@pilotspace/add 1.3.0 → 1.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/CHANGELOG.md CHANGED
@@ -4,6 +4,114 @@ All notable changes to the ADD method (`@pilotspace/add` on npm,
4
4
  `pilotspace-add` on PyPI) are documented here. The format follows
5
5
  [Keep a Changelog](https://keepachangelog.com/); versions follow semver.
6
6
 
7
+ ## [1.5.0] — 2026-06-16
8
+
9
+ The UDD design-loop release: defining the design *before* the code is now a
10
+ guided, evidence-backed loop inside the method. A new `design.md` drives the UDD
11
+ beats to a confirmed screen, a wireframe + HTML-mock recipe renders a real screen
12
+ the human approves before build, and the engine measures that the confirmation
13
+ was actually captured. All additive; no breaking changes (SemVer MINOR).
14
+
15
+ ### Added
16
+ - **UDD design-definition loop (`design.md`)** — turns the foundation's UDD
17
+ concern into a runnable loop: a low-fi structural wireframe → a self-contained
18
+ HTML mock (resolve semantic tokens → one kit class per component → compose the
19
+ prototype tree → populate with mock data) → a captured screen the human
20
+ confirms *before* any build. Wired into `0-setup` and `1-specify`.
21
+ - **Wireframe + HTML-mock recipe (`udd-wireframe.md`) + sample templates** — a
22
+ zero-dependency, any-stack floor for rendering a prototype tree into a real
23
+ screen, with a worked sample set (`tokens.sample.css`, `kit.sample.css`,
24
+ `welcome.sample.html`, `settings.sample.html` reusing the kit,
25
+ `wireframe.sample.txt`). One semantic-token flip re-themes every screen by
26
+ construction. An optional `@json-render/image` (Satori → PNG/SVG, no browser)
27
+ fast path is noted for JS-ecosystem projects.
28
+ - **Capture-evidence convention + `missing_capture` WARN** — design captures live
29
+ at `.add/design/captures/<name>.<ext>`; `add.py check` emits a never-red
30
+ `missing_capture` warning for any prototype lacking a capture (silent when
31
+ absent, so non-UI projects stay clean). The engine *measures* capture presence;
32
+ it never renders.
33
+
34
+ ## [1.4.0] — 2026-06-15
35
+
36
+ The guided-onboarding release: starting and running an ADD project is now guided
37
+ and self-tuning. Setup interviews you into a run mode and a first milestone and
38
+ deepens each drive, the engine schedules parallel work into dependency waves,
39
+ stale installs nudge any agent to update, and the AI carries a human-owned voice
40
+ that improves itself. All additive; no breaking changes (SemVer MINOR).
41
+
42
+ ### Added
43
+ - **Guided, self-tuning setup** — `0-setup` now interviews instead of assuming:
44
+ it proposes a **run mode** (a parallel+auto vs. sequential comparison table,
45
+ confirm-to-keep the recommended default), sketches a **first milestone** as a
46
+ kickoff suggestion (goal + flow + scenarios, shown before it asks), and runs a
47
+ per-drive **domain deep-dive** (DDD · SDD · UDD · TDD) that captures the
48
+ decisions as ADRs. Onboarding stops being a blank page.
49
+ - **`add.py waves` DAG scheduler** — a new read-only command that groups the
50
+ active milestone's open tasks into topological **waves** (a wave is the tasks
51
+ whose in-milestone dependencies have all landed), names the **critical path**,
52
+ emits an advisory **tier hint** (a scope-of-impact proxy for model selection,
53
+ never a gate), and surfaces a transitively-**blocked** set with what each task
54
+ is waiting on. It never mutates state and `streams.md` gains a "DAG strategy"
55
+ section that points at it.
56
+ - **`SOUL.md` — a human-owned, self-improving voice** — `init` now scaffolds a
57
+ `.add/SOUL.md` voice doc (schema: Name · Tone · Communication style · Trust ·
58
+ Learns-from · Voice deltas) with a *proposed* "Trusting" starter voice that is
59
+ explicitly yours to rewrite — the tests assert the schema, never the tone words.
60
+ `status` points at it to read each session, and a new `soul.md` guide drives an
61
+ observe→confirm→rewrite **voice-delta loop** (the human is the only writer),
62
+ the voice-side sibling of the competency-delta→foundation loop.
63
+ - **Agent-agnostic update nudge** — because every agent is told to run
64
+ `add.py status`/`guide` first each session, the engine uses that one universal
65
+ chokepoint to flag a stale install: on those orientation reads only, when a
66
+ launcher `.add-version` stamp is present and the registry's latest is newer, it
67
+ writes one `ACTION REQUIRED` line to **stderr** naming the channel-correct
68
+ command (`npx @pilotspace/add@latest update` / `pipx run pilotspace-add
69
+ update`). It is the engine's one deliberate, tightly-bounded network touch:
70
+ fail-open (offline/timeout → silent no-op), throttled once per 24 h via a
71
+ git-ignored `.update-cache.json`, inert without a launcher stamp, and silenced
72
+ by `ADD_NO_UPDATE_CHECK=1`. stdout and exit codes are never touched, so `--json`
73
+ stays clean. (Originated as community PR #17.)
74
+ - **First-class `add.py autonomy show|set`** — autonomy was the only mutable
75
+ first-class state with no CLI verb, so an agent driving under `autonomy: auto`
76
+ could hallucinate the missing `add.py autonomy` command, hit `invalid choice`,
77
+ and derail an autonomous run. `autonomy show` prints declared · effective
78
+ (fallback-resolved) · project default · the verify-gate owner; `autonomy set
79
+ <level> [slug] [--project] [--yes]` is the first writer of the `autonomy:`
80
+ header token — an idempotent, atomic single-line rewrite (trailing comment
81
+ preserved, never appended) with three fail-closed guards run before any write:
82
+ an invalid level, raising the rung without `--yes` (raising is a human-owned
83
+ trust escalation), and raising a `risk: high` task to `auto`. The command-shaped
84
+ header-edit wording is de-shaped to cite the verb, and an `[enforced]`
85
+ `WORDING_RUBRIC` fence keeps the phantom phrasing from regressing.
86
+ - **Foundation compaction across all four specs** — the living foundation now
87
+ stays relevant-first and short as a project grows. Every append-only sequence
88
+ (`PROJECT.md` §Spec · §Key-Decisions · `CONVENTIONS.md` learnings) reads
89
+ **newest-first**, and at milestone close the AI proposes collapsing each spec's
90
+ shipped, zero-open-residue tail into one per-spec **rolled-up settled line** —
91
+ the human confirms one line at a time; it summarizes and points to git, never
92
+ deletes, and every open residue stays expanded. A new `compact-foundation.md`
93
+ skill guide drives the ritual — convention-guided, with no new engine command,
94
+ and distinct from `add.py compact` (which archives finished-milestone files).
95
+ The loop chapter and glossary document it.
96
+ - **Per-step Advisor + Confidence context** — every ADD step now carries a thin
97
+ pointer to two new shared skill guides: `advisor.md` (when and how to delegate
98
+ one plan-following subagent — vendor-neutral; the engine never spawns) and
99
+ `confidence.md` (an advisory 0–1 self-score across six dimensions, refine if any
100
+ dimension scores below 0.9). Both are advisory by construction — the self-score
101
+ is never a gate — making delegate-and-self-assess first-class guidance for any
102
+ agent driving the loop.
103
+ - **`.add/.gitignore` scaffolded at init** — `init` now writes a co-located
104
+ `.add/.gitignore` so the engine's transient local artifacts (scope snapshots,
105
+ pre-archive backups, the update-nudge cache) never reach git. It is additive and
106
+ never clobbers an existing copy; edit it freely.
107
+
108
+ ### Changed
109
+ - **Conversational-only install hand-off** — after `init`, the closing hint points
110
+ only at the conversational entry point: open your AI agent CLI, run `/add`, and
111
+ say what you want to build. The hand-off is tool-agnostic (Claude Code, Codex,
112
+ …) and no longer advertises a manual `add.py new-task` / `--await-lock` escape
113
+ as the primary path (the flag still exists; `/add` runs it internally).
114
+
7
115
  ## [1.3.0] — 2026-06-13
8
116
 
9
117
  The render-ready-foundation release: a UI project now gets a lintable design
@@ -343,6 +343,10 @@ You just ran the method; now read *why* it's shaped this way:
343
343
  - Each step in depth — `.add/docs/03-step-1-specify.md` through `.add/docs/09-the-loop.md`
344
344
  - Operating it on a team — `.add/docs/11-governance.md`, `.add/docs/12-roles.md`
345
345
  - A fully worked example — `.add/docs/appendix-d-worked-example.md`
346
+ - Building UI? The render-ready UDD foundation — `.add/DESIGN.md` is the prose
347
+ front-door to a lintable design system (`.add/design/` tokens · catalog ·
348
+ prototypes) the AI drafts from; `add.py check` lints it (delete `DESIGN.md` if
349
+ your project has no UI)
346
350
 
347
351
  The rule to remember: **build the right thing (direction), prove it's right
348
352
  (verification), and let the AI do the building in between.**
package/README.md CHANGED
@@ -46,6 +46,12 @@ pilotspace-add init
46
46
  No flags needed — the project name is inferred from your folder and the stage
47
47
  defaults to `prototype` (pass `--name "My App" --stage mvp` to choose up front).
48
48
 
49
+ **Already installed?** Refresh to the latest without a re-install —
50
+ `npx @pilotspace/add@latest update` (or `pipx run pilotspace-add update`)
51
+ re-materializes the skill, tooling, and book while leaving your project work
52
+ (`.add/state.json`, `PROJECT.md`, milestones, tasks) untouched; add `--check` to
53
+ see whether a project is behind the installed package.
54
+
49
55
  **New here?** Follow the [10-minute Quickstart](./GETTING-STARTED.md) — it walks
50
56
  your first feature end to end.
51
57
 
@@ -56,11 +62,18 @@ This installs:
56
62
  | `.claude/skills/add/` | the `add` skill Claude loads (thin router + per-phase guides) |
57
63
  | `.add/tooling/add.py` | scaffolder + state tracker (Python, stdlib only) |
58
64
  | `.add/docs/` | the AIDD book — the method rationale |
65
+ | `.add/DESIGN.md` | (UI projects) the prose front-door to the **render-ready UDD foundation** — delete it if your project has no UI |
66
+
67
+ On a UI project, UDD gives the AI a frozen design ground to draft from: `DESIGN.md`
68
+ plus a lintable JSON foundation under `.add/design/` (design tokens · component
69
+ catalog · prototype trees). `add.py check` lints that foundation, going red with a
70
+ named code on any layer, catalog, tree, or cross-file violation — and staying
71
+ silent when a project has no design set.
59
72
 
60
73
  Project state (`.add/state.json`) and the living-documentation files (`CONVENTIONS.md`,
61
- `GLOSSARY.md`, `MODEL_REGISTRY.md`, `dependencies.allowlist`) are *not* created
62
- here — the installer drops files only; initialisation is the agent's first move
63
- when you run `/add`.
74
+ `GLOSSARY.md`, `MODEL_REGISTRY.md`, `dependencies.allowlist`, `SOUL.md` the AI's
75
+ human-owned voice) are *not* created here — the installer drops files only;
76
+ initialisation is the agent's first move when you run `/add`.
64
77
 
65
78
  ## Use it
66
79
 
package/bin/cli.js CHANGED
@@ -102,15 +102,10 @@ function cmdInit(args) {
102
102
  // (via `/add`) or a CLI user — a pre-run plain `add.py init` would grandfather-lock
103
103
  // the v12 lock-down gate before `/add` runs (see file header). So no Python is run here.
104
104
  log("\nDone. The `add` skill + tooling are installed (no project state yet — that's intentional).");
105
- log("Next: open Claude Code, run `/add`, and say what you want to build — the agent");
105
+ log("Next: open your AI Agent CLI (like Claude Code, Codex, etc.), then run `/add`, and say what you want to build — the agent");
106
106
  log(" sets up the foundation, sizes it into a milestone, and drives the build with you;");
107
107
  log(" you sign off once, at the lock-down.");
108
108
  log("");
109
- log("Prefer the CLI / not using Claude Code? Initialise it yourself (this arms the lock-down):");
110
- const launcher = process.platform === "win32" ? "py" : "python3";
111
- log(` ${launcher} .add/tooling/add.py init --await-lock` +
112
- (args.stage ? ` --stage ${args.stage}` : "") +
113
- (args.name ? ` --name "${args.name}"` : ""));
114
109
  }
115
110
 
116
111
  // --- update: re-materialize the managed layer without a re-install -----------
@@ -47,10 +47,12 @@ A spec delta feeds the *next feature*. But a loop also teaches the **method itse
47
47
 
48
48
  Each delta is one tagged entry — `- [COMPETENCY · status] the learning (evidence: a pointer)` — and the evidence is **required**: a failing scenario, a production signal, a review note. No evidence means it is an opinion, not a delta. The AI **emits** deltas as `open`; it never consolidates its own. Consolidation is judgment, and judgment is the human's — the same verify/observe decision point that keeps the AI from grading its own work.
49
49
 
50
- **The consolidation.** At milestone close (or on demand, when open deltas pile up), a person runs the retrospective consolidation: **gather** every `open` delta across the milestone's tasks, **group** them by competency, **propose** the exact foundation edit for each, **confirm** with the human one by one, then **write** — append-only — flipping each delta to `folded` (merged) or `rejected` (considered and deliberately not merged, left in place so the trail survives), and bumping the `foundation-version:` marker. `DDD`/`SDD`/`UDD` deltas consolidate into the matching section of `PROJECT.md`; `TDD`/`ADD` consolidate into `CONVENTIONS.md` (they sharpen the engine, not the product); and **every** consolidation also appends one row to `PROJECT.md` §Key Decisions — the universal, auditable record of what the foundation learned.
50
+ **The consolidation.** At milestone close (or on demand, when open deltas pile up), a person runs the retrospective consolidation: **gather** every `open` delta across the milestone's tasks, **group** them by competency, **propose** the exact foundation edit for each, **confirm** with the human one by one, then **write** — append-only, newest-first (the newest record prepended at the top) — flipping each delta to `folded` (merged) or `rejected` (considered and deliberately not merged, left in place so the trail survives), and bumping the `foundation-version:` marker. `DDD`/`SDD`/`UDD` deltas consolidate into the matching section of `PROJECT.md`; `TDD`/`ADD` consolidate into `CONVENTIONS.md` (they sharpen the engine, not the product); and **every** consolidation also prepends one row at the top of `PROJECT.md` §Key Decisions — the universal, auditable record of what the foundation learned.
51
51
 
52
52
  **Tooling.** `add.py deltas` lists every open delta across the project (so nothing waiting to be consolidated is invisible); `add.py check` lints each delta's well-formedness — known competency tag, valid status, non-empty evidence. There is deliberately **no `add.py fold`**: the engine stays judgment-free, and the ritual lives with the human who owns it.
53
53
 
54
+ **Foundation compaction.** The consolidation *prepends* new learnings; **foundation compaction** is the separate, later step that *shrinks* the result. At milestone close (or on demand, once a foundation spec grows past one screen), the AI proposes collapsing the stable, shipped, zero-residue tail of each foundation spec into ONE per-spec **rolled-up settled line** at the bottom — and the human confirms, one line at a time, exactly as with the consolidation. It never deletes: a settled line summarizes the prose and keeps a `see git` pointer, so the record is lossy on wording but lossless on traceability, and any OPEN residue always stays live. Each spec collapses in its own **per-spec shape** — `PROJECT.md` §Spec version bullets, §Key-Decisions rows, `CONVENTIONS.md` learnings, the `GLOSSARY.md` definition, the `MODEL_REGISTRY.md` rows — under one shared eligibility rule. Because every append-only sequence is **newest-first** (newest record on top), compaction collapses *upward from the bottom*: the settled line anchors at the tail (the oldest end). Like the consolidation it is convention-guided — there is deliberately no `add.py` command for it (read `compact-foundation.md`) — and it is distinct from the engine's `add.py compact <slug>`, which archives a finished milestone's files rather than shrinking a living spec.
55
+
54
56
  ## Re-entrancy: the loop is the whole point
55
57
 
56
58
  Two principles converge here. *The flow is re-entrant* — any step can send you back to an earlier one — and *the flow is a loop* — production feeds the next specification. Together they mean the artifacts you built are never "finished"; they are living documents that the next cycle refines.
@@ -47,6 +47,17 @@ the method already names, made explicit as three concerns.
47
47
  test that behaviour; the foundation keeps the design intent that makes a screen
48
48
  worth building.
49
49
 
50
+ When a milestone has screens, UDD is not only a static `DESIGN.md` — it runs a
51
+ **design-definition loop** that turns the domain into a screen the human has *seen
52
+ and confirmed before build*. Its four beats are `review-domain → research-components
53
+ → wireframe → render-capture-confirm`: read the domain into screens and regions,
54
+ research and reuse components before inventing them, wireframe the structure low-fi,
55
+ then render a real screen and **capture** it. That capture is the **design-confirm**
56
+ evidence — a real image the person approves *before* implementation, so the build
57
+ matches the layout instead of discovering it. The book keeps the *why*; the
58
+ operational recipe (the wireframe format, the token-bound mock, the capture engines)
59
+ lives in the `add` skill's `design.md` and `udd-wireframe.md`.
60
+
50
61
  These three foundation competencies, together with the **TDD ⇄ ADD** engine of
51
62
  [Part II](./02-the-flow.md), are ADD's five. The first four feed context to the
52
63
  fifth, where the AI executes on it:
@@ -100,6 +100,22 @@
100
100
 
101
101
  **Verification capacity / review throughput** — the rate at which a team can confirm AI output is correct; the real ceiling on safe speed.
102
102
 
103
+ **Foundation compaction** — the retrospective shrink: collapse a foundation spec's stable, shipped, zero-residue tail into one rolled-up settled line; the AI proposes and the human confirms; summarize and point, never delete; a SEPARATE step from the retrospective consolidation; distinct from the engine `add.py compact` (which archives finished-milestone files). See **Rolled-up settled line**, **Per-spec shape**.
104
+
105
+ **Rolled-up settled line** — the single line a compaction leaves in place of a collapsed run of records: lossy on prose, lossless on traceability (it carries a `see git` pointer).
106
+
107
+ **Per-spec shape** — each foundation spec's own tailored rolled-line format (PROJECT §Spec bullets · §Key-Decisions rows · CONVENTIONS learnings · GLOSSARY definition · MODEL_REGISTRY rows), all sharing one eligibility rule: shipped + zero open residues.
108
+
109
+ **Newest-first append-only** — every append-only foundation sequence prepends the newest record at the top; the rolled-up settled line anchors at the bottom (the oldest end), so compaction collapses upward.
110
+
111
+ **Wireframe** — the Stage-A low-fidelity, *structural* map of one screen: its regions and the component **slots** inside them, derived from `prototypes/<name>.json` *before* any color, type, or spacing — it answers "what goes where", not "what it looks like". Beat 3 of the UDD **design-definition loop**; the low-fi half of the two-stage fidelity that ends in a confirmed capture. See the `add` skill's `udd-wireframe.md` (Stage A).
112
+
113
+ **Design mock** — the Stage-B high-fidelity, **self-contained** HTML render of a screen: the `catalog.json` components as a reusable token-bound kit, bound to `tokens.json` and populated with mock data, openable offline and screenshot-able. The human-facing *visible* evidence the human confirms (the frozen `prototypes/<name>.json` tree is its machine-checkable twin). Beat 4's hi-fi artifact; the recipe lives in the `add` skill's `udd-wireframe.md` (Stage B).
114
+
115
+ **Capture** — the real rendered image (PNG/SVG) of a design mock: the **design-confirm evidence** artifact. Captures live at `.add/design/captures/<name>.<ext>` (one per prototype) and are attached or mentioned in the feature's `TASK.md`; `@json-render/image` (Satori → PNG/SVG, no browser) is the named default capture engine, otherwise the self-contained mock is screenshot headless. The engine never renders — it only MEASURES presence: `add.py check` raises a never-red `missing_capture` WARN for a prototype with no capture.
116
+
117
+ **Design-confirm** — the human touchpoint closing the UDD **design-definition loop** (`review-domain → research-components → wireframe → render-capture-confirm`, beat 4 of the `add` skill's `design.md`): approving the captured screen image **before build**, show-before-ask, so the implementation matches the layout the human has already seen instead of discovering it.
118
+
103
119
  ---
104
120
 
105
121
  ## Optional mapping to formal phase names
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilotspace/add",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
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
5
  "bin": {
6
6
  "add": "bin/cli.js"
@@ -31,6 +31,11 @@ Run the tool to find the resume point instead of re-reading the repo:
31
31
  python3 .add/tooling/add.py status
32
32
  ```
33
33
 
34
+ `status` points at two things to read when orienting: `.add/PROJECT.md` (the foundation) and
35
+ `.add/SOUL.md` (your **voice** — tone, communication style, what keeps the human's trust). Read
36
+ `.add/SOUL.md` each session and let it shape how you speak; it is human-owned and self-improving
37
+ (the `soul-self-improve` path proposes voice deltas the human confirms).
38
+
34
39
  - **No `.add/state.json` yet** (a fresh install drops tooling + docs but does *not* init — so `status` says
35
40
  `no .add/ project found`) → enter **autonomous setup**: YOU run init yourself —
36
41
  `add.py init --name "<inferred>" --stage <picked> --await-lock` (don't tell the human to) — then read
@@ -86,13 +91,25 @@ In **observe**, also emit **lessons learned** — learnings tagged by which of t
86
91
  (`DDD · SDD · UDD · TDD · ADD`) they improve — so the foundation self-improves across loops.
87
92
  You write them as `open`; the human consolidates them into `PROJECT.md`. Read `deltas.md` for the
88
93
  grammar and the status lifecycle. At milestone close (or on demand), run the retrospective consolidation that
89
- gathers confirmed deltas into a versioned foundation — read `fold.md`.
94
+ gathers confirmed deltas into a versioned foundation — read `fold.md`. Then (or on demand) compact the stable tail of each foundation spec into a rolled-up settled line — read `compact-foundation.md` (a SEPARATE step, run after `fold.md`).
95
+
96
+ Observe also tunes your **voice**: propose a confirmable **voice delta** from the human's wordings +
97
+ flow that, once they confirm, rewrites `SOUL.md` (the human is the only writer) — read `soul.md`.
90
98
 
91
99
  ## Beyond the bundle — load on demand
92
100
 
93
101
  Once **§3 CONTRACT is FROZEN**, the build→verify half is a dynamic, auto-gated run
94
102
  (`autonomy: auto` default, lowered to `conservative` or `manual` for a human gate) — read `run.md`. To
95
- pipeline several ready tasks behind their own frozen contracts, read `streams.md`.
103
+ pipeline several ready tasks behind their own frozen contracts, read `streams.md`. To delegate
104
+ one piece of your plan to a subagent that follows it — when to spawn, the plan-following prompt
105
+ template, the tier pick — read `advisor.md`; and at any decision point self-score your draft
106
+ (0–1 across six dimensions, refine if any < 0.9) with `confidence.md`. Both are advisory: the
107
+ engine never spawns, and the self-score is never a gate.
108
+
109
+ When a **UI feature** reaches specify, run the **design-definition loop** in `design.md` (UDD):
110
+ review the domain → research and reuse components → wireframe → render a real captured screen the
111
+ human confirms **before** build — so the build matches the expected layout. Tool-agnostic; the
112
+ engine never renders.
96
113
 
97
114
  When a milestone's tasks are all done but its **goal** (the `MILESTONE.md` exit criteria) is not
98
115
  yet met, `milestone-done` holds the milestone open — read `loop.md` for the dynamic loop that turns
@@ -0,0 +1,75 @@
1
+ # Advisor — spawning one subagent to follow your plan
2
+
3
+ The **advisor** strategy is for the orchestrating agent: spawn a *single* subagent to execute
4
+ one piece of your plan, then merge its verdict back in. It is the single-subagent companion to
5
+ `streams.md` — streams pipelines *many* independent tasks in parallel worktrees; the advisor
6
+ delegates *one* well-scoped piece (a sweep, a review, a batch) while you stay in the loop. The
7
+ engine never spawns; this is your judgment to make per step.
8
+
9
+ ## When to spawn — and when not
10
+
11
+ Spawn a subagent when the piece is **separable and worth the round-trip**:
12
+
13
+ - **Broad / expensive sweep** — gather a wide map cheaply, return a compact result (the `0-ground`
14
+ broad sweep is the canonical case).
15
+ - **Independent adversarial review** — a fresh context argues *against* your result (the `6-verify`
16
+ earned-green refute-read), so the check is not graded by the author.
17
+ - **A well-scoped delegable batch** — a self-contained slice with a clear contract and return shape.
18
+ - **Context offload** — work that would bloat your context but compresses to a small verdict.
19
+
20
+ Do **not** spawn when the work is narrow and cheap enough to do in-context: a small sweep, a
21
+ two-file read, a quick edit. A spawn costs a round-trip and a fresh context — pay it only when
22
+ the piece is big or independent enough to earn it. When in doubt, do it in-context.
23
+
24
+ ## The plan-following prompt template
25
+
26
+ Give the subagent the *piece of your plan it owns* and a fixed return shape. This reuses
27
+ `streams.md`'s worker-contract tags for a single advisory subagent — the contract is identical
28
+ on any runner; only the spawn adapter (see `streams.md`) changes.
29
+
30
+ ```xml
31
+ <objective>
32
+ Execute THIS piece of the orchestrator's plan: {{PIECE}}. You own only this piece — not the
33
+ surrounding decisions. Return a verdict; do not record state.
34
+ </objective>
35
+
36
+ <persona>
37
+ You are a {{DOMAIN}} engineer. Correctness over speed; a wrong-but-plausible result is expensive.
38
+ Work step by step, following the plan:
39
+ 1. Load the context files; confirm you understand the piece you own.
40
+ 2. Do the work in small steps, honoring the orchestrator's plan and constraints.
41
+ 3. Self-score your result with confidence.md; if any dimension < 0.9, refine before returning.
42
+ </persona>
43
+
44
+ <context_files>
45
+ the plan / task files the piece needs (read-only unless the piece says otherwise)
46
+ </context_files>
47
+
48
+ <return>
49
+ End with a structured verdict the orchestrator parses and RECORDS:
50
+ { piece, result, evidence, confidence: {per-dimension 0–1}, open_questions }.
51
+ Do NOT run add.py or write any shared state — you propose, the orchestrator records.
52
+ </return>
53
+ ```
54
+
55
+ ## Choosing the model — vendor-neutral tiers
56
+
57
+ Reuse `streams.md`'s tiers, never a new vocabulary: **mid** (Claude Code: `sonnet`) for ordinary,
58
+ well-scoped pieces with a clear contract; **top** (Claude Code: `opus`) for complex, ambiguous, or
59
+ cross-cutting pieces. The tier maps to the runner's model id through the same adapter `streams.md`
60
+ defines. A stronger model never buys back a human gate: high-risk scope still escalates.
61
+
62
+ ## The hard rule — you delegate, you do not abdicate
63
+
64
+ <constraints>
65
+ The engine never spawns — spawning is the orchestrating agent's choice (tool-agnostic). And:
66
+ - the subagent PROPOSES; the orchestrator RECORDS — a worker never runs add.py or writes shared
67
+ state (state.json, MILESTONE.md, a sibling's files): you read its verdict and record the outcome;
68
+ - delegation never lowers a gate — a SECURITY finding still HARD-STOPs, and high-risk scope still
69
+ escalates to the human, whoever (or whatever tier) did the work;
70
+ - the spawned subagent returns its confidence.md self-score; a low score is a signal to refine or
71
+ re-spawn, never a pass.
72
+ </constraints>
73
+
74
+ > Used per step: each phase guide's Advisor hook points here, so an agent spawns in the idiom of
75
+ > the phase it is in (see the per-step hooks).
@@ -0,0 +1,53 @@
1
+ # Foundation compaction — collapse the stable tail
2
+
3
+ This is the **retrospective shrink**. `fold.md` PREPENDS new learnings (newest-first); foundation
4
+ compaction later COLLAPSES the stable tail of each foundation spec into a rolled-up settled line — so
5
+ PROJECT.md, CONVENTIONS.md, GLOSSARY.md, and MODEL_REGISTRY.md keep to one screen as the project grows.
6
+
7
+ You (the AI) **gather and propose**; the **human confirms**; you then write the settled line. This is a
8
+ **convention**, not a command — there is no `add.py compact-foundation` (the engine stays judgment-free).
9
+ It is DISTINCT from the engine `add.py compact <slug>` (the archive recovery-bundle move).
10
+
11
+ ## When
12
+
13
+ At **milestone close** (after `fold.md`) or **on demand** when a spec has grown past one screen.
14
+ Compaction is a SEPARATE step from `fold.md` — never merged into the retrospective consolidation.
15
+
16
+ ## Eligibility (one shared test)
17
+
18
+ An entry is compaction-eligible **IFF** its milestone is **shipped** (done/archived) **AND** it carries
19
+ **zero open residues**/deltas. An unshipped or open-residue entry is NOT eligible — leave it live
20
+ (`open-residue-version`).
21
+
22
+ ## The ritual
23
+
24
+ 1. **Gather** — collect the stable, shipped, zero-residue tail of the target spec (its oldest entries).
25
+ 2. **Propose** — draft the per-spec rolled-up settled line (see the shapes below) and show the human.
26
+ 3. **Confirm** — the human accepts or declines. No write happens without confirmation.
27
+ 4. **Write** — replace the collapsed tail with ONE settled line at the BOTTOM (newest-first: live records
28
+ stay on top, the settled line anchors at the tail), carrying a git/archive pointer.
29
+
30
+ ## Per-spec rolled-line shapes (from the frozen compaction-contract)
31
+
32
+ - **PROJECT.md §Spec** — a run of stable `[folded fv N..M]` bullets → `settled fvN–fvM — <theme> (see git)`.
33
+ - **PROJECT.md §Key-Decisions** — matching shipped rows → one `| settled <dateA>–<dateB> | <N> decisions rolled | … | see git |` row at the tail.
34
+ - **CONVENTIONS.md** — a run of stable `(TAG)` learnings → `- settled conventions <range> — <N> rules (see git)`.
35
+ - **GLOSSARY.md** — a verbose, stable definition → its terse canonical line + `(rationale: see git)`. *(forward-looking — small today.)*
36
+ - **MODEL_REGISTRY.md** — superseded model rows → `Prior models: <list> (see git)`. *(forward-looking — nothing to compact yet.)*
37
+
38
+ ## Preservation (every collapse)
39
+
40
+ - **Never delete** — summarize and point; a settled line is lossy on prose, lossless on traceability.
41
+ - A surviving **git**/archive pointer is mandatory (`trail-loss` if dropped).
42
+ - **OPEN residues stay** live; the audit trail is summarized-not-deleted.
43
+
44
+ ## Reject codes (judgment-checked — the AI proposes, the human confirms)
45
+
46
+ - `open-residue-version` — the entry is unshipped or has ≥1 open delta/residue; leave it live.
47
+ - `trail-loss` — the collapse would drop the git/archive pointer or the audit summary.
48
+ - `wrong-order` — a record is not newest-first, or the settled line is not at the tail.
49
+
50
+ ## Distinct from `add.py compact`
51
+
52
+ Foundation compaction ≠ engine `add.py compact <slug>`. It mirrors `fold.md`'s "AI proposes, human
53
+ confirms" voice and stays convention-guided — no engine command, no `add.py check` enforcement.
@@ -0,0 +1,48 @@
1
+ # Confidence — the self-score that aims attention
2
+
3
+ The **confidence self-score** is an *advisory* check an agent runs on its own drafted artifact
4
+ — a spec, a contract, a build, or a verdict returned by a spawned subagent — *before* it
5
+ presents it. It sharpens the draft and aims the reader's eye at the soft spots; it is never a
6
+ gate. Score it privately, refine while it is cheap, then surface what stayed uncertain.
7
+
8
+ ## The six dimensions
9
+
10
+ Score each from 0 to 1 (0–1), honestly, on the artifact you are about to hand over:
11
+
12
+ - **Completeness** — did it cover every rule, scenario, and rejection the task asked for?
13
+ - **Clarity** — would the next reader understand it without you in the room?
14
+ - **Practicality** — is it feasible and implementable as written, against the real code?
15
+ - **Optimization** — does it balance correctness, simplicity, and cost — no gold-plating, no corner cut?
16
+ - **Edge cases** — did it name the failure modes, the concurrency, the empty/oversized inputs?
17
+ - **Self-evaluation** — does it carry its own refine step — a way to catch its own mistakes?
18
+
19
+ If **any** dimension scores **< 0.9**, refine the artifact before you present it (or before you
20
+ return from a spawned subagent), then re-score. The point is to spend the cheap iteration now,
21
+ not after a human has read past the weak spot.
22
+
23
+ ## Where it plugs in
24
+
25
+ - It **feeds the lowest-confidence flag** (run.md · phases/1-specify.md): the lowest-scoring
26
+ dimension or point is what you surface ⚠-first at the contract freeze. The self-score is the
27
+ private computation; the lowest-confidence flag is the public surfacing of its weakest point —
28
+ this rubric only *aims* that flag, it does not redefine it.
29
+ - A persistently low score on a risky scope is a signal to **recommend lowering the autonomy
30
+ level** (auto → conservative / manual; run.md). Recommend it — never force it; choosing the
31
+ autonomy level stays the human's call.
32
+
33
+ ## The hard rule — advisory, never a gate
34
+
35
+ <constraints>
36
+ The confidence self-score is advisory only — it is never a gate. It never:
37
+ - auto-PASSes a verify or blocks a run — the verify outcome rests on evidence (passing tests,
38
+ the non-functional review), not on a number the agent assigned itself;
39
+ - substitutes for evidence or for the human decision point;
40
+ - is recorded as a score the human "agreed to" — a self-asserted score that gated would only
41
+ move an unread approval one level up (run.md).
42
+
43
+ What it MAY do: aim the lowest-confidence flag, trigger a refine pass, and recommend lowering
44
+ the autonomy level. The gate itself stays evidence-based and human-owned.
45
+ </constraints>
46
+
47
+ > Used per step: each phase guide's Confidence hook points here, so an agent self-scores in the
48
+ > idiom of the phase it is in (see the per-step hooks).
@@ -0,0 +1,92 @@
1
+ # Design — the design-definition loop (UDD)
2
+
3
+ When a **UI feature** reaches specify, design it before you build it. This loop takes the
4
+ feature from the **domain** to a screen the human has **seen and confirmed** — a real captured
5
+ image — *before* any implementation, so the build matches the expected layout instead of
6
+ discovering it. It is loaded on demand (like `advisor.md` / `confidence.md`); the engine never
7
+ runs it for you.
8
+
9
+ Design before code is the UDD half of the method. The token + component foundation a UI project
10
+ draws from already exists — `tokens.json` (the compact-DTCG dialect, `udd-tokens.md`),
11
+ `catalog.json` + `prototypes/<name>.json` (`udd-catalog.md`). This loop is how you *fill* that
12
+ foundation for a feature and earn the human's sign-off on the look before build.
13
+
14
+ ## The loop — four beats
15
+
16
+ ```
17
+ review-domain → research-components → wireframe → render-capture-confirm
18
+ ```
19
+
20
+ Run the beats in order. Each feeds the next; the last ends at a human design-confirm.
21
+
22
+ ### 1 · review-domain
23
+ Start from the **domain**, not from a blank canvas. Read the domain model — entities, flows, the
24
+ ubiquitous language in `PROJECT.md` / `GLOSSARY.md` — and derive **which screens** the feature
25
+ needs and the **regions** each screen holds. Map each domain entity to a *presentational*
26
+ component (it shows state; it does not own a domain decision). The screen list + per-screen
27
+ regions are this beat's output, and they are grounded in the domain you just read.
28
+
29
+ ### 2 · research-components (reuse before you invent)
30
+ Check `catalog.json` **first** and **reuse** the components already there — that is what keeps
31
+ screens consistent. Research a reference UI (a websearch over pattern galleries / component
32
+ libraries for this kind of screen) only to fill a **genuine gap**, and propose a **new** catalog
33
+ component for that gap with a **cited** reference. Reuse before invention; a new component is the
34
+ exception, named and justified, not the default.
35
+
36
+ ### 3 · wireframe
37
+ Draw a **low-fi**, **structural** layout for each screen — regions and component slots, no
38
+ styling, no color. This is the cheapest possible artifact that shows the *expected layout*, so
39
+ the human can correct the structure before a pixel is styled. Confirm the wireframe, then move on.
40
+
41
+ ### 4 · render-capture-confirm
42
+ Render the screen as a **self-contained HTML mock** — the project's component library via CDN,
43
+ bound to `tokens.json` (resolved to CSS variables), composed from the **reusable per-component
44
+ kit** (one token-bound partial per catalog component), populated with realistic **mock** data.
45
+ **Capture** a real image of it (a headless screenshot) and present that image to the human for
46
+ **design-confirm** — show-before-ask, **before build**. On confirm, record the layout back to
47
+ `prototypes/<name>.json` + `catalog.json`, save the captured image to
48
+ `.add/design/captures/<name>.<ext>`, and **attach or mention it in the feature's `TASK.md`**
49
+ (alongside the §6 evidence) — so the screen the human approved is traceable from the task that
50
+ builds it. The HTML mock is the *visible evidence*; the json-render tree is the
51
+ *machine-checkable* record of the same screen.
52
+
53
+ ## Tool-agnostic capture
54
+
55
+ How you render and capture is **your** choice, not the engine's: a headless browser
56
+ (Playwright / Puppeteer), an `html2image`-style renderer, a browser-automation skill, a design
57
+ tool, or a hosted screenshot service — whatever the agent has. The recommended default is the
58
+ self-contained HTML mock above, captured headless, because it needs no app build yet still wears
59
+ the project's real tokens and component vocabulary. For a project that renders json-render, the
60
+ recommended default is **`@json-render/image`** (Satori → PNG/SVG, no browser) — a deterministic
61
+ `Spec` → image. The captured image is a **design-confirm evidence** artifact the human approves;
62
+ it is never an engine output, and the engine never renders. This keeps the loop tool-agnostic and
63
+ the method renderer-free.
64
+
65
+ Captures live at **`.add/design/captures/<name>.<ext>`** (one per prototype) and are
66
+ attached/mentioned in the feature's `TASK.md`. `add.py check` raises a never-red
67
+ `missing_capture` WARN for any prototype under `.add/design/prototypes/` that still lacks a
68
+ capture — a nudge to render + confirm it, never a blocker.
69
+
70
+ The loop **binds** the existing UDD contracts **read-only**: `tokens.json`, `catalog.json`, and
71
+ `prototypes/<name>.json` are read and composed, never reshaped — the `prototypes/<name>.json`
72
+ data contract stays **unchanged** (a change to it is a change request, not a design step). And
73
+ **identity** values — brand color, palette, typeface — stay **human-owned**: surface them for the
74
+ human to decide, never auto-pick a brand value (`udd-tokens.md`).
75
+
76
+ ## The hard rules
77
+
78
+ <constraints>
79
+ - **Domain first.** A screen is derived from the domain (beat 1), never sketched blind.
80
+ - **Reuse before invent.** Beat 2 checks the catalog first; a new component is a justified,
81
+ cited exception — never the reflex.
82
+ - **Confirm before build.** The captured image is approved by the human *before* implementation;
83
+ a design-confirm placed at or after build defeats the loop.
84
+ - **The engine never renders.** Capture is a recommended, tool-agnostic recipe run by the
85
+ agent's own tools; the image is evidence, not an engine artifact.
86
+ - **Bind, don't break.** The loop reads `tokens.json` / `catalog.json` / `prototypes/<name>.json`
87
+ read-only; the data contract is unchanged, and identity values stay human-owned.
88
+ </constraints>
89
+
90
+ > Used at specify for a UI feature: `phases/0-setup.md` scaffolds `DESIGN.md`, and
91
+ > `phases/1-specify.md` points here when the feature has a screen — run the four beats, then
92
+ > carry the confirmed layout into the contract.
package/skill/add/fold.md CHANGED
@@ -19,7 +19,7 @@ lives here so the engine stays judgment-free.
19
19
  2. **Group** — bucket them by competency (`DDD · SDD · UDD · TDD · ADD`).
20
20
  3. **Propose** — for each, draft the exact foundation edit (see routing) and show the human.
21
21
  4. **Confirm** — the human accepts or declines each delta. No write happens without this.
22
- 5. **Write** — append the accepted edits, flip each delta's status, and bump the version.
22
+ 5. **Write** — prepend the accepted edits at the top (newest-first), flip each delta's status, and bump the version.
23
23
 
24
24
  ## Consolidation routing (every competency has a home)
25
25
 
@@ -31,15 +31,15 @@ lives here so the engine stays judgment-free.
31
31
  | `TDD` | `CONVENTIONS.md` | append a testing convention (no PROJECT.md section — it is the engine) |
32
32
  | `ADD` | `CONVENTIONS.md` | append a build/harness convention (likewise the engine) |
33
33
 
34
- **Every** consolidation — whatever the competency — ALSO appends one row to `PROJECT.md` **§Key Decisions**
34
+ **Every** consolidation — whatever the competency — ALSO prepends one row at the TOP of `PROJECT.md` **§Key Decisions** (newest-first)
35
35
  (date · decision · why · outcome): the universal, auditable trail of what the foundation learned.
36
36
 
37
37
  ## Status transitions & version
38
38
 
39
- - on **confirm**: the delta moves `open` → `folded` (and its edit is appended to the routed target).
39
+ - on **confirm**: the delta moves `open` → `folded` (and its edit is prepended at the top of the routed target, newest-first).
40
40
  - on **decline**: the delta moves `open` → `rejected` and is **left in place** — never deleted —
41
41
  so "we considered this and chose not to act" stays auditable.
42
- - a consolidation is **append-only**: it adds bullets/rows; it never silently rewrites existing foundation text.
42
+ - a consolidation is **append-only (newest-first)**: it PREPENDS new bullets/rows at the top and never silently rewrites existing foundation text — EXCEPT via the recorded **compaction door** (`compact-foundation.md`): eligible (shipped + zero open residues) stable entries collapse upward into a rolled-up settled line at the tail. Reject: `open-residue-version` · `trail-loss` · `wrong-order`.
43
43
  - each consolidation session **bumps** the `foundation-version:` marker in `PROJECT.md` by one (monotonic int).
44
44
 
45
45
  ## Reject codes (the AI is first check, the human the backstop)
@@ -60,6 +60,8 @@ Never: invent a file, symbol, or signature you have not opened.
60
60
  - [ ] The anchors §3 will cite are listed — §3 names only anchors that exist here.
61
61
  </exit_gate>
62
62
 
63
+ > **Advisor · Confidence** — a broad sweep is the canonical spawn case (advisor.md); self-score your grounding before you specify against it (confidence.md).
64
+
63
65
  ## Next
64
66
 
65
67
  `python3 .add/tooling/add.py advance` → read `phases/1-specify.md`.