@sabaiway/agent-workflow-kit 17.0.0 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,73 @@ Semantically versioned ([semver](https://semver.org)), newest first. The `versio
4
4
  is the current release. `upgrade` mode reads a project's `docs/ai/.workflow-version` and applies
5
5
  every `migrations/<version>-<slug>.md` newer than it, in semver order.
6
6
 
7
+ ## 19.0.0 — the Jev copy is written current with no question beside a copy at a kit pin; `jev-skill.earlier` retires (AD-210)
8
+
9
+ **MAJOR: the advisor's `jev-skill.earlier` item is gone, and `apply-danger-check --variant jev-skill.earlier` is a
10
+ usage refusal, exit 2.** Before, the vendor's Jev skill copy in the agent skill roots was never updated silently: a copy
11
+ at an earlier pin was replaced only on your yes to `jev-skill.earlier`, and an absent root was filled only on your yes
12
+ to the `jev-skill` offer, both shown only once `TYPESAFE_API_KEY` was set. Now a copy whose two files match a pin the
13
+ kit shipped is the kit's, and beside one such copy in any of the three roots (`~/.agents/skills`, the Claude Code skills
14
+ dir, `~/.gemini/config/skills`) every root absent or behind the kit's pin is written with no question. A copy matching
15
+ no pin, a link or any other node there is yours: left untouched and named.
16
+
17
+ - **A new kit item, `jev-skill.not-current`.** Beside a copy at a kit pin the advisor renders this `lane: kit` item,
18
+ which the agent applies with no question by the kit route, whatever the key and whatever decline you recorded. Its
19
+ text reads `Jev's vendor skill is absent or behind the kit's pin in {n} agent skill root(s) beside a copy at a kit
20
+ pin — written with no question`, and its `recipe:` line names every root its apply writes and each foreign copy it
21
+ leaves.
22
+ - **The offer is for a first install only.** Where no root holds a copy at a kit pin, the `jev-skill` offer is
23
+ unchanged — the key gate, the decline, your yes — and its text now reads `a skill root the kit fills is absent`.
24
+ - **The danger check** for the kit item admits the skill roots only while it judges the component accepted itself;
25
+ over a home with no copy at a kit pin it admits nothing, so each planned write prints `refused:`, exit 1, and the
26
+ no-question apply installs nothing there. A copy at a kit pin removed between the check and the writer's own read is
27
+ not seen: the writer still fills every root it plans. A copy the vendor's `skills` CLI wrote with the same bytes
28
+ counts as a copy at a kit pin.
29
+ - **The skill command's line.** `jev-skill.mjs --apply` prints `leftover: <path> — <cause>` where it printed
30
+ `kept aside:`; its plan, argv and exit codes are unchanged. A script that read `kept aside:` reads `leftover:`.
31
+ - **The texts say the same.** The skill command's header, which now names the four routes that apply it; the jev and
32
+ recommendations modes; `references/advisor-writers.md`; the guide's *Reserved names and channels*, which names the
33
+ vendor skill copy at a kit pin as the kit's.
34
+
35
+ ## 18.0.0 — the kit's two hook files are written current within a hook you wired; `gate-hook --reseed` and three advisor items retire (AD-209)
36
+
37
+ **MAJOR: `gate-hook.mjs --reseed` is removed, and the advisor's `gate-hook.marker-stale`, `read-lane.stale` and
38
+ `read-lane.missing` items are gone.** Before, a placed gate hook that differed from the kit's was preserved by
39
+ `gate-hook --apply`; the advisor offered the reseed route, on your yes, in two states only: a declaration carrying
40
+ `lcovProducer`, and an enabled read-lane. A wired gate hook whose file was missing got `read-lane.missing`, whose apply
41
+ was `gate-hook --apply`; a wired state-block hook whose file was missing was never offered at all. Now one rule covers
42
+ both kit hook files, `.claude/hooks/agent-workflow-gates.mjs` and `.claude/hooks/state-block-guard.mjs`: within a hook
43
+ you wired (for the gate hook, a `PreToolUse` `Bash` entry running its command; for the state-block hook, a `Stop` entry
44
+ whose command names `state-block-guard.mjs`, whichever copy it runs — in `.claude/settings.json` or
45
+ `.claude/settings.local.json`), an absent file is placed and one whose bytes
46
+ differ is written with the body the kit writes for it, in place, with no question and no copy kept. Wiring stays
47
+ yours: an unwired hook keeps its `gate-hook` or `state-block` offer and your yes.
48
+
49
+ - **Two new kit items, `gate-hook.not-current` and `state-block.not-current`.** Over a wired hook whose file is absent
50
+ or differs, the advisor renders this `lane: kit` item, which the agent applies with no question by the kit route. Its
51
+ text reads `<the hook file> is absent or differs from the body the kit writes for it — written with that body, with
52
+ no question`, and its detail names the one file its apply writes. A stale stamp beside it is the upgrade-first skip.
53
+ - **`gate-hook --apply` writes a differing file.** It places an absent hook file, writes a differing one with the
54
+ bundled body in place, leaves a current one, and wires the entry only while it is wired in neither settings file —
55
+ so over a wired hook it writes the file alone. A differing file under an unwired hook is no longer refused: your yes
56
+ to the offer writes and wires it.
57
+ - **The line.** A differing kit hook file reads `differs from the body the kit writes for it — written with that body;
58
+ a hook of your own goes in .claude/hooks/<name>.local.mjs` (on a dry run, `would be written with that body`), from
59
+ both hook writers. No line says preserved or reseed.
60
+ - **The danger check** for a kit hook item admits only that hook file and its folders, and only while it judges the
61
+ hook wired; over an unwired hook it admits nothing (`refused:`, exit 1), so the no-question apply never wires a hook.
62
+ - **`read-lane` is the enable offer alone.** It renders while the hook is wired and the lane is off; a stale or absent
63
+ hook under it is written by `gate-hook.not-current` first. The `--read-lane` currency refusal now names
64
+ `gate-hook --apply`.
65
+ - **`--reseed` is gone, with no alias.** `gate-hook.mjs --reseed` now stops with `unknown argument: --reseed`, exit 2.
66
+ No migration note is owed: every line that printed it — the retired items `gate-hook.marker-stale` and
67
+ `read-lane.stale`, the writer's refusals, its diverged line and `--help` — is gone or now names `gate-hook --apply`,
68
+ and a script that ran `--apply --reseed` runs `gate-hook.mjs --apply`.
69
+ - **The texts say the same.** The writer's header and `--help`; the hook, gates, state-block-guard and recommendations
70
+ modes; `references/advisor-writers.md`; the README's hook and state-block-guard rows; the guide's *Reserved names and
71
+ channels*, which names the two hook files and gains a seventh channel, `.claude/hooks/<name>.local.mjs`, for a hook
72
+ of your own, which you wire.
73
+
7
74
  ## 17.0.0 — every kit agent file is written current with no question; `--executor` and `executor-vehicle.differing` retire (AD-208)
8
75
 
9
76
  **MAJOR: `cheap-agents.mjs --executor` is removed, and the advisor's `executor-vehicle.differing` item is gone.** Before,
package/README.md CHANGED
@@ -264,8 +264,8 @@ file), or run the guarded `/agent-workflow-kit uninstall`.
264
264
  | `/agent-workflow-kit uninstall` | opt-in, any time | **guarded teardown** — the inverse of `init` / `setup`. Removes only what's **provably ours** (managed skill dirs + bridge wrappers; in a project, the hidden-mode git-ignore block it added + the pre-commit hook it installed); **never deletes** your `docs/ai` / `AGENTS.md` (prints the exact `rm` to run by hand) or your `.claude/settings.json` (prints an **edit** — remove the attribution key, review any velocity `permissions.*` — never an `rm`). Always `--dry-run` first; preflight-then-mutate; never commits. |
265
265
  | `/agent-workflow-kit velocity` | Claude Code · opt-in | **onboarding velocity profile** — seeds a fixed, audited **read-only** allowlist into `.claude/settings.json` so routine read-only commands stop idling on approval prompts while you're away; every allowlist apply (flagless, `--kit-tools`, `--bridge-tier`) also seeds one `permissions.ask` rule, so all work can stay in auto mode: without it auto mode refuses a harness or kit apply (the `apply:` line of each harness or kit item the upgrade advisor renders) and you must leave auto mode for it; with it the harness shows its usual dialog — the rule allows nothing; opt-in `acceptEdits`; plus a **read-only advisory** of likely project gate commands to add by hand. Writes `.claude/settings.json`; a fourth opt-in, `--worktrees`, writes the worktrees grant into the local settings, `.claude/settings.local.json`, alone — **never** allowlists commit/push/publish, never commits. A seeded entry is a **trust posture, not a sandbox** (a runtime residual remains at the settings level — its guard ships as the opt-in `hook` command); a direct commit/push/publish still asks. `--dry-run` first. |
266
266
  | `/agent-workflow-kit agents` | Claude Code · opt-in | **subagent vehicles** — places the five bundled subagent definitions into `.claude/agents/`: **four read-only vehicles + one full-tool `executor`**. **No read-only vehicle gets `Bash`**, and that is the load-bearing property: a read-only fan-out on a full-tool subagent shells out for facts it could have read, and every shelled command is an approval prompt you never needed to see. Three of the four ride a **cheap model** (haiku, low effort) for mechanical work — extraction sweeps, changelog fact-skeletons, gate-failure triage; the fourth, **`review-lens`**, is an ADDITIONAL independent read-only review opinion on code your configured backends have already seen (never a replacement for your plan or diff review recipe, advisory like every review; an epic is reviewed by the lens alone, whatever `epic.review` resolves to). The fifth, **`executor`** (all tools; model and effort from `docs/ai/vehicles.json`), is the ONE vehicle with a shell and the instrument behind the **Subagent** recipe: dispatched only for a bounded, file-disjoint execution / authoring / routine slice you verify afterwards — never for read-only work, never as a review backend, and it never commits. Its state (`placed` / `customized` / `unusable` / `missing`) is what a `subagent` slot's readiness resolves from. Writing code and running gates stay off the four read-only vehicles; the executor carries a bounded slice you re-verify on your main lane, and every vehicle's output is verified. Preview by default (`--apply` writes); every kit agent file (the five bundled names and each configured roster-derived lens) is **written current with no question** — an absent one placed, a differing one written with the body the kit writes for it, the executor's and the bundled `review-lens`'s (opus / high by default, set in the file's optional `review-lens` section) derived from `docs/ai/vehicles.json`, no copy kept; a link at a kit agent path stops the run naming it, nothing written; a vehicle of your own goes in `.claude/agents/<name>.local.md` with a `name:` of its own; never touches `settings*.json`, never commits. |
267
- | `/agent-workflow-kit hook` | Claude Code · opt-in | **gate-approval hook** — places a self-contained PreToolUse hook (`.claude/hooks/`) and wires it into `.claude/settings.json`: a Bash command **byte-identical** to a gate you declared in `docs/ai/gates.json` (run from the project root) is auto-approved — no prompt, no idle; a seeded read-only command carrying a runtime residual (output redirection, command substitution, `--output` writes) now **asks** even where an allow rule would have silently passed it (proven live — hook `ask` overrides an allow rule). Detection is a conservative string scan, so it over-asks on a byte that is ordinary text — searching for `=>`, or a read wearing `2>/dev/null`, prompts. That is a documented open limit: 4.1.0 built three mechanisms to narrow it and removed all three in review, each counterexample kept as a test (see Mode: hook). Exact matches only, never patterns; never `deny`; a broken `gates.json` only disables auto-approval, never the guard. An opt-in **read-lane** (`--read-lane` → `docs/ai/lanes.json`, a **separate** file from `gates.json`) additionally auto-approves *compounds* of seeded read-only commands carrying no shell metaprogramming; `--apply --read-lane` verifies the placed hook is current first; a stale or diverged placed hook is replaced by the reseed route (`--apply --reseed`, the bundled bytes in place). Preview by default; never writes `settings.local.json`; never commits. |
268
- | `/agent-workflow-kit state-block-guard` | Claude Code · opt-in | **closing-block detector** — a `Stop` hook that reads the turn's final assistant message and warns when the closing state block is defective: the «what I need from you» slot answering *nothing* (a turn that ENDS always needs a resume, so the answer is false, not merely unhelpful), or a first-person promise of imminent work in a turn that is over. Judged on the slot's first clause, so a real ask followed by a clause break and "nothing else" passes, and a promise gated on something named passes; matching is word-bounded and Unicode-aware, quoted and fenced examples are stripped, and the last STARTED block decides — an incomplete tail counts as no block rather than falling back to an earlier one. A message carrying no block at all is silent unless you pass `--require-block` — this kit does not mandate the block, and a hook that runs every turn must not warn every turn. The judgement is lexical and the mode doc names every residual it leaves. **Detection, never prevention** — a `Stop` hook cannot un-send the message it judges; what it buys is that a silent recurrence becomes a visible one. Warns via `systemMessage` and **exits 0 on every path**: never `deny`, never blocks the stop, never re-enters the model. Reads nothing but the message, makes no network call, approves nothing. Its writer is `tools/state-block-hook.mjs`: it places the self-contained hook and merges its `Stop` entry into `.claude/settings.json` by the three merge cases, keeping every foreign hook — the agent applies it on the chat yes after the danger check. |
267
+ | `/agent-workflow-kit hook` | Claude Code · opt-in | **gate-approval hook** — places a self-contained PreToolUse hook (`.claude/hooks/`) and wires it into `.claude/settings.json`: a Bash command **byte-identical** to a gate you declared in `docs/ai/gates.json` (run from the project root) is auto-approved — no prompt, no idle; a seeded read-only command carrying a runtime residual (output redirection, command substitution, `--output` writes) now **asks** even where an allow rule would have silently passed it (proven live — hook `ask` overrides an allow rule). Detection is a conservative string scan, so it over-asks on a byte that is ordinary text — searching for `=>`, or a read wearing `2>/dev/null`, prompts. That is a documented open limit: 4.1.0 built three mechanisms to narrow it and removed all three in review, each counterexample kept as a test (see Mode: hook). Exact matches only, never patterns; never `deny`; a broken `gates.json` only disables auto-approval, never the guard. An opt-in **read-lane** (`--read-lane` → `docs/ai/lanes.json`, a **separate** file from `gates.json`) additionally auto-approves *compounds* of seeded read-only commands carrying no shell metaprogramming; `--apply --read-lane` verifies the placed hook is current first. Within a hook you wired, its file is placed when absent and written with the kit's body when it differs, with no question and no copy kept (the upgrade's `gate-hook.not-current`); a hook of your own goes in `.claude/hooks/<name>.local.mjs`, which you wire. Preview by default; never writes `settings.local.json`; never commits. |
268
+ | `/agent-workflow-kit state-block-guard` | Claude Code · opt-in | **closing-block detector** — a `Stop` hook that reads the turn's final assistant message and warns when the closing state block is defective: the «what I need from you» slot answering *nothing* (a turn that ENDS always needs a resume, so the answer is false, not merely unhelpful), or a first-person promise of imminent work in a turn that is over. Judged on the slot's first clause, so a real ask followed by a clause break and "nothing else" passes, and a promise gated on something named passes; matching is word-bounded and Unicode-aware, quoted and fenced examples are stripped, and the last STARTED block decides — an incomplete tail counts as no block rather than falling back to an earlier one. A message carrying no block at all is silent unless you pass `--require-block` — this kit does not mandate the block, and a hook that runs every turn must not warn every turn. The judgement is lexical and the mode doc names every residual it leaves. **Detection, never prevention** — a `Stop` hook cannot un-send the message it judges; what it buys is that a silent recurrence becomes a visible one. Warns via `systemMessage` and **exits 0 on every path**: never `deny`, never blocks the stop, never re-enters the model. Reads nothing but the message, makes no network call, approves nothing. Its writer is `tools/state-block-hook.mjs`: it places the self-contained hook and merges its `Stop` entry into `.claude/settings.json` by the three merge cases, keeping every foreign hook — the agent applies it on the chat yes after the danger check. Within the wired hook its runtime file is written with the kit's body when absent or differing, with no question (the upgrade's `state-block.not-current`); a hook of your own goes in `.claude/hooks/<name>.local.mjs`, which you wire. |
269
269
  | `/agent-workflow-kit bridge-settings` | opt-in, any time | **host-level bridge settings** — read or change the bridges' `KEY=VALUE` config file (`${XDG_CONFIG_HOME:-~/.config}/agent-workflow/bridge-settings.conf`), the **one place a knob survives kit upgrades** (it lives outside every kit tree; a refresh never touches it, and now states loudly if it ever overwrote a local edit). The **model each bridge runs**: `CODEX_MODEL` + `CODEX_EFFORT` (default `gpt-6.1-sol` at `high`) and `AGY_MODEL` (default `Gemini 3.8 Flash (High)`) — the read-out shows the models each installed CLI offers, and a set one is checked against that list before anything is written. Other knobs: the **codex Fast tier** (`CODEX_SERVICE_TIER=priority` — "2x speed, **increased usage**" in the catalog's own words, quality-neutral, default off — a consented spend), the codex/agy hard timeouts, the codex review byte cap, and `AGY_REVIEW_MAX_TOTAL_BYTES` (the ceiling on what an oversized agy code review may feed before it refuses pre-spend). `AGY_REVIEW_ALLOW_ADDDIR` is a **retired** compatibility key: still recognized so an existing line never warns as unknown, but it arms nothing — the writer refuses to set it and `--unset` clears it. Allowed keys + value rules come from the bundled bridge manifests. **Previews by default**; refuses an unknown key, an out-of-range value, a model or effort the catalog does not offer, or a duplicate-carrying file; writes atomically (symlink/TOCTOU-safe). Never commits, never runs a model (only the read-only catalog commands). |
270
270
  | `/agent-workflow-kit autonomy-doctor` | opt-in, any time | **guarded sandbox provisioner "doctor"** — can this machine run the Claude sandbox, and (only with your consent) fix it: macOS Seatbelt built-in / Linux+WSL2 needs `bwrap`+`socat` / native Windows → WSL2. Flagless = **FS-only preview** (the diagnosis, the exact absolute-path command it WOULD run, the exact `--apply <pm>:<pkgs>` consent tuple — runs nothing, never claims ready); `--verify` runs the unprivileged proof (a `bwrap` user-namespace smoke + `socat -V`) — the **only** source of a Linux "ready (verified)" claim; `--apply <pm>:<pkgs>` is the consent-gated privileged install (the tuple must equal the previewed plan; everything executed resolves to absolute paths inside `/usr/bin:/bin:/usr/sbin:/sbin`; the exact command is re-printed immediately before execution), then verifies. Honest loud degrades (unknown PM, untrusted location, nested-sandbox INDETERMINATE, root-unproven) and a stated restart step. Sits **outside every velocity auto-approve tier**; never auto-runs, never writes repo files, never commits. |
271
271
 
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: agent-workflow-kit
3
3
  description: Deploy or upgrade a portable AI-agent memory-and-workflow system in any project. Use when the user wants to bootstrap `docs/ai/` + an entry-point `AGENTS.md` (+ `CLAUDE.md` alias) + cap/archive/index enforcement in a new or existing repo, set up the Memory Map and session protocols, install the docs-rotation pre-commit hook, or run `/agent-workflow-kit` / `/agent-workflow-kit upgrade`. Triggers on phrases like "set up the memory system", "deploy the AI workflow here", "bootstrap docs/ai", "upgrade the workflow". New to the epic, story and task tier? Run `/agent-workflow-kit tier`. A typed decision with a confidence from Jev? Run `/agent-workflow-kit jev`.
4
4
  disable-model-invocation: true
5
5
  metadata:
6
- version: '17.0.0'
6
+ version: '19.0.0'
7
7
  ---
8
8
 
9
9
  # agent-workflow-kit
package/capability.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "agent-workflow-kit",
5
5
  "kind": "composition-root",
6
- "version": "17.0.0",
6
+ "version": "19.0.0",
7
7
  "provides": [],
8
8
  "roles": {},
9
9
  "detect": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabaiway/agent-workflow-kit",
3
- "version": "17.0.0",
3
+ "version": "19.0.0",
4
4
  "description": "Portable, cross-agent memory & workflow for AI coding agents — Claude Code, Codex, Cursor, Devin Desktop. One command deploys an AGENTS.md entry point + docs/ai context with cap/archive/index enforcement into any repo.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -25,14 +25,13 @@
25
25
  | source-size.schema-1 | chat | source-size-check.mjs |
26
26
  | source-size.layout | chat | source-size-check.mjs |
27
27
  | gate-hook | harness | gate-hook.mjs |
28
- | gate-hook.marker-stale | harness | gate-hook.mjs |
28
+ | gate-hook.not-current | kit | gate-hook.mjs |
29
29
  | commit-guard | harness | git-hooks.mjs |
30
30
  | hook-checks | harness | git-hooks.mjs |
31
31
  | enforcement | harness | git-hooks.mjs |
32
32
  | read-lane | chat | gate-hook.mjs |
33
- | read-lane.stale | harness | gate-hook.mjs |
34
- | read-lane.missing | harness | gate-hook.mjs |
35
33
  | state-block | harness | state-block-hook.mjs |
34
+ | state-block.not-current | kit | state-block-hook.mjs |
36
35
  | mcp-channel | harness | mcp.mjs |
37
36
  | mcp-channel.differing | harness | mcp.mjs |
38
37
  | agents | harness | cheap-agents.mjs |
@@ -49,5 +48,5 @@
49
48
  | profile-gap | chat | rules-insert.mjs, tier-preview.mjs, checker-gates.mjs |
50
49
  | jev-connect | user | user step |
51
50
  | jev-skill | harness | jev-skill.mjs |
52
- | jev-skill.earlier | harness | jev-skill.mjs |
51
+ | jev-skill.not-current | kit | jev-skill.mjs |
53
52
  | spec-adoption.adopting | chat | ack-write.mjs |
@@ -99,10 +99,14 @@ customization: every kit script, the spec layer's four pair files (`scripts/spec
99
99
  included, the hook installer set, the kit rules files `docs/ai/rules/<theme>.md` and the kit agent
100
100
  files (the five the kit bundles for `.claude/agents/` — `changelog-skeleton.md`, `executor.md`,
101
101
  `gate-triage.md`, `mechanical-sweep.md`, `review-lens.md` — and each configured
102
- `review-lens-<model>-<effort>.md`) are written over by the next upgrade with no question and no copy
103
- kept. A declaration seeded once from a template and never
102
+ `review-lens-<model>-<effort>.md`) and, within a hook you wired, the kit hook files
103
+ `.claude/hooks/agent-workflow-gates.mjs` and `.claude/hooks/state-block-guard.mjs` are written over
104
+ by the next upgrade with no question and no copy kept.
105
+ Also the kit's: the vendor skill copy the kit installs into the three agent skill roots
106
+ when it matches a pin the kit shipped, written with no question beside a copy at a kit pin;
107
+ a copy matching none is the user's, left and named. A declaration seeded once from a template and never
104
108
  replaced by the upgrade's ensures (a migration rewrites one only on the user's explicit yes) is the
105
- user's own file. A customization goes into one of six channels instead:
109
+ user's own file. A customization goes into one of seven channels instead:
106
110
 
107
111
  - **Your own commit checks** go in the local hook file `scripts/pre-commit.local`: the managed
108
112
  pre-commit hook runs it first, once the installer has run.
@@ -112,6 +116,7 @@ user's own file. A customization goes into one of six channels instead:
112
116
  - **An agent's model** goes in the vehicle settings `docs/ai/vehicles.json`.
113
117
  - **A vehicle of your own** goes in `.claude/agents/<name>.local.md` with a `name:` of its own, which
114
118
  no review roster names; a lens of your own in a review slot keeps a stem of its own.
119
+ - **A hook of your own** goes in `.claude/hooks/<name>.local.mjs`, which you wire.
115
120
 
116
121
  No path segment of a file the kit bundles and places as its own has a dot-separated part exactly
117
122
  `local`; a path of that form is the user's, and no kit tool writes one on its own. Outside that rule:
@@ -40,7 +40,7 @@ Declared gates can also be **auto-approved** (no permission prompt on a byte-exa
40
40
 
41
41
  **A declared checker is read in THREE outcomes, not two.** `gates-inert.producer-unrecognized` — no producer anywhere in the declaration, over a tracked tree the changed-line domain cannot reach: the remedies are the marker above or dropping the checker, never a `node --test` prescription and never an acknowledgement (a dead pair is broken, not narrow). `gates-inert.coverage-domain-narrow` — the pair IS live and the tree is still dominated by what the domain excludes: certification covers the assessable minority, a FACT that converges on a `coverage-domain` acknowledgement. The census is the TRACKED tree (`git ls-files`) in this same closed vocabulary; dominance is STRICT (a tie, or a lone `.d.ts` beside real JS, never fires), and a tree it cannot read is a stated skip — no census, no optimality claim. A producer declared AFTER the checker is neither outcome: it keeps the ORDERING remedy above. Each outcome's convergence and posture note live in `${CLAUDE_SKILL_DIR}/references/modes/recommendations.md`.
42
42
 
43
- **A marker-carrying declaration needs a CURRENT placed hook.** The gate-approval hook restates this schema in its own baked copy and goes dark on any key it does not know (`${CLAUDE_SKILL_DIR}/references/modes/hook.md`), so a declaration carrying the key under a hook that predates it silently switches auto-approval off — every gate prompting again, no error anywhere. The condition is the key's PRESENCE: an older hook rejects a key it does not know whatever the value, so `"lcovProducer": false` darkens it exactly as `true` does. The recovery is the reseed route: `node ${CLAUDE_SKILL_DIR}/tools/gate-hook.mjs --apply --reseed --cwd <project>` replaces the placed hook with the bundled bytes in place — the advisor's `gate-hook.marker-stale` item, which the agent applies on the chat yes after the danger check.
43
+ **A marker-carrying declaration needs a CURRENT placed hook.** The gate-approval hook restates this schema in its own baked copy and goes dark on any key it does not know (`${CLAUDE_SKILL_DIR}/references/modes/hook.md`), so a declaration carrying the key under a hook that predates it silently switches auto-approval off — every gate prompting again, no error anywhere. The condition is the key's PRESENCE: an older hook rejects a key it does not know whatever the value, so `"lcovProducer": false` darkens it exactly as `true` does. The recovery is the advisor's `gate-hook.not-current` item: within the wired hook it writes the placed hook with the kit's body in place, and the agent applies it with no question after the danger check.
44
44
 
45
45
  **`coverage=` states what the run can honestly say about coverage.** A CLOSED four-value set, always present, DETAIL only — exit code, `status=`, the receipt status, `--final` acceptance and the commit-guard disposition are untouched. `coverage=certified` — the checker consumed an lcov and ISSUED a verdict, pass **or** fail (one listing uncovered lines still reads certified and still exits 1). `coverage=not-run` — the checker ran and issued NO verdict (no lcov bytes were read, or the run holds no attestation context). `coverage=none` — no canonical checker ran here (an `--only` subset, the `--pre-review` subset). `coverage=unknown` — the run ended before the gates produced a signal (missing / empty / malformed declaration, no bash, a pre-spend refusal), or that signal is unreadable: the checker could not spawn, or its two anchored lines are missing, duplicated, or CONTRADICTORY (`attested=yes` over `lcov-sha256=none` certifies nothing) — fail closed. The value is DERIVED by cross-reading both anchored machine lines, the bytes the `--final` receipt binds, so it can never disagree with what the checker printed; the checker's table row names a withheld verdict in the same words, and a `--final` receipt RECORDS the token (`none` never rides one — a final run always selects the checker).
46
46
 
@@ -22,23 +22,23 @@ The opt-in **gate-approval PreToolUse hook** — the family's third `.claude/` w
22
22
 
23
23
  **Trust posture (state it plainly when asking consent):** the hook removes the PROMPT only for commands the human already declared in `docs/ai/gates.json` — the same trust boundary as the `gates` runner, which executes them with the caller's privileges. **gates.json thereby becomes a privileged file**: whoever can edit it can get its commands auto-approved. An invalid declaration approves NOTHING (strict parse, exact validation parity with the runner).
24
24
 
25
- **The read-lane (opt-in, AD-055 Part II).** The toggle lives in `docs/ai/lanes.json` — a **SEPARATE kit-owned strict-JSON file** (`{ "readLane": true }`); `docs/ai/gates.json`, both its validators and the byte-mirrored template are **untouched** (the gates schema has no lane/model/routing fields — that claim stays true). The hook reads `lanes.json` LIVE per call, **fail-closed**: an absent / malformed / non-object file, or a `readLane` that is not the boolean `true`, leaves the lane dark (gate auto-approval and the residual ask are unaffected). `lanes.json` becomes a **privileged file** exactly like `gates.json` — an auto-approved read chain runs **unattended** and can read any file you can (the same trust boundary as the audited read-only core velocity seeds, extended to compounds (and singles) of that core; **prompt-bypass only, never a sandbox bypass**). Enable it with `--read-lane` (below), which runs a **currency check** first: it refuses unless the PLACED hook is byte-identical to the current bundle — a **pre-1.48 hook never reads `lanes.json`**, so enabling the lane against a stale placed copy would be a silent no-op the user paid consent for. The stale-hook silent-blackout class is dead **by construction** (an old hook merely lacks the rung; nothing existing changes behavior); the currency refusal names the **reseed** route (`gate-hook --apply --reseed --cwd <root>`, which replaces the placed hook with the bundled bytes in place).
25
+ **The read-lane (opt-in, AD-055 Part II).** The toggle lives in `docs/ai/lanes.json` — a **SEPARATE kit-owned strict-JSON file** (`{ "readLane": true }`); `docs/ai/gates.json`, both its validators and the byte-mirrored template are **untouched** (the gates schema has no lane/model/routing fields — that claim stays true). The hook reads `lanes.json` LIVE per call, **fail-closed**: an absent / malformed / non-object file, or a `readLane` that is not the boolean `true`, leaves the lane dark (gate auto-approval and the residual ask are unaffected). `lanes.json` becomes a **privileged file** exactly like `gates.json` — an auto-approved read chain runs **unattended** and can read any file you can (the same trust boundary as the audited read-only core velocity seeds, extended to compounds (and singles) of that core; **prompt-bypass only, never a sandbox bypass**). Enable it with `--read-lane` (below), which runs a **currency check** first: it refuses unless the PLACED hook is byte-identical to the current bundle — a **pre-1.48 hook never reads `lanes.json`**, so enabling the lane against a stale placed copy would be a silent no-op the user paid consent for. The stale-hook silent-blackout class is dead **by construction** (an old hook merely lacks the rung; nothing existing changes behavior); the currency refusal names `gate-hook --apply --cwd <root>`, which writes the placed hook with the kit's body in place.
26
26
 
27
27
  **Version-status routing** like the other writer modes (stamp head `4.0.0`; `--apply` enforces it in code).
28
28
 
29
29
  Run `node ${CLAUDE_SKILL_DIR}/tools/gate-hook.mjs [--dry-run | --apply] [--cwd <dir>]`:
30
30
 
31
- 1. **`--dry-run` first, always** (the default — changes nothing): previews the placement and the exact settings entry it would merge. It STOPs (zero writes) on: a symlinked `.claude` / `.claude/hooks` / target file / non-regular `settings.json`; malformed settings JSON; a **malformed existing `hooks` shape** (never a merge-through-clobber); an unsafe `permissions.defaultMode` in **either** settings file; or a target hook file with **different** content while our entry is not wired (**it refuses to wire an unknown script as a PreToolUse hook** — the recovery is named: the reseed route, below).
31
+ 1. **`--dry-run` first, always** (the default — changes nothing): previews the placement and the exact settings entry it would merge. It STOPs (zero writes) on: a symlinked `.claude` / `.claude/hooks` / target file / non-regular `settings.json`; malformed settings JSON; a **malformed existing `hooks` shape** (never a merge-through-clobber); or an unsafe `permissions.defaultMode` in **either** settings file.
32
32
  2. **Ask consent** via **`AskUserQuestion` where supported**, the no-change option first: keep prompting for gate commands, or place + wire the hook — presenting the trust posture above in plain language.
33
- 3. **Only on an explicit yes**, re-run with `--apply`. It places the file FIRST, then wires settings (a wired-but-missing entry would error on every Bash call); merge-don't-clobber (foreign hooks/matchers/keys and existing permissions preserved; re-apply never duplicates); **settings hot-reload — the hook is active for new Bash calls, no session restart needed**. An identical existing file is *already current*; a diverged-but-already-wired file is reported, never clobbered or unwired by `--apply`.
33
+ 3. **Only on an explicit yes**, re-run with `--apply`. It places the file FIRST, then wires settings (a wired-but-missing entry would error on every Bash call); merge-don't-clobber (foreign hooks/matchers/keys and existing permissions preserved; re-apply never duplicates); **settings hot-reload — the hook is active for new Bash calls, no session restart needed**. An identical existing file is *already current*; a differing one is written with the kit's body in place; the entry is wired only while it is wired in neither settings file.
34
34
 
35
- **The reseed route — `--reseed`, the one consented replacement.** `gate-hook --reseed` previews and `--apply --reseed --cwd <root>` replaces a PLACED hook whose bytes differ from the bundle with the bundled bytes, in place, and wires the entry only while it is wired in neither settings file; a current hook wired in either file is `nothing to change: the placed hook is current`, and a current unwired one is only wired. It refuses an absent hook (`--apply` places it), a symlinked or non-regular target, a hook file swapped for a symlink before the write (nothing is written through it), and `--read-lane` beside it; where Node exposes no no-follow open flag (native Windows) it refuses the replace instead of risking a write through a link. It is what the advisor's `gate-hook.marker-stale` and `read-lane.stale` items apply: the agent runs it on the chat yes after the danger check, whose result names the replaced file with the old and the new digest; `init` applies it as the route the user may take instead.
35
+ **The hook file is the kit's.** Within a wired hook, `.claude/hooks/agent-workflow-gates.mjs` is placed when absent and written with the kit's body when it differs, in place, with no question and no copy kept; a current one is left; a link or another non-regular node there is named and nothing is written, and where Node exposes no no-follow open flag (native Windows) a replace stops instead of risking a write through a link. The advisor renders that state as `gate-hook.not-current`, lane kit: the agent applies it with no question after the danger check, and over a wired hook `gate-hook --apply` writes only the file. A hook of your own goes in `.claude/hooks/<name>.local.mjs`, which you wire; no kit tool writes it.
36
36
  4. **Hidden-mode deployments:** after apply, run the hide-footprint reconcile (`node ${CLAUDE_SKILL_DIR}/tools/hide-footprint.mjs --dir <project> --reconcile`) — `/.claude/hooks/` is in the known-footprint registry; the apply report reminds you.
37
37
 
38
- **Enabling the read-lane:** `node ${CLAUDE_SKILL_DIR}/tools/gate-hook.mjs --read-lane [--dry-run | --apply] [--cwd <dir>]`. `--dry-run` (the default) previews the `lanes.json` edit, the hook-currency status, and the trust posture; `--apply --read-lane` runs the **currency check** (above), then writes `{ "readLane": true }` into `docs/ai/lanes.json` — create-if-absent, merge-preserve every key, symlink / non-regular refusal, malformed-JSON fail-closed, atomic. It **never touches** `.claude/settings.json` or `docs/ai/gates.json`. The upgrade Recommendations advisor surfaces this as the `read-lane` offer once the hook is placed **and** wired.
38
+ **Enabling the read-lane:** `node ${CLAUDE_SKILL_DIR}/tools/gate-hook.mjs --read-lane [--dry-run | --apply] [--cwd <dir>]`. `--dry-run` (the default) previews the `lanes.json` edit, the hook-currency status, and the trust posture; `--apply --read-lane` runs the **currency check** (above), then writes `{ "readLane": true }` into `docs/ai/lanes.json` — create-if-absent, merge-preserve every key, symlink / non-regular refusal, malformed-JSON fail-closed, atomic. It **never touches** `.claude/settings.json` or `docs/ai/gates.json`. The upgrade Recommendations advisor surfaces this as the `read-lane` offer once the hook is wired.
39
39
 
40
- **Invariants:** the base flow writes ONLY `.claude/hooks/agent-workflow-gates.mjs` + `.claude/settings.json`; `--read-lane` writes ONLY `docs/ai/lanes.json` (never settings, never `gates.json`) · never `settings.local.json` · never commits · exact-match approval only (no patterns) · never `deny` · never auto-wired by `init`/`upgrade` (placement stays opt-in — the AD-011/AD-034 boundary: init/upgrade may refresh placed things, never place new ones).
40
+ **Invariants:** the base flow writes ONLY `.claude/hooks/agent-workflow-gates.mjs` + `.claude/settings.json`; `--read-lane` writes ONLY `docs/ai/lanes.json` (never settings, never `gates.json`) · never `settings.local.json` · never commits · exact-match approval only (no patterns) · never `deny` · never auto-wired by `init`/`upgrade` (wiring stays opt-in — the AD-011/AD-034 boundary: the upgrade with no question, and init on its one y, place or refresh the hook file of a hook the user wired, and a hook is wired only on the user's yes to its offer).
41
41
 
42
- **Exit codes:** `0` done / dry-run (incl. the reported diverged-but-wired state); `1` a precondition STOP; `2` bad arguments.
42
+ **Exit codes:** `0` done / dry-run; `1` a precondition STOP; `2` bad arguments.
43
43
 
44
44
  **The kit's other hook.** `state-block-guard` (see `${CLAUDE_SKILL_DIR}/references/modes/state-block-guard.md`) is a separate, unrelated `Stop` hook that judges the closing state block of a turn. Its writer is `tools/state-block-hook.mjs` (the advisor's `state-block` item), it never approves or denies anything, and this mode neither places nor wires it — the two hooks share only the `.claude/` directory they live in and the hardened placement discipline the state-block writer imports from `gate-hook.mjs`.
@@ -9,7 +9,7 @@ Run `node ${CLAUDE_SKILL_DIR}/tools/jev-guide.mjs --dir <project> --json`.
9
9
 
10
10
  Render the returned envelope compactly in the user's conversational language. Never paste the JSON. Keep every path and every command verbatim, each command on its own line so it runs as printed; translate only the prose around them. Keep the one vendor-quoted text verbatim and in quotes, never translated or reflowed: the not-a-replacement sentence. The `Run it in <place>:` line, when the guide printed one, stays directly before the connect line and is never folded into it; the restart step is relayed whole.
11
11
 
12
- The connect line is the user's own step — hand it over as printed; it asks for the key in their terminal, so the key never reaches the agent or the chat; the connect command refuses without a terminal, and a terminal is not consent. The agent applies the skill only through the advisor's `jev-skill` item: its check line, and on the user's yes on that result its apply line (spec kit/install/init-project); where the advisor shows no `jev-skill` item (the key not set), STEP 2's line is the user's own step. The guide's line is the user's command for a terminal of their own. The vendor's install lines are the user's own step too. Only when the user asks to see the plan, run the skill command without `--apply` yourself: a read-only dry run that writes nothing.
12
+ The connect line is the user's own step — hand it over as printed; it asks for the key in their terminal, so the key never reaches the agent or the chat; the connect command refuses without a terminal, and a terminal is not consent. The agent applies the skill only through the advisor's `jev-skill` items: the offer's check line, and on the user's yes on that result its apply line, or, beside a copy at a kit pin, the kit item `jev-skill.not-current` by the kit route with no question (spec kit/install/init-project); where the advisor shows no `jev-skill` item, STEP 2's line is the user's own step. The guide's line is the user's command for a terminal of their own. The vendor's install lines are the user's own step too. Only when the user asks to see the plan, run the skill command without `--apply` yourself: a read-only dry run that writes nothing.
13
13
 
14
14
  Keep this order: the fixed text (WHAT, WHY HERE, NOT, SOURCES); then the two steps — the key with its connect line and its mark, the vendor skill with its install lines, its mark and its first prompt; then the three prompts where it pays.
15
15
 
@@ -22,7 +22,7 @@ Run `node ${CLAUDE_SKILL_DIR}/tools/recommendations.mjs --cwd <project-root> [--
22
22
 
23
23
  The **consent route** for a harness item: run its `check:` line in the sandbox and show its result. On the check's `masked:` line, say so and run that same check line once more outside the sandbox, so it re-judges in the apply's own environment; the yes is taken on the outside result. Take the user's yes on that result and run its `apply:` line with that result's digest once, outside the sandbox at once, so the harness asks at the point of action (with the apply ask rule seeded, its own dialog); never another line, never unseen. When velocity-core, kit-tools-tier or bridge-tier is among the user's picks (velocity-core preferred), check, confirm and apply it, or leave it pending, before any other pick's check runs, so its apply seeds the ask rule before the other harness applies. When the harness's auto mode refuses the check or the apply, say so and give the one plain step: leave auto mode for this one action (Shift+Tab in the terminal, the mode indicator in an editor) and say yes, or run `npx @sabaiway/agent-workflow-kit@latest init` in a terminal of your own. On the user's word, run the same line once more when they left auto mode, never another, never unseen; when they ran `init` instead, run the advisor again and offer only what is still pending, each through this route from its check (after a restart `init` asked for, the next session's upgrade does it). When that refusal hits the velocity-core, kit-tools-tier or bridge-tier pick taken first, run no other pick's check until the user answers the plain step. A check that refuses (exit 1) leaves the item unapplied and pending, its result shown; a changed digest (exit 5) applies nothing, shows the new result and asks a new yes. A no, a harness refusal and any other failure of a harness apply leave the item pending with its output shown, and the agent continues. `init`, run in a console from the project's folder, is the route the user may take instead.
24
24
 
25
- **The kit route** for a `lane: kit` item, which writes a kit file of a component the project already has: ask no question and wait for no pick. Before offering the other items, run each kit item's `check:` line in the sandbox and show its result, then at once run its `apply:` line with that result's digest once, outside the sandbox; the harness's own dialog there is its consent, which the kit cannot remove. A changed digest (exit 5) re-runs the check once and applies with its new digest, still with no question; every other outcome leaves the item pending with its output shown, and the agent goes on; an auto-mode refusal gets the one plain step above. `init` checks and applies it on its one y, as a harness item.
25
+ **The kit route** for a `lane: kit` item, which writes a kit file of a component the project already has or the host already accepted: ask no question and wait for no pick. Before offering the other items, run each kit item's `check:` line in the sandbox and show its result, then at once run its `apply:` line with that result's digest once, outside the sandbox; the harness's own dialog there is its consent, which the kit cannot remove. A changed digest (exit 5) re-runs the check once and applies with its new digest, still with no question; every other outcome leaves the item pending with its output shown, and the agent goes on; an auto-mode refusal gets the one plain step above. `init` checks and applies it on its one y, as a harness item.
26
26
 
27
27
  **The `executor-vehicle` item (the carrier the project already CONFIGURED — beside the `agents` offer, never the same item).** It fires on ONE pair of facts: a slot in `docs/ai/orchestration.json` names `subagent` while the executor vehicle (`.claude/agents/executor.md`) is `missing` or `unusable` — so every such slot silently degrades to solo. That is a configured declaration that is broken, hence **`attention`**, not an offer; its text names the state, its reason and how many configured slots are affected across the six activities (`plan-authoring`, `plan-execution`, `routine`, `feedback-triage`, `epic`, `task`), covering the subagent-capable slots `plan-authoring.author`, `plan-authoring.fold`, `plan-execution.execute`, `routine.carrier`, `epic.author`, `task.author` and `task.execute`. **`placed` renders NOTHING** (a working vehicle is not a recommendation); it yields to `agents.not-current`, the kit item the agent applies with no question, which writes a regular executor whose bytes differ, the check failing or not, in a placed component; a config naming no `subagent` slot renders no base item, and a config the validated reader refuses is a stated **skip**, never an item computed over a shape nothing accepted. It is deliberately DISTINCT from the `agents` offer and the review-recipe probe, neither of which can observe this state. The agent applies it on the chat yes after the check; `init` previews the agents writer's own `cheap-agents.mjs` and applies it with `--apply` on the terminal yes as a route the user may take instead. Its `recipe:` line carries each precondition the advisor observes beside the apply slot, followed by the hidden-mode reconcile follow-up (`hide-footprint --reconcile`), for a hidden deployment only. Honest limit on convergence: the apply places an ABSENT vehicle, so it clears `missing`; it STOPs on a symlink, so on `unusable` the `recipe:` line names each refusal as a precondition; an executor whose frontmatter is invalid is written by the apply itself. Risk profile: writes under `.claude/agents/` only — every kit agent file written current with no question, the executor's and the review lens's bodies derived from `docs/ai/vehicles.json` — never `settings.json`, never a commit.
28
28
 
@@ -32,13 +32,13 @@ A variant's posture note, where its key has one, is printed by `init` from this
32
32
 
33
33
  - `bridge-tier` — the lane is harness and env-dependent: the agent applies the item on the chat yes after the check, writing the project `.claude/settings.json`; `init` previews `velocity-profile --bridge-tier` and applies it on the terminal y as the route the user may take instead. It wires the USED bridges from the project's effective recipes and host readiness: each used review wrapper's `code`-mode allow rule (a wrapper then runs UNATTENDED: it reads any repo file it is pointed at and sends the assembled payload to its subscription backend), the quoted grounding pre-step rule when `agy-review` is used, `codex-review *` / `agy-review *` in `sandbox.excludedCommands`, and `codex-exec *` where an execute slot delegates (no execution allow rule: it keeps its prompt). It also seeds the used bridges' declared hosts (`networkHosts`) in `sandbox.network.allowedDomains` and resolved state dirs (`writableDirs`), home-relative where under home, in `sandbox.filesystem.allowWrite`. Where the host honours the settings sandbox keys, an excluded wrapper runs outside the sandbox, every sandboxed command of the project can reach the seeded hosts, and every sandboxed command can write the seeded state dirs. The item fires while an allow rule, a `*` exclusion, a host or a state dir of a used bridge is missing. Its `recipe:` line names each missing entry by kind (allow rules, exclusions, hosts, state dirs), then what the execution wrapper `codex-exec` needs where an execute slot delegates, then, when the project settings enable the sandbox, "once added, wired where the host honors the settings sandbox keys", or "host condition unchecked" with the reason.
34
34
 
35
- - `read-lane` — enabling the opt-in read-only compound lane auto-approves *compounds* (and singles) of the seeded read-only core that carry ZERO shell metaprogramming: an UNATTENDED trust extension, bounded by the audited read-only core (never a command outside it; prompt-bypass only, never a sandbox bypass) and applied regardless of which of those core commands you seeded as individual settings rules. It is a PROJECT-PERSISTENT declaration in `docs/ai/lanes.json` — every future session, subagents' Bash too where the host fires hooks on subagent Bash, and (committed) every checkout. The apply depends on state: when the lane is OFF, it is the `gate-hook --read-lane` preview (whose own currency check refuses a stale hook — a pre-1.48 hook never reads `lanes.json`); when the placed hook is MISSING, the item instead surfaces the re-place offer; when it is STALE (an enabled lane over an old hook), the **stale** arm is an attention item on the harness lane: its writer is `gate-hook --apply --reseed`, which replaces the placed hook with the bundled bytes in place, and the agent applies it on the chat yes after the check, whose result names the replaced file with both digests; `init` applies it on the terminal y as the route the user may take instead. Risk profile: a bounded read-only trust-posture extension — no write/exec exposure beyond the audited core.
35
+ - `read-lane` — enabling the opt-in read-only compound lane auto-approves *compounds* (and singles) of the seeded read-only core that carry ZERO shell metaprogramming: an UNATTENDED trust extension, bounded by the audited read-only core (never a command outside it; prompt-bypass only, never a sandbox bypass) and applied regardless of which of those core commands you seeded as individual settings rules. It is a PROJECT-PERSISTENT declaration in `docs/ai/lanes.json` — every future session, subagents' Bash too where the host fires hooks on subagent Bash, and (committed) every checkout. The item renders while the hook is wired and the lane is off, whatever the placed hook's bytes; its apply is the `gate-hook --read-lane` preview, whose own currency check refuses a stale hook (a pre-1.48 hook never reads `lanes.json`). A stale or absent hook under it is a planned file of the kit item `gate-hook.not-current`, applied before the offers. The agent applies the enable offer on the chat yes, and the kit item with no question after the check; `init` applies that kit item on its one y as the route the user may take instead. Risk profile: a bounded read-only trust-posture extension — no write/exec exposure beyond the audited core.
36
36
  - `worktrees-dir` — the agent applies the item on the chat yes after the check: one `sandbox.filesystem.allowWrite` entry naming the worktrees parent itself, written to this copy's `.claude/settings.local.json` only, never the committed project settings, the parent created when missing. `init` applies it on the batch terminal yes as the route the user may take instead. Where the host honors the key, the entry widens the OS-sandbox WRITE surface to the whole parent dir: every sibling path under it (other repositories included) becomes agent-writable, for every later session and every worktree provisioned afterwards. Narrow it BEFORE the first apply: point `docs/ai/worktrees.json` `parentDir` at a dedicated dir — no apply removes an entry, so an earlier one stays until the user deletes it. A parent that is the home or holds it renders `worktrees-dir.home` instead, the user's own step. **Convergence** is two-path: a declared `sandbox.filesystem.allowWrite` entry covering the probed dir (either settings scope — `~` and `~/…` resolve against home, and coverage is path-segment-aware, so a grant on a sibling or on a child never counts), or the dir-bound acknowledgement `worktreesDirAck` in the family-owned `docs/ai/acks.json`, recorded by the `ack-write --lane worktrees-dir` line the `recipe:` line carries — the ack fallback for a host that ignores the key, run only on the user's word, instead of the grant; against a trusted host NO no ack renders. Neither is proof of write CAPABILITY: the provision preflight's real create+delete probe stays the runtime truth, and the ack is bound to the **resolved probe dir**, so the item re-fires only when that resolved dir changes. Risk profile: a real write-surface widening where honored — scope it deliberately.
37
37
 
38
38
  - `gates-inert` — the gate matrix is DECLARED but verifies nothing, and the two causes have different remedies, so the item renders a different apply for each. **Cause A** — a canonical `coverage-check` gate with no producer gate declared BEFORE it (none at all, or one declared after it, which writes the lcov too late): the run certifies no coverage of its own — `coverage=not-run` when nothing wrote an lcov, or a verdict over STALE bytes an earlier run left in the git dir, which is worse because it reads as `coverage=certified`. The remedy needs the producer to run BEFORE the checker — declared or MOVED there. When the checker is the LAST declared gate and the project's own scripts yield an offerable producer, the fill PLACES that producer before it, so the apply is the ordinary `gates-init` dry-run preview. Otherwise — no offerable producer, or a checker that is not last — it is the user item `gates-inert.unfillable`: the user's own step is to edit `docs/ai/gates.json` (the exact producer form lives in `${CLAUDE_SKILL_DIR}/references/modes/gates.md`), because the fill never reorders entries it did not write. **Cause B** — every declared gate is one of the kit's own canonical checkers, so the matrix runs no project-verification command at all: the apply is the `gates-init` dry-run preview, the same consent-gated seeder the `gates-declaration` item renders, and after the SAME confirmation you run the `--apply` line it prints. Neither cause changes any gate result, exit code or receipt — the item adds no enforcement, only the offer. Risk profile: `docs/ai/gates.json` is a PRIVILEGED file (a declared gate is auto-approvable by the wired hook), so both causes land in the same place — where the fill can help, it declares a project-controlled command on your explicit yes; where it cannot, the edit is the user's own step.
39
39
 
40
40
  - `source-size` — the arms differ by what the declared gate IS. **`adopted-elsewhere`** — the gate runs a DIFFERENT real copy of this checker (a vendored deployment): the practice runs, the advisor cannot resolve it as its own sibling, and the realpath anchor does not widen (that stops a lookalike). So the convergence is the ack writer's preview (`--lane source-size-copy` → `sourceSizeCopyAck`), never `--adopt`, which would mint and then be refused by the fill on the declared id. The fingerprint binds the declared claims AS AUTHORED, sorted, not resolved paths, so a second external copy re-fires it. **`id-squatter`** — a gate carries the `source-size` id and is not this checker under any reading: it claims the practice while nothing measures module size, so it is the user's own step (rename the id, or repoint the cmd at this `--check`). **`unminted`**, for both copies: a gate refusing every run over an authored or incomplete record (over an absent one the check judges layout alone), attention, and NO acknowledgement silences it; only the verb differs (with the gate declared elsewhere, `--write-baseline`). **`schema-1`** — the check stops on a minted schema-1 config, so this arm comes first: its `--write-baseline` line carries NO reason (a pinned one would launder a raise; a raise riding the move refuses and you relay it), every run until the move. **`layout`** — on a config with no layout record, the record of the piles already there comes first, as its own item: a no writes nothing and the item returns every run; its `recipe:` line names the branch states, and `source-size.layout` is applied before the `hook-checks` check line runs, whose layout line follows that record. Risk profile: `docs/ai/gates.json` is a PRIVILEGED file, so every arm here either records an acknowledgement or hands you an edit — the kit declares nothing on its own.
41
- - `gate-hook` — the base arm is the ordinary opt-in wiring offer on the harness lane: the agent applies it on the chat yes after the check; `init` previews and applies it on the terminal yes as the route the user may take instead. The **`marker-stale`** arm is not: the placed hook validates your declaration through its OWN baked copy and goes dark on any key it does not know, so a declaration carrying the `lcovProducer` key under a hook that predates it silently turns auto-approval OFF, and every gate prompts again with no error anywhere. The condition is the key's PRESENCE, not its value: `"lcovProducer": false` darkens it exactly as `true` does. The arm is deliberately marker-scoped — a stale hook is otherwise harmless — and it is a harness item: its writer is `gate-hook --apply --reseed`, which replaces the placed hook with the bundled bytes in place (and wires the entry only while it is unwired), so the agent applies it on the chat yes after the check, whose result names the replaced file with the old and the new digest; `init` applies it on the terminal y as the route the user may take instead. When the read-lane is also enabled, this arm and `read-lane.stale` would report the same file with the same recovery, so exactly one renders — **this one**: a hook that postdates the read-lane and merely predates the marker key reads `lanes.json` perfectly well. Risk profile: one placed hook file replaced by the bundled runtime; the declaration is never touched.
41
+ - `gate-hook` — the offer wires the hook on the harness lane: the agent applies it on the chat yes after the check; `init` previews and applies it on the terminal yes as the route the user may take instead. Over a wired hook the key renders the kit item `gate-hook.not-current` instead: the placed hook file is absent or differs from the body the kit writes for it. An older body validates your declaration through its OWN baked copy and goes dark on a key it does not know, such as `lcovProducer` (present, whatever its value), so every gate prompts again with no error anywhere. The agent applies the kit item with no question after the check, whose result names the file with its new digest, and the old one too over a differing file; it writes only the hook file. Risk profile: the offer places a hook file and wires one settings entry; the kit item writes one hook file with the kit's body; the declaration is never touched.
42
42
  - `enforcement` — copies the bundled `references/scripts/*.mjs` runnable scripts and their tests, then runs the project's own hook installer, which installs the pre-commit hook. The lane is harness: the agent applies the item on the chat yes after the check, whose result shows each script the kit places with its bytes and the installer it runs with its bytes; `init` applies it on the batch terminal yes as the route the user may take instead. The copy is create-only: an existing file stands and nothing is written through a link, and the offer renders only when `scripts/` is absent or a plain directory contains no bundled basename. The hook invokes `node` directly, so a committer without it on PATH gets a loud failure. The installer refuses to overwrite a pre-commit hook it did not write: an install it refuses removes the scripts this apply copied, and the item is offered again with the installer's output shown; over a pre-commit hook the installer did not write the item is not offered — its skip names the user's own step. Risk profile: local tooling and a Git hook are added on the chat yes after the check, or on init's y.
43
43
  - `hook-checks` — the agent applies the item on the chat yes after the check; `init` applies it on the terminal y as the route the user may take instead. Risk profile: future commits stop on the rules check and, where judged, on the size check's findings — lines, aggregate and layout; over a clone with no pre-commit hook the installer writes its whole hook, so commits also stop on its docs, archive and `scripts/` test lines.
44
44
  - `attribution` — the agent applies the item on the chat yes after the check, setting one key in the project `.claude/settings.json`; `init` applies it on the terminal y as the route the user may take instead. An existing "includeCoAuthoredBy": false already converges the item unless an "attribution" key sets a commit or PR text; a local-scope override is the user's own edit. Risk profile: one settings key, nothing widened.
@@ -48,7 +48,7 @@ A variant's posture note, where its key has one, is printed by `init` from this
48
48
  - `spec-adoption` — the feature-spec layer's ADOPTION STATE, judged from `docs/ai/specs/` alone through the same census `spec-check --all` runs, so a store the checker would refuse to observe is never counted here either. Both arms are OFFERS (`optional`) — the layer is opt-in, and `attention` stays reserved for a configured declaration that is broken. **`not-adopted`** (no store): every plan then cites zero governing specs by default and nothing says adoption never started; its apply is the spec-layer ensure one-liner (`ensure-configs --reconcile --only specs`, the same seed `upgrade` runs — it seeds the reader/checker pairs and the store root, and skips with a stated reason where no Node evidence exists), and its `recipe:` line carries the decline alternative — the DECLINE preview (`ack-write --lane spec-adoption`, a dry-run that prints the exact `--apply`), which records `specAdoptionAck` in the family-owned `docs/ai/acks.json`. **The two are exclusive, and the order is part of the contract:** ask which the user wants, apart, BEFORE the confirmation; on "seed" run the apply; on "decline" the agent records it — the preview line, then on that same answer its printed `--apply`; never run the seed after a decline, nor the decline after the seed. **`adopting`** (a store with no live contract): an optional item naming the draft count; its apply is that same decline preview (a dry-run; after the SAME confirmation you run the `--apply` it prints), and the honest remedy is authoring a contract from the skill's `SPEC_TEMPLATE.md`. A recorded decline silences BOTH arms and shows on `status` as ` — declined`; one live contract makes the decline moot. An unreadable store is a stated skip, never `flow optimal`. Risk profile: the seed writes create-only files under `scripts/` and `docs/ai/specs/` and refreshes a script body a release shipped; it writes an edited spec-layer file with the bundled body with no question, its line naming where an edit meant to last goes; the decline writes one key into the ack store; nothing here authors a spec or blocks a plan.
49
49
  - `profile-gap` — each item's apply is a PREVIEW that writes nothing, and consent takes two steps: the confirmed pick runs the preview and you relay every line it prints (the environment-resolved slot values, each checker `entry:` line with its trust-chain disclosure, a Communication region the insert plans in the same run); the same line with ` --apply` appended runs only on a SECOND yes over those lines, never carried by the first. Items whose apply lines are byte-equal are one writer and take one answer: the tier preview's `--apply` writes the absent slots, the store seed and the queue seed together; the checker verb writes only its own entries; the insert writes every region it plans, all or nothing, so a `communication-absent` skip beside a declined `story-sessions-section` gets its own ask after the insert's full preview. A no records nothing and the item stays on the screen. A DECLINE is asked apart from later, before anything runs, and runs `node ${CLAUDE_SKILL_DIR}/tools/tier-preview.mjs --decline --cwd <project-root>` only when the user refuses EVERY item the tier preview then reports offered: it records each of them at the shipped lineage, and a declined item leaves the screen until a lineage step changes the profile. An undecidable entry is a stated skip naming its reason, the remedy by reason: a prior → the upgrade's `lens` reconcile; an absent region → the insert; a customized region → a hand edit only (the lens preserves it), so that skip stands and withholds `flow optimal`. Risk profile: the tier preview's `--apply` rewrites `docs/ai/orchestration.json` in canonical form with the `_README` note and creates `docs/ai/epics/.gitkeep` and `docs/plans/queue.md` create-only; the insert adds regions to `docs/ai/agent_rules.md`; the checker verb adds entries to the PRIVILEGED `docs/ai/gates.json`; the decline writes `docs/ai/profile-declines.json`; nothing here commits.
50
50
  - `jev-connect` — the lane is user and env-dependent: the connect command is the user's own step in a terminal of their own, where it asks for the key; the key never reaches the agent or the chat (the command refuses without a terminal, and a terminal is not consent). When the recipe line opens with `run the apply in <place>`, that place is the terminal to run it in; `init`, run there, offers the command on its own consent line. The command reads the key with no echo, makes one network call to api.typesafe.ai with the vendor's sample text only on the user's own run, and writes the key in plain text — as managed export lines in the shell's startup files (bash: ~/.bashrc and the login file, created as ~/.bash_profile when none exists; zsh: ~/.zshrc), as the kit's own file ~/.config/fish/conf.d/typesafe-api-key.fish for fish, or on Windows as the user environment variable TYPESAFE_API_KEY, stored in the Windows user environment; a process already running at the save can keep its old environment and hand it to what it starts — the guide's key mark confirms the agent sees it (a file is readable by any process running as that user, and by other local accounts when one is world-readable in a traversable home); the vendor keeps data under its processing agreement and offers zero retention only to enterprise accounts. The item reads the environment the agent's commands run in: a host setting that filters it shows the item while the key is set in the user's shell. The decline alternative rides the recipe line, asked apart BEFORE the confirmation (the `spec-adoption` order): on "connect" hand over the apply line; on "decline" the agent records it — the recipe line's preview, then its printed `--apply` — per project as `jevConnectAck` in `docs/ai/acks.json`. Risk profile: a plain-text key in the user's startup files or the Windows user environment, written by a command the user runs; one network call from that run.
51
- - `jev-skill` — the lane is harness; both `jev-skill` and `jev-skill.earlier` are env-dependent: the agent applies the item on the chat yes after the check, showing the files it would write; it changes no harness setting. `init` applies it on the batch terminal yes as the route the user may take instead. When the recipe line opens with `run the apply in <place>`, that place is where a user who prefers their own terminal runs it. The skill is third-party text — the vendor's, MIT — that the kit ships pinned and installs as a verified copy into three agent skill roots: `~/.agents/skills`, the Claude Code skills dir (`CLAUDE_CONFIG_DIR` or `~/.claude`) and `~/.gemini/config/skills`. It is never updated silently: a copy at an earlier pin is replaced only by that command, and a foreign copy is left untouched and named on the recipe line. A copy the vendor's `skills` CLI wrote with the same bytes reads current, and a later pin move replaces it like a kit copy; a vendor plugin install is invisible to the file check, so the Claude Code root may read absent while the plugin serves it. Only when the user asks to see the plan does the agent run the command without `--apply` (a read-only dry run). The decline alternative rides the recipe line, asked apart BEFORE the confirmation: on "install" run the check line and, on the yes given on its result, the apply line by the consent route; on "decline" the agent records it — the recipe line's preview, then its printed `--apply` — per project as `jevSkillAck` in `docs/ai/acks.json`. Risk profile: third-party text written into the user's agent skill roots by the kit's skill command; no network.
51
+ - `jev-skill` — two arms, both env-dependent. The offer `jev-skill`, lane harness, shows once `TYPESAFE_API_KEY` is set and no decline is recorded, while no skill root holds a copy at a kit pin and a root the kit fills is absent: the agent applies it on the chat yes after the check, showing the files it would write; it changes no harness setting. `init` applies it on the batch terminal yes as the route the user may take instead. When the recipe line opens with `run the apply in <place>`, that place is where a user who prefers their own terminal runs it. The kit item `jev-skill.not-current`, lane kit, shows beside a copy at a kit pin in any root: the kit route applies it with no question, writing every root absent or behind the kit's pin. The skill is third-party text — the vendor's, MIT — that the kit ships pinned and installs as a verified copy into three agent skill roots: `~/.agents/skills`, the Claude Code skills dir (`CLAUDE_CONFIG_DIR` or `~/.claude`) and `~/.gemini/config/skills`. The copy is written current with no question beside a copy at a kit pin; a foreign copy is left untouched and named on the recipe line. A copy the vendor's `skills` CLI wrote with the same bytes reads current, accepts the component and is written at a later pin like a kit copy; a vendor plugin install is invisible to the file check, so the Claude Code root may read absent while the plugin serves it. Only when the user asks to see the plan does the agent run the command without `--apply` (a read-only dry run). The decline alternative rides the offer's recipe line, asked apart BEFORE the confirmation: on "install" run the check line and, on the yes given on its result, the apply line by the consent route; on "decline" the agent records it — the recipe line's preview, then its printed `--apply` — per project as `jevSkillAck` in `docs/ai/acks.json`. Risk profile: third-party text written into the user's agent skill roots by the kit's skill command; no network.
52
52
 
53
53
  **Sandbox lanes (what to DO with the bridge surfaces, per host class):**
54
54
 
@@ -100,6 +100,10 @@ stamp refusals use that writer's error codes:
100
100
  present and not an array is a refusal with nothing written;
101
101
  - the entry is merged only while no `Stop` entry of either settings file runs the runtime, so a
102
102
  wiring you made yourself (another path, `--require-block`) counts and is never duplicated;
103
+ - within a wired hook the advisor renders a runtime that is absent or differs as
104
+ `state-block.not-current`, lane kit: the agent applies it with no question after the danger check,
105
+ and the writer then writes only the file. A hook of your own goes in `.claude/hooks/<name>.local.mjs`,
106
+ which you wire;
103
107
  - a symlinked `.claude`, `.claude/hooks`, target or settings file, malformed settings and an unsafe
104
108
  permission mode each refuse with nothing written; a deployment stamp behind the kit refuses
105
109
  `--apply` (the preview still answers and notes it); the runtime is written through gate-hook's
@@ -9,19 +9,19 @@ import {
9
9
  APPLY_ASK_RULE, CLAUDE_DIR, RENDER_OWNED_REDLINE_RULES,
10
10
  SAFE_DEFAULT_MODES, SETTINGS_FILE, SETTINGS_LOCAL_FILE, UNIVERSAL_READONLY_ALLOWLIST,
11
11
  deriveKitToolsAllowlist, detectAtRoot, mergeAutonomySettings,
12
- writeAutonomyProfile, writeVelocityProfile,
12
+ readSettingsFile, writeAutonomyProfile, writeVelocityProfile,
13
13
  } from './velocity-profile.mjs';
14
14
  import { KIT_GROUNDING_TOOL, bundledSandboxRecipe, usedBridges } from './bridge-sandbox-recipe.mjs';
15
15
  import { homeRelative, mergeAllowWrite, stateDirsOf } from './bridge-state-dirs.mjs';
16
16
  import { nearestExistingDir, worktreesGrantDir, worktreesGrantHoldsHome } from './worktrees.mjs';
17
17
  import { loadConfig } from './orchestration-config.mjs';
18
- import { HOOK_FILE_REL, HOOKS_DIR, buildHookSettingsEntry, mergeHookEntry, writeGateHook } from './gate-hook.mjs';
19
- import { STATE_BLOCK_HOOK_FILE_REL, buildStopHookEntry, mergeStopEntry, writeStateBlockHook } from './state-block-hook.mjs';
18
+ import { HOOK_FILE_REL, HOOKS_DIR, buildHookSettingsEntry, isHookWired, mergeHookEntry, writeGateHook } from './gate-hook.mjs';
19
+ import { STATE_BLOCK_HOOK_FILE_REL, buildStopHookEntry, isStopHookWired, mergeStopEntry, writeStateBlockHook } from './state-block-hook.mjs';
20
20
  import { writeMcp } from './mcp.mjs';
21
21
  import { ENABLED_KEY, MCP_JSON_REL, SERVERS_KEY, SERVER_NAME, allowRulesFor, buildServerEntry } from './mcp-registration.mjs';
22
22
  import { AGENTS_DIR, agentsAccepted, kitAgentNames, writeCheapAgents } from './cheap-agents.mjs';
23
23
  import { planFor } from './jev-skill.mjs';
24
- import { SKILL_FILES, claudeDirOf, skillTargets } from './jev-facts.mjs';
24
+ import { SKILL_FILES, claudeDirOf, skillAccepted, skillState, skillTargets } from './jev-facts.mjs';
25
25
  import { findOnPath } from './detect-backends.mjs';
26
26
  import { consoleArgv } from './write-lanes.mjs';
27
27
  import { BUNDLED_SCRIPT_NAMES, INSTALLER_REL, SCRIPTS_REL, formatPlan, planGitHooks } from './git-hooks.mjs';
@@ -31,11 +31,11 @@ import { isDirectRun } from './direct-run.mjs';
31
31
  import { dirCovers as covers } from './declared-paths.mjs';
32
32
 
33
33
  const TOOLS = dirname(fileURLToPath(import.meta.url));
34
- const SKILL_VARIANTS = ['jev-skill', 'jev-skill.earlier'];
34
+ const SKILL_KIT = 'jev-skill.not-current';
35
+ const SKILL_VARIANTS = ['jev-skill', SKILL_KIT];
35
36
  const VELOCITY_VARIANTS = ['velocity-core', 'kit-tools-tier', 'bridge-tier'];
36
- const RESEED_VARIANTS = ['gate-hook.marker-stale', 'read-lane.stale'];
37
- const HOOK_VARIANTS = ['gate-hook', 'read-lane.missing', ...RESEED_VARIANTS];
38
- const STOP = 'state-block';
37
+ const [GATE_KIT, STOP, STOP_KIT] = ['gate-hook.not-current', 'state-block', 'state-block.not-current'];
38
+ const [HOOK_VARIANTS, STOP_VARIANTS, KIT_HOOKS] = [['gate-hook', GATE_KIT], [STOP, STOP_KIT], [GATE_KIT, STOP_KIT]];
39
39
  const MCP_VARIANTS = ['mcp-channel', 'mcp-channel.differing'];
40
40
  const AGENTS_KIT = 'agents.not-current';
41
41
  const AGENT_VARIANTS = ['agents', 'executor-vehicle', AGENTS_KIT];
@@ -43,7 +43,7 @@ const GIT_VARIANTS = ['enforcement', 'commit-guard', 'hook-checks'];
43
43
  const WORKTREES = 'worktrees-dir';
44
44
  const ATTRIBUTION = 'attribution';
45
45
  const FOOTPRINT = 'footprint-global';
46
- const VARIANTS = [...VELOCITY_VARIANTS, 'autonomy-render', ...HOOK_VARIANTS, STOP, ...MCP_VARIANTS, ...AGENT_VARIANTS, ...SKILL_VARIANTS, ...GIT_VARIANTS, WORKTREES, ATTRIBUTION, FOOTPRINT];
46
+ const VARIANTS = [...VELOCITY_VARIANTS, 'autonomy-render', ...HOOK_VARIANTS, ...STOP_VARIANTS, ...MCP_VARIANTS, ...AGENT_VARIANTS, ...SKILL_VARIANTS, ...GIT_VARIANTS, WORKTREES, ATTRIBUTION, FOOTPRINT];
47
47
  const HOOK_KEYS = ['hooks.PreToolUse', 'hooks.Stop'];
48
48
  const CREDENTIALS = 'sandbox.credentials.envVars';
49
49
  const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
@@ -163,6 +163,16 @@ const writerFacts = (facts, deps) => ({
163
163
  findWrapper: (name) => findOnPath(name, { getenv: facts.env }).state === 'present',
164
164
  findOnPath: (name) => findOnPath(name, { getenv: facts.env }),
165
165
  });
166
+ // A kit hook variant writes neither settings file, so a device there (a sandbox mask over an absent file) reads
167
+ // as absent; its acceptance is judged by the check from the two settings files with the writer's own predicate.
168
+ const SETTINGS_FILES = [SETTINGS_FILE, SETTINGS_LOCAL_FILE];
169
+ const unmaskedLstat = (facts) => (path, ...args) => {
170
+ const stat = lstatSync(path, ...args);
171
+ if (stat?.isCharacterDevice() && SETTINGS_FILES.some((rel) => path === join(facts.root, rel))) throw Object.assign(new Error(`ENOENT: ${path}`), { code: 'ENOENT' });
172
+ return stat;
173
+ };
174
+ const kitHookWired = (variant, facts) => SETTINGS_FILES.some((rel) => (variant === GATE_KIT ? isHookWired : isStopHookWired)(readSettingsFile(join(facts.root, rel), { lstat: unmaskedLstat(facts), cwd: facts.root }).data));
175
+ const skillIo = (deps) => ({ lstat: deps.lstat ?? lstatSync, readdir: deps.readdir ?? readdirSync, readFile: deps.readFile ?? readFileSync, pins: deps.pins });
166
176
 
167
177
  export const scopeOf = (variant, facts, deps = {}) => {
168
178
  const allowed = {};
@@ -195,21 +205,23 @@ export const scopeOf = (variant, facts, deps = {}) => {
195
205
  if (grantDir !== null && !worktreesGrantHoldsHome(grantDir, facts.home, facts)) {
196
206
  set('sandbox.filesystem.allowWrite', [homeRelative(grantDir, facts.home)]);
197
207
  }
198
- if (HOOK_VARIANTS.includes(variant)) set('hooks.PreToolUse', [buildHookSettingsEntry()]);
208
+ if (variant === 'gate-hook') set('hooks.PreToolUse', [buildHookSettingsEntry()]);
199
209
  else if (variant === STOP) set('hooks.Stop', [buildStopHookEntry()]);
200
210
  else if (MCP_VARIANTS.includes(variant)) {
201
211
  set(`${SERVERS_KEY}.${SERVER_NAME}`, [buildServerEntry(join(facts.toolsDir, 'mcp-server.mjs'))]);
202
212
  set(ENABLED_KEY, [SERVER_NAME]);
203
213
  set('permissions.allow', allowRulesFor());
204
214
  }
205
- const targets = SKILL_VARIANTS.includes(variant) ? skillTargets({ home: facts.home,
215
+ const judged = SKILL_VARIANTS.includes(variant) ? skillTargets({ home: facts.home,
206
216
  claudeDir: facts.claudeDir ?? claudeDirOf(facts.env, facts.home, facts.platform).dir }) : [];
207
- const filePaths = HOOK_VARIANTS.includes(variant) ? [join(facts.root, HOOK_FILE_REL)]
208
- : variant === STOP ? [join(facts.root, STATE_BLOCK_HOOK_FILE_REL)] : [];
209
- const directories = SKILL_VARIANTS.includes(variant) || variant === FOOTPRINT ? [] : [join(facts.root, CLAUDE_DIR)];
217
+ // The kit skill variant's scope holds only while the check's own judgement accepts the component, never read from the plan.
218
+ const targets = variant !== SKILL_KIT || skillAccepted(judged.map((target) => ({ ...target, ...skillState(target, skillIo(deps)) }))) ? judged : [];
219
+ const accepted = !KIT_HOOKS.includes(variant) || kitHookWired(variant, facts);
220
+ const filePaths = !accepted ? [] : HOOK_VARIANTS.includes(variant) ? [join(facts.root, HOOK_FILE_REL)] : STOP_VARIANTS.includes(variant) ? [join(facts.root, STATE_BLOCK_HOOK_FILE_REL)] : [];
221
+ const directories = !accepted || SKILL_VARIANTS.includes(variant) || variant === FOOTPRINT ? [] : [join(facts.root, CLAUDE_DIR)];
210
222
  const globalFile = variant === FOOTPRINT ? footprintPlan(facts, deps)?.source : undefined;
211
223
  if (globalFile) filePaths.push(globalFile);
212
- if (HOOK_VARIANTS.includes(variant) || variant === STOP) directories.push(join(facts.root, HOOKS_DIR));
224
+ if (accepted && (HOOK_VARIANTS.includes(variant) || STOP_VARIANTS.includes(variant))) directories.push(join(facts.root, HOOKS_DIR));
213
225
  if (AGENT_VARIANTS.includes(variant)) directories.push(join(facts.root, AGENTS_DIR));
214
226
  const kitNames = variant === AGENTS_KIT ? kitAgentNames(facts.root) : [];
215
227
  if (kitNames.length && agentsAccepted(facts.root, kitNames)) filePaths.push(...kitNames.map((name) => join(facts.root, AGENTS_DIR, name)));
@@ -248,7 +260,7 @@ const jsonAt = (path) => existsSync(path) ? JSON.parse(readFileSync(path, 'utf8'
248
260
  const regularBytes = (path) => lstatSync(path, { throwIfNoEntry: false })?.isFile() ? readFileSync(path) : undefined;
249
261
  const halted = (lines) => Object.assign(new Error(lines.join('\n')), { code: 'CHECK_HALTED', lines });
250
262
  const maskedFiles = (variant, facts) => {
251
- const paths = VELOCITY_VARIANTS.includes(variant) || variant === 'autonomy-render' || HOOK_VARIANTS.includes(variant)
263
+ const paths = VELOCITY_VARIANTS.includes(variant) || variant === 'autonomy-render' || variant === 'gate-hook'
252
264
  || variant === STOP || variant === WORKTREES || variant === ATTRIBUTION ? [SETTINGS_FILE, SETTINGS_LOCAL_FILE] : MCP_VARIANTS.includes(variant) ? [MCP_JSON_REL, SETTINGS_FILE] : [];
253
265
  return paths.flatMap((path) => lstatSync(join(facts.root, path), { throwIfNoEntry: false })?.isCharacterDevice()
254
266
  ? [`masked: ${path}`] : []);
@@ -259,7 +271,7 @@ export const plannedChange = (variant, facts, deps = {}) => {
259
271
  const temporaries = [];
260
272
  const created = [];
261
273
  let runs = null;
262
- const writerDeps = writerFacts(facts, deps);
274
+ const writerDeps = { ...writerFacts(facts, deps), ...(KIT_HOOKS.includes(variant) ? { lstat: unmaskedLstat(facts) } : {}) };
263
275
  const addFile = (path, before, after) => {
264
276
  files.push({ path, before: before ?? null, after });
265
277
  };
@@ -287,16 +299,13 @@ export const plannedChange = (variant, facts, deps = {}) => {
287
299
  const before = jsonAt(join(facts.root, SETTINGS_FILE));
288
300
  addFile(SETTINGS_FILE, before, mergeAutonomySettings(before, render));
289
301
  } else if (HOOK_VARIANTS.includes(variant)) {
290
- const plan = writeGateHook({ cwd: facts.root, dryRun: true, reseed: RESEED_VARIANTS.includes(variant) }, writerDeps);
302
+ const plan = (deps.writeGateHook ?? writeGateHook)({ cwd: facts.root, dryRun: true }, writerDeps);
291
303
  if (plan.wirePlanned) addFile(SETTINGS_FILE, plan.projectSettings.data, mergeHookEntry(plan.projectSettings.data));
292
- const path = join(facts.root, HOOK_FILE_REL);
293
- if (plan.placePlanned) writes.push({ path, bytes: plan.bundleContent });
294
- if (plan.reseedPlanned) writes.push({ path, bytes: plan.bundleContent });
295
- } else if (variant === STOP) {
296
- const plan = writeStateBlockHook({ cwd: facts.root, dryRun: true }, writerDeps);
304
+ if (plan.placePlanned || plan.replacePlanned) writes.push({ path: join(facts.root, HOOK_FILE_REL), bytes: plan.bundleContent });
305
+ } else if (STOP_VARIANTS.includes(variant)) {
306
+ const plan = (deps.writeStateBlockHook ?? writeStateBlockHook)({ cwd: facts.root, dryRun: true }, writerDeps);
297
307
  if (plan.mergePlanned) addFile(SETTINGS_FILE, plan.projectSettings.data, mergeStopEntry(plan.projectSettings.data));
298
- const path = join(facts.root, STATE_BLOCK_HOOK_FILE_REL);
299
- if (['create', 'replace'].includes(plan.placement)) writes.push({ path, bytes: plan.bundleContent });
308
+ if (['create', 'replace'].includes(plan.placement)) writes.push({ path: join(facts.root, STATE_BLOCK_HOOK_FILE_REL), bytes: plan.bundleContent });
300
309
  } else if (MCP_VARIANTS.includes(variant)) {
301
310
  const result = writeMcp({ cwd: facts.root, dryRun: true, replace: variant === 'mcp-channel.differing' }, writerDeps);
302
311
  const { plan, registration } = result;
@@ -308,7 +317,7 @@ export const plannedChange = (variant, facts, deps = {}) => {
308
317
  writes.push({ path: item.abs, bytes: item.content });
309
318
  }
310
319
  } else if (SKILL_VARIANTS.includes(variant)) {
311
- const plan = planFor({ ...writerDeps, lstat: lstatSync, readdir: readdirSync, readFile: readFileSync });
320
+ const plan = (deps.planFor ?? planFor)({ ...writerDeps, lstat: lstatSync, readdir: readdirSync, readFile: readFileSync });
312
321
  for (const target of plan.targets.filter(({ action }) => ['install', 'replace'].includes(action))) {
313
322
  const stem = basename(target.path);
314
323
  const bytes = Object.keys(SKILL_FILES).sort().map((name) => [name,
@@ -26,6 +26,7 @@ export const SCRIPT_CHANNEL = 'a script or suite of your own under its own name
26
26
  export const LOCAL_HOOK_CHANNEL = 'the local hook file scripts/pre-commit.local, which the commit hook runs first';
27
27
  export const VEHICLE_CHANNEL = VEHICLES_REL;
28
28
  export const AGENT_CHANNEL = '.claude/agents/<name>.local.md with a name: of its own';
29
+ export const HOOK_CHANNEL = '.claude/hooks/<name>.local.mjs';
29
30
  // The family files memory copies on Node evidence alone, accepted or not (the suite derives them).
30
31
  export const SEED_NAMES = Object.freeze(['_expect-shim.mjs', 'archive-decisions.mjs', 'archive-decisions.test.mjs', 'markdown-blocks.mjs']);
31
32
  const ROTATOR = 'archive-decisions.mjs';
@@ -81,10 +82,11 @@ const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
81
82
  // A fate is `written`, `stood` (an absent file that appeared with the bundled body), `refused` (its
82
83
  // write failed), or none: the run stopped before it, or, dry, would write it. The spec layer's pair
83
84
  // lines are these too, through the module's index.
84
- const VERBS = { prior: ['refreshed', 'refreshed to the bundled one'], custom: ['replaced', 'replaced by the bundled body'], absent: ['placed', 'placed from the bundled scripts'], derived: ['written', 'written with that body'], agent: ['written', 'written with that body'] };
85
- const HEADS = { prior: 'matches a body an earlier release shipped', custom: 'differs from every body this kit knows it shipped', absent: 'absent', derived: 'differs from the body derived from the vehicle settings', agent: 'differs from the body the kit writes for it' };
85
+ const VERBS = { prior: ['refreshed', 'refreshed to the bundled one'], custom: ['replaced', 'replaced by the bundled body'], absent: ['placed', 'placed from the bundled scripts'], derived: ['written', 'written with that body'], agent: ['written', 'written with that body'], hook: ['written', 'written with that body'] };
86
+ const HEADS = { prior: 'matches a body an earlier release shipped', custom: 'differs from every body this kit knows it shipped', absent: 'absent', derived: 'differs from the body derived from the vehicle settings', agent: 'differs from the body the kit writes for it', hook: 'differs from the body the kit writes for it' };
86
87
  const channelOf = (f) => (f.state === 'derived' ? `; its model and effort are set in ${VEHICLE_CHANNEL}`
87
88
  : f.state === 'agent' ? `; a vehicle of your own goes in ${AGENT_CHANNEL}`
89
+ : f.state === 'hook' ? `; a hook of your own goes in ${HOOK_CHANNEL}`
88
90
  : f.state === 'custom' ? `; an edit meant to last goes in ${f.name === INSTALLER_SET[0] ? LOCAL_HOOK_CHANNEL : SCRIPT_CHANNEL}` : '');
89
91
  export const fileLine = (f, fate, dryRun) => {
90
92
  if (fate === 'stood') return `${f.rel}: appeared while this run was placing it — the bundled body stands, nothing written`;