Repository navigation
Conversation
…wiring (trailhq#829) User-scope agent wiring (~/.claude/helpers/*.cjs, ~/.claude/skills, the graft MCP entry in ~/.claude.json) made the home folder look like a wired repository: wiredHostIds(~) reads ~/.claude/helpers, so a version-change upkeep ran a full wiring refresh against ~ — clearOldLayout deleted the user-scope helpers and skills, and disableGraftServerIn disabled the graft MCP server with nothing registered in its place, on every version change. reconcileWiring now gives the home folder the same refusal "trail init" already gives it (homeFolderRefusal), before anything is read or written: no stamp replay, no rewrite, no deletion. The guard is positional — only ~ itself is refused; a real repository under the same home refreshes exactly as before. The explicit-init path was already guarded in runInitCommand; this closes the automatic path, which is the one that fired without the person choosing anything.
b07ecb6 to
0c7c67e
Compare
🌱 graft blast radius1 area changed → 3 areas can be affected. 3 dependent symbols, depth 2. flowchart TB
A0(("Claude Hooks<br/>1 symbol"))
A1(("Upkeep Execution<br/>1 symbol"))
A2(("MCP Server<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2 reached;
Who knows this code — 2 people across 4 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 3 dependent symbols, grouped by areaClaude Hooks — 1 symbol in 1 file
Upkeep Execution — 1 symbol in 1 file
MCP Server — 1 symbol in 1 file
Test signal per changed area — 1 ✓Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
4 test suites also reference this code4 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
Fixes #829.
Root cause
wiredHostIds(~)reads~/.claude/helpers/*.cjs— user-scope agent wiring — as if it were repository wiring. On a version change,reconcileWiring(~)then finds hosts "wired", runs the full rewrite path against the home folder, andclearOldLayoutdeletes the user-scope helpers and skills whiledisableGraftServerIndisables the graft MCP server inprojects[~]— with trail mode registering no replacement. It repeats on every version change.Fix
reconcileWiringnow refuses the home folder before reading or writing anything — the samehomeFolderRefusalthe explicittrail initcommand already gives (runInitCommand), applied to the automatic path that fired without the person choosing anything. SincerewriteWiring(and thereforerunInit,clearOldLayout, anddisableGraftServerIn) is only reachable throughreconcileWiringon the upkeep path, this one guard closes the whole chain.The guard is positional: only
~itself is refused. A real repository under the same home refreshes exactly as before.Tests (RED→GREEN, adversarial)
.claude/helpers/graft-hooks.cjs): reconcile returns null, the rewrite spy never fires, the helper file survives;