@pilotspace/add 1.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 (53) hide show
  1. package/GETTING-STARTED.md +238 -0
  2. package/LICENSE +20 -0
  3. package/README.md +106 -0
  4. package/bin/cli.js +131 -0
  5. package/docs/00-introduction.md +46 -0
  6. package/docs/01-principles.md +71 -0
  7. package/docs/02-the-flow.md +93 -0
  8. package/docs/03-step-1-specify.md +117 -0
  9. package/docs/04-step-2-scenarios.md +78 -0
  10. package/docs/05-step-3-contract.md +78 -0
  11. package/docs/06-step-4-tests.md +71 -0
  12. package/docs/07-step-5-build.md +80 -0
  13. package/docs/08-step-6-verify.md +63 -0
  14. package/docs/09-the-loop.md +43 -0
  15. package/docs/10-setup-and-stages.md +75 -0
  16. package/docs/11-governance.md +87 -0
  17. package/docs/12-roles.md +99 -0
  18. package/docs/13-adoption.md +67 -0
  19. package/docs/14-foundation.md +121 -0
  20. package/docs/README.md +70 -0
  21. package/docs/add-competencies.png +0 -0
  22. package/docs/add-flow.png +0 -0
  23. package/docs/add-foundation.png +0 -0
  24. package/docs/add-hierarchy.png +0 -0
  25. package/docs/appendix-a-templates.md +88 -0
  26. package/docs/appendix-b-prompts.md +119 -0
  27. package/docs/appendix-c-glossary.md +85 -0
  28. package/docs/appendix-d-worked-example.md +152 -0
  29. package/docs/appendix-e-checklists.md +80 -0
  30. package/docs/appendix-f-requirements-matrix.md +170 -0
  31. package/package.json +47 -0
  32. package/skill/add/SKILL.md +118 -0
  33. package/skill/add/deltas.md +69 -0
  34. package/skill/add/fold.md +66 -0
  35. package/skill/add/intake.md +49 -0
  36. package/skill/add/phases/0-setup.md +35 -0
  37. package/skill/add/phases/1-specify.md +55 -0
  38. package/skill/add/phases/2-scenarios.md +36 -0
  39. package/skill/add/phases/3-contract.md +41 -0
  40. package/skill/add/phases/4-tests.md +37 -0
  41. package/skill/add/phases/5-build.md +38 -0
  42. package/skill/add/phases/6-verify.md +39 -0
  43. package/skill/add/phases/7-observe.md +32 -0
  44. package/skill/add/run.md +152 -0
  45. package/skill/add/scope.md +58 -0
  46. package/tooling/add.py +1573 -0
  47. package/tooling/templates/CONVENTIONS.md.tmpl +8 -0
  48. package/tooling/templates/GLOSSARY.md.tmpl +3 -0
  49. package/tooling/templates/MILESTONE.md.tmpl +25 -0
  50. package/tooling/templates/MODEL_REGISTRY.md.tmpl +6 -0
  51. package/tooling/templates/PROJECT.md.tmpl +42 -0
  52. package/tooling/templates/TASK.md.tmpl +111 -0
  53. package/tooling/templates/dependencies.allowlist.tmpl +2 -0
@@ -0,0 +1,119 @@
1
+ # Appendix B · Prompt library
2
+
3
+ [← Appendix A Templates](./appendix-a-templates.md) · [Contents](./README.md) · Next: [Appendix C Glossary →](./appendix-c-glossary.md)
4
+
5
+ The contents of the `playbook/` folder. Each prompt is plain text that names the files to read, states a single task, and lists the rules. The inline `# why:` notes are annotations — keep them; they encode the judgment behind each instruction. These prompts are themselves versioned, tested artifacts (see [11 Governance](./11-governance.md)).
6
+
7
+ ---
8
+
9
+ ### `playbook/1_specify.md`
10
+ ```
11
+ Role: a domain analyst who brainstorms, then asks rather than assumes.
12
+ Read first: ./PRD/* , ./GLOSSARY.md , ./inputs/ (tickets, interviews, contracts)
13
+ Task: co-specify SPEC.md WITH me. No solutions, no code.
14
+ Steps:
15
+ 0. Diverge first: surface 2–3 genuine framings of the feature + the open questions, and let
16
+ me react before you draft. Record the result as `Framings weighed: X (chosen) · Y · Z`.
17
+ # why: a spec dictated by one side is a guess; brainstormed, it is a decision.
18
+ 1. List every required behavior (Must) and every situation to refuse (Reject),
19
+ giving each refusal a named error code.
20
+ # why: named errors become scenarios and contract responses; "handle bad input" does not.
21
+ 2. State the success state-change (After).
22
+ 3. List the assumptions you had to make, RANKED least-sure first; flag the 1–2 you are least
23
+ sure about as `⚠ <assumption> — least sure because <why>; if wrong: <cost>`.
24
+ # why: a flat all-equal list gets rubber-stamped; a ranked one aims my attention at the risk.
25
+ Exit: a domain owner disputes none of it; assumptions ranked least-sure first, the 1–2 ⚠ flags
26
+ carrying why + cost — or an honest "none material" that still names the single biggest risk.
27
+ Never: resolve an ambiguity by guessing — ask. Never a blank "none" or a flat wall of equal ticks.
28
+ ```
29
+
30
+ ### `playbook/2_scenarios.md`
31
+ ```
32
+ Role: a specification tester.
33
+ Read first: ./SPEC.md , ./GLOSSARY.md
34
+ Task: produce features/<name>.feature.
35
+ Steps:
36
+ 1. For each Must and each Reject rule, write a Given/When/Then scenario.
37
+ # why: a rule with no scenario will never be verified.
38
+ 2. For every rejection, add an And-clause asserting what must NOT change.
39
+ # why: catches corrupting partial failures that a result-only check misses.
40
+ Exit: every rule has at least one scenario with an observable result.
41
+ Never: write a vague result ("then it works").
42
+ ```
43
+
44
+ ### `playbook/3_contract.md`
45
+ ```
46
+ Role: an interface/contract architect; contracts are immutable once frozen.
47
+ Read first: ./SPEC.md , ./features/*.feature , ./GLOSSARY.md
48
+ Task: produce contracts/<name>.md, a mock server, and contract tests. No business logic.
49
+ Steps:
50
+ 1. Define interfaces, request/response shapes, and the schema, named from the glossary.
51
+ # why: consistent names prevent the subtle mismatches that cause silent bugs.
52
+ 2. Define a response for every Reject error code in the spec.
53
+ 3. Generate a mock returning the contracted shapes, and contract tests pinning them.
54
+ # why: the mock unblocks dependent work; the tests become a regression baseline.
55
+ 4. Mark the contract FROZEN at a version.
56
+ Exit: contract tests pass against the mock; every spec rejection has a response.
57
+ Never: change a frozen contract — a change is a request that reopens Specify.
58
+ ```
59
+
60
+ ### `playbook/4_tests.md`
61
+ ```
62
+ Role: a test author who writes tests before code.
63
+ Read first: ./features/*.feature , ./contracts/*
64
+ Task: produce a failing (red) test suite. Do NOT implement the feature.
65
+ Steps:
66
+ 1. Turn each scenario into an executable test.
67
+ # why: closes spec -> scenario -> test with no human translation loss.
68
+ 2. Add contract-conformance and edge-case tests.
69
+ 3. Run the suite; confirm it fails for the right reason (missing implementation).
70
+ # why: a test that passes before code exists is testing nothing.
71
+ 4. Record a coverage target.
72
+ Exit: one test per scenario; suite red for the right reason; target recorded.
73
+ Never: assert on internals; write the implementation here.
74
+ ```
75
+
76
+ ### `playbook/5_build.md`
77
+ ```
78
+ Role: an execution agent. The human commands; you implement and report.
79
+ Read first: ./SPEC.md , ./contracts/* , ./tests/* , ./CONVENTIONS.md
80
+ Task: make EVERY failing test pass, one small task at a time.
81
+ Steps:
82
+ 1. Pick ONE task; restate the tests it must satisfy before coding.
83
+ # why: small batches keep human review able to keep up.
84
+ 2. Implement; run tests; iterate to green WITHOUT weakening any test.
85
+ # why: editing a test to pass makes the code judge itself — the cardinal sin.
86
+ 3. Honor the feature-specific safety rule (e.g. atomic balance update).
87
+ 4. Run security and allow-list checks; attach the evidence bundle; open the change.
88
+ Exit: all green; coverage held; no test/contract changed; no out-of-allow-list package.
89
+ Never: change a test or the contract; add an unlisted dependency; exceed the task budget
90
+ without escalating; guess when unclear — ask.
91
+ ```
92
+
93
+ ### `playbook/6_observe.md`
94
+ ```
95
+ Role: a reliability analyst feeding the next cycle.
96
+ Read first: telemetry exports , service-objective definitions , incident tickets
97
+ Task: turn production reality into the next SPEC delta.
98
+ Steps:
99
+ 1. Report objective status and error-budget burn vs target.
100
+ 2. Cluster errors and usage; surface the top real-world failures.
101
+ 3. Draft a SPEC delta — what the next loop should add or fix — with evidence links.
102
+ # why: closes the loop; production learning becomes the next specification.
103
+ Exit: a reviewed SPEC delta linked into the backlog.
104
+ Never: auto-roll back — recommend; a human owns the production decision.
105
+ ```
106
+
107
+ ---
108
+
109
+ ### Master prompt skeleton
110
+ ```
111
+ Role: <one line — who the agent is for this step>
112
+ Read first: <explicit repository paths — never chat memory>
113
+ Task: <the single outcome; state what is OUT of scope>
114
+ Steps:
115
+ 1. <action> # why: <the judgment this encodes>
116
+ Exit: <conditions a person or the pipeline can check>
117
+ Never: <what the agent must not do>
118
+ Evidence: <artifacts to attach for review>
119
+ ```
@@ -0,0 +1,85 @@
1
+ # Appendix C · Glossary
2
+
3
+ [← Appendix B Prompts](./appendix-b-prompts.md) · [Contents](./README.md) · Next: [Appendix D Worked example →](./appendix-d-worked-example.md)
4
+
5
+ ---
6
+
7
+ ## Terms
8
+
9
+ **AIDD (AI-Driven Development)** — a method of building software in which an AI agent writes most of the code and people direct and verify the work.
10
+
11
+ **Artifact** — a durable work product: the spec, the scenarios, the contract, the tests. The artifacts survive; the code is disposable.
12
+
13
+ **Competency delta** — a single learning a loop produces, tagged by which of the five competencies (`DDD · SDD · UDD · TDD · ADD`) it improves, written in a task's OBSERVE phase as `- [<COMPETENCY> · <status>] <learning> (evidence: …)`. Emitted `open` by the AI; the human folds it into a versioned `PROJECT.md` (`folded`) or declines it (`rejected`). The mechanism by which the foundation self-improves instead of drifting. See the `add` skill's `deltas.md`.
14
+
15
+ **Contract** — the fixed external shape of a feature: interfaces, data structures, names, and error cases. Frozen before the build, it is the surface the AI builds against.
16
+
17
+ **Co-specification** — how a spec is made in ADD: the AI and the human **brainstorm the shape together** (diverge), the AI **drafts** it, and the human **validates with the AI's advice** (validate). The AI's decisive advice is the *least-sure flag*. It replaces dictation-by-one-side — the human owns the decision, the AI owns surfacing what it does not yet know. See [03 Specify](./03-step-1-specify.md).
18
+
19
+ **Disposable code** — the view that code is one regenerable implementation of the artifacts, not a durable asset to be preserved.
20
+
21
+ **Evidence bundle** — the proof attached to a change (passing tests, clean security scan, no coverage loss) that justifies trusting it and may unlock more AI autonomy.
22
+
23
+ **Foundation version** — a monotonic integer marker in `PROJECT.md` that advances by one each time confirmed competency deltas are folded into the foundation. It makes the survivor layer's evolution auditable: a rising version with fewer new deltas per milestone is the signal that a competency is converging rather than drifting. Bumped only by the fold ritual (see the `add` skill's `fold.md`).
24
+
25
+ **Gate** — a checkpoint with an explicit pass/fail exit. Its outcome is `PASS`, `RISK-ACCEPTED`, or `HARD-STOP`.
26
+
27
+ **`HARD-STOP`** — a gate outcome meaning work cannot proceed; triggered by any failing test or security finding.
28
+
29
+ **Intake** — the step *before* a task: sizing a raw request into versioned scope by classifying it into one **request bucket**. The AI proposes `{bucket, rationale, command}`; the human confirms. Lives in the `add` skill's `intake.md` (the intake altitude, above the per-task flow).
30
+
31
+ **Least-sure flag** — the AI's ranked declaration of the **1–2 things most likely to be wrong** in what it is asking a human to approve, each carrying *why* it is uncertain and *what it costs if wrong* (`⚠ [spec|scenario|contract|test] … — because …; if wrong: …`). It reshapes the old flat assumptions list into a ranked one, so a single approval aims the reviewer's attention at the real risk instead of a wall of equal-looking ticks. Bundle-wide at the one-approval freeze seam; the §1 assumptions are its first feeder. If nothing is materially uncertain it still names the single biggest risk — never a blank "none". It makes a genuine review cheap and a lazy one visibly negligent, but cannot *force* the read. The "AI advises" half of **co-specification**.
32
+
33
+ **Living document** — an artifact expected to change as the loop learns; never frozen forever (the one exception being a versioned contract, which changes only via a change request).
34
+
35
+ **On-ramp** — the path a new user walks from install to their first milestone: install → `/add` → describe the goal → the agent runs intake (sizing the request into a milestone the human confirms) → the one-approval front → the self-driving run. The AI-first entry to the method; the human talks to the agent rather than hand-typing `add.py`.
36
+
37
+ **Owner (of a phase)** — who drives a phase, exposed by `add.py … --json` as `human`, `seam`, or `ai`. It tells an autonomous harness where it may run (`ai`) and where it must checkpoint to a person (`human`/`seam`), following the who-does-what table (Verify is always `human`).
38
+
39
+ **Profile** — the intensity at which the method is run: Express, Standard, or Regulated.
40
+
41
+ **Request bucket** — one of the four intake classifications — `new-major`, `sub-milestone`, `task`, or `change-request` — chosen by the tie-break order (the frozen-scope test runs before the size test). A request too vague to size is rejected `ask_human`; one that touches frozen scope, `frozen_scope`; one spanning buckets, `split_required`.
42
+
43
+ **`RISK-ACCEPTED`** — a gate outcome meaning work proceeds with a signed waiver (owner, ticket, expiry); allowed for non-security gaps only.
44
+
45
+ **Scenario** — a single rule expressed as Given/When/Then; readable by people and checkable by machines; the bridge between spec and tests.
46
+
47
+ **Scope drafting (scope-loop)** — the second half of **intake**: once a request is classified `new-major`/`sub-milestone`, turning it into a confirmed, well-formed `MILESTONE.md` (goal · scope · exit criteria · breadth-first tasks) through discussion. Every exit criterion maps to a declared task slug; the AI proposes the draft, the human confirms before anything is created. Lives in the `add` skill's `scope.md`.
48
+
49
+ **Spec (`SPEC.md`)** — the plain-language statement of what a feature must do, must reject, and assumes.
50
+
51
+ **Spine / continuous concern** — a concern that runs through every step rather than being one step: security, testing, observability, cost.
52
+
53
+ **Stage** — one pass through the flow at a chosen depth: Prototype, Proof of Concept, MVP, or Production-Ready.
54
+
55
+ **State surface** — everything an agent loads every session: the `add` skill (router `SKILL.md` + the active phase) and the lean operational docs — `PROJECT.md`, the active `MILESTONE.md` and `TASK.md`, and `state.json`. Kept small to avoid context rot. Contrast **Story surface**.
56
+
57
+ **Stop signal** — the boolean an autonomous harness reads from `add.py … --json` (`stop = owner != "ai"`): true means pause for a person before proceeding. The irreducible stops are the contract freeze and the Verify gate. See **Owner (of a phase)**.
58
+
59
+ **Story surface** — the book (`docs/*`): the whole method, read once by a person to trust ADD, then referenced by a pointer and **never auto-loaded** into agent context. Contrast **State surface**.
60
+
61
+ **Survivor layer** — the set of durable artifacts (conventions, glossary, frozen contracts) that outlive any particular code.
62
+
63
+ **Trust ladder / autonomy ladder** — the graduated levels of AI autonomy, earned with evidence and verification capacity.
64
+
65
+ **Verification capacity / review throughput** — the rate at which a team can confirm AI output is correct; the real ceiling on safe speed.
66
+
67
+ ---
68
+
69
+ ## Optional mapping to formal phase names
70
+
71
+ This book uses plain step names. Teams connecting it to a larger formal standard may use these equivalents. The mapping is optional; the plain flow is complete on its own.
72
+
73
+ | Plain step (this book) | Formal phase name |
74
+ |------------------------|-------------------|
75
+ | Project setup | Foundation |
76
+ | Specify | Domain Discovery + Spec Definition |
77
+ | (design portion) | UX-Driven Design |
78
+ | Scenarios | Behavior specification (Given/When/Then) |
79
+ | Contract | Contract Freeze |
80
+ | Tests | Test-Driven Verification |
81
+ | Build | AI-Driven Development (the engine) |
82
+ | Verify | the review gate within the build |
83
+ | Observe (loop) | Operate and Learn |
84
+
85
+ The formal standard also names the *foundation* and *design* work as full phases in their own right; this book folds them into project setup and the Specify step (and the Prototype stage) to keep the flow to six memorable steps.
@@ -0,0 +1,152 @@
1
+ # Appendix D · The worked example, end to end
2
+
3
+ [← Appendix C Glossary](./appendix-c-glossary.md) · [Contents](./README.md) · Next: [Appendix E Checklists →](./appendix-e-checklists.md)
4
+
5
+ The running example, assembled in one place so you can see a complete pass through the flow without flipping between chapters. The feature: **transfer money between a user's own accounts.**
6
+
7
+ ---
8
+
9
+ ## Step 1 — Specify → `SPEC.md`
10
+
11
+ ```
12
+ Feature: Transfer money between my own accounts
13
+ Framings weighed: synchronous single-currency transfer (chosen) · queued transfer · multi-currency with FX
14
+ Must:
15
+ - move an amount from one of my accounts to another of mine
16
+ - amount > 0
17
+ - source and destination are different accounts
18
+ - source has enough balance
19
+ After:
20
+ - source balance -= amount, destination balance += amount
21
+ Reject:
22
+ - amount <= 0 -> "amount_invalid"
23
+ - source == destination -> "same_account"
24
+ - balance < amount -> "insufficient_funds"
25
+ - account not mine -> "forbidden"
26
+ Assumptions — least-sure first:
27
+ ⚠ same currency only (no FX) in v1 — least sure because the ticket never said; if wrong: the amount/rounding model changes and this contract is wrong
28
+ - [x] no daily limit in v1 — confirmed: out of scope for v1
29
+ ```
30
+
31
+ The product owner read the flagged assumption first — the single-currency choice, the one most likely to be wrong and most expensive if it were — and confirmed it: v1 is single-currency with no daily limit.
32
+
33
+ ## Step 2 — Scenarios → `features/transfer.feature`
34
+
35
+ ```
36
+ Scenario: successful transfer
37
+ Given A has 100 and B has 0, both mine
38
+ When I transfer 30 from A to B
39
+ Then A has 70 and B has 30
40
+
41
+ Scenario: amount must be positive
42
+ Given A has 100, mine
43
+ When I transfer 0 from A to B
44
+ Then it is rejected "amount_invalid"
45
+ And no balance changes
46
+
47
+ Scenario: same account
48
+ Given A has 100, mine
49
+ When I transfer 10 from A to A
50
+ Then it is rejected "same_account"
51
+ And no balance changes
52
+
53
+ Scenario: insufficient funds
54
+ Given A has 20, mine
55
+ When I transfer 50 from A to B
56
+ Then it is rejected "insufficient_funds"
57
+ And no balance changes
58
+
59
+ Scenario: not my account
60
+ Given account C is not mine
61
+ When I transfer 10 from C to B
62
+ Then it is rejected "forbidden"
63
+ ```
64
+
65
+ Five scenarios for four rejections plus the happy path — every rule from the spec is covered.
66
+
67
+ ## Step 3 — Contract → `contracts/transfer.md`
68
+
69
+ ```
70
+ POST /transfers body: { fromAccountId, toAccountId, amount }
71
+ 200 -> { transferId, fromBalance, toBalance }
72
+ 400 -> { error: "amount_invalid" | "same_account" | "insufficient_funds" }
73
+ 403 -> { error: "forbidden" }
74
+ Schema: accounts.balance (read + write, must be transactional)
75
+ Status: FROZEN @ v1
76
+ ```
77
+
78
+ Frozen at v1. The schema note flags the atomicity requirement the verification step will check.
79
+
80
+ ## Step 4 — Tests → `tests/transfer_test.py` (run first; all fail)
81
+
82
+ ```python
83
+ def test_successful_transfer():
84
+ a = account(balance=100, owner=me); b = account(balance=0, owner=me)
85
+ r = transfer(a.id, b.id, 30)
86
+ assert r.status == 200
87
+ assert a.balance == 70 and b.balance == 30
88
+
89
+ def test_amount_must_be_positive():
90
+ a = account(balance=100, owner=me); b = account(balance=0, owner=me)
91
+ r = transfer(a.id, b.id, 0)
92
+ assert r.status == 400 and r.error == "amount_invalid"
93
+ assert a.balance == 100 and b.balance == 0
94
+
95
+ def test_same_account():
96
+ a = account(balance=100, owner=me)
97
+ r = transfer(a.id, a.id, 10)
98
+ assert r.status == 400 and r.error == "same_account"
99
+ assert a.balance == 100
100
+
101
+ def test_insufficient_funds():
102
+ a = account(balance=20, owner=me); b = account(balance=0, owner=me)
103
+ r = transfer(a.id, b.id, 50)
104
+ assert r.status == 400 and r.error == "insufficient_funds"
105
+ assert a.balance == 20
106
+
107
+ def test_not_my_account():
108
+ c = account(balance=100, owner=someone_else); b = account(balance=0, owner=me)
109
+ r = transfer(c.id, b.id, 10)
110
+ assert r.status == 403 and r.error == "forbidden"
111
+ ```
112
+
113
+ Run now, with no implementation: all five fail. That is the honest baseline.
114
+
115
+ ## Step 5 — Build → the prompt given to the AI
116
+
117
+ ```
118
+ Read SPEC.md, contracts/transfer.md, and tests/transfer_test.py.
119
+ Implement POST /transfers so that EVERY test passes.
120
+ Constraints:
121
+ - Do NOT change any test.
122
+ - Do NOT change the contract.
123
+ - Make the balance update atomic: debit and credit in a single transaction,
124
+ and re-check the balance inside the transaction.
125
+ - Stop and ask if any requirement is unclear — do not guess.
126
+ - Use only packages in dependencies.allowlist.
127
+ Report which tests pass and exactly what you changed.
128
+ ```
129
+
130
+ The AI implements, runs the suite, iterates, and reports all five green, listing the files it changed.
131
+
132
+ ## Step 6 — Verify → the human checks
133
+
134
+ - **Evidence:** all five tests pass; coverage held; no test or contract was altered. ✓
135
+ - **Concurrency (the key check):** two simultaneous transfers from account A must not both pass the balance check and overdraw it. The reviewer confirms the balance re-check happens *inside* the transaction and that the row is locked for the update — so a race cannot double-spend. ✓
136
+ - **Security:** no hardcoded secrets; inputs validated; no new dependency added. ✓
137
+ - **Architecture:** the change respects the layering in `CONVENTIONS.md`. ✓
138
+ - **Outcome recorded:** `PASS`, reviewed by the senior engineer.
139
+
140
+ ## The loop — observe
141
+
142
+ Released behind a feature flag to 5% of users. Monitored:
143
+
144
+ - transfer error rate (target: well under 0.1% of attempts);
145
+ - the rate of each rejection — a spike in `insufficient_funds` would suggest a UX problem (users not seeing their balance) rather than a code defect;
146
+ - latency of the atomic update under load.
147
+
148
+ A week later, telemetry shows an unexpectedly high `forbidden` rate. The `6_observe` prompt clusters it: users are trying to transfer *into* a shared account they can see but do not own. That observation becomes a `SPEC.md` delta — "support transfers into accounts I am authorized on, not only accounts I own" — and the flow returns to Step 1 for the next cycle.
149
+
150
+ ---
151
+
152
+ This is the whole method in one feature: four artifacts written in order, an AI build bounded by them, a verification grounded in evidence plus the one check tests miss, and a loop that turns production reality into the next specification.
@@ -0,0 +1,80 @@
1
+ # Appendix E · Checklists
2
+
3
+ [← Appendix D Worked example](./appendix-d-worked-example.md) · [Contents](./README.md) · Next: [Appendix F Requirements matrix →](./appendix-f-requirements-matrix.md)
4
+
5
+ Every exit check in the book, collected for quick use. Print this page.
6
+
7
+ ---
8
+
9
+ ## Setup (once per project)
10
+
11
+ - [ ] Pipeline runs and is green on the empty skeleton.
12
+ - [ ] AI model pinned in `MODEL_REGISTRY.md`.
13
+ - [ ] Dependency allow-list exists; pipeline fails on anything outside it.
14
+ - [ ] `playbook/` contains the six prompts.
15
+
16
+ ## Step 1 — Specify
17
+
18
+ - [ ] Every required behavior stated explicitly.
19
+ - [ ] Every rejection has a named error code.
20
+ - [ ] Success state-change described.
21
+ - [ ] Assumptions ranked least-sure first; the 1–2 most-likely-wrong ⚠-flagged with why + cost (or an honest "none material" that still names the single biggest risk).
22
+
23
+ ## Step 2 — Scenarios
24
+
25
+ - [ ] Every "Must" rule has a scenario.
26
+ - [ ] Every "Reject" rule has a scenario.
27
+ - [ ] Each result is a specific, observable fact.
28
+ - [ ] Rejections assert what must stay unchanged.
29
+
30
+ ## Step 3 — Contract
31
+
32
+ - [ ] Contract versioned and `FROZEN`.
33
+ - [ ] Contract tests pass against the mock.
34
+ - [ ] Names match the glossary.
35
+ - [ ] Every spec rejection has a contracted response.
36
+
37
+ ## Step 4 — Tests
38
+
39
+ - [ ] One test per scenario.
40
+ - [ ] Suite runs in the pipeline and is red for the right reason.
41
+ - [ ] Tests assert behavior, not internals.
42
+ - [ ] Coverage target recorded.
43
+
44
+ ## Step 5 — Build
45
+
46
+ - [ ] All tests pass.
47
+ - [ ] Coverage did not decrease.
48
+ - [ ] No test or contract modified by the AI.
49
+ - [ ] No package outside the allow-list added.
50
+ - [ ] Change is small enough to review in full.
51
+
52
+ ## Step 6 — Verify
53
+
54
+ - [ ] All tests pass (the evidence).
55
+ - [ ] Concurrency/timing of the risky operation is safe.
56
+ - [ ] No exposed secrets, injection, or unexpected dependencies.
57
+ - [ ] Layering and dependencies follow `CONVENTIONS.md`.
58
+ - [ ] A person reviewed and approved.
59
+ - [ ] Outcome recorded (`PASS` / `RISK-ACCEPTED` / `HARD-STOP`).
60
+
61
+ ## The loop
62
+
63
+ - [ ] Released behind a flag or gradual rollout.
64
+ - [ ] Scenarios reused as production monitors.
65
+ - [ ] Learnings written back as a `SPEC.md` delta.
66
+
67
+ ---
68
+
69
+ ## Master shippable checklist
70
+
71
+ A feature is shippable only when all are true:
72
+
73
+ - [ ] Spec complete: behavior stated, rejections named, assumptions ranked least-sure first with the biggest risk flagged.
74
+ - [ ] Every rule has a scenario.
75
+ - [ ] Contract frozen; contract tests green.
76
+ - [ ] A test per scenario; suite was red before the build.
77
+ - [ ] All tests green; coverage held; tests and contract untouched by the AI.
78
+ - [ ] Concurrency, security, and architecture checked by a person.
79
+ - [ ] Gate outcome recorded with an accountable owner.
80
+ - [ ] Released behind a flag, with monitors in place.
@@ -0,0 +1,170 @@
1
+ # Appendix F · Document requirements matrix (Project → Milestone → Task)
2
+
3
+ [← Appendix E Checklists](./appendix-e-checklists.md) · [Contents](./README.md)
4
+
5
+ This appendix maps every AIDD document to a three-level project hierarchy, so that at any level a team can answer three questions: **which documents must exist, who owns them, and what proves the level is complete.** It is the traceability backbone of the method — read it alongside the stage-depth matrix in [10 Setup and stages](./10-setup-and-stages.md), which covers *step* depth; this appendix covers *document* requirements.
6
+
7
+ ---
8
+
9
+ ## The three levels
10
+
11
+ | Level | What it is | AIDD meaning | Spans |
12
+ |-------|-----------|--------------|-------|
13
+ | **Project** | the whole product or engagement | the survivor layer — documents created once and kept for the life of the product | all milestones |
14
+ | **Milestone** | a stage or release | one pass of the flow at a chosen depth: Prototype, POC, MVP, or Production-Ready; groups many tasks | many tasks |
15
+ | **Task** | one feature through the flow | a single pass of Specify → … → Verify; the smallest unit with its own gate records | the six steps |
16
+
17
+ A **project** sets up the survivor-layer documents once. A **milestone** is a depth-bounded goal that groups tasks and has its own entry and exit document gates. A **task** is one feature, and it produces the per-feature artifacts.
18
+
19
+ ## How the hierarchy decomposes
20
+
21
+ ```mermaid
22
+ flowchart TD
23
+ P["PROJECT — the product<br/>PROJECT.md (foundation) · CONVENTIONS · GLOSSARY · MODEL_REGISTRY · allowlist · playbook"]
24
+ P --> M1["MILESTONE · Prototype"]
25
+ P --> M2["MILESTONE · POC"]
26
+ P --> M3["MILESTONE · MVP"]
27
+ P --> M4["MILESTONE · Production-Ready"]
28
+ M3 --> T1["TASK · Transfer between accounts<br/>SPEC · feature · contract · tests · code · gate records"]
29
+ M3 --> T2["TASK · View balance"]
30
+ M3 --> T3["TASK · Transaction history"]
31
+ classDef p fill:#F1EFE8,stroke:#5F5E5A,color:#2C2C2A;
32
+ classDef m fill:#FAEEDA,stroke:#BA7517,color:#633806;
33
+ classDef t fill:#E6F1FB,stroke:#185FA5,color:#042C53;
34
+ class P p; class M1,M2,M3,M4 m; class T1,T2,T3 t;
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Matrix 1 — Documents by level (ownership and lifespan)
40
+
41
+ Which document lives at which level, who is accountable for it, and how long it lasts.
42
+
43
+ | Document | Level | Created | Lifespan | Accountable owner |
44
+ |----------|:-----:|---------|----------|-------------------|
45
+ | `PROJECT.md` (foundation: domain · spec · UI/UX) | Project | setup, grows | whole project | Product / Architect |
46
+ | `CONVENTIONS.md` | Project | setup | whole project | Architect / Lead |
47
+ | `GLOSSARY.md` | Project | setup, grows | whole project | Product / Domain |
48
+ | `MODEL_REGISTRY.md` | Project | setup | whole project | Architect / Lead |
49
+ | `dependencies.allowlist` | Project | setup | whole project | Security |
50
+ | `playbook/*.md` (prompts) | Project | setup, versioned | whole project | Eng Lead |
51
+ | Stage plan / roadmap | Milestone | per milestone | the milestone | EM / Delivery |
52
+ | Milestone exit report | Milestone | milestone end | the milestone | EM / Delivery |
53
+ | `SLO.md` (objectives) | Milestone (MVP+) | from MVP | from MVP onward | DevOps / SRE |
54
+ | `SPEC.md` | Task | per feature | living | Product / Domain |
55
+ | `features/*.feature` | Task | per feature | living | QA / Test |
56
+ | `contracts/*.md` | Task → **Project** | per feature, then frozen | survivor (promoted to project) | Architect / Lead |
57
+ | `tests/*` | Task | per feature | living | QA / Engineer |
58
+ | Source code | Task | per feature | **disposable** | Engineer |
59
+ | Gate outcome records | Task | per step | kept for audit | the reviewer |
60
+
61
+ > Note the one promotion: a **contract** is authored at task level but, once frozen, becomes part of the project's survivor layer — other tasks depend on it. That promotion is why a contract change is a project-level change request, not a task-local edit.
62
+
63
+ ---
64
+
65
+ ## Matrix 2 — Documents required by milestone
66
+
67
+ Which documents must exist, and at what depth, to **exit** each milestone. Depth: **Deep** · **Core** · **Light** · **—** (not required).
68
+
69
+ | Document | Prototype | POC | MVP | Production-Ready |
70
+ |----------|:---------:|:---:|:---:|:----------------:|
71
+ | `CONVENTIONS.md` | Light | Core | Required | Required |
72
+ | `GLOSSARY.md` | seed | Core | Required | Required |
73
+ | `MODEL_REGISTRY.md` | Required | Required | Required | Required |
74
+ | `dependencies.allowlist` | optional | Required | Required | Required |
75
+ | `playbook/*.md` | Required | Required | Required | Required |
76
+ | `SPEC.md` | Light | Deep (risky slice) | Required (full) | Required (full) |
77
+ | Design: flows + screen states | **Deep** | Light | Core | Deep |
78
+ | `features/*.feature` | — | Core | Required | Exhaustive |
79
+ | `contracts/*.md` (frozen) | — | Core (risky slice) | Required (frozen) | Required (versioned) |
80
+ | `tests/*` | — | Core | Core | Full coverage |
81
+ | `SLO.md` | — | — | Light | Required |
82
+ | Gate outcome records | — | Core | Required | Required (all `HARD-STOP`) |
83
+ | Operate / observe report | — | — | Light | Required |
84
+ | Milestone exit report | Light | Core | Required | Required |
85
+
86
+ **Reading it:** a Prototype exits on a deep design and little else; a POC adds a deep spec, core scenarios/contract/tests on the risky slice; an MVP requires the full per-feature document set plus light operations; Production requires everything at full depth with operations and audit-grade gate records.
87
+
88
+ ---
89
+
90
+ ## Matrix 3 — Documents required per task (the six steps)
91
+
92
+ Every task, regardless of milestone, produces this artifact chain. The depth varies by milestone (Matrix 2); the *sequence and exit gate* do not.
93
+
94
+ | Step | Required document | Exit gate (the proof) | Detail |
95
+ |------|-------------------|------------------------|--------|
96
+ | 1 Specify | `SPEC.md` | rules + named rejections, assumptions ranked least-sure first (biggest risk ⚠-flagged) | [03](./03-step-1-specify.md) |
97
+ | 2 Scenarios | `features/<task>.feature` | one scenario per rule | [04](./04-step-2-scenarios.md) |
98
+ | 3 Contract | `contracts/<task>.md` | frozen + contract tests green | [05](./05-step-3-contract.md) |
99
+ | 4 Tests | `tests/<task>_*` | one test per scenario, red first | [06](./06-step-4-tests.md) |
100
+ | 5 Build | source code + evidence bundle | all tests green, nothing weakened | [07](./07-step-5-build.md) |
101
+ | 6 Verify | gate outcome record | `PASS` / `RISK-ACCEPTED` / `HARD-STOP` | [08](./08-step-6-verify.md) |
102
+
103
+ A task is **done** only when all six documents exist and the Verify record reads `PASS` (or a signed `RISK-ACCEPTED`). See the master shippable checklist in [Appendix E](./appendix-e-checklists.md).
104
+
105
+ ---
106
+
107
+ ## Matrix 4 — Executable proofs (the claims the engine enforces)
108
+
109
+ The rows above are the method's *promises*. A promise a tool quietly breaks is worse than none — so the `add` engine ships a proof-harness: each invariant below is pinned by an automated test that fails loudly if the **Story** (this book) and the **State** (the engine) drift apart. This table is the coverage *so far*, not a completeness claim — but the minimalism-and-coverage audit has now run once over Matrices 1–3 (see **Sweep findings** below); what it could cheaply prove, it added; what it deliberately left unenforced, it recorded.
110
+
111
+ | Claim (where it lives) | The engine enforces | Proof test |
112
+ |------------------------|---------------------|------------|
113
+ | No silent skips (principle 7) · "done only when Verify reads `PASS`" (Matrix 3) | `gate PASS` is **refused** unless the task has reached `verify` | `test_gate_pass_refused_before_verify` |
114
+ | A passed task is genuinely done | `gate PASS` at `verify` advances to `done` | `test_gate_pass_at_verify_reaches_done` |
115
+ | Deliberate ≠ silent | the explicit `phase` command is a logged escape hatch the guardrail does not block | `test_phase_override_escape_hatch` |
116
+ | "A security finding is ALWAYS `HARD-STOP`" | `HARD-STOP` is recordable from any phase and never forces `done` | `test_hardstop_recordable_mid_build` |
117
+ | "done … or a signed `RISK-ACCEPTED`" (Matrix 3) | `gate RISK-ACCEPTED` at `verify` advances to `done` (same guard as `PASS`) | `test_risk_accepted_complete_reaches_done` |
118
+ | A waived task **can complete its milestone** (the point of the waiver) | the completeness predicate counts a signed `RISK-ACCEPTED` as done, so `milestone-done` / `ready` / `check` / `archive` accept it — it does not silently block | `test_milestone_done_accepts_a_waived_task` · `test_check_tolerates_a_recorded_waiver` |
119
+ | A waiver is **signed** (owner · ticket · expiry) | `gate RISK-ACCEPTED` is refused without all three; they are stored in state | `test_risk_accepted_requires_waiver` · `test_risk_accepted_partial_waiver_refused` |
120
+ | A waiver can **expire** — a lapsed one is caught, not trusted forever | `check` **FAILS** a `RISK-ACCEPTED` task whose stored `expires` is before today; fail-closed on a missing/unparseable date (`waiver_expired`) | `test_check_flags_expired_waiver` · `test_check_passes_unexpired_waiver` · `test_check_failclosed_on_unparseable_expires` |
121
+ | **The Story is never auto-loaded** (principle 9, the *Minimal* pillar) | **no** command reads a `docs/` chapter at runtime — and the spy runs *every* subcommand the parser exposes, so "no command" is universal, not a subset; a project with **no** `docs/` runs the whole lifecycle | `test_full_lifecycle_runs_with_no_story` · `test_no_command_reads_a_docs_chapter` · `test_every_subcommand_is_covered` |
122
+ | The book's gate outcomes are the engine's | `PASS` · `RISK-ACCEPTED` · `HARD-STOP` exist in both prose and `GATES` | `test_book_gate_outcomes_match_engine` |
123
+
124
+ The tests are the source of truth; this table is their index. If a row here is ever unproven, that is a gap in the method, not a detail — the proof-harness exists to make such gaps fail loudly. (Tests: `add-method/tooling/test_proof_harness.py`, `test_waiver.py`.)
125
+
126
+ **Now closed:** an earlier version of this table flagged a `RISK-ACCEPTED` gap — the engine advanced only `PASS` to `done`, so a waived task could not complete its milestone, and the waiver fields were uncaptured. The `RISK-ACCEPTED` rows above close it: a signed waiver (owner · ticket · expiry) now completes a verify-phase task and is stored in state for a later `check` to expire. Closing it took *two* edits, not one — advancing the gate to `done` was necessary but not sufficient, because the shared completeness predicate (`milestone-done` / `ready` / `check` / `archive` all read it) still counted only `PASS`; a waived task reached `done` yet silently blocked its milestone until that predicate was taught to count a signed `RISK-ACCEPTED` too. The end-to-end row above is what catches that class of half-fix — proving the *task* completes is not proving the *milestone* can. The pattern that found it — book-claim → engine-enforces → named test — is the standing way to audit the remaining rows.
127
+
128
+ **Sweep findings (minimalism-and-coverage audit, v2):** the audit walked Matrices 1–3 for claims the engine *could* enforce but did not yet prove.
129
+
130
+ - **Proved and added** (rows above): the *Minimal* pillar's headline — "the Story is never auto-loaded" (principle 9) — was written but unproven; it is now pinned behaviorally (the engine runs the whole lifecycle with no `docs/` present, and a read-spy over *every* subcommand confirms none reads a chapter at runtime). And waiver **expiry**, which Matrix 4 already promised the state captured "for a later `check` to expire," is now enforced.
131
+ - **Recorded, deliberately *not* enforced:** Matrix 3 says a task is done only when "all six documents exist." The engine checks that `TASK.md` *exists* and that its phase marker matches state — it does **not** parse the file to confirm each of the seven sections is filled. Teaching it to grade section completeness would push the engine toward reading and judging the Story it is supposed to keep off the runtime path — an anti-minimal move. The reviewer owns section completeness at the Verify gate (the human-led half of the method); the engine owns the cheap structural invariants. This is a chosen boundary, not an oversight.
132
+ - **Lean check:** the audit confirmed `state.json` carries no redundant per-task fields — `title`, `phase`, `gate`, `milestone`, `depends_on`, the two timestamps, and a `waiver` only once one is signed; nothing to trim. A clean bill is a finding too.
133
+
134
+ ---
135
+
136
+ ## Worked example — the hierarchy filled in
137
+
138
+ - **Project:** *Mobile Banking App.* Survivor-layer documents: `CONVENTIONS.md`, `GLOSSARY.md` (defines *account*, *balance*, *transfer*), `MODEL_REGISTRY.md`, `dependencies.allowlist`, `playbook/`.
139
+ - **Milestone:** *MVP — core money movement.* Exit requires the full per-feature document set for each task below, plus a light `SLO.md` and a milestone exit report.
140
+ - **Task:** *Transfer between own accounts* → `SPEC.md`, `features/transfer.feature`, `contracts/transfer.md` (frozen at v1), `tests/transfer_test.py`, code, and a `PASS` gate record. (The full set is in [Appendix D](./appendix-d-worked-example.md).)
141
+ - **Task:** *View balance* → its own SPEC, feature, contract, tests, code, record.
142
+ - **Task:** *Transaction history* → its own set.
143
+
144
+ When all three tasks read `PASS` and the milestone documents exist, the MVP milestone exits — and the frozen `transfer` contract is now a project-level survivor artifact the next milestone builds on.
145
+
146
+ ---
147
+
148
+ ## Traceability chain
149
+
150
+ The hierarchy gives a clean line of evidence from a business goal down to a passing test — which is what makes an AIDD project auditable:
151
+
152
+ ```
153
+ PROJECT goal "let customers move their own money safely"
154
+ └─ MILESTONE (MVP) "core money movement"
155
+ └─ TASK "transfer between own accounts"
156
+ └─ SPEC rule "source must have enough balance"
157
+ └─ SCENARIO "insufficient funds -> rejected, no change"
158
+ └─ TEST test_insufficient_funds (was red, now green)
159
+ └─ VERIFY record PASS (atomicity checked)
160
+ ```
161
+
162
+ Every level points down to the evidence beneath it and up to the goal above it. To audit any claim — "we handle insufficient funds correctly" — you follow the chain to a specific test and a specific gate record. Nothing rests on assertion.
163
+
164
+ ---
165
+
166
+ *This matrix is the requirements view of the method. The flow ([Part II](./02-the-flow.md)) tells you the order; the stages ([10](./10-setup-and-stages.md)) tell you the depth; this appendix tells you, at each level of the project, exactly which documents must exist and who owns them.*
167
+
168
+ ---
169
+
170
+ *End of book. AIDD is one repeatable loop — Specify → Scenarios → Contract → Tests → Build → Verify → observe, then repeat. People own direction and verification; the AI owns the build; the artifacts are the asset and the code is disposable.*
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@pilotspace/add",
3
+ "version": "1.0.0",
4
+ "description": "ADD (AI-Driven Development) — a minimal, state-tracked Claude Code skill that drives every feature through Specify → Scenarios → Contract → Tests → Build → Verify → Observe. Ships the AIDD book as its trust layer.",
5
+ "bin": {
6
+ "add": "bin/cli.js"
7
+ },
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "scripts": {
12
+ "test": "python3 -m unittest discover -s tooling -p 'test_*.py'"
13
+ },
14
+ "files": [
15
+ "bin/",
16
+ "skill/",
17
+ "tooling/add.py",
18
+ "tooling/templates/",
19
+ "docs/",
20
+ "README.md",
21
+ "GETTING-STARTED.md"
22
+ ],
23
+ "keywords": [
24
+ "ai-driven-development",
25
+ "add",
26
+ "aidd",
27
+ "claude-code",
28
+ "skill",
29
+ "tdd",
30
+ "spec-driven",
31
+ "agent",
32
+ "methodology"
33
+ ],
34
+ "engines": {
35
+ "node": ">=18"
36
+ },
37
+ "license": "MIT",
38
+ "author": "Tin Dang <tindang.ht97@gmail.com>",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/pilotspace/ADD.git"
42
+ },
43
+ "homepage": "https://github.com/pilotspace/ADD#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/pilotspace/ADD/issues"
46
+ }
47
+ }