@sabaiway/agent-workflow-kit 16.0.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 +59 -0
- package/README.md +3 -3
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/advisor-writers.md +2 -2
- package/references/contracts.md +8 -3
- package/references/modes/agents.md +7 -5
- package/references/modes/recommendations.md +6 -4
- package/references/modes/upgrade.md +4 -4
- package/tools/apply-danger-check.mjs +9 -6
- package/tools/cheap-agents-read.mjs +8 -3
- package/tools/cheap-agents.mjs +47 -47
- package/tools/distribution-files/scripts.mjs +9 -3
- package/tools/ensure-configs.mjs +2 -2
- package/tools/ensure-executor.mjs +4 -4
- package/tools/init-project.mjs +2 -2
- package/tools/recommendations.mjs +68 -83
- package/tools/write-lanes.mjs +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,65 @@ 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
|
+
|
|
43
|
+
## 16.1.0 — the agent writes a differing executor vehicle with no question: a new advisor lane `kit` (AD-207)
|
|
44
|
+
|
|
45
|
+
**A placed `.claude/agents/executor.md` that differs from the body derived from `docs/ai/vehicles.json` is now
|
|
46
|
+
written back with no question.** Before, the advisor's `executor-vehicle.differing` item waited for your pick and
|
|
47
|
+
your yes, and its apply ran the whole agents writer. Now it is the first item of a fourth lane, `lane: kit`: the agent
|
|
48
|
+
runs its check line in the sandbox, shows the result, and at once runs its apply line once outside the sandbox. The
|
|
49
|
+
harness's own dialog there is the only ask. The item reads `the placed executor vehicle differs from the body derived
|
|
50
|
+
from docs/ai/vehicles.json — the derived body is written with no question`.
|
|
51
|
+
|
|
52
|
+
- **One file, one form.** The item's form is the new `cheap-agents.mjs --executor`: it plans the executor alone and
|
|
53
|
+
reads no orchestration config, so its `--apply` writes `.claude/agents/executor.md` and no other file. The advisor,
|
|
54
|
+
the danger check and the apply judge the same dry run, and the check admits only that file. The other vehicles are
|
|
55
|
+
left byte for byte.
|
|
56
|
+
- **The executor's line names where to change it:** `.claude/agents/executor.md: differs from the body derived from the
|
|
57
|
+
vehicle settings — written with that body; its model and effort are set in docs/ai/vehicles.json` (on a dry run,
|
|
58
|
+
`would be written with that body`).
|
|
59
|
+
- **The verdict line counts a kit item in neither class.** With only kit items and no skipped check, it reads
|
|
60
|
+
`nothing is broken`.
|
|
61
|
+
- **`init` checks and applies the item on its one y**, as it does a harness item.
|
|
62
|
+
- **The texts say the same:** the executor ensure's `pending` line and the `ensure-configs.mjs` help, the advisor's
|
|
63
|
+
help, `references/advisor-writers.md`, the recommendations, upgrade and agents modes, and the README's
|
|
64
|
+
recommendations and velocity rows.
|
|
65
|
+
|
|
7
66
|
## 16.0.0 — the upgrade writes the spec layer current with no question; `--replace-custom` and the kept-aside copy retire (AD-206)
|
|
8
67
|
|
|
9
68
|
**MAJOR: the `--replace-custom` flag is removed, and the upgrade no longer asks a yes before it writes a spec-layer
|
package/README.md
CHANGED
|
@@ -257,13 +257,13 @@ file), or run the guarded `/agent-workflow-kit uninstall`.
|
|
|
257
257
|
| `/agent-workflow-kit core-evidence` | any time | **the ONE loop-evidence writer** (strip-the-kit) — every core evidence record lands in a single append-only JSONL store inside the git dir (never committable; versioned schema, latest-per-key supersession, byte-identical duplicates refused, malformed lines fail every reader closed). `red-proof "<file>#<pattern>"` declares an observed-red **BEFORE a bugfix** (N/N red runs + content custody + base + the pre-fix fingerprint; green/mixed/timeout are DISTINGUISHED refusals — nothing written); `degrade --backend --reason` is the ONLY escape for an unavailable review backend (per-tree, never all backends); `summary` renders the whole loop state statelessly (gate result · per-backend verdicts · red-proofs · degrades) — no ledger, no rounds, nothing remembered. Honest residual: records are forgeable — self-discipline, not a security boundary. Never commits, never runs a subscription CLI. |
|
|
258
258
|
| `/agent-workflow-kit coverage-check` | any time | **the final-run checker** (D3(c)+(d)) — **certifies coverage ONLY inside the `--final` run that owns the lcov** (ownership is exclusive by CONVENTION over the fixed path, not enforced — a concurrent writer to it is a stated residual, queued as LCOV-EXCLUSIVE-OWNERSHIP): an artifact on disk proves nothing about the tree it came from, so a standalone run prints its findings and states `attested=no` / `NO VERDICT` rather than a PASS (an lcov that predates an edit would otherwise certify a line the suite never executed). `attested=` claims a verdict was ISSUED, pass or fail — a run over uncovered lines still reads `attested=yes` and still exits 1, and a run whose coverage arm never executed (no lcov) reads `attested=no` even inside `--final`, because nothing was read and nothing is certified. The runner passes a nonce whose one-way commitment over `{nonce, fingerprint, base}` is the `final-start.attempt` it recorded; a context describing another tree, or matching no recorded attempt, is a REFUSAL, never a verdict. Findings are unchanged — reads the lcov the declared `unit-tests` gate produced at the FIXED git-dir path and fails on any uncovered CHANGED executable Node line (listed `file:line`; a changed file absent from the map is a file-level red; out-of-domain/unsupported files are LISTED — the claim narrowed honestly); VERIFIES every current-base red-proof declaration (bound test exists · custody hash unchanged · green N/N now · pre-fix fingerprint differs); prints `lcov-sha256=<hex|none>` of the exact bytes it consumed — the sha the `--final` receipt binds and re-hashes. An absent lcov is a LOUD `skipped-no-lcov`; a symlinked path is a refusal. `--check` is the gate exit code — declare it as the LAST gate (`run-gates --final` refuses otherwise). Read-only. |
|
|
259
259
|
| `/agent-workflow-kit commit-guard` | any time | **the read-only pre-commit guard** (D10) — makes the commit capture the whole current working tree, so «verified» and «about to be committed» are the same bytes (the receipt itself has a stated residual — see the mode doc). FIRST it refuses an **INDEX that lags the verified working tree** (the gates and the fingerprint describe the WORKING tree while `git commit` takes the INDEX alone, and the fingerprint cannot tell them apart — so a lagging index used to ship a strict subset of what was verified): unstaged tracked paths or reviewable untracked-not-ignored paths, named up to a bounded cap with the remainder stated, a dirty tracked **submodule** named separately with its own recovery, and fail-closed on an undecidable probe. This deliberately blocks a partial commit. Then it binds the LATEST completed `run-gates --final` receipt to the EXACT current tree: refuses on a missing/red/stale receipt, fingerprint drift under the run, a dangling later attempt, declaration content drift, evidence-hash or lcov drift, or unsatisfied review obligations (the same review-state decision, recomputed over a sanitized env — forged out-of-repo stores never satisfy). Re-runs NO gate or test. Wire it into `.git/hooks/pre-commit` (the installer writes the RESOLVED invocation). `git commit --no-verify` stays the stated residual. |
|
|
260
|
-
| `/agent-workflow-kit recommendations` | any time (every `upgrade` ends with it) | **read-only deployment advisor** (AD-044) — computes what in THIS deployment is configured sub-optimally (allowlist not seeded, autonomy render drifted, OS sandbox unavailable, gates undeclared, bridge friction, sandbox-mask clutter, a feature-spec layer never adopted) and renders **verdict-first**: one composed verdict line (does anything need attention?), then each item as **{severity · what · one-line benefit · an optional `recipe:` line (the bridge-tier item's missing-entries line — each missing entry by kind: allow rules, exclusions, hosts, state dirs, then what the execution wrapper codex-exec needs, then the host condition; the worktrees-dir ack fallback for a host that ignores the settings key, the agents hidden-mode reconcile follow-up, a user item's own facts, the spec-adoption decline preview, or another offer's decline preview) · the exact consent-gated apply one-liner}**; `references/advisor-writers.md` names each variant's writer or user step. The agent PRESENTS the section in the user's conversational language — every fact and count, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; raw tool block on request — and runs EXACTLY the rendered one-liners and the follow-up commands required by the mode doc, only on the answer authorizing that step — your yes to apply or your explicit decline to record it — with a second yes where the mode doc requires it, surfacing each item's posture note first. Renders **present-even-when-empty** (`no recommendations — flow optimal.`); a failed probe degrades to a stated skip line. Registry strings are fact-true frozen one-line data (posture/risk notes live in the mode doc at the consent moment); `velocity --bridge-tier` seeds the used bridges' review allow rules, `<wrapper> *` exclusions (`codex-exec *` where an execute slot delegates, keeping its permission prompt), declared hosts into `sandbox.network.allowedDomains`, and home-relative state dirs into `sandbox.filesystem.allowWrite`; hosts and dirs are declared per bridge in `capability.json` `networkHosts` + `writableDirs`, and the advisor's `bridge-tier` item counts and names each missing one. `--cwd` is required (the target project is explicit); writes nothing, never commits, never runs a subscription CLI. |
|
|
260
|
+
| `/agent-workflow-kit recommendations` | any time (every `upgrade` ends with it) | **read-only deployment advisor** (AD-044) — computes what in THIS deployment is configured sub-optimally (allowlist not seeded, autonomy render drifted, OS sandbox unavailable, gates undeclared, bridge friction, sandbox-mask clutter, a feature-spec layer never adopted) and renders **verdict-first**: one composed verdict line (does anything need attention?), then each item as **{severity · what · one-line benefit · an optional `recipe:` line (the bridge-tier item's missing-entries line — each missing entry by kind: allow rules, exclusions, hosts, state dirs, then what the execution wrapper codex-exec needs, then the host condition; the worktrees-dir ack fallback for a host that ignores the settings key, the agents hidden-mode reconcile follow-up, a user item's own facts, the spec-adoption decline preview, or another offer's decline preview) · the exact consent-gated apply one-liner}**; `references/advisor-writers.md` names each variant's writer or user step. The agent PRESENTS the section in the user's conversational language — every fact and count, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; raw tool block on request — and runs EXACTLY the rendered one-liners and the follow-up commands required by the mode doc, only on the answer authorizing that step — your yes to apply or your explicit decline to record it — with a second yes where the mode doc requires it, surfacing each item's posture note first; a kit item it applies with no question, its check line first, the harness's own dialog the only ask, or the one plain step where auto mode refuses its check or apply. Renders **present-even-when-empty** (`no recommendations — flow optimal.`); a failed probe degrades to a stated skip line. Registry strings are fact-true frozen one-line data (posture/risk notes live in the mode doc at the consent moment); `velocity --bridge-tier` seeds the used bridges' review allow rules, `<wrapper> *` exclusions (`codex-exec *` where an execute slot delegates, keeping its permission prompt), declared hosts into `sandbox.network.allowedDomains`, and home-relative state dirs into `sandbox.filesystem.allowWrite`; hosts and dirs are declared per bridge in `capability.json` `networkHosts` + `writableDirs`, and the advisor's `bridge-tier` item counts and names each missing one. `--cwd` is required (the target project is explicit); writes nothing, never commits, never runs a subscription CLI. |
|
|
261
261
|
| `/agent-workflow-kit doc-parity` | any time | **read-only doc-parity lint** (AD-049) — kills the doc-drift class where a mode-contract doc silently lags a code constant (a `--check` doc still reading `300` after the diff cap moved to `400`): a **closed, exported registry** binds each live constant (review caps, schema versions, the ledger's own class/scope vocabulary, and the autonomy-doctor EXIT/status/trusted-dir contract) to the exact token its `references/modes/*.md` contract must carry, and asserts the CURRENT value renders into every bound file — a drifted doc, an unreadable file, or an absent token **fails closed**. The values are sourced from the live imports (never re-typed), so the lint can't itself go stale; adding a binding is adding a checked entry (closed-world, edit-safe). `--check` is the gate exit code a kit maintainer runs: the lint checks the kit's own package. Never writes, never commits, never runs a subscription CLI. |
|
|
262
262
|
| `/agent-workflow-kit dispatch` | any time | **the delegation engine** — makes "how much does delegating a sub-task actually buy?" a measured number instead of a feeling. `check <file>` validates a sub-task brief's contract block and exits 0/1 naming the first violated field — **form only**: whether the task is genuinely bounded, its design decided and its acceptance adequate stays your judgment, and a well-formed absurdity passes here by construction. `advise --step-class <c>` answers the question that comes BEFORE that one — which vehicle should carry this kind of sub-task, whether it is even present on this machine, and what the ledger has already recorded for threads of that class (finished, failed, closed without a fold, and still open — counted separately) — and it decides nothing: it refuses no dispatch, gates no verb, and a choice that diverges from the advice is noted rather than blocked. It reads the filesystem only: nothing is launched to find out what is installed, an absent ledger prints "no recorded history", an unreadable one prints the store's own words, and either way the advice still prints. The same block appears as a footer under a form-valid `check` — never under a refusal, so it can never hide one. `register` pre-registers an acceptance wave (step classes, pairing key, minimum observations per class, the mean and first-pass thresholds) so the bar can never be chosen after the results it judges — immutable per wave. `observe` records ONE hand-written observation (`solo-construction`, the baseline whose ratio is 1 by construction — except over a scope measuring zero bytes, which has no ratio at all and is recorded ineligible by name — or `self-reported`) — delegated numbers are never hand-written, they are derived. The writer verbs are where that derivation happens: `open` puts a delegated thread on the record with every mint-time field copied from the brief's own header, refusing a deadline the wrapper's cap plus its kill grace would not fit inside, and recording whether the tree it started from was clean against the thread's base — HEAD by default, or the tree `--checkpoint <oid>` names, so the second task of a story is measured over the first one's uncommitted work instead of opening dirty (a dirty one makes the result honestly unmeasurable rather than quietly counted), while `--task <brief>` also records which task brief the thread carries out and the files that brief lists, refusing, since the last commit, a task thread whose files overlap by path prefix those of an open task thread or of a folded thread of another brief (`files-overlap`), and a mix of the two kinds — an untasked open beside an open task thread or, for a `code` open of backend `codex`, after a task fold, and a task open beside an open untasked thread (`mixed-open`), refusing at open a Files path the snapshot scope can never hold (`task-files-scope`), and measuring a task thread over its files alone, so `return` and `fold` refuse a changed path that no open or folded task thread on the same base claims (`out-of-files`); `await` waits for that one dispatch to answer and writes nothing — only the finished receipt satisfies it, a run still holding the nonce means keep waiting, and a wait that runs out says so with its own exit code, names whether the deadline or your own timeout ended it, and authorizes nothing: a wait that ended without an answer is a question for you, never permission to dispatch again; `return` absorbs the receipt the wrapper minted — only a finished one, checked against the contract it actually ran, its deadline and its own report, and refused outright when the tree hides changes from git or moves while the return is being computed — and derives the bytes from git rather than from anyone's claim; `fold` is the acceptance, and it refuses if the tree moved since the return — precisely, it re-confirms **equality of the visible canonical payload**, which is a change detector rather than a cryptographic identity of the tree: under the default head base that payload's untracked section is unframed and carries no file mode, so a content or symlink target that imitates the marker opening the next entry can alias two trees, and making an untracked file executable moves nothing (both named as residuals in the mode doc, with the fix queued); under a checkpoint base it is one indexed diff that carries modes. A change set carrying a binary, a non-regular path, a submodule, or a symlink whose target is not valid UTF-8 is **refused** at `return` and `fold` — CONSERVATIVELY, rather than promise what the default head payload may not be able to follow — and the same refusals hold for a checkpoint thread. `degrade` closes a thread that never earned a fold, on the record and with its reason. `aggregate` prints one wave: the registered thresholds, every observation as context, and per step class the finished threads — a folded success with git-provable bytes contributes its ratio, one whose bytes are unprovable is excluded from the mean but still counts in the first-pass rate, and a failed thread, a degrade-closed one, or one folded after failing acceptance each count as a real zero. Below the registered minimum nothing is computed (insufficient); at or above it is computed and labeled PILOT evidence. It REFUSES rather than guessing: no pre-registration, an unfinished thread in scope, a recorded refusal-to-delegate that never opened a thread, or an ambiguous wave each stop the computation by name. `handoff-return --slug <s>` closes the worktree loop after `land --prepare`: it re-attests that main still holds exactly the prepared tree under the same HEAD (both recorded in the handoff at prepare time), prints the satellite handoff's user-owned content byte for byte with its boundaries, byte lengths and the main-owned destinations each part folds into, prints the handoff digest and both OIDs as its proof, states the after-the-fold order (a fold landed after the gates leaves them stale), and records ONE self-reported worktree-stream observation only when the whole prepared change set is measurable — a deletion, a rename, a symlink, a submodule or a mode-only change ends with a named NOT RECORDED instead, never a partial number. Appends only to its own ledger inside the git dir (never committable); it also writes `handoff-return`'s `write-tree` tree object and, for a checkpoint measurement, the leaf's OWN temporary index file and the blobs its forced adds store — never a ref, never the real index; never commits, never runs a subscription CLI. |
|
|
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
|
-
| `/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 apply (the `apply:` line of each harness 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);
|
|
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); 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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Advisor writers
|
|
2
2
|
|
|
3
|
-
`tools/write-lanes.mjs` is the one source of the advisor's variant set and lanes; each row below names a variant's lane and its writer — a harness form's file, a chat apply's writers or writer mode — or `user step`.
|
|
3
|
+
`tools/write-lanes.mjs` is the one source of the advisor's variant set and lanes; each row below names a variant's lane and its writer — a harness or kit form's file, a chat apply's writers or writer mode — or `user step`.
|
|
4
4
|
|
|
5
5
|
| variant | lane | writer |
|
|
6
6
|
| --- | --- | --- |
|
|
@@ -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 | harness | 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
|
+
|
|
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).
|
|
18
20
|
|
|
19
21
|
Run `node ${CLAUDE_SKILL_DIR}/tools/cheap-agents.mjs [--dry-run | --apply] [--cwd <dir>]`:
|
|
20
22
|
|
|
21
|
-
1. **`--dry-run` first, always** (the default — changes nothing). It previews, per
|
|
22
|
-
2.
|
|
23
|
-
3. **Hidden-mode deployments:** after apply, 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;
|
|
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.
|
|
24
26
|
|
|
25
|
-
**Invariants:** writer (writes only `.claude/agents/`) · preview by default ·
|
|
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).
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md
|
|
6
6
|
|
|
7
|
-
The **read-only deployment advisor** — the deterministic section every `upgrade` run ends with, also invocable on its own. It computes what in THIS deployment is configured sub-optimally (allowlist not seeded, autonomy render drifted, sandbox unavailable, gates undeclared, a declared gate matrix that verifies nothing, bridge friction, sandbox-mask clutter, a configured `subagent` carrier whose executor vehicle cannot carry it, a difference from the reference profile the project has not declined, Jev not connected on this host, the Jev skill not installed for every agent) and renders **verdict-first**: one composed verdict line, then each item as **{severity · what is sub-optimal · the benefit in ONE plain line · `lane: chat`, `lane: harness` or `lane: user` · an optional `recipe:` line (an item's own facts or its alternative, such as the `bridge-tier` missing-entries line or the `worktrees-dir` ack fallback) · a harness item's `check:` line before its apply slot · the apply slot: a chat one-liner, a harness item's apply line or a user item's own step}**. The tool computes deterministic English DATA; **you PRESENT the section in the user's conversational language** — every fact, count and item from the tool, nothing added or dropped; commands, paths, hosts and rule strings stay **byte-exact**; show the raw tool block on request (the AD-032 report-contract lane — the tool cannot know the dialogue language, so the language rendering is your presentation layer).
|
|
7
|
+
The **read-only deployment advisor** — the deterministic section every `upgrade` run ends with, also invocable on its own. It computes what in THIS deployment is configured sub-optimally (allowlist not seeded, autonomy render drifted, sandbox unavailable, gates undeclared, a declared gate matrix that verifies nothing, bridge friction, sandbox-mask clutter, a configured `subagent` carrier whose executor vehicle cannot carry it, a difference from the reference profile the project has not declined, Jev not connected on this host, the Jev skill not installed for every agent) and renders **verdict-first**: one composed verdict line, then each item as **{severity · what is sub-optimal · the benefit in ONE plain line · `lane: chat`, `lane: harness`, `lane: kit` or `lane: user` · an optional `recipe:` line (an item's own facts or its alternative, such as the `bridge-tier` missing-entries line or the `worktrees-dir` ack fallback) · a harness or kit item's `check:` line before its apply slot · the apply slot: a chat one-liner, a harness or kit item's apply line or a user item's own step}**. The tool computes deterministic English DATA; **you PRESENT the section in the user's conversational language** — every fact, count and item from the tool, nothing added or dropped; commands, paths, hosts and rule strings stay **byte-exact**; show the raw tool block on request (the AD-032 report-contract lane — the tool cannot know the dialogue language, so the language rendering is your presentation layer).
|
|
8
8
|
|
|
9
9
|
**Live host/session facts are tool-composed only.** Every fact this section states about the current
|
|
10
10
|
host or session — prompts fired, sandbox scope, whether a bypass was needed, network reachability,
|
|
@@ -16,13 +16,15 @@ host/session facts* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`.
|
|
|
16
16
|
Run `node ${CLAUDE_SKILL_DIR}/tools/recommendations.mjs --cwd <project-root> [--json]`:
|
|
17
17
|
|
|
18
18
|
1. **`--cwd` is REQUIRED** — the target project is explicit, never inferred from the shell's current directory (a subdirectory invocation still advises on the named root).
|
|
19
|
-
2. **Verdict first (present-even-when-empty, opening at the `## Recommendations (agent-workflow)` header).** With everything optimal the body is exactly `no recommendations — flow optimal.` — the empty-state line ALONE is the verdict, zero added lines. Every other state opens the body with ONE verdict line composed from the frozen templates: `{K} item(s) need attention` leads when any item's severity is `attention` (a CONFIGURED declaration that is broken, drifted, degrading or invalid — the deployment needs review); `{N} optional recommendation(s), apply any you want` covers the `optional` class (offers to enable an unconfigured capability), led by `nothing is broken` ONLY when no item needs attention AND no probe check was skipped (a skipped probe could hide an attention-class problem — the claim never overreaches); `optimality NOT attested — {M} probe check(s) skipped` is appended last whenever probe checks were skipped. (The `(s)` invariant form IS the pinned pluralization — no singular/plural branching.) Items render attention-first, each tagged `needs attention:` / `optional:`. A failed probe renders as a stated `⚠ skipped item …` line — never a crash, never a fabricated item.
|
|
20
|
-
3. **The apply-through-agent lane — an explicit informed-consent checkpoint:** the agent applies chat and harness items on the chat yes, harness items by the consent route below. A chat item is never retried outside the sandbox and every failure of a chat step is a STOP. A user item is the user's own step, handed over as worded with its posture note (e.g. `source-size.id-squatter`). After presenting, OFFER to apply; the user selects items in plain language; for each selected item you **surface its posture note inline** where one exists (the per-item notes below cover exactly the risk-marked keys). For a chat item: the user **explicitly confirms**, and **only then** — **no command runs before confirmation** — do you run the rendered command. Do NOT infer safety from the presence or absence of an `--apply` flag: most chat items' rendered command IS the mutation and completes on that one run, **including a no-`--apply` mutation** such as `spec-adoption`'s `ensure-configs --reconcile --only specs` (it writes an edited spec-layer file with the bundled body with no question, its line naming where an edit meant to last goes). Some items instead render a **dry-run preview** that changes nothing and prints an explicit follow-up `--apply`/mutating command to run NEXT (e.g. the `gates-declaration` seeder): after the SAME confirmation you run that printed follow-up command — no second ask, no improvisation (each writer keeps its own consent semantics: previews, `--apply` flags, refusals) — except profile-gap, whose apply line runs with --apply appended only on a second yes over the relayed preview. For `worktrees-dir` you apply the grant on the chat yes after its check, like every harness item, with no hand step to wait for; its `recipe:` line's `ack-write` preview is the ack fallback, run only on the user's word that the host ignores the settings key, instead of the grant, and against a trusted host NO no ack renders.
|
|
19
|
+
2. **Verdict first (present-even-when-empty, opening at the `## Recommendations (agent-workflow)` header).** With everything optimal the body is exactly `no recommendations — flow optimal.` — the empty-state line ALONE is the verdict, zero added lines. Every other state opens the body with ONE verdict line composed from the frozen templates: `{K} item(s) need attention` leads when any item's severity is `attention` (a CONFIGURED declaration that is broken, drifted, degrading or invalid — the deployment needs review); `{N} optional recommendation(s), apply any you want` covers the `optional` class (offers to enable an unconfigured capability), led by `nothing is broken` ONLY when no item needs attention AND no probe check was skipped (a skipped probe could hide an attention-class problem — the claim never overreaches); `optimality NOT attested — {M} probe check(s) skipped` is appended last whenever probe checks were skipped. A kit item counts in neither class (applied with no pick): with only kit items and no skip the verdict is `nothing is broken` alone. (The `(s)` invariant form IS the pinned pluralization — no singular/plural branching.) Items render attention-first, each tagged `needs attention:` / `optional:`. A failed probe renders as a stated `⚠ skipped item …` line — never a crash, never a fabricated item.
|
|
20
|
+
3. **The apply-through-agent lane — an explicit informed-consent checkpoint:** the agent applies chat and harness items on the chat yes, harness items by the consent route below, and kit items with no question by the kit route below. A chat item is never retried outside the sandbox and every failure of a chat step is a STOP. A user item is the user's own step, handed over as worded with its posture note (e.g. `source-size.id-squatter`). After presenting, OFFER to apply; the user selects items in plain language; for each selected item you **surface its posture note inline** where one exists (the per-item notes below cover exactly the risk-marked keys). For a chat item: the user **explicitly confirms**, and **only then** — **no command runs before confirmation** — do you run the rendered command. Do NOT infer safety from the presence or absence of an `--apply` flag: most chat items' rendered command IS the mutation and completes on that one run, **including a no-`--apply` mutation** such as `spec-adoption`'s `ensure-configs --reconcile --only specs` (it writes an edited spec-layer file with the bundled body with no question, its line naming where an edit meant to last goes). Some items instead render a **dry-run preview** that changes nothing and prints an explicit follow-up `--apply`/mutating command to run NEXT (e.g. the `gates-declaration` seeder): after the SAME confirmation you run that printed follow-up command — no second ask, no improvisation (each writer keeps its own consent semantics: previews, `--apply` flags, refusals) — except profile-gap, whose apply line runs with --apply appended only on a second yes over the relayed preview. For `worktrees-dir` you apply the grant on the chat yes after its check, like every harness item, with no hand step to wait for; its `recipe:` line's `ack-write` preview is the ack fallback, run only on the user's word that the host ignores the settings key, instead of the grant, and against a trusted host NO no ack renders.
|
|
21
21
|
4. Registry strings (benefits + item texts) are frozen tool data, fact-true, ONE line under the pinned shape cap — posture/risk detail lives in the notes below at the consent moment, never inline in the overview. The dual velocity+security wording (`safer — blast radius bounded by the OS sandbox, not human attention`) rides ONLY the items with a real security delta (the autonomy render, the sandbox provisioning); the bridge-wrappers item claims **velocity only**.
|
|
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
|
|
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
|
+
|
|
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.
|
|
26
28
|
|
|
27
29
|
**Per-item posture notes (the consent moment — surface BEFORE running or handing over the apply):**
|
|
28
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
|
|
|
@@ -115,12 +115,12 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md · ${CLAUDE_SKI
|
|
|
115
115
|
- **A skip line that contradicts the observed tree is a FINDING, never pasted as neutral.** Every ensure skip names the fact it proved (the probes that answered absent); if the tree you can see disproves that reason — a "no Node" skip beside deployed Node scripts, a "not deployed" skip beside a stamped `docs/ai` — do not relay the line as an outcome: raise it in the report as a defect of the tool, with the contradicting fact named, and stop short of any step that would build on the skip.
|
|
116
116
|
- **Report step 3's outcome in plain language** — for **each** `pointers` slot (workflow-methodology, orchestration-recipes and autonomy-policy) whether it was *added*, was *already present* (nothing changed), or was *skipped* (the soft-skip from step 3, with its reason — over the line limit / engine too old / the autonomy pointer's anchor absent), and each Memory Map row the same way (or *refreshed*); the **nine project-configuration ensure** (`configs`) lines exactly as the one ensure run composed them (the ensures and their outcome tokens are enumerated in step 3), each rendered in plain language: what was created, what was left exactly as the user wrote it, and — for a `failed` line — what stopped it; for the navigator, relay the **late** `--only index` line, not the early one; the **`gates-migration`** result — *nothing to migrate*, the shown plan *applied* on your explicit yes, or the plan *left unapplied* (consent not given), with any INERT checker or CUSTOMIZED entries named; the **placed-bridge refresh** (`bridges`) outcome — paste the tool's per-bridge lines verbatim (they are already plain: *refreshed* / *already current* / *skipped — not placed* / `skipped-readonly` with its re-scan verdict / *could not refresh* + recovery); the **agent-rules lens** (`lens`) outcome (*refreshed* / *already current* / *custom edit preserved + note* / *file absent* / *engine too old* / *over the line cap*) and the **Communication-section** outcome (its own set: refreshed / already current / custom preserved + note / section absent — noted / over the cap — refused) and the **story-sessions section** outcome (its own set: refreshed / already current / custom edit preserved + note / section absent — noted / over the file's line cap — refused); the **full-flow offer** (`tier`) lines; the **bridge-settings reconcile** (`bridge-settings`) outcome (paste the tool's line(s) verbatim); and, for a hidden deployment, whether the hidden-mode footprint (`footprint`) was *moved to project-local*, was *already project-local* (nothing changed), or needed a question (ambiguous visibility). Plain wording only — never the reconcile/slot/anchor/marker terms (the never-leak-kit-internals Gotcha — `${CLAUDE_SKILL_DIR}/references/shared/deploy-tail.md`).
|
|
117
117
|
- **Never surface the structure number on this exit.** Whatever step 3 did, do **not** recite the `docs/ai` structure version, the internal versioning vocabulary, or the two-axes note here — the number is inert on an equal-head exit; it belongs to *Version disclosure* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md` (shown at the never-downgrade STOP, the explicit status view, or on an explicit ask). Frame the success itself per the final bullet: if step 3 changed anything, say **what changed** in plain human terms; only a pure zero-diff no-op is *settings already current — no update needed*.
|
|
118
|
-
- **Render the mandatory Recommendations section — on this exit too, BEFORE the footer.** Run `node ${CLAUDE_SKILL_DIR}/tools/recommendations.mjs --cwd <project-root>` and PRESENT its output — from the `## Recommendations (agent-workflow)` header — in the user's conversational language: every fact, count and item from the tool, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; show the raw tool block on request. The section is present-even-when-empty (with everything optimal the body is exactly `no recommendations — flow optimal.`) and VERDICT-FIRST — the composed verdict line renders from the frozen templates `{K} item(s) need attention` / `nothing is broken` / `{N} optional recommendation(s), apply any you want` / `optimality NOT attested — {M} probe check(s) skipped`. Then OFFER the consent route: the user picks items in plain language; surface each picked item's posture note and get the explicit confirm; run its lane's rendered lines — chat: the one-liner; harness: the check line, then on the yes to its result the apply line; user: the user's own step — per the full consent route in `${CLAUDE_SKILL_DIR}/references/modes/recommendations.md`. Pinned order on this exit: Recommendations block → optional applies → report footer → the commit ask (the advisor/apply lane never lands after the commit ask).
|
|
119
|
-
- **Recommendations lanes — both exits.** The
|
|
118
|
+
- **Render the mandatory Recommendations section — on this exit too, BEFORE the footer.** Run `node ${CLAUDE_SKILL_DIR}/tools/recommendations.mjs --cwd <project-root>` and PRESENT its output — from the `## Recommendations (agent-workflow)` header — in the user's conversational language: every fact, count and item from the tool, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; show the raw tool block on request. The section is present-even-when-empty (with everything optimal the body is exactly `no recommendations — flow optimal.`) and VERDICT-FIRST — the composed verdict line renders from the frozen templates `{K} item(s) need attention` / `nothing is broken` / `{N} optional recommendation(s), apply any you want` / `optimality NOT attested — {M} probe check(s) skipped`. Then apply each kit item by the kit route, with no question: its check line in the sandbox, then at once its apply line once outside it. Then OFFER the consent route: the user picks items in plain language; surface each picked item's posture note and get the explicit confirm; run its lane's rendered lines — chat: the one-liner; harness: the check line, then on the yes to its result the apply line; user: the user's own step — per the full consent route in `${CLAUDE_SKILL_DIR}/references/modes/recommendations.md`. Pinned order on this exit: Recommendations block → optional applies → report footer → the commit ask (the advisor/apply lane never lands after the commit ask).
|
|
119
|
+
- **Recommendations lanes — both exits.** The four lanes (`chat`, `harness`, `kit`, `user`), the consent route and the kit route live in `${CLAUDE_SKILL_DIR}/references/modes/recommendations.md`; `init` stays a route the user may take.
|
|
120
120
|
- **Live host/session facts are tool-composed only.** Any claim this report makes about the current host or session state — prompts fired, sandbox scope, whether a bypass was needed, network reachability, approval counts — must trace to **live tool output** from **this session** (the lines you just composed, or a probe you ran this run); a memory/handover snapshot is **context, never report facts**, and a claim with no live signal is **omitted or explicitly marked unverified** — never asserted from recollection. Full clause: *Live host/session facts* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`.
|
|
121
121
|
- **Print the report footer** in the canonical order (version block → one-line backend-status line → welcome mat — the shared contracts in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`; rendered from the helpers, same host-can't-run skip-with-reason). The welcome mat closes on **one** caveat-aware next step (a behind member first, else `setup` / `recipes` / `velocity` / `agents` / `hook`).
|
|
122
122
|
- **Then ask before committing — never auto-commit.** If step 3 added the slot (or anything else changed), report it and ask. If step 3 was a pure zero-diff no-op and nothing else changed, give the plain **settings already current — no update needed** message (the *Success state* contract in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`) and still print the read-only version block (installed package versions) + backend line — but **no `docs/ai` structure version and no two-axes note** (nothing changed, so the number is inert here).
|
|
123
123
|
5. Show the relevant `${CLAUDE_SKILL_DIR}/CHANGELOG.md` diff (entries newer than the project's stamp).
|
|
124
124
|
6. **Collect the migration answers FIRST, then apply.** Run `node ${CLAUDE_SKILL_DIR}/tools/migration-notes.mjs --cwd <project>` and relay its stdout lines verbatim, in order; a non-zero exit relays its one named line and STOPs, except `stamp-absent`, which routes back to step 1. Then run the preview `node ${CLAUDE_SKILL_DIR}/tools/migration-blocks.mjs --cwd <project>`. If its lines say both blocks are missing (pre-1.1.0), ask the two questions as ONE structured multi-question prompt; record each answer individually, write nothing until ALL are answered, and carry the answers into the migrations below: a migration whose answer was already collected never re-asks; a single missing block keeps its single ask (step 7). Then apply exactly the notes the tool listed, in its order ("only those newer than the project's stamp" is why, never a second selection). Migrations are **idempotent** — safe to re-run.
|
|
125
125
|
7. Reconcile drift: add any kernel files/scripts the project is missing; never clobber project-authored content (their `decisions.md`, `known_issues.md`, page specs stay). Any user question a migration raises follows the same rule as bootstrap — **structured multiple-choice where supported** (`AskUserQuestion` in Claude Code), otherwise prose. For a block the preview names as needing its answer, **ask the user their conversational language** (`--language`) or **whether the agent may attribute work to itself / AI** (`--attribution`, defaulting to `off`), never re-asking a step-6 answer; then re-run the preview with `--apply` and the answers, relaying its lines. Exit 1 `answer-missing`: ask exactly what its lines name and re-run `--apply` once; a second one STOPs. Any other exit 1 is a named refusal: relay it with its recovery (`cap`: trim `AGENTS.md`, re-run) and STOP before the finalizer and the stamp. **Then, before the stamp, re-run the LATE navigator finalizer:** the migrations of steps 6–7 may have changed `docs/ai` files, so run the one op again — `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --only index --cwd <project>` — and relay THAT line in the step-8 report (idempotent: an untouched tree changes nothing; a failure STOPs this upgrade like any other ensure).
|
|
126
|
-
8. Re-stamp `docs/ai/.workflow-version` to the **deployment-lineage head** (`4.0.0`, not the package version — mechanics unchanged: the atomic write to the stamp file). In the report, **describe what the upgrade changed in plain human terms** — which parts of their `docs/ai` are now different (the migrations that ran), plus the step-3 run-list outcomes, each as step 4 words it: the `pointers` slots and Memory Map rows, the `footprint` visibility verdict (and what a consented re-run migrated), the **nine project-configuration ensure** (`configs`) lines (enumerated in step 3) — the navigator one being the late `--only index` run at the end of step 7, the **`gates-migration`** result, the **placed-bridge refresh** (`bridges`) lines (pasted verbatim), the **agent-rules lens** (`lens`) + **Communication-section** + **story-sessions section** outcomes (same outcome sets as step 4), the **full-flow offer** (`tier`) outcome, and the **bridge-settings reconcile** (`bridge-settings`) outcome (line(s) pasted verbatim) — rather than reciting a version number; **omit the raw structure number**, and do **not** print the two-axes note here (it belongs to *Version disclosure* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`, on demand only). Then **render the mandatory Recommendations section**: run `node ${CLAUDE_SKILL_DIR}/tools/recommendations.mjs --cwd <project-root>` and PRESENT its output — from the `## Recommendations (agent-workflow)` header — in the user's conversational language (every fact, count and item, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; raw tool block on request; present-even-when-empty: `no recommendations — flow optimal.`), then OFFER the consent route (per picked item: posture note → explicit confirm → chat: the one-liner; harness: the check line, then on the yes to its result the apply line; user: the user's own step — `${CLAUDE_SKILL_DIR}/references/modes/recommendations.md`). **Every current host/session claim in this report is tool-composed only** — prompts fired, sandbox scope, whether a bypass was needed, network reachability and approval counts must trace to **live tool output** from **this session**, a memory/handover snapshot is **context, never report facts**, and an unbacked claim is **omitted or explicitly marked unverified** (full clause: *Live host/session facts* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`). Then **print the report footer** in the canonical order (version block → one-line backend-status line → welcome mat — the shared contracts in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`; rendered from the helpers, same host-can't-run skip-with-reason; the welcome mat closes on one caveat-aware next step). Then **ask before committing** — the pinned order on this exit is: Recommendations block → optional applies → report footer → the commit ask.
|
|
126
|
+
8. Re-stamp `docs/ai/.workflow-version` to the **deployment-lineage head** (`4.0.0`, not the package version — mechanics unchanged: the atomic write to the stamp file). In the report, **describe what the upgrade changed in plain human terms** — which parts of their `docs/ai` are now different (the migrations that ran), plus the step-3 run-list outcomes, each as step 4 words it: the `pointers` slots and Memory Map rows, the `footprint` visibility verdict (and what a consented re-run migrated), the **nine project-configuration ensure** (`configs`) lines (enumerated in step 3) — the navigator one being the late `--only index` run at the end of step 7, the **`gates-migration`** result, the **placed-bridge refresh** (`bridges`) lines (pasted verbatim), the **agent-rules lens** (`lens`) + **Communication-section** + **story-sessions section** outcomes (same outcome sets as step 4), the **full-flow offer** (`tier`) outcome, and the **bridge-settings reconcile** (`bridge-settings`) outcome (line(s) pasted verbatim) — rather than reciting a version number; **omit the raw structure number**, and do **not** print the two-axes note here (it belongs to *Version disclosure* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`, on demand only). Then **render the mandatory Recommendations section**: run `node ${CLAUDE_SKILL_DIR}/tools/recommendations.mjs --cwd <project-root>` and PRESENT its output — from the `## Recommendations (agent-workflow)` header — in the user's conversational language (every fact, count and item, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; raw tool block on request; present-even-when-empty: `no recommendations — flow optimal.`), then apply each kit item by the kit route (no question: its check line, then at once its apply line), then OFFER the consent route (per picked item: posture note → explicit confirm → chat: the one-liner; harness: the check line, then on the yes to its result the apply line; user: the user's own step — `${CLAUDE_SKILL_DIR}/references/modes/recommendations.md`). **Every current host/session claim in this report is tool-composed only** — prompts fired, sandbox scope, whether a bypass was needed, network reachability and approval counts must trace to **live tool output** from **this session**, a memory/handover snapshot is **context, never report facts**, and an unbacked claim is **omitted or explicitly marked unverified** (full clause: *Live host/session facts* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`). Then **print the report footer** in the canonical order (version block → one-line backend-status line → welcome mat — the shared contracts in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`; rendered from the helpers, same host-can't-run skip-with-reason; the welcome mat closes on one caveat-aware next step). Then **ask before committing** — the pinned order on this exit is: Recommendations block → optional applies → report footer → the commit ask.
|
|
@@ -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, writeCheapAgents } from './cheap-agents.mjs';
|
|
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,13 +37,13 @@ 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
|
|
40
|
+
const AGENTS_KIT = 'agents.not-current';
|
|
41
|
+
const AGENT_VARIANTS = ['agents', 'executor-vehicle', AGENTS_KIT];
|
|
41
42
|
const GIT_VARIANTS = ['enforcement', 'commit-guard', 'hook-checks'];
|
|
42
43
|
const WORKTREES = 'worktrees-dir';
|
|
43
44
|
const ATTRIBUTION = 'attribution';
|
|
44
45
|
const FOOTPRINT = 'footprint-global';
|
|
45
|
-
const VARIANTS = [...VELOCITY_VARIANTS, 'autonomy-render', ...HOOK_VARIANTS, STOP, ...MCP_VARIANTS, ...AGENT_VARIANTS,
|
|
46
|
-
...SKILL_VARIANTS, ...GIT_VARIANTS, WORKTREES, ATTRIBUTION, FOOTPRINT];
|
|
46
|
+
const VARIANTS = [...VELOCITY_VARIANTS, 'autonomy-render', ...HOOK_VARIANTS, STOP, ...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);
|
|
@@ -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) {
|
|
@@ -236,8 +239,8 @@ export const scopeOf = (variant, facts, deps = {}) => {
|
|
|
236
239
|
|| (VELOCITY_VARIANTS.includes(variant) && key === 'permissions.ask');
|
|
237
240
|
return correctFile && (!gains || change === 'added') && !(key === ATTRIBUTION_KEY && change === 'removed') && Boolean(allowed[key]?.(value));
|
|
238
241
|
},
|
|
239
|
-
admitsPath: (path, directory = false) => directory ? directories.includes(path)
|
|
240
|
-
|
|
242
|
+
admitsPath: (path, directory = false) => directory ? directories.includes(path) : filePaths.includes(path)
|
|
243
|
+
|| (variant !== AGENTS_KIT && AGENT_VARIANTS.includes(variant) && covers(join(facts.root, AGENTS_DIR), path)),
|
|
241
244
|
};
|
|
242
245
|
};
|
|
243
246
|
|
|
@@ -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';
|
|
@@ -42,6 +43,7 @@ import { deriveLensTemplate, lensVehicleSpec } from './review-roster-resolve.mjs
|
|
|
42
43
|
import { loadVehicles, resolveExecutor, resolveReviewLens } from './vehicle-settings.mjs';
|
|
43
44
|
import { safeLine } from './carriers.mjs';
|
|
44
45
|
import { writeContainedFileAtomic } from './atomic-write.mjs';
|
|
46
|
+
import { fileLine } from './distribution-files/index.mjs';
|
|
45
47
|
// The READ core, never a second copy: the bundle, the placement plan and the executor survey live
|
|
46
48
|
// there so the read-only advisor graph can reach them without reaching this writer.
|
|
47
49
|
import {
|
|
@@ -49,7 +51,6 @@ import {
|
|
|
49
51
|
CLAUDE_DIR,
|
|
50
52
|
WORKFLOW_STAMP,
|
|
51
53
|
EXPECTED_WORKFLOW_VERSION,
|
|
52
|
-
UTF8,
|
|
53
54
|
CHEAP_AGENTS_STAMP,
|
|
54
55
|
CHEAP_AGENTS_SYMLINK,
|
|
55
56
|
CHEAP_AGENTS_BUNDLE,
|
|
@@ -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,
|
|
@@ -109,17 +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
|
-
|
|
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.`;
|
|
116
120
|
|
|
117
121
|
export const fail = (exitCode, message) => Object.assign(new Error(message), { exitCode });
|
|
118
122
|
|
|
119
|
-
const writeFsDeps = (deps = {}) => ({
|
|
120
|
-
mkdir: deps.mkdir ?? mkdirSync,
|
|
121
|
-
writeFile: deps.writeFile ?? writeFileSync,
|
|
122
|
-
});
|
|
123
|
+
const writeFsDeps = (deps = {}) => ({ mkdir: deps.mkdir ?? mkdirSync });
|
|
123
124
|
|
|
124
125
|
const refuseSymlinkedRoot = (projectDir, deps) => {
|
|
125
126
|
const root = resolve(projectDir);
|
|
@@ -178,6 +179,10 @@ const configuredDerivedTemplates = (cwd, deps) => {
|
|
|
178
179
|
return [...templates.values()];
|
|
179
180
|
};
|
|
180
181
|
|
|
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
|
+
|
|
181
186
|
export const applyCheapAgentsCommand = (root) =>
|
|
182
187
|
`node ${shellQuoteArg(fileURLToPath(import.meta.url))} --apply --cwd ${shellQuoteArg(root)}`;
|
|
183
188
|
|
|
@@ -188,9 +193,7 @@ export const writeCheapAgents = ({ cwd, dryRun = true } = {}, deps = {}) => {
|
|
|
188
193
|
const projectDir = cwd ?? process.cwd();
|
|
189
194
|
refuseSymlinkedRoot(projectDir, deps);
|
|
190
195
|
const { posture, lensPosture } = loadPosturesOrStop(projectDir, deps);
|
|
191
|
-
const derived = [
|
|
192
|
-
executorTemplate(posture, deps), reviewLensTemplate(lensPosture, deps), ...configuredDerivedTemplates(projectDir, deps),
|
|
193
|
-
];
|
|
196
|
+
const derived = [executorTemplate(posture, deps), reviewLensTemplate(lensPosture, deps), ...configuredDerivedTemplates(projectDir, deps)];
|
|
194
197
|
const preflight = preflightCheapAgents({ cwd: projectDir, derived }, deps);
|
|
195
198
|
if (dryRun) return { wrote: false, dryRun: true, posture, lensPosture, ...preflight };
|
|
196
199
|
|
|
@@ -200,29 +203,29 @@ export const writeCheapAgents = ({ cwd, dryRun = true } = {}, deps = {}) => {
|
|
|
200
203
|
`not a deployed agent-workflow project at lineage ${EXPECTED_WORKFLOW_VERSION} (found ${preflight.stamp ?? 'none'}) — run init/upgrade first`,
|
|
201
204
|
);
|
|
202
205
|
}
|
|
206
|
+
const accepted = agentsAccepted(projectDir, preflight.plan.map((item) => item.name), deps);
|
|
203
207
|
const toWrite = preflight.plan.filter((item) => item.action === 'place' || item.action === 're-derive');
|
|
204
208
|
if (toWrite.length > 0) fs.mkdir(join(preflight.projectDir, AGENTS_DIR), { recursive: true });
|
|
205
209
|
for (const item of toWrite) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
210
|
-
} 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
|
+
});
|
|
211
213
|
}
|
|
212
|
-
return { wrote: toWrite.length > 0, dryRun: false, posture, lensPosture, ...preflight };
|
|
214
|
+
return { wrote: toWrite.length > 0, dryRun: false, accepted, posture, lensPosture, ...preflight };
|
|
213
215
|
};
|
|
214
216
|
|
|
215
217
|
// ── report ────────────────────────────────────────────────────────────────────────────
|
|
216
218
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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]);
|
|
222
|
+
const rowLine = (item, dryRun) => {
|
|
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);
|
|
226
|
+
}
|
|
227
|
+
return `${item.rel}: ${item.action === 'already-current' ? 'already current' : dryRun ? 'would place' : 'place'}`;
|
|
222
228
|
};
|
|
223
|
-
const LENS_REDERIVE_LABEL = 're-derived — the earlier body was replaced; set its model and effort in docs/ai/vehicles.json';
|
|
224
|
-
const labelOf = (item) =>
|
|
225
|
-
(item.action === 're-derive' && item.name === REVIEW_LENS_VEHICLE ? LENS_REDERIVE_LABEL : ACTION_LABEL[item.action]);
|
|
226
229
|
|
|
227
230
|
export const formatResult = (result) => {
|
|
228
231
|
const { posture, lensPosture } = result;
|
|
@@ -231,17 +234,13 @@ export const formatResult = (result) => {
|
|
|
231
234
|
? 'agent-workflow subagent vehicles — DRY RUN (no changes)'
|
|
232
235
|
: 'agent-workflow subagent vehicles — APPLY',
|
|
233
236
|
];
|
|
234
|
-
for (const item of result.plan) {
|
|
235
|
-
const verb = result.dryRun && item.action === 'place' ? 'would place'
|
|
236
|
-
: result.dryRun && item.action === 're-derive' ? 'would re-derive' : labelOf(item);
|
|
237
|
-
lines.push(` - ${item.rel}: ${verb}`);
|
|
238
|
-
}
|
|
237
|
+
for (const item of result.plan) lines.push(` - ${rowLine(item, result.dryRun)}`);
|
|
239
238
|
if (!result.stampOk) {
|
|
240
239
|
lines.push(`note: no current deployment stamp found (${result.stamp ?? 'none'}) — --apply will refuse until init/upgrade runs.`);
|
|
241
240
|
}
|
|
242
241
|
const readOnlyCount = result.plan.filter((item) => item.name !== EXECUTOR_VEHICLE).length;
|
|
243
242
|
lines.push(
|
|
244
|
-
`${readOnlyCount} vehicles are Claude Code subagents with READ-ONLY tools and NO shell as
|
|
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.`,
|
|
245
244
|
`three of those ride the cheap lane (model: haiku, effort: low) for mechanical work; ${FALLBACK_LENS_ADDITIONAL_ONLY}`,
|
|
246
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.',
|
|
247
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`,
|
|
@@ -253,7 +252,8 @@ export const formatResult = (result) => {
|
|
|
253
252
|
if (result.dryRun && result.plan.some((item) => item.action === 'place' || item.action === 're-derive')) {
|
|
254
253
|
lines.push(`to apply, run exactly: ${applyCheapAgentsCommand(result.projectDir)}`);
|
|
255
254
|
}
|
|
256
|
-
|
|
255
|
+
// Over a placed component the known-footprint registry already hides every kit agent file.
|
|
256
|
+
if (!result.dryRun && result.wrote && !result.accepted) {
|
|
257
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`.');
|
|
258
258
|
}
|
|
259
259
|
return lines.join('\n');
|
|
@@ -16,6 +16,7 @@ import { lstatNoFollow, writeContainedFileAtomic, writeProjectFileCreateOnly } f
|
|
|
16
16
|
import { composeFailure, composeOutcome, nodeEvidenceRefusal, probeSeedTarget, tmpNote } from '../ensure-ops.mjs';
|
|
17
17
|
import { BUNDLED_SCRIPT_NAMES } from '../node-evidence.mjs';
|
|
18
18
|
import { CHECKER_PAIR, INSTALLER_SET, READER_PAIR, SCRIPT_PRIORS, classifyDeployedScript } from '../script-priors.mjs';
|
|
19
|
+
import { VEHICLES_REL } from '../vehicle-settings.mjs';
|
|
19
20
|
|
|
20
21
|
const OP = 'scripts';
|
|
21
22
|
const SCRIPTS_DIR = 'scripts';
|
|
@@ -23,6 +24,8 @@ const BUNDLED = ['references', 'scripts'];
|
|
|
23
24
|
// Where an edit meant to last goes: the installer's in the local hook file, every other file's beside it.
|
|
24
25
|
export const SCRIPT_CHANNEL = 'a script or suite of your own under its own name in scripts/, or a config the script reads';
|
|
25
26
|
export const LOCAL_HOOK_CHANNEL = 'the local hook file scripts/pre-commit.local, which the commit hook runs first';
|
|
27
|
+
export const VEHICLE_CHANNEL = VEHICLES_REL;
|
|
28
|
+
export const AGENT_CHANNEL = '.claude/agents/<name>.local.md with a name: of its own';
|
|
26
29
|
// The family files memory copies on Node evidence alone, accepted or not (the suite derives them).
|
|
27
30
|
export const SEED_NAMES = Object.freeze(['_expect-shim.mjs', 'archive-decisions.mjs', 'archive-decisions.test.mjs', 'markdown-blocks.mjs']);
|
|
28
31
|
const ROTATOR = 'archive-decisions.mjs';
|
|
@@ -78,13 +81,16 @@ const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
|
|
|
78
81
|
// A fate is `written`, `stood` (an absent file that appeared with the bundled body), `refused` (its
|
|
79
82
|
// write failed), or none: the run stopped before it, or, dry, would write it. The spec layer's pair
|
|
80
83
|
// lines are these too, through the module's index.
|
|
81
|
-
const VERBS = { prior: ['refreshed', 'refreshed to the bundled one'], custom: ['replaced', 'replaced by the bundled body'], absent: ['placed', 'placed from the bundled scripts'] };
|
|
82
|
-
const HEADS = { prior: 'matches a body an earlier release shipped', custom: 'differs from every body this kit knows it shipped', absent: 'absent' };
|
|
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' };
|
|
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}`
|
|
88
|
+
: f.state === 'custom' ? `; an edit meant to last goes in ${f.name === INSTALLER_SET[0] ? LOCAL_HOOK_CHANNEL : SCRIPT_CHANNEL}` : '');
|
|
83
89
|
export const fileLine = (f, fate, dryRun) => {
|
|
84
90
|
if (fate === 'stood') return `${f.rel}: appeared while this run was placing it — the bundled body stands, nothing written`;
|
|
85
91
|
const [verb, done] = VERBS[f.state];
|
|
86
92
|
const tail = fate === 'written' ? done : dryRun ? `would be ${done}` : `not ${verb}; ${fate === 'refused' ? 'its write was refused (above)' : 'the run stopped before it'}`;
|
|
87
|
-
return `${f.rel}: ${HEADS[f.state]} — ${tail}${f
|
|
93
|
+
return `${f.rel}: ${HEADS[f.state]} — ${tail}${channelOf(f)}`;
|
|
88
94
|
};
|
|
89
95
|
const NOT_ACCEPTED = `${SCRIPTS_DIR}/: the enforcement scripts were not accepted in this project, so no other kit script is placed`;
|
|
90
96
|
// The hook-run line, once after the file lines of a run that wrote (or, dry, would write) a file.
|
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
|
-
|
|
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
|
};
|
package/tools/init-project.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { preflightInit } from './init-preflight.mjs';
|
|
|
13
13
|
import { buildRecommendations, hostFacts } from './recommendations.mjs';
|
|
14
14
|
import { compareSemver } from './semver-lite.mjs';
|
|
15
15
|
import { EXPECTED_WORKFLOW_VERSION } from './velocity-profile.mjs';
|
|
16
|
-
import { LANE_HARNESS, VARIANT_LANES, consoleArgv, isEnvDependent, isProtectedPath, isRejudged, laneOf, writesOf } from './write-lanes.mjs';
|
|
16
|
+
import { LANE_HARNESS, LANE_KIT, VARIANT_LANES, consoleArgv, isEnvDependent, isProtectedPath, isRejudged, laneOf, writesOf } from './write-lanes.mjs';
|
|
17
17
|
|
|
18
18
|
const INSIDE_LINE = 'you are inside an agent; run this in your own terminal';
|
|
19
19
|
const APPLY_PROMPT = 'apply? y/N: ';
|
|
@@ -218,7 +218,7 @@ const previewQueue = async (context, queue) => {
|
|
|
218
218
|
const tuple = result.stdout.match(/--apply\s+(\S+)/)?.[1];
|
|
219
219
|
const facts = { ...context.facts, env: context.spawnEnv, tuple };
|
|
220
220
|
let checkDigest = null;
|
|
221
|
-
if (laneOf(item.variant)
|
|
221
|
+
if ([LANE_HARNESS, LANE_KIT].includes(laneOf(item.variant))) {
|
|
222
222
|
try {
|
|
223
223
|
const { lines, refused, digest } = context.checkApply(item.variant, facts, {});
|
|
224
224
|
for (const line of lines) context.print(line);
|
|
@@ -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,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from './velocity-profile.mjs';
|
|
47
47
|
import { loadAutonomy, isSparseSeedConfig, AUTONOMY_REL } from './autonomy-config.mjs';
|
|
48
48
|
import { deriveDoctorPlan, TRUSTED_DIRS } from './autonomy-doctor.mjs';
|
|
49
|
-
import { laneOf, applySlot, consoleArgv } from './write-lanes.mjs';
|
|
49
|
+
import { LANE_KIT, laneOf, applySlot, consoleArgv } from './write-lanes.mjs';
|
|
50
50
|
import { STATE_BLOCK_HOOK_COMMAND, STATE_BLOCK_HOOK_RUNTIME, isStopHookWired } from './state-block-hook.mjs';
|
|
51
51
|
import { detectBackends } from './detect-backends.mjs';
|
|
52
52
|
import { isDirectRun } from './direct-run.mjs';
|
|
@@ -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
|
|
216
|
-
// re-deriving it is an offer.
|
|
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,
|
|
@@ -249,16 +248,15 @@ const fillTemplate = (template, values) => template.replace(/\{([A-Za-z]+)\}/g,
|
|
|
249
248
|
// composeVerdict(counts) → the ONE verdict line, or null for the optimal state (D1 state matrix).
|
|
250
249
|
// attention>0 leads; the "nothing is broken" wording renders ONLY when attention==0 AND skipped==0
|
|
251
250
|
// (a skipped probe could hide an attention-class problem, so the claim would overreach; it renders
|
|
252
|
-
//
|
|
253
|
-
// appended last.
|
|
254
|
-
export const composeVerdict = ({ attention, optional, skipped }) => {
|
|
255
|
-
if (attention === 0 && optional === 0 && skipped === 0) return null;
|
|
251
|
+
// as the lead-in to the optional offer, or alone beside kit items only, which count in neither class:
|
|
252
|
+
// the agent applies them with no pick); the skips part is appended last.
|
|
253
|
+
export const composeVerdict = ({ attention, optional, skipped, kit = 0 }) => {
|
|
254
|
+
if (attention === 0 && optional === 0 && skipped === 0 && kit === 0) return null;
|
|
256
255
|
const parts = [];
|
|
257
256
|
if (attention > 0) parts.push(fillTemplate(VERDICT_ATTENTION_TEMPLATE, { K: attention }));
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
257
|
+
const offer = optional > 0 ? fillTemplate(VERDICT_OPTIONAL_TEMPLATE, { N: optional }) : null;
|
|
258
|
+
if (attention === 0 && skipped === 0) parts.push(offer ? `${VERDICT_NOTHING_BROKEN} — ${offer}` : VERDICT_NOTHING_BROKEN);
|
|
259
|
+
else if (offer) parts.push(offer);
|
|
262
260
|
if (skipped > 0) parts.push(fillTemplate(VERDICT_SKIPS_TEMPLATE, { M: skipped }));
|
|
263
261
|
return parts.join('; ');
|
|
264
262
|
};
|
|
@@ -305,9 +303,8 @@ export const WHATS = Object.freeze({
|
|
|
305
303
|
'mcp-channel': "the kit's read-only MCP server is not registered here — path questions and literal searches stay shell strings",
|
|
306
304
|
'mcp-channel.differing': 'an "{server}" MCP entry is already declared here and DIFFERS from the registration this kit copy would write',
|
|
307
305
|
agents: '{n} bundled subagent vehicle(s) not placed (Claude Code) — {ro} read-only, {ex} the full-tool executor; the apply PREVIEWS first',
|
|
308
|
-
'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',
|
|
309
307
|
'executor-vehicle': '{n} slot(s) configured subagent but the executor vehicle is {state}{reason} — every such slot runs solo until it is usable',
|
|
310
|
-
'executor-vehicle.differing': 'the placed executor vehicle differs from the body derived from docs/ai/vehicles.json — a hand edit stands until it is re-derived',
|
|
311
308
|
attribution: 'AGENTS.md says attribution off but .claude/settings.json does not hide the harness trailer and PR text',
|
|
312
309
|
'footprint-global': 'legacy kit ignore line(s) sit in {file} — they ignore kit paths in every repository here',
|
|
313
310
|
'family-freshness': '{parts}',
|
|
@@ -385,9 +382,9 @@ export const BENEFITS = Object.freeze({
|
|
|
385
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',
|
|
386
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',
|
|
387
384
|
});
|
|
388
|
-
// The
|
|
385
|
+
// The arms whose gain differs from their base item's (BENEFITS stays keyed by item key).
|
|
389
386
|
export const VARIANT_BENEFITS = Object.freeze({
|
|
390
|
-
'
|
|
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',
|
|
391
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',
|
|
392
389
|
});
|
|
393
390
|
|
|
@@ -445,9 +442,9 @@ export const OPT_IN_CAPABILITIES = Object.freeze([
|
|
|
445
442
|
// which is why the review-recipe benefit is worded for either slot rather than for review alone.
|
|
446
443
|
{ id: 'delegated-execution', mode: 'set-recipe', advisorKey: 'review-recipe' },
|
|
447
444
|
{ id: 'agents', mode: 'agents', advisorKey: 'agents' },
|
|
448
|
-
// A DISTINCT capability from the offer above: the
|
|
449
|
-
//
|
|
450
|
-
//
|
|
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.
|
|
451
448
|
{ id: 'executor-vehicle', mode: 'agents', advisorKey: 'executor-vehicle' },
|
|
452
449
|
// Exempt, not un-audited. `acceptEdits` auto-applies Edit/Write and auto-runs mkdir/touch/mv/cp:
|
|
453
450
|
// a TRUST-POSTURE change. Velocity presents its full posture at its own consent moment;
|
|
@@ -1148,37 +1145,35 @@ const probeStateBlockHook = ({ root, deps, add, skip }) => {
|
|
|
1148
1145
|
// surfaced its absence: `agents` is the family's SECOND `.claude/` writer, the `help` Tune tail
|
|
1149
1146
|
// advertises it, and the advisor had no entry for it — so a user who never runs `help` never learned
|
|
1150
1147
|
// it existed while the advisor reported the deployment optimal. Found by the guard, not by an incident.
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
|
|
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 }) => {
|
|
1154
1155
|
try {
|
|
1155
|
-
const
|
|
1156
|
-
const
|
|
1157
|
-
|
|
1158
|
-
if (
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
// The writer refuses below the expected lineage, so offering its command would hand the user a
|
|
1165
|
-
// guaranteed failure — the honest surface is a stated skip naming the recovery.
|
|
1166
|
-
if (!preflight.stampOk) {
|
|
1167
|
-
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(', ')}`);
|
|
1168
1165
|
return;
|
|
1169
1166
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1175
|
-
//
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
// The hidden-mode reconcile rides the detail, never the apply line: it is wrong to run on a
|
|
1179
|
-
// 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));
|
|
1180
1175
|
const executors = toPlace.filter((item) => item.name === EXECUTOR_VEHICLE).length;
|
|
1181
|
-
add('agents', fillTemplate(WHATS
|
|
1176
|
+
add('agents', fillTemplate(WHATS.agents, { n: toPlace.length, ex: executors, ro: toPlace.length - executors }),
|
|
1182
1177
|
`node ${q(toolPath('cheap-agents.mjs'))} --cwd ${q(root)}`, 'agents',
|
|
1183
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`,
|
|
1184
1179
|
);
|
|
@@ -1188,14 +1183,15 @@ const probeCheapAgents = ({ root, deps, add, skip }) => {
|
|
|
1188
1183
|
};
|
|
1189
1184
|
|
|
1190
1185
|
// The subagent carrier's ONE instrument (contract: kit/carriers). Neither neighbour can report this
|
|
1191
|
-
// state: `probeReviewRecipe` skips a slot configured `subagent` by construction, and the
|
|
1192
|
-
//
|
|
1193
|
-
//
|
|
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).
|
|
1194
1189
|
const VEHICLE_BROKEN_STATES = Object.freeze(['missing', 'unusable']);
|
|
1195
1190
|
|
|
1191
|
+
// The writer's plain dry run, the call the `agents` key makes: its refusal is the last precondition.
|
|
1196
1192
|
const writerBlock = (root, deps) => {
|
|
1197
1193
|
try {
|
|
1198
|
-
|
|
1194
|
+
writeCheapAgents({ cwd: root, dryRun: true }, deps);
|
|
1199
1195
|
return null;
|
|
1200
1196
|
} catch (err) {
|
|
1201
1197
|
return safeLine(err?.message ?? String(err));
|
|
@@ -1204,39 +1200,27 @@ const writerBlock = (root, deps) => {
|
|
|
1204
1200
|
|
|
1205
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`;
|
|
1206
1202
|
|
|
1207
|
-
const probeExecutorVehicle = ({ root, deps, add, skip }) => {
|
|
1208
|
-
if (renderBrokenExecutor({ root, deps, add, skip })) return;
|
|
1209
|
-
try {
|
|
1210
|
-
if (!executorBodyDiffers(root, deps)) return;
|
|
1211
|
-
const plan = writeCheapAgents({ cwd: root, dryRun: 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),
|
|
1214
|
-
'executor-vehicle.differing', HIDDEN_AGENTS_FOLLOW_UP(root));
|
|
1215
|
-
} catch (err) {
|
|
1216
|
-
skip('executor-vehicle', err);
|
|
1217
|
-
}
|
|
1218
|
-
};
|
|
1219
|
-
|
|
1220
|
-
const renderBrokenExecutor = ({ root, deps, add, skip }) => {
|
|
1203
|
+
const probeExecutorVehicle = ({ root, deps, add, skip, shared }) => {
|
|
1221
1204
|
try {
|
|
1222
1205
|
// The VALIDATED reader, as probeReviewRecipe uses it: a schema-invalid config is a stated skip,
|
|
1223
1206
|
// never an item computed over a shape nothing accepted.
|
|
1224
1207
|
const { config } = loadConfig(root, deps.readFile ?? readFileSync, deps.lstat ?? lstatSync);
|
|
1225
1208
|
const configured = Object.entries(ACTIVITIES).flatMap(([activity, def]) =>
|
|
1226
1209
|
Object.keys(def.slots).filter((slot) => config?.[activity]?.[slot] === 'subagent'));
|
|
1227
|
-
if (configured.length === 0) return
|
|
1210
|
+
if (configured.length === 0) return;
|
|
1228
1211
|
const survey = (deps.surveyVehicle ?? surveyExecutorVehicle)(root, deps);
|
|
1229
|
-
if (!VEHICLE_BROKEN_STATES.includes(survey.state)) return
|
|
1212
|
+
if (!VEHICLE_BROKEN_STATES.includes(survey.state) || shared?.agentsNotCurrent) return;
|
|
1230
1213
|
const reason = safeLine(survey.reason ?? '');
|
|
1231
1214
|
const { posture, reason: settingsReason } = readExecutorPosture(root, deps);
|
|
1232
1215
|
const stamp = readStamp(join(root, WORKFLOW_STAMP), readFsDeps(deps));
|
|
1233
1216
|
const preconditions = [
|
|
1234
|
-
...(stamp === EXPECTED_WORKFLOW_VERSION ? [] : [
|
|
1217
|
+
...(stamp === EXPECTED_WORKFLOW_VERSION ? [] : [upgradeFirst(stamp).message]),
|
|
1235
1218
|
...(posture === null ? [`${safeLine(settingsReason)} — fix that`] : []),
|
|
1236
1219
|
];
|
|
1237
|
-
// The writer refuses on ANY
|
|
1238
|
-
// missing executor's placement too), so its
|
|
1239
|
-
|
|
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);
|
|
1240
1224
|
if (blocked) preconditions.push(`${blocked} — fix that`);
|
|
1241
1225
|
const room = templateBudget(WHATS['executor-vehicle']) - String(configured.length).length - survey.state.length - 2;
|
|
1242
1226
|
add(
|
|
@@ -1246,16 +1230,14 @@ const renderBrokenExecutor = ({ root, deps, add, skip }) => {
|
|
|
1246
1230
|
state: survey.state,
|
|
1247
1231
|
reason: reason && room > 0 ? `: ${truncatedTo(reason, room)}` : '',
|
|
1248
1232
|
}),
|
|
1249
|
-
// 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
|
|
1250
1234
|
// frontmatter or read-only tools included), so those states need no precondition; every precondition above is a refusal the apply would meet.
|
|
1251
1235
|
`node ${q(toolPath('cheap-agents.mjs'))} --apply --cwd ${q(root)}`,
|
|
1252
1236
|
'executor-vehicle',
|
|
1253
1237
|
`${preconditions.length ? `precondition: ${preconditions.join('; ')}; ` : ''}${HIDDEN_AGENTS_FOLLOW_UP(root)}`,
|
|
1254
1238
|
);
|
|
1255
|
-
return true;
|
|
1256
1239
|
} catch (err) {
|
|
1257
1240
|
skip('executor-vehicle', err);
|
|
1258
|
-
return true;
|
|
1259
1241
|
}
|
|
1260
1242
|
};
|
|
1261
1243
|
|
|
@@ -1738,13 +1720,16 @@ export const buildRecommendations = ({ cwd, deps = {} } = {}) => {
|
|
|
1738
1720
|
// one pair today (the marker-stale ⟷ read-lane.stale precedence) and read in the frozen PROBES
|
|
1739
1721
|
// order, so the reader can never run first.
|
|
1740
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;
|
|
1741
1726
|
const contentDeps = Object.create(Object.getPrototypeOf(deps), {
|
|
1742
1727
|
...Object.getOwnPropertyDescriptors(deps),
|
|
1743
1728
|
lstat: {
|
|
1744
1729
|
enumerable: true,
|
|
1745
1730
|
value: (path, ...args) => {
|
|
1746
1731
|
const stat = (deps.lstat ?? deps.lstatSync ?? lstatSync)(path, ...args);
|
|
1747
|
-
if (stat.isCharacterDevice?.() || stat.isBlockDevice?.()) {
|
|
1732
|
+
if (!String(path).startsWith(agentsDir) && (stat.isCharacterDevice?.() || stat.isBlockDevice?.())) {
|
|
1748
1733
|
throw Object.assign(new Error(`${ABSENT_CODE}: ${path}`), { code: ABSENT_CODE });
|
|
1749
1734
|
}
|
|
1750
1735
|
return stat;
|
|
@@ -1761,8 +1746,8 @@ export const buildRecommendations = ({ cwd, deps = {} } = {}) => {
|
|
|
1761
1746
|
// facts/counts complete, commands byte-exact; the raw block on request) ─────────────────────────
|
|
1762
1747
|
export const formatRecommendations = ({ items, skips }) => {
|
|
1763
1748
|
const lines = [RECOMMENDATIONS_SECTION_HEADER, ''];
|
|
1764
|
-
const attention = items.filter((i) => i.severity === SEVERITY_ATTENTION).length;
|
|
1765
|
-
const verdict = composeVerdict({ attention, optional: items.length - attention, skipped: skips.length });
|
|
1749
|
+
const [kit, attention] = [items.filter((i) => i.lane === LANE_KIT).length, items.filter((i) => i.lane !== LANE_KIT && i.severity === SEVERITY_ATTENTION).length];
|
|
1750
|
+
const verdict = composeVerdict({ attention, optional: items.length - attention - kit, skipped: skips.length, kit });
|
|
1766
1751
|
if (verdict == null) {
|
|
1767
1752
|
// The flow-optimal claim renders ONLY when every probe ran and none fired — an empty item
|
|
1768
1753
|
// list beside skipped checks would falsely attest optimality (Segment B).
|
|
@@ -1800,7 +1785,7 @@ Computes the deterministic Recommendations section every kit upgrade ends with
|
|
|
1800
1785
|
one composed verdict line opens every non-optimal render, then per item {severity · what is
|
|
1801
1786
|
sub-optimal · the benefit in one plain line · the lane · an optional \`recipe:\` line (an item's own
|
|
1802
1787
|
facts or its alternative, such as the bridge-tier missing-entries line or
|
|
1803
|
-
the worktrees-dir ack fallback) · the harness check line · the exact consent-gated apply one-liner}. --cwd is
|
|
1788
|
+
the worktrees-dir ack fallback) · the harness or kit check line · the exact consent-gated apply one-liner}. --cwd is
|
|
1804
1789
|
REQUIRED (the target project is explicit, never inferred from the shell's current directory). The
|
|
1805
1790
|
section renders present-even-when-empty ("${RECOMMENDATIONS_EMPTY_LINE}"); a probe failure is a
|
|
1806
1791
|
stated skipped-item line. Apply lines are cwd-independent (absolute tool paths, a pinned --cwd;
|
|
@@ -1811,7 +1796,7 @@ allow rules, <wrapper> * exclusions (codex-exec * where an execute slot delegate
|
|
|
1811
1796
|
sandbox.network.allowedDomains and state dirs in sandbox.filesystem.allowWrite. Where the host
|
|
1812
1797
|
honors the settings sandbox keys, an excluded wrapper runs outside the sandbox, every sandboxed
|
|
1813
1798
|
command of the project can reach each host, and every sandboxed command can write each state dir;
|
|
1814
|
-
plan/diff review modes and delegated execution keep their prompt.
|
|
1799
|
+
plan/diff review modes and delegated execution keep their prompt. A kit item the agent applies with no question, after its check.
|
|
1815
1800
|
A user item stays the user's own step.
|
|
1816
1801
|
|
|
1817
1802
|
Read-only: never writes, never commits, never runs a subscription CLI. Exit codes: 0 report
|
package/tools/write-lanes.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { GATES_REL } from './gates-declaration.mjs';
|
|
|
11
11
|
export const LANE_CHAT = 'chat';
|
|
12
12
|
export const LANE_HARNESS = 'harness';
|
|
13
13
|
export const LANE_USER = 'user';
|
|
14
|
+
export const LANE_KIT = 'kit';
|
|
14
15
|
|
|
15
16
|
export const VARIANT_LANES = Object.freeze({
|
|
16
17
|
'velocity-core': LANE_HARNESS,
|
|
@@ -45,8 +46,8 @@ export const VARIANT_LANES = Object.freeze({
|
|
|
45
46
|
'mcp-channel': LANE_HARNESS,
|
|
46
47
|
'mcp-channel.differing': LANE_HARNESS,
|
|
47
48
|
agents: LANE_HARNESS,
|
|
49
|
+
'agents.not-current': LANE_KIT,
|
|
48
50
|
'executor-vehicle': LANE_HARNESS,
|
|
49
|
-
'executor-vehicle.differing': LANE_HARNESS,
|
|
50
51
|
attribution: LANE_HARNESS,
|
|
51
52
|
'footprint-global': LANE_HARNESS,
|
|
52
53
|
'family-freshness': LANE_USER,
|
|
@@ -160,8 +161,8 @@ const FORMS = Object.freeze({
|
|
|
160
161
|
'mcp-channel.differing': createForm('mcp.mjs',
|
|
161
162
|
['--replace', '--cwd', '<root>'], ['--replace', '--apply', '--cwd', '<root>'], MCP_WRITES),
|
|
162
163
|
agents: AGENT_FORM,
|
|
164
|
+
'agents.not-current': AGENT_FORM,
|
|
163
165
|
'executor-vehicle': AGENT_FORM,
|
|
164
|
-
'executor-vehicle.differing': AGENT_FORM,
|
|
165
166
|
attribution: createForm('attribution.mjs', ['--cwd', '<root>'], ['--apply', '--cwd', '<root>'], SETTINGS_WRITES),
|
|
166
167
|
'footprint-global': createForm('hide-footprint.mjs',
|
|
167
168
|
['--remove-global', '--dry-run', '--dir', '<root>'], ['--remove-global', '--dir', '<root>'], [], false, null, true),
|
|
@@ -246,7 +247,7 @@ export const isRejudged = (variant) => {
|
|
|
246
247
|
export const applySlot = (variant, facts) => {
|
|
247
248
|
const lane = laneOf(variant);
|
|
248
249
|
const form = FORMS[variant];
|
|
249
|
-
if (lane === LANE_HARNESS) {
|
|
250
|
+
if (lane === LANE_HARNESS || lane === LANE_KIT) {
|
|
250
251
|
const args = ['node', join(facts.toolsDir, 'apply-danger-check.mjs'), '--variant', variant, '--cwd', facts.root];
|
|
251
252
|
const skillArgs = form === SKILL_FORM ? form.preview.map((arg) => resolveArgument(arg, facts)) : [];
|
|
252
253
|
const check = formatCommand([...args, ...skillArgs]);
|