@oneie/claude 0.3.2 → 0.5.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/commands/do.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # /do — idea to shipped (v2, lifecycle-first)
2
2
 
3
- **One command.** Type `/do "<an idea>"` and it walks the whole build lifecycle from wherever the idea is: it agrees a goal, then walks the artifact spine — promise spec todo → code → tests → proof → docs → release **writing whatever is missing, skipping whatever exists.** Point it at a bare idea and it writes everything. Point it at code with no tests or docs and it backfills just those.
3
+ **One command.** Type `/do "<an idea>"` and it walks the whole build lifecycle from wherever the idea is: it agrees a goal, then walks the artifact spine — **making each artifact true** — writing whatever is missing, skipping whatever exists. Point it at a bare idea and it writes everything. Point it at code with no tests or docs and it backfills just those.
4
+
5
+ For each artifact on the spine: `true(artifact) ≡ exists(artifact) ∧ reconciles(artifact, canon)`. Missing → write. Stale → rewrite. True → skip.
4
6
 
5
7
  The human owns one thing: the goal sentence. `/do` owns everything below it.
6
8
 
7
- > Narrative for humans: `text/000-do.md`. Per-stage template/skill/agent routing: `plans/templates.md`. This file is what `/do` executes.
9
+ > Narrative for humans: `text/do.md`. Per-stage template/skill/agent routing: `text/templates-plan.md`. This file is what `/do` executes.
8
10
 
9
11
  ---
10
12
 
@@ -21,7 +23,22 @@ Sonnet low | medium mechanical edit (low) · genuine restructure / prose (
21
23
  Opus high | xhigh architecture (high) · substrate / schema reconciliation (xhigh)
22
24
  ```
23
25
 
24
- Fan-out: independent agents in ONE message, capped by the plan's `parallel_budget`. Recon + verify fan wide (Haiku × N). Edits run one-per-file (Sonnet × N). Only the design decision (Opus) stays single — understanding is not delegable.
26
+ Fan-out: independent agents in ONE message, capped by the plan's `parallel_budget`. Recon + verify fan wide (Haiku × N). Edits run one-per-file (Sonnet × N). Only W2 stays single — understanding is not delegable, but it runs as a **spawned single Opus `w2-decide` agent**, not inline. The conductor/session model runs Sonnet; W2 stays Opus·high. W2 is in the spawn list (W1·**W2**·W3·W4-rubric); the "never delegated → run inline" constraint is replaced by "stays single — one Opus agent, never fanned."
27
+
28
+ ### The coherence ratchet
29
+
30
+ `reconciles` is not pass/fail in isolation — it is **monotonic**. A write may leave the system *more* coherent or equally coherent. Never less.
31
+
32
+ ```
33
+ types — zero new tsc errors (the original ratchet)
34
+ names — converge to the dictionary (no new synonym, no dead name)
35
+ primitives— net new ≤ 0 (compose 3 existing before adding 1)
36
+ schema — extend, never fork (one model, not two)
37
+ surfaces — reachable, never orphaned (registered + linked, never dangling)
38
+ docs — synced, never stale (no broken link, no lie)
39
+ ```
40
+
41
+ This is what *"every line makes the system stronger"* means mechanically: coherence is a gate the loop runs, not a hope. The ratchet can tighten the system; it can never loosen it.
25
42
 
26
43
  ### Fast & lean — the token economy (automatic, never a flag)
27
44
 
@@ -42,7 +59,7 @@ Comprehensive and fast are not in tension: the **tier decides which gates run**,
42
59
  | Write-once state | per cycle | `.w2-spec`/`.w3-receipts` read by path, never re-derived after compaction |
43
60
  | `cost:cycle` gradient | close | spend → pheromone; future SELECT routes toward cheap-and-effective paths |
44
61
 
45
- A cycle that runs **zero LLM calls** is a *good* cycle. The comprehensiveness lives in the gates (DoD, rubric, doc-sync, ANALYZE, PROVE); the tier decides how many of them you pay for.
62
+ A cycle that runs **zero LLM calls** is a *good* cycle. The comprehensiveness lives in the gates (DoD, rubric, RECONCILES, ANALYZE, PROVE); the tier decides how many of them you pay for.
46
63
 
47
64
  ### Maximize parallelism — read the graph, reject imaginary blockers
48
65
 
@@ -64,7 +81,7 @@ C2·C3·C4 are siblings → their W1/W2 run concurrently and their W3a edits mer
64
81
  **The only valid arrow.** `C_n → C_m` exists **only** when C_m reads a file C_n writes. Before drawing one, fill the blank or delete it:
65
82
  > `C_n → C_m because C_m imports/reads {exact file path} that C_n creates.`
66
83
 
67
- **Imaginary blockers — reject on sight** (full list in `plans/template-todo.md`): "same feature area" · "same folder" · "both touch the DB" (unless the *same* entity) · "logical/reading order" · "don't want too many agents at once" (`parallel_budget` already caps it) · "want to review C_n first" (policy, not a dependency) · "C_m depends on what we *learn* in C_n" (W2 learning ≠ a file dependency).
84
+ **Imaginary blockers — reject on sight** (full list in `text/template-todo.md`): "same feature area" · "same folder" · "both touch the DB" (unless the *same* entity) · "logical/reading order" · "don't want too many agents at once" (`parallel_budget` already caps it) · "want to review C_n first" (policy, not a dependency) · "C_m depends on what we *learn* in C_n" (W2 learning ≠ a file dependency).
68
85
 
69
86
  **Cross-cycle W3 batch (the big win).** A batch of 3 cycles with 8 + 6 + 4 independent edits = **18 `w3-edit` agents in ONE message**, not 3 sequential rounds. Only a named same-file collision serializes (→ W3b). Same rule for waves: W1 recon across all cycles in a batch is one Haiku spawn; W4 rubric is 5 Haiku × N cycles in one message — all capped by `parallel_budget`.
70
87
 
@@ -75,7 +92,7 @@ C2·C3·C4 are siblings → their W1/W2 run concurrently and their W3a edits mer
75
92
  | Input | Treat as | Entry |
76
93
  |---|---|---|
77
94
  | bare text (`"add usage billing"`) | **IDEA** (default) | walk the spine from the top |
78
- | `<slug>` or a `plans/*.md` path | existing work | resolve its slug; ≥2 incomplete cycles → auto context-isolated loop, else walk from the first gap inline |
95
+ | `<slug>` or a `text/*.md` path | existing work | resolve its slug; ≥2 incomplete cycles → auto context-isolated loop, else walk from the first gap inline |
79
96
  | `--wave N` | force one wave of a todo | BUILD engine |
80
97
  | `--next-cycle` | *(internal)* run one batch then exit — the loop's recursion guard, set by `do-auto.sh`; never typed by a human | BUILD engine |
81
98
  | `--auto` | *(legacy alias)* same as a bare multi-cycle `/do <slug>` — the loop is automatic now | BUILD engine, trust-aware |
@@ -97,40 +114,43 @@ Derive the **slug** from the idea: kebab-case, 2–4 words (`"add usage billing"
97
114
  The pruned spine by tier:
98
115
 
99
116
  ```
100
- PATCH code (edit + W4 verify gate; 0 spawns)
101
- FIX survey[investigate if legacy] → codetestsprove
102
- FEATURE promisesurveyspec ▸clarify → todo ▸analyze → codetestsproofdocsrelease
103
- SCHEMA = FEATURE + substrate reconcile at max
117
+ PATCH AIM → BUILD → VERIFY (edit + W4 verify gate; 0 spawns)
118
+ FIX AIMSURVEY [INVESTIGATE] → BUILDTESTPROVE → LEARN
119
+ FEATURE AIMPROMISESURVEY → DESIGN ▸clarify → PLAN ▸analyze → BUILDTESTVERIFYPROVETEACH → SHIP → LEARN
120
+ SCHEMA = FEATURE + Substrate reconcile at max
104
121
  ```
105
122
 
106
- `investigate` rides any tier when the work touches code we didn't just write — it's the "understand before you change" step, not a separate tier.
123
+ `INVESTIGATE` rides any tier when the work touches code we didn't just write — it's the "understand before you change" step, not a separate tier.
107
124
 
108
125
  ---
109
126
 
110
127
  ## Step 2 — Walk the artifact spine (presence-check · backfill · skip)
111
128
 
112
- For each **enabled** stop (per the pruned spine), in order: check if its artifact exists. **Exists → skip. Missing → write it with the owner below.** A stop whose artifact is present is a phase already done; resume is free, no `--from` flag.
129
+ For each **enabled** stop (per the pruned spine), in order: check if its artifact exists and reconciles with its canon. **True → skip. Missing or stale → write/rewrite with the owner below.**
113
130
 
114
131
  | Stop | Presence check | Missing → write with | Owner · model · effort |
115
132
  |---|---|---|---|
116
- | **promise** | `test -f text/<slug>.md` | `writer` skill + `text/template-frame.md` | sonnet · medium |
117
- | **survey** | `do-survey.sh` (4 surfaces) | reuse verdict (expose / extend / build / drop) → the gap list, not the whole idea, feeds the spec | `w1-recon`, `Explore` · haiku · low |
118
- | **investigate** *(fix / legacy only)* | code we didn't just write | forensic reconroot cause (not symptom) + blast radius + the `must_not_break` line | `w1-recon` · haiku→sonnet · medium |
119
- | **spec** | `test -f plans/<slug>.md` | Opus + `plans/template-spec.md` (designs the gap list; pre-mortem + decisions live in the template), then `do-reconcile.sh` | opus · high |
120
- | *CLARIFY* | spec has `## Clarifications` (FEATURE/SCHEMA) | ≤5 `AskUserQuestion`, written back into the spec | opus · high |
121
- | **todo** | `test -f plans/<slug>-todo.md` | `/create todo` + `plans/template-todo.md` | sonnet · medium |
122
- | *ANALYZE* | | `do-analyze.sh plans/<slug>-todo.md` CRITICAL exit 1 blocks BUILD | bash · none |
123
- | **code** | survey verdict = `build` (≥70% match `expose`/`extend` instead) | the BUILD engine (Step 3) | sonnet · low–medium |
124
- | **tests** | test file in the repo folder | test-first, one assertion per deliverable | sonnet · low |
125
- | **proof** | proof artifact captured | `do-prove.sh` (browser / curl / contract / sync) + `accessibility`; **promise-check** the shipped thing against `text/<slug>.md`. A multi-cycle plan already built on its own `do/<slug>` branch (worktree isolation — see Step 2); PROVE is the gate that branch must clear before a human merges it to trunk | sonnet · low |
126
- | **docs** | feature doc + runbook exist | `tutorial` + `writer` written against the *proven* behavior | sonnet · medium |
127
- | **release** | changelog / README row | `/release` + adoption signal | sonnet · low |
133
+ | **AIM** | goal + tier confirmed | `AskUserQuestion` (one) | |
134
+ | **PROMISE** | `test -f text/<slug>.md` | `writer` skill + `text/template-feature.md` | sonnet · medium |
135
+ | **SURVEY** | `do-survey.sh` (4 surfaces) | reuse verdict (expose / extend / build / drop) the gap list, not the whole idea, feeds the design | `w1-recon`, `Explore` · haiku · low |
136
+ | **INVESTIGATE** *(fix / legacy only)* | code we didn't just write | forensic recon root cause (not symptom) + blast radius + the `must_not_break` line | `w1-recon` · haiku→sonnet · medium |
137
+ | **DESIGN** | `test -f text/<slug>-plan.md` | Opus + `text/template-plan.md` (designs the gap list; pre-mortem + decisions live in the template), then `do-reconcile.sh substrate` + `do-reconcile.sh dictionary` | opus · high |
138
+ | *CLARIFY* | plan has `## Clarifications` (FEATURE/SCHEMA) | ≤5 `AskUserQuestion`, written back into the plan | opus · high |
139
+ | **PLAN** | `test -f text/<slug>-todo.md` | `/create todo` + `text/template-todo.md` | sonnet · medium |
140
+ | *ANALYZE* | | `do-analyze.sh text/<slug>-todo.md` CRITICAL exit 1 blocks BUILD | bash · none |
141
+ | **BUILD** | survey verdict = `build` (≥70% match → `expose`/`extend` instead) | the BUILD engine (Step 3) | sonnet · low–medium |
142
+ | **TEST** | test file in the repo folder | test-first, one assertion per deliverable | sonnet · low |
143
+ | **VERIFY** | rubric + ratchet pass | `do-reconcile.sh <canon>` per category + rubric composite 0.65 | haiku · medium |
144
+ | **PROVE** | proof artifact captured | `do-prove.sh` (browser / curl / contract / sync) + `accessibility`; the shipped thing checked against `text/<slug>.md`. A multi-cycle plan already built on its own `do/<slug>` branch (worktree isolation — see context isolation below); PROVE is the gate that branch must clear before a human merges it to trunk | sonnet · low |
145
+ | **TEACH** | feature doc + runbook exist | `tutorial` + `writer` — written against the *proven* behavior | sonnet · medium |
146
+ | **SHIP** | changelog / README row | `/release` + adoption signal | sonnet · low |
147
+ | **LEARN** | learnings entry written | close: learnings + cost signal + trust write | — |
128
148
 
129
149
  **Proof before docs.** PROVE can fail and loop back to BUILD; docs written first would describe behavior that isn't final. Document what's proven, then ship.
130
150
 
131
- The two `↳` rows are **gates, not artifacts**: CLARIFY edits the spec in place (FEATURE/SCHEMA only); ANALYZE is read-only and blocks only on CRITICAL. Each real stop closes by leaving **one durable artifact on disk** — that artifact is the skip-check next time.
151
+ The two `↳` rows are **gates, not artifacts**: CLARIFY edits the plan in place (FEATURE/SCHEMA only); ANALYZE is read-only and blocks only on CRITICAL. Each real stop closes by leaving **one durable artifact on disk** — that artifact is the skip-check next time.
132
152
 
133
- **FRAME first (for FEATURE/SCHEMA).** The promise (`text/<slug>.md`) is what PROVE later checks the shipped feature against. If you can't state what the user gets, halt — the idea isn't ready to build. PATCH/FIX have no promise to keep, so they skip it.
153
+ **PROMISE first (for FEATURE/SCHEMA).** The promise (`text/<slug>.md`) is what PROVE later checks the shipped feature against. If you can't state what the user gets, halt — the idea isn't ready to build. PATCH/FIX have no promise to keep, so they skip it.
134
154
 
135
155
  **Before BUILD — EQUIP (skill-check).** Infer skills from the task tags → `ls .claude/skills/{name}/` → **ready** (proceed) / **stale** (warn, proceed) / **missing** (offer to add). Block only if a required skill is missing.
136
156
 
@@ -139,20 +159,20 @@ The two `↳` rows are **gates, not artifacts**: CLARIFY edits the spec in place
139
159
  | When | Ticked by |
140
160
  |---|---|
141
161
  | a W1 recon agent returns findings for a file | `/do` after the agent settles |
142
- | a W2 verdict / diff spec / doc-plan resolves | `/do` inline |
162
+ | a W2 verdict / diff spec / doc-plan resolves | `/do` after the spawned W2 agent settles |
143
163
  | a W3 edit agent reports success on a file | `/do` after the agent settles |
144
- | a W4 check passes (verify · demo · doc-sync · rubric · ratchet) | `/do` after the bash exits 0 |
164
+ | a W4 check passes (verify · demo · RECONCILES · rubric · ratchet) | `/do` after the bash exits 0 |
145
165
  | all of a wave's items are `[x]` | the wave header (derived) |
146
166
  | all 4 waves `[x]` | the cycle header (derived) |
147
167
  | all cycles in a batch `[x]` | the batch header (derived) |
148
168
 
149
- Forward-only — a `[x]` is never un-ticked except by `/do --wave N --redo`. If an action has no checkbox, it isn't tracked, and untracked work is the loudest smell. Full granularity table in `plans/template-todo.md`.
169
+ Forward-only — a `[x]` is never un-ticked except by `/do --wave N --redo`. If an action has no checkbox, it isn't tracked, and untracked work is the loudest smell. Full granularity table in `text/template-todo.md`.
150
170
 
151
171
  After the spine: **LEARN / close** — write one `learnings.md` entry (slug, tier, composite, deliverable, proof line), emit `signal("cost:cycle", {tokens, model, composite})`, delete `.w3-receipts.json`, write `.do-trust.json {level, consecutive, composite}`, and append `.w4-improvements.json` (an open item recurring in 3+ consecutive cycles = systemic gap → emit `substrate:systemic-gap`; next W1 reads it as a mandatory recon target).
152
172
 
153
173
  **Plan-outcome kill-switch (zero LLM).** Re-run the plan's `outcome:` command every cycle close. Exit 0 → the goal is met: remaining cycles enter justify-or-drop (default drop), `--auto` halts. Over the tier ceiling → `warn` + justify. Weak rubric 3× → halt, the *plan* is wrong, not the code. Goal-drift (outcome fails 3× with green rubrics) → force a re-plan.
154
174
 
155
- **One command, complexity-sized.** `/do <anything>` is the only thing a human types — an idea, a slug, or a `plans/<slug>-todo.md` path. The tier sizes the work and the spine prunes itself: a typo is edited and verified inline (one cycle, no loop); a feature writes its promise, spec, todo, tests, and docs and then runs every cycle. The human never picks the mode, never types a flag, never runs a second command.
175
+ **One command, complexity-sized.** `/do <anything>` is the only thing a human types — an idea, a slug, or a `text/<slug>-todo.md` path. The tier sizes the work and the spine prunes itself: a typo is edited and verified inline (one cycle, no loop); a feature writes its promise, plan, todo, tests, and docs and then runs every cycle. The human never picks the mode, never types a flag, never runs a second command.
156
176
 
157
177
  **Context isolation is automatic for multi-cycle plans.** When `/do` resolves to a todo with **≥2 incomplete cycles**, it does not run them inline — it hands the loop to the internal engine so every cycle gets a **fresh context**:
158
178
 
@@ -170,7 +190,7 @@ A **single** incomplete cycle (or a PATCH/FIX) runs inline — there's nothing t
170
190
  **`--next-cycle` is internal.** It means "run one batch, tick boxes, exit — do **not** loop." Only `do-auto.sh` passes it; it is the recursion guard that keeps a fresh `/do` from re-entering the loop. A human never types it.
171
191
 
172
192
  State that survives the reset (all on disk — the loop is stateless in memory):
173
- - `plans/<slug>-todo.md` — checked boxes are the progress bar; the next `/do --next-cycle` reads them and skips completed cycles automatically
193
+ - `text/<slug>-todo.md` — checked boxes are the progress bar; the next `/do --next-cycle` reads them and skips completed cycles automatically
174
194
  - `.do-trust.json` — trust level and consecutive score history (drives auto-continue vs halt)
175
195
  - `.w4-improvements.json` — open items that become mandatory W1 targets next cycle
176
196
  - `.w2-spec.json` / `.w3-receipts.json` — write-once state for soft-resume within a cycle
@@ -193,7 +213,7 @@ This compounds with the W1 cache and W4 rubric cache: a cycle 6 run with context
193
213
 
194
214
  ## Step 3 — The BUILD engine (W0 → W4)
195
215
 
196
- Runs only when the spine reaches `code`. Folder-aware: there is **no root `package.json`** — resolve the target repo folder from the touched files.
216
+ Runs only when the spine reaches `BUILD`. Folder-aware: there is **no root `package.json`** — resolve the target repo folder from the touched files.
197
217
 
198
218
  **W0 — Baseline.**
199
219
  ```bash
@@ -218,15 +238,23 @@ bun .claude/scripts/w1-recon.ts --targets "$FILES" --mode RECON
218
238
  ```
219
239
  Script exits 2 if `ANTHROPIC_API_KEY` is absent → fall back to spawning `w1-recon` agent (Haiku · low) for ALL files in ONE message. Either path: skip `relevance_score < 0.4`; all-filtered → halt and broaden (zero-findings guard). Receipt capped at 400 words; persist high-signal slices into `.w2-spec.json`. *(The `w1-recon` agent carries the two-track existing-code + primitive-inventory contract.)*
220
240
 
221
- **W2 — Decide (never delegated — Opus · high).** Write the goal/deliverable/UX gate (3 sentences) first. Then: reconcile names against `dictionary.md`; run the **compress check** before any new primitive (name 3 existing primitives that compose it → `compose` removes it from the diff, `new` needs a one-line justification + same-diff doc edit). The pre-mortem + trade-offs were already captured at the `spec` stop (`template-spec.md`) — carry the failure modes forward as test cases, don't redo them. Classify each W1 finding Act / Keep / Defer. Output diff specs + write `.w2-spec.json` (+ `.w2-doc-plan.json` if a doc trigger fires). *(The `w2-decide` agent carries the compose-target table — which canonical doc to check per primitive type — plus context-triggers for surgical doc injection.)*
241
+ **W2 — Decide (spawned single Opus `w2-decide` agent — Opus · high).** W2 is NOT run inline; the conductor spawns one `w2-decide` agent at Opus·high and waits for its result. Understanding is not delegable; it stays single, never fanned — but pinning it to the conductor process is not required. The conductor/session model runs Sonnet; W2 stays Opus. W2 writes the goal/deliverable/UX gate (3 sentences) first. Then: reconcile names against `dictionary.md`; run the **compress check** before any new primitive (name 3 existing primitives that compose it → `compose` removes it from the diff, `new` needs a one-line justification + same-diff doc edit). The pre-mortem + trade-offs were already captured at the DESIGN stop (`template-plan.md`) — carry the failure modes forward as test cases, don't redo them. Classify each W1 finding Act / Keep / Defer. Output diff specs + write `.w2-spec.json` (+ `.w2-doc-plan.json` if a doc trigger fires). Pin the **Interface Contract** (shared names, CLI signatures, decisions that multiple downstream tasks reference — pins let them run parallel, not serial). Emit the maximal-width batch DAG (arrow test applied: arrows exist only where one cycle reads a file another writes). *(The `w2-decide` agent carries the compose-target table — which canonical doc to check per primitive type — plus context-triggers for surgical doc injection.)*
222
242
 
223
- **W3 — Edit (Sonnet × N parallel).** Soft-resume first: if `.w3-receipts.json` has fewer receipts than `.w2-spec.json` diff specs, a prior W3 was interrupted — skip W0–W2 and resume from the first unapplied spec. Pre-validate every anchor with `grep -qF` in parallel. No file overlap → spawn all `w3-edit` agents in ONE message (W3a). Overlap → W3a (independent) then W3b (same-file, sequential). Append a receipt per edit; anchor miss twice → halt, ask user. Build every UI state (empty / loading / error / edge), not just the happy path.
243
+ **W3 — Edit (Sonnet × N parallel).** Soft-resume first: if `.w3-receipts.json` has fewer receipts than `.w2-spec.json` diff specs, a prior W3 was interrupted — skip W0–W2 and resume from the first unapplied spec. Pre-validate every anchor with `grep -qF` in parallel. No file overlap → spawn all `w3-edit` agents in ONE message (W3a). Overlap → W3a (independent) then W3b (same-file, sequential). Append a receipt per edit; anchor miss twice → halt, ask user. Build every UI state (empty / loading / error / edge), not just the happy path. Surfaces are built in category order: `schema → types → receiver/SDK → API route → component → page → route registered → nav entry → inbound links → states`.
224
244
 
225
245
  **W4 — Verify (bash first, zero tokens).**
226
246
  ```bash
227
247
  ( cd $folder && bun run verify ) # biome + tsc + vitest
228
248
  $(cycle.demo.command) # the goal gate — exit 0 = pass
229
- # doc-sync gate (reads .w2-doc-plan.json): stale-name=0, links ok, contract mtime current
249
+ # RECONCILES gate: per-category reconcile calls
250
+ do-reconcile.sh types # tsc delta ≤ 0
251
+ do-reconcile.sh dictionary # no dead name, no new synonym
252
+ do-reconcile.sh substrate <file> # DATA tasks — schema extended, not forked
253
+ do-reconcile.sh sdk <file> # GATEWAY tasks — joins a receiver
254
+ do-reconcile.sh navigation <surface> # SURFACE tasks — registered + ≥1 inbound link
255
+ do-reconcile.sh design <file> # SURFACE tasks — composes shadcn/tokens
256
+ do-reconcile.sh authority <file> # GATEWAY tasks — walk-up resolves, no ad-hoc
257
+ # TEACH tasks: do-reconcile.sh dictionary + do-reconcile.sh types on doc files
230
258
  DELTA_TSC=$((TSC_NOW - TSC_BASELINE)) # hard gate: ≤ 0, no new type errors ever
231
259
  ```
232
260
  Rubric (inline for TRIVIAL/SIMPLE; for COMPLEX — run the SDK script first (6 Haiku in parallel, rubric + spec block cached across all calls):
@@ -240,44 +268,54 @@ gate: composite ≥ 0.65 AND goal-fit ≥ 0.50 (hard) AND no adversarial > 0
240
268
  ```
241
269
  Verify scope is the **dependency cone** of `git diff` (full verify only at cycle close — speed). Then compress sweep (ts-prune + noUnusedLocals → delete orphans/dead code), write `.w4-improvements.json`, and fire one pre-warm Haiku at the next cycle's W1 targets. Verify or demo failure on touched files → W3.5 (one Sonnet per dirty file), max 3 W4 loops then halt.
242
270
 
243
- **Testing policy** (full detail in `plans/template-todo.md`): Vitest-first; Playwright only when the cycle declares `requires_playwright: true`; one goal-based `expect()` per deliverable (assert the destination, not the path); ≤1 test file per cycle; a cycle needing >5 tasks splits unless `mode: lean`; N-variant split-test → winner `mark()`, losers `warn(0.5)`.
271
+ **Testing policy** (full detail in `text/template-todo.md`): Vitest-first; Playwright only when the cycle declares `requires_playwright: true`; one goal-based `expect()` per deliverable (assert the destination, not the path); ≤1 test file per cycle; a cycle needing >5 tasks splits unless `mode: lean`; N-variant split-test → winner `mark()`, losers `warn(0.5)`.
244
272
 
245
273
  ---
246
274
 
247
275
  ## Definition of done (tier-scaled — `/do` ticks these automatically)
248
276
 
249
- 1. The agreed goal is met (goal-fit gate). 2. Every shippable deliverable has a test asserting it. 3. No regression — tests green, `delta_tsc ≤ 0`, `must_not_break` preserved. 4. Proven live, matches the promise. 5. Docs in sync. 6. Full coverage, no orphan tasks. 7. Rubric clears the bar. 8. Closed loop — recorded result + one learnings entry.
277
+ | # | Done means | Gate |
278
+ |---|---|---|
279
+ | 1 | The agreed goal is met | RUBRIC goal-fit |
280
+ | 2 | Every shippable deliverable has a test asserting it | ANALYZE + TEST |
281
+ | 3 | No regression — ratchet held, `must_not_break` preserved | RECONCILES |
282
+ | 4 | Proven live, reachable, matches the promise | PROVE |
283
+ | 5 | Surfaces wired into navigation, not orphaned | RECONCILES (Navigation) |
284
+ | 6 | Docs in sync — no stale name, no dead link | RECONCILES (Docs) |
285
+ | 7 | Rubric clears the bar | RUBRIC |
286
+ | 8 | Loop closed — result + learning recorded | LEARN |
250
287
 
251
- PATCH clears {1,2,3,8}. FEATURE clears all eight.
288
+ PATCH clears {1, 3, 7, 8}. FEATURE clears all eight. Same bar, scaled to the work.
252
289
 
253
290
  ---
254
291
 
255
292
  ## Non-negotiable rules
256
293
 
257
- - **Never skip W2.** Understanding is not delegable.
258
- - **Default to parallel.** Spawn W1, W3, and W4-rubric agents in a **single message** — across cycles in a batch, not just within one. An arrow exists only when you can name the file one cycle writes and the next reads; reject every imaginary blocker.
294
+ - **Never skip W2.** Understanding is not delegable — spawn the single Opus `w2-decide` agent; never inline it, never fan it.
295
+ - **Default to parallel.** Spawn W1, **W2**, W3, and W4-rubric agents — across cycles in a batch, not just within one. W2 is in the spawn list; the conductor runs Sonnet. An arrow exists only when you can name the file one cycle writes and the next reads; reject every imaginary blocker.
259
296
  - **Tick the moment it lands.** Flip `[ ]`→`[x]` as each agent/check settles — never batch at the end. The file is the progress bar.
260
- - **FRAME before code (FEATURE/SCHEMA)** — no *feature* ships without a stated promise. PATCH/FIX skip FRAME by design.
297
+ - **PROMISE before code (FEATURE/SCHEMA)** — no feature ships without a stated promise. PATCH/FIX skip PROMISE by design.
261
298
  - **Closed loop** — every cycle ends in `mark`/`warn`, never a silent return.
262
299
  - **Cheapest tool that decides wins** — a phase that needs no LLM call is the best kind.
263
300
  - **W4 max 3 loops**, then halt and report.
264
301
  - **One command.** A human types `/do <anything>` and nothing else. Complexity sizing, spine pruning, and (for multi-cycle plans) the context-isolated loop are all automatic — never a flag, never a second command.
265
302
  - **Every cycle gets a fresh context.** A multi-cycle `/do` runs each cycle in a clean subprocess via the internal loop. Prior-cycle conversation is noise; the todo checkboxes are the only state that carries forward.
303
+ - **Coherence ratchet is a hard gate.** Every write must leave types / names / primitives / schema / surfaces / docs equal or more coherent than before. The ratchet can tighten; it can never loosen.
266
304
 
267
305
  ---
268
306
 
269
307
  ## Available to /do — the toolbox
270
308
 
271
- **Scripts** (`.claude/scripts/`): `do-auto.sh` (*internal* — the context-isolated, worktree-isolated loop `/do` drives for multi-cycle plans; builds on branch `do/<slug>`, merges to trunk only on a human's say-so) · `do-tier.sh` (tier + pruned spine + classifier + ceiling) · `do-folder.sh` (folder-aware verify/build) · `do-survey.sh` (reuse verdict) · `do-reconcile.sh` (substrate dim/verb/dead-name gate) · `do-analyze.sh` (deliverable↔cycle coverage gate) · `do-prove.sh` (surface-detect proof) · `do-smoke.sh` (deterministic outcome) · `w1-recon.ts` (prompt-cached recon) · `w4-rubric.ts` (cached parallel rubric).
309
+ **Scripts** (`.claude/scripts/`): `do-auto.sh` (*internal* — the context-isolated, worktree-isolated loop `/do` drives for multi-cycle plans; builds on branch `do/<slug>`, merges to trunk only on a human's say-so) · `do-tier.sh` (tier + pruned spine + classifier + ceiling) · `do-folder.sh` (folder-aware verify/build) · `do-survey.sh` (reuse verdict) · `do-reconcile.sh <canon>` (**one predicate over 7 canons** — `substrate|dictionary|authority|sdk|design|navigation|types` — subsumes the old RECONCILE, COMPRESS, PROMISE-CHECK, DOC-SYNC gates; `navigation` branch enforces surface reachability; `--self-test` drives fixtures) · `do-analyze.sh` (deliverable↔cycle coverage gate) · `do-prove.sh` (surface-detect proof — pure PROVE, promise-check moved into `do-reconcile.sh design`) · `do-smoke.sh` (deterministic outcome — drives ≥1 fixture per canon branch + orphan/reachable nav fixtures) · `w1-recon.ts` (prompt-cached recon) · `w4-rubric.ts` (cached parallel rubric).
272
310
 
273
- **Templates**: `text/template-frame.md` (promise) · `plans/template-spec.md` (design + pre-mortem + decisions) · `plans/template-todo.md` (plan + parallel budget + testing policy) · `plans/agent-template.md` (agent definition).
311
+ **Templates**: `text/template-feature.md` (promise/PROMISE) · `text/template-plan.md` (design + pre-mortem + decisions/DESIGN) · `text/template-todo.md` (plan + parallel budget + testing policy/PLAN) · `text/template-agent.md` (agent definition/BUILD).
274
312
 
275
- **Agents**: `w1-recon` · `w2-decide` · `w3-edit` · `w4-verify` · `Explore` · `Plan` · `pr-review-toolkit:*` (code-reviewer, silent-failure-hunter, type-design-analyzer, pr-test-analyzer, code-simplifier) · `find-bugs`.
313
+ **Agents**: `w1-recon` · `w2-decide` (spawned single Opus; carries the full W2 contract — compress check, Interface Contract pin, maximal batch DAG) · `w3-edit` · `w4-verify` · `Explore` · `Plan` · `pr-review-toolkit:*` (code-reviewer, silent-failure-hunter, type-design-analyzer, pr-test-analyzer, code-simplifier) · `find-bugs`.
276
314
 
277
- **Skills** (per-stage routing in `plans/templates.md`): FRAME → `writer`, `copywriting` · SPEC → `typedb`, `signal` · BUILD → `astro`, `react19`, `shadcn`, `ai-ui`, `ai-sdk`, `reactflow`, `hono`, `cloudflare`, `wrangler`, `durable-objects` · TEST → `vitest`, `playwright-best-practices`, `webapp-testing` · VERIFY → `accessibility`, `find-bugs`, `perf`, `typecheck` · TEACH → `tutorial`, `writer`.
315
+ **Skills** (per-stage routing in `text/templates-plan.md`): PROMISE → `writer`, `copywriting` · DESIGN → `typedb`, `signal` · BUILD → `astro`, `react19`, `shadcn`, `ai-ui`, `ai-sdk`, `reactflow`, `hono`, `cloudflare`, `wrangler`, `durable-objects` · TEST → `vitest`, `playwright-best-practices`, `webapp-testing` · VERIFY → `accessibility`, `find-bugs`, `perf`, `typecheck` · TEACH → `tutorial`, `writer`.
278
316
 
279
317
  **State files** (write-once, read-by-path — compaction-proof): `.w0-baseline.json` · `.w2-spec.json` · `.w2-doc-plan.json` · `.w3-receipts.json` · `.do-trust.json` · `.w4-improvements.json`.
280
318
 
281
319
  ---
282
320
 
283
- *`/do` is `select()` made human-readable: idea in, shipped-and-proven feature out. The path remembers every execution.*
321
+ *`/do` is `select()` made human-readable: idea in, shipped-and-proven feature out. Each artifact is made true — exists and agrees with its canon. The path remembers every execution.*
@@ -23,11 +23,11 @@ If `[slug]` is omitted, derive it from the most recent `learnings.md` entry
23
23
 
24
24
  ```bash
25
25
  # Last learnings entry
26
- tail -5 plans/learnings.md
26
+ tail -5 text/learnings.md
27
27
 
28
28
  # Recent cycle diff (what actually changed)
29
29
  git diff HEAD~1 HEAD --stat
30
- git diff HEAD~1 HEAD -- $(git diff HEAD~1 HEAD --name-only | grep -v 'plans/\|text/' | head -20)
30
+ git diff HEAD~1 HEAD -- $(git diff HEAD~1 HEAD --name-only | grep -v 'text/\|text/' | head -20)
31
31
  ```
32
32
 
33
33
  **Step 2 — Extract the pattern (Haiku · low)**
@@ -72,7 +72,7 @@ Use this template:
72
72
  **Step 5 — Close**
73
73
 
74
74
  Emit `signal("learning:harden", 1, "skill=<slug>")` and append one line to
75
- `plans/learnings.md`:
75
+ `text/learnings.md`:
76
76
 
77
77
  ```
78
78
  - YYYY-MM-DD · skill:<slug> · crystallised from <source-slug> · source=skill-create
@@ -96,5 +96,5 @@ Emit `signal("learning:harden", 1, "skill=<slug>")` and append one line to
96
96
  ## Close
97
97
 
98
98
  After writing the skill file: `[ ] skill-create:<slug> done` appended to
99
- `plans/learnings.md`, signal emitted, session stop-reflect will pick it up as
99
+ `text/learnings.md`, signal emitted, session stop-reflect will pick it up as
100
100
  a new primitive on the next session start.
package/commands/sync.md CHANGED
@@ -10,8 +10,8 @@ Reconcile substrate state — tick loops, absorb markdown, propagate knowledge.
10
10
  |------|------|------|
11
11
  | *(default)* | Tick all loops + scan docs + todos + agents | L1-L7 |
12
12
  | `tick` | Fire all L1-L7 loops once (one full growth cycle) | L1-L7 |
13
- | `docs` | Scan `docs/*.md` → memory → TypeDB | L6 |
14
- | `todos` | Scan `docs/*-todo.md` → tasks → TypeDB + KV | L1 |
13
+ | `docs` | Scan `text/*.md` → memory → TypeDB | L6 |
14
+ | `todos` | Scan `text/*-todo.md` → tasks → TypeDB + KV | L1 |
15
15
  | `tasks [dir]` | Import reusable task templates from `tasks/` (or `[dir]`) → world-scoped tasks + skills + capabilities | L1 |
16
16
  | `agents` | Scan `agents/**/*.md` → units → TypeDB | L1 |
17
17
  | `fade` | Fire L3 only — asymmetric decay | L3 |
@@ -41,8 +41,8 @@ Individual noun invocations target a single loop layer; default runs all of them
41
41
  ### *(default)*
42
42
 
43
43
  1. `bun run verify` — W0 gate (skip if already passed this session)
44
- 2. Scan `docs/*-todo.md` → parse checkboxes → POST `/api/tasks/sync`
45
- 3. Scan `docs/*.md` → extract concepts → write to memory → TypeDB
44
+ 2. Scan `text/*-todo.md` → parse checkboxes → POST `/api/tasks/sync`
45
+ 3. Scan `text/*.md` → extract concepts → write to memory → TypeDB
46
46
  4. Scan `agents/**/*.md` → parse frontmatter → sync units + skills
47
47
  5. GET `http://localhost:4321/api/tick?interval=0` — fire all L1-L7 loops
48
48
  6. Report:
@@ -73,14 +73,14 @@ Individual noun invocations target a single loop layer; default runs all of them
73
73
 
74
74
  ### docs
75
75
 
76
- 1. Scan all `docs/*.md` files via `src/engine/doc-scan.ts`
76
+ 1. Scan all `text/*.md` files via `src/engine/doc-scan.ts`
77
77
  2. Extract key concepts, verify doc-code alignment
78
78
  3. Write to memory → TypeDB
79
79
  4. Report: docs scanned, gaps found, TypeDB writes
80
80
 
81
81
  ### todos
82
82
 
83
- 1. Scan all `docs/*-todo.md` files via `src/engine/task-parse.ts` (`scanTodos()`)
83
+ 1. Scan all `text/*-todo.md` files via `src/engine/task-parse.ts` (`scanTodos()`)
84
84
  2. POST to `http://localhost:4321/api/tasks/sync` (hash-gated: skips if data unchanged)
85
85
  3. KV update (~10ms), async TypeDB sync (~100ms)
86
86
  4. Report:
@@ -129,7 +129,7 @@ Optional: `description`, `tags`, `wave`, `value`, `effort`, `phase`, `persona`,
129
129
  **Why this noun exists:** Stage 1 (LIST) of the trade lifecycle needs inventory.
130
130
  A new seller world with zero listings is a dead market. Reusable task templates
131
131
  are pre-packaged LIST entries — import the catalog, your world has a starter
132
- set of listings ready to receive offers. See `docs/trade-lifecycle-todo.md § Cycle 6`.
132
+ set of listings ready to receive offers. See `text/trade-lifecycle-todo.md § Cycle 6`.
133
133
 
134
134
  ### agents
135
135
 
@@ -75,11 +75,11 @@ check_drift '^api/src/' 'api/CLAUDE.md'
75
75
 
76
76
  # (4) Completed /do cycle → suggest /skill-create to crystallise the pattern.
77
77
  # Heuristic: learnings.md was touched AND W3 edited >=3 non-plan/non-text files.
78
- if echo "$CHANGED" | grep -qF 'plans/learnings.md'; then
79
- CYCLE_FILES=$(echo "$CHANGED" | grep -vE '^plans/|^text/|^\.claude/' | wc -l | awk '{print $1}')
78
+ if echo "$CHANGED" | grep -qF 'text/learnings.md'; then
79
+ CYCLE_FILES=$(echo "$CHANGED" | grep -vE '^text/|^text/|^\.claude/' | wc -l | awk '{print $1}')
80
80
  if [ "$CYCLE_FILES" -ge 3 ]; then
81
81
  # Extract the cycle slug from the last learnings entry
82
- CYCLE_SLUG=$(grep -oE 'cycle [0-9]+|· [a-z][a-z0-9-]+' plans/learnings.md 2>/dev/null | tail -1 | sed 's/^· //')
82
+ CYCLE_SLUG=$(grep -oE 'cycle [0-9]+|· [a-z][a-z0-9-]+' text/learnings.md 2>/dev/null | tail -1 | sed 's/^· //')
83
83
  BUF+="- **skill-create** cycle closed with ${CYCLE_FILES} file(s) changed — run \`/skill-create ${CYCLE_SLUG}\` to crystallise the pattern as a reusable skill.\n"
84
84
  PROPOSALS=$((PROPOSALS + 1))
85
85
  fi
@@ -24,7 +24,7 @@ esac
24
24
 
25
25
  # Don't recurse: if the edit IS TODO.md itself, it was likely regenerated. Skip.
26
26
  case "$FILE" in
27
- */docs/TODO.md) exit 0 ;;
27
+ */text/TODO-plan.md) exit 0 ;;
28
28
  esac
29
29
 
30
30
  # Best-effort POST with a 2s cap so edits stay snappy.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/claude",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "ONE Claude Code plugin — /do lifecycle, W1-W4 BUILD engine, ONE substrate via MCP, signals, and rules",
5
5
  "files": [
6
6
  ".claude-plugin",
@@ -11,6 +11,7 @@
11
11
  "rules",
12
12
  "hooks",
13
13
  "scripts",
14
+ "templates",
14
15
  "README.md"
15
16
  ],
16
17
  "peerDependencies": {
@@ -16,12 +16,12 @@ Before any code is written, explicitly list which docs will change:
16
16
  ### Documentation Updates (W2)
17
17
 
18
18
  **New docs:**
19
- - `docs/feature.md` — {purpose}
19
+ - `text/feature.md` — {purpose}
20
20
 
21
21
  **Docs modified:**
22
- - `docs/dictionary.md` — add term {name}
23
- - `docs/routing.md` — update loop L{N}
24
- - `docs/rubrics.md` — add dimension {name}
22
+ - `text/dictionary-plan.md` — add term {name}
23
+ - `text/routing-plan.md` — update loop L{N}
24
+ - `text/rubrics-plan.md` — add dimension {name}
25
25
 
26
26
  **Schema changes:**
27
27
  - New TypeDB entities, D1 migrations, TypeQL functions
@@ -37,12 +37,12 @@ Before any code is written, explicitly list which docs will change:
37
37
 
38
38
  | Code File | Related Doc |
39
39
  |-----------|-------------|
40
- | `nanoclaw/src/types.ts` | `docs/dictionary.md` — add new type terms |
41
- | `src/engine/world.ts` | `docs/DSL.md` — update signal grammar |
42
- | `src/engine/loop.ts` | `docs/routing.md` — update L1-L7 loops |
43
- | `src/pages/api/*.ts` | `docs/lifecycle.md` — update lifecycle stage |
44
- | `src/schema/*.tql` | `docs/one-ontology.md` — update dimension/entity |
45
- | Feature-specific file | `docs/feature.md` — update feature spec |
40
+ | `nanoclaw/src/types.ts` | `text/dictionary-plan.md` — add new type terms |
41
+ | `src/engine/world.ts` | `text/DSL-plan.md` — update signal grammar |
42
+ | `src/engine/loop.ts` | `text/routing-plan.md` — update L1-L7 loops |
43
+ | `src/pages/api/*.ts` | `text/lifecycle-plan.md` — update lifecycle stage |
44
+ | `src/schema/*.tql` | `text/one-ontology.md` — update dimension/entity |
45
+ | Feature-specific file | `text/feature.md` — update feature spec |
46
46
 
47
47
  **Pattern:** If you're adding a new field to a TypeScript interface, add it to the doc that defines that interface. If you're changing a loop, update the loop diagram in the doc.
48
48
 
@@ -54,7 +54,7 @@ Before any code is written, explicitly list which docs will change:
54
54
 
55
55
  1. **Terminology** — All renamed concepts updated everywhere
56
56
  ```bash
57
- grep -r "old-name" docs/ -- ignore new-name where intentional (dead names)
57
+ grep -r "old-name" text/ -- ignore new-name where intentional (dead names)
58
58
  ```
59
59
 
60
60
  2. **Examples** — Code examples in docs match actual implementation
@@ -125,10 +125,10 @@ After W4 completes, auto-run consistency checks:
125
125
 
126
126
  ```bash
127
127
  # Terminology consistency
128
- grep -r "old-term" docs/ | flag if > 0 (not on deadname list)
128
+ grep -r "old-term" text/ | flag if > 0 (not on deadname list)
129
129
 
130
130
  # Cross-references
131
- markdown-link-check docs/*.md
131
+ markdown-link-check text/*.md
132
132
 
133
133
  # Metaphor alignment (if touching signal/path semantics)
134
134
  grep -l "signal\|strength\|resistance" src/changed-files.txt | xargs -I {} \
@@ -151,9 +151,9 @@ grep "rubric\|dimension" src/changed-files.txt | flag for rubrics.md review
151
151
  - None (extends existing types)
152
152
 
153
153
  **Docs modified:**
154
- - `docs/dictionary.md` — add "Rich Messages" section, explain `data.rich` convention
155
- - `docs/rich-messages.md` — add PaymentMetadata type, Payment flow section
156
- - `docs/template-todo.md` — add "Documentation Updates (W2 + W4)" section
154
+ - `text/dictionary-plan.md` — add "Rich Messages" section, explain `data.rich` convention
155
+ - `text/rich-messages.md` — add PaymentMetadata type, Payment flow section
156
+ - `text/template-todo.md` — add "Documentation Updates (W2 + W4)" section
157
157
 
158
158
  **Schema changes:**
159
159
  - `nanoclaw/src/types.ts` — RichMessage.thread, RichMessage.payment added (Cycle 1 & 3)
@@ -197,9 +197,9 @@ When running `/do {name}-todo.md`, the workflow enforces:
197
197
  | feature doc named in plan | feature doc | sync verb/component/endpoint counts |
198
198
  | rename across W3 | every `**/*.md` containing old name | inline replace (auto-grep) |
199
199
 
200
- Anchor mismatch → log to `docs/improvements.md` for manual W2 next cycle (no halt — the cycle still closes; the propagate task surfaces next iteration).
200
+ Anchor mismatch → log to `text/improvements.md` for manual W2 next cycle (no halt — the cycle still closes; the propagate task surfaces next iteration).
201
201
 
202
- **Learnings entry** (append to `docs/learnings.md` on each close):
202
+ **Learnings entry** (append to `text/learnings.md` on each close):
203
203
 
204
204
  ```
205
205
  - YYYY-MM-DD · cycle N · wave N|gate · {one sentence} · rubric=0.NN · source=w1|w2|w3|w4|cycle