@sabaiway/agent-workflow-kit 19.5.0 → 20.0.1

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +18 -10
  3. package/SKILL.md +6 -6
  4. package/bin/install.mjs +1 -1
  5. package/capability.json +1 -1
  6. package/migrations/1.1.0-communication-language.md +2 -4
  7. package/migrations/1.2.0-agent-attribution.md +1 -3
  8. package/migrations/5.0.0-kit-text-in-kit-files.md +30 -0
  9. package/migrations/README.md +2 -2
  10. package/package.json +1 -1
  11. package/references/advisor-writers.md +1 -1
  12. package/references/contracts.md +9 -11
  13. package/references/modes/bootstrap.md +2 -4
  14. package/references/modes/hook.md +1 -1
  15. package/references/modes/procedures.md +1 -1
  16. package/references/modes/recommendations.md +1 -1
  17. package/references/modes/rules.md +4 -3
  18. package/references/modes/upgrade.md +23 -49
  19. package/references/modes/velocity.md +1 -1
  20. package/references/reference-profile.json +0 -6
  21. package/references/rules/communication.md +22 -0
  22. package/references/rules/project-layout.md +2 -0
  23. package/references/rules/story-sessions.md +14 -0
  24. package/references/shared/composition-handoff.md +24 -59
  25. package/references/shared/deploy-tail.md +2 -2
  26. package/references/templates/AGENTS.md +0 -10
  27. package/references/templates/agent_rules.md +0 -33
  28. package/tools/cheap-agents-read.mjs +1 -1
  29. package/tools/delegation.mjs +5 -8
  30. package/tools/engine-source.mjs +13 -11
  31. package/tools/family-registry.mjs +4 -5
  32. package/tools/inject-methodology.mjs +153 -493
  33. package/tools/migration-blocks.mjs +0 -6
  34. package/tools/orchestration-readme.mjs +1 -1
  35. package/tools/payload-prune.mjs +48 -8
  36. package/tools/profile-gap-screen.mjs +2 -6
  37. package/tools/profile-gaps.mjs +19 -100
  38. package/tools/project-rules/index.mjs +1 -2
  39. package/tools/project-rules/rules-ensure.mjs +37 -6
  40. package/tools/project-rules/rules-priors.mjs +1 -0
  41. package/tools/project-rules/themes.mjs +13 -5
  42. package/tools/transition/index.mjs +214 -0
  43. package/tools/upgrade-runlist.mjs +2 -17
  44. package/tools/velocity-profile.mjs +1 -1
  45. package/tools/lens-region.mjs +0 -281
  46. package/tools/project-rules/memory-map-row.mjs +0 -81
  47. package/tools/rules-insert.mjs +0 -203
  48. package/tools/rules-regions.mjs +0 -190
package/CHANGELOG.md CHANGED
@@ -4,6 +4,73 @@ Semantically versioned ([semver](https://semver.org)), newest first. The `versio
4
4
  is the current release. `upgrade` mode reads a project's `docs/ai/.workflow-version` and applies
5
5
  every `migrations/<version>-<slug>.md` newer than it, in semver order.
6
6
 
7
+ ## 20.0.1 — `init` removes the folders it leaves empty in the kit home (AD-217)
8
+
9
+ **A refresh no longer asks you to delete folders by hand.** `init` removes from an existing kit home every file in
10
+ the kit's folders that the package does not carry, but it kept the folders themselves and printed `kept <folder> (a
11
+ directory the package does not carry — yours to remove by hand)` for the topmost such folder of each tree, on every
12
+ run. Moving to 20.0.0, which ships no test suites, left 70 empty folders and 26 such lines. Now:
13
+
14
+ - After removing the files, `init` removes each folder the package does not carry that is left empty, children first,
15
+ with one `removed <folder> (not in the package)` line for the topmost folder of each removed tree. The next run over
16
+ the same home prints nothing for it.
17
+ - A folder that still holds something stays, with one `kept <folder> (a directory the package does not carry that
18
+ still holds an entry)` line for the topmost such folder of each tree. A symlink the package does not carry stays the owner's, unchanged.
19
+ - The removal is a single non-recursive `rmdir` behind the same guards as the file removal; a failure is reported by
20
+ folder and cause and fails the install, like a file that cannot be removed.
21
+
22
+ Your next `npx @sabaiway/agent-workflow-kit@latest init` removes the empty folders earlier refreshes left. Contract:
23
+ upgrade-delivery revision 10.
24
+
25
+ ## 20.0.0 — the kit's text lives in kit files and one kit block; one upgrade moves your project once (AD-216)
26
+
27
+ **Your project's own files can no longer lose the kit's updates.** Until now the kit kept its standing text inside
28
+ files your project owns, three pointers and theme rows in `AGENTS.md` and three sections in `docs/ai/agent_rules.md`,
29
+ and found them by headings and anchor sentences. A project that moved a section to another heading stopped getting
30
+ its updates, and nothing said so. Now:
31
+
32
+ - **One kit block in `AGENTS.md`.** The upgrade writes one block between `<!-- workflow:kit:start -->` and
33
+ `<!-- workflow:kit:end -->`, at the start of the file when there is none: a line saying the block is the kit's and
34
+ governs over any copy of kit text elsewhere, a line to read `docs/ai/index.md` after the entry file and
35
+ `docs/ai/agent_rules.md` before any code change, the methodology, orchestration and autonomy texts from the installed
36
+ engine, and one row per rules theme. It is written current with no question and no copy kept. Text of your own
37
+ goes outside the two comment lines. Marker lines that are not exactly one start before one end stop the upgrade
38
+ with their line numbers. No line cap is judged on `AGENTS.md` any more.
39
+ - **The rules texts are rules themes.** Communication, Story sessions and the lens now ship as rules themes beside
40
+ project-layout: `docs/ai/rules/<theme>.md` (the kit's), `docs/ai/rules/local/<theme>.md` (yours, which wins) and
41
+ `docs/ai/rules/effective/<theme>.md` (what agents read before any code change). The lens theme comes from the
42
+ installed engine. `docs/ai/agent_rules.md` is now yours: the kit lays it only where it is absent, and apart from the
43
+ one-time step below never reads or writes it.
44
+ - **What retires.** `tools/rules-regions.mjs`, `tools/lens-region.mjs`, `tools/rules-insert.mjs` and
45
+ `tools/project-rules/memory-map-row.mjs`; the three pointer pairs and the line cap; the advisor items
46
+ `story-sessions-section` and `session-close-rules`. Every decline you recorded for the full-flow offer stays current.
47
+
48
+ **One upgrade moves your project once.** The deployment structure moves to `5.0.0`, and its note
49
+ `migrations/5.0.0-kit-text-in-kit-files.md` runs `node <kit>/tools/transition/index.mjs --cwd <project>` once, after
50
+ the upgrade wrote the block and the themes. It first checks that they are in place: the block, each engine text and
51
+ the lens theme. If one is missing, it refuses `replacement-missing`, removes nothing and names the fix (the upgrade
52
+ again, or `npx @sabaiway/agent-workflow-engine@latest init` and then the upgrade). Otherwise it removes, each whole with
53
+ any text written inside it, the three old pointer pairs, the old theme rows and the old line-cap footer from
54
+ `AGENTS.md`, and the Communication, Planning-review-and-process-fidelity and Story sessions sections from
55
+ `docs/ai/agent_rules.md`, found by their titles at any heading level, and prints one `removed:` line for each. A second
56
+ run prints only `unchanged:` lines. The kit keeps no copy: your version control is the rollback.
57
+
58
+ **What the one-time move leaves, by design:**
59
+
60
+ - a line of your own that points at a removed pointer (for example "the `workflow:methodology` slot") stays, pointing
61
+ at nothing;
62
+ - a deployment that reaches this kit without passing the `5.0.0` step (an old memory-only seed adopted later) keeps
63
+ its old copies;
64
+ - between updating the kit and running the upgrade, tools that check the structure version refuse;
65
+ - an older `agent-workflow-memory` refuses its own upgrade on a project this kit stamped `5.0.0`, and a bootstrap
66
+ with an older memory keeps the copies its templates laid;
67
+ - a memory-only deployment gets no kit rules.
68
+
69
+ MAJOR: four modules, two advisor items and the engine's lens file path retire, and an older kit or memory refuses a
70
+ project at `5.0.0`. Contracts: entry-pointers revision 2, project-rules revision 10, transition revision 1 (new),
71
+ rules-regions retired, gap-screen revision 3, session-rules revision 4, tier-offer revision 7, upgrade-delivery
72
+ revision 9.
73
+
7
74
  ## 19.5.0 — the spec reader counts no children, and one plain upgrade brings it to every deployment (AD-215)
8
75
 
9
76
  **The spec reader your project runs no longer refuses an index of more than 30 children.** The kit carries memory
package/README.md CHANGED
@@ -172,9 +172,9 @@ After `init`, run `/agent-workflow-kit upgrade` in an agent session: the agent a
172
172
  > If a **healthy** copy is installed (the kit validates it with its own shipped validator), the kit
173
173
  > **delegates** substrate deployment to it and injects the workflow methodology; otherwise it uses
174
174
  > its **own bundled copy** — the one command above keeps working with **no new dependency on the
175
- > memory substrate**. Same `docs/ai/` either way. (The **methodology slot** is a separate axis: its
176
- > fragment is read **live from the installed `agent-workflow-engine`**, which `npx … init` installs
177
- > for you — a runtime dependency placed by `init`, read live.)
175
+ > memory substrate**. Same `docs/ai/` either way. (The **kit block** in `AGENTS.md` is a separate
176
+ > axis: its engine texts are read **live from the installed `agent-workflow-engine`**, which
177
+ > `npx … init` installs for you — a runtime dependency placed by `init`, read live.)
178
178
 
179
179
  ### Refresh the kit itself — same command with `@latest`
180
180
 
@@ -207,7 +207,7 @@ other agent). The manual path works identically but **isn't reflected in install
207
207
  <summary><b>What <code>init</code> touches — and how to undo it</b></summary>
208
208
 
209
209
  `init` **never deletes your project settings**, and it installs only into a new or empty folder or an existing kit home: any other `--dir` is refused before anything is written. In an existing kit home it removes every file in the kit's
210
- `references/`, `tools/`, `migrations/`, `launchers/` and `bridges/` folders that the package does not carry, a file you put there included, one reported line per file. It writes its own namespaced slots, then
210
+ `references/`, `tools/`, `migrations/`, `launchers/` and `bridges/` folders that the package does not carry, a file you put there included, one reported line per file, and then each folder there that is left empty. It writes its own namespaced slots, then
211
211
  refreshes the other npm core members so a returning `init` leaves **no stale core member**:
212
212
 
213
213
  | Path | What |
@@ -269,7 +269,8 @@ file), or run the guarded `/agent-workflow-kit uninstall`.
269
269
  | `/agent-workflow-kit bridge-settings` | opt-in, any time | **host-level bridge settings** — read or change the bridges' `KEY=VALUE` config file (`${XDG_CONFIG_HOME:-~/.config}/agent-workflow/bridge-settings.conf`), the **one place a knob survives kit upgrades** (it lives outside every kit tree; a refresh never touches it, and now states loudly if it ever overwrote a local edit). The **model each bridge runs**: `CODEX_MODEL` + `CODEX_EFFORT` (default `gpt-6.1-sol` at `high`) and `AGY_MODEL` (default `Gemini 3.8 Flash (High)`) — the read-out shows the models each installed CLI offers, and a set one is checked against that list before anything is written. Other knobs: the **codex Fast tier** (`CODEX_SERVICE_TIER=priority` — "2x speed, **increased usage**" in the catalog's own words, quality-neutral, default off — a consented spend), the codex/agy hard timeouts, the codex review byte cap, and `AGY_REVIEW_MAX_TOTAL_BYTES` (the ceiling on what an oversized agy code review may feed before it refuses pre-spend). `AGY_REVIEW_ALLOW_ADDDIR` is a **retired** compatibility key: still recognized so an existing line never warns as unknown, but it arms nothing — the writer refuses to set it and `--unset` clears it. Allowed keys + value rules come from the bundled bridge manifests. **Previews by default**; refuses an unknown key, an out-of-range value, a model or effort the catalog does not offer, or a duplicate-carrying file; writes atomically (symlink/TOCTOU-safe). Never commits, never runs a model (only the read-only catalog commands). |
270
270
  | `/agent-workflow-kit autonomy-doctor` | opt-in, any time | **guarded sandbox provisioner "doctor"** — can this machine run the Claude sandbox, and (only with your consent) fix it: macOS Seatbelt built-in / Linux+WSL2 needs `bwrap`+`socat` / native Windows → WSL2. Flagless = **FS-only preview** (the diagnosis, the exact absolute-path command it WOULD run, the exact `--apply <pm>:<pkgs>` consent tuple — runs nothing, never claims ready); `--verify` runs the unprivileged proof (a `bwrap` user-namespace smoke + `socat -V`) — the **only** source of a Linux "ready (verified)" claim; `--apply <pm>:<pkgs>` is the consent-gated privileged install (the tuple must equal the previewed plan; everything executed resolves to absolute paths inside `/usr/bin:/bin:/usr/sbin:/sbin`; the exact command is re-printed immediately before execution), then verifies. Honest loud degrades (unknown PM, untrusted location, nested-sandbox INDETERMINATE, root-unproven) and a stated restart step. Sits **outside every velocity auto-approve tier**; never auto-runs, never writes repo files, never commits. |
271
271
 
272
- It **never auto-commits** and **never overwrites** an existing `AGENTS.md` without asking.
272
+ It **never auto-commits** and **never overwrites** an existing `AGENTS.md` without asking (its kit
273
+ block aside, which is written current on every run).
273
274
 
274
275
  > **Two kinds of "upgrade":** `npx @sabaiway/agent-workflow-kit@latest init` updates the **kit's
275
276
  > own files** in `~/.claude/skills/`; `/agent-workflow-kit upgrade` then migrates a **project's**
@@ -309,11 +310,18 @@ agent-workflow-kit — the composition root (installed via npx … init)
309
310
 
310
311
  - **Delegates** substrate deployment to **`@sabaiway/agent-workflow-memory`** when a healthy
311
312
  standalone copy is present, else uses its **bundled fallback** — same `docs/ai/` either way.
312
- - **Injects** three bounded pointers into the deployed `AGENTS.md` — the workflow **methodology**, the
313
- **orchestration recipes** (Solo / Reviewed / Council / Delegated / Subagent), and the **autonomy policy** (the
314
- `docs/ai/autonomy.json` read contract) — read **live** from the installed
313
+ - **Writes** one **kit block** into the deployed `AGENTS.md`, between the
314
+ `<!-- workflow:kit:start -->` and `<!-- workflow:kit:end -->` comment lines, current on every run
315
+ with no question and no copy kept — the read order, the workflow **methodology**, the
316
+ **orchestration recipes** (Solo / Reviewed / Council / Delegated / Subagent), the **autonomy
317
+ policy** (the `docs/ai/autonomy.json` read contract), and a table of the rules themes
318
+ (`docs/ai/rules/effective/<theme>.md`); the engine texts are read **live** from the installed
315
319
  **`agent-workflow-engine`** (the canonical narrative; a published member, never one of the shipped
316
- backends). `/agent-workflow-kit recipes` surfaces + plans a recipe for your environment, read-only.
320
+ backends). Text of your own goes outside the two `workflow:kit` comment lines; a change to a kit
321
+ rule goes in its theme's file under `docs/ai/rules/local/`. `docs/ai/agent_rules.md` is yours:
322
+ the kit lays it only where it is absent, and apart from the one-time `5.0.0` step, which removes the kit's old
323
+ sections from it, never reads or writes it. `/agent-workflow-kit recipes` surfaces + plans a recipe
324
+ for your environment, read-only.
317
325
  - **Detects & (opt-in) sets up** the optional `codex` / `agy` **bridges** — agent skills (not npm;
318
326
  never first placed by `init` — `setup` places them, and once placed `init`/`upgrade` refresh
319
327
  them). They plug into the workflow's **execute** and **review** phases — for *what
@@ -360,7 +368,7 @@ agent-workflow-kit/
360
368
  ├── tools/ ← family tooling:
361
369
  │ ├── manifest/ ← capability-manifest schema + validator
362
370
  │ ├── delegation.mjs ← detect substrate · delegate-or-fall-back
363
- │ ├── inject-methodology.mjs ← write the methodology + recipe slots
371
+ │ ├── inject-methodology.mjs ← write the AGENTS.md kit block
364
372
  │ ├── engine-source.mjs ← live engine fragment read (fail-loud)
365
373
  │ ├── detect-backends.mjs ← read-only backend detector
366
374
  │ ├── recipes.mjs ← read-only recipe planner (recipes)
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: '19.5.0'
6
+ version: '20.0.1'
7
7
  ---
8
8
 
9
9
  # agent-workflow-kit
@@ -20,7 +20,7 @@ This kit is the **composition root** of the `agent-workflow` family. The memory
20
20
  (`docs/ai/`, the entry-point doc, caps / archive / index, the setup contracts) is owned by
21
21
  **`agent-workflow-memory`**. The kit **prefers to delegate** substrate deployment to that skill
22
22
  when it is present and healthy, and otherwise uses its **own bundled copy** (`references/`,
23
- `migrations/`) — the one-command install stays **dependency-free**. (The methodology slot is a separate axis: its fragment is read **live from the
23
+ `migrations/`) — the one-command install stays **dependency-free**. (The kit block in `AGENTS.md` is a separate axis: its engine texts are read **live from the
24
24
  installed `agent-workflow-engine`**, which `npx @sabaiway/agent-workflow-kit@latest init` installs;
25
25
  see `${CLAUDE_SKILL_DIR}/references/shared/composition-handoff.md`.)
26
26
  `init` also **refreshes the installed memory substrate** (best-effort — a miss is a loud DEGRADED
@@ -51,7 +51,7 @@ made: a partial/broken memory install discovered mid-flow must not disable the w
51
51
  > returns who writes what, which stamps end up present, and that the commit gate is kit-only. Both
52
52
  > are unit-tested — the contract below is pinned by code.
53
53
 
54
- **Hand-off contract & bounded pointer reconciliation** — `${CLAUDE_SKILL_DIR}/references/shared/composition-handoff.md` (read at the bootstrap/upgrade point of use).
54
+ **Hand-off contract & the kit block** — `${CLAUDE_SKILL_DIR}/references/shared/composition-handoff.md` (read at the bootstrap/upgrade point of use).
55
55
 
56
56
  **One composition-level commit gate.** The delegated memory mode performs **no** commit and
57
57
  raises **no** "ask to commit". There is exactly **one** gate, owned by the kit, **after**
@@ -71,14 +71,14 @@ Pick the mode from the user's invocation — the mapping is pinned by `tools/com
71
71
  Before acting, read `docs/ai/.workflow-version` (the project's stamp) — via the host's file-read tool, else ONE plain undecorated command (no compounds/redirects/pipes) — to decide the route — an **internal** routing decision, **not** a line you print (version display: *Version disclosure* in `${CLAUDE_SKILL_DIR}/references/shared/report-footer.md`). Route:
72
72
 
73
73
  - **absent** → bootstrap (a fresh deployment).
74
- - **stamp < `4.0.0`** (the deployment-lineage head) → `upgrade`.
75
- - **stamp == `4.0.0`** → already current; only the stamp-independent reconciles may run — the FULL set lives in `${CLAUDE_SKILL_DIR}/references/modes/upgrade.md` step 3; run step 3 (never enumerate the reconciles from memory).
74
+ - **stamp < `5.0.0`** (the deployment-lineage head) → `upgrade`.
75
+ - **stamp == `5.0.0`** → already current; only the stamp-independent reconciles may run — the FULL set lives in `${CLAUDE_SKILL_DIR}/references/modes/upgrade.md` step 3; run step 3 (never enumerate the reconciles from memory).
76
76
  - **stamp > head / unparseable** → STOP — never-downgrade gate (see `${CLAUDE_SKILL_DIR}/references/modes/upgrade.md` step 2).
77
77
  - **Exempt:** `autonomy-doctor` provisions the OS, not the deployment — stamp-independent (stated in its mode file).
78
78
 
79
79
  **Two independent version axes — never conflate them:**
80
80
 
81
- 1. **Project deployment** — `docs/ai/.workflow-version` vs the lineage head (`4.0.0`). This is the **only** axis this skill compares.
81
+ 1. **Project deployment** — `docs/ai/.workflow-version` vs the lineage head (`5.0.0`). This is the **only** axis this skill compares.
82
82
  2. **Kit freshness** — this skill's own files vs the published npm package. That is the **npx installer's** job: `npx @sabaiway/agent-workflow-kit@latest init` (it refuses a stale-cache downgrade by comparing the version on disk — **no network**). This skill never checks npm, and the package version is **not** the lineage head.
83
83
 
84
84
  **Refreshed the kit but nothing changed?** After the npx installer updates `~/.claude/skills/agent-workflow-kit/`, **restart the session** so the agent reloads the new skill files.
package/bin/install.mjs CHANGED
@@ -293,7 +293,7 @@ Installs/refreshes the kit at ~/.claude/skills/agent-workflow-kit
293
293
  stays /agent-workflow-kit setup, opt-in); once placed, init refreshes them from the kit's
294
294
  own bundled copies — local files only, never a downgrade — and --no-bridges skips that
295
295
  refresh. init never deletes your project settings; in an existing kit home it removes each
296
- file in its folders that the package does not carry, one line each. If the
296
+ file in its folders that the package does not carry and each folder left empty. If the
297
297
  installed kit is newer than the version you ran, init refuses (no network — it compares
298
298
  the version on disk) and points you at @latest; --allow-downgrade overrides that
299
299
  refusal (distinct from --force, which is launcher-only).
package/capability.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "agent-workflow-kit",
5
5
  "kind": "composition-root",
6
- "version": "19.5.0",
6
+ "version": "20.0.1",
7
7
  "provides": [],
8
8
  "roles": {},
9
9
  "detect": {
@@ -30,15 +30,13 @@ translated either. This migration changes *one* doc block, nothing else.
30
30
  names and re-run apply once. A second withheld result stops the migration.
31
31
  Any other named refusal on stderr stops the migration; relay it as worded before any stamp update.
32
32
  The upgrade's step 7 runs this same command with the answers its step-6 prompt collected.
33
- 5. The writer refuses with `cap` rather than push `AGENTS.md` past its 100-line budget.
34
- Relay that refusal, trim `AGENTS.md`, then re-run the upgrade; do not translate existing contents.
33
+ 5. Do **not** translate existing contents.
35
34
 
36
35
  ## Verification
37
36
 
38
37
  - `AGENTS.md` has exactly one `## 🗣️ Communication language` block, with a real language in
39
38
  place of `<their language>` (no leftover `{{COMM_LANGUAGE}}` placeholder).
40
- - The docs cap-validator is still green (`node scripts/check-docs-size.mjs` for Node projects)
41
- — the entry point did not bust its line budget.
39
+ - The docs cap-validator is still green (`node scripts/check-docs-size.mjs` for Node projects).
42
40
  - From now on the agent's replies are in the chosen language; paths/commands/identifiers
43
41
  remain in their source language.
44
42
 
@@ -36,9 +36,7 @@ keeps it permanently via PR refs — so the safe default is "no mention anywhere
36
36
  key kept. An existing "includeCoAuthoredBy": false already converges the item unless an
37
37
  "attribution" key sets a commit or PR text.
38
38
  - For other tools, disable their equivalent co-author / footer setting if present.
39
- 6. The writer refuses with `cap` rather than push `AGENTS.md` past its 100-line budget;
40
- trim the entry point and re-run the upgrade. Do **not**
41
- retroactively rewrite existing git history here — that is a separate, deliberate operation.
39
+ 6. Do **not** retroactively rewrite existing git history here — that is a separate, deliberate operation.
42
40
 
43
41
  ## Verification
44
42
 
@@ -0,0 +1,30 @@
1
+ # Migration 5.0.0-kit-text-in-kit-files
2
+
3
+ **From:** versions < 5.0.0 **To:** 5.0.0
4
+
5
+ ## Why
6
+
7
+ The kit's standing text now lives in kit files and in one kit block in `AGENTS.md`, which this
8
+ upgrade's step 3 already wrote together with the rules themes under `docs/ai/rules/`. The old
9
+ copies in the project's own `AGENTS.md` and `docs/ai/agent_rules.md`, found by the kit's old
10
+ landmarks, are removed once, each whole with any text a project wrote inside it. Anything the
11
+ script does not find stays as the project's text under the block's precedence line.
12
+
13
+ ## Steps
14
+
15
+ 1. Run `node <installed-kit>/tools/transition/index.mjs --cwd <project>` and relay every line it
16
+ prints. Exit 0 is a completed run, removals or none. A non-zero exit is a named refusal: relay
17
+ its line with the recovery it names, and the upgrade STOPs before the finalizer and the stamp, so
18
+ the next upgrade applies this note again. The refusal `replacement-missing` names its recovery:
19
+ a re-run of the upgrade, or the engine refresh `npx @sabaiway/agent-workflow-engine@latest init`
20
+ and then the upgrade again.
21
+ 2. **Re-stamp:** the upgrade re-stamps `docs/ai/.workflow-version` to 5.0.0.
22
+
23
+ ## Verification
24
+
25
+ A second run of the same command prints only `unchanged:` lines and exits 0.
26
+
27
+ ## Rollback
28
+
29
+ Restore `AGENTS.md` and `docs/ai/agent_rules.md` from the project's version control; the kit keeps
30
+ no copy of what it removed.
@@ -15,13 +15,13 @@ releases add files/templates, which `upgrade` reconciles without a migration.
15
15
  The upgrade must relay those stdout lines verbatim and apply exactly the listed notes.
16
16
  A named refusal stops the upgrade, except `stamp-absent`, which routes it back to the upgrade's step 1.
17
17
  3. Apply them in the order the tool listed them (**ascending semver order**).
18
- 4. Re-stamp `docs/ai/.workflow-version` to the **deployment-lineage head** (`4.0.0` today — the
18
+ 4. Re-stamp `docs/ai/.workflow-version` to the **deployment-lineage head** (`5.0.0` today — the
19
19
  shared lineage, **not** this skill's npm package version). A stamp greater than the head → STOP.
20
20
 
21
21
  ## Authoring rules
22
22
 
23
23
  - **Idempotent** — safe to re-run; check before mutating (e.g. "if the file already has X, skip").
24
- - **Non-destructive** — never clobber project-authored content (their `decisions.md`, `known_issues.md`, page specs). Add/rename/restructure only what the kernel owns.
24
+ - **Non-destructive** — never clobber project-authored content (their `decisions.md`, `known_issues.md`, page specs). Add/rename/restructure only what the kernel owns. A lineage note may remove what it finds by the kit's old landmarks whole, whatever a project wrote inside it, as its Why states.
25
25
  - **Self-contained** — exact paths + commands, readable cold, like a mini-plan.
26
26
  - **Mention rollback** — note how to undo if the step is risky.
27
27
  - **Template blocks** — a note never pastes entry-point block text; `tools/migration-blocks.mjs` places it from the kit's template.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabaiway/agent-workflow-kit",
3
- "version": "19.5.0",
3
+ "version": "20.0.1",
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",
@@ -46,7 +46,7 @@
46
46
  | worktrees-dir | harness | velocity-profile.mjs |
47
47
  | worktrees-dir.home | user | user step |
48
48
  | spec-adoption | chat | ensure-configs.mjs |
49
- | profile-gap | chat | rules-insert.mjs, tier-preview.mjs, checker-gates.mjs |
49
+ | profile-gap | chat | tier-preview.mjs, checker-gates.mjs |
50
50
  | jev-connect | user | user step |
51
51
  | jev-skill | harness | jev-skill.mjs |
52
52
  | jev-skill.not-current | kit | jev-skill.mjs |
@@ -104,13 +104,11 @@ files (the five the kit bundles for `.claude/agents/` — `changelog-skeleton.md
104
104
  by the next upgrade with no question and no copy kept.
105
105
  Also the kit's: the vendor skill copy the kit installs into the three agent skill roots
106
106
  when it matches a pin the kit shipped, written with no question beside a copy at a kit pin;
107
- a copy matching none is the user's, left and named. Also the kit's: the three kit sections of
108
- `docs/ai/agent_rules.md` (Communication, Story sessions and the planning/review lens), each
109
- written current on every upgrade with no question and no copy kept. Also the kit's: the three pointers of `AGENTS.md`
110
- and its Memory Map rows of the rules themes, each written current on every upgrade with no question and no copy kept.
107
+ a copy matching none is the user's, left and named. Also the kit's: the kit block of `AGENTS.md`, between its two
108
+ `workflow:kit` comment lines, written current on every upgrade with no question and no copy kept.
111
109
  Also the kit's: the onboarding note of `docs/ai/orchestration.json`, its `_README` key, written current on every
112
- upgrade with no question and no copy kept, every recipe kept; a note of your own goes in `AGENTS.md`, outside the
113
- two `<!-- workflow: -->` comment lines around the orchestration pointer.
110
+ upgrade with no question and no copy kept, every recipe kept; a note of your own goes in AGENTS.md, outside the kit
111
+ block's two workflow:kit comment lines.
114
112
  A declaration seeded once from a template and never
115
113
  replaced by the upgrade's ensures (a migration rewrites one only on the user's explicit yes) is the
116
114
  user's own file. A customization goes into one of nine channels instead:
@@ -124,11 +122,11 @@ user's own file. A customization goes into one of nine channels instead:
124
122
  - **A vehicle of your own** goes in `.claude/agents/<name>.local.md` with a `name:` of its own, which
125
123
  no review roster names; a lens of your own in a review slot keeps a stem of its own.
126
124
  - **A hook of your own** goes in `.claude/hooks/<name>.local.mjs`, which you wire.
127
- - **Your own text in the agent rules file**: text of your own goes under a ### heading of its own,
128
- titled unlike the kit's sections.
129
- - **Your own text in the entry file `AGENTS.md`**: text of your own goes outside the two
130
- `<!-- workflow: -->` comment lines around each pointer; a row of your own goes on a line of its
131
- own, its first cell a path of your own.
125
+ - **Your own agent rules** go in the whole of `docs/ai/agent_rules.md`, the project's own rules file: the kit lays
126
+ it only where it is absent, and apart from the one-time `5.0.0` step, which removes the kit's old sections from it,
127
+ never reads or writes it.
128
+ - **Your own text in the entry file `AGENTS.md`**: text of your own goes outside the two workflow:kit comment
129
+ lines; a change to a kit rule goes in its theme's file under docs/ai/rules/local/.
132
130
 
133
131
  No path segment of a file the kit bundles and places as its own has a dot-separated part exactly
134
132
  `local`; a path of that form is the user's, and no kit tool writes one on its own. Outside that rule:
@@ -38,11 +38,9 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/report-footer.md · ${CLAUDE_SKI
38
38
  10. **Stamp the deployment lineage.** In both paths, delegated and fallback, **first lay down the
39
39
  project rules** — `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --only rules --cwd <project>`,
40
40
  relaying its line — **then re-run the step-7 navigator finalizer**
41
- (`--ensure-index`) whenever a later step touched `docs/ai` — the rules run and the reconciles that follow the
42
- template copy do (the agent-rules lens,
43
- `${CLAUDE_SKILL_DIR}/references/shared/composition-handoff.md`); it is idempotent, so an
41
+ (`--ensure-index`) whenever a later step touched `docs/ai` — the rules run does; it is idempotent, so an
44
42
  untouched tree simply reports `already-current`. Then write the **deployment-lineage head** into
45
- `docs/ai/.workflow-version` (one semver line). The lineage head is **`4.0.0`** — the shared
43
+ `docs/ai/.workflow-version` (one semver line). The lineage head is **`5.0.0`** — the shared
46
44
  `agent-workflow` deployment lineage, **NOT** this kit's npm package version (see
47
45
  `package.json` / `CHANGELOG.md`). The two are
48
46
  independent axes: a packaging-only release bumps the package but leaves the lineage head until a
@@ -24,7 +24,7 @@ The opt-in **gate-approval PreToolUse hook** — the family's third `.claude/` w
24
24
 
25
25
  **The read-lane (opt-in, AD-055 Part II).** The toggle lives in `docs/ai/lanes.json` — a **SEPARATE kit-owned strict-JSON file** (`{ "readLane": true }`); `docs/ai/gates.json`, both its validators and the byte-mirrored template are **untouched** (the gates schema has no lane/model/routing fields — that claim stays true). The hook reads `lanes.json` LIVE per call, **fail-closed**: an absent / malformed / non-object file, or a `readLane` that is not the boolean `true`, leaves the lane dark (gate auto-approval and the residual ask are unaffected). `lanes.json` becomes a **privileged file** exactly like `gates.json` — an auto-approved read chain runs **unattended** and can read any file you can (the same trust boundary as the audited read-only core velocity seeds, extended to compounds (and singles) of that core; **prompt-bypass only, never a sandbox bypass**). Enable it with `--read-lane` (below), which runs a **currency check** first: it refuses unless the PLACED hook is byte-identical to the current bundle — a **pre-1.48 hook never reads `lanes.json`**, so enabling the lane against a stale placed copy would be a silent no-op the user paid consent for. The stale-hook silent-blackout class is dead **by construction** (an old hook merely lacks the rung; nothing existing changes behavior); the currency refusal names `gate-hook --apply --cwd <root>`, which writes the placed hook with the kit's body in place.
26
26
 
27
- **Version-status routing** like the other writer modes (stamp head `4.0.0`; `--apply` enforces it in code).
27
+ **Version-status routing** like the other writer modes (stamp head `5.0.0`; `--apply` enforces it in code).
28
28
 
29
29
  Run `node ${CLAUDE_SKILL_DIR}/tools/gate-hook.mjs [--dry-run | --apply] [--cwd <dir>]`:
30
30
 
@@ -43,6 +43,6 @@ Run **`node ${CLAUDE_SKILL_DIR}/tools/procedures.mjs <activity> [--override <slo
43
43
 
44
44
  **Record-bound review block (`feedback-triage` only).** In place of the driving contracts and the grounding pre-step the advisor renders the check-with-excerpts line, then one line per review member — a ready bridge's plan-mode command, a ready lens's brief (the record plus the excerpts), a skipped line for a not-ready member — and the round-table line while the slot carries a bridge obligation (a roster naming no bridge: the no-receipt fact in its place; a fully degraded reviewed or council slot keeps the line). The round-table line is followed by the standing fact that the table judges the obligation `review-rounds-cli` resolves from `docs/ai/orchestration.json`, never this run's `--override`. `--json` carries the identical lines under **`feedbackTriage`** (an empty array for the other activities).
45
45
 
46
- **Cap-soft-skip degradation (the feature's only AUTO route).** The activity procedures are auto-discoverable only through the one-line **`workflow:methodology`** pointer (this kit + the engine carry `disable-model-invocation:true`, so NL like "write a plan" does **not** auto-load this skill). On a deployment whose methodology pointer could not fit the line cap, the procedures are still reachable by **explicitly** invoking `/agent-workflow-kit procedures`; surface that plainly rather than treating it as a gap.
46
+ **Discovery (the feature's only AUTO route).** The activity procedures are auto-discoverable only through the methodology text of the kit block in `AGENTS.md` (this kit + the engine carry `disable-model-invocation:true`, so NL like "write a plan" does **not** auto-load this skill). On a deployment whose kit block is not written yet, the procedures are still reachable by **explicitly** invoking `/agent-workflow-kit procedures`; surface that plainly rather than treating it as a gap.
47
47
 
48
48
  **Invariants:** read-only · never writes · never commits · never runs a subscription CLI · the deterministic resolution is the kit's, the recipe execution is the orchestrator's.
@@ -46,7 +46,7 @@ A variant's posture note, where its key has one, is printed by `init` from this
46
46
  - `mcp-channel` — the offer is to REGISTER the kit's read-only stdio MCP server in this project on the harness lane: a registration is a command your MCP client will RUN. The agent applies it on the chat yes after the check; `init` previews the exact entry and applies it on the terminal y as the route the user may take instead. What the registration buys: path questions and literal searches become typed tool calls whose arguments are named JSON fields instead of a string handed to a shell, so a pipe, a redirect or a quote inside a pattern or a path stays DATA and is never interpreted. Posture: the server is a **read-only child of your client** (path/type/size/line facts and literal search over this project root; no write and no exec API), and like the client itself it runs **outside the Bash sandbox** — the sandbox is not what bounds it, the server's own root containment is. The two allow rules it adds make those two tools promptless and nothing else. The **`.differing`** arm is also a harness item: an `agent-workflow` entry already stands in `.mcp.json` and **structurally differs** from what this kit copy would write (another kit copy, a hand-edited path, an added `env`; the comparison ignores key order, so re-serialized identical bytes are the same registration). The check shows the entry standing in `.mcp.json` and the entry it would write; the chat yes confirms the replacement. `init` previews `mcp --replace` and replaces only on the terminal y. Stated limit: this item does **not** detect a `disabledMcpjsonServers` veto, so a converged `mcp-channel` means *what the mode writes is in place*, not *the client will load it* — see `${CLAUDE_SKILL_DIR}/references/modes/mcp.md`. Risk profile: a new read-only channel your client will launch; no write or exec exposure; a differing registration is replaced only on the checked chat yes or the terminal y and every other declaration is kept.
47
47
  - ADDITIONAL `gates-inert` arms (the third outcomes) — two further arms, and they differ in whether anything is BROKEN. **`producer-unrecognized`** — a checker with no producer anywhere in the declaration, on a tracked tree the changed-line coverage domain cannot reach (`.ts`/`.tsx`/`.jsx`/`.mts`/`.cts` strictly outnumber `.mjs`/`.cjs`/`.js`): the dead pair is real, so this arm is a user item, the user's own step, and the two remedies are marking the real producer with `"lcovProducer": true` or dropping the checker. Never a `node --test` prescription, the fill preview or an acknowledgement — a dead pair is broken, not narrow. **`coverage-domain-narrow`** — the producer/checker pair IS live and the tree is still dominated by what the domain excludes: nothing is broken, and the honest sentence is that certification covers the assessable minority. Its apply is the consent-gated **ack writer** preview (a NEUTRAL fingerprint into `docs/ai/acks.json` as `coverageDomainAck`, never a security key); after the SAME confirmation you run the `--apply` it prints. The fingerprint binds the FACT — the verdict plus the unsupported extensions present, never the file counts — so an acknowledged project stays quiet as it grows and re-fires when a new unsupported language arrives or the verdict flips. The census reads the TRACKED tree with a read-only `git ls-files`; a tree it cannot read (a non-git deployment) becomes a stated skip. Risk profile: no enforcement change of any kind — one acknowledgement recorded in a family-owned file, and one edit that is the user's own step.
48
48
  - `spec-adoption` — the feature-spec layer's ADOPTION STATE, judged from `docs/ai/specs/` alone through the same census `spec-check --all` runs, so a store the checker would refuse to observe is never counted here either. Both arms are OFFERS (`optional`) — the layer is opt-in, and `attention` stays reserved for a configured declaration that is broken. **`not-adopted`** (no store): every plan then cites zero governing specs by default and nothing says adoption never started; its apply is the spec-layer ensure one-liner (`ensure-configs --reconcile --only specs`, the same seed `upgrade` runs — it seeds the reader/checker pairs and the store root, and skips with a stated reason where no Node evidence exists), and its `recipe:` line carries the decline alternative — the DECLINE preview (`ack-write --lane spec-adoption`, a dry-run that prints the exact `--apply`), which records `specAdoptionAck` in the family-owned `docs/ai/acks.json`. **The two are exclusive, and the order is part of the contract:** ask which the user wants, apart, BEFORE the confirmation; on "seed" run the apply; on "decline" the agent records it — the preview line, then on that same answer its printed `--apply`; never run the seed after a decline, nor the decline after the seed. **`adopting`** (a store with no live contract): an optional item naming the draft count; its apply is that same decline preview (a dry-run; after the SAME confirmation you run the `--apply` it prints), and the honest remedy is authoring a contract from the skill's `SPEC_TEMPLATE.md`. A recorded decline silences BOTH arms and shows on `status` as ` — declined`; one live contract makes the decline moot. An unreadable store is a stated skip, never `flow optimal`. Risk profile: the seed writes create-only files under `scripts/` and `docs/ai/specs/` and refreshes a script body a release shipped; it writes an edited spec-layer file with the bundled body with no question, its line naming where an edit meant to last goes; the decline writes one key into the ack store; nothing here authors a spec or blocks a plan.
49
- - `profile-gap` — each item's apply is a PREVIEW that writes nothing, and consent takes two steps: the confirmed pick runs the preview and you relay every line it prints (the environment-resolved slot values, each checker `entry:` line with its trust-chain disclosure, a Communication region the insert plans in the same run); the same line with ` --apply` appended runs only on a SECOND yes over those lines, never carried by the first. Items whose apply lines are byte-equal are one writer and take one answer: the tier preview's `--apply` writes the absent slots, the store seed and the queue seed together; the checker verb writes only its own entries; the insert writes every region it plans, all or nothing, so a `communication-absent` skip beside a declined `story-sessions-section` gets its own ask after the insert's full preview. A no records nothing and the item stays on the screen. A DECLINE is asked apart from later, before anything runs, and runs `node ${CLAUDE_SKILL_DIR}/tools/tier-preview.mjs --decline --cwd <project-root>` only when the user refuses EVERY item the tier preview then reports offered: it records each of them at the shipped lineage, and a declined item leaves the screen until a lineage step changes the profile. An undecidable entry is a stated skip naming its reason, the remedy by reason: a prior or any other body → the upgrade's `lens` reconcile, which writes the region current or names the line cap that refused the write; an absent region → the insert. Risk profile: the tier preview's `--apply` rewrites `docs/ai/orchestration.json` in canonical form with the `_README` note and creates `docs/ai/epics/.gitkeep` and `docs/plans/queue.md` create-only; the insert adds regions to `docs/ai/agent_rules.md`; the checker verb adds entries to the PRIVILEGED `docs/ai/gates.json`; the decline writes `docs/ai/profile-declines.json`; nothing here commits.
49
+ - `profile-gap` — each item's apply is a PREVIEW that writes nothing, and consent takes two steps: the confirmed pick runs the preview and you relay every line it prints (the environment-resolved slot values, each checker `entry:` line with its trust-chain disclosure); the same line with ` --apply` appended runs only on a SECOND yes over those lines, never carried by the first. Items whose apply lines are byte-equal are one writer and take one answer: the tier preview's `--apply` writes the absent slots, the store seed and the queue seed together; the checker verb writes only its own entries. A no records nothing and the item stays on the screen. A DECLINE is asked apart from later, before anything runs, and runs `node ${CLAUDE_SKILL_DIR}/tools/tier-preview.mjs --decline --cwd <project-root>` only when the user refuses EVERY item the tier preview then reports offered: it records each of them at the shipped lineage, and a declined item leaves the screen until a lineage step changes the profile. An undecidable entry is a stated skip naming its reason. Risk profile: the tier preview's `--apply` rewrites `docs/ai/orchestration.json` in canonical form with the `_README` note and creates `docs/ai/epics/.gitkeep` and `docs/plans/queue.md` create-only; the checker verb adds entries to the PRIVILEGED `docs/ai/gates.json`; the decline writes `docs/ai/profile-declines.json`; nothing here commits.
50
50
  - `jev-connect` — the lane is user and env-dependent: the connect command is the user's own step in a terminal of their own, where it asks for the key; the key never reaches the agent or the chat (the command refuses without a terminal, and a terminal is not consent). When the recipe line opens with `run the apply in <place>`, that place is the terminal to run it in; `init`, run there, offers the command on its own consent line. The command reads the key with no echo, makes one network call to api.typesafe.ai with the vendor's sample text only on the user's own run, and writes the key in plain text — as managed export lines in the shell's startup files (bash: ~/.bashrc and the login file, created as ~/.bash_profile when none exists; zsh: ~/.zshrc), as the kit's own file ~/.config/fish/conf.d/typesafe-api-key.fish for fish, or on Windows as the user environment variable TYPESAFE_API_KEY, stored in the Windows user environment; a process already running at the save can keep its old environment and hand it to what it starts — the guide's key mark confirms the agent sees it (a file is readable by any process running as that user, and by other local accounts when one is world-readable in a traversable home); the vendor keeps data under its processing agreement and offers zero retention only to enterprise accounts. The item reads the environment the agent's commands run in: a host setting that filters it shows the item while the key is set in the user's shell. The decline alternative rides the recipe line, asked apart BEFORE the confirmation (the `spec-adoption` order): on "connect" hand over the apply line; on "decline" the agent records it — the recipe line's preview, then its printed `--apply` — per project as `jevConnectAck` in `docs/ai/acks.json`. Risk profile: a plain-text key in the user's startup files or the Windows user environment, written by a command the user runs; one network call from that run.
51
51
  - `jev-skill` — two arms, both env-dependent. The offer `jev-skill`, lane harness, shows once `TYPESAFE_API_KEY` is set and no decline is recorded, while no skill root holds a copy at a kit pin and a root the kit fills is absent: the agent applies it on the chat yes after the check, showing the files it would write; it changes no harness setting. `init` applies it on the batch terminal yes as the route the user may take instead. When the recipe line opens with `run the apply in <place>`, that place is where a user who prefers their own terminal runs it. The kit item `jev-skill.not-current`, lane kit, shows beside a copy at a kit pin in any root: the kit route applies it with no question, writing every root absent or behind the kit's pin. The skill is third-party text — the vendor's, MIT — that the kit ships pinned and installs as a verified copy into three agent skill roots: `~/.agents/skills`, the Claude Code skills dir (`CLAUDE_CONFIG_DIR` or `~/.claude`) and `~/.gemini/config/skills`. The copy is written current with no question beside a copy at a kit pin; a foreign copy is left untouched and named on the recipe line. A copy the vendor's `skills` CLI wrote with the same bytes reads current, accepts the component and is written at a later pin like a kit copy; a vendor plugin install is invisible to the file check, so the Claude Code root may read absent while the plugin serves it. Only when the user asks to see the plan does the agent run the command without `--apply` (a read-only dry run). The decline alternative rides the offer's recipe line, asked apart BEFORE the confirmation: on "install" run the check line and, on the yes given on its result, the apply line by the consent route; on "decline" the agent records it — the recipe line's preview, then its printed `--apply` — per project as `jevSkillAck` in `docs/ai/acks.json`. Risk profile: third-party text written into the user's agent skill roots by the kit's skill command; no network.
52
52
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Requires: ${CLAUDE_SKILL_DIR}/references/shared/command-shapes.md
6
6
 
7
- **The one place the user changes the project rules.** Each theme (the first is project layout) has three files under `docs/ai/rules/`: the kit file `docs/ai/rules/<theme>.md`, which only the kit writes; the user's local file `docs/ai/rules/local/<theme>.md`, which wins where it differs; and the effective file `docs/ai/rules/effective/<theme>.md`, which agents read. This mode writes the local file on the user's request and yes, and keeps the effective file and its record current with the kit's own tools. It never commits.
7
+ **The one place the user changes the project rules.** Each theme (project layout, communication, story sessions and lens) has three files under `docs/ai/rules/`: the kit file `docs/ai/rules/<theme>.md`, which only the kit writes; the user's local file `docs/ai/rules/local/<theme>.md`, which wins where it differs; and the effective file `docs/ai/rules/effective/<theme>.md`, which agents read. This mode writes the local file on the user's request and yes, and keeps the effective file and its record current with the kit's own tools. It never commits.
8
8
 
9
9
  **1. Start with the ensure.** Run `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --only rules --cwd <project>` and relay its line in plain words. The effective file is built, never written by hand: this mode moves no edit out of it, and the ensure's rebuild or the next merge replaces one.
10
10
 
@@ -12,12 +12,13 @@ Requires: ${CLAUDE_SKILL_DIR}/references/shared/command-shapes.md
12
12
 
13
13
  - **Change a rule.** The user says in plain words what to change. Show the exact text you will write to `docs/ai/rules/local/<theme>.md`, its frontmatter included, holding only the user's own rules and never a copy of the kit's, and write it on the user's yes. That request and that yes are the consent for the write of the local file.
14
14
  - **Drop the local rules.** On the user's request, delete the local file; the next ensure rebuilds the effective file from the kit file and records it.
15
- - **Change a number.** A request to change a number, a limit's value or its tolerance, is never written into a rules file: the rules are prose and carry no numbers; the kit keeps its numbers in its code, and a project's own number is a reasoned override in the size check's config. Show the exact `node ${CLAUDE_SKILL_DIR}/tools/source-size-check.mjs --override <id> [--value <n>] [--tolerance <p>] --reason "<text>" --cwd <project>` command, passing only the numbers the user named (an option left out keeps the limit's current value or tolerance; `files-per-root` takes `--tolerance` only), with `--kit-default` in their place to return to the kit's numbers; run it on the user's yes and relay its lines. This route ends there: it runs no ensure, merge, record or closing check.
15
+ - **An engine-homed theme waits for its engine.** For an engine-homed theme (`lens`, whose template the installed engine ships), run the ensure `--only rules` before you write or drop its local file; when its line for the theme says no installed engine supplies it, relay that line and stop with `npx @sabaiway/agent-workflow-engine@latest init`, writing and dropping no local file.
16
+ - **Change a size limit.** A request to change a limit of the size check, its value or its tolerance, is never written into a rules file: the kit keeps those numbers in its code, and a project's own value is a reasoned override in the size check's config. Show the exact `node ${CLAUDE_SKILL_DIR}/tools/source-size-check.mjs --override <id> [--value <n>] [--tolerance <p>] --reason "<text>" --cwd <project>` command, passing only the numbers the user named (an option left out keeps the limit's current value or tolerance; `files-per-root` takes `--tolerance` only), with `--kit-default` in their place to return to the kit's numbers; run it on the user's yes and relay its lines. This route ends there: it runs no ensure, merge, record or closing check.
16
17
 
17
18
  **3. After each of the two rules routes, run the ensure again.** On `pending`, do the merge its line states, show the user what changed in the final rules, then run the record command the line prints with the sha256 of the merged file (one plain command for the digest, per the shared command-shapes contract).
18
19
 
19
20
  **It stops on a refusal.** When an ensure run answers `failed`, the record command exits non-zero, or the `--override` command exits non-zero, relay the line and stop: write, delete and record nothing further, and run no closing check as if the change held.
20
21
 
21
- **4. End with the checks.** Run `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --only index --cwd <project>`, then `node ${CLAUDE_SKILL_DIR}/tools/project-rules/rules-cli.mjs --check --cwd <project>`, which answers `current` for every theme; relay both in plain words.
22
+ **4. End with the checks.** Run `node ${CLAUDE_SKILL_DIR}/tools/ensure-configs.mjs --reconcile --only index --cwd <project>`, then `node ${CLAUDE_SKILL_DIR}/tools/project-rules/rules-cli.mjs --check --cwd <project>`, which answers `current` for every theme, or `absent` for an engine-homed theme no installed engine supplies; relay both in plain words.
22
23
 
23
24
  **What it never does.** It never writes the effective file except with the merge a `pending` line states, never changes the kit file's text, and never writes a local file without the user's request.