@oneie/claude 0.4.0 → 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/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # @oneie/claude
2
2
 
3
- > "Every other AI coding tool stops at 'here's some code.' That's the easy 20%. The other 80% — the spec nobody wrote, the test nobody added, the doc that's already a lie, the proof that it actually works — is where software goes to die. We built a machine that does the whole 80%, and only commits to the trunk once it's proven."
4
- >
5
- > — Anthony O'Connell, Founder of ONE
6
-
7
3
  One command. One substrate. Install this plugin and Claude Code gains two things: a complete build workflow that takes an idea to proven, shipped software — and direct access to the ONE substrate, the backend that makes any application composable by agents.
8
4
 
9
5
  ```
@@ -35,10 +31,10 @@ That's it. The `/do` workflow is available immediately. The substrate tools acti
35
31
  One command walks the entire build lifecycle. You confirm the goal once. Everything below it is owned by the workflow.
36
32
 
37
33
  ```
38
- IDEA → GOALFRAME → SURVEY → SPEC → PLAN → BUILD → TEST → VERIFY → PROVE → TEACH → SHIP → LEARN
34
+ IDEA → AIMPROMISE → SURVEY → [INVESTIGATE]DESIGN → PLAN → BUILD → TEST → VERIFY → PROVE → TEACH → SHIP → LEARN
39
35
  ```
40
36
 
41
- The workflow is a spine of artifacts on disk. A phase whose artifact already exists is skipped. Point `/do` at a blank idea and it runs every phase. Point it at code that's missing tests and point it runs only those.
37
+ The workflow is a spine of artifacts on disk. A phase whose artifact is already **true** — it both *exists* and *reconciles* with its canon (`true ≡ exists ∧ reconciles`) — is skipped. Missing → write it. Stale → rewrite it. True → skip. Point `/do` at a blank idea and it makes every artifact true. Point it at code that's missing tests and docs and it backfills only those.
42
38
 
43
39
  A cheap probe at the start sizes the work:
44
40
 
@@ -55,14 +51,14 @@ You never pick the tier. The probe does, and it defaults down when unsure.
55
51
 
56
52
  1. The agreed goal is actually met (goal-fit gate)
57
53
  2. Every shippable deliverable has a test asserting it
58
- 3. No regression — tests green, zero new type errors
59
- 4. Proven live and matches the promise
60
- 5. Docs in sync — no stale names, no dead links
61
- 6. Full coverage — no orphan tasks
54
+ 3. No regression — coherence ratchet held, `must_not_break` preserved
55
+ 4. Proven live, reachable, matches the promise
56
+ 5. Surfaces wired into navigation, not orphaned
57
+ 6. Docs in sync — no stale name, no dead link
62
58
  7. Rubric clears the bar
63
59
  8. Loop closed — recorded result, written learning
64
60
 
65
- A typo clears 1, 2, 3, 8. A feature clears all eight.
61
+ A typo clears 1, 3, 7, 8. A feature clears all eight.
66
62
 
67
63
  ### The ONE substrate — 14 operations via MCP
68
64
 
@@ -73,19 +69,18 @@ Every application is composed from the same fourteen operations:
73
69
  ```ts
74
70
  // A merchant publishes a product
75
71
  await c.signal('world:create-thing', {
76
- content: { name: 'Midnight Linen Jacket', type: 'product', price: 295 }
72
+ name: 'Midnight Linen Jacket', type: 'product', price: 295
77
73
  })
78
74
 
79
- // A buyer completes a purchase — marks the path, settles payment
80
- await c.mark('buyermerchant:order', {
81
- weight: 295.00, currency: 'USDC', fit: 1, form: 1
82
- })
75
+ // A buyer completes a purchase — settle the payment, then mark the path that converted
76
+ await c.payWeight('buyer', 'merchant', 'order', 295.00) // USDC settled
77
+ await c.mark('buyer→merchant:order') // strengthen what worked
83
78
 
84
79
  // The substrate asks: what should we surface next?
85
- const next = await c.select('product', { exploration: 0.15 })
80
+ const { target } = await c.select('product')
86
81
  ```
87
82
 
88
- Three calls. A commerce platform. The substrate records what converted, strengthens those paths, and starts surfacing better results automatically.
83
+ Four calls. A commerce platform. The substrate records what converted, strengthens those paths, and starts surfacing better results automatically.
89
84
 
90
85
  **MCP tools available after `/setup`:**
91
86
 
@@ -142,7 +137,7 @@ When `/do` reaches the `code` phase it runs four waves:
142
137
 
143
138
  **W3 — Edit** — spawns one Sonnet agent per file, all in a single message. Pre-validates every anchor. Soft-resumes if interrupted.
144
139
 
145
- **W4 — Verify** — bash first, zero tokens: `bun run verify`, the goal gate, the doc-sync gate, the ratchet (`delta_tsc ≤ 0`). Rubric only if the bash gates pass.
140
+ **W4 — Verify** — bash first, zero tokens: `bun run verify`, the goal gate, then `reconciles` — one predicate over seven canons (`substrate · dictionary · authority · sdk · design · navigation · types`) that subsumes the old reconcile, compress, promise-check, and doc-sync gates — and the ratchet (`delta_tsc ≤ 0`). Rubric only if the bash gates pass.
146
141
 
147
142
  ```
148
143
  composite = 0.35·goal-fit + 0.20·security + 0.20·stability + 0.15·simplicity + 0.10·speed
@@ -153,6 +148,21 @@ A cycle that runs zero LLM calls is a good cycle.
153
148
 
154
149
  ---
155
150
 
151
+ ## Templates
152
+
153
+ Each spine stop that writes an artifact has a template — copied, never written from scratch, under the naming law `template-<suffix>.md → <slug>-<suffix>.md`. One proof observable is named once at PROMISE and referenced (never restated) all the way to TEACH.
154
+
155
+ | Template | Stop | Writes |
156
+ |----------|------|--------|
157
+ | `template-feature.md` | PROMISE | `<slug>.md` — the promise + the one proof observable PROVE checks |
158
+ | `template-plan.md` | DESIGN | `<slug>-plan.md` — design, pre-mortem, 7-canon reconcile gate |
159
+ | `template-todo.md` | PLAN | `<slug>-todo.md` — cycles, parallel budget, DAG, testing policy |
160
+ | `template-agent.md` | BUILD | `.claude/agents/<name>.md` — agent contract + one filled example |
161
+ | `template-tests.md` | TEST | the cycle's demo gate — assert the destination, red before green |
162
+ | `template-teach.md` | TEACH | `<slug>-doc.md` — the journey doc for humans *and* agents |
163
+
164
+ ---
165
+
156
166
  ## Agents as builders
157
167
 
158
168
  Agents are actors. They have the same fourteen operations as any other actor — the same API key, the same signal grammar, the same read surfaces. A human developer and an AI agent calling `signal` land in the same substrate. Same paths. Same pheromone.
@@ -64,7 +64,7 @@ The rubric is not a verdict; it is a map forward.
64
64
 
65
65
  1. Run `bun run verify` (biome + tsc + vitest). Capture exit code and counts. If the command fails because `bun` isn't available, fall back to `npm run verify`.
66
66
  2. If biome/tsc/vitest fail on files touched in W3 → route failure back to W3 (the parent handles the W3.5 reloop; you emit `w4:verify:fail` with the failure list). Max 3 loops per cycle.
67
- 2.5. **Contract gate** — for any verb touched in W3 (`signal`, `mark`, `warn`, `fade`, `follow`, `harden`), read `text/contracts-plan.md` and verify the diff against the verb's pre/post/inv. Until a property-test suite exists, this is a manual check; emit `contracts: reviewed` or `contracts: violated <verb> <clause>` in receipts. A violation is **non-bypassable** — cycle does not close regardless of rubric. If no verb touched → `contracts: n/a`.
67
+ 2.5. **Contract gate** — for any verb touched in W3 (`signal`, `mark`, `warn`, `fade`, `follow`, `harden`), read `text/contracts.md` and verify the diff against the verb's pre/post/inv. Until a property-test suite exists, this is a manual check; emit `contracts: reviewed` or `contracts: violated <verb> <clause>` in receipts. A violation is **non-bypassable** — cycle does not close regardless of rubric. If no verb touched → `contracts: n/a`.
68
68
 
69
69
  3. **Reconcile per canon** — run after deterministic checks pass, before rubric scoring.
70
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/claude",
3
- "version": "0.4.0",
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",
package/rules/engine.md CHANGED
@@ -1,11 +1,14 @@
1
1
  ---
2
2
  paths:
3
- - "agents/src/**/*.ts"
3
+ - "packages/sdk/src/**/*.ts"
4
+ - "channels/src/**/*.ts"
5
+ - "one.ie/web/src/lib/pheromone.ts"
6
+ - "one.ie/web/src/workers/**/*.ts"
4
7
  ---
5
8
 
6
9
  # Engine Rules
7
10
 
8
- Apply to `src/engine/*.ts`
11
+ Apply to substrate code — the SDK verbs, the pheromone world, and every worker that consumes them.
9
12
 
10
13
  ---
11
14
 
@@ -16,17 +19,20 @@ These three rules compound. Breaking any one breaks the flywheel.
16
19
  ### Rule 1 — Closed Loop
17
20
 
18
21
  **Every signal closes its loop.** `mark()` on result, `warn()` on failure,
19
- `dissolve` on missing unit/capability. No silent returns. No orphan signals.
22
+ `dissolve` on missing receiver. No silent returns. No orphan signals.
20
23
 
21
24
  ```typescript
22
- const { result, timeout, dissolved } = await net.ask({ receiver: next })
23
- if (result) net.mark(edge, chainDepth) // success → path strengthens
24
- else if (timeout) /* neutral — not the agent's fault */
25
- else if (dissolved) net.warn(edge, 0.5) // mild path doesn't exist
26
- else net.warn(edge, 1) // failure — agent produced nothing
25
+ // ask() resolves to one of 4 outcomes (packages/sdk/src/types.ts Outcome<T>)
26
+ const outcome = await one.ask(receiver, data)
27
+ switch (outcome.kind) {
28
+ case "result": await one.mark(edge); break // success path strengthens
29
+ case "timeout": /* neutralnot the agent's fault */ break
30
+ case "dissolved": await one.warn(edge, 0.5); break // mild — receiver doesn't exist
31
+ case "failure": await one.warn(edge, 1); break // failure — produced nothing
32
+ }
27
33
  ```
28
34
 
29
- Why: pheromone is the only thing that compounds. A handler that returns
35
+ Why: path strength is the only thing that compounds. A handler that returns
30
36
  silently leaks learning. Width (parallelism) only compounds if every
31
37
  parallel branch deposits a mark or warn on the path it used.
32
38
 
@@ -36,10 +42,10 @@ parallel branch deposits a mark or warn on the path it used.
36
42
  or any wall-clock unit.
37
43
 
38
44
  ```
39
- task = atomic unit of work (one .on() handler, one file edit)
45
+ task = atomic unit of work (one receiver handler, one file edit)
40
46
  wave = phase within a cycle (W1 recon → W2 decide → W3 edit → W4 verify)
41
47
  cycle = full W0-W4 sandwich, exits at rubric >= 0.65
42
- path = what remembers across cycles (pheromone strength / resistance)
48
+ path = what remembers across cycles (strength / resistance)
43
49
  ```
44
50
 
45
51
  Why: the substrate measures **width** by tasks-per-wave, **depth** by
@@ -52,7 +58,7 @@ from outside the substrate.
52
58
 
53
59
  **Every loop reports verified numbers, not vibes.** Tests passed/total.
54
60
  Build time in ms. Deploy time per service. Health check latency. Rubric
55
- dimension scores. These are the deterministic signals that calibrate pheromone.
61
+ dimension scores. These are the deterministic signals that calibrate path strength.
56
62
 
57
63
  ```typescript
58
64
  // Every loop ends like this — not "done", but "done with receipts"
@@ -60,8 +66,8 @@ dimension scores. These are the deterministic signals that calibrate pheromone.
60
66
  passed: 320,
61
67
  failed: 0,
62
68
  buildMs: 22995,
63
- deployMs: { gateway: 13705, sync: 8249, nanoclaw: 9163, pages: 17391 },
64
- health: { gateway: 292, sync: 270, nanoclaw: 270 },
69
+ deployMs: { web: 13705, sync: 8249, channels: 9163, api: 17391 },
70
+ health: { web: 292, sync: 270, channels: 270 },
65
71
  // /do code rubric — security/stability/simplicity/speed, gate ≥ 0.65
66
72
  rubric: { security: 0.92, stability: 0.85, simplicity: 0.90, speed: 0.80 }
67
73
  }
@@ -73,153 +79,48 @@ it's learning. A loop that can't report deterministic results can't
73
79
  sandwich applied to every automation skill.
74
80
 
75
81
  **Where it shows up:**
76
- - `/work` — reports task count, tests passed, time spent
77
- - `/wave` — reports dissolved/marked/warned agent counts per wave
82
+ - `/do` — W4 reports tests passed/total, reconcile canons, rubric scores
83
+ - `/close` — reports rubric score (security + stability + simplicity + speed, composite ≥ 0.65) + learnings entry
78
84
  - `/sync` — reports tasks synced, hash-delta, KV writes
79
85
  - `/deploy` — reports W0 results, build ms, per-service deploy ms, health
80
- - `/done` — reports rubric score (security + stability + simplicity + speed, composite ≥ 0.65)
81
- - growth tick — reports per-loop timings (L1-L7 lastAtMs, nextAtMs)
82
86
 
83
87
  If you can't measure it, you can't route around it.
84
88
 
85
89
  ---
86
90
 
87
- ## The Substrate
88
-
89
- ```
90
- ~90 lines. Zero returns. Two fields. Queue.
91
-
92
- { receiver, data }
93
-
94
- That's all that flows.
95
- The runtime moves signals. TypeDB remembers.
96
- ```
97
-
98
- ---
99
-
100
- ## Two Layers
101
-
102
- ```
103
- NERVOUS SYSTEM (runtime) BRAIN (TypeDB)
104
- signals, strength, resistance, queue paths, units, skills, knowledge
105
- loops L1-L3 (ms to minutes) loops L4-L7 (hours to weeks)
106
- ```
107
-
108
- The runtime handles what moves. TypeDB handles what remains.
109
-
110
- ---
111
-
112
- ## Tasks = Handlers, Dependencies = Continuations
113
-
114
- ```typescript
115
- // Tasks are .on() handlers on units
116
- // Dependencies are .then() continuations
117
- const bob = net.add('bob')
118
- .on('schema', async (data, emit) => buildSchema(data))
119
- .then('schema', r => ({ receiver: 'bob:api', data: r }))
120
- .on('api', async (data, emit) => buildAPI(data))
121
- .then('api', r => ({ receiver: 'bob:test', data: r }))
122
-
123
- // No task entities. No dependency relations. No trail relations.
124
- // Pheromone accumulates on paths automatically.
125
- ```
126
-
127
- ---
128
-
129
- ## Agent Self-Improvement
130
-
131
- Units have `model`, `system-prompt`, `generation`.
132
- The substrate measures performance. When it's bad enough, the agent evolves.
133
-
134
- ```typescript
135
- // TypeDB detects
136
- needs_evolution(unit) → success-rate < 0.50, sample-count >= 20
137
-
138
- // Agent responds
139
- unit.system-prompt = rewrite(old-prompt, failures)
140
- unit.generation++
141
- ```
142
-
143
- Two layers of learning:
144
- - **Substrate** — pheromone on paths. World gets smarter.
145
- - **Agent** — prompt/model evolution. Individual gets smarter.
146
-
147
- ---
148
-
149
91
  ## Signal
150
92
 
151
93
  ```typescript
152
94
  type Signal = {
153
- receiver: string // "unit" or "unit:task"
154
- data?: unknown // { tags?, weight?, content? } by convention
95
+ receiver: string // "family" or "family:action"
96
+ data?: unknown // typed per receiver via RECEIVERS catalog
155
97
  }
156
98
  ```
157
99
 
158
- The universal primitive. `data` is untyped convention shapes it:
159
- `tags` (routing/classification), `weight` (pheromone deposit), `content` (payload).
100
+ The universal primitive `{ receiver, data }` is frozen. Capability contracts
101
+ live in the receiver registry (`@oneie/sdk/receivers`); the schema is truth for data.
160
102
 
161
103
  ---
162
104
 
163
- ## Unit
164
-
165
- ```typescript
166
- unit(id, route?)
167
- .on(name, fn) // define task (handler)
168
- .then(name, template) // define continuation (dependency)
169
- .role(name, task, ctx) // context-bound task
170
- .has(name) // introspection
171
- .list() // introspection
172
- .id // identity
173
- ```
174
-
175
- ### Task Signature
105
+ ## World (the pheromone primitives)
176
106
 
177
- ```typescript
178
- (data, send, ctx) => result
179
-
180
- data // the data
181
- send // (signal) => void — fan out
182
- ctx // { from: string, self: string }
183
- ```
184
-
185
- ---
186
-
187
- ## World
107
+ Shipped surface — `createWorld()` in `one.ie/web/src/lib/pheromone.ts`
108
+ (vendored in-RAM for DO bundles; mirrors the SDK verb semantics):
188
109
 
189
110
  ```typescript
190
- world()
191
- .add(id) // create unit (auto-drains queued signals)
192
- .remove(id) // remove unit (trails remain, fade naturally)
193
- .signal(signal, from?) // route signal, mark pheromone
194
- .enqueue(signal) // queue for later processing
195
- .drain() // shift from queue, signal it
196
- .pending() // queue length
197
- .mark(edge, strength?) // strengthen path
198
- .warn(edge, strength?) // weaken path
199
- .sense(edge) // read strength
200
- .danger(edge) // read resistance
201
- .follow(type) // best path (deterministic)
202
- .select(type?) // best path (probabilistic, ant-like)
203
- .fade(rate?) // decay all paths (resistance 2x faster)
204
- .highways(limit?) // top weighted paths
205
- .has(id) // introspection
206
- .list() // introspection
207
- .get(id) // direct access
111
+ world.mark(edge, w?) // strengthen path
112
+ world.warn(edge, w?) // weaken path (resistance)
113
+ world.sense(edge) // read strength
114
+ world.follow(from) // best path (deterministic)
115
+ world.select(from) // best path (probabilistic, ant-like)
116
+ world.highways(prefix?, n?) // top weighted paths
117
+ world.fade(rate?) // decay all paths (resistance 2x faster)
118
+ world.serialize() // snapshot for KV
119
+ world.restore(snapshot) // rehydrate
208
120
  ```
209
121
 
210
- ---
211
-
212
- ## Persist
213
-
214
- ```typescript
215
- persist() // extends world with TypeDB
216
- .actor(id, kind?, opts?) // add + persist
217
- .flow(from, to) // mark/warn wrapper
218
- .open(n?) // top paths as {from, to, strength}
219
- .blocked() // toxic paths
220
- .know() // promote highways to knowledge
221
- .recall(match?) // query knowledge from TypeDB
222
- ```
122
+ Over HTTP the same verbs are `SubstrateClient` methods (`packages/sdk/src/client.ts`).
123
+ `harden` is exposed via `signal("learning:know")`.
223
124
 
224
125
  ---
225
126
 
@@ -228,70 +129,25 @@ persist() // extends world with TypeDB
228
129
  Positive flow only. Silence is valid.
229
130
 
230
131
  ```typescript
231
- // GOOD
232
- task?.(data, emit, ctx).then(result =>
233
- next[name] && route?.(next[name](result), receiver)
234
- )
132
+ // GOOD — missing handler? Signal dissolves. World continues.
133
+ handler?.(data, send, ctx)
235
134
 
236
135
  // BAD
237
- if (!task) return reject(...)
136
+ if (!handler) return reject(...)
238
137
  if (!target) throw new Error(...)
239
138
  ```
240
139
 
241
- Missing handler? Signal dissolves. Group continues.
242
-
243
- ---
244
-
245
- ## The Tick
246
-
247
- ```typescript
248
- const next = net.select() // follow pheromone
249
- next && net.signal({ receiver: next }) // execute
250
- net.drain() // process queue
251
- net.fade(0.05) // decay
252
- // evolve every 10min, know every hour
253
- ```
254
-
255
- ---
256
-
257
- ## Signal Flow
258
-
259
- ```
260
- signal(sig, from='entry')
261
- → unit(sig, from)
262
- → task(data, send, {from, self})
263
- → send(sig) // fan out
264
- → signal(sig, from=self)
265
- → mark(edge) // path remembers
266
- → .then(task) // continuation fires
267
- → signal(next) // chain continues
268
- ```
269
-
270
- Concurrency safe. No global state.
271
-
272
- ---
273
-
274
- ## Multi-Machine Collaboration
275
-
276
- ```
277
- Machine A Machine B
278
- ┌──────────┐ ┌──────────┐
279
- │ router │──signal──→ TypeDB ←──signal──│ router │
280
- │ │←─paths───→ ←──paths──│ │
281
- └──────────┘ └──────────┘
282
- ```
283
-
284
- Each machine runs one router process. TypeDB is shared.
285
- Pheromone builds across machines. The substrate learns end-to-end paths.
140
+ A dissolved signal still closes its loop — the *caller* sees `kind: "dissolved"`
141
+ and warns the edge (Rule 1). Dissolve is an outcome, not an exception.
286
142
 
287
143
  ---
288
144
 
289
- *Signal. Mark. Warn. Follow. Fade. Highway. Queue. Evolve. Know.*
145
+ *The 6 verbs: signal · mark · warn · fade · follow · harden.*
290
146
 
291
147
  ---
292
148
 
293
149
  ## Verb Contracts
294
150
 
295
- Each of the 6 verbs has a **pre / post / invariant** contract. Spec lives in `text/contracts-plan.md` — loaded only when editing a verb implementation, not every session.
151
+ Each of the 6 verbs has a **pre / post / invariant** contract. Spec lives in `text/contracts.md` — loaded only when editing a verb implementation, not every session.
296
152
 
297
- New verb? You need: contract block in `text/contracts-plan.md`, row in `one-ie/CLAUDE.md` § The 6 verbs, contract gate in `.claude/agents/w4-verify.md` step 2.5. If you can't write the contract, you can't ship the verb.
153
+ New verb? You need: contract block in `text/contracts.md`, row in `one-ie/CLAUDE.md` § The 6 verbs, contract gate in `.claude/agents/w4-verify.md` step 2.5. If you can't write the contract, you can't ship the verb.
@@ -31,7 +31,7 @@ const DIMS = [
31
31
  { key: "goal-fit", weight: 0.35, instruction: "Score goal-fit: does the diff advance the plan outcome? Read Goal/deliverable from the spec. 0 = no movement, 1 = fully delivers." },
32
32
  // These are grep-pattern strings sent to the LLM for it to search — not code being executed.
33
33
  { key: "security", weight: 0.20, instruction: "Score security: check for hardcoded secrets, calls to eval, dangerouslySetInnerHTML, missing Zod at API boundaries, wildcard CORS, TypeQL string concat. 1 = all greps return 0." },
34
- { key: "stability", weight: 0.20, instruction: "Score stability: check new `any`, @ts-ignore without comment, silent returns, retired names (knowledge|connections|people|node|scent|alarm|trail|colony). 1 = all zero." },
34
+ { key: "stability", weight: 0.20, instruction: "Score stability: check new `any`, @ts-ignore without comment, silent returns, retired names (knowledge|connections|people|node|scent|trail|colony|pheromone). 1 = all zero." },
35
35
  { key: "simplicity", weight: 0.15, instruction: "Score simplicity: focused single-purpose files, functions under 20 lines, no backwards-compat shims or WHAT comments. 1 = tight, no ceremony." },
36
36
  { key: "speed", weight: 0.10, instruction: "Score speed: does the diff increase bundle size or build time? Any new client:load where client:idle suffices? 1 = no regressions." },
37
37
  { key: "adversarial", weight: 0, instruction: "Adversarial check: is there any finding that should block this cycle? If yes, name it briefly. If nothing blocks, return null for 'finding'." },
@@ -15,6 +15,8 @@ You are the {name} agent. {One sentence role statement.}
15
15
 
16
16
  **Output:** {format of the result — structured, bounded, cited}
17
17
 
18
+ **Escalate, don't guess.** Ambiguous or under-specified input → return a `needs: {what}` receipt and stop. Never assume a missing value.
19
+
18
20
  ## Model · Effort dial
19
21
 
20
22
  | Model | Effort | Use when |
@@ -45,6 +47,17 @@ You are the {name} agent. {One sentence role statement.}
45
47
 
46
48
  {json signal receiver and shape}
47
49
 
50
+ ## Example (one filled pass — the shape to copy)
51
+
52
+ **Input:** `{ targets: ["src/lib/foo.ts", "src/lib/bar.ts"], mode: "RECON" }`
53
+
54
+ **Output:**
55
+ ```json
56
+ { "receiver": "recon:done", "files": 2,
57
+ "findings": [{ "file": "src/lib/foo.ts", "exports": ["fooClient"], "relevance": 0.8 }],
58
+ "receipt": "2 files · 1 high-signal · bar.ts filtered (relevance 0.3)" }
59
+ ```
60
+
48
61
  ## Out of scope
49
62
 
50
63
  - {what this agent never does}
@@ -22,6 +22,10 @@ type: feature
22
22
 
23
23
  ## The promise (PROVE checks this)
24
24
  {One paragraph — concrete enough to prove. What the user sees, clicks, or gets back. Specific nouns. No hedging.}
25
+ {One line — and what it deliberately does NOT do, so scope can't creep: "Not this: {the adjacent thing we leave out}."}
26
+
27
+ ## The proof (the one observable the whole spine points at)
28
+ {ONE checkable thing that is true only if the promise is kept — a screen that renders, a command that exits 0, a response shape. Name it once here; DESIGN's pre-mortem tests, the todo's `outcome:` command, the TEST assertion, and TEACH's "verify it's working" all reference THIS — never a loose restatement.}
25
29
 
26
30
  ## Tone
27
31
  {Voice contract keywords for this surface — 3-5 words that capture the feel. These come from .claude/product-marketing.md.}
@@ -18,9 +18,10 @@ source_of_truth:
18
18
 
19
19
  # {Title}
20
20
 
21
- ## The promise (from FRAME)
21
+ ## The promise (from PROMISE)
22
22
 
23
23
  {One line, copied from text/<feature>.md — the design exists to keep this promise.}
24
+ {The one proof observable, copied from the promise — every decision below is measured against keeping it true.}
24
25
 
25
26
  ## Reuse verdict (from SURVEY)
26
27
 
@@ -40,10 +41,14 @@ source_of_truth:
40
41
  ### UI
41
42
  {Which existing components / pages / navigation this composes. Empty / loading / error / edge states named here, not deferred to BUILD.}
42
43
 
43
- ## Substrate reconciliation (gate — zero new core concepts without justification)
44
+ ## Reconciliation (gate — reconcile against every canon this design touches)
44
45
 
45
- - [ ] Names exist in `dictionary.md` (no dead names)
46
- - [ ] No new dimension / verb / type — or one-sentence justification: {…}
46
+ The 7 canons: `substrate · dictionary · authority · sdk · design · navigation · types`. Tick only those this design touches; each becomes a `do-reconcile.sh <canon>` gate at W4.
47
+
48
+ - [ ] **dictionary** — names exist in `text/dictionary-plan.md`; no dead name, no synonym
49
+ - [ ] **substrate** — extends `schema/one.tql`, never forks; no new dimension/verb (or one-sentence justification: {…})
50
+ - [ ] **navigation** — every new surface names its manifest entry + ≥1 inbound link *here*, not deferred to BUILD
51
+ - [ ] **authority** — access resolves by the walk-up; no ad-hoc role-equality check
47
52
  - [ ] No locked-rule break (6 dims, 6 verbs, 3 rules)
48
53
 
49
54
  ## Pre-mortem (assume it shipped and failed — why?)
@@ -2,33 +2,74 @@
2
2
  slug: {{slug}}
3
3
  written: {{YYYY-MM-DD}}
4
4
  proven: true
5
+ audience: humans + agents
5
6
  promise: text/{{slug}}.md
6
7
  ---
7
8
 
8
9
  # {{Feature Name}}
9
10
 
10
- > Written after PROVE passes. Describes behavior that exists, not behavior that is planned.
11
- > The promise (`text/{{slug}}.md`) is what this doc must match.
11
+ > {{One line the promise kept, in the reader's own words. This is the hook. Make them want the next sentence.}}
12
12
 
13
- ## What it does
13
+ <!-- Written AFTER PROVE passes. Every claim below is proven behavior, never planned. The promise (text/{{slug}}.md) is the spec this doc must match. -->
14
14
 
15
- {{1–3 sentences. What the user/operator gets. Every claim here must be in the proven behavior.}}
15
+ ## Why this exists
16
16
 
17
- ## How to use it
17
+ {{2–4 sentences. The world *before* this feature — the friction, the wait, the thing that was hard or impossible. Name the pain the reader already feels, so everything after lands as relief. Plain English, no jargon. Earn the reader before you teach them.}}
18
18
 
19
- {{The golden path. Step-by-step. Present tense. Tested commands only.}}
19
+ ## What you get
20
+
21
+ {{1–3 sentences. The capability in the reader's words — what they can do now that they couldn't before. This is the "after" to the "Why this exists" "before." One clean promise, no list of features.}}
22
+
23
+ ## The mental model
24
+
25
+ {{The one idea that makes everything else obvious. One short paragraph — or the small diagram below. Hold this shape in your head and every step clicks. Great docs hand you the model first; weak docs make you reverse-engineer it from the steps. Use an analogy only if it is exact.}}
26
+
27
+ ```
28
+ {{optional — a 3–6 line shape: the thing, what goes in, what comes out}}
29
+ ```
30
+
31
+ ## Your first win (60 seconds)
32
+
33
+ The shortest path to a working result. Copy, paste, watch it work — then you'll trust the rest.
20
34
 
21
35
  ```bash
22
- # Example — copy-pasteable, verified to work
36
+ # Copy-pasteable. Verified to work. The fastest route to a green result.
37
+ {{the one command — or 2–3 lines — that produce a visible win}}
23
38
  ```
24
39
 
40
+ You'll see {{the exact observable result: the line of output, the screen, the file that appears}}. That is the whole thing working. Everything below is depth, not prerequisite.
41
+
42
+ ## The walkthrough
43
+
44
+ The full path, one step at a time. Each step says what you do, what you'll see, and why it matters — so you are never typing on faith.
45
+
46
+ ### 1. {{Step name — start with a verb}}
47
+
48
+ {{What this step does and why, in 1–2 sentences.}}
49
+
50
+ ```bash
51
+ {{command}}
52
+ ```
53
+
54
+ {{What you see, and how you know it worked. Show the expected output — don't make the reader guess.}}
55
+
56
+ ### 2. {{Step name}}
57
+
58
+ {{Repeat. Number every step. Show the result after each. Call out the one place people slip — inline, right before they would hit it, not in a footnote.}}
59
+
60
+ ### 3. {{Step name}}
61
+
62
+ {{The final step lands the reader exactly at the goal from "What you get." Close the loop out loud: "You now have {{the outcome}}."}}
63
+
25
64
  ## Reference
26
65
 
27
- | Concept | Where |
28
- |---------|-------|
29
- | {{name}} | {{`file:line` or section link}} |
30
- | Script | `.claude/scripts/{{relevant-script}}.sh` |
31
- | Template | `text/template-{{template}}.md` |
66
+ Everything you'll look up later, scannable at a glance. **Agents: this is the contract** — exact names, paths, signatures, no prose required.
67
+
68
+ | Thing | What it is | Where |
69
+ |---|---|---|
70
+ | {{name}} | {{one line}} | {{`file:line` or link}} |
71
+ | {{command / flag}} | {{what it does}} | {{usage}} |
72
+ | Script | {{what it runs}} | `.claude/scripts/{{script}}.sh` |
32
73
 
33
74
  ---
34
75
 
@@ -36,24 +77,48 @@ promise: text/{{slug}}.md
36
77
 
37
78
  ### Verify it's working
38
79
 
80
+ The proof command from PROVE, reusable as a health check. Green here means the feature is live.
81
+
39
82
  ```bash
40
- # The proof command from the PROVE step — still valid as a health check
83
+ {{the proof command}}
84
+ # Expected: {{the exact passing output}}
41
85
  ```
42
86
 
43
- ### Common issues
87
+ ### When something breaks
44
88
 
45
- | Symptom | Cause | Fix |
46
- |---------|-------|-----|
47
- | {{symptom}} | {{cause}} | {{fix}} |
89
+ | You see | It means | Do this |
90
+ |---|---|---|
91
+ | {{symptom}} | {{cause}} | {{the exact fix — a command, not advice}} |
48
92
 
49
93
  ### Rollback
50
94
 
51
- {{What to undo if this needs to be reverted. Specific commands, not vague guidance.}}
95
+ {{The exact way back. Specific commands, in order. The reader is stressed when they reach this section be precise, be calm, be complete. Leave nothing to infer.}}
96
+
97
+ ## Where to go next
98
+
99
+ {{1–3 pointers: the adjacent feature, the deeper doc, the thing this unlocks. Leave the reader knowing which door to open next.}}
52
100
 
53
101
  <!--
54
- TEACH stop rules (from do.md):
55
- - Write AFTER PROVE passes (proven: true in frontmatter marks this)
56
- - Match the promise: every user-facing claim must appear in text/{{slug}}.md
57
- - Doc + runbook in one file; presence check is: test -f text/{{slug}}-doc.md
58
- - do-reconcile.sh dictionary on this file before committing (no dead names)
102
+ TEACH template the doc that brings humans AND agents on a journey.
103
+
104
+ VOICE friendly · authoritative · clear · succinct · complete:
105
+ - Talk to one reader. "You", never "the user." Warm, never chatty.
106
+ - Authoritative = you have done this and it works. Show, don't hedge. No "should probably", no "might."
107
+ - Succinct = every sentence earns its place. Cut adverbs. Depth through brevity — see .claude/product-marketing.md.
108
+ - Complete = no step assumed, no command untested, no output unshown. A reader holding ONLY this doc can succeed.
109
+ - Plain English. A CEO and an engineer read the same words. Banned-jargon list lives in .claude/product-marketing.md.
110
+
111
+ THE JOURNEY — why → what → model → first win → walkthrough → reference → runbook → next:
112
+ - Motivation before mechanics. The reader must WANT it before they learn it.
113
+ - Model before steps. Give the shape; the steps then click into it.
114
+ - A win before the depth. One fast success buys patience for everything after.
115
+ - Every command copy-pasteable and verified. Every step shows its expected output.
116
+ - Two audiences, one doc: humans read the prose top-to-bottom for the journey; agents jump to Reference + Runbook for the contract. Serve both — narrative for the journey, tables for the lookup. Never make a human scan a table for motivation, or an agent read prose for a path.
117
+
118
+ STOP RULES (from do.md):
119
+ - Write AFTER PROVE passes (proven: true in frontmatter). Proven behavior only — never planned.
120
+ - Match the promise: every user-facing claim appears in text/{{slug}}.md.
121
+ - Doc + runbook in one file. Presence check: test -f text/{{slug}}-doc.md.
122
+ - Run do-reconcile.sh dictionary on this file before committing (no dead names, no new synonyms).
123
+ - Draft with the `tutorial` skill, tighten with the `writer` skill.
59
124
  -->
@@ -1,34 +1,34 @@
1
1
  ---
2
2
  slug: {{slug}}
3
- surface: {{frontend|api|backend|substrate}}
4
3
  cycle: {{C1}}
5
4
  folder: {{one.ie/web|packages/sdk|channels}}
5
+ demo: # this file IS the cycle's demo gate — the todo references it by this command
6
+ command: "bun vitest run {{folder}}/tests/e2e/{{cycle}}.test.ts"
7
+ asserts: "{{the promise's one proof observable — what passing means}}"
8
+ budget: "<2s wall · ≤80 LOC"
6
9
  deliverables:
7
10
  - {{D1 — what it asserts}}
8
11
  ---
9
12
 
10
13
  # Tests — {{slug}} · {{cycle}}
11
14
 
12
- > One `expect()` per deliverable — assert the destination, not the path.
13
- > Run: `bun run verify` in `{{folder}}/`
14
- > Written first (before W3 edits land), verified at W4.
15
+ > One `expect()` per deliverable — **assert the destination, not the path.**
16
+ > The assertion is the promise's proof observable restated as code — nothing new.
17
+ > Write it FIRST: it must **fail before W3 lands (red), pass after (green).**
18
+ > Run: `bun run verify` in `{{folder}}/`.
15
19
 
16
20
  ## {{D1 — user-facing outcome}}
17
21
 
18
22
  ```typescript
19
23
  import { describe, it, expect } from 'vitest'
20
- // import { {{thing}} } from '{{path}}'
24
+ // import { {{thing}} } from '{{path}}' // one import per file — no cross-cycle coupling
21
25
 
22
26
  describe('{{slug}} · {{deliverable}}', () => {
23
- it('{{outcome a user would care about}}', async () => {
24
- // arrange
25
- // const input = ...
26
-
27
- // act
28
- // const result = await ...
29
-
30
- // assert
31
- // expect(result).toBe(...)
27
+ it('{{the outcome a user cares about}}', async () => {
28
+ const result = await {{run the real thing}}
29
+ expect(result).toBe({{the destination}})
30
+ // ✓ destination: expect(getStrength(edge)).toBe(1)
31
+ // ✗ not the path: expect(button).toHaveClass('bg-primary')
32
32
  })
33
33
  })
34
34
  ```
@@ -151,11 +151,13 @@ Every artifact reconciles against the canons that apply to its category. Running
151
151
  | **PROOF** | test · e2e · a11y | goal / outcome | asserts the destination, not the path; exits 0 |
152
152
  | **TEACH** | doc · runbook · tutorial | Dictionary (names + links) | no stale name, no dead link |
153
153
 
154
- **The naming law:** `template-<suffix>.md` fills to `<slug>-<suffix>.md`. Four templates, four phases:
154
+ **The naming law:** `template-<suffix>.md` fills to `<slug>-<suffix>.md`. Six templates, one per spine stop that writes an artifact:
155
155
  - `template-feature.md` → `<slug>.md` (PROMISE)
156
156
  - `template-plan.md` → `<slug>-plan.md` (DESIGN)
157
157
  - `template-todo.md` → `<slug>-todo.md` (PLAN)
158
- - `template-agent.md` → `.claude/agents/<name>.md` (BUILD)
158
+ - `template-agent.md` → `.claude/agents/<name>.md` (BUILD — the one exception: agents live in `.claude/agents/`, not `text/`)
159
+ - `template-tests.md` → `<slug>-tests.md` or `tests/e2e/<cycle>.test.ts` (TEST)
160
+ - `template-teach.md` → `<slug>-doc.md` (TEACH)
159
161
 
160
162
  ## Reuse contract (read before drafting any cycle)
161
163
 
@@ -185,7 +187,7 @@ match wins; only fall through to "new file" if every layer fails.
185
187
  | 2. **Cross-surface composition** | sibling component folders (`chat/`, `crm/`, `cards/`, `in/`, `settings/`) | import + slot — do not copy |
186
188
  | 3. **Design primitives** | `web/src/components/ai-elements/`, `web/src/components/ui/` | compose the primitive into a parent; never reimplement |
187
189
  | 4. **Library primitives** | `@/lib/`, `@/engine/`, existing hooks | reuse the helper; do not parallel-write |
188
- | 5. **Skill / rule packs** | `.claude/skills/`, `.claude/rules/` | invoke the existing skill; do not inline its knowledge |
190
+ | 5. **Skill / rule packs** | `.claude/skills/`, `.claude/rules/` | invoke the existing skill; do not inline its guidance |
189
191
  | 6. **New file** | only if 1-5 all fail | requires the W2 justification line above |
190
192
 
191
193
  **Anti-patterns rejected on sight:**
@@ -337,7 +339,7 @@ Pin shared names, CLI signatures, and design decisions **here**, before drawing
337
339
  | 4 | Self-test protocol | `do-reconcile.sh navigation --self-test` exits 0 |
338
340
  | 5 | Agent invocation strings | `do-reconcile.sh <canon> <file>` per category |
339
341
  | 6 | Shadow → live rename map | `do2-reconcile.sh → do-reconcile.sh` |
340
- | 7 | Template names | `template-feature.md · template-plan.md · template-todo.md · template-agent.md` |
342
+ | 7 | Template names | `template-feature · plan · todo · agent · tests · teach` (six, one per artifact-writing stop) |
341
343
  | 8 | W2 delegation | W2 = spawned single Opus agent; conductor stays Sonnet |
342
344
 
343
345
  **Contract test:** could every cycle's W2 fill in its diff specs right now, without waiting for another cycle? If yes → contract complete. If no → pin the missing decision before drawing any arrow.
@@ -714,8 +716,8 @@ Report: `delta_tsc=±N delta_loc=±N compress_orphans=N new_files=N primitiv
714
716
  - `text/template-feature.md` — the PROMISE template (PROMISE phase)
715
717
  - `docs/relevant-spec.md` — {why relevant to this plan}
716
718
  - `src/relevant/file.ts` — {why relevant}
717
- - `one/dictionary.md` — canonical names (always)
718
- - `one/rubrics.md` — scoring bands (always)
719
+ - `text/dictionary-plan.md` — canonical names (always)
720
+ - `text/rubrics-plan.md` — scoring bands (always)
719
721
 
720
722
  ---
721
723
 
@@ -777,5 +779,5 @@ nothing in this codebase is built on bare ground.
777
779
 
778
780
  **context_triggers:**
779
781
  - Pattern is matched against W1 findings (file paths + excerpts) — regex, case-insensitive
780
- - Inject only the *section* you need: `"one/signals.md § Six Verbs"` not the whole file
782
+ - Inject only the *section* you need: `"text/dsl-plan.md § Six Verbs"` not the whole file
781
783
  - If you don't know which patterns will fire, leave empty — do.md's built-in triggers still apply