@skyf0xx/hedgehog 2.0.13 → 3.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 (35) hide show
  1. package/README.md +9 -3
  2. package/bin/cli.mjs +463 -19
  3. package/package.json +3 -2
  4. package/src/agents/backend-eng.md +56 -45
  5. package/src/agents/bootstrap.md +67 -73
  6. package/src/agents/front-end-eng.md +31 -18
  7. package/src/agents/planner.md +163 -84
  8. package/src/agents/reviewer.md +4 -4
  9. package/src/agents/tweaker.md +138 -106
  10. package/src/db/core.mjs +141 -0
  11. package/src/db/friction.mjs +25 -0
  12. package/src/db/init.mjs +35 -0
  13. package/src/db/intent.mjs +101 -0
  14. package/src/db/next.mjs +179 -0
  15. package/src/db/plan.mjs +222 -0
  16. package/src/db/schema.mjs +95 -0
  17. package/src/db/status.mjs +113 -0
  18. package/src/db/verify.mjs +286 -0
  19. package/src/db/why.mjs +97 -0
  20. package/src/golden-cores/full-stack-app/core.yaml +41 -0
  21. package/src/golden-cores/landing-page/core.yaml +41 -0
  22. package/src/skills/conventional-commits/SKILL.md +1 -1
  23. package/src/skills/hedgehog-bootstrap/SKILL.md +38 -41
  24. package/src/skills/hedgehog-bootstrap-full-stack-app-core/SKILL.md +8 -12
  25. package/src/skills/hedgehog-bootstrap-landing-page-core/SKILL.md +7 -9
  26. package/src/skills/hedgehog-core-design/SKILL.md +239 -0
  27. package/src/skills/hedgehog-landing-loop/SKILL.md +91 -57
  28. package/src/skills/hedgehog-loop/SKILL.md +109 -77
  29. package/src/skills/hedgehog-planning-intake/SKILL.md +72 -97
  30. package/src/templates/CLAUDE.core.full-stack-app.md +31 -24
  31. package/src/templates/CLAUDE.core.landing-page.md +11 -7
  32. package/src/templates/CLAUDE.md +46 -38
  33. package/src/templates/TODO.core.full-stack-app.md +0 -51
  34. package/src/templates/TODO.core.landing-page.md +0 -31
  35. package/src/templates/TODO.md +0 -12
@@ -16,9 +16,10 @@ This piece is deterministic — the same commands produce the same output
16
16
  on every project — so the output is committed once, upstream, and copied
17
17
  here instead of re-derived by an agent on every run.
18
18
 
19
- This skill has no per-project decisions to make: no add-ons, no `TODO.md`
20
- dependency beyond checking its own Bootstrap line, nothing to ask.
21
- Landing-page's core is identical on every project running it.
19
+ This skill has no per-project decisions to make: no add-ons, no
20
+ dependency beyond confirming its own commit hasn't already landed,
21
+ nothing to ask. Landing-page's core is identical on every project
22
+ running it.
22
23
 
23
24
  ## What lands
24
25
 
@@ -98,12 +99,9 @@ the same gate every phase in this core's loop runs.
98
99
  feat(landing): workspace
99
100
  ```
100
101
 
101
- One commit for all of core, landed as a verified copy.
102
-
103
- ### 6. `TODO.md`'s core line
104
-
105
- The Bootstrap line ships pre-checked in the `landing-page` `TODO.md`
106
- template. If step 2's fallback copy ran, check it now.
102
+ One commit for all of core, landed as a verified copy. That commit
103
+ existing is the record that core landed — `bootstrap` checks for it via
104
+ the commit log, not a checklist line.
107
105
 
108
106
  ## Known issues baked into the landing-page core
109
107
 
@@ -0,0 +1,239 @@
1
+ ---
2
+ name: hedgehog-core-design
3
+ description: Use on full-stack-app and landing-page alike only when neither shipped Golden Core fits a project that is still building something real — picks the stack and designs the layer sequence for it, and writes `.hedgehog/core.yaml`. Invoked by the `planner` agent as Phase 0's third outcome, after the vendored BMAD shelf has run; don't run standalone and don't run when a shipped core fits.
4
+ ---
5
+
6
+ # Hedgehog Core Design
7
+
8
+ Designs a core definition for a project no shipped Golden Core fits.
9
+ Hedgehog decides the architecture here — the stack, the layers, their
10
+ order, their file scope, their verification — and shows it back for
11
+ confirmation. The user is asked about their product, never asked to pick
12
+ a stack or design layers; a person who could name the right stack and
13
+ layer sequence unprompted wouldn't need a build discipline to enforce it.
14
+
15
+ The output is one file, `.hedgehog/core.yaml`, in the exact format
16
+ shipped cores use (spec: "Core definitions"). Everything else this skill
17
+ produces is rationale, and rationale goes to `.hedgehog/core-design.md`,
18
+ not into `core.yaml` — the loader (`src/db/core.mjs`) parses a narrow
19
+ YAML subset and throws on anything outside it.
20
+
21
+ ## When this runs
22
+
23
+ After `hedgehog-planning-intake`'s Phase 0, not before. An architecture
24
+ can't be designed from a one-line project description: the drivers that
25
+ decide it — persistence, concurrency, deployment target, integration
26
+ surface — are exactly what BMAD's brief and PRD elicit. So `planner`'s
27
+ Phase 0 reaches its third outcome ("neither shipped core fits, but
28
+ something is being built"), runs the BMAD shelf in full, then opens this
29
+ skill against that archive. Intent mining follows this skill, not the
30
+ other way round — the layer sequence has to exist before `hedgehog plan`
31
+ can compile anything against it.
32
+
33
+ ## Step 1 — name the system shape
34
+
35
+ Say what the project fundamentally is, in one line, before deriving
36
+ anything from it: a CLI, a library or SDK, a data pipeline, a browser
37
+ extension, a desktop app, a compiler or language tool, a bot or agent, a
38
+ game, an infrastructure/deploy tool. Pick the dominant one. A project
39
+ with several surfaces has one primary system and the rest are layers
40
+ inside it, not co-equal architectures.
41
+
42
+ This is the step that catches a misrouted Phase 0. If the shape you land
43
+ on is "a web app with a database behind it," that is `full-stack-app` and
44
+ you should say so and route back rather than author a near-copy of a
45
+ shipped core under a new name. The same goes for a marketing page that
46
+ grew a second page — still `landing-page`.
47
+
48
+ ## Step 2 — pick the stack
49
+
50
+ Name the language, package manager, and the one or two frameworks that
51
+ shape the architecture (a web/CLI/RPC framework, not every library the
52
+ project will eventually need) before deriving layers — a layer's `verify`
53
+ command can't be written until the test runner and build tooling are
54
+ decided, and layer boundaries themselves often follow framework
55
+ conventions (e.g. a middleware layer only exists if the framework has
56
+ middleware). Don't ask the user to choose — the same reasoning Step 1
57
+ applies to layers applies here: naming a stack is exactly what a build
58
+ discipline exists to decide unprompted, and asking would just relocate
59
+ the design work onto the person who came here to avoid doing it.
60
+
61
+ Pick one default per system shape, the same way the shipped cores commit
62
+ to one choice per row rather than a menu (`hedgehog-bootstrap`'s stack
63
+ table). Substitute off a default only for a concrete, named constraint
64
+ read from `.hedgehog/BMAD/` — never a general preference for variety:
65
+
66
+ | System shape | Default stack | Substitute when |
67
+ |---|---|---|
68
+ | CLI | TypeScript + Node, Commander, Vitest, pnpm | the target users are a Python-first or Go-first ecosystem (data/ML tooling → Python + Typer + pytest; infra/systems tooling → Go + Cobra + `go test`) |
69
+ | Library / SDK | TypeScript, tsup, Vitest, pnpm | the consuming ecosystem is fixed by the brief (a Python package → Python + Hatch + pytest; publishing to both → author the TS core first, wrap it) |
70
+ | Data pipeline | Python, stdlib/argparse or Dagster for orchestration, pytest, uv or pip | the pipeline is thin glue over an existing Node/TS service mesh already named in the brief |
71
+ | Browser extension | TypeScript, the target browser's WebExtension API (`@types/chrome` or WXT), Vitest, pnpm | none in practice — this shape has one real ecosystem |
72
+ | Desktop app | TypeScript + Electron, Vitest + Playwright, pnpm | native platform integration is a stated hard requirement (macOS/Windows-only, deep OS API use) → Swift/AppKit or C#/WinUI, per platform, named explicitly |
73
+ | Compiler / language tool | Rust, `cargo test`, Cargo | the brief is explicitly about fast iteration over raw performance, or targets a JS/TS-only toolchain (a Babel/ESLint plugin) → TypeScript, Vitest, pnpm |
74
+ | Bot / agent | TypeScript, Vitest, pnpm | the brief calls for heavy ML/data-science library use → Python, pytest, uv |
75
+ | Game | TypeScript + a canvas/WebGL engine already named in the brief (e.g. PixiJS, Three.js), Vitest, pnpm | a native/console target is explicit → the engine's native language (C#/Unity, C++), named per that engine |
76
+ | Infra / deploy tool | Go, `go test`, Go modules | the tool is a thin wrapper generating config/manifests with no systems-level need → TypeScript, Vitest, pnpm |
77
+
78
+ A shape not on this table is rare enough that no default has been
79
+ battle-tested — reason from the same drivers `hedgehog-bootstrap`'s
80
+ table encodes (ecosystem the target users already live in, deployment
81
+ target, the language the brief's own examples or comparables are
82
+ written in) and name the result as a judgment call, not a table lookup,
83
+ in `core-design.md`'s rationale.
84
+
85
+ Record the choice as one line — language, package manager, the named
86
+ framework(s), test runner — before moving to Step 3; every layer's
87
+ `scope` and `verify` in Step 3 draws from it.
88
+
89
+ ## Step 3 — derive the layers
90
+
91
+ Read `.hedgehog/BMAD/` for what the system actually does, then decide the
92
+ layers it builds in. A layer earns its place by owning a distinct
93
+ artifact that can be verified on its own. Order by dependency first (a
94
+ layer that another layer imports comes first) and by risk second (where
95
+ two layers are independent, build the one that would invalidate the other
96
+ if it went wrong first).
97
+
98
+ Three rules with teeth:
99
+
100
+ - **A layer with no executable verification is not a layer.** Fold it
101
+ into its neighbour or drop it. `verify: manually inspect` is not a
102
+ verify command, and the loader rejects an empty one outright
103
+ (`validateCore`, `src/db/core.mjs`).
104
+ - **A layer whose file scope overlaps another layer's is not a layer.**
105
+ Scope is what stops step N from quietly rewriting step N−1's work;
106
+ overlapping globs make that enforcement meaningless.
107
+ - **Don't reproduce a Golden Core's sequence under new names.** If
108
+ schema → contract → repository → service → controller is genuinely
109
+ right, Phase 0 picked the wrong outcome.
110
+
111
+ Four to seven layers is the usual range. Fewer than three means the
112
+ project probably wanted a shipped core or no core at all; more than eight
113
+ means several layers are one layer with internal steps.
114
+
115
+ ## Step 4 — decide the module axis
116
+
117
+ Answer explicitly, because it changes the shape of the whole graph:
118
+
119
+ - **Module axis** (like `full-stack-app`) — the layer chain instantiates
120
+ once per intent. Every scope glob, verify command, and commit message
121
+ that differs per module carries the `{module}` placeholder, which
122
+ `hedgehog plan` fills with the intent's id (`src/db/plan.mjs`). The
123
+ graph is intents × layers tasks.
124
+ - **Linear chain** (like `landing-page`) — one pass total, no `{module}`
125
+ anywhere. The graph is one task per layer. Mine the project as a single
126
+ intent.
127
+
128
+ Choose a module axis when the project has repeating units of domain work
129
+ that each walk the same layers (entities, commands, resources,
130
+ integrations). Choose a linear chain when the project is built once,
131
+ front to back.
132
+
133
+ Getting this wrong is the most common failure. A module-axis core whose
134
+ scopes omit `{module}` gives every intent identical scope globs, so
135
+ intent A's task may write intent B's files and the scope enforcement that
136
+ justifies authoring a core at all disappears. Check every glob before
137
+ writing the file.
138
+
139
+ ## Step 5 — write `.hedgehog/core.yaml`
140
+
141
+ The loader parses `id` plus a `layers` list of flat maps. Every layer
142
+ needs all five fields — `depends_on` is omitted only on the first layer:
143
+
144
+ ```yaml
145
+ id: cli-tool
146
+ layers:
147
+ - id: command-model
148
+ scope: ["src/commands/**"]
149
+ verify: "pnpm test commands && pnpm typecheck"
150
+ commit: "feat({module}): command model"
151
+ - id: domain
152
+ depends_on: command-model
153
+ scope: ["src/domain/{module}/**"]
154
+ verify: "pnpm test {module}-domain"
155
+ commit: "feat({module}): domain"
156
+ - id: adapter
157
+ depends_on: domain
158
+ scope: ["src/adapters/{module}/**"]
159
+ verify: "pnpm test {module}-adapter"
160
+ commit: "feat({module}): adapter"
161
+ ```
162
+
163
+ Constraints the loader and compiler impose, all of them silent failures
164
+ if missed:
165
+
166
+ - **`commit` is required in practice**, though `validateCore` doesn't
167
+ check it. `hedgehog plan` writes `commit_message` from it for every
168
+ task (`src/db/plan.mjs`); a layer without one compiles to a task with
169
+ an empty commit message, and the Correction Protocol and `hedgehog why`
170
+ both hang off commit shape. Use the conventional-commit form every
171
+ other core uses: `feat({module}): <layer>`, or `feat(<project>):
172
+ <layer>` on a linear chain.
173
+ - **`scope` must be an inline list** — `["a/**", "b/**"]` on one line.
174
+ Block sequences under `scope:` don't parse.
175
+ - **No nesting beyond a layer's flat fields.** Flat top-level keys other
176
+ than `id` and `layers` are ignored, but any nested block
177
+ (`architecture:`, `modules:`, `decisions:`) throws at load. Rationale
178
+ belongs in `.hedgehog/core-design.md`.
179
+ - **`depends_on` names one layer**, and the chain must be acyclic. The
180
+ compiler walks it directly into `dependencies` rows.
181
+
182
+ Verify the file loads before showing it back, by calling the loader
183
+ directly:
184
+
185
+ ```bash
186
+ node -e "import('./src/db/core.mjs').then(m => m.loadCore('.hedgehog/core.yaml')).then(c => console.log(JSON.stringify(c, null, 2)))"
187
+ ```
188
+
189
+ Read the layers it prints back: a field the parser dropped shows up as an
190
+ empty string or `[]` there, and a `{module}` you meant to include is
191
+ visible in the globs or absent from them. A `core.yaml` that throws at
192
+ load time is the one failure mode that strands a project with no path
193
+ forward.
194
+
195
+ ## Step 6 — write `.hedgehog/core-design.md`
196
+
197
+ The rationale the engine doesn't read but the project needs: the system
198
+ shape and why, the stack and why (the default it came from, or the named
199
+ constraint that justified a substitution), the layers with a line each on
200
+ what they own and why they sit where they do, the module-axis decision,
201
+ and anything left unresolved. Written once, archival, never edited after
202
+ — the same stance `.hedgehog/BMAD/` takes. Later changes to the
203
+ architecture are Correction Protocol entries in the commit log, not edits
204
+ here.
205
+
206
+ ## Confirm & Lock
207
+
208
+ Authoring a core is the most consequential decision in a Hedgehog project
209
+ — every task the graph ever compiles walks this sequence — and it's cheap
210
+ to change only until the file lands. Hard stop.
211
+
212
+ 🔒 **Confirm & Lock**. Show, in full, not condensed:
213
+
214
+ - The system shape, in the one line from step 1.
215
+ - The stack: language, package manager, and named framework(s), plus
216
+ whether it's the shape's default or a substitution — and if a
217
+ substitution, the one-line constraint that justified it.
218
+ - Each layer in order: what it owns, its scope globs, its verify command,
219
+ its commit message.
220
+ - The module-axis decision, named as such, with the consequence stated
221
+ (intents × layers tasks, or one task per layer).
222
+ - That this is an authored core: the sequence was designed for this
223
+ project, not battle-tested across many, and it carries the same
224
+ enforcement as a Golden Core but a weaker guarantee.
225
+
226
+ Then state plainly what happens on confirmation, before it happens:
227
+
228
+ > This writes `.hedgehog/core.yaml` and `.hedgehog/core-design.md`, then
229
+ > planning intake mines the PRD into intents against this layer sequence.
230
+ > Every task this project ever builds walks these layers in this order.
231
+ > Anything wrong — say so now; it's a normal edit before this point, and
232
+ > a Correction Protocol entry after. Confirm to proceed, or tell me what
233
+ > to change.
234
+
235
+ Wait for an explicit go-ahead. A revision here is another design pass —
236
+ update the draft, re-run this stage, write nothing until the confirmation
237
+ holds. Once confirmed and written, control returns to `planner`, which
238
+ runs `hedgehog-planning-intake`'s Phase 1 mining against this core the
239
+ same way it would against a shipped one.
@@ -1,15 +1,18 @@
1
1
  ---
2
2
  name: hedgehog-landing-loop
3
- description: Use for every unit of work on the landing-page core, from planning intake through the final build phase — the Chain Method's brief → feeling → tokens/element → sequence → artifact pipeline, gated and committed one phase at a time, checked off TODO.md. Triggers on "next step", "next phase", "what's next", or the start of any work session on a bootstrapped landing-page project. Also covers this core's own planning intake and Correction Protocol.
3
+ description: Use for every unit of work on the landing-page core, from planning intake through the final build phase — the Chain Method's brief → feeling → tokens/element → sequence → artifact pipeline, gated by `hedgehog verify` and committed one phase at a time. Triggers on "next step", "next phase", "what's next", or the start of any work session on a bootstrapped landing-page project. Also covers this core's own planning intake and Correction Protocol.
4
4
  ---
5
5
 
6
6
  # Hedgehog Landing Loop
7
7
 
8
- The operating loop for a bootstrapped `landing-page` project: pick the
9
- next phase, run it through its owning agent, gate it, commit it, check it
10
- off. `TODO.md` at repo root is the live list — read it before starting.
11
- It's thin: a context blurb plus a checklist mirroring the phase structure
12
- below. Checked/unchecked is its only state.
8
+ The operating loop for a bootstrapped `landing-page` project: `hedgehog
9
+ next` emits the packet for one ready phase, run it through its owning
10
+ agent, `hedgehog verify` gates and commits it. The build graph
11
+ (`.hedgehog/hedgehog.db`) is the live list — query it via `hedgehog
12
+ status`/`hedgehog next`, never re-derive state from prose. The five
13
+ compiled phases (`src/golden-cores/landing-page/core.yaml`, already the
14
+ source of truth) are the degenerate one-module case of the layer graph:
15
+ one task per phase, each depending on the one before it.
13
16
 
14
17
  This is the **Chain Method**: a pipeline where every visual choice traces
15
18
  back to a reason. No agent may introduce a choice that doesn't originate
@@ -55,19 +58,29 @@ back at Confirm & Lock for the user to accept or correct.
55
58
  `.hedgehog/BMAD/`.
56
59
  4. **Confirm & Lock** — show the mined subject statement, audience, and
57
60
  job back in plain terms, alongside which BMAD skills ran and where
58
- their output lives (`.hedgehog/BMAD/`), before writing `TODO.md`.
59
- State plainly what happens on confirmation: *"This locks in the
60
- brief, commits it (`chore(planning): intake`), and hands off to
61
- `bootstrap` to scaffold the Astro workspace. The Strategist phase
61
+ their output lives (`.hedgehog/BMAD/`), before writing anything to the
62
+ build graph. State plainly what happens on confirmation: *"This locks
63
+ in the brief, adds the `landing` intent to the build graph
64
+ (`hedgehog intent add`), compiles it into the five-phase chain
65
+ (`hedgehog plan`), commits (`chore(planning): intake`), and hands off
66
+ to `bootstrap` to scaffold the Astro workspace. The Strategist phase
62
67
  starts once that closes. Anything wrong or missing — say so now."*
63
68
  Wait for explicit go-ahead — a revision here is just another mining
64
69
  pass against the same BMAD archive, not a Correction Protocol entry,
65
70
  since nothing downstream exists yet.
66
- 5. **Write `TODO.md`** mirroring the phase table below, then commit
67
- planning intake's output as one commit, `chore(planning): intake` —
68
- `TODO.md`, `.hedgehog/BMAD/`, `.hedgehog/chain/00-brief.md`, and root
69
- `CLAUDE.md`'s filled placeholders.
70
- 6. **Hand off to `bootstrap`** once the commit lands.
71
+ 5. **Add the intent and compile the graph**: `hedgehog intent add --id
72
+ landing --goal "<subject statement>" --outcome "<audience + single
73
+ job>"` — one call, no `--rule`/`--depends-on` needed; landing-page has
74
+ no module axis, so this single intent is what `hedgehog plan` compiles
75
+ against `src/golden-cores/landing-page/core.yaml` into the five phase
76
+ tasks. Run `hedgehog plan` next, then `hedgehog status` to show the
77
+ compiled chain.
78
+ 6. **Commit planning intake's output as one commit**,
79
+ `chore(planning): intake` — the committed `.hedgehog/hedgehog.db` (the
80
+ `landing` intent and its compiled tasks), `.hedgehog/BMAD/`,
81
+ `.hedgehog/chain/00-brief.md`, and root `CLAUDE.md`'s filled
82
+ placeholders.
83
+ 7. **Hand off to `bootstrap`** once the commit lands.
71
84
 
72
85
  `planner` owns this section; see that agent for when it runs.
73
86
 
@@ -79,6 +92,15 @@ agent works from anything but what was actually handed to it. Steps 4a
79
92
  only parallel-input point in the chain, both reading the same upstream
80
93
  artifact; everything else is strictly sequential.
81
94
 
95
+ This table's 12 rows are the fine-grained, per-agent-dispatch view. The
96
+ compiled build graph (`src/golden-cores/landing-page/core.yaml`) has only
97
+ 5 layers — `brief`/`feeling`/`tokens`/`sequence`/`artifact` — because it's
98
+ the coarser, one-task-per-commit view: rows 1–4 compile into one `feeling`
99
+ task, 5–7 into one `tokens` task, 8–10 into one `sequence` task, 11–12
100
+ into one `artifact` task. These are intentionally not 1:1; don't "fix"
101
+ either one to match the other's granularity — see The Loop below for how
102
+ one delegated phase relates to one compiled task.
103
+
82
104
  | # | Phase | Agent | Produces | Commit |
83
105
  |---|---|---|---|---|
84
106
  | 1 | Strategist | `landing-strategist` | Subject/audience/job statement (from planning intake — restated here as this phase's formal output) | `feat(landing): strategy` |
@@ -112,30 +134,39 @@ paragraph algorithm, and their self-tests.
112
134
 
113
135
  ## The Loop (every unit of work)
114
136
 
115
- 1. **Pick the next phase** per the table above, from `TODO.md`. One phase
116
- at a time, in order.
117
- 2. **Check the gate.** The prior phase is checkpointed and committed
118
- first.
119
- 3. **Delegate exactly one phase** to its owning agent, passing it the
120
- full chain so far (every upstream artifact, not just the immediately
121
- prior one) — an agent that only sees its direct input can't verify its
122
- own traceability back to the subject statement. Phase 10
123
- (`landing-copywriter`) is delegated once per section, in
124
- `landing-sequencer`'s order — each invocation is still "exactly one
125
- phase" in the sense this step means: one section, reviewed and locked,
126
- before the next invocation starts.
127
- 4. The agent **runs its self-test** (see that agent's own file for what
128
- it checks) before presenting its artifact.
129
- 5. The agent **commits** using the exact Conventional Commit format
130
- above.
131
- 6. **Check off the line in `TODO.md`** once the agent reports the commit
132
- landed. Phase 10 stays unchecked until every section in
133
- `landing-sequencer`'s list has locked, not after the first section.
134
- 7. **Repeat**, one delegated phase (or one section, at phase 10) at a
135
- time.
136
-
137
- Each commit batches exactly one phase's artifact; a wrong phase is fixed
138
- forward later via the Correction Protocol.
137
+ 1. **Run `hedgehog next`.** It emits the task packet for one ready
138
+ compiled layer (STATUS/WHY NOW/BLOCKED DOWNSTREAM/ALLOWED
139
+ SCOPE/VERIFICATION) — trust it: `hedgehog next` never emits a layer
140
+ whose dependency isn't `complete`, so there's no separate gate check to
141
+ run by hand.
142
+ 2. **Map the packet's layer to the fine-grained phases it bundles**, per
143
+ the table above (`feeling` = phases 1–4, `tokens` = 5–7, `sequence` =
144
+ 8–10, `artifact` = 11–12), and **delegate to that layer's owning
145
+ agent(s)**, passing the full chain so far (every upstream artifact,
146
+ not just the immediately prior one) — an agent that only sees its
147
+ direct input can't verify its own traceability back to the subject
148
+ statement. Within a bundled layer, run its phases in order and in one
149
+ continuous pass: phase 10 (`landing-copywriter`) still runs once per
150
+ section, in `landing-sequencer`'s order, every section reviewed and
151
+ locked before the next starts, all still inside the one `sequence`
152
+ task.
153
+ 3. Each agent **runs its own self-test** (see that agent's own file for
154
+ what it checks) before presenting its artifact — necessary, not
155
+ sufficient. This is a sanity check the agent does for itself; it does
156
+ not move the task and the agent does not commit its own work.
157
+ 4. Once every phase inside the packet's layer has been presented and
158
+ locked by the user, **run `hedgehog verify <task-id>`.** It checks the
159
+ touched files against the packet's ALLOWED SCOPE, runs the layer's
160
+ `VERIFICATION` command, and on a pass writes the commit (the exact
161
+ Conventional Commit message from the table above) and unlocks the next
162
+ layer. On a scope violation or a failing check, the task stays
163
+ `implemented`/`failed` and nothing downstream unlocks — fix it and
164
+ re-run `hedgehog verify`, don't hand-commit around it.
165
+ 5. **Repeat** — `hedgehog next` again for the following layer.
166
+
167
+ Each `hedgehog verify` call commits exactly one compiled layer's
168
+ artifact; a wrong phase is fixed forward later via the Correction
169
+ Protocol.
139
170
 
140
171
  ## Friction log
141
172
 
@@ -146,12 +177,13 @@ user feedback implied something was wrong even without a direct
146
177
  correction (a preference stated once that, read plainly, means an
147
178
  earlier phase missed something) — is signal worth keeping past this
148
179
  session, separate from the Correction Protocol that fixes it in the
149
- moment. Append one entry to `.hedgehog/friction.md` (create it if it
150
- doesn't exist) when that happens: what was tried, what went wrong or was
151
- implied, why if visible, and the commit/redline it traces to. This is a
152
- log, not a todo list — don't let it block or slow the loop; append and
153
- keep moving. `tweaker` reads it once the build reaches its Stop
154
- Condition.
180
+ moment. Log one entry via `hedgehog friction add "<note>" [--task
181
+ <task-id>]` when that happens: what was tried, what went wrong or was
182
+ implied, why if visible, and the commit/redline it traces to, all in the
183
+ note text; pass `--task` with the compiled layer's task id when the
184
+ friction traces to one. This is a log, not a todo list — don't let it
185
+ block or slow the loop; log and keep moving. `tweaker` reads it (via
186
+ `hedgehog friction list`) once the build reaches its Stop Condition.
155
187
 
156
188
  ## Correction Protocol
157
189
 
@@ -206,7 +238,8 @@ Before `landing-builder` starts, confirm:
206
238
 
207
239
  - `landing-critic` returned a pass, not a redline — a redlined spec never
208
240
  reaches the Builder; it goes back to the phase the redline names.
209
- - Every phase 1–11 has its commit landed.
241
+ - `hedgehog status` shows the `sequence` task `complete` (phases 1–11's
242
+ commits have landed).
210
243
 
211
244
  Before `landing-strategist` starts, confirm planning intake's Confirm &
212
245
  Lock has held and its commit has landed. If not, stop and ask.
@@ -254,17 +287,18 @@ procedure:
254
287
 
255
288
  ## Stop Condition
256
289
 
257
- A build session ends when every phase in `TODO.md` is checked off and
258
- `landing-builder`'s artifact is committed, or when the subject statement
259
- or an adjective is ambiguous enough that continuing means guessing — ask
260
- one question and wait.
290
+ A build session ends when `hedgehog status` shows the `artifact` task
291
+ `complete` (`landing-builder`'s artifact is committed and every task in
292
+ the chain is done), or when the subject statement or an adjective is
293
+ ambiguous enough that continuing means guessing — ask one question and
294
+ wait.
261
295
 
262
296
  On the former (a real build completion, not an ambiguity stop), offer a
263
297
  fresh-context handoff before doing anything else: tell the user the
264
- build is complete, that clearing context now costs nothing (`TODO.md`
265
- and the commit log hold everything), and that a `tweaker` session is the
266
- right next step for any adjustments — it starts clean, reviews
267
- `.hedgehog/friction.md` once for a possible discipline-improvement
268
- suggestion, and takes tweak requests one at a time from there. Don't
269
- start making tweaks in the current, already-large context; that's what
270
- the fresh session is for.
298
+ build is complete, that clearing context now costs nothing (the build
299
+ graph and the commit log hold everything), and that a `tweaker` session
300
+ is the right next step for any adjustments — it starts clean, reviews
301
+ the friction log (`hedgehog friction list`) once for a possible
302
+ discipline-improvement suggestion, and takes tweak requests one at a
303
+ time from there. Don't start making tweaks in the current, already-large
304
+ context; that's what the fresh session is for.