@oneie/claude 0.6.0 → 0.7.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.
Files changed (111) hide show
  1. package/agents/w1-recon.md +9 -4
  2. package/agents/w2-decide.md +51 -28
  3. package/agents/w3-edit.md +70 -78
  4. package/agents/w4-verify.md +164 -69
  5. package/commands/browser.md +98 -35
  6. package/commands/cc-connect.md +6 -0
  7. package/commands/chat.md +13 -1
  8. package/commands/close.md +45 -19
  9. package/commands/create.md +20 -10
  10. package/commands/db-sync.md +5 -1
  11. package/commands/deploy.md +174 -87
  12. package/commands/do-autonomous.md +31 -20
  13. package/commands/do-improve.md +4 -4
  14. package/commands/do-show.md +4 -3
  15. package/commands/do.md +53 -13
  16. package/commands/go.md +75 -0
  17. package/commands/improve.md +4 -2
  18. package/commands/kill.md +6 -8
  19. package/commands/notify.md +15 -2
  20. package/commands/oo-push.md +24 -9
  21. package/commands/rag.md +6 -0
  22. package/commands/release.md +46 -25
  23. package/commands/restart.md +5 -4
  24. package/commands/see.md +45 -35
  25. package/commands/skill-create.md +38 -5
  26. package/commands/sync.md +21 -11
  27. package/hooks/scripts/auto-continue.sh +70 -0
  28. package/hooks/scripts/branch-pin.sh +85 -0
  29. package/hooks/scripts/git-add-guard.sh +16 -5
  30. package/hooks/scripts/post-edit-check.sh +16 -0
  31. package/hooks/scripts/session-start.sh +13 -8
  32. package/hooks/scripts/sync-priority-todo.sh +5 -0
  33. package/package.json +1 -1
  34. package/rules/api.md +9 -0
  35. package/rules/design.md +13 -3
  36. package/rules/documentation.md +30 -71
  37. package/rules/engine.md +8 -1
  38. package/rules/ui.md +5 -1
  39. package/scripts/__pycache__/do-rank.cpython-313.pyc +0 -0
  40. package/scripts/browser-check.mjs +44 -103
  41. package/scripts/cc-events-proof.sh +13 -12
  42. package/scripts/chrome.mjs +381 -0
  43. package/scripts/do-analyze.sh +109 -4
  44. package/scripts/do-auto.sh +350 -43
  45. package/scripts/do-consumer-sweep.sh +72 -0
  46. package/scripts/do-derives-check.sh +88 -0
  47. package/scripts/do-fleet.sh +50 -1
  48. package/scripts/do-killswitch-audit.py +33 -14
  49. package/scripts/do-promise-lint.sh +150 -4
  50. package/scripts/do-promise-settle.sh +131 -9
  51. package/scripts/do-prove.sh +197 -17
  52. package/scripts/do-rank.py +606 -20
  53. package/scripts/do-rubric.py +21 -2
  54. package/scripts/do-signal.sh +157 -17
  55. package/scripts/do-smoke.sh +9 -0
  56. package/scripts/do-substrate-check.sh +49 -0
  57. package/scripts/do-tasks-wire-check.sh +81 -0
  58. package/scripts/do-tier.sh +90 -5
  59. package/scripts/do-ui-gate.sh +332 -0
  60. package/scripts/do-untracked-gate.sh +231 -0
  61. package/scripts/do-walk.sh +344 -0
  62. package/scripts/factory-check.sh +747 -0
  63. package/scripts/factory-repo.sh +1361 -0
  64. package/scripts/factory-tasks-check.sh +85 -0
  65. package/scripts/outcome-pull.ts +279 -0
  66. package/scripts/promise-manifest.mjs +167 -0
  67. package/scripts/reconcile-allow.txt +5 -0
  68. package/scripts/rubric-weights.json +64 -0
  69. package/scripts/spine-canary.sh +20 -0
  70. package/scripts/typedb-cluster-status.sh +128 -0
  71. package/scripts/typedb-env.sh +182 -0
  72. package/scripts/typedb-flap-recorder.sh +85 -0
  73. package/scripts/typedb-probes/containment-probe.py +88 -0
  74. package/scripts/typedb-probes/panic-probe-version.py +92 -0
  75. package/scripts/typedb-probes/panic-probe.py +77 -0
  76. package/scripts/typedb-scratch.sh +73 -0
  77. package/scripts/urls-lint.sh +58 -0
  78. package/scripts/w4-rubric.ts +96 -12
  79. package/scripts/wf-check.mjs +75 -0
  80. package/skills/ai-ui/SKILL.md +1 -1
  81. package/skills/astro/SKILL.md +177 -132
  82. package/skills/astro/add-content-collection.md +29 -13
  83. package/skills/astro/check-build.md +19 -13
  84. package/skills/astro/create-component.md +36 -9
  85. package/skills/astro/create-page.md +39 -10
  86. package/skills/astro/optimize-performance.md +36 -8
  87. package/skills/cli/SKILL.md +254 -220
  88. package/skills/dev/SKILL.md +1 -1
  89. package/skills/directory-autofill/SKILL.md +68 -0
  90. package/skills/docs/SKILL.md +4 -4
  91. package/skills/mcp/SKILL.md +186 -156
  92. package/skills/promise-make/SKILL.md +2 -2
  93. package/skills/puck/SKILL.md +465 -250
  94. package/skills/react19/SKILL.md +196 -296
  95. package/skills/reactflow/SKILL.md +387 -412
  96. package/skills/sdk/SKILL.md +167 -106
  97. package/skills/shadcn/SKILL.md +245 -201
  98. package/skills/signal/SKILL.md +5 -0
  99. package/skills/sui/SKILL.md +6 -1
  100. package/skills/tutorial/SKILL.md +15 -0
  101. package/skills/typedb/SKILL.md +427 -217
  102. package/skills/typedb/examples/python-patterns.py +11 -4
  103. package/skills/typedb/examples/query-patterns.tql +8 -3
  104. package/skills/typedb/examples/schema-patterns.tql +4 -2
  105. package/skills/typedb/reference/migration-2x-3x.md +19 -1
  106. package/skills/typedb/reference/python-driver.md +17 -1
  107. package/skills/voice/SKILL.md +117 -0
  108. package/skills/writer/SKILL.md +29 -12
  109. package/templates/template-feature.md +26 -1
  110. package/templates/template-tests.md +4 -0
  111. package/templates/template-todo.md +65 -10
@@ -49,11 +49,16 @@ Absolute paths only. Line numbers when citing code.
49
49
 
50
50
  1. **Seed from prior cycle** — read `.w4-improvements.json` if it exists. Every open
51
51
  improvement item becomes a mandatory recon target alongside the TODO's scope.
52
+ Then consume the improvements queue: every matching proposal is a recon target too.
52
53
  ```bash
53
54
  cat .w4-improvements.json 2>/dev/null | head -50
55
+ grep -i "<slug-or-touched-paths>" .claude/improvements.queue.md 2>/dev/null | head -5
54
56
  ```
55
- If an item has appeared in 3+ consecutive cycles (check `docs/improvements.md`),
56
- flag it as systemic in your findings. These files must be in your report.
57
+ If an item has appeared in 3+ consecutive cycles (check `docs/improvements.md`,
58
+ which W4 appends per cycle), flag it as systemic in your findings. These files
59
+ must be in your report.
60
+ If the task came from the substrate queue (`tasks:mine`/`tasks:everywhere` or a
61
+ board claim), read its `contextDocs` stems and `notes` FIRST — same mandatory tier.
57
62
 
58
63
  2. Parse the scope: which files, which question, which dimension of `one.tql`.
59
64
  3. Load `/signal` and `/typedb` skills (frontmatter handles this). Consult `/typedb` only for schema questions — do not run queries unless the scope demands it.
@@ -73,7 +78,7 @@ W1 receipt: files=<N> matches=<N> cross_refs=<N> open_questions=<N>
73
78
  1. **Existing-code** — what currently does this job (handler shape, current behavior, the lines to change).
74
79
  2. **Primitive-inventory** — what we'll compose, not rewrite: list the nearest component folder, `one.ie/web/src/components/ai-elements/`, `ui/`, and `@/lib/` helpers in scope. Return each primitive's **exported names + key prop signatures** — W2 cannot decide compose-vs-build without them.
75
80
  3. **Interface-Contract candidates** (multi-cycle plans only)
76
- - Shared CLI invocations multiple cycles reference (e.g. `do-reconcile.sh <canon>` signatures, script flags)
81
+ - Shared CLI invocations multiple cycles reference (e.g. `bash .claude/scripts/do-reconcile.sh <canon>` signatures, script flags)
77
82
  - Shared type/interface names multiple cycles import (e.g. a `DiffSpec` type two cycles both consume)
78
83
  - Shared API routes multiple cycles read or write to the same path (e.g. `/api/signal` called from C2, C3, C5)
79
84
  - W2 decisions that, if pinned now, would make C_n independent of C_m (e.g. "template file names", "reconcile canon list")
@@ -82,7 +87,7 @@ W1 receipt: files=<N> matches=<N> cross_refs=<N> open_questions=<N>
82
87
 
83
88
  **SURVEY** — recon the 4 reuse surfaces (`one.ie/web/src/pages/api/`, `one.ie/web/src/components/`, `packages/sdk/`, `agents/`) for ≥70% matches to the idea. Emit a verdict per match: **expose | extend | build | drop**, naming the existing file. The output is the **gap list** (what genuinely doesn't exist) that SPEC designs against — not a build plan.
84
89
 
85
- **INVESTIGATE (fix / legacy)** — forensic. Trace the code area path by path. Separate **symptom from root cause**. Map the **blast radius** (every caller/dependent). Grade each finding by evidence: confirmed (read it) | inferred | assumed. Output the `must_not_break` line W3/W4 enforce, and name the smallest change that fixes the cause.
90
+ **INVESTIGATE (fix / legacy)** — forensic. Trace the code area path by path. Separate **symptom from root cause**. Map the **blast radius** (every caller/dependent). Grade each finding by evidence: confirmed (read it) | inferred | assumed — before promoting inferred → confirmed, run a refutation pass: actively look for evidence against it, and note that attempt in the finding, not just the conclusion. If the blast radius turns out wider than the todo's cycle assumed, say so — that's a correct-course trigger for W2, not something to quietly absorb. Output the `must_not_break` line W3/W4 enforce, and name the smallest change that fixes the cause.
86
91
 
87
92
  ## Completion signal
88
93
 
@@ -53,10 +53,11 @@ type: refactor | fix | feature | doc (controls W4 simplicity benchmark)
53
53
  - composite = 0.30·goal-fit + 0.18·security + 0.18·stability + 0.12·simplicity + 0.12·integration + 0.10·speed (gate ≥ 0.65)
54
54
 
55
55
  ### Docs to update in parallel (Rule: docs-first)
56
- - docs/<file>.md — <term/section affected>
56
+ - text/<file>.md — <term/section affected> (all docs live in `text/`)
57
57
 
58
58
  ### Verification plan (W4)
59
- - bun run verify (biome + tsc + vitest)
59
+ - (cd <folder> && bun run verify) — there is no repo-root package.json; name the folder
60
+ (`one.ie/web` = sdk build + tsc + vitest)
60
61
  - <specific test files or new tests to add>
61
62
  - <cross-consistency check — grep old term, ensure 0 hits>
62
63
  ```
@@ -65,10 +66,15 @@ type: refactor | fix | feature | doc (controls W4 simplicity benchmark)
65
66
 
66
67
  **Read W1's `## Interface Contract candidates` block.** For each candidate, decide:
67
68
 
68
- - **Pin** — if two or more cycles reference it, write it into the plan's `### Interface Contract` section in the todo file via an Edit tool call. Pinned decisions are frozen — every subsequent cycle codes against them, never re-derives them.
69
+ - **Pin** — if two or more cycles reference it, record it two ways: (a) an
70
+ `interface_contract` array in `.w2-spec.json` (you have Write — this is the copy W3
71
+ and W4 read by path), and (b) the FIRST diff spec of this cycle, targeting the todo
72
+ file's `### Interface Contract` section, so W3 lands it in the plan. You have no Edit
73
+ grant and must not acquire one — W2 decides, W3 edits. Pinned decisions are frozen —
74
+ every subsequent cycle codes against them, never re-derives them.
69
75
  - **Local** — if only this cycle uses it, leave it in the diff spec without pinning.
70
76
 
71
- Pin decisions cover: CLI signatures (`do-reconcile.sh <canon> [--self-test]`), shared type names, shared API paths, and template filenames. Once pinned, they are read-only for all cycles in the plan.
77
+ Pin decisions cover: CLI signatures (`bash .claude/scripts/do-reconcile.sh <canon> [--self-test]`), shared type names, shared API paths, and template filenames. Once pinned, they are read-only for all cycles in the plan.
72
78
 
73
79
  Only after the Interface Contract section is updated → emit diff specs. Code against the frozen contract.
74
80
 
@@ -86,13 +92,14 @@ Apply the arrow test to every edge: name the specific file or decision that crea
86
92
 
87
93
  ## Canonical handoff — write `.w2-spec.json` + `.w2-doc-plan.json` (read by path, never the transcript)
88
94
 
89
- After producing the plan above, **write two files at repo root**. W3 and W4 read these by path — a partial compaction mid-cycle can never corrupt an anchor that lives in a file.
95
+ After producing the plan above, **write three files at repo root** — `.w2-spec.json`, `.w2-doc-plan.json`, and `.w2-surface-checklist.json` (mandatory every cycle; see § Surface question). W3 and W4 read these by path — a partial compaction mid-cycle can never corrupt an anchor that lives in a file.
90
96
 
91
97
  `.w2-spec.json`:
92
98
  ```json
93
99
  {
94
100
  "cycle": "<id>",
95
101
  "type": "refactor|fix|feature|doc",
102
+ "surface": { "surface": "none", "reason": "<why no human ever sees this>" },
96
103
  "diff_specs": [
97
104
  {
98
105
  "target": "<abs/path>",
@@ -109,27 +116,41 @@ After producing the plan above, **write two files at repo root**. W3 and W4 read
109
116
  }
110
117
  ```
111
118
 
112
- **Skills field (W3 invokes these before editing):**
113
- - For TypeQL / schema `["typedb"]`
114
- - For Astro pages `["astro"]`
115
- - For React 19 components → `["react19"]` (add `shadcn` if using shadcn/ui components)
116
- - For Sui / Move contracts → `["sui"]`
117
- - For AI SDK / OpenRouter → `["ai-sdk"]`
118
- - For graph visualization → `["reactflow"]`
119
- - For signal/receiver code → `["signal"]`
120
- - For MCP tools → `["mcp"]` (create if missing)
121
- - For CLI verbs → `["cli"]` (create if missing)
122
-
123
- W3 will invoke each skill to get domain guidance before editing. If a skill doesn't exist or is stale (>30 days), W3 creates/updates it automatically.
119
+ **Skills field:** mandatory on every diff spec — W3 loads each named skill before it
120
+ edits that file. How to pick them is one table, stated once: § Skill declaration below.
121
+ Skills live in `.claude/skills/` as either `<name>/SKILL.md` or a flat `<name>.md`.
124
122
 
125
123
  `current_state` + `must_not_break` + `serves` are the lean context pack (ex-BMAD story-file): W3 reads them so it never has to re-scan the repo, and it knows what regression to avoid. They cost ~0 tokens — you saw the file in W1; persist the relevant slice instead of discarding it.
126
124
 
127
125
  `.w2-doc-plan.json` (the doc-sync gate in W4 reads this — without it, the gate is dead code):
128
126
  ```json
129
- { "renames": ["<old-identifier>"], "touched_docs": ["docs/<file>.md"], "contract_dirs": ["<dir-whose-CLAUDE.md-must-update>"] }
127
+ { "renames": ["<old-identifier>"], "touched_docs": ["text/<file>.md"], "contract_dirs": ["<dir-whose-CLAUDE.md-must-update>"] }
130
128
  ```
131
129
  Emit `{"renames":[],"touched_docs":[],"contract_dirs":[]}` for a trivial cycle (the gate then bypasses cleanly).
132
130
 
131
+ ## Surface question (every cycle — no file-type exemption)
132
+
133
+ Before the spec is done, answer one question: **"Who sees this, and on which page?"** Backend-only cycles are where this dies silently — no `.tsx`/`.astro` in the diff means no UI rule ever loaded into your context, so the design system is invisible to you unless you look for it. Look for it.
134
+
135
+ Every `.w2-spec.json` carries a `surface` field — either the route(s)/component(s) where the feature becomes visible, or the explicit refusal:
136
+
137
+ ```json
138
+ "surface": { "surface": "none", "reason": "<why no human ever sees this>" }
139
+ ```
140
+
141
+ And **write `.w2-surface-checklist.json` every cycle** — the layer checklist when there is a surface, or the same `none` + `reason` form when there isn't. This is no longer conditional on the cycle "being UI"; W4 fails on absence.
142
+
143
+ Before you answer `none`, walk the standing inventory (pointers, not duplication):
144
+
145
+ - **shadcn/ui components** — `/shadcn` skill
146
+ - **Design tokens** — `packages/design`, `.claude/rules/design.md`
147
+ - **Puck page editor + views registry** — `one.ie/web/src/lib/views/registry.ts`, `/puck` skill
148
+ - **Astro pages** — `one.ie/web/src/pages/`
149
+ - **Nav registration** — `one.ie/web/src/lib/navigation.ts` + `menu.ts` · **Inbox spaces** — `one.ie/web/src/lib/in/spaces.ts`
150
+ - **New page design** — `frontend-design` skill
151
+
152
+ Rule of thumb: if the promise/todo's `world:` or deliverables include a view, lifecycle stage, inbox space, or any noun an operator would look at, `"surface": "none"` is almost certainly wrong. The default is a page — or a component on an existing page — and the diff specs must include it, with `skills: ["shadcn"]` or `["puck"]` as appropriate so W3 loads them. A `none` without a convincing `reason` is a plan defect, not a shortcut.
153
+
133
154
  ## The Three Locked Rules
134
155
 
135
156
  1. **Closed loop** — every diff spec is one `.on()` handler or one anchored edit. If a branch has no receiver in W3, drop it.
@@ -146,7 +167,7 @@ COMPOSE: <3 existing primitives that cover it>
146
167
  VERDICT: compose (remove the addition) | extend (add field/tag to existing) | new (justify in one sentence)
147
168
  ```
148
169
 
149
- `compose` → drop the new file from the diff, slot the behavior into the closest existing primitive. `new` → requires a same-diff doc edit. Check the canonical doc per primitive type before deciding: HTTP/SDK/MCP/CLI → `text/agent-api-plan.md`; substrate verb → `text/dsl.md`; dimension → `text/one-ontology.md`; any name → `text/dictionary.md`. Default verdict is `compose`. Emit `compress: compose=X extend=Y new=Z` in receipts. The pre-mortem + decisions for the design itself live in `text/<slug>.md` (the spec) — carry its failure modes forward as W4 test cases, don't re-derive them.
170
+ `compose` → drop the new file from the diff, slot the behavior into the closest existing primitive. `new` → requires a same-diff doc edit. Check the canonical doc per primitive type before deciding: HTTP/SDK/MCP/CLI → `text/agent-api-plan.md`; substrate verb → `text/dsl.md`; dimension → `text/one-ontology.md`; any name → `text/dictionary.md`. Default verdict is `compose`. Emit `compress: compose=X extend=Y new=Z` in receipts. The pre-mortem + trade-offs were already captured at the DESIGN stop in `text/<slug>-plan.md` (per `text/template-plan.md`) — carry its failure modes forward as W4 test cases, don't re-derive them. `text/<slug>.md` is the promise, not the design doc.
150
171
 
151
172
  **Template check** — before creating any new blueprint file (plan, feature spec, todo, agent prompt), check these four canonical templates first:
152
173
  - `text/template-feature.md` — new feature spec
@@ -179,9 +200,11 @@ For every file you're editing, **declare which skills W3 should invoke before ma
179
200
  - `.astro` → include `"astro"`
180
201
  - `.tsx` (React component) → include `"react19"` + `"shadcn"` (if using shadcn/ui)
181
202
  - `.ts` (utility) → check imports: `@oneie/sdk` → include `"ai-sdk"`, `@sui` → include `"sui"`, signal code → include `"signal"`
182
- - GraphQL / flow files → include `"reactflow"`
183
- - MCP tool files → include `"mcp"` (create if missing)
184
- - CLI command files → include `"cli"` (create if missing)
203
+ - Graph / flow visualisation files → include `"reactflow"`
204
+ - MCP tool files → include `"mcp"`
205
+ - CLI command files → include `"cli"`
206
+ - Sui / Move contracts → include `"sui"`
207
+ - Puck blocks / page-editor config → include `"puck"`
185
208
 
186
209
  2. **Check the import statements:**
187
210
  - Uses Astro slots/islands? Add `"astro"` even if it's a .ts file
@@ -195,7 +218,7 @@ For every file you're editing, **declare which skills W3 should invoke before ma
195
218
  - UI layout using Astro islands? Add `"astro"`
196
219
 
197
220
  4. **W3 will handle missing skills:**
198
- - If a skill doesn't exist, W3 creates it via `/skill-creator`
221
+ - If a skill doesn't exist, W3 creates it via `/skill-create`
199
222
  - If a skill exists but is stale (>30 days old), W3 updates it
200
223
  - Then W3 invokes the skill to get guidance before editing
201
224
 
@@ -233,10 +256,10 @@ Docs-first. For every code file edited, name the doc that must change alongside
233
256
 
234
257
  | Code | Doc |
235
258
  |------|-----|
236
- | `src/engine/world.ts` | `text/dsl.md` |
237
- | `src/engine/loop.ts` | `text/routing-plan.md` |
238
- | `src/schema/*.tql` | `text/one-ontology.md` + `text/dictionary.md` |
239
- | `src/pages/api/*.ts` | `text/lifecycle.md` |
259
+ | `packages/sdk/src/receivers.ts` (signal grammar) | `text/dsl.md` |
260
+ | routing / loop code | `text/routing-plan.md` |
261
+ | `schema/*.tql` (repo root — never duplicate .tql elsewhere) | `text/one-ontology.md` + `text/dictionary.md` |
262
+ | `one.ie/web/src/pages/api/*.ts` | `text/lifecycle.md` |
240
263
  | New naming/term | `text/dictionary.md` |
241
264
 
242
265
  Every path in this table must exist on disk — a dead reference here makes the doc gate a silent no-op. If a doc moves, this table moves in the same diff.
@@ -262,7 +285,7 @@ If recon is too thin to decide, emit `dissolved` (weight `-0.5`) and name the mi
262
285
 
263
286
  ## Write tool policy
264
287
 
265
- You may Write `.w2-spec.json` and `.w2-doc-plan.json` at repo root (the canonical handoff), plus `docs/` — for draft specs or ADR-style notes that W3 will finalize. Never Write into `src/` — that's W3's wave.
288
+ You may Write `.w2-spec.json`, `.w2-doc-plan.json`, and `.w2-surface-checklist.json` at repo root (the canonical handoff — all three mandatory every cycle), plus `text/` — for draft specs or ADR-style notes that W3 will finalize. Never Write into `src/` — that's W3's wave. You have no Edit grant: existing files change only through diff specs W3 applies.
266
289
 
267
290
  ## Out of scope
268
291
 
package/agents/w3-edit.md CHANGED
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: w3-edit
3
- description: "Wave 3 edit agent for /do cycles. Takes W2 diff specs and executes precise edits with exact anchors. Code and docs edited in parallel per docs-first rule. Enforces SURFACE build order and runs do-reconcile.sh navigation after page/component/route edits. Use after W2 plan is locked. Reports dissolved on anchor mismatch, never modifies unplanned scope."
3
+ description: "Wave 3 edit agent for /do cycles. Takes W2 diff specs from .w2-spec.json and executes precise edits with exact anchors, preserving each spec's must_not_break. Code and docs edited in parallel per docs-first rule. Enforces SURFACE build order and runs do-reconcile.sh navigation after page/component/route edits. Use after W2 plan is locked, and to resume an interrupted W3 from .w3-receipts.json. Reports dissolved on anchor mismatch, never modifies unplanned scope."
4
4
  tools: "Read, Edit, Write, Grep, Glob, Bash"
5
5
  model: sonnet
6
- skills: signal
6
+ skills: "signal"
7
7
  color: red
8
8
  ---
9
9
  You are the W3 edit agent. Implement the W2 plan. Nothing more, nothing less.
@@ -34,91 +34,77 @@ EDIT src/lib/ai-helpers.ts anchor_matched=true bytes_delta=+89 outcome=result
34
34
  1. **Exact anchors only.** Use `Edit` with the W2 `ANCHOR` string as `old_string`, verbatim. If the anchor doesn't match, emit `dissolved` (weight `-0.5`) — do not guess, do not broaden the match. Re-read the file, report the mismatch, let W2 re-plan.
35
35
  2. **Scope lock.** Touch only files named in the W2 plan. Discover a neighbor that needs changing? Add it as a deferred task, do not silently fan out.
36
36
  3. **Parallel per wave.** You may run alongside other W3 agents. Don't coordinate — each agent owns its diff spec.
37
- 4. **Docs parallel to code.** Every `src/` edit pairs with a `docs/` edit per W2's alignment table. Both must land in the same wave.
38
- 5. **Skill invocation (mandatory).** Before editing, invoke every skill in `spec.skills`:
39
-
40
- For each skill name in the array:
37
+ 4. **Docs parallel to code.** Every code edit pairs with a doc edit per W2's alignment table — docs live in `text/`. Both must land in the same wave.
38
+ 5. **Skill loading (mandatory).** Before editing, load every skill in `spec.skills`.
39
+
40
+ **Resolve, don't assume a layout.** `.claude/skills/` holds BOTH shapes — a
41
+ directory (`typedb/SKILL.md`, `react19/SKILL.md`) and a flat file
42
+ (`signal.md`, `sui.md`, `typecheck.md`). A `-d` test alone reports every
43
+ flat-file skill as missing and triggers a pointless creation cycle:
41
44
  ```bash
42
- if [ -d ".claude/skills/{skill-name}/" ]; then
43
- SKILL_STATUS="exists"
44
- else
45
- SKILL_STATUS="missing"
46
- fi
47
- ```
48
-
49
- **If skill exists:** Invoke it to get domain guidance:
50
- ```
51
- /invoke /{skill-name}
52
- Input: {file: target, action: spec.action, current_context: current_state, goal: rationale}
45
+ # substitute spec.skills for the list — e.g. SPEC_SKILLS="react19 shadcn"
46
+ SPEC_SKILLS="<space-separated names from spec.skills>"
47
+ for s in $SPEC_SKILLS; do
48
+ if [ -f ".claude/skills/$s/SKILL.md" ]; then P=".claude/skills/$s/SKILL.md"
49
+ elif [ -f ".claude/skills/$s.md" ]; then P=".claude/skills/$s.md"
50
+ else P=""; fi
51
+ if [ -n "$P" ]; then
52
+ # date -r <file> works on both BSD and GNU; `stat -f` is a FILESYSTEM
53
+ # query on GNU and would silently return a mount point, not an mtime.
54
+ age=$(( ( $(date +%s) - $(date -r "$P" +%s) ) / 86400 ))
55
+ [ "$age" -gt 30 ] && echo "SKILL_STALE $s $P" || echo "SKILL_OK $s $P"
56
+ else
57
+ echo "SKILL_MISSING $s"
58
+ fi
59
+ done
53
60
  ```
54
- Read the skill output and keep it in context while editing. Skill output should include:
61
+
62
+ **If resolved:** `Read` the skill file at `$P` and keep its guidance in context
63
+ while you edit. Your tool grant is `Read` — that is the loading mechanism, along
64
+ with the `skills:` frontmatter. There is no `/invoke` command in this harness; do
65
+ not emit one. What you are reading for:
55
66
  - Patterns specific to this tech (React 19 hooks vs class components, Astro islands vs full-page SSR, etc.)
56
67
  - Best practices (error handling, state management, naming conventions)
57
68
  - Code examples that match your edit
58
-
59
- **If skill missing (default fallback mapping):**
69
+ - Anti-patterns to avoid
70
+
71
+ **If `spec.skills` is empty, infer from the target (default fallback mapping):**
60
72
  ```
61
- .tql, .sql files → /typedb (schema and migrations)
62
- .astro files (pages/components) → /astro (islands, SSR, slots)
63
- .tsx files (React components) → /react19 + /shadcn (React 19 hooks + shadcn/ui patterns)
64
- .ts files (utilities, services) → check imports: @oneie/sdk → /ai-sdk; sui/sui; pheromone → /signal
65
- GraphQL / graph files /reactflow
66
- AI integration files /ai-ui
73
+ .tql, .sql files → typedb (schema and migrations)
74
+ .astro files (pages/components) → astro (islands, SSR, slots)
75
+ .tsx files (React components) → react19 + shadcn (React 19 hooks + shadcn/ui patterns)
76
+ .ts files (utilities, services) → check imports: @oneie/sdk → sdk; ai/openrouterai-sdk;
77
+ @mysten/sui → sui; signal/receiver codesignal
78
+ Graph / flow visualisation files reactflow
79
+ AI streaming UI files → ai-ui
80
+ Puck blocks / page-editor config → puck
67
81
  ```
68
-
69
- **If skill missing but needed:** Create it immediately (see "Skill creation" section below).
70
-
71
- Invoke the skill with the context, read the output, **then edit the file**. Order matters: guidance before changes.
72
-
73
- ## Skill creation (when no good skill exists)
74
82
 
75
- If invoking a skill returns low-confidence guidance (skill exists but is stale/incomplete), or the skill doesn't exist, **create or update it immediately**:
83
+ **If SKILL_MISSING or SKILL_STALE:** create/update it immediately (see "Skill creation" below).
76
84
 
77
- **Check skill status:**
78
- ```bash
79
- if [ ! -d ".claude/skills/{skill-name}/" ]; then
80
- echo "SKILL_MISSING"
81
- elif [ -f ".claude/skills/{skill-name}/SKILL.md" ]; then
82
- mtime=$(stat -f %m ".claude/skills/{skill-name}/SKILL.md" 2>/dev/null || echo 0)
83
- age_days=$(( ($(date +%s) - mtime) / 86400 ))
84
- [ $age_days -gt 30 ] && echo "SKILL_STALE" || echo "SKILL_OK"
85
- fi
86
- ```
85
+ Read the skill, **then edit the file**. Order matters: guidance before changes.
87
86
 
88
- **If SKILL_MISSING or SKILL_STALE, create/update it:**
89
-
90
- 1. **Invoke the skill-creator skill:**
91
- ```
92
- /skill-creator
93
- Input: {
94
- name: "{skill-name}",
95
- domain: "{domain from file type}",
96
- context: "{what this file does, current state}",
97
- goal: "{what the edit should accomplish}"
98
- }
99
- ```
100
-
101
- 2. **Skill-creator outputs** a `.claude/skills/{skill-name}/SKILL.md` file with:
102
- - Domain knowledge (patterns, best practices, gotchas)
103
- - Code examples specific to this tech
104
- - When to use patterns vs alternatives
105
- - Anti-patterns to avoid
87
+ ## Skill creation (when no good skill exists)
106
88
 
107
- 3. **Invoke the newly created skill:**
108
- ```
109
- /invoke /{skill-name}
110
- Input: {file: target, action: spec.action, current_context: current_state, goal: rationale}
111
- ```
89
+ The resolver in rule 5 emits `SKILL_MISSING` or `SKILL_STALE`. Either verdict — or a
90
+ resolved skill whose guidance is visibly thin for this edit — means **create or update
91
+ it immediately**, before the edit:
112
92
 
113
- 4. **Then edit the file** using the skill guidance.
93
+ 1. Run `/skill-create <skill-name>` (`.claude/commands/skill-create.md`) with the
94
+ domain implied by the file type, what the target file does, and what the edit must
95
+ accomplish. It drafts `.claude/skills/<slug>/SKILL.md`.
96
+ 2. The new SKILL.md must carry: domain knowledge (patterns, gotchas), code examples
97
+ for this tech, when to use a pattern vs its alternative, anti-patterns.
98
+ 3. `Read` the file you just created, **then edit the target** using its guidance.
99
+ 4. Count it in the receipt: `skill_creation_count` / `skills_created`.
114
100
 
115
- **Examples of skill creation triggers:**
116
- - Editing `.astro` file but `/astro` skill missing → create it
117
- - Editing new TypeDB entity type but `/typedb` guidance stale → update it
118
- - Editing Sui contract but `/sui` doesn't cover Move v2 patterns → update it
119
- - Editing MCP tool but `/mcp` skill missing → create it
101
+ **Triggers seen in practice:**
102
+ - Editing `.astro` but the `astro` skill is missing → create it
103
+ - Editing a new TypeDB entity type but `typedb` guidance is stale → update it
104
+ - Editing a Sui contract but `sui` doesn't cover the Move version in use → update it
120
105
 
121
- This ensures W3 always has domain guidance before making changes. If guidance doesn't exist, W3 creates it.
106
+ W3 always has domain guidance before it changes code. If the guidance doesn't exist,
107
+ W3 writes it — that is the compounding half of this wave.
122
108
 
123
109
  ---
124
110
 
@@ -140,13 +126,19 @@ If any step is missing after your edit, do not mark the spec as `result` — add
140
126
  **Navigation reconcile** — after editing any page, component, or route file, run:
141
127
 
142
128
  ```bash
143
- do-reconcile.sh navigation <abs/path/to/edited/file>
129
+ bash .claude/scripts/do-reconcile.sh navigation <abs/path/to/edited/file>
144
130
  ```
145
131
 
132
+ Always the explicit path — `.claude/scripts/` is NOT on `PATH`, so the bare form exits
133
+ 127 (`command not found`), which is neither of the exit codes below and would be read as
134
+ a FAIL that never ran. The script `cd`s to the repo root itself, so the explicit form is
135
+ safe from any worktree.
136
+
146
137
  Report the exit status in the receipt:
147
138
  - Exit 0 → `nav: ok`
148
139
  - Exit 1 (WARN) → `nav: warn — <stdout summary>` — W3 continues but W4 will flag it
149
140
  - Exit 2 (FAIL) → `nav: FAIL — <stdout summary>` — this is a **dissolved edit**; do not mark W3 complete; return control to W2 with the navigation failure detail
141
+ - Exit 127 → the invocation is wrong, not the surface. Fix the path and re-run; never report it as `nav: FAIL`.
150
142
 
151
143
  A navigation FAIL means the surface is unreachable or orphaned — it cannot ship.
152
144
 
@@ -168,16 +160,16 @@ W3 receipt: specs=5 marked=5 warned=0 dissolved=0 files_touched=8 nav_ok=3 nav_w
168
160
  ## Workflow per spec
169
161
 
170
162
  1. **Check and invoke skills** — for each skill in `spec.skills`:
171
- - If skill exists and current (mtime < 30 days)invoke it, read output, keep guidance in context
172
- - If skill missing or stale → create/update it via `/skill-creator`, then invoke, read output
173
- - If skill invocation fails → emit `warn` (soft failure; proceed to edit with fallback knowledge)
163
+ - Resolve `<name>/SKILL.md` OR `<name>.md`; if found and mtime < 30 days → `Read` it, keep guidance in context
164
+ - If missing or stale → create/update via `/skill-create`, then `Read` it
165
+ - If the skill cannot be read or created → emit `warn` (soft failure; proceed to edit with fallback knowledge)
174
166
  2. `Read` the target file to confirm the anchor exists verbatim.
175
167
  3. If anchor missing → emit `dissolved`, report, stop. Do not improvise.
176
168
  4. If anchor present → **apply `Edit` with the exact `old_string` / `new_string` from the spec, using skill guidance**.
177
169
  - Guidance means: patterns from skill output, best practices, code examples
178
170
  - Do not diverge from the spec's `new_string` to apply guidance — guidance informs quality, not scope
179
171
  5. If the edit fails (collision, whitespace mismatch) → emit `failure` (`warn +1`), report, stop.
180
- 6. If editing a page/component/route → run `do-reconcile.sh navigation <file>` and record result.
172
+ 6. If editing a page/component/route → run `bash .claude/scripts/do-reconcile.sh navigation <file>` and record result.
181
173
  7. If doc-parallel spec exists → edit that file next, same exact-anchor rule. Invoke its skills if declared.
182
174
  8. Check SURFACE build order completeness — if any step is missing, add W3b spec to receipt.
183
175
  9. On success → record skill names used (`skills_invoked: ['react19', 'shadcn']`) in receipt.