@pilotspace/add 1.17.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/GETTING-STARTED.md +20 -64
  3. package/README.md +128 -56
  4. package/agents/add.md +68 -0
  5. package/bin/cli.js +86 -21
  6. package/package.json +2 -3
  7. package/personas-teacher/VENDOR.md +6 -0
  8. package/skill/add/SKILL.md +100 -134
  9. package/skill/add/adopt.md +28 -0
  10. package/skill/add/beyond.md +36 -0
  11. package/skill/add/deltas.md +25 -2
  12. package/skill/add/design.md +56 -74
  13. package/skill/add/{report-template.md → gate-udd.md} +28 -38
  14. package/skill/add/intake.md +56 -25
  15. package/skill/add/loop.md +32 -19
  16. package/skill/add/phases/build.md +78 -0
  17. package/skill/add/phases/direction.md +280 -0
  18. package/skill/add/phases/verify.md +160 -0
  19. package/skill/add/run.md +11 -18
  20. package/skill/add/terms.md +18 -0
  21. package/tooling/add.py +2383 -3261
  22. package/tooling/add_engine/autonomy.py +2 -37
  23. package/tooling/add_engine/components.py +4 -87
  24. package/tooling/add_engine/constants.py +145 -91
  25. package/tooling/add_engine/guidelines.py +9 -11
  26. package/tooling/add_engine/io_state.py +69 -2
  27. package/tooling/add_engine/predicates.py +90 -2
  28. package/tooling/add_engine/search.py +6 -6
  29. package/tooling/add_engine/taskdoc.py +15 -10
  30. package/tooling/templates/CONVENTIONS.md.tmpl +1 -1
  31. package/tooling/templates/GLOSSARY.md.tmpl +10 -4
  32. package/tooling/templates/MILESTONE.md.tmpl +20 -16
  33. package/tooling/templates/PLAN.md.tmpl +128 -0
  34. package/tooling/templates/PROJECT.md.tmpl +6 -1
  35. package/tooling/templates/PROMPT.persona.md.tmpl +17 -21
  36. package/tooling/templates/personas/_template.md.tmpl +33 -29
  37. package/tooling/templates/personas/build-engineer.md.tmpl +45 -0
  38. package/tooling/templates/personas/data-steward.md.tmpl +45 -0
  39. package/tooling/templates/personas/evidence-verifier.md.tmpl +45 -0
  40. package/tooling/templates/personas/platform-engineer.md.tmpl +45 -0
  41. package/tooling/templates/personas/product-lead.md.tmpl +51 -0
  42. package/tooling/templates/personas/quality-auditor.md.tmpl +47 -0
  43. package/tooling/templates/personas/release-manager.md.tmpl +52 -0
  44. package/tooling/templates/personas/security-gatekeeper.md.tmpl +45 -0
  45. package/tooling/templates/personas/software-architect.md.tmpl +45 -0
  46. package/tooling/templates/personas/stream-orchestrator.md.tmpl +44 -0
  47. package/tooling/templates/personas/technical-writer.md.tmpl +49 -0
  48. package/tooling/templates/personas/ux-experience-lead.md.tmpl +48 -0
  49. package/tooling/templates/specs/SPEC.md.tmpl +18 -0
  50. package/tooling/templates/udd-wireframe.md +1 -1
  51. package/agents/add-advisor.md +0 -31
  52. package/agents/add-build.md +0 -29
  53. package/agents/add-design.md +0 -32
  54. package/agents/add-persona.md +0 -33
  55. package/agents/add-verify.md +0 -36
  56. package/docs/00-introduction.md +0 -46
  57. package/docs/01-principles.md +0 -71
  58. package/docs/02-the-flow.md +0 -113
  59. package/docs/03-step-1-specify.md +0 -123
  60. package/docs/04-step-2-scenarios.md +0 -90
  61. package/docs/05-step-3-contract.md +0 -80
  62. package/docs/06-step-4-tests.md +0 -85
  63. package/docs/07-step-5-build.md +0 -82
  64. package/docs/08-step-6-verify.md +0 -105
  65. package/docs/09-the-loop.md +0 -75
  66. package/docs/10-setup-and-stages.md +0 -118
  67. package/docs/11-governance.md +0 -91
  68. package/docs/12-roles.md +0 -99
  69. package/docs/13-adoption.md +0 -67
  70. package/docs/14-foundation.md +0 -142
  71. package/docs/15-foundations-and-lineage.md +0 -106
  72. package/docs/16-releasing.md +0 -182
  73. package/docs/17-components.md +0 -143
  74. package/docs/18-personas.md +0 -80
  75. package/docs/README.md +0 -77
  76. package/docs/add-competencies.png +0 -0
  77. package/docs/add-flow.png +0 -0
  78. package/docs/add-foundation.png +0 -0
  79. package/docs/add-hierarchy.png +0 -0
  80. package/docs/add-milestone-task-lifecycle.png +0 -0
  81. package/docs/add-task-growth-wheel.png +0 -0
  82. package/docs/appendix-a-templates.md +0 -88
  83. package/docs/appendix-b-prompts.md +0 -154
  84. package/docs/appendix-c-glossary.md +0 -176
  85. package/docs/appendix-d-worked-example.md +0 -231
  86. package/docs/appendix-e-checklists.md +0 -92
  87. package/docs/appendix-f-requirements-matrix.md +0 -171
  88. package/docs/appendix-g-references.md +0 -106
  89. package/skill/add/advisor.md +0 -81
  90. package/skill/add/compact-foundation.md +0 -40
  91. package/skill/add/components.md +0 -52
  92. package/skill/add/confidence.md +0 -32
  93. package/skill/add/fold.md +0 -63
  94. package/skill/add/graduate.md +0 -39
  95. package/skill/add/phases/0-ground.md +0 -64
  96. package/skill/add/phases/0-setup.md +0 -103
  97. package/skill/add/phases/1-specify.md +0 -61
  98. package/skill/add/phases/2-scenarios.md +0 -48
  99. package/skill/add/phases/3-contract.md +0 -60
  100. package/skill/add/phases/4-tests.md +0 -61
  101. package/skill/add/phases/5-build.md +0 -62
  102. package/skill/add/phases/6-verify.md +0 -69
  103. package/skill/add/phases/7-observe.md +0 -45
  104. package/skill/add/phases/fast-lane.md +0 -34
  105. package/skill/add/release.md +0 -61
  106. package/skill/add/scope.md +0 -72
  107. package/skill/add/self-improve.md +0 -20
  108. package/skill/add/sensitivity.md +0 -51
  109. package/skill/add/setup-review.md +0 -48
  110. package/skill/add/soul.md +0 -58
  111. package/skill/add/streams.md +0 -269
  112. package/tooling/add_engine/release.py +0 -86
  113. package/tooling/templates/TASK.fast.md.tmpl +0 -78
  114. package/tooling/templates/TASK.md.tmpl +0 -181
@@ -0,0 +1,280 @@
1
+ # Direction — the whole specification bundle (setup · rules · plan · red suite) to the ONE freeze
2
+
3
+ Every task drafts §1–§4 top-to-bottom, then ONE human approval crosses it into build:
4
+ `add.py freeze --by <name> --cross`. This file is the reference depth for that span —
5
+ SKILL.md carries the loop; read the section you're stuck in, not the file.
6
+
7
+ ---
8
+
9
+ ## Setup — first session only (autonomous draft → one baseline lock)
10
+
11
+ ## 1 · Zero-touch entry — you run init yourself
12
+
13
+ No `.add/state.json`? Run init yourself — never tell the human to. Infer name + stage from the
14
+ repo and **arm the baseline-approval gate** with `--await-lock`:
15
+
16
+ ```bash
17
+ python3 .add/tooling/add.py init --name "<inferred from repo/dir>" --stage <prototype|poc|mvp|production> --await-lock
18
+ ```
19
+
20
+ - `--await-lock` seeds an *unlocked* setup — the engine refuses build/`gate` until you `lock`; a plain `init` is grandfathered-locked (re-lock: `already_locked`).
21
+ - name + stage are **your judgment**: throwaway → `prototype`, risky slice → `poc`, narrow → `mvp`, full rigor → `production`.
22
+ - `init` prints your branch: `brownfield:` → existing code, map it SILENTLY (open `adopt.md`: fill each living documentation file from code, never clobber, tag `evidence-grounded` | `guessed`; ask the human nothing). No `brownfield:` → greenfield, run the 4-lens interview below.
23
+
24
+ ## 2 · Greenfield — the 4-lens interview: co-specify at foundation level
25
+
26
+ Ask one load-bearing question per lens (only the live ones), draft, rank lowest-confidence-first:
27
+
28
+ | Lens | The one question that unblocks the section |
29
+ |------|--------------------------------------------|
30
+ | Domain (DDD) | The 3–5 core nouns, and the one invariant that must NEVER break? |
31
+ | Spec (SDD) | The first milestone's outcome — and what's explicitly NOT in v1? |
32
+ | Users (UDD) | The primary user and the one job they hire this for? (or "no UI — surface is X") |
33
+ | Decisions | What's already decided that you'd regret re-litigating? (first Key Decision row) |
34
+
35
+ Rank: `⚠ <assumption> — lowest confidence because <why>; if wrong: <cost>` — tag thin answers
36
+ `guessed`. Under `autonomy: auto`, deepen all four drives in one pass (deepens drafting, never the
37
+ gate); capture each surfaced decision as an ADR in `PROJECT.md` **Key Decisions**.
38
+
39
+ ## 3 · Draft to the lock (both paths)
40
+
41
+ 1. **Pin invariants first — never defer.** The "never breaks" invariant + any imposed
42
+ run/entry contract (interpreter · port · packaging · protocol) land in PROJECT.md `invariants:`
43
+ NOW; every task's §3 Grounding re-states the ones it touches.
44
+ 2. **Seed, don't draft.** Fill ONLY the `goal:` line, the 4-lens seed answers, and the sections the
45
+ FIRST milestone touches (UI project: seed `DESIGN.md` per `design.md`; delete if no UI). Every
46
+ other section keeps its `<!-- living: fill on first touch -->` marker. One `generic` persona is
47
+ enough at setup; author per-role personas from the local teacher library
48
+ (`.add/personas-teacher/`) when a task first embodies the role.
49
+ 3. **Propose, then size it.** Float a kickoff suggestion (goal · flow · scenarios) for the first
50
+ milestone; on the human's reaction draft `MILESTONE.md` (Milestone scope drafting, below).
51
+ 4. **Create the first task and draft its bundle §1–§4** (`new-task` is allowed pre-lock; the red
52
+ suite must FAIL before build). Leave §3 `Status: DRAFT` — the lock is its approval; the engine
53
+ refuses build until you `lock` (`setup_unlocked`).
54
+ 5. **Write `.add/SETUP-REVIEW.md`** per `adopt.md`'s Setup review section: every drafted
55
+ decision, **lowest-confidence-first**, tagged `guessed` | `evidence-grounded`.
56
+
57
+ **Run mode** — propose before the lock, confirm-to-keep, record in PROJECT.md Key Decisions:
58
+
59
+ | Autonomy | Human gates |
60
+ |----------|-------------|
61
+ | **sequential · auto** *(default)* | contract freeze **only** — Verify auto-PASSes on evidence |
62
+ | **sequential · manual/conservative** | contract freeze **and** every Verify — safest |
63
+
64
+ One task at a time; raise the gate via `add.py autonomy set conservative --project` (or
65
+ `init --run-mode conservative`). Need concurrency? Spawn a subagent per task to run in parallel, its
66
+ model picked by task complexity (mid ordinary · top complex) — floor stays **one human approval per contract**.
67
+
68
+ ## 4 · The one human gate — the baseline approval
69
+
70
+ Open the report with the ARC per `gate-udd.md`, then present `SETUP-REVIEW.md`
71
+ lowest-confidence-first. They confirm **once** — an explicit yes; ambient agreement is not a
72
+ confirmation. **Never self-stamp a timeout — hold, or re-ask.** On that recorded confirmation, you run:
73
+
74
+ ```bash
75
+ python3 .add/tooling/add.py lock --by "<name>"
76
+ ```
77
+
78
+ Typing it themselves stays the escape hatch. The lock IS the first task's contract approval —
79
+ stamp its §3 `Status: FROZEN @ v1`, build is open.
80
+
81
+ <exit_gate>
82
+ - [ ] `.add/state.json` exists; setup seeded unlocked (`--await-lock`) then locked.
83
+ - [ ] Seed lines filled; untouched sections carry the living marker (brownfield: evidence-grounded from code).
84
+ - [ ] First task created; §1–§4 drafted — the red suite runs RED before build opens; `.add/SETUP-REVIEW.md` written lowest-confidence-first.
85
+ - [ ] Human confirmed the baseline approval and `add.py lock --by` ran with their name.
86
+ </exit_gate>
87
+
88
+ ---
89
+
90
+ ## Milestone scope drafting — a classified request into a versioned MILESTONE.md
91
+
92
+ Intake CLASSIFIES (`intake.md`); this rubric fills the confirmed `MILESTONE.md` (the
93
+ template is the SHAPE).
94
+ `new-major`/`sub-milestone` → draft ONE MILESTONE.md · `split_required` → draft ALL N as one
95
+ batch pass · `task`/`change-request` → no milestone (route per intake).
96
+ **Confirm before create is the convention** — one drafting pass, nothing written until the human confirms; enforced only
97
+ by the opt-in gate: `new-milestone <slug> --await-confirm` seeds it unconfirmed and HOLDS
98
+ `new-task` (`milestone_unconfirmed`) until you show the filled draft and run
99
+ `milestone-confirm <slug>`.
100
+
101
+ ## Position the goal FIRST — ground in assets, relate to the map
102
+
103
+ 1. **Ground in current assets** — the four §3 Grounding fields at milestone scope: **Touches**
104
+ (subsystems/files) · **Context** (docs · config · data) · **Honors** (`PROJECT.md`/
105
+ `CONVENTIONS.md` invariants) · **Anchors** (contracts/symbols tasks cite) — each from real
106
+ assets, never assumed. Record it as the milestone's `## Ground` — gathered ONCE; each task's
107
+ specify PROJECTS its §1 from it. Touches >1 app root (BE+FE)? weigh `.add/components.toml` now.
108
+ 2. **Relate to the map** — `add.py search <keyword>` first, then read every live + archived goal
109
+ (`.add/milestones/*` · `.add/archive/*`); name the relationship — *extends* X · *depends-on* Y ·
110
+ *overlaps* Z — in the `rationale` line.
111
+ 3. **Already delivered** by an existing milestone → reject `duplicate_goal`; route as `task` or
112
+ `change-request`.
113
+
114
+ **Draft the sections well**: goal = ONE outcome sentence (no "and" — that is two milestones) ·
115
+ rationale = bucket + WHY + the relationship (never in state.json) · Scope In/Out = an explicit
116
+ deferral list (an empty Out means scope is not thought through) · shared decisions/contracts
117
+ name the owning task · tasks breadth-first (`slug · depends-on · one line`, each one-file-sized) ·
118
+ exit criteria observable, EVERY criterion maps to a declared task slug · `Close — ship review` +
119
+ `Release steps` stay drafted-blank (filled at `milestone-done`/release). Brainstorm via the
120
+ three-move co-specify (below) at milestone scope; rank assumptions lowest-confidence first (top
121
+ 1–2 get the ⚠ flag); present per `gate-udd.md` as a guided choice — fix any unmet box first.
122
+ Rejects: `not_classified` · `dangling_criterion` · `no_milestone` · `duplicate_goal`.
123
+
124
+ ---
125
+
126
+ ## Rules (§1) + scenarios (§2) — co-specification
127
+
128
+ State what the feature MUST do and MUST REJECT — zero ambiguity left to guessing. Co-specify in three moves: **Diverge** (surface the 2–3 genuine framings +
129
+ open questions; let the user react), **Converge** (draft §1 by PROJECTING from the milestone
130
+ `## Ground` + the request), **Validate** (present the ranked uncertainty first). If you cannot
131
+ write the spec, you don't yet understand the feature — stop and ask. **Identity is direction, not
132
+ default (UDD)**: brand/palette/typeface are human-owned — surface, never assume; a UI screen runs
133
+ the design-definition loop (`design.md`).
134
+
135
+ <output_format>
136
+ - **Framings weighed** — one-line trace: `X (chosen) · Y · Z`.
137
+ - **Must** — each required behavior. **Reject** — each refused input/situation with a **named error
138
+ code** (`amount <= 0 -> "amount_invalid"`). **After** — the state true once it succeeds.
139
+ - **Boundary** — one format-variant per external input shape the tests must speak (or an explicit "none").
140
+ - **Assumptions — lowest-confidence first** — ranked most-likely-wrong → least; the top 1–2 carry
141
+ `⚠ <assumption> — lowest confidence because <why>; if wrong: <cost>`.
142
+ </output_format>
143
+
144
+ §2 makes every rule checkable — one scenario per Must and per Reject:
145
+
146
+ ```gherkin
147
+ Scenario: <short name>
148
+ Given <starting situation>
149
+ When <action>
150
+ Then <observable result>
151
+ And <what must remain unchanged> # REQUIRED for every rejection
152
+ ```
153
+
154
+ Then sweep the edge cases — boundary · duplicate · partial failure · concurrency · malformed input —
155
+ one per applicable case, or rule it out on purpose. Every Then is specific and observable, never
156
+ "then it works". Your §1 ranking feeds the bundle-level flag the human reads at the freeze.
157
+
158
+ <exit_gate>
159
+ - [ ] Framings weighed noted; every required behavior stated; every rejection has a named error code.
160
+ - [ ] Assumptions ordered lowest-confidence first; the 1–2 `⚠` flags carry why + cost — or an honest
161
+ "none material" that still names the single biggest risk (never a blank "none").
162
+ - [ ] §2: one scenario per Must and per Reject; every rejection asserts what stays unchanged; edge
163
+ cases covered or ruled out on purpose.
164
+ </exit_gate>
165
+
166
+ ---
167
+
168
+ ## Plan (§3) — ground · freeze the shape · build-strategy
169
+
170
+ Turn the rules + scenarios into ONE change plan and FREEZE it. Below the freeze code is disposable;
171
+ above it the Contract does not move.
172
+
173
+ ### Grounding — reason it in-context (don't write an essay — `PLAN.md.tmpl`: persist the interface, not prose)
174
+ Project from the milestone `## Ground`, then deepen only where THIS task lands. Never invent a
175
+ file/symbol you have not opened; cite the **symbol**, not a bare line number (`l.NNN` rots; symbols
176
+ survive), via code-navigation tools, not memory. **Persist only what the contract needs**: the
177
+ **Anchors** it may cite (the specific symbols §3 names — it may cite ONLY these) and, optionally, a
178
+ **Ground SHA** (the commit grounded against — the engine stamps it when the line is present).
179
+ Everything else — what it **Touches**, the **Honors**/seams consulted, the **Issues/Risks**, the
180
+ **Related intent** (the WHY) — you REASON now and let the frozen Contract encode; don't transcribe it
181
+ into the file. Sweep BROAD cheaply (skim an index/map; a subagent sweep for unfamiliar ground), then
182
+ DEEPEN on what THIS task needs. *Greenfield / first task:* grounding IS the foundation docs — an
183
+ honest "new module, no code; honors CONVENTIONS.md §X" is complete.
184
+
185
+ ### Contract — freeze the external shape (HARD, tamper-guarded)
186
+ Interfaces with inputs/outputs; shapes + persistent schema (note transactional needs). Names drawn
187
+ from `GLOSSARY.md`; a response for **every** Reject code from §1; cites only Grounding anchors.
188
+ Declare the measurable **Target** — the success bar the verify evidence must hit (numbers, not
189
+ adjectives; judged at the gate with `--target-hit`). Generate a mock + contract tests so
190
+ dependent work can start.
191
+
192
+ ### Build-strategy — the intended approach (SOFT: preferred; the builder self-improves, records actual at verify)
193
+ **Scope (may touch)** — backticked path tokens; the freeze locks this. **Strategy** — ordered
194
+ batches. **Approach / Data strategy / Pattern / Optimization stance** — the domain plan + the
195
+ trust-least facet. **Persona** · **Spawn isolation** · **Known-problem fixes** (`SEAMS.md` traps).
196
+
197
+ ### The freeze — the one approval
198
+ Present the bundle **lowest-confidence first**. Render from the card: banner → ARC → SHAPE →
199
+ SUMMARY → FLAGS → DECIDED → EVIDENCE → APPROVE → NEXT (`gate-udd.md` = template + examples, read at
200
+ most once per session) — **render before `FROZEN`, then record `Reported: yes`; never on a
201
+ timeout** (`run.md`). The freeze always renders the full card. The approval freezes the Contract
202
+ (HARD) + the Build-strategy Scope; then `Status: FROZEN @ v1 — approved by <name>`. Lane modes are
203
+ retired — ONE atomic template serves every task; if the header still carries an optional `route:`
204
+ line the freeze records it (audit-only — `route_unrecorded` is measured, never a refusal).
205
+
206
+ <exit_gate>
207
+ - [ ] **Grounding** — reasoned in-context; the Contract's **Anchors** resolve in the code; an optional **Ground SHA** recorded (the essay bullets are not persisted — the interface is).
208
+ - [ ] **Contract** — versioned, `FROZEN`; contract tests pass against the mock; every name matches the glossary; every §1 rejection has a contracted response.
209
+ - [ ] **Build-strategy** — Scope declared; batches + persona + spawn isolation named; a measurable Target set.
210
+ - [ ] The Contract cites only Grounding anchors; the ⚠ lowest-confidence flag is surfaced.
211
+ </exit_gate>
212
+
213
+ ## The freeze review checklist
214
+
215
+ The human's one minute, aimed. Walk these seven before saying yes:
216
+
217
+ - **⚠ flags first** — read the lowest-confidence flags; accept each knowing its cost if wrong. The engine refuses an unflagged freeze before build (`unflagged_freeze`).
218
+ - **Intent** — does §1 say what you actually want built?
219
+ - **Cases** — does every Must and Reject have an observable §2 scenario?
220
+ - **Shape** — glossary names, error codes, additive vs breaking: is THIS the shape to freeze?
221
+ - **Grounded** — does the Contract cite anchors that exist in the Grounding map? `status`/`check` surface this.
222
+ - **Risk** — high-risk or method-defining? Require `risk: high · autonomy: conservative` in the PLAN.md header.
223
+ - **Tests** — will §4 go red for the right reason, asserting behavior rather than internals?
224
+
225
+ Reject any line → the bundle goes back to draft; the freeze stays the only gate.
226
+
227
+ ---
228
+
229
+ ## Tests (§4) — failing-first suite
230
+
231
+ Run the suite now, with no implementation — **red for the right reason** (missing implementation,
232
+ not a broken harness). A test green before code exists is testing nothing. **A test is any
233
+ machine-checkable assertion**, not only xUnit code — a metric threshold (ML/data), a reconciliation
234
+ query, a plan-diff (infra), a rendered-screen diff (UI). Produce: one executable test per §2
235
+ scenario asserting **behavior, not internals** · contract-conformance tests (shapes + error
236
+ responses) · side-effect assertions on rejection paths (`assert balance unchanged`) · a recorded
237
+ coverage target.
238
+
239
+ ## Declaring where tests live
240
+
241
+ §4's `Tests live in:` line is machine-read — declare paths as backticked tokens on that line: with
242
+ no local `tests/`, `add.py report` counts test functions at the declared paths (FIRST such line only).
243
+ `./…` → this task dir · a token with `/` → the project root · a bare name → a
244
+ sibling of the previous token's dir. A directory counts its `*.py` files
245
+ (non-recursive); a `.py` file counts itself. Resolved files dedupe; declared counts
246
+ marked `†`. Paths are confined: outside the project root counts 0 — `..` traversal,
247
+ absolute paths, and symlink escapes are never read.
248
+
249
+ **Clause map + edges.** Fill each `<test_plan>` bullet's `covers:` tail — frozen with the
250
+ bundle; `add.py locate path::test_x` walks a failure → owning node → that frozen §3 clause.
251
+ Declare edges at creation (`--depends-on`, later `relate`; milestone-confirm compiles `## Tasks`
252
+ rows into inherited edges) — `locate <slug>` names who re-verifies when a settled contract
253
+ moves. Ground §3 on each parent edge's frozen §3 — the PLAN.md itself, never a summary or
254
+ built code.
255
+
256
+ <exit_gate>
257
+ - [ ] One test per scenario, red for the right reason, asserting observable behavior; coverage target recorded.
258
+ </exit_gate>
259
+
260
+ > **Persona / Advisor / Confidence** — load the domain-fit `.add/personas/<slug>.md` (its Critical
261
+ > Rules shape §1, its Success Metrics shape the red suite; advisory, never lowers a gate). If none
262
+ > fits, spawn the add agent in persona mode to seed one (PROJECT.md + `.add/personas-teacher/`),
263
+ > then load it — seed per DOMAIN, REUSE across tasks, never one per task. Canonical spawns:
264
+ > researcher (unfamiliar domain) · risky-shape second opinion · test-author for a wide suite (the
265
+ > advisor spawn — `phases/verify.md`); self-score the bundle below — the lowest dimension aims ⚠.
266
+
267
+ ## The confidence self-score
268
+
269
+ Before presenting ANY drafted artifact (spec · contract · bundle · subagent verdict), self-score
270
+ it 0–1 on six dimensions: **Completeness** (every rule/scenario/rejection covered?) · **Clarity**
271
+ (understood without you in the room?) · **Practicality** (implementable against the real code?) ·
272
+ **Optimization** (correctness/simplicity/cost balanced — no gold-plating, no corner cut?) ·
273
+ **Edge cases** (failure modes, concurrency, empty/oversized inputs named?) · **Self-evaluation**
274
+ (does it carry its own refine step?). Any dimension **< 0.9** → refine, then re-score. The lowest
275
+ dimension is what you surface ⚠-first at the freeze; persistently low on risky scope →
276
+ *recommend* lowering autonomy (the level stays the human's call).
277
+ The hard rule: **advisory, never a gate** — it never auto-passes a verify, never substitutes for evidence or the
278
+ human decision, and a self-asserted score is never recorded as something the human "agreed to".
279
+
280
+ Book: `docs/03-step-1-specify.md` · `docs/05-step-3-plan.md` · `docs/06-step-4-tests.md` · `docs/10-setup-and-stages.md`.
@@ -0,0 +1,160 @@
1
+ # Verify — evidence + non-functional review (gate + the observe tail)
2
+
3
+ Goal: establish trust and record an outcome. Passing tests are necessary, not
4
+ sufficient. Fill **§6** in PLAN.md including the GATE RECORD.
5
+
6
+ > **Who resolves this gate depends on the `autonomy:` header.** Under `autonomy: auto` (the default)
7
+ > a run auto-PASSes on complete evidence with **no residue** (security · concurrency · architecture),
8
+ > recorded *auto-resolved* with the named run as owner;
9
+ > **security is always a HARD-STOP and is never auto-passed**. Under `conservative`, or whenever
10
+ > residue is found, this phase is **human-led** (auto-PASS conditions: `run.md`).
11
+
12
+ ## Part one — confirm the evidence
13
+
14
+ - [ ] All tests pass.
15
+ - [ ] Coverage did not decrease.
16
+ - [ ] No test or contract was altered during build.
17
+ - [ ] The §3 Target (measurable) is hit — including any declared outcome tests can't show, confirmed by real evidence.
18
+ - [ ] §1 rules trace to §2/§4 — an untraced rule is a coverage gap (`add.py check` warns on it).
19
+ - [ ] every §3-cited symbol still resolves in the CURRENT tree.
20
+
21
+ If any is false, stop and return to Build.
22
+
23
+ ## Part two — check what tests miss
24
+
25
+ - **Concurrency/timing** — correct when two run at once? (Tests run serially and miss races.)
26
+ - **Security** — exposed secrets, injection openings, unexpected dependencies. A security finding is always `HARD-STOP`, never a waiver. ANY note here escalates to the human — start it with `NOTE` or `⚠` so a reviewer can see it. A finding you never marked is **invisible** — escalated to no one. Under `auto`, a human **spot-audit** (reading the diff) is the only backstop for a *missed* security finding.
27
+ - **Architecture** — respects layering/dependency rules in CONVENTIONS.md?
28
+
29
+ Run the three lenses in order — a Security `HARD-STOP` ends the checklist (leave the rest blank). Record in §6 `### Advisor 3-lens verdict` (Verdict · Residue · Binding): `sensitivity: mechanical` → Binding `yes` (engine reads it for `advisor-gate-relax`), every other class → Binding `advisory`. An unfilled block is an unrecorded verdict, not a PASS.
30
+
31
+ ## Part three — the deep check (do not skim)
32
+
33
+ Code: record every new symbol referenced (wiring) and no new dead/unused code introduced. Prose or non-code: record a semantic read — what you read in full and what it confirmed. The resolver judges which path; the engine never classifies.
34
+
35
+ Record in the §6 **Deep checks** block — an unfilled one is a **shallow verify**, not a PASS.
36
+
37
+ ## Part four — was the green earned?
38
+
39
+ A green suite proves tests pass — not that the build EARNED them. Three judgment cheats pass the unchanged suite: src overfit to the test fixtures (special-cased to literal inputs), vacuous asserts (green against an empty implementation), and real logic stubbed away — all invisible to the mechanical tamper tripwire. Score them with an adversarial refute-read: an independent reviewer — the engine never spawns one — prompted to argue the green was NOT earned. A confirmed earned-green failure is HARD-STOP-class: never auto-passed, never RISK-ACCEPTED — a first cheat enters the bounded self-heal loop (run.md). Under `auto`, **record the verdict** in §6's `### Refute-read verdict` block — an unrecorded verdict leaves the auto-PASS untraceable (the human spot-audit is the backstop).
40
+
41
+ ## Record exactly one outcome (no silent pass)
42
+
43
+ Render this gate from the card: banner → ARC → SUMMARY → FLAGS → EVIDENCE → APPROVE → NEXT
44
+ (`gate-udd.md` = the full template + examples, read at most once per session), and reconcile FLAGS
45
+ with `add.py report --decide`'s open-item count. Right-size the render to the risk: `sensitivity: mechanical`
46
+ tasks use the compact form — banner → SUMMARY → EVIDENCE → APPROVE; `security` / `data` /
47
+ `architecture` always get the full card. **Human-led: render before `gate` and record `Reported: yes` in §6, never self-stamp.**
48
+
49
+ | Outcome | When |
50
+ |---------|------|
51
+ | `PASS` | all checks met |
52
+ | `RISK-ACCEPTED` | a **non-security** gap, with signed owner + ticket + expiry |
53
+ | `HARD-STOP` | any failing test or any security finding |
54
+
55
+ ## Exit gate / Next
56
+
57
+ <exit_gate>
58
+ - [ ] Evidence confirmed, non-functional risks checked, outcome recorded — a person approved, or
59
+ (under `autonomy: auto`, no residue) the run auto-resolved as accountable owner.
60
+ </exit_gate>
61
+
62
+ > **Persona** — refute-read under the fit `flow: verify` persona / Code-Reviewer lens (advisory; security still HARD-STOPs).
63
+ > **Advisor · Confidence** — the earned-green refute-read is the canonical adversarial spawn (the
64
+ > advisor spawn, below); score it with the confidence self-score (`phases/direction.md`) before recording the gate.
65
+
66
+ ```bash
67
+ python3 .add/tooling/add.py gate PASS # marks the task done
68
+ # or: add.py gate RISK-ACCEPTED | add.py gate HARD-STOP (return to Build)
69
+ ```
70
+
71
+ ## Observe (post-gate, §7) — feed the next loop
72
+
73
+ Verify owns the loop's tail since the six-phase merge. After the gate, fill §7:
74
+
75
+ 1. **Release behind a scope-of-impact limit** — a flag and/or gradual rollout.
76
+ 2. **Reuse scenarios as monitors** — the §2 scenarios that defined "correct" define
77
+ what you alert on: overall error rate, each rejection's rate, latency of the risky op.
78
+ 3. **Draft the next spec delta** — every defect, surprise, or new need becomes a change
79
+ that re-enters the flow at Specify (a new task). Emit lessons tagged by the
80
+ competency they improve (`deltas.md`); file each into its living spec (`delta-append`).
81
+ 4. **Propose a voice delta** — where your voice diverged from the human's, propose a
82
+ confirmable voice delta tuning `SOUL.md`, emitted `open` (grammar + routing: `deltas.md` —
83
+ the human is the only writer). Never auto-roll-back — recommend; a human owns production.
84
+
85
+ > **Decisions (ADR)** — the gate already harvested §7's ADR block into the milestone record.
86
+ > **Persona** — tag `· persona:<slug> · critical-rule|success-metric|anti-pattern|ability`;
87
+ > a HOW-an-agent-behaves lesson belongs in that persona file, not the shared pile.
88
+
89
+ Loop — the artifacts are living docs the next cycle refines. Map: the self-improving map
90
+ (`phases/build.md`) · book: `docs/08-step-6-verify.md` · `docs/09-the-loop.md`.
91
+
92
+ ## The advisor spawn — delegate one piece, never the loop
93
+
94
+ Spawn a *single* subagent for one well-scoped piece of your plan (many-task pipelines: the
95
+ stream-orchestrator persona); the engine never spawns — your call per step. Spawn when the piece
96
+ is separable and worth the round-trip: a broad sweep, an independent adversarial review (the
97
+ refute-read — fresh context, never author-graded), a batch, a context-offload; not for narrow
98
+ cheap work — in doubt, do it in-context. **Prefer the named roster**: the ONE `add` agent — the
99
+ spawn names the mode (direction · build · verify · persona · advise) — over an ad-hoc spawn; it
100
+ carries the worker contract and loads the beat guide + best-fit persona itself. Tier: **mid**
101
+ ordinary, **top** complex/cross-cutting (the roster contract in `agents/add.md` maps tiers to
102
+ models); a stronger model never buys back a gate. **Refute-read persona** — a **Code-Reviewer**;
103
+ findings carry severity: 🔴 blocker · 🟡 concern · 💭 note. A persona is advisory: it never
104
+ lowers a gate (a security finding still HARD-STOPs).
105
+
106
+ The plan-following prompt (the worker-contract tags — canonical here):
107
+
108
+ ```xml
109
+ <objective>
110
+ Execute THIS piece of the orchestrator's plan: {{PIECE}}. You own only this piece — not the
111
+ surrounding decisions. Return a verdict; do not record state.
112
+ </objective>
113
+
114
+ <persona>
115
+ SELECT the persona by frontmatter — flow: match first, then domain; read ONE body —
116
+ and load `.add/personas/{{PERSONA_SLUG}}.md` —
117
+ Identity→your stance · Critical Rules→constraints · Success Metrics→done-bar.
118
+ No match → a {{DOMAIN}} engineer, correctness over speed; never blocks.
119
+ Work step by step: load the context files + the persona; do the work in small steps honoring
120
+ the orchestrator's plan; self-score on the confidence six dimensions — any < 0.9 → refine
121
+ before returning.
122
+ </persona>
123
+
124
+ <strategy>
125
+ The task's §5 plan — the Strategy (ordered batches) order and the Known-problem fixes — is
126
+ your PREFERRED starting path, not a hard rule. Improve on it when a better strategy emerges
127
+ as you build; on done, report the strategy you ACTUALLY used so the orchestrator can update
128
+ §5 for the audit trail.
129
+ </strategy>
130
+
131
+ <context_files>
132
+ the plan / task files the piece needs (read-only unless the piece says otherwise)
133
+ </context_files>
134
+
135
+ <return>
136
+ End with a structured verdict the orchestrator parses and RECORDS:
137
+ { piece, persona, result, evidence, confidence: {per-dimension 0–1}, open_questions }.
138
+ `persona` names the slug you adopted (or `generic`). Do NOT run add.py or write any shared
139
+ state — you propose, the orchestrator records.
140
+ </return>
141
+ ```
142
+
143
+ **Delegate, don't abdicate**: the subagent PROPOSES, the orchestrator RECORDS — a worker never
144
+ runs add.py or writes shared state; delegation never lowers a gate — a SECURITY finding still
145
+ HARD-STOPs and high-risk scope still escalates, whoever did the work; a low returned self-score
146
+ means refine or re-spawn, never a pass.
147
+
148
+ ## Sensitivity — the risk-class vocabulary
149
+
150
+ A `sensitivity:` header line declares the risk-CLASS (*what kind*, distinct from `risk:` = *how
151
+ much*); the engine validates + surfaces it (freeze/status/check), never classifies. Base four:
152
+ **security** (authn/authz, secrets, crypto, attack surface — HARD-STOP, human in EVERY tier) ·
153
+ **data** (persistence, migrations, privacy, loss — Datetime, money, or timezone arithmetic also ⇒
154
+ `data`, value formats are the risk surface, bench wm2's naive-timestamp green) · **architecture**
155
+ (module boundaries, contracts, cross-cutting structure) · **mechanical** (rote, low-impact — the
156
+ only class a recorded advisor verdict can gate for auto-completion, `advisor-gate-relax`). EXTEND
157
+ per project in `GLOSSARY.md`'s `## Sensitivity classes` (`- <token>: <definition>`); freeze accepts
158
+ base ∪ domain else `sensitivity_invalid`. Declared never inferred · base four never replaced · a
159
+ comment is never a declaration · a new KIND of risk → propose a class, human confirms (map domain →
160
+ base behavior in the definition, e.g. "pii … escalates to human review" = human-floor).
package/skill/add/run.md CHANGED
@@ -9,11 +9,8 @@ Scenarios · Contract) still owns *direction*. The engine stays judgment-free: t
9
9
 
10
10
  v7 compresses the old three-approval flow to **one**: the AI drafts Spec · Scenarios ·
11
11
  Contract · failing Tests in one pass; the human gives **one approval, at the frozen
12
- contract** the decision point stays human (the AI never freezes its own shape; a
13
- rejected part goes back to draft, backward-correction not failure). The freeze
14
- presentation — the bundle led **lowest-confidence first** by its ⚠ flag, the
15
- freeze review checklist (seven lines, ⚠-first) — lives in `phases/3-contract.md`,
16
- its one home; this rubric owns what happens AFTER the freeze.
12
+ contract** (a rejected part goes back to draft backward-correction, not failure). The
13
+ freeze presentation lives in `phases/direction.md`, its one home; this rubric owns AFTER the freeze.
17
14
 
18
15
  ## When the run begins — the scope-lock trigger
19
16
 
@@ -58,9 +55,9 @@ recorded pass is an explicit pass, not a skip).
58
55
  - **Auto-PASS requires ALL of:** every test green; coverage not decreased; no test weakened and no
59
56
  contract edited; loops dry; completeness-critic clean; and the deep check below.
60
57
  - **The deep check (every gate, do not skim).** If the task produced code, record that every new symbol is referenced (wiring) and that no new dead/unused code was introduced. If it produced prose or non-code, record a semantic read. An unfilled deep check is a **shallow verify**, not an auto-PASS.
61
- - **The recorded refute-read (under `auto`).** The earned-green refute-read (`6-verify.md`) is not just run — its **verdict is recorded** in §6 (`EARNED | NOT-EARNED`); `add.py audit` surfaces an unrecorded one as `refute_unrecorded` one of three shape lints it lists (with `shallow_deep_check` + `risk_unset`) and a human spot-audit is the backstop. NOT-EARNED routes to `add.py heal`, never an auto-PASS.
62
- - **The recorded Advisor 3-lens verdict (under `auto`).** The Advisor 3-lens sweep (security → concurrency → architecture, `6-verify.md`) is recorded in §6 `### Advisor 3-lens verdict`; `add.py audit` surfaces an unfilled block as `advisor_verdict_unrecorded` a shape lint alongside `refute_unrecorded`.
63
- - **The rendered gate report (§3/§6).** Report-template.md's ceremony is recorded, not just performed — a `Reported: yes` line in §3/§6; `add.py audit` surfaces an unrecorded one as `contract_report_unrecorded`/`verify_report_unrecorded`; a human spot-audit is the backstop.
58
+ - **The recorded refute-read (under `auto`).** The earned-green refute-read (`6-verify.md`) is not just run — its **verdict is recorded** in §6 (`EARNED | NOT-EARNED`); an unrecorded verdict leaves the auto-PASS untraceable — a human spot-audit is the backstop. NOT-EARNED routes to `add.py heal`, never an auto-PASS.
59
+ - **The recorded Advisor 3-lens verdict (under `auto`).** The Advisor 3-lens sweep (security → concurrency → architecture, `6-verify.md`) is recorded in §6 `### Advisor 3-lens verdict`; an unfilled block is an unrecorded verdict, not a PASS.
60
+ - **The rendered gate report (§3/§6).** Report-template.md's ceremony is recorded, not just performed — a `Reported: yes` line in §3/§6 is the trace; a missed render surfaces only there a human spot-audit is the backstop.
64
61
  - **The `advisor-gate-relax` pathway.** A `risk: high` + `sensitivity: mechanical` task whose §6 Advisor 3-lens verdict records Verdict `PASS` and Residue `none` may auto-complete via `add.py gate PASS` **without** a lowered autonomy level. Security and every non-mechanical sensitivity class are never relaxed by this pathway — the high-risk guard still applies.
65
62
  - **Always escalates to a human (never auto-passed):** any **security** finding (HARD-STOP, always);
66
63
  a **concurrency**/timing risk the tests cannot exercise; an **architecture**/layering violation;
@@ -95,14 +92,14 @@ Either way: ≤3 honest redos, then escalate. A gamed green never ships.
95
92
  ## Emitting deltas — feeding the foundation back
96
93
 
97
94
  Every gap the completeness-critic finds becomes an **`open` lesson learned** in the task's OBSERVE
98
- block (`deltas.md` grammar). These `open` deltas feed v5's human-gated consolidation (`fold.md`)
99
- at milestone close — the loop closing: **v6 run -> v5 foundation**.
95
+ block (`deltas.md` grammar). File each into its living spec (`add.py delta-append`) as it lands
96
+ — the loop closing: **v6 run -> the living 5-DD specs**.
100
97
 
101
98
  ## The autonomy level
102
99
 
103
100
  <constraints>
104
101
  How much a run may auto-gate is a **per-scope setting** (principle 5). A task declares it in its
105
- `TASK.md` header — this is not an add.py flag; it is a rubric convention:
102
+ `PLAN.md` header — this is not an add.py flag; it is a rubric convention:
106
103
 
107
104
  ```
108
105
  autonomy: manual | conservative | auto
@@ -115,17 +112,13 @@ autonomy: manual | conservative | auto
115
112
  - **conservative** — the deliberate *lowering*: the run converges but STOPS at the verify gate.
116
113
  - **manual** — the strict floor: the human owns the verify gate; the engine never auto-resolves.
117
114
 
118
- > **v7 reversal (recorded).** Earlier the default was `conservative`; v7 flips it to `auto` as
119
- > the default. The level is still **per-scope** and is lowered wherever risk demands.
120
-
121
115
  **The high-risk guard.** On a **high-risk or method-defining scope** `auto` must be lowered to
122
116
  `conservative` or `manual`; leaving it at `auto` is the reject code **`unguarded_high_risk_auto`**.
123
- The scope declares **`risk: high`** in the `TASK.md` header (the engine never classifies scope).
117
+ The scope declares **`risk: high`** in the `PLAN.md` header (the engine never classifies scope).
124
118
  Since v14 the guard is mechanical for the declared case:
125
119
  the engine refuses the declared combination — `add.py gate` will not complete (`PASS`/`RISK-ACCEPTED`)
126
- a task whose header carries `risk: high` without a lowered level (`HARD-STOP` always records);
127
- `add.py audit` flags finished records whose header was tampered or whose GATE RECORD reviewer is
128
- the auto-gate (CI enforces). An undeclared high-risk scope passes — a scope without `risk: high`
120
+ a task whose header carries `risk: high` without a lowered level (`HARD-STOP` always records).
121
+ An undeclared high-risk scope passes a scope without `risk: high`
129
122
  in its header is not blocked by the v14 mechanical guard.
130
123
 
131
124
  **Autonomy is earned by goal-clarity — the auto-ready goal.** A milestone goal is auto-ready
@@ -0,0 +1,18 @@
1
+ # Terms — the method's coined vocabulary (decode, don't guess)
2
+
3
+ The loop in `SKILL.md` uses a few compressed terms of art. This is their plain-language key —
4
+ load it once if a phrase reads opaque; it teaches nothing new about the flow, only names it.
5
+
6
+ | Term | Plain meaning |
7
+ |------|---------------|
8
+ | **the ARC** | the three-line frame every gate opens with — **A**im (the goal this serves) · **R**each (what is already covered) · **C**ourse (the plan the choice sets up). Engine-sourced, never invented. |
9
+ | **co-specify** | write the ranked ⚠ risk-flag *inside* §1 as you draft it — the flag and the rule it guards are specified together, not bolted on after. |
10
+ | **red for the right reason** | a §4 test fails because the behavior is genuinely absent, not because of a typo, bad import, or wrong fixture. Prove the failure message names the missing behavior before you build. |
11
+ | **covers: clause** | each §4 test bullet carries a `covers:` key naming the frozen §3 clause it proves — the link that lets `locate` map a failing test back to its contract clause. |
12
+ | **cross / re-cross** | *cross* = pass the one human approval that carries the task from direction into build (`freeze --cross`). *re-cross* = a post-freeze change reopened the contract, so the crossing must be earned again. |
13
+ | **compound-cross** | at `gate PASS`, the engine folds every open sub-check (evidence · lenses · target-hit) into one recorded crossing — you don't stamp each; the gate compounds them. |
14
+ | **earned-green refute-read** | before recording PASS, read the green suite *trying to disprove it* — is it green because the feature works, or because the test is weak? Green is earned, not assumed. |
15
+ | **auto-resolved PASS** | under `autonomy: auto`, a verify with complete, no-residue evidence records an explicit PASS without a human tap — an *auto-resolved* crossing, never a skip. Residue or lowered autonomy → a human decides. |
16
+
17
+ Everything else in `SKILL.md` is plain method language; when in doubt, the phase guide that owns the
18
+ beat (`phases/direction.md` · `phases/build.md` · `phases/verify.md`) defines it in full.