Skip to content

Commit 458687d

Browse files
author
Anton
committed
feat: ship Claude Code plugin in-tree (#7)
Phase-scoped skills layered on the existing raysense MCP server, packaged as a Claude Code plugin alongside the crate. Layout: .claude-plugin/marketplace.json # source -> ./claude-plugin claude-plugin/ .claude-plugin/plugin.json .mcp.json # registers `raysense --mcp` skills/ raysense-bootstrap/SKILL.md # session start: scan + baseline + memory raysense-impact/SKILL.md # before edits: blast radius + coupling raysense-verify/SKILL.md # after edits: rescan + rule check + diff raysense-audit/SKILL.md # on demand: architecture + dsm + evolution Each skill is a short markdown playbook over MCP tools that already exist in src/mcp.rs:137 (verified: every raysense_* name referenced across all four SKILL.md files resolves in the tool registry). Multi-codebase isolation is cwd-driven: every skill passes path: $CWD; per-project state stays in <repo>/.raysense/. Two CC sessions on two repos = two MCP processes, two on-disk state trees, zero cross-project bleed. No new Rust code; cargo test still 123/123 green. Install path: cargo install raysense /plugin marketplace add RayforceDB/raysense /plugin install raysense Co-authored-by: Anton <anton.kundenko@gmail.com>
1 parent 56eb634 commit 458687d

7 files changed

Lines changed: 244 additions & 0 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3+
"name": "raysense-marketplace",
4+
"version": "0.1.0",
5+
"description": "Raysense — architectural X-ray for your codebase, exposed to AI coding agents through MCP",
6+
"owner": {
7+
"name": "Anton Kundenko",
8+
"email": "anton.kundenko@gmail.com"
9+
},
10+
"plugins": [
11+
{
12+
"name": "raysense",
13+
"description": "Phase-scoped skills (bootstrap / impact / verify / audit) over the raysense MCP server. Surfaces structural health, blast radius, dependency cycles, and persisted memory to coding agents.",
14+
"version": "0.1.0",
15+
"author": {
16+
"name": "Anton Kundenko",
17+
"email": "anton.kundenko@gmail.com"
18+
},
19+
"source": "./claude-plugin",
20+
"category": "development"
21+
}
22+
]
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "raysense",
3+
"version": "0.1.0",
4+
"description": "Architectural telemetry for AI coding agents. Phase-scoped skills over the raysense MCP server: scan + baseline at session start, blast-radius before edits, regression diff after, on-demand architecture audits.",
5+
"author": {
6+
"name": "Anton Kundenko",
7+
"email": "anton.kundenko@gmail.com"
8+
},
9+
"homepage": "https://github.com/RayforceDB/raysense",
10+
"repository": "https://github.com/RayforceDB/raysense",
11+
"license": "MIT",
12+
"keywords": [
13+
"architecture",
14+
"code-quality",
15+
"mcp",
16+
"agent-loop",
17+
"structural-health",
18+
"coupling",
19+
"cycles",
20+
"blast-radius",
21+
"memory",
22+
"raysense"
23+
]
24+
}

claude-plugin/.mcp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"raysense": {
4+
"command": "raysense",
5+
"args": ["--mcp"]
6+
}
7+
}
8+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: raysense-audit
3+
description: Use when the user explicitly asks for a structural audit, architecture review, dead-code report, test-gap analysis, or evolution hotspot scan. Heavier and noisier than the other raysense skills — only run on demand, not as part of the routine edit loop.
4+
---
5+
6+
# Raysense Audit
7+
8+
This skill is for deliberate "look at the whole codebase" requests.
9+
It calls multiple raysense MCP tools and produces a multi-section
10+
report. Do not run it as part of routine edits — it is loud by design
11+
and will pollute the working context.
12+
13+
All tools take a `path` argument; pass the current repo root.
14+
15+
## Steps
16+
17+
1. **Architecture** — call `raysense_architecture`. Reports root
18+
causes, cycles by SCC, layer levels, and unstable modules. Lead
19+
the report with the worst root cause.
20+
2. **DSM** — call `raysense_dsm` for the module dependency matrix and
21+
level assignments. Useful for showing the user the *shape* of the
22+
project, not just the metrics.
23+
3. **Evolution** — call `raysense_evolution`. Surfaces bus factor,
24+
change-coupling pairs (files that change together), and temporal
25+
hotspots (commits × max complexity).
26+
4. **Test gaps** — call `raysense_test_gaps`. Files without nearby
27+
tests, ranked by risk.
28+
5. **Optional dashboard** — call `raysense_visualize` if the user
29+
asked for something they can browse. Writes a self-contained HTML
30+
file the user can open.
31+
32+
## Report structure
33+
34+
When summarising back to the user, lead with the *one* finding that
35+
matters most — usually the worst architectural root cause or the
36+
highest-risk untested file. Long lists overwhelm; a single
37+
prioritized headline plus a short table of next-three-things tends to
38+
land better.
39+
40+
## When to skip
41+
42+
- The user asked a narrow question. Use `raysense-impact` or a
43+
single targeted MCP call instead.
44+
- The repo is tiny (under ~50 files). The audit will produce mostly
45+
noise — just call `raysense_health` and read out the grade.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: raysense-bootstrap
3+
description: Use at the start of any coding session in a repository to scan the structure, save a baseline, and materialize splayed-table memory for fast follow-up queries. Establishes the "before" reference point that raysense-verify diffs against later.
4+
---
5+
6+
# Raysense Bootstrap
7+
8+
Run this once per session, before any non-trivial edits. It produces a
9+
persisted baseline plus live splayed-table memory that the other
10+
raysense skills (`raysense-impact`, `raysense-verify`,
11+
`raysense-audit`) read against.
12+
13+
All tools take a `path` argument. Always pass the current working
14+
directory as an absolute path so per-project state stays inside the
15+
repo (`<repo>/.raysense/`).
16+
17+
## Steps
18+
19+
1. **Health overview** — call `raysense_health` with `path: <cwd>`.
20+
Note the overall grade and the worst dimension.
21+
2. **Save the baseline** — call `raysense_baseline_save` with
22+
`path: <cwd>`. This writes `<cwd>/.raysense/baseline/manifest.json`
23+
plus splayed tables under `<cwd>/.raysense/baseline/tables/`.
24+
3. **Confirm memory is live** — call `raysense_memory_summary` with
25+
`path: <cwd>`. Report the row/column counts so the user can see the
26+
memory is materialized.
27+
4. **Surface the top 3 hotspots** — call `raysense_hotspots` and
28+
`raysense_rules`. List the three highest-traffic files and any
29+
already-failing rules. These are the spots most likely to bite
30+
during the session.
31+
32+
## What to keep in working memory
33+
34+
After bootstrap, the agent should remember (briefly):
35+
36+
- The overall health grade and the lowest-scoring dimension.
37+
- The three hottest files (high coupling × high churn).
38+
- Whether any rules are currently failing (so a later regression isn't
39+
mistaken for pre-existing breakage).
40+
41+
## When to skip
42+
43+
- Session is read-only (the user just asked a question — no edits
44+
planned). Skip bootstrap; reach for `raysense-audit` instead if
45+
structural context is needed.
46+
- A baseline already exists from a recent session and no commits have
47+
landed since (`git log -1 --since='1 hour ago'` shows nothing).
48+
Re-using the previous baseline is fine; just call `raysense_health`
49+
for a fresh grade and skip the rest.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: raysense-impact
3+
description: Use before refactoring, deleting, moving, or substantially modifying a file to compute its blast radius, coupling profile, and cycle exposure. Lets the agent edit with awareness of downstream effects rather than discovering them after the fact.
4+
---
5+
6+
# Raysense Impact
7+
8+
Call this *before* a non-trivial edit (deletion, rename, signature
9+
change, extraction, file move). It tells the agent what depends on the
10+
target and what the target depends on, so the edit plan can account
11+
for the blast radius up front.
12+
13+
All tools take a `path` argument (absolute, current repo root) plus
14+
the target file path relative to that root.
15+
16+
## Steps
17+
18+
1. **Blast radius** — call `raysense_blast_radius` with `path: <cwd>`
19+
and `file: <target>`. Returns the set of files reachable downstream
20+
under the active edge filter. A blast radius >20 files is a strong
21+
signal to break the change into smaller commits.
22+
2. **Coupling profile** — call `raysense_coupling`. Look up the
23+
target's module in the response: afferent (incoming) and efferent
24+
(outgoing) counts, plus main-sequence distance. High-afferent
25+
modules are stable foundations — breaking changes there cascade
26+
widely.
27+
3. **Cycle exposure** — call `raysense_cycles`. If the target appears
28+
in any reported cycle, call
29+
`raysense_break_cycle_recommendations` for ranked candidate edges
30+
to remove. The recommended edge is often *not* the obvious one.
31+
4. **Optional simulation** — when the planned change is mechanical
32+
(file removal, edge removal), call `raysense_what_if` to preview
33+
the health delta without touching the working tree.
34+
35+
## What to keep in working memory
36+
37+
- Number of files in the blast radius — quote it back to the user
38+
before starting an edit that exceeds 20.
39+
- Whether the target is on any cycle — informs whether the edit is
40+
likely to introduce or break a cycle.
41+
- The `instability` score — a value near 1.0 means the file is
42+
expected to depend on stable foundations, not be one.
43+
44+
## When to skip
45+
46+
- Local-only edit inside one file with no signature changes (typo
47+
fix, comment, internal rename). No downstream effect, no need.
48+
- Brand-new file. Nothing depends on it yet.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: raysense-verify
3+
description: Use after completing a logical chunk of edits to rescan the project and detect new rule violations or health regressions against the session baseline. Catches structural regressions before they reach review.
4+
---
5+
6+
# Raysense Verify
7+
8+
Call this after a meaningful chunk of edits — typically before
9+
suggesting the user run tests or commit. It rescans the project and
10+
diffs the result against the baseline that `raysense-bootstrap`
11+
established.
12+
13+
All tools take a `path` argument; pass the current repo root as an
14+
absolute path.
15+
16+
## Steps
17+
18+
1. **Rescan** — call `raysense_rescan` with `path: <cwd>`. Forces a
19+
fresh walk; uses cached config and plugin state.
20+
2. **Rule status** — call `raysense_check_rules`. Pass/fail per rule.
21+
A rule that was passing at bootstrap and is failing now is a
22+
regression to flag explicitly.
23+
3. **Baseline diff** — call `raysense_baseline_diff` with
24+
`path: <cwd>`. Health-dimension deltas vs the saved baseline.
25+
Anything that dropped a grade letter (B → C, etc.) is worth
26+
surfacing.
27+
4. **Remediations on regression** — if step 2 or 3 reports
28+
regressions, call `raysense_remediations` for suggested fixes.
29+
Surface the regression *and* the suggestion to the user before
30+
continuing.
31+
32+
## What to surface to the user
33+
34+
Be concise. The user does not want a wall of metrics. A good verify
35+
report is:
36+
37+
- "Rules: all pass" *or* "Rules: 1 new failure (`max_blast_radius`,
38+
was 18 / threshold 25 / now 27)."
39+
- "Baseline diff: modularity B → C-, redundancy stable, others
40+
unchanged." Only the dimensions that moved.
41+
42+
## When to skip
43+
44+
- Edits were limited to comments, docs, or config that does not
45+
affect imports.
46+
- The session bootstrapped less than a minute ago and the working
47+
tree shows trivial changes (`git diff --stat` is one or two lines).

0 commit comments

Comments
 (0)