@sabaiway/agent-workflow-kit 16.1.0 → 17.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 +36 -0
- package/README.md +1 -1
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/advisor-writers.md +1 -1
- package/references/contracts.md +8 -3
- package/references/modes/agents.md +8 -6
- package/references/modes/recommendations.md +1 -1
- package/references/modes/upgrade.md +1 -1
- package/tools/apply-danger-check.mjs +8 -5
- package/tools/cheap-agents-read.mjs +8 -3
- package/tools/cheap-agents.mjs +62 -74
- package/tools/distribution-files/scripts.mjs +4 -2
- package/tools/ensure-configs.mjs +2 -2
- package/tools/ensure-executor.mjs +4 -4
- package/tools/recommendations.mjs +56 -70
- package/tools/write-lanes.mjs +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,42 @@ 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
|
+
## 17.0.0 — every kit agent file is written current with no question; `--executor` and `executor-vehicle.differing` retire (AD-208)
|
|
8
|
+
|
|
9
|
+
**MAJOR: `cheap-agents.mjs --executor` is removed, and the advisor's `executor-vehicle.differing` item is gone.** Before,
|
|
10
|
+
a placed cheap vehicle or roster-derived lens whose bytes differed from the kit's was `customized — preserved` forever,
|
|
11
|
+
a differing bundled `review-lens.md` was re-derived only on your yes to the `agents` item, and only the executor had a
|
|
12
|
+
no-question route. Now one rule covers every kit agent file — the five names the
|
|
13
|
+
kit bundles for `.claude/agents/` (`changelog-skeleton.md`, `executor.md`, `gate-triage.md`, `mechanical-sweep.md`,
|
|
14
|
+
`review-lens.md`) and each configured `review-lens-<model>-<effort>.md`: an absent one is placed, one whose bytes
|
|
15
|
+
differ is written with the body the kit writes for it, a current one is left, with no question and no copy kept.
|
|
16
|
+
Every other file under `.claude/agents/` is yours, and no kit tool writes it.
|
|
17
|
+
|
|
18
|
+
- **A new kit item, `agents.not-current`.** Over a placed component (a kit agent path holds a regular file) the
|
|
19
|
+
advisor's `agents` key renders this `lane: kit` item, which the agent applies with no question by the kit route. Its
|
|
20
|
+
text reads `{n} kit agent file(s) in .claude/agents/ not current — each is written with the body the kit writes for
|
|
21
|
+
it, with no question`, and its `recipe:` line names every file the apply writes. Over a component not placed the
|
|
22
|
+
`agents` offer is unchanged, and your yes to it is what places the component.
|
|
23
|
+
- **The lines.** A differing executor keeps, and a differing bundled `review-lens.md` now takes, `differs from the body
|
|
24
|
+
derived from the vehicle settings — written with that body; its model and effort are set in docs/ai/vehicles.json`. Every other kit agent file
|
|
25
|
+
reads `differs from the body the kit writes for it — written with that body; a vehicle of your own goes in
|
|
26
|
+
.claude/agents/<name>.local.md with a name: of its own`. No line says customized or preserved.
|
|
27
|
+
- **A link stops the run.** A link, another non-regular node or an unreadable file at a kit agent path stops the writer
|
|
28
|
+
naming it, in a dry run too, with nothing written; the advisor states that refusal as a skip. Every write is contained
|
|
29
|
+
and atomic.
|
|
30
|
+
- **The danger check** for `agents.not-current` admits only the kit agent paths, and over a tree with no placed kit
|
|
31
|
+
agent file it admits none (`refused:`, exit 1), so the no-question apply never places a component you never accepted.
|
|
32
|
+
- **The base `executor-vehicle` item yields** to `agents.not-current`, whose apply writes the executor: the two never
|
|
33
|
+
render for one tree.
|
|
34
|
+
- **`--executor` is gone, with no alias.** `cheap-agents.mjs --executor` now stops with `unknown argument: --executor`,
|
|
35
|
+
exit 2. No migration note is owed: its printed caller, the advisor's `executor-vehicle.differing` item, retires with
|
|
36
|
+
it, and the `agents` item now writes the executor; a script that ran `--executor --apply` runs `cheap-agents.mjs
|
|
37
|
+
--apply`, which writes every kit agent file that is not current.
|
|
38
|
+
- **The texts say the same.** The executor ensure's `pending` and `not-placed` lines and the `ensure-configs.mjs` help
|
|
39
|
+
name the advisor's `agents` item; the writer's header and `--help`; the agents, upgrade and recommendations modes;
|
|
40
|
+
`references/advisor-writers.md`; the README's agents row; the guide's *Reserved names and channels*, which names the
|
|
41
|
+
kit agent files and gains a sixth channel, `.claude/agents/<name>.local.md`, for a vehicle of your own.
|
|
42
|
+
|
|
7
43
|
## 16.1.0 — the agent writes a differing executor vehicle with no question: a new advisor lane `kit` (AD-207)
|
|
8
44
|
|
|
9
45
|
**A placed `.claude/agents/executor.md` that differs from the body derived from `docs/ai/vehicles.json` is now
|
package/README.md
CHANGED
|
@@ -263,7 +263,7 @@ file), or run the guarded `/agent-workflow-kit uninstall`.
|
|
|
263
263
|
| `/agent-workflow-kit worktrees` | any time | **parallel feature worktrees** — run several features in DIFFERENT agent sessions on one repo, zero interference on working-tree files (the ONE exception is the dependency cache, below): `provision <slug> --plan <file>` creates a sibling git worktree on branch `aw/<slug>` and populates it (registry-derived footprint copy-if-missing — a tracked file is never overwritten; EXACTLY ONE seeded feature plan; the `handoff-<slug>.md` record from minute zero; `node_modules` symlinked where the link stays ignored — a shared MUTABLE dependency cache: writes through it hit MAIN's node_modules; for isolation run the printed isolated-install command (`--install` only PRINTS it; on `--resume` run the printed unlink-first recovery first — printed only for a link whose RAW TARGET is MAIN's `node_modules`, since a foreign or unreadable link is reported as such with no removal advised); absolute root-pinned gate commands rebased on untracked copies only, and only while their bytes equal the MAIN source or its rebased form — user-modified copies stay untouched); `list` is read-only (slug, branch, base, dirty, handoff); `prompt <slug>` is read-only too and re-prints the satellite's cold-start prompt — the same text `provision` ends its report with: where the worktree is, its ONE seeded plan, the handoff as the one channel back, MAIN's orientation (shared series index, landing) and, under its own heading because it is probed on the satellite, that checkout's install posture — every value derived LIVE rather than replayed from the frozen provision record, a recorded value that no longer matches NAMED as a divergence (with the cause its source makes likely) instead of printed as the runnable one, every offered command marked with WHO runs it (`MAIN $ …` for the landing, `HERE $ …` for this checkout's own install, a posture with nothing to run staying prose), and a control character in any rendered value a typed STOP rather than a forged prompt line; `land <slug> --prepare` locks the common git dir, fail-closes on divergence or incomplete satellite state, transfers the complete accepted satellite diff onto a CLEAN main, runs sync plus the declared gates, and reports HEAD/TRANSFER/PREPARED OIDs — the commit ALWAYS stays a dialogue ask; `cleanup <slug>` takes the same lock and removes a LANDED worktree only after live landed-verification against main HEAD, while `--abandon` is the ONE destructive arm (destroys unlanded work; **no preview step** on any writer). The parent dir is the `docs/ai/worktrees.json` `parentDir` setting (default: the repo's sibling parent); an unwritable parent prints the `worktrees-dir` check line: the agent applies the grant on your chat yes after the check, one entry in this copy's `.claude/settings.local.json`, never the committed project settings (`init` is the route you may take instead, and the ack is the fallback for a host that ignores the key), else the printed terminal command runs it. Never commits, never pushes, never runs a subscription CLI. |
|
|
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
|
-
| `/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);
|
|
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
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
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. |
|
|
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). |
|
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: '
|
|
6
|
+
version: '17.0.0'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# agent-workflow-kit
|
package/capability.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.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",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
| mcp-channel | harness | mcp.mjs |
|
|
37
37
|
| mcp-channel.differing | harness | mcp.mjs |
|
|
38
38
|
| agents | harness | cheap-agents.mjs |
|
|
39
|
+
| agents.not-current | kit | cheap-agents.mjs |
|
|
39
40
|
| executor-vehicle | harness | cheap-agents.mjs |
|
|
40
|
-
| executor-vehicle.differing | kit | cheap-agents.mjs |
|
|
41
41
|
| attribution | harness | attribution.mjs |
|
|
42
42
|
| footprint-global | harness | hide-footprint.mjs |
|
|
43
43
|
| family-freshness | user | user step |
|
package/references/contracts.md
CHANGED
|
@@ -96,10 +96,13 @@ On `upgrade`, a pre-1.2.0 deployment with no block gets one (the agent asks, def
|
|
|
96
96
|
Every name the kit bundles and writes over on an upgrade is the kit's, and an edit there is never a
|
|
97
97
|
customization: every kit script, the spec layer's four pair files (`scripts/spec-schema.mjs`,
|
|
98
98
|
`scripts/spec-schema.test.mjs`, `scripts/check-docs-size.mjs`, `scripts/check-docs-size.test.mjs`)
|
|
99
|
-
included, the hook installer set
|
|
100
|
-
|
|
99
|
+
included, the hook installer set, the kit rules files `docs/ai/rules/<theme>.md` and the kit agent
|
|
100
|
+
files (the five the kit bundles for `.claude/agents/` — `changelog-skeleton.md`, `executor.md`,
|
|
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
|
|
101
104
|
replaced by the upgrade's ensures (a migration rewrites one only on the user's explicit yes) is the
|
|
102
|
-
user's own file. A customization goes into one of
|
|
105
|
+
user's own file. A customization goes into one of six channels instead:
|
|
103
106
|
|
|
104
107
|
- **Your own commit checks** go in the local hook file `scripts/pre-commit.local`: the managed
|
|
105
108
|
pre-commit hook runs it first, once the installer has run.
|
|
@@ -107,6 +110,8 @@ user's own file. A customization goes into one of five channels instead:
|
|
|
107
110
|
- **A setting** goes in a config a script reads.
|
|
108
111
|
- **Your own rules** go in the local rules file `docs/ai/rules/local/<theme>.md`.
|
|
109
112
|
- **An agent's model** goes in the vehicle settings `docs/ai/vehicles.json`.
|
|
113
|
+
- **A vehicle of your own** goes in `.claude/agents/<name>.local.md` with a `name:` of its own, which
|
|
114
|
+
no review roster names; a lens of your own in a review slot keeps a stem of its own.
|
|
110
115
|
|
|
111
116
|
No path segment of a file the kit bundles and places as its own has a dot-separated part exactly
|
|
112
117
|
`local`; a path of that form is the user's, and no kit tool writes one on its own. Outside that rule:
|
|
@@ -14,12 +14,14 @@ Writing code, running gates, and user-facing copy never move to these four vehic
|
|
|
14
14
|
|
|
15
15
|
**The fifth vehicle, `executor`, is the ONE full-tool one** (model and effort from `docs/ai/vehicles.json` — `opus` / `high` by default — and every tool, a shell included). It is the instrument behind the **Subagent** recipe, dispatched ONLY for a **bounded, file-disjoint slice** the orchestrator verifies afterwards by running its suites: a slice of execution (`plan-execution.execute`), a plan/contract authoring brief (`plan-authoring.author`), an authoring-round fold (`plan-authoring.fold`), a bounded chore (`routine.carrier`), an epic brief (`epic.author`), or one prompt the orchestrator wrote from one ledger row, run inside its Files (`task.execute`); `task.author` dispatches no slice, since the orchestrator writes each row's prompt itself. It **never commits** (no git write at all), is **never a review backend**, is **never a bridge substitute**, and is **never dispatched for read-only work** — a sweep, an inventory or a review rides a read-only vehicle instead.
|
|
16
16
|
|
|
17
|
-
**Its readiness is the vehicle FILE.** `surveyExecutorVehicle` answers exactly one of four states: **`placed`** (bytes equal to the body derived from `docs/ai/vehicles.json` at `.claude/agents/executor.md`), **`customized`** (a readable regular file whose frontmatter names `executor` and whose tools are not read-only), **`unusable`** (a symlink, a non-regular or unreadable file, one failing that check, or an unreadable `docs/ai/vehicles.json` — with the reason), **`missing`**. `placed` and `customized` are dispatchable; on `unusable` or `missing` a `subagent` slot **degrades to Solo** with a reason naming this mode's apply command (and `docs/ai/vehicles.json` when that file is unreadable). `/agent-workflow-kit status` shows the state in its `agents` block and the deployment advisor raises it when a configured slot names `subagent` and the vehicle is `unusable` or `missing` — that item is **`executor-vehicle`** (attention-class: a configured declaration that is broken)
|
|
17
|
+
**Its readiness is the vehicle FILE.** `surveyExecutorVehicle` answers exactly one of four states: **`placed`** (bytes equal to the body derived from `docs/ai/vehicles.json` at `.claude/agents/executor.md`), **`customized`** (a readable regular file whose frontmatter names `executor` and whose tools are not read-only), **`unusable`** (a symlink, a non-regular or unreadable file, one failing that check, or an unreadable `docs/ai/vehicles.json` — with the reason), **`missing`**. `placed` and `customized` are dispatchable; on `unusable` or `missing` a `subagent` slot **degrades to Solo** with a reason naming this mode's apply command (and `docs/ai/vehicles.json` when that file is unreadable). `/agent-workflow-kit status` shows the state in its `agents` block and the deployment advisor raises it when a configured slot names `subagent` and the vehicle is `unusable` or `missing` — that item is **`executor-vehicle`** (attention-class: a configured declaration that is broken). It yields to the `agents` key's `agents.not-current`, which writes the executor in a placed component — a regular executor whose bytes differ, the check failing or not — so the two never render for one tree; over a component not placed the `agents` offer places the executor and `executor-vehicle` names the solo degrade beside it. It is a claim about the FILE, never about the host: a Claude Code lane, like this mode itself.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**Every kit agent file is written current with no question.** The kit agent files are the five bundled names and every configured roster-derived lens `review-lens-<model>-<effort>.md`; an absent one is placed, one whose bytes differ is written with the body the kit writes for it, no copy kept, and a current one is left. Every other file under `.claude/agents/` is yours and no kit tool writes it: a vehicle of your own goes in `.claude/agents/<name>.local.md` with a `name:` of its own (Claude Code knows a subagent by its `name:` alone).
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
2. **Only on an explicit yes**, re-run with `--apply`. It writes **only** under `.claude/agents/` — never `settings.json` / `settings.local.json`, never a commit. `--apply` is deployment-gated (the stamp must be at the lineage head) and symlink-safe (a symlinked project root / `.claude` / `.claude/agents` / target file is a STOP, in a `--dry-run` too). **`--executor`** is the form of the advisor's `executor-vehicle.differing` kit item, which the agent applies with no question: it plans the executor alone and reads no orchestration config, so its `--apply` writes `.claude/agents/executor.md` and no other file.
|
|
23
|
-
3. **Hidden-mode deployments:** after an apply without `--executor`, run the hide-footprint reconcile (`node ${CLAUDE_SKILL_DIR}/tools/hide-footprint.mjs --dir <project> --reconcile`) so the placed files stay invisible to `git status` — `/.claude/agents/` is in the known-footprint registry; the apply report reminds you.
|
|
21
|
+
Run `node ${CLAUDE_SKILL_DIR}/tools/cheap-agents.mjs [--dry-run | --apply] [--cwd <dir>]`:
|
|
24
22
|
|
|
25
|
-
**
|
|
23
|
+
1. **`--dry-run` first, always** (the default — changes nothing). It previews, per kit agent file, whether it **would place** the file, finds it **already current**, or finds its bytes differ. The executor's and the bundled `review-lens`'s line reads `<rel>: differs from the body derived from the vehicle settings — would be written with that body; its model and effort are set in docs/ai/vehicles.json`; every other kit file's reads `<rel>: differs from the body the kit writes for it — would be written with that body; a vehicle of your own goes in .claude/agents/<name>.local.md with a name: of its own` (on `--apply`, `written with that body`). The lens takes its model and effort from that file's optional `review-lens` section — `opus` / `high` by default — and the report prints its posture line beside the executor's.
|
|
24
|
+
2. **`--apply`** writes what the preview named. Over a placed component the advisor's `agents.not-current` item applies this `--apply` through the kit route with no question; the first placement is the yes to the advisor's `agents` offer. It writes **only** under `.claude/agents/`, each write contained and atomic — never `settings.json` / `settings.local.json`, never a commit. `--apply` is deployment-gated (the stamp must be at the lineage head). A symlinked project root / `.claude` / `.claude/agents`, or a link, another non-regular node or an unreadable file at any kit agent path, stops the run naming it with nothing written, in a `--dry-run` too.
|
|
25
|
+
3. **Hidden-mode deployments:** after the apply that places the component, run the hide-footprint reconcile (`node ${CLAUDE_SKILL_DIR}/tools/hide-footprint.mjs --dir <project> --reconcile`) so the placed files stay invisible to `git status` — `/.claude/agents/` is in the known-footprint registry; that apply's report reminds you.
|
|
26
|
+
|
|
27
|
+
**Invariants:** writer (writes only `.claude/agents/`) · preview by default · every kit agent file written current with no question, a link or an unreadable file at a kit agent path a STOP naming it · never touches settings · never commits · **no READ-ONLY vehicle grants `Bash`, and exactly one bundled vehicle, `executor`, grants a shell** · the cheap-lane vehicles are pinned to `model: haiku` + `effort: low`, and the bundled review lens file is pinned OFF the cheap model (`opus` / `high`), its placed copy taking the posture `docs/ai/vehicles.json` sets — `opus` / `high` when unset (all content-tested).
|
|
@@ -24,7 +24,7 @@ The **consent route** for a harness item: run its `check:` line in the sandbox a
|
|
|
24
24
|
|
|
25
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.
|
|
26
26
|
|
|
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);
|
|
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
|
|
|
29
29
|
**Per-item posture notes (the consent moment — surface BEFORE running or handing over the apply):**
|
|
30
30
|
|
|
@@ -41,7 +41,7 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md · ${CLAUDE_SKI
|
|
|
41
41
|
|
|
42
42
|
**What the autonomy-declaration ensure does.** `docs/ai/autonomy.json` must exist: created from `${CLAUDE_SKILL_DIR}/references/templates/autonomy.json` if missing (the kit's own template twin — a stale memory never silently loses the seed); **an existing file is preserved byte-for-byte** (a declared policy is authored content). The seed is SPARSE (the onboarding note only) and **defaults-equivalent** — deploying it never changes behavior (the computed defaults stay the policy until the user declares levels with `/agent-workflow-kit set-autonomy` or by hand).
|
|
43
43
|
|
|
44
|
-
**What the executor ensure does.** It never writes: a placed `.claude/agents/executor.md` whose bytes differ from the body derived from `docs/ai/vehicles.json` is `pending`
|
|
44
|
+
**What the executor ensure does.** It never writes: a placed `.claude/agents/executor.md` whose bytes differ from the body derived from `docs/ai/vehicles.json` is `pending` and an absent one is `not-placed` — the advisor's `agents` item writes the derived body.
|
|
45
45
|
|
|
46
46
|
**What the enforcement-script ensure does.** It judges every kit script — each `*.mjs` of `${CLAUDE_SKILL_DIR}/references/scripts/` but the spec-layer pairs — once the component is accepted: a kit script outside the seed names (memory's own copies) stands in `scripts/` as a regular file. Each file by proof, with no question and no copy kept: a shipped prior is refreshed, an edited body replaced (its line names where a lasting edit goes), an absent file placed, the current body left. The hook installer and its two suites go first; a closing line says the commit hook runs the files written. A declined enforcement offer keeps the standing seed files current with the modules they import, places no other kit script (one line says so) and words that hook-run line as a condition. With no kit script there: `not-placed`, nothing written. **The ADR store, after the writes:** where the run judged the rotator, it runs `scripts/archive-decisions.mjs --ensure-current`, with no question, which brings the store current (an older layout moved) or writes nothing; its lines are relayed under `ADR store: `. A rotator that does not bring the store current is `failed` / `adr-store-not-current`, the scripts written above staying as written: its refusal stops the upgrade. Where the size practice measures `scripts/`, a write may grow a root past its record: the size check names its own reasoned `--write-baseline`. **Whether Node runs here is PROVEN, never proxied:** the ensure runs on a regular `package.json` at the root OR on any kit-seeded `scripts/*.mjs` already deployed; only when every probe answers absent does it report `skipped-no-node-evidence`, a line naming every probe it checked, while the config ensures still run; a probe that cannot be read is `failed` with the cause `node-evidence-unverifiable`, nothing written. **A `skipped-*` outcome whose stated reason this tool could itself disprove may not exist**. A deployed pre-commit hook takes a new installer body only when the installer next runs: the `enforcement` check line and apply, by the consent route, re-run it (it refuses a non-marker hook as always); until then `scripts/pre-commit.local` does not run.
|
|
47
47
|
|
|
@@ -19,7 +19,7 @@ import { HOOK_FILE_REL, HOOKS_DIR, buildHookSettingsEntry, mergeHookEntry, write
|
|
|
19
19
|
import { STATE_BLOCK_HOOK_FILE_REL, buildStopHookEntry, 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
|
-
import { AGENTS_DIR,
|
|
22
|
+
import { AGENTS_DIR, agentsAccepted, kitAgentNames, writeCheapAgents } from './cheap-agents.mjs';
|
|
23
23
|
import { planFor } from './jev-skill.mjs';
|
|
24
24
|
import { SKILL_FILES, claudeDirOf, skillTargets } from './jev-facts.mjs';
|
|
25
25
|
import { findOnPath } from './detect-backends.mjs';
|
|
@@ -37,8 +37,8 @@ const RESEED_VARIANTS = ['gate-hook.marker-stale', 'read-lane.stale'];
|
|
|
37
37
|
const HOOK_VARIANTS = ['gate-hook', 'read-lane.missing', ...RESEED_VARIANTS];
|
|
38
38
|
const STOP = 'state-block';
|
|
39
39
|
const MCP_VARIANTS = ['mcp-channel', 'mcp-channel.differing'];
|
|
40
|
-
const
|
|
41
|
-
const AGENT_VARIANTS = ['agents', 'executor-vehicle',
|
|
40
|
+
const AGENTS_KIT = 'agents.not-current';
|
|
41
|
+
const AGENT_VARIANTS = ['agents', 'executor-vehicle', AGENTS_KIT];
|
|
42
42
|
const GIT_VARIANTS = ['enforcement', 'commit-guard', 'hook-checks'];
|
|
43
43
|
const WORKTREES = 'worktrees-dir';
|
|
44
44
|
const ATTRIBUTION = 'attribution';
|
|
@@ -211,6 +211,9 @@ export const scopeOf = (variant, facts, deps = {}) => {
|
|
|
211
211
|
if (globalFile) filePaths.push(globalFile);
|
|
212
212
|
if (HOOK_VARIANTS.includes(variant) || variant === STOP) directories.push(join(facts.root, HOOKS_DIR));
|
|
213
213
|
if (AGENT_VARIANTS.includes(variant)) directories.push(join(facts.root, AGENTS_DIR));
|
|
214
|
+
const kitNames = variant === AGENTS_KIT ? kitAgentNames(facts.root) : [];
|
|
215
|
+
if (kitNames.length && agentsAccepted(facts.root, kitNames)) filePaths.push(...kitNames.map((name) => join(facts.root, AGENTS_DIR, name)));
|
|
216
|
+
else if (kitNames.length) directories.splice(0);
|
|
214
217
|
const existingAncestor = grantDir === null ? null : nearestExistingDir(grantDir, facts);
|
|
215
218
|
for (let at = grantDir; at !== existingAncestor; at = dirname(at)) directories.push(at);
|
|
216
219
|
for (const target of targets) {
|
|
@@ -237,7 +240,7 @@ export const scopeOf = (variant, facts, deps = {}) => {
|
|
|
237
240
|
return correctFile && (!gains || change === 'added') && !(key === ATTRIBUTION_KEY && change === 'removed') && Boolean(allowed[key]?.(value));
|
|
238
241
|
},
|
|
239
242
|
admitsPath: (path, directory = false) => directory ? directories.includes(path) : filePaths.includes(path)
|
|
240
|
-
|| (variant
|
|
243
|
+
|| (variant !== AGENTS_KIT && AGENT_VARIANTS.includes(variant) && covers(join(facts.root, AGENTS_DIR), path)),
|
|
241
244
|
};
|
|
242
245
|
};
|
|
243
246
|
|
|
@@ -300,7 +303,7 @@ export const plannedChange = (variant, facts, deps = {}) => {
|
|
|
300
303
|
if (plan.writeMcpJson) addFile(MCP_JSON_REL, registration.mcpJson.data, JSON.parse(plan.mcpBody));
|
|
301
304
|
if (plan.writeSettings) addFile(SETTINGS_FILE, registration.settings.data, JSON.parse(plan.settingsBody));
|
|
302
305
|
} else if (AGENT_VARIANTS.includes(variant)) {
|
|
303
|
-
const plan = writeCheapAgents({ cwd: facts.root, dryRun: true
|
|
306
|
+
const plan = writeCheapAgents({ cwd: facts.root, dryRun: true }, writerDeps);
|
|
304
307
|
for (const item of plan.plan.filter(({ action }) => ['place', 're-derive'].includes(action))) {
|
|
305
308
|
writes.push({ path: item.abs, bytes: item.content });
|
|
306
309
|
}
|
|
@@ -96,7 +96,7 @@ export const assertDirSafe = (absPath, relPath, fs) => {
|
|
|
96
96
|
return { absent: false };
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
// Per-template placement plan: place | already-current | re-derive
|
|
99
|
+
// Per-template placement plan: place | already-current | re-derive (every differing kit file).
|
|
100
100
|
export const planPlacement = (templates, projectDir, deps = {}) => {
|
|
101
101
|
const fs = readFsDeps(deps);
|
|
102
102
|
return templates.map((template) => {
|
|
@@ -109,11 +109,16 @@ export const planPlacement = (templates, projectDir, deps = {}) => {
|
|
|
109
109
|
}
|
|
110
110
|
const existing = fs.readFile(abs, UTF8);
|
|
111
111
|
if (existing === template.content) return { ...template, rel, abs, action: 'already-current' };
|
|
112
|
-
|
|
113
|
-
return { ...template, rel, abs, action: 'customized-preserved', existing };
|
|
112
|
+
return { ...template, rel, abs, action: 're-derive', existing };
|
|
114
113
|
});
|
|
115
114
|
};
|
|
116
115
|
|
|
116
|
+
// The component is accepted when a kit agent path of the given names holds a regular file, never followed.
|
|
117
|
+
export const agentsAccepted = (projectDir, names, deps = {}) => {
|
|
118
|
+
const fs = readFsDeps(deps);
|
|
119
|
+
return names.some((name) => lstatNoFollow(join(projectDir, AGENTS_DIR, name), fs)?.isFile() === true);
|
|
120
|
+
};
|
|
121
|
+
|
|
117
122
|
// ── the executor vehicle's readiness (the subagent carrier's one instrument) ──────────
|
|
118
123
|
|
|
119
124
|
export const EXECUTOR_VEHICLE = 'executor.md';
|
package/tools/cheap-agents.mjs
CHANGED
|
@@ -7,31 +7,32 @@
|
|
|
7
7
|
// only for a bounded execution, authoring, or write-capable routine slice the orchestrator verifies, never for read-only work, and it
|
|
8
8
|
// never commits. `surveyExecutorVehicle` is that vehicle's readiness, for the subagent carrier.
|
|
9
9
|
//
|
|
10
|
-
// The family's second `.claude/` writer, the velocity-profile.mjs discipline
|
|
10
|
+
// The family's second `.claude/` writer, the velocity-profile.mjs discipline:
|
|
11
11
|
// • preview-then-mutate — `--dry-run` is the DEFAULT and writes nothing; `--apply` writes;
|
|
12
12
|
// • deployment-gated — `--apply` STOPs unless docs/ai/.workflow-version equals the lineage
|
|
13
13
|
// head (a dry-run stays usable whatever the stamp says; an unreadable orchestration config
|
|
14
14
|
// STOPs both, since the derived lenses it names cannot be known);
|
|
15
|
-
// • symlink-safe — a symlinked project root, `.claude`, `.claude/agents` or
|
|
16
|
-
// STOP, in a dry-run too,
|
|
17
|
-
// •
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
15
|
+
// • symlink-safe — a symlinked project root, `.claude`, `.claude/agents` or any non-regular or
|
|
16
|
+
// unreadable kit agent file is a STOP naming it, in a dry-run too, nothing written;
|
|
17
|
+
// • every kit agent file is written current with no question: an absent one is placed, one whose
|
|
18
|
+
// bytes differ is written with the body the kit writes for it (the executor's and the bundled
|
|
19
|
+
// review lens's derived from docs/ai/vehicles.json), no copy kept; an identical file is
|
|
20
|
+
// `already current` (idempotent re-run). A vehicle of your own goes in
|
|
21
|
+
// .claude/agents/<name>.local.md with a `name:` of its own; no kit tool writes it;
|
|
22
|
+
// • writes ONLY under .claude/agents/, each write contained and atomic — never settings.json /
|
|
23
|
+
// settings.local.json, never commits.
|
|
23
24
|
//
|
|
24
25
|
// Claude-Code-specific (like velocity): .claude/agents/ is a Claude Code surface; other agent
|
|
25
26
|
// hosts ignore it. In a HIDDEN-mode deployment, run the hide-footprint reconcile after apply so
|
|
26
27
|
// the placed files stay out of `git status` (the registry already carries /.claude/agents/); the
|
|
27
|
-
// apply
|
|
28
|
+
// report of an apply that placed the component reminds you.
|
|
28
29
|
//
|
|
29
|
-
// Exit codes: 0 done / dry-run
|
|
30
|
-
//
|
|
31
|
-
//
|
|
30
|
+
// Exit codes: 0 done / dry-run; 1 precondition STOP (stamp, a link or unreadable kit agent file,
|
|
31
|
+
// missing bundle, an unreadable orchestration config or docs/ai/vehicles.json — their derived
|
|
32
|
+
// bodies cannot be known); 2 usage.
|
|
32
33
|
// Dependency-free, Node >= 22. No side effects on import.
|
|
33
34
|
|
|
34
|
-
import { mkdirSync
|
|
35
|
+
import { mkdirSync } from 'node:fs';
|
|
35
36
|
import { join, resolve } from 'node:path';
|
|
36
37
|
import { fileURLToPath } from 'node:url';
|
|
37
38
|
import { isDirectRun } from './direct-run.mjs';
|
|
@@ -50,13 +51,13 @@ import {
|
|
|
50
51
|
CLAUDE_DIR,
|
|
51
52
|
WORKFLOW_STAMP,
|
|
52
53
|
EXPECTED_WORKFLOW_VERSION,
|
|
53
|
-
UTF8,
|
|
54
54
|
CHEAP_AGENTS_STAMP,
|
|
55
55
|
CHEAP_AGENTS_SYMLINK,
|
|
56
56
|
CHEAP_AGENTS_BUNDLE,
|
|
57
57
|
CHEAP_AGENTS_CONFIG,
|
|
58
58
|
CHEAP_AGENTS_VEHICLES,
|
|
59
59
|
EXECUTOR_VEHICLE,
|
|
60
|
+
REVIEW_LENS_VEHICLE,
|
|
60
61
|
executorTemplate,
|
|
61
62
|
reviewLensTemplate,
|
|
62
63
|
makeCheapAgentsError,
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
readStamp,
|
|
66
67
|
assertDirSafe,
|
|
67
68
|
planPlacement,
|
|
69
|
+
agentsAccepted,
|
|
68
70
|
} from './cheap-agents-read.mjs';
|
|
69
71
|
|
|
70
72
|
export {
|
|
@@ -84,6 +86,7 @@ export {
|
|
|
84
86
|
makeCheapAgentsError,
|
|
85
87
|
readBundledAgents,
|
|
86
88
|
planPlacement,
|
|
89
|
+
agentsAccepted,
|
|
87
90
|
surveyExecutorVehicle,
|
|
88
91
|
EXECUTOR_VEHICLE,
|
|
89
92
|
EXECUTOR_VEHICLE_REL,
|
|
@@ -99,7 +102,7 @@ const EXIT_USAGE = 2;
|
|
|
99
102
|
// never silent).
|
|
100
103
|
export const FALLBACK_LENS_ADDITIONAL_ONLY = 'review-lens is an ADDITIONAL read-only review opinion, not a replacement for your plan or diff review recipe.';
|
|
101
104
|
|
|
102
|
-
const USAGE = `usage: cheap-agents [--dry-run | --apply] [--
|
|
105
|
+
const USAGE = `usage: cheap-agents [--dry-run | --apply] [--cwd <dir>] [--help]
|
|
103
106
|
|
|
104
107
|
Places the bundled subagent definitions into the project's ${AGENTS_DIR}/. Four vehicles grant NO
|
|
105
108
|
shell: three ride a cheap model (haiku/low) for mechanical work — extraction sweeps, changelog
|
|
@@ -109,19 +112,15 @@ authoring, or write-capable routine slice the orchestrator verifies, never for r
|
|
|
109
112
|
it never commits.
|
|
110
113
|
Default is --dry-run (a preview; writes nothing). --apply writes.
|
|
111
114
|
Configured derived review lenses are planned and placed beside the bundled vehicles.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
${AGENTS_DIR}/executor.md and no other file.`;
|
|
115
|
+
Every kit agent file is written current with no question: an absent one is placed, one whose bytes
|
|
116
|
+
differ is written on --apply with the body the kit writes for it, no copy kept. The executor's model
|
|
117
|
+
and effort come from docs/ai/vehicles.json, the review lens's from its review-lens section there
|
|
118
|
+
(opus and high by default). A link or an unreadable file at a kit agent path stops the run naming it,
|
|
119
|
+
nothing written. A vehicle of your own goes in ${AGENTS_DIR}/<name>.local.md with a name: of its own.`;
|
|
118
120
|
|
|
119
121
|
export const fail = (exitCode, message) => Object.assign(new Error(message), { exitCode });
|
|
120
122
|
|
|
121
|
-
const writeFsDeps = (deps = {}) => ({
|
|
122
|
-
mkdir: deps.mkdir ?? mkdirSync,
|
|
123
|
-
writeFile: deps.writeFile ?? writeFileSync,
|
|
124
|
-
});
|
|
123
|
+
const writeFsDeps = (deps = {}) => ({ mkdir: deps.mkdir ?? mkdirSync });
|
|
125
124
|
|
|
126
125
|
const refuseSymlinkedRoot = (projectDir, deps) => {
|
|
127
126
|
const root = resolve(projectDir);
|
|
@@ -134,12 +133,11 @@ const refuseSymlinkedRoot = (projectDir, deps) => {
|
|
|
134
133
|
if (stat.isSymbolicLink()) throw makeCheapAgentsError(CHEAP_AGENTS_SYMLINK, `the project root ${root} is a symlink — refusing to write through it`);
|
|
135
134
|
};
|
|
136
135
|
|
|
137
|
-
|
|
138
|
-
export const preflightCheapAgents = ({ cwd, derived = [], alone = false }, deps = {}) => {
|
|
136
|
+
export const preflightCheapAgents = ({ cwd, derived = [] }, deps = {}) => {
|
|
139
137
|
const fs = readFsDeps(deps);
|
|
140
138
|
const projectDir = cwd ?? process.cwd();
|
|
141
139
|
refuseSymlinkedRoot(projectDir, deps);
|
|
142
|
-
const templatesByName = new Map(
|
|
140
|
+
const templatesByName = new Map(readBundledAgents(deps).map((template) => [template.name, template]));
|
|
143
141
|
for (const template of derived) templatesByName.set(template.name, template);
|
|
144
142
|
const templates = [...templatesByName.values()];
|
|
145
143
|
const stamp = readStamp(join(projectDir, WORKFLOW_STAMP), fs);
|
|
@@ -181,21 +179,22 @@ const configuredDerivedTemplates = (cwd, deps) => {
|
|
|
181
179
|
return [...templates.values()];
|
|
182
180
|
};
|
|
183
181
|
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
// The kit agent file names, read from the bundle and the orchestration config, never from a plan.
|
|
183
|
+
export const kitAgentNames = (cwd, deps = {}) =>
|
|
184
|
+
[...new Set([...readBundledAgents(deps), ...configuredDerivedTemplates(cwd, deps)].map(({ name }) => name))];
|
|
185
|
+
|
|
186
|
+
export const applyCheapAgentsCommand = (root) =>
|
|
187
|
+
`node ${shellQuoteArg(fileURLToPath(import.meta.url))} --apply --cwd ${shellQuoteArg(root)}`;
|
|
186
188
|
|
|
187
189
|
// ── the writer ────────────────────────────────────────────────────────────────────────
|
|
188
190
|
|
|
189
|
-
|
|
190
|
-
export const writeCheapAgents = ({ cwd, dryRun = true, executorOnly = false } = {}, deps = {}) => {
|
|
191
|
+
export const writeCheapAgents = ({ cwd, dryRun = true } = {}, deps = {}) => {
|
|
191
192
|
const fs = writeFsDeps(deps);
|
|
192
193
|
const projectDir = cwd ?? process.cwd();
|
|
193
194
|
refuseSymlinkedRoot(projectDir, deps);
|
|
194
195
|
const { posture, lensPosture } = loadPosturesOrStop(projectDir, deps);
|
|
195
|
-
const derived =
|
|
196
|
-
|
|
197
|
-
];
|
|
198
|
-
const preflight = { executorOnly, ...preflightCheapAgents({ cwd: projectDir, derived, alone: executorOnly }, deps) };
|
|
196
|
+
const derived = [executorTemplate(posture, deps), reviewLensTemplate(lensPosture, deps), ...configuredDerivedTemplates(projectDir, deps)];
|
|
197
|
+
const preflight = preflightCheapAgents({ cwd: projectDir, derived }, deps);
|
|
199
198
|
if (dryRun) return { wrote: false, dryRun: true, posture, lensPosture, ...preflight };
|
|
200
199
|
|
|
201
200
|
if (!preflight.stampOk) {
|
|
@@ -204,35 +203,28 @@ export const writeCheapAgents = ({ cwd, dryRun = true, executorOnly = false } =
|
|
|
204
203
|
`not a deployed agent-workflow project at lineage ${EXPECTED_WORKFLOW_VERSION} (found ${preflight.stamp ?? 'none'}) — run init/upgrade first`,
|
|
205
204
|
);
|
|
206
205
|
}
|
|
206
|
+
const accepted = agentsAccepted(projectDir, preflight.plan.map((item) => item.name), deps);
|
|
207
207
|
const toWrite = preflight.plan.filter((item) => item.action === 'place' || item.action === 're-derive');
|
|
208
208
|
if (toWrite.length > 0) fs.mkdir(join(preflight.projectDir, AGENTS_DIR), { recursive: true });
|
|
209
209
|
for (const item of toWrite) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
});
|
|
214
|
-
} else fs.writeFile(item.abs, item.content, UTF8);
|
|
210
|
+
writeContainedFileAtomic(preflight.projectDir, item.abs, item.content, deps, {
|
|
211
|
+
label: item.rel, stop: (message) => makeCheapAgentsError(CHEAP_AGENTS_SYMLINK, message),
|
|
212
|
+
});
|
|
215
213
|
}
|
|
216
|
-
return { wrote: toWrite.length > 0, dryRun: false, posture, lensPosture, ...preflight };
|
|
214
|
+
return { wrote: toWrite.length > 0, dryRun: false, accepted, posture, lensPosture, ...preflight };
|
|
217
215
|
};
|
|
218
216
|
|
|
219
217
|
// ── report ────────────────────────────────────────────────────────────────────────────
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
'customized-preserved': 'customized — preserved (delete the file to reseed from the bundle)',
|
|
225
|
-
};
|
|
226
|
-
const LENS_REDERIVE_LABEL = 're-derived — the earlier body was replaced; set its model and effort in docs/ai/vehicles.json';
|
|
227
|
-
// The executor's re-derive line is the distribution-files composer's, over the state `derived`.
|
|
219
|
+
// A differing file's line is the distribution-files composer's: the state `derived` for the two
|
|
220
|
+
// bodies derived from the vehicle settings, `agent` for every other kit agent file.
|
|
221
|
+
const DERIVED_FROM_SETTINGS = new Set([EXECUTOR_VEHICLE, REVIEW_LENS_VEHICLE]);
|
|
228
222
|
const rowLine = (item, dryRun) => {
|
|
229
|
-
if (item.action === 're-derive'
|
|
230
|
-
|
|
223
|
+
if (item.action === 're-derive') {
|
|
224
|
+
const state = DERIVED_FROM_SETTINGS.has(item.name) ? 'derived' : 'agent';
|
|
225
|
+
return fileLine({ rel: item.rel, name: item.name, state }, dryRun ? undefined : 'written', dryRun);
|
|
231
226
|
}
|
|
232
|
-
|
|
233
|
-
: dryRun && item.action === 're-derive' ? 'would re-derive'
|
|
234
|
-
: item.action === 're-derive' ? LENS_REDERIVE_LABEL : ACTION_LABEL[item.action];
|
|
235
|
-
return `${item.rel}: ${verb}`;
|
|
227
|
+
return `${item.rel}: ${item.action === 'already-current' ? 'already current' : dryRun ? 'would place' : 'place'}`;
|
|
236
228
|
};
|
|
237
229
|
|
|
238
230
|
export const formatResult = (result) => {
|
|
@@ -246,25 +238,22 @@ export const formatResult = (result) => {
|
|
|
246
238
|
if (!result.stampOk) {
|
|
247
239
|
lines.push(`note: no current deployment stamp found (${result.stamp ?? 'none'}) — --apply will refuse until init/upgrade runs.`);
|
|
248
240
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
lines.push(`executor posture: model=${safeLine(posture.model)} effort=${safeLine(posture.effort)} fallback=${safeLine(posture.fallback)} (source: ${safeLine(posture.source)}) — set in docs/ai/vehicles.json`);
|
|
258
|
-
if (!result.executorOnly) {
|
|
259
|
-
lines.push(`review-lens posture: model=${safeLine(lensPosture.model)} effort=${safeLine(lensPosture.effort)} (source: ${safeLine(lensPosture.source)}) — set in docs/ai/vehicles.json`);
|
|
260
|
-
}
|
|
241
|
+
const readOnlyCount = result.plan.filter((item) => item.name !== EXECUTOR_VEHICLE).length;
|
|
242
|
+
lines.push(
|
|
243
|
+
`${readOnlyCount} vehicles are Claude Code subagents with READ-ONLY tools and NO shell as the kit writes them — so a fan-out on the shipped templates can never turn into a wave of approval prompts.`,
|
|
244
|
+
`three of those ride the cheap lane (model: haiku, effort: low) for mechanical work; ${FALLBACK_LENS_ADDITIONAL_ONLY}`,
|
|
245
|
+
'executor is the one FULL-TOOL vehicle: dispatched only for a bounded execution, authoring, or write-capable routine slice the orchestrator verifies, never for read-only work, and it never commits.',
|
|
246
|
+
`executor posture: model=${safeLine(posture.model)} effort=${safeLine(posture.effort)} fallback=${safeLine(posture.fallback)} (source: ${safeLine(posture.source)}) — set in docs/ai/vehicles.json`,
|
|
247
|
+
`review-lens posture: model=${safeLine(lensPosture.model)} effort=${safeLine(lensPosture.effort)} (source: ${safeLine(lensPosture.source)}) — set in docs/ai/vehicles.json`,
|
|
248
|
+
);
|
|
261
249
|
// A preview must print the EXACT command that applies it. The advisor renders this dry-run as an
|
|
262
250
|
// item's one-liner, and that flow's contract is "run the printed command, no improvisation" — a
|
|
263
251
|
// bare "re-run with --apply" would leave the caller to reconstruct --cwd and its quoting.
|
|
264
252
|
if (result.dryRun && result.plan.some((item) => item.action === 'place' || item.action === 're-derive')) {
|
|
265
|
-
lines.push(`to apply, run exactly: ${applyCheapAgentsCommand(result.projectDir
|
|
253
|
+
lines.push(`to apply, run exactly: ${applyCheapAgentsCommand(result.projectDir)}`);
|
|
266
254
|
}
|
|
267
|
-
|
|
255
|
+
// Over a placed component the known-footprint registry already hides every kit agent file.
|
|
256
|
+
if (!result.dryRun && result.wrote && !result.accepted) {
|
|
268
257
|
lines.push('hidden-mode note: if this deployment is hidden, run the hide-footprint reconcile so the placed files stay out of `git status`.');
|
|
269
258
|
}
|
|
270
259
|
return lines.join('\n');
|
|
@@ -273,13 +262,12 @@ export const formatResult = (result) => {
|
|
|
273
262
|
// ── CLI ───────────────────────────────────────────────────────────────────────────────
|
|
274
263
|
|
|
275
264
|
export const parseArgs = (argv) => {
|
|
276
|
-
const opts = { dryRunFlag: false, apply: false,
|
|
265
|
+
const opts = { dryRunFlag: false, apply: false, cwd: undefined, help: false };
|
|
277
266
|
for (let i = 0; i < argv.length; i += 1) {
|
|
278
267
|
const arg = argv[i];
|
|
279
268
|
if (arg === '--help' || arg === '-h') opts.help = true;
|
|
280
269
|
else if (arg === '--dry-run') opts.dryRunFlag = true;
|
|
281
270
|
else if (arg === '--apply') opts.apply = true;
|
|
282
|
-
else if (arg === '--executor') opts.executorOnly = true;
|
|
283
271
|
else if (arg === '--cwd') {
|
|
284
272
|
i += 1;
|
|
285
273
|
if (argv[i] === undefined || argv[i].startsWith('-')) throw fail(EXIT_USAGE, '--cwd needs a directory argument');
|
|
@@ -289,7 +277,7 @@ export const parseArgs = (argv) => {
|
|
|
289
277
|
}
|
|
290
278
|
}
|
|
291
279
|
if (opts.dryRunFlag && opts.apply) throw fail(EXIT_USAGE, '--dry-run and --apply cannot be used together');
|
|
292
|
-
return { help: opts.help, dryRun: !opts.apply,
|
|
280
|
+
return { help: opts.help, dryRun: !opts.apply, cwd: opts.cwd };
|
|
293
281
|
};
|
|
294
282
|
|
|
295
283
|
export const main = (argv = process.argv.slice(2), deps = {}) => {
|
|
@@ -301,7 +289,7 @@ export const main = (argv = process.argv.slice(2), deps = {}) => {
|
|
|
301
289
|
log(USAGE);
|
|
302
290
|
return EXIT_OK;
|
|
303
291
|
}
|
|
304
|
-
const result = writeCheapAgents({ cwd: args.cwd ?? process.cwd(), dryRun: args.dryRun
|
|
292
|
+
const result = writeCheapAgents({ cwd: args.cwd ?? process.cwd(), dryRun: args.dryRun }, deps);
|
|
305
293
|
log(formatResult(result));
|
|
306
294
|
return EXIT_OK;
|
|
307
295
|
} catch (err) {
|
|
@@ -25,6 +25,7 @@ const BUNDLED = ['references', 'scripts'];
|
|
|
25
25
|
export const SCRIPT_CHANNEL = 'a script or suite of your own under its own name in scripts/, or a config the script reads';
|
|
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
|
+
export const AGENT_CHANNEL = '.claude/agents/<name>.local.md with a name: of its own';
|
|
28
29
|
// The family files memory copies on Node evidence alone, accepted or not (the suite derives them).
|
|
29
30
|
export const SEED_NAMES = Object.freeze(['_expect-shim.mjs', 'archive-decisions.mjs', 'archive-decisions.test.mjs', 'markdown-blocks.mjs']);
|
|
30
31
|
const ROTATOR = 'archive-decisions.mjs';
|
|
@@ -80,9 +81,10 @@ const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
|
|
|
80
81
|
// A fate is `written`, `stood` (an absent file that appeared with the bundled body), `refused` (its
|
|
81
82
|
// write failed), or none: the run stopped before it, or, dry, would write it. The spec layer's pair
|
|
82
83
|
// lines are these too, through the module's index.
|
|
83
|
-
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'] };
|
|
84
|
-
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' };
|
|
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
86
|
const channelOf = (f) => (f.state === 'derived' ? `; its model and effort are set in ${VEHICLE_CHANNEL}`
|
|
87
|
+
: f.state === 'agent' ? `; a vehicle of your own goes in ${AGENT_CHANNEL}`
|
|
86
88
|
: f.state === 'custom' ? `; an edit meant to last goes in ${f.name === INSTALLER_SET[0] ? LOCAL_HOOK_CHANNEL : SCRIPT_CHANNEL}` : '');
|
|
87
89
|
export const fileLine = (f, fate, dryRun) => {
|
|
88
90
|
if (fate === 'stood') return `${f.rel}: appeared while this run was placing it — the bundled body stands, nothing written`;
|
package/tools/ensure-configs.mjs
CHANGED
|
@@ -89,8 +89,8 @@ exists; and the navigator index — a GENERATED artifact, regenerated
|
|
|
89
89
|
whenever it is missing or stale; where a module the project's hook loads is not the bundled one,
|
|
90
90
|
the project's own checker judges the navigator and a write it rejects is put back byte for byte.
|
|
91
91
|
The executor ensure writes nothing: a placed .claude/agents/executor.md whose bytes differ from the
|
|
92
|
-
body derived from docs/ai/vehicles.json is pending
|
|
93
|
-
writes the derived body
|
|
92
|
+
body derived from docs/ai/vehicles.json is pending and an absent one is not placed here — the
|
|
93
|
+
advisor's agents item writes the derived body.
|
|
94
94
|
A fifth writes too: once a kit script outside the seed names stands in scripts/, the enforcement-script
|
|
95
95
|
ensure writes every kit script that is not the bundled body, the hook installer and its two suites
|
|
96
96
|
first, with no question and no copy kept: a body a release shipped is refreshed, an edited one replaced
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ensure-executor.mjs — the EIGHTH upgrade ensure, fifth in the fixed order right after `vehicles`:
|
|
2
2
|
// the placed executor vehicle (.claude/agents/executor.md) judged against the body derived from
|
|
3
|
-
// docs/ai/vehicles.json. It never writes:
|
|
4
|
-
//
|
|
3
|
+
// docs/ai/vehicles.json. It never writes: a vehicle not placed and a placed body that differs
|
|
4
|
+
// (`pending`) are each written by the advisor's `agents` item.
|
|
5
5
|
//
|
|
6
6
|
// The state table, in the order the cells are proven:
|
|
7
7
|
// | cell | .claude, .claude/agents | placed path | docs/ai/vehicles.json | answer | read before answering |
|
|
@@ -48,7 +48,7 @@ export const ensureExecutor = ({ cwd, kitRoot, deps = {} }) => {
|
|
|
48
48
|
return loud('wrong-node-kind', `${EXECUTOR_VEHICLE_REL}: exists but is ${probe.wrongKind} — nothing was read or written; resolve it by hand, then re-run`);
|
|
49
49
|
}
|
|
50
50
|
if (!probe.present) {
|
|
51
|
-
return ok('not-placed', [`${EXECUTOR_VEHICLE_REL}: not placed — the agents
|
|
51
|
+
return ok('not-placed', [`${EXECUTOR_VEHICLE_REL}: not placed — nothing written; the advisor's agents item places it`]);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const { posture, reason } = readExecutorPosture(cwd, deps);
|
|
@@ -66,5 +66,5 @@ export const ensureExecutor = ({ cwd, kitRoot, deps = {} }) => {
|
|
|
66
66
|
if (!executorBodyDiffers(cwd, bundleDeps)) {
|
|
67
67
|
return ok('already-current', [`${EXECUTOR_VEHICLE_REL}: the body derived from ${VEHICLES_REL} (model=${posture.model}, effort=${posture.effort}, source ${posture.source}) — nothing written`]);
|
|
68
68
|
}
|
|
69
|
-
return ok('pending', [`${EXECUTOR_VEHICLE_REL}: differs from the body derived from ${VEHICLES_REL} — nothing written; the advisor's
|
|
69
|
+
return ok('pending', [`${EXECUTOR_VEHICLE_REL}: differs from the body derived from ${VEHICLES_REL} — nothing written; the advisor's agents item writes the derived body`]);
|
|
70
70
|
};
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
import { readFileSync, readdirSync, lstatSync, existsSync, statSync } from 'node:fs';
|
|
34
34
|
import { homedir, hostname } from 'node:os';
|
|
35
|
-
import { dirname, join, resolve } from 'node:path';
|
|
35
|
+
import { dirname, join, resolve, sep } from 'node:path';
|
|
36
36
|
import { fileURLToPath } from 'node:url';
|
|
37
37
|
import {
|
|
38
38
|
preflightVelocityProfile,
|
|
@@ -82,13 +82,12 @@ import { homeRelative } from './bridge-state-dirs.mjs';
|
|
|
82
82
|
import { sandboxEnabled, HOST_HONORS_QUALIFIER } from './bridge-wiring.mjs';
|
|
83
83
|
import { assertContainedRealPath } from './fs-safe.mjs';
|
|
84
84
|
import { nearestExistingDir, worktreesGrantDir, worktreesGrantHoldsHome } from './worktrees.mjs';
|
|
85
|
-
import {
|
|
85
|
+
import { readBundledAgents, writeCheapAgents, EXECUTOR_VEHICLE } from './cheap-agents.mjs';
|
|
86
86
|
import { ATTRIBUTION_KEY, LEGACY_ATTRIBUTION_KEY, attributionHidesText, effectiveAttribution, readAttributionChoice, wrongTypedKey } from './attribution.mjs';
|
|
87
87
|
import { planGlobalRemoval } from './hide-footprint.mjs';
|
|
88
88
|
import { NODE_EVIDENCE, NODE_EVIDENCE_SCRIPTS, probeNodeEvidence } from './node-evidence.mjs';
|
|
89
89
|
// The vehicle READINESS comes from the read-only half — the same survey `recipes` and `status` read.
|
|
90
|
-
import { surveyExecutorVehicle, readExecutorPosture,
|
|
91
|
-
import { readVehicles, resolveExecutor, resolveReviewLens } from './vehicle-settings.mjs';
|
|
90
|
+
import { surveyExecutorVehicle, readExecutorPosture, agentsAccepted, readStamp, readFsDeps, AGENTS_DIR, WORKFLOW_STAMP, EXPECTED_WORKFLOW_VERSION } from './cheap-agents-read.mjs';
|
|
92
91
|
// The ack store's path, keys, lane registry, fingerprint and guarded reader live in their own leaf
|
|
93
92
|
// (contract: kit/ack-store) — `status` reads the same store, and a second copy is what drifts.
|
|
94
93
|
import {
|
|
@@ -208,13 +207,13 @@ export const SEVERITIES = Object.freeze({
|
|
|
208
207
|
'mcp-channel': SEVERITY_OPTIONAL,
|
|
209
208
|
'mcp-channel.differing': SEVERITY_ATTENTION,
|
|
210
209
|
agents: SEVERITY_OPTIONAL,
|
|
211
|
-
//
|
|
210
|
+
// A placed component with a kit agent file not current: its lane is kit, so the agent writes it
|
|
211
|
+
// with no pick and the verdict counts it in neither class.
|
|
212
|
+
'agents.not-current': SEVERITY_OPTIONAL,
|
|
213
|
+
// The `agents` rows above place and write vehicles. This one reports a config that ALREADY
|
|
212
214
|
// names the subagent carrier over a vehicle that cannot carry it — a configured declaration that
|
|
213
215
|
// is broken, which is what attention means.
|
|
214
216
|
'executor-vehicle': SEVERITY_ATTENTION,
|
|
215
|
-
// A hand edit of the placed executor is not a broken declaration — the vehicle still carries — so it is optional;
|
|
216
|
-
// its lane is kit, so the agent writes it with no pick and the verdict counts it in neither class.
|
|
217
|
-
'executor-vehicle.differing': SEVERITY_OPTIONAL,
|
|
218
217
|
// The AGENTS.md block is a configured choice the harness does not honour.
|
|
219
218
|
attribution: SEVERITY_ATTENTION,
|
|
220
219
|
'footprint-global': SEVERITY_OPTIONAL,
|
|
@@ -304,9 +303,8 @@ export const WHATS = Object.freeze({
|
|
|
304
303
|
'mcp-channel': "the kit's read-only MCP server is not registered here — path questions and literal searches stay shell strings",
|
|
305
304
|
'mcp-channel.differing': 'an "{server}" MCP entry is already declared here and DIFFERS from the registration this kit copy would write',
|
|
306
305
|
agents: '{n} bundled subagent vehicle(s) not placed (Claude Code) — {ro} read-only, {ex} the full-tool executor; the apply PREVIEWS first',
|
|
307
|
-
'agents.
|
|
306
|
+
'agents.not-current': '{n} kit agent file(s) in .claude/agents/ not current — each is written with the body the kit writes for it, with no question',
|
|
308
307
|
'executor-vehicle': '{n} slot(s) configured subagent but the executor vehicle is {state}{reason} — every such slot runs solo until it is usable',
|
|
309
|
-
'executor-vehicle.differing': 'the placed executor vehicle differs from the body derived from docs/ai/vehicles.json — the derived body is written with no question',
|
|
310
308
|
attribution: 'AGENTS.md says attribution off but .claude/settings.json does not hide the harness trailer and PR text',
|
|
311
309
|
'footprint-global': 'legacy kit ignore line(s) sit in {file} — they ignore kit paths in every repository here',
|
|
312
310
|
'family-freshness': '{parts}',
|
|
@@ -384,9 +382,9 @@ export const BENEFITS = Object.freeze({
|
|
|
384
382
|
'jev-connect': 'decisions — a typed choice with a confidence in under a second for your code and the agent\'s scripts, once for every project here',
|
|
385
383
|
'jev-skill': 'the TypeSafe skill for Claude Code, Codex and Antigravity CLI, one pinned verified copy per agent root, from one command you run',
|
|
386
384
|
});
|
|
387
|
-
// The
|
|
385
|
+
// The arms whose gain differs from their base item's (BENEFITS stays keyed by item key).
|
|
388
386
|
export const VARIANT_BENEFITS = Object.freeze({
|
|
389
|
-
'
|
|
387
|
+
'agents.not-current': 'currency — each kit agent file carries the body the kit writes for it today, model and effort where docs/ai/vehicles.json names them',
|
|
390
388
|
'source-size.layout': 'layout — piles past the layout limits become recorded, reasoned debt, so the commit hook can judge new ones once its layout line is armed',
|
|
391
389
|
});
|
|
392
390
|
|
|
@@ -444,9 +442,9 @@ export const OPT_IN_CAPABILITIES = Object.freeze([
|
|
|
444
442
|
// which is why the review-recipe benefit is worded for either slot rather than for review alone.
|
|
445
443
|
{ id: 'delegated-execution', mode: 'set-recipe', advisorKey: 'review-recipe' },
|
|
446
444
|
{ id: 'agents', mode: 'agents', advisorKey: 'agents' },
|
|
447
|
-
// A DISTINCT capability from the offer above: the
|
|
448
|
-
//
|
|
449
|
-
//
|
|
445
|
+
// A DISTINCT capability from the offer above: the `agents` key writes a regular executor whose bytes differ,
|
|
446
|
+
// but it never names a configured subagent slot that runs solo — over a component not placed it offers the
|
|
447
|
+
// placement, and over a refusal (a symlinked executor, an unreadable docs/ai/vehicles.json) only its skip.
|
|
450
448
|
{ id: 'executor-vehicle', mode: 'agents', advisorKey: 'executor-vehicle' },
|
|
451
449
|
// Exempt, not un-audited. `acceptEdits` auto-applies Edit/Write and auto-runs mkdir/touch/mv/cp:
|
|
452
450
|
// a TRUST-POSTURE change. Velocity presents its full posture at its own consent moment;
|
|
@@ -1147,37 +1145,35 @@ const probeStateBlockHook = ({ root, deps, add, skip }) => {
|
|
|
1147
1145
|
// surfaced its absence: `agents` is the family's SECOND `.claude/` writer, the `help` Tune tail
|
|
1148
1146
|
// advertises it, and the advisor had no entry for it — so a user who never runs `help` never learned
|
|
1149
1147
|
// it existed while the advisor reported the deployment optimal. Found by the guard, not by an incident.
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1152
|
-
|
|
1148
|
+
// The key renders by its state table (contract: kit/carriers, part agent-files) over the writer's
|
|
1149
|
+
// plain dry run, the call the danger check makes: a throw is one stated skip naming the refusal; no
|
|
1150
|
+
// planned file renders nothing; a stale stamp beside a planned file is the upgrade-first skip; over
|
|
1151
|
+
// a component not accepted the OFFER to place, over an accepted one `agents.not-current`, kit lane.
|
|
1152
|
+
const upgradeFirst = (stamp) => new Error(`run /agent-workflow-kit upgrade first (deployment stamp ${stamp ?? 'none'}, expected ${EXPECTED_WORKFLOW_VERSION})`);
|
|
1153
|
+
|
|
1154
|
+
const probeCheapAgents = ({ root, deps, add, skip, shared }) => {
|
|
1153
1155
|
try {
|
|
1154
|
-
const
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
if (
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
// The writer refuses below the expected lineage, so offering its command would hand the user a
|
|
1164
|
-
// guaranteed failure — the honest surface is a stated skip naming the recovery.
|
|
1165
|
-
if (!preflight.stampOk) {
|
|
1166
|
-
skip('agents', new Error(`not a deployed agent-workflow project at the current lineage (found ${preflight.stamp ?? 'none'}) — run upgrade first`));
|
|
1156
|
+
const result = writeCheapAgents({ cwd: root, dryRun: true }, deps);
|
|
1157
|
+
const planned = result.plan.filter((item) => item.action === 'place' || item.action === 're-derive');
|
|
1158
|
+
if (planned.length === 0) return; // converged
|
|
1159
|
+
if (!result.stampOk) throw upgradeFirst(result.stamp);
|
|
1160
|
+
if (agentsAccepted(root, result.plan.map((item) => item.name), deps)) {
|
|
1161
|
+
// The detail names every file the apply writes, never truncated; the component is placed and the
|
|
1162
|
+
// known-footprint registry lists /.claude/agents/, so no hidden-mode follow-up rides it.
|
|
1163
|
+
shared.agentsNotCurrent = add('agents', fillTemplate(WHATS['agents.not-current'], { n: planned.length }),
|
|
1164
|
+
formsApply('agents.not-current', root), 'agents.not-current', `writes: ${planned.map((item) => item.rel).join(', ')}`);
|
|
1167
1165
|
return;
|
|
1168
1166
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
//
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
// The hidden-mode reconcile rides the detail, never the apply line: it is wrong to run on a
|
|
1178
|
-
// VISIBLE deployment, and the apply slot must stay one pure executable command.
|
|
1167
|
+
// The offer counts the BUNDLED templates the plan would place. The writer's contract is «--dry-run
|
|
1168
|
+
// first, ALWAYS» (references/modes/agents.md), so the rendered line is the PREVIEW — the
|
|
1169
|
+
// dry-run-preview class the mode doc documents for the gates-declaration seeder, where the same
|
|
1170
|
+
// confirmation then runs the follow-up the preview prints. The hidden-mode reconcile rides the
|
|
1171
|
+
// detail, never the apply line: it is wrong to run on a VISIBLE deployment, and the apply slot
|
|
1172
|
+
// must stay one pure executable command.
|
|
1173
|
+
const bundled = new Set(readBundledAgents(deps).map((template) => template.name));
|
|
1174
|
+
const toPlace = planned.filter((item) => bundled.has(item.name));
|
|
1179
1175
|
const executors = toPlace.filter((item) => item.name === EXECUTOR_VEHICLE).length;
|
|
1180
|
-
add('agents', fillTemplate(WHATS
|
|
1176
|
+
add('agents', fillTemplate(WHATS.agents, { n: toPlace.length, ex: executors, ro: toPlace.length - executors }),
|
|
1181
1177
|
`node ${q(toolPath('cheap-agents.mjs'))} --cwd ${q(root)}`, 'agents',
|
|
1182
1178
|
`hidden-mode deployments only: after the --apply the preview prints, run node ${q(toolPath('hide-footprint.mjs'))} --dir ${q(root)} --reconcile so the placed .claude/agents/ stays invisible to git status`,
|
|
1183
1179
|
);
|
|
@@ -1187,14 +1183,15 @@ const probeCheapAgents = ({ root, deps, add, skip }) => {
|
|
|
1187
1183
|
};
|
|
1188
1184
|
|
|
1189
1185
|
// The subagent carrier's ONE instrument (contract: kit/carriers). Neither neighbour can report this
|
|
1190
|
-
// state: `probeReviewRecipe` skips a slot configured `subagent` by construction, and the
|
|
1191
|
-
//
|
|
1192
|
-
//
|
|
1186
|
+
// state: `probeReviewRecipe` skips a slot configured `subagent` by construction, and the `agents` key
|
|
1187
|
+
// above names files to place or write, never a configured slot that runs solo. It yields to
|
|
1188
|
+
// `agents.not-current`, whose apply writes the executor (the frozen order runs `agents` first).
|
|
1193
1189
|
const VEHICLE_BROKEN_STATES = Object.freeze(['missing', 'unusable']);
|
|
1194
1190
|
|
|
1191
|
+
// The writer's plain dry run, the call the `agents` key makes: its refusal is the last precondition.
|
|
1195
1192
|
const writerBlock = (root, deps) => {
|
|
1196
1193
|
try {
|
|
1197
|
-
|
|
1194
|
+
writeCheapAgents({ cwd: root, dryRun: true }, deps);
|
|
1198
1195
|
return null;
|
|
1199
1196
|
} catch (err) {
|
|
1200
1197
|
return safeLine(err?.message ?? String(err));
|
|
@@ -1203,39 +1200,27 @@ const writerBlock = (root, deps) => {
|
|
|
1203
1200
|
|
|
1204
1201
|
const HIDDEN_AGENTS_FOLLOW_UP = (root) => `hidden-mode deployments only: after the apply, run node ${q(toolPath('hide-footprint.mjs'))} --dir ${q(root)} --reconcile so the placed .claude/agents/ stays invisible to git status`;
|
|
1205
1202
|
|
|
1206
|
-
const probeExecutorVehicle = ({ root, deps, add, skip }) => {
|
|
1207
|
-
if (renderBrokenExecutor({ root, deps, add, skip })) return;
|
|
1208
|
-
try {
|
|
1209
|
-
if (!executorBodyDiffers(root, deps)) return;
|
|
1210
|
-
// The executor-only dry run: the call the check makes, so the arm, the check and the apply judge one plan.
|
|
1211
|
-
const plan = writeCheapAgents({ cwd: root, dryRun: true, executorOnly: true }, deps);
|
|
1212
|
-
if (!plan.stampOk) throw new Error(`run /agent-workflow-kit upgrade first (deployment stamp ${plan.stamp ?? 'none'}, expected ${EXPECTED_WORKFLOW_VERSION})`);
|
|
1213
|
-
add('executor-vehicle', WHATS['executor-vehicle.differing'], formsApply('executor-vehicle.differing', root), 'executor-vehicle.differing');
|
|
1214
|
-
} catch (err) {
|
|
1215
|
-
skip('executor-vehicle', err);
|
|
1216
|
-
}
|
|
1217
|
-
};
|
|
1218
|
-
|
|
1219
|
-
const renderBrokenExecutor = ({ root, deps, add, skip }) => {
|
|
1203
|
+
const probeExecutorVehicle = ({ root, deps, add, skip, shared }) => {
|
|
1220
1204
|
try {
|
|
1221
1205
|
// The VALIDATED reader, as probeReviewRecipe uses it: a schema-invalid config is a stated skip,
|
|
1222
1206
|
// never an item computed over a shape nothing accepted.
|
|
1223
1207
|
const { config } = loadConfig(root, deps.readFile ?? readFileSync, deps.lstat ?? lstatSync);
|
|
1224
1208
|
const configured = Object.entries(ACTIVITIES).flatMap(([activity, def]) =>
|
|
1225
1209
|
Object.keys(def.slots).filter((slot) => config?.[activity]?.[slot] === 'subagent'));
|
|
1226
|
-
if (configured.length === 0) return
|
|
1210
|
+
if (configured.length === 0) return;
|
|
1227
1211
|
const survey = (deps.surveyVehicle ?? surveyExecutorVehicle)(root, deps);
|
|
1228
|
-
if (!VEHICLE_BROKEN_STATES.includes(survey.state)) return
|
|
1212
|
+
if (!VEHICLE_BROKEN_STATES.includes(survey.state) || shared?.agentsNotCurrent) return;
|
|
1229
1213
|
const reason = safeLine(survey.reason ?? '');
|
|
1230
1214
|
const { posture, reason: settingsReason } = readExecutorPosture(root, deps);
|
|
1231
1215
|
const stamp = readStamp(join(root, WORKFLOW_STAMP), readFsDeps(deps));
|
|
1232
1216
|
const preconditions = [
|
|
1233
|
-
...(stamp === EXPECTED_WORKFLOW_VERSION ? [] : [
|
|
1217
|
+
...(stamp === EXPECTED_WORKFLOW_VERSION ? [] : [upgradeFirst(stamp).message]),
|
|
1234
1218
|
...(posture === null ? [`${safeLine(settingsReason)} — fix that`] : []),
|
|
1235
1219
|
];
|
|
1236
|
-
// The writer refuses on ANY
|
|
1237
|
-
// missing executor's placement too), so its
|
|
1238
|
-
|
|
1220
|
+
// The writer refuses on ANY kit agent path it cannot touch (a linked configured lens blocks a
|
|
1221
|
+
// missing executor's placement too), so its plain dry run is the last precondition, skipped when
|
|
1222
|
+
// the posture is already unreadable so that reason is named once.
|
|
1223
|
+
const blocked = posture === null ? null : writerBlock(root, deps);
|
|
1239
1224
|
if (blocked) preconditions.push(`${blocked} — fix that`);
|
|
1240
1225
|
const room = templateBudget(WHATS['executor-vehicle']) - String(configured.length).length - survey.state.length - 2;
|
|
1241
1226
|
add(
|
|
@@ -1245,16 +1230,14 @@ const renderBrokenExecutor = ({ root, deps, add, skip }) => {
|
|
|
1245
1230
|
state: survey.state,
|
|
1246
1231
|
reason: reason && room > 0 ? `: ${truncatedTo(reason, room)}` : '',
|
|
1247
1232
|
}),
|
|
1248
|
-
// The writer places a missing vehicle and
|
|
1233
|
+
// The writer places a missing vehicle and writes a placed executor whose bytes differ from the derived body (an invalid
|
|
1249
1234
|
// frontmatter or read-only tools included), so those states need no precondition; every precondition above is a refusal the apply would meet.
|
|
1250
1235
|
`node ${q(toolPath('cheap-agents.mjs'))} --apply --cwd ${q(root)}`,
|
|
1251
1236
|
'executor-vehicle',
|
|
1252
1237
|
`${preconditions.length ? `precondition: ${preconditions.join('; ')}; ` : ''}${HIDDEN_AGENTS_FOLLOW_UP(root)}`,
|
|
1253
1238
|
);
|
|
1254
|
-
return true;
|
|
1255
1239
|
} catch (err) {
|
|
1256
1240
|
skip('executor-vehicle', err);
|
|
1257
|
-
return true;
|
|
1258
1241
|
}
|
|
1259
1242
|
};
|
|
1260
1243
|
|
|
@@ -1737,13 +1720,16 @@ export const buildRecommendations = ({ cwd, deps = {} } = {}) => {
|
|
|
1737
1720
|
// one pair today (the marker-stale ⟷ read-lane.stale precedence) and read in the frozen PROBES
|
|
1738
1721
|
// order, so the reader can never run first.
|
|
1739
1722
|
const shared = {};
|
|
1723
|
+
// A device node reads as absent (a sandbox mask), except under .claude/agents/: there it is the
|
|
1724
|
+
// agents writer's refusal, as the danger check reads it.
|
|
1725
|
+
const agentsDir = join(root, AGENTS_DIR) + sep;
|
|
1740
1726
|
const contentDeps = Object.create(Object.getPrototypeOf(deps), {
|
|
1741
1727
|
...Object.getOwnPropertyDescriptors(deps),
|
|
1742
1728
|
lstat: {
|
|
1743
1729
|
enumerable: true,
|
|
1744
1730
|
value: (path, ...args) => {
|
|
1745
1731
|
const stat = (deps.lstat ?? deps.lstatSync ?? lstatSync)(path, ...args);
|
|
1746
|
-
if (stat.isCharacterDevice?.() || stat.isBlockDevice?.()) {
|
|
1732
|
+
if (!String(path).startsWith(agentsDir) && (stat.isCharacterDevice?.() || stat.isBlockDevice?.())) {
|
|
1747
1733
|
throw Object.assign(new Error(`${ABSENT_CODE}: ${path}`), { code: ABSENT_CODE });
|
|
1748
1734
|
}
|
|
1749
1735
|
return stat;
|
package/tools/write-lanes.mjs
CHANGED
|
@@ -46,8 +46,8 @@ export const VARIANT_LANES = Object.freeze({
|
|
|
46
46
|
'mcp-channel': LANE_HARNESS,
|
|
47
47
|
'mcp-channel.differing': LANE_HARNESS,
|
|
48
48
|
agents: LANE_HARNESS,
|
|
49
|
+
'agents.not-current': LANE_KIT,
|
|
49
50
|
'executor-vehicle': LANE_HARNESS,
|
|
50
|
-
'executor-vehicle.differing': LANE_KIT,
|
|
51
51
|
attribution: LANE_HARNESS,
|
|
52
52
|
'footprint-global': LANE_HARNESS,
|
|
53
53
|
'family-freshness': LANE_USER,
|
|
@@ -161,9 +161,8 @@ const FORMS = Object.freeze({
|
|
|
161
161
|
'mcp-channel.differing': createForm('mcp.mjs',
|
|
162
162
|
['--replace', '--cwd', '<root>'], ['--replace', '--apply', '--cwd', '<root>'], MCP_WRITES),
|
|
163
163
|
agents: AGENT_FORM,
|
|
164
|
+
'agents.not-current': AGENT_FORM,
|
|
164
165
|
'executor-vehicle': AGENT_FORM,
|
|
165
|
-
'executor-vehicle.differing': createForm('cheap-agents.mjs',
|
|
166
|
-
['--executor', '--cwd', '<root>'], ['--apply', '--executor', '--cwd', '<root>'], [join('.claude', 'agents', 'executor.md')]),
|
|
167
166
|
attribution: createForm('attribution.mjs', ['--cwd', '<root>'], ['--apply', '--cwd', '<root>'], SETTINGS_WRITES),
|
|
168
167
|
'footprint-global': createForm('hide-footprint.mjs',
|
|
169
168
|
['--remove-global', '--dry-run', '--dir', '<root>'], ['--remove-global', '--dir', '<root>'], [], false, null, true),
|