@skyf0xx/hedgehog 4.2.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -130,26 +130,52 @@ then generates that workspace and builds it one verified layer at a time.
130
130
  The enforcement remains the same: ordered steps,
131
131
  scoped file access and a verification command per layer.
132
132
 
133
+ ### Existing codebases
134
+
135
+ Hedgehog also adopts onto a repo it didn't build. It never converts your
136
+ stack and never touches working code — it reads your repo's own
137
+ `test/lint/build` commands, confirms them with you, and locks them into a
138
+ change-order `.hedgehog/core.yaml`, plus a dated snapshot of the repo's
139
+ shape to calibrate new code against.
140
+
141
+ From there, every change lands through the same scoped, verified,
142
+ committed loop — coverage grows only as new work passes through it, and
143
+ that's by design: pre-existing code is context to respect, never a task
144
+ to fabricate.
145
+
146
+ Run `init` with no core flag inside the existing repo, then ask to adopt
147
+ Hedgehog onto it.
148
+
133
149
  ## Why Hedgehog Works
134
150
 
135
151
  ![Why Hedgehog works](https://raw.githubusercontent.com/skyf0xx/hedgehog/master/docs/images/why.png)
136
152
 
137
153
  ## Install
138
154
 
139
- From an empty project folder, ask Claude or your Agent to run:
155
+ Install the Hedgehog plugin for your coding agent. It offers to set up
156
+ Hedgehog whenever you open a project that doesn't have it yet.
157
+
158
+ ### Claude Code
140
159
 
141
160
  ``` bash
142
- # Full-stack app
143
- npx @skyf0xx/hedgehog init --ts-full-stack-app
161
+ claude plugin marketplace add skyf0xx/hedgehog
162
+ claude plugin install hedgehog
163
+ ```
144
164
 
145
- # Landing page
146
- npx @skyf0xx/hedgehog init --landing-page
165
+ ### Gemini CLI
147
166
 
148
- # Anything else (CLI, library, browser extension, data pipeline, etc.)
149
- npx @skyf0xx/hedgehog init
167
+ ``` bash
168
+ gemini extensions install https://github.com/skyf0xx/hedgehog
150
169
  ```
151
170
 
152
- Then open your coding agent and describe what you want to build.
171
+ ### Cursor
172
+
173
+ ``` bash
174
+ git clone https://github.com/skyf0xx/hedgehog ~/.cursor/plugins/local/hedgehog
175
+ ```
176
+
177
+ Then open a project and describe what you want to build. Hedgehog offers
178
+ to set itself up, and takes it from there once you say yes.
153
179
 
154
180
  The golden cores print a `pnpm install` step as part of their next steps.
155
181
  On a fresh project with no warm pnpm store, that first install can take
@@ -158,22 +184,6 @@ sass-embedded, Playwright, etc.) and, on first commit, running the commit
158
184
  gate against the whole workspace. A quiet stretch of output during that
159
185
  step is expected, not a hang.
160
186
 
161
- ### Coding agents
162
-
163
- Hedgehog installs for **Claude Code** by default. Add a host flag to
164
- install for another one, or several at once:
165
-
166
- ``` bash
167
- npx @skyf0xx/hedgehog init --cursor # Cursor
168
- npx @skyf0xx/hedgehog init --gemini # Gemini CLI
169
- npx @skyf0xx/hedgehog init --host=claude,cursor # both
170
- npx @skyf0xx/hedgehog init --all-hosts # every supported agent
171
- ```
172
-
173
- Each one gets the discipline in its own native shape — agents and skills
174
- in the directory it reads, and the instructions file it loads at session
175
- start (`CLAUDE.md`, `HEDGEHOG.md`, or `GEMINI.md`).
176
-
177
187
  To update:
178
188
 
179
189
  ``` bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyf0xx/hedgehog",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "description": "Install the Hedgehog build discipline (agents + skills) into a repo, for Claude Code, Cursor, or Gemini CLI.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -104,8 +104,10 @@ rather than guessing which way to resolve it.
104
104
  done; don't hand off. (Skip this entirely for a skipped add-on step —
105
105
  there's nothing to commit.)
106
106
  2. If every `on` add-on in `.hedgehog/addons.yaml` now has a matching
107
- commit: Bootstrap is closed. State that plainly — `hedgehog-loop` owns
108
- everything from here, one module at a time. Don't hand off again.
107
+ commit: Bootstrap is closed. Run `hedgehog graph` to start (or reuse)
108
+ the live graph server and open it, so the build graph is on screen
109
+ before the first module starts. State that plainly — `hedgehog-loop`
110
+ owns everything from here, one module at a time. Don't hand off again.
109
111
  Check every `on` add-on for a commit before deciding you're done —
110
112
  don't assume by step order alone (a project with Queue and Mobile
111
113
  both off closes right after Auth, for instance).
@@ -129,9 +131,12 @@ Open `hedgehog-bootstrap-landing-page-core` and follow it in full: confirm
129
131
  not already run, land `src/golden-cores/landing-page/` if the installer
130
132
  hasn't already, `pnpm install`, verify `astro check` and `pnpm build`
131
133
  clean, one commit (`feat(landing): workspace`), check the Bootstrap box.
132
- That's the whole of Bootstrap on this core state plainly that it's
133
- closed and `hedgehog-landing-loop` owns everything from here. Don't hand
134
- off to a fresh instance of yourself; there's no next Bootstrap step.
134
+ That's the whole of Bootstrap on this core. Run `hedgehog graph` to start
135
+ (or reuse) the live graph server and open it, so the build graph is on
136
+ screen before the Strategist phase starts, then state plainly that
137
+ Bootstrap is closed and `hedgehog-landing-loop` owns everything from
138
+ here. Don't hand off to a fresh instance of yourself; there's no next
139
+ Bootstrap step.
135
140
 
136
141
  ## authored core: running Bootstrap
137
142
 
@@ -147,8 +152,10 @@ already run, fill root `CLAUDE.md`'s `{{CORE_SECTION}}` placeholder with
147
152
  from `.hedgehog/core-design.md` and `.hedgehog/core.yaml`, generate that
148
153
  stack's workspace via its own ecosystem's generator, install, run every
149
154
  layer's `verify` command clean, one commit (`feat(<id>): workspace`),
150
- check the Bootstrap box. That's the whole of Bootstrap on this core
151
- state plainly that it's closed and `hedgehog-authored-loop` owns
155
+ check the Bootstrap box. That's the whole of Bootstrap on this core. Run
156
+ `hedgehog graph` to start (or reuse) the live graph server and open it,
157
+ so the build graph is on screen before the first layer starts, then
158
+ state plainly that Bootstrap is closed and `hedgehog-authored-loop` owns
152
159
  everything from here. Don't hand off to a fresh instance of yourself;
153
160
  there's no next Bootstrap step.
154
161
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: layer-eng
3
- description: Use for every build task on an authored core (`.hedgehog/core.yaml` present) — one layer per claimed packet, gated by `hedgehog verify`. The layer sequence, stack, and file scope come from `.hedgehog/core.yaml` and `.hedgehog/core-design.md`, designed for this project by `hedgehog-core-design`. Invoked by `hedgehog-authored-loop`, one packet at a time (possibly several dispatched concurrently).
3
+ description: Use for every build task on an authored core (`.hedgehog/core.yaml` present) — one layer per claimed packet, gated by `hedgehog verify`. The layer sequence, stack, and file scope come from `.hedgehog/core.yaml` and its rationale file — `.hedgehog/core-design.md` on a core `hedgehog-core-design` designed from scratch, `.hedgehog/adoption.md` on an existing repo `hedgehog-adopt` brought under discipline. Invoked by `hedgehog-authored-loop`, one packet at a time (possibly several dispatched concurrently).
4
4
  model: sonnet
5
5
  color: red
6
6
  tools: Read, Glob, Grep, Edit, Write, Bash
@@ -26,10 +26,18 @@ live in the project, not in this file:
26
26
  report the disagreement rather than silently following the YAML. (The
27
27
  fix is `hedgehog plan --recompile`, run by whoever is driving the loop,
28
28
  not by you mid-task.)
29
- - **`.hedgehog/core-design.md`**the rationale: the system shape, the
30
- stack (language, package manager, frameworks, test runner), and a line
31
- per layer on what it owns and why it sits where it does. This is what
32
- tells you *what belongs in* the layer you're building.
29
+ - **The rationale file** whichever one this core has:
30
+ - **`.hedgehog/core-design.md`**, on a core designed from scratch: the
31
+ system shape, the stack (language, package manager, frameworks, test
32
+ runner), and a line per layer on what it owns and why it sits where
33
+ it does. This is what tells you *what belongs in* the layer you're
34
+ building.
35
+ - **`.hedgehog/adoption.md`**, on an existing repo `hedgehog-adopt`
36
+ brought under discipline: why the layers are ordered the way they
37
+ are, plus a "Repo shape" section — module boundaries, entry points,
38
+ and conventions observed, dated to when it was read. Treat that
39
+ section as calibration, not ground truth past its date; read the
40
+ files it describes when you need precision the snapshot can't give.
33
41
  - **The task packet** — INTENT carries the goal and outcome of the
34
42
  *whole* intent this layer belongs to (not your layer's objective, which
35
43
  only names what kind of thing to build); RELEVANT RULES carry the
@@ -37,17 +45,18 @@ live in the project, not in this file:
37
45
  layers you depend on declared they left undone; ALLOWED SCOPE and
38
46
  VERIFICATION are the gate you'll be checked against.
39
47
 
40
- Read all three before writing anything. `core-design.md`'s line for your
41
- layer is the closest thing to a spec you get — a layer described as
48
+ Read all three before writing anything. The rationale file's line for
49
+ your layer is the closest thing to a spec you get — a layer described as
42
50
  "parses the manifest into a typed config object" means that layer owns
43
51
  parsing and typing, and the layer after it consumes the result.
44
52
 
45
53
  ## Core Responsibilities
46
54
 
47
55
  - Build exactly one layer per packet, entirely inside its ALLOWED SCOPE.
48
- - Honor the layer boundary `core-design.md` describes: a layer owns one
56
+ - Honor the layer boundary the rationale file describes: a layer owns one
49
57
  artifact, and the layer below it is consumed through whatever interface
50
- that design named, not reached around.
58
+ that design (or, on an adopted core, that seam) named, not reached
59
+ around.
51
60
  - Write the tests the layer's `verify` command runs. A layer whose verify
52
61
  command passes because it has no tests is not built — the command is
53
62
  the gate, and an empty gate certifies nothing.
@@ -67,13 +76,16 @@ parsing and typing, and the layer after it consumes the result.
67
76
  from the build graph, not from your file's comments.
68
77
  - Match the conventions already in the workspace: the generated
69
78
  toolchain's idioms, the file naming already on disk, the import style
70
- the earlier layers established.
79
+ the earlier layers established. On an adopted core, start from
80
+ `adoption.md`'s "Repo shape" section, then confirm against the actual
81
+ files nearby — the section is a snapshot, the files are current.
71
82
 
72
83
  ## Workflow
73
84
 
74
- 1. Read the packet, `.hedgehog/core.yaml`, and `.hedgehog/core-design.md`.
75
- The packet's WHY NOW already confirms every dependency is `complete`;
76
- don't re-derive readiness.
85
+ 1. Read the packet, `.hedgehog/core.yaml`, and this core's rationale file
86
+ (`.hedgehog/core-design.md` or `.hedgehog/adoption.md`, whichever
87
+ exists). The packet's WHY NOW already confirms every dependency is
88
+ `complete`; don't re-derive readiness.
77
89
  2. Read the layers already built (the ones your layer's `depends_on`
78
90
  chain names) before adding to them — their shape is the contract
79
91
  you're building against.
@@ -106,14 +118,19 @@ parsing and typing, and the layer after it consumes the result.
106
118
  this layer from quietly rewriting the previous one's work; `hedgehog
107
119
  verify` enforces it, and a change that needs to land elsewhere is a
108
120
  Correction Protocol case (`hedgehog-authored-loop`), not a wider write.
109
- - Never edit `.hedgehog/core.yaml` or `.hedgehog/core-design.md`. Both
110
- are locked at `hedgehog-core-design`'s Confirm & Lock. A layer boundary
121
+ - Never edit `.hedgehog/core.yaml` or the rationale file — not even
122
+ `adoption.md`'s "Repo shape" section, the one part of it a
123
+ `hedgehog-adopt` re-run may regenerate. Both files are locked outside
124
+ that one re-run path (`hedgehog-core-design`'s Confirm & Lock on a
125
+ designed core, `hedgehog-adopt`'s on an adopted one). A layer boundary
111
126
  that turns out wrong is a Correction Protocol entry through `planner`,
112
127
  not a quiet edit to the design.
113
- - Never add a dependency the stack in `core-design.md` doesn't already
114
- name without flagging it first. The stack was chosen deliberately; a
115
- felt need for a new library is worth surfacing, and usually belongs to
116
- the layer's design rather than to this build step.
128
+ - On a designed core, never add a dependency the stack in
129
+ `core-design.md` doesn't already name without flagging it first the
130
+ stack was chosen deliberately, and a felt need for a new library
131
+ usually belongs to the layer's design rather than to this build step.
132
+ An adopted core has no stack Hedgehog chose; match what the repo
133
+ already uses instead.
117
134
  - Never skip or weaken a layer's `verify` command to make a task pass —
118
135
  deleting an assertion, marking a test skipped, or loosening a type to
119
136
  clear the gate defeats the only mechanical check the discipline has.
@@ -100,6 +100,21 @@ and the scaffolded workspace.
100
100
  and eliciting a full intake for it is ceremony on top of ceremony. This
101
101
  is a real bail-out, not a formality — don't soften it into forcing a
102
102
  core that doesn't fit.
103
+ - **An existing repo, ongoing adoption** — the description is about
104
+ bringing Hedgehog's discipline to a codebase that already exists,
105
+ rather than building something new (the repo you're running in already
106
+ has real source files, or the user says so explicitly: "adopt this
107
+ repo", "add Hedgehog to my existing project", "I want scope/verify
108
+ enforcement on my changes here"). This is a distinct question from the
109
+ three above: it's not about which core fits new work, because no new
110
+ workspace gets built at all. Route straight to `hedgehog-adopt` —
111
+ bootstrap and every other Phase 0 outcome are skipped entirely, since
112
+ there is no workspace to scaffold and no golden stack to adopt toward.
113
+ `hedgehog-adopt` runs its own read-only intake and writes its own
114
+ `.hedgehog/core.yaml`; don't run `hedgehog-planning-intake`'s BMAD shelf
115
+ first — the drivers that skill elicits (persistence, stack, deployment
116
+ target) are already settled facts of the existing repo, not open
117
+ decisions.
103
118
 
104
119
  This is a distinct question from project *size*. A single-table, single-
105
120
  user tool (one person's task list, a personal habit tracker) is still
@@ -209,17 +224,39 @@ accounts get added where there were none).
209
224
  build graph, not a file this agent owns.
210
225
  - **landing-page**: owns `.hedgehog/BMAD/` and
211
226
  `.hedgehog/chain/00-brief.md` as artifacts.
227
+ - **brownfield adoption**: owns nothing here — `hedgehog-adopt` owns
228
+ `.hedgehog/core.yaml` and `.hedgehog/adoption.md`, the same way an
229
+ authored core's design is `hedgehog-core-design`'s.
212
230
 
213
231
  ## Workflow
214
232
 
215
233
  1. **Read the requirement** fully before doing anything.
216
234
  2. **Run `hedgehog status` and decide which path you're on.** This is a
217
235
  branch, not a survey — the rest of the workflow depends on its answer:
218
- - **No intents in the graph first run.** Continue at step 3.
219
- - **One or more intents → re-entry.** Skip steps 3, 4, and 9 entirely
220
- and go to step 5's re-entry branch. The core is already chosen and
221
- its workspace already scaffolded; re-deciding either is destructive,
222
- not a fresh start.
236
+ - **No intents in the graph, and the request is new work → first
237
+ run.** Continue at step 3.
238
+ - **No intents in the graph, and the request is adoption onto an
239
+ existing repo brownfield first run.** Skip Phase 0's core
240
+ selection and every step below through step 9 — go straight to
241
+ `hedgehog-adopt`. It runs its own intake and Confirm & Lock, writes
242
+ `.hedgehog/core.yaml` and `.hedgehog/adoption.md`, and adds the
243
+ first intent(s) itself. Return the summary (step 10) once it's done.
244
+ - **One or more intents, on `.hedgehog/core.yaml` written by
245
+ `hedgehog-adopt` → adoption re-entry.** New change-work on a repo
246
+ already under adoption. Skip steps 3 through 9 — route straight to
247
+ `hedgehog-adopt` again instead, same as brownfield first run above.
248
+ It owns everything the other path's steps 5, 7, 8, and 9 would
249
+ otherwise do: it sizes the request (a large or ambiguous one gets its
250
+ own short clarifying pass, a clear small one doesn't), adds the
251
+ intent(s), runs `hedgehog plan`, and commits its own work as `chore
252
+ (planning): adopt change`. Don't run `hedgehog-planning-intake`'s
253
+ Re-entry pass here — there is no BMAD archive to read as context on
254
+ this path, since adoption never runs one. Return the summary (step
255
+ 10) once `hedgehog-adopt` is done.
256
+ - **One or more intents, on any other core → re-entry.** Skip steps 3,
257
+ 4, and 9 entirely and go to step 5's re-entry branch. The core is
258
+ already chosen and its workspace already scaffolded; re-deciding
259
+ either is destructive, not a fresh start.
223
260
 
224
261
  Read the commit log alongside it for what's already built —
225
262
  full-stack-app: `feat(<module>): api` commits and each task's status in
@@ -264,28 +301,29 @@ accounts get added where there were none).
264
301
  tasks. On re-entry this is append-only: `plan` only reads intents still
265
302
  `proposed`/`planned`, so already-compiled work is untouched and its
266
303
  `complete` tasks keep their status.
267
- 8. **Commit planning intake's output as one commit** —
304
+ 8. **Commit planning intake's output as one commit** — not on the
305
+ adoption re-entry path, where `hedgehog-adopt` already committed its
306
+ own work as `chore(planning): adopt change` (step 2). Elsewhere:
268
307
  `chore(planning): intake` on a first run, `chore(planning): extend
269
- scope` on re-entry, so the two passes are distinguishable in the log.
270
- It carries the committed `.hedgehog/hedgehog.db` (its new intent and
271
- task rows on full-stack-app), `.hedgehog/addons.yaml` (full-stack-app
272
- only, and on re-entry only if a trigger actually changed), this core's
273
- own archival planning output (`.hedgehog/BMAD/` or `.hedgehog/chain/`,
274
- first run only), the authored core's `.hedgehog/core.yaml` and
275
- `.hedgehog/core-design.md` if step 4 ran, and root `CLAUDE.md`'s filled
276
- placeholders (first run only). Write these with the `no-history-in-output`
277
- skill: current state only, no narration of the intake conversation.
278
- This is planning intake's own unit of work, landed before `bootstrap`
279
- touches anything.
280
- 9. **First run only hand off to the `bootstrap` agent** once the
281
- commit lands. It scaffolds the chosen core's workspace (and, for
282
- full-stack-app, whichever add-ons are on) before any build step
283
- starts. On re-entry the workspace already exists: hand straight to
284
- this core's loop skill instead, which picks the new work up from
285
- `hedgehog next`.
286
- 10. **Return a summary**: which core (naming it as authored, if it is),
287
- the intents added (or subject statement, for landing-page), any open
288
- questions.
308
+ scope` on re-entry, so the passes are distinguishable in the log. It
309
+ carries the committed `.hedgehog/hedgehog.db` (its new intent and task
310
+ rows), `.hedgehog/addons.yaml` (full-stack-app only, and on re-entry
311
+ only if a trigger actually changed), this core's own archival planning
312
+ output (`.hedgehog/BMAD/` or `.hedgehog/chain/`, first run only), the
313
+ authored core's `.hedgehog/core.yaml` and `.hedgehog/core-design.md` if
314
+ step 4 ran, and root `CLAUDE.md`'s filled placeholders (first run
315
+ only). Write these with the `no-history-in-output` skill: current
316
+ state only, no narration of the intake conversation. This is planning
317
+ intake's own unit of work, landed before `bootstrap` touches anything.
318
+ 9. **First run only, and not on the brownfield path — hand off to the
319
+ `bootstrap` agent** once the commit lands. It scaffolds the chosen
320
+ core's workspace (and, for full-stack-app, whichever add-ons are on)
321
+ before any build step starts. On re-entry on any other core the
322
+ workspace already exists: hand straight to that core's loop skill
323
+ instead, which picks the new work up from `hedgehog next`.
324
+ 10. **Return a summary**: which core (naming it as authored or adopted,
325
+ if it is), the intents added (or subject statement, for
326
+ landing-page), any open questions.
289
327
 
290
328
  ## Constraints
291
329
 
@@ -293,12 +331,20 @@ accounts get added where there were none).
293
331
  codebase; you may write `.hedgehog/addons.yaml` (full-stack-app only —
294
332
  see "The Add-ons decision" below), `.hedgehog/core.yaml` and
295
333
  `.hedgehog/core-design.md` (authored cores only, via
296
- `hedgehog-core-design`), this core's own archival planning
334
+ `hedgehog-core-design`), `.hedgehog/core.yaml` and
335
+ `.hedgehog/adoption.md` (brownfield adoption only, via
336
+ `hedgehog-adopt`), this core's own archival planning
297
337
  output (`.hedgehog/BMAD/` or `.hedgehog/chain/` — write-once, never
298
- edited after it's written), and — first run only root `CLAUDE.md`'s
299
- `{{PROJECT_NAME}}`/`{{PROJECT_SUMMARY}}` placeholders and its installer
300
- comment block. `hedgehog intent add` and `hedgehog plan` are how you
301
- write the build graph itself not a file you edit directly.
338
+ edited after it's written), and — first run only, and not on the
339
+ brownfield path — root `CLAUDE.md`'s `{{PROJECT_NAME}}`/
340
+ `{{PROJECT_SUMMARY}}` placeholders and its installer comment block.
341
+ `hedgehog intent add` and `hedgehog plan` are how you write the build
342
+ graph itself — not a file you edit directly.
343
+ - On the brownfield path, never route toward converting the host repo's
344
+ existing stack, structure, or conventions toward any Golden Core's —
345
+ not even as a suggestion. `hedgehog-adopt` designs `verify` commands
346
+ and layer order around what the repo already uses; it doesn't propose
347
+ Nx, Drizzle, or any other opinionated choice a shipped core would make.
302
348
  - Never touch root `CLAUDE.md` outside those placeholders. Every other
303
349
  line is a Hedgehog constant for this project's core (stack, layout,
304
350
  rules, agent/skill pointers) shared verbatim across every Hedgehog
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: tweaker
3
- description: Use once a core's build is complete (every task in the build graph `complete`) and the user is offered a fresh-context session to iterate. Takes post-build tweak requests one at a time from a clean context, and — separately — reviews accumulated build friction and asks the user directly for feedback, filing each as its own GitHub issue (friction as `bug`/`help wanted`, user feedback as `suggestion`), gated by explicit user approval at every step, then makes a single one-time, no-pressure mention that Hedgehog itself takes contributions via `ROADMAP.md`. Shared by every core.
3
+ description: Use once a core's build is complete (every task in the build graph `complete`) and the user is offered a fresh-context session to iterate. Takes post-build tweak requests one at a time from a clean context, and — separately — reviews accumulated build friction and asks the user directly for feedback, filing each as its own GitHub issue (friction as `bug`/`help wanted`, user feedback as `suggestion`), gated by explicit user approval at every step, then makes a single one-time, no-pressure mention that Hedgehog itself takes contributions via `ROADMAP.md`. Shared by every core with a Stop Condition — not an adopted repo (`hedgehog-adopt`), which has none; there, new change-work goes straight through `hedgehog-adopt` and `hedgehog-authored-loop` instead.
4
4
  model: sonnet
5
5
  color: green
6
6
  tools: Read, Glob, Grep, Edit, Write, Bash
@@ -16,6 +16,14 @@ conversation. You start from a cleared context on purpose. Re-read the
16
16
  friction log (`hedgehog friction list`) and the commit log rather than
17
17
  expecting anything to be remembered.
18
18
 
19
+ **Not for an adopted repo (`.hedgehog/core.yaml` written by
20
+ `hedgehog-adopt`).** That core has no Stop Condition and no "build
21
+ finished" moment for you to follow — adoption is the permanent way
22
+ change lands, not a project with an end. A request there is just the
23
+ next unit of change-work: it goes through `hedgehog-adopt`'s "Adding the
24
+ first (or next) change-work" and `hedgehog-authored-loop`, not through
25
+ this agent.
26
+
19
27
  You have two separate jobs. Don't blend them:
20
28
 
21
29
  1. **Take tweak requests** and make them, one at a time, gated the same
@@ -37,10 +45,10 @@ straight to job 1.
37
45
 
38
46
  None of its own — you work inside whichever core's stack is already
39
47
  installed (`full-stack-app`, `landing-page`, or the stack an authored
40
- core's `.hedgehog/core-design.md` names), editing the same files the
41
- core's own build agents would. `gh` (GitHub CLI) for issue creation
42
- only, and only against `skyf0xx/hedgehog`, never the project's own
43
- remote.
48
+ core's `.hedgehog/core-design.md` names an adopted repo never reaches
49
+ you, per the note above), editing the same files the core's own build
50
+ agents would. `gh` (GitHub CLI) for issue creation only, and only against
51
+ `skyf0xx/hedgehog`, never the project's own remote.
44
52
 
45
53
  ## Core Responsibilities
46
54
 
package/src/db/why.mjs CHANGED
@@ -70,9 +70,20 @@ function formatVerification(verification) {
70
70
 
71
71
  // Renders whyPath()'s chain into the artifact → task → requirement →
72
72
  // intent shape from the spec's "Traceability" diagram.
73
+ //
74
+ // An empty chain means exactly one thing regardless of core: no task
75
+ // this build graph ever ran wrote or touched this path. On a brownfield
76
+ // adoption (hedgehog-adopt) that's the ordinary case for almost every
77
+ // file in the repo — the graph is change-scoped by design and never
78
+ // backfills a record for code that predates adoption — so the message
79
+ // says that plainly rather than reading as a broken lookup.
73
80
  export function formatWhy(path, chain) {
74
81
  if (chain.length === 0) {
75
- return `${path}\n (no artifact recorded for this path)`;
82
+ return (
83
+ `${path}\n (no artifact recorded for this path — no task in this build graph ` +
84
+ `ever wrote it; on an adopted repo this is expected for any file that predates ` +
85
+ `Hedgehog, not an error)`
86
+ );
76
87
  }
77
88
 
78
89
  const lines = [];
@@ -0,0 +1,348 @@
1
+ ---
2
+ name: hedgehog-adopt
3
+ description: Use once, at the start of bringing Hedgehog's discipline to an existing repo whose code Hedgehog didn't build — "adopt this repo", "add Hedgehog here", "I want scope/verify enforcement on my changes to this existing codebase". Invoked by the `planner` agent as Phase 0's fourth outcome, in place of any bootstrap skill. Reads the repo read-only, proposes a linear-chain `.hedgehog/core.yaml` whose `verify` commands are the repo's own, and writes only `.hedgehog/` — never touches working code. Also invoked again, briefly, whenever new change-work enters play on an already-adopted repo.
4
+ ---
5
+
6
+ # Hedgehog Adopt
7
+
8
+ Brings Hedgehog's discipline to a repo that already exists, without
9
+ bootstrapping a workspace. On every other core, bootstrap generates or
10
+ copies a workspace before any build step runs. Here there is nothing to
11
+ generate — the workspace already exists, built by whoever wrote this
12
+ repo — so this skill replaces bootstrap entirely rather than extending
13
+ it. It writes `.hedgehog/` and nothing else, ever.
14
+
15
+ ## What this is, precisely
16
+
17
+ Hedgehog on an existing repo is a **permanent discipline for how change
18
+ lands**, not an authority over what exists. The build graph covers new
19
+ work only. Pre-existing code is context to read and respect, never a node
20
+ in the graph — no task is ever created to "build" something that's
21
+ already there, and no artifact record, commit, or task ever claims
22
+ Hedgehog wrote code it didn't. `adoption.md`'s "Repo shape" section (Step
23
+ 4) is a separate thing: a dated, prose snapshot of what Step 1 observed,
24
+ refreshable by re-running this skill — never build-graph state, never
25
+ authoritative past the date it was read, and never a substitute for
26
+ reading the actual code.
27
+
28
+ This is what makes adoption safe to run on a real, live codebase:
29
+
30
+ - **The build graph never models pre-existing architecture.** Module
31
+ boundaries, conventions, and shape live in `adoption.md`'s prose as a
32
+ dated read, not as `core.yaml` state or task history — nothing about
33
+ the existing repo is ever treated as something Hedgehog built or
34
+ verified.
35
+ - **No completion backfill.** It never fabricates commits to make
36
+ `hedgehog db rebuild` believe pre-existing files were built by
37
+ Hedgehog. `rebuild.mjs` marks a task complete only when a real commit's
38
+ subject matches its `commit_message` — inventing that history would be
39
+ fiction in the permanent record, so this skill doesn't.
40
+ - **No stack migration.** The repo's language, tooling, and conventions
41
+ are already decided. This skill never proposes moving them toward any
42
+ Golden Core's stack — not Nx, not Drizzle, not anything else Hedgehog
43
+ is opinionated about elsewhere. Every `verify` command it writes is one
44
+ of the repo's own commands, confirmed with the user, never invented.
45
+ - **No legacy-code review.** `reviewer`, once this core is running,
46
+ judges only the unit under change — never findings against pre-existing
47
+ code nothing asked it to look at.
48
+ - **No generators.** Nothing here scaffolds files the way a Golden
49
+ Core's bootstrap does. This skill's only output is `.hedgehog/`.
50
+
51
+ What *does* transfer from the rest of Hedgehog, unweakened: scope as a
52
+ hard boundary on every task, no self-certification (only `hedgehog
53
+ verify`'s exit code moves state and commits), the dependency graph and
54
+ its leases and safe parallelism, small per-layer context loops, and
55
+ `reviewer`/`debt`/`friction` as real channels. On an existing codebase
56
+ scope enforcement is worth *more* than on a fresh one: blast radius is
57
+ the primary risk on code you didn't write, and bounding it is the one
58
+ thing a generic agent setup doesn't give you.
59
+
60
+ ## When this runs
61
+
62
+ `planner`'s Phase 0 routes here as a fourth outcome, distinct from "which
63
+ shipped core fits" or "author one" — the question here isn't which core
64
+ fits new work, it's that no new workspace is being built at all. Skip
65
+ `hedgehog-planning-intake`'s BMAD shelf entirely: BMAD elicits product
66
+ drivers (persistence, deployment target, integration surface) that are
67
+ already settled facts of a repo that already exists, not open decisions
68
+ to interview for.
69
+
70
+ Two entry shapes:
71
+
72
+ - **First run** — nothing under `.hedgehog/` yet. Run every step below
73
+ through Confirm & Lock, then add the first intent(s).
74
+ - **Later run** — `.hedgehog/core.yaml` already exists and was written by
75
+ this skill (its own record — see Step 5). New change-work entered play.
76
+ Skip straight to "Adding change-work" below; every earlier step is
77
+ already-locked state, except `adoption.md`'s "Repo shape" section, which
78
+ that same later run may refresh on request (see Step 4).
79
+
80
+ ## Step 1 — read the repo, read-only
81
+
82
+ Before proposing anything, read enough of the repo to answer:
83
+
84
+ - **Layout.** Where source lives, where tests live, whether there's a
85
+ monorepo structure (workspaces, packages) or a single package.
86
+ - **Package manager and toolchain.** `package.json`/`pnpm-lock.yaml`/
87
+ `yarn.lock` (which one), `Cargo.toml`, `pyproject.toml`, `go.mod`,
88
+ whatever the repo's own manifest is.
89
+ - **Existing commands.** `package.json` `scripts` (test, lint, typecheck,
90
+ build), a `Makefile`, CI config (`.github/workflows/*.yml`,
91
+ `.gitlab-ci.yml`) — CI config is often the most trustworthy source,
92
+ since it's what the repo's own maintainers already run as their bar for
93
+ "this change is good."
94
+ - **Natural seams.** Places where a change plausibly needs to move in a
95
+ fixed order — a schema or migration before the code that reads it, a
96
+ shared type or contract before its consumers, a public API before an
97
+ internal one. Not every repo has these; a repo with no natural
98
+ ordering constraint gets a single-layer chain (see Step 3). When a
99
+ workspace manifest declares structure — `pnpm-workspace.yaml`,
100
+ `Cargo.toml`'s `[workspace]` table, `go.work`, or equivalent — read it
101
+ directly for the package list and which packages depend on which; that's
102
+ evidence for a seam candidate, not a seam itself (see Step 3). Absent a
103
+ manifest, fall back to reading the repo directly.
104
+ - **Shape.** Module or package boundaries, key entry points, and code
105
+ conventions actually observed — naming patterns, error-handling idiom,
106
+ where tests live relative to source. Note only what's actually visible
107
+ in the files read for the other bullets above; skip this bullet outright
108
+ if the repo is too small or too inconsistent to show a real pattern.
109
+ This becomes `adoption.md`'s "Repo shape" section (Step 4) — calibration
110
+ for how new code gets written, not an architecture model.
111
+
112
+ This step is entirely read-only. Never write, edit, or run anything that
113
+ mutates the working tree here — no `npm install`, no formatter, nothing.
114
+
115
+ ## Step 2 — propose the verify commands, confirm with the user
116
+
117
+ Candidate commands come only from what Step 1 actually found — never
118
+ invented, never assumed from convention ("this looks like it should have
119
+ a lint script"). Show the candidates and their source (`package.json`
120
+ script name, Makefile target, CI job step) and get explicit confirmation
121
+ before writing anything.
122
+
123
+ This is the highest-leverage step in the whole skill and the one place a
124
+ mistake is silent rather than loud: a `verify` command that doesn't
125
+ actually check what it claims to (a script that's a no-op, a lint config
126
+ so lenient it never fails, a test command that runs zero tests) still
127
+ exits 0, so `hedgehog verify` commits work that was never actually
128
+ checked. It looks like success. Read what a candidate command actually
129
+ does — not just its name — before proposing it: a `"test": "echo
130
+ ok"` placeholder script is a real thing real repos have.
131
+
132
+ If the repo has no test command at all, say so plainly rather than
133
+ inventing one. A layer's `verify` can be a typecheck or lint alone if
134
+ that's genuinely all the repo has — an honest, weaker gate beats a
135
+ fabricated test command that doesn't exist.
136
+
137
+ ## Step 3 — propose the layer chain
138
+
139
+ **Linear chain, no `{module}` anywhere.** Change order is not
140
+ construction order — there's no "schema before service" here, because
141
+ nothing is being constructed. The chain expresses, for a given batch of
142
+ change-work, which seam moves first and what has to be re-verified after.
143
+ A repo with no natural seam (Step 1 found none) gets the degenerate case:
144
+ one layer, scope `["**"]`, verify the repo's full check. A repo with a
145
+ real seam (e.g. a shared package other packages depend on) gets that
146
+ seam as an earlier layer, `depends_on` chaining the rest after it — the
147
+ same pattern `landing-page`'s brief → feeling → tokens → sequence →
148
+ artifact chain already establishes for a linear, no-module-axis core
149
+ (`src/golden-cores/landing-page/core.yaml`). When Step 1 found a
150
+ workspace manifest, its declared packages and dependency direction are
151
+ candidate seams, shown to the user with the manifest as their source —
152
+ same as Step 2's verify-command candidates, confirmed before anything is
153
+ written, never assumed straight into the chain.
154
+
155
+ Linear chain is not a simplification made for this skill's convenience —
156
+ it's what sidesteps `core.mjs`'s module-axis uniformity rule
157
+ (`validateCore`, `src/db/core.mjs:603`): a core where any layer's scope
158
+ carries `{module}` requires every non-`exclusive`/non-`once` layer to
159
+ carry one too, which fights any repo not laid out module-per-directory.
160
+ Never introduce `{module}` here.
161
+
162
+ **Always end with a `join`-style tail layer**: `scope: ["**"]`,
163
+ `exclusive: true`, verify the repo's full check (typecheck + test,
164
+ whatever Step 2 confirmed covers the whole repo) — the cross-cutting
165
+ safety net, the same pattern `full-stack-app`'s own `join` layer
166
+ establishes. This is what catches a change that passed its own narrow
167
+ layer's verify but broke something the narrower verify command couldn't
168
+ see.
169
+
170
+ Each layer's `commit` uses the repo's own conventional-commit style if it
171
+ has one (read a handful of recent commit subjects to tell), or standard
172
+ Conventional Commits otherwise.
173
+
174
+ ## Step 4 — write `.hedgehog/adoption.md`
175
+
176
+ The rationale, same stance as `core-design.md` on an authored core: what
177
+ the repo's own commands are and their source, why the layers are ordered
178
+ the way they are (or why there's only one, for a repo with no natural
179
+ seam), and what was deliberately left out (stack migration, legacy
180
+ review — name these explicitly so a later reader doesn't wonder whether
181
+ they were forgotten). No nested YAML-shaped content — this file is
182
+ prose, `core.yaml` is the only file the engine parses.
183
+
184
+ Add a **"Repo shape, as of adoption"** section from Step 1's Shape
185
+ bullet: module/package boundaries, entry points, and conventions
186
+ observed, headed with the date and git ref it was read at. Label it
187
+ plainly as a snapshot — what the repo looked like when read, not a
188
+ live model — and say how to refresh it: re-run this skill (see "Adding
189
+ the first (or next) change-work" below), never a hand edit.
190
+
191
+ Only this section is refreshable. Everything else in `adoption.md` — the
192
+ commands, the layer rationale, what was left out — is locked the same as
193
+ `core.yaml`, written once at Step 5 and changed only by the Correction
194
+ Protocol path described there.
195
+
196
+ ## Step 5 — Confirm & Lock
197
+
198
+ 🔒 Show, in full:
199
+
200
+ - The commands Step 2 confirmed and where each came from.
201
+ - The layer chain in order: what each owns, its scope globs, its verify
202
+ command, its commit message.
203
+ - The tail `join` layer explicitly, and what it catches that the earlier
204
+ layers don't.
205
+ - Plainly, in these words or equivalent: *"This adds Hedgehog's
206
+ discipline to how change lands on this repo from here forward. It
207
+ never touches your existing code and never converts your stack — only
208
+ new work goes through this build graph, and coverage will always be
209
+ partial by design. `adoption.md` will also hold a dated snapshot of
210
+ this repo's shape, refreshable on request — never build-graph state,
211
+ never treated as current past the date it was read."*
212
+
213
+ Wait for explicit go-ahead. On confirmation, write `.hedgehog/core.yaml`
214
+ (exact format `src/db/core.mjs` parses — see any shipped core.yaml for
215
+ the shape) and `.hedgehog/adoption.md`. Verify the file loads before
216
+ showing it back:
217
+
218
+ ```bash
219
+ node -e "import('<path-to-hedgehog-install>/src/db/core.mjs').then(m => m.loadCore('.hedgehog/core.yaml')).then(c => console.log(JSON.stringify(c, null, 2)))"
220
+ ```
221
+
222
+ Nothing else gets written at adoption time. No working code, no
223
+ `package.json` edits, no formatter run, no root `CLAUDE.md` project
224
+ placeholders — `{{PROJECT_NAME}}`/`{{PROJECT_SUMMARY}}` describe a
225
+ project Hedgehog is building, and adoption isn't building one, so leave
226
+ them alone. Fill root `CLAUDE.md`'s `{{CORE_SECTION}}` placeholder with
227
+ `src/templates/CLAUDE.core.adopted.md`'s content — the same mechanic
228
+ `hedgehog-bootstrap-authored-core` uses for an authored core, done here
229
+ directly since there is no bootstrap step on this path to do it.
230
+
231
+ ## Adding the first (or next) change-work
232
+
233
+ Before adding an intent, judge the request the same way `planner`'s
234
+ Phase 0 judges which core fits: a clear, bounded ask ("fix the auth
235
+ timeout bug") goes straight to `hedgehog intent add` below. A large or
236
+ under-specified one ("add billing," "support multi-tenancy") gets
237
+ `hedgehog-adopt-elicit` first — a short, targeted clarifying pass on
238
+ what's in scope, what's explicitly out, and any constraints the user
239
+ already knows — not `hedgehog-planning-intake`'s BMAD shelf (that
240
+ shelf's product-driver questions don't fit a change to a repo that
241
+ already exists, whatever the change's size). Fold the answers directly
242
+ into the intent's own `--goal`/`--outcome` text; nothing new gets archived or
243
+ locked.
244
+
245
+ Once `core.yaml` is locked and any elicitation above is done, add intents
246
+ the same way any other core does — `hedgehog intent add --id <id> --goal
247
+ <goal> --outcome <outcome>`, one per distinct unit of change, each `id`
248
+ naming the change rather than a domain module (`fix-auth-timeout`,
249
+ `add-rate-limiting`, not a table or screen name — there's no module axis
250
+ here). Then `hedgehog plan` compiles it through the locked chain. This is
251
+ the same shape whether it's the first intent on a freshly adopted repo or
252
+ the fifth one three months later — adoption has no first-run-only intent
253
+ step the way planning intake does; every entry is the same mechanical
254
+ add, sized as above.
255
+
256
+ An adoption re-run can also refresh `adoption.md`'s "Repo shape" section
257
+ on request — when the user or `planner` flags that the repo's changed
258
+ enough since the last read to be worth re-scanning. Re-run Step 1's Shape
259
+ bullet and Step 4's write for that section only; the commands, layer
260
+ chain, and rest of `adoption.md` stay locked and untouched.
261
+
262
+ Commit this as `chore(planning): adopt` (first run, alongside the
263
+ Confirm & Lock commit) or `chore(planning): adopt change` (every later
264
+ run adding new change-work) — distinguishable from `hedgehog-planning-
265
+ intake`'s own `chore(planning): intake`/`extend scope` messages, since no
266
+ BMAD archive backs either of these.
267
+
268
+ From here, hand off to `hedgehog-authored-loop` — this core's
269
+ `core.yaml` is shaped exactly like an authored core's, so the same loop
270
+ skill runs it unmodified: `hedgehog claim` reserves the packet, `layer-
271
+ eng` builds it, `hedgehog verify` gates and commits it. That skill's
272
+ "Module axis" section always reads as linear chain here; its Correction
273
+ Protocol and Stop Condition apply as written, with one addition — see
274
+ "No global Stop Condition" below.
275
+
276
+ ## `hedgehog why` on pre-existing code
277
+
278
+ A file this skill's chain never touched has no `artifacts` row, because
279
+ Hedgehog never built it — `hedgehog why <path>` already says so plainly
280
+ (`(no artifact recorded for this path)`) rather than erroring or
281
+ returning something misleading. That's the correct, expected answer for
282
+ almost every file in a freshly adopted repo. It is not a bug to route
283
+ around and not something this skill tries to backfill.
284
+
285
+ ## No global Stop Condition
286
+
287
+ Every other core's Stop Condition fires once the whole graph is
288
+ `complete` — the project is done. Adoption has no such moment: it is the
289
+ permanent way change lands on this repo from here on, not a build that
290
+ finishes. Read `hedgehog-authored-loop`'s Stop Condition as **per-change,
291
+ never whole-graph**: `hedgehog boundary` still answers "is now a safe
292
+ moment to clear context" for the change currently in flight, and that
293
+ check is exactly as useful here as anywhere else. What doesn't apply is
294
+ treating "every task complete" as a project-level milestone worth a
295
+ handoff ceremony — there's always a next change, and the next one is
296
+ just another `hedgehog-adopt` intent add away.
297
+
298
+ ## Coverage is partial — say so
299
+
300
+ `hedgehog status` and `hedgehog boundary` describe the state of work
301
+ under discipline, never the state of the repo as a whole. On an adopted
302
+ repo this matters more than it does elsewhere: a fresh Hedgehog project's
303
+ graph and its repo are the same size by construction, but an adopted
304
+ repo's graph only ever covers what's passed through it since adoption.
305
+ Never let a status summary imply broader authority than that — if asked
306
+ "is this repo fully covered," the honest answer is always "no, only the
307
+ changes that went through Hedgehog since adoption are," not a count that
308
+ could be misread as a percentage of the whole.
309
+
310
+ ## Constraints
311
+
312
+ - **Never touch working code, at adoption time or ever, as this skill.**
313
+ The only writes this skill makes are `.hedgehog/core.yaml`,
314
+ `.hedgehog/adoption.md` (Step 4's rationale and its "Repo shape"
315
+ section), root `CLAUDE.md`'s `{{CORE_SECTION}}` placeholder (first run
316
+ only), and the build graph via `hedgehog intent add`/`hedgehog plan`.
317
+ `hedgehog-adopt-elicit`'s clarifying pass writes nothing of its own —
318
+ its output only ever becomes `--goal`/`--outcome` text on an
319
+ `hedgehog intent add` call. Everything else — the actual change-work —
320
+ is `layer-eng`'s job through `hedgehog-authored-loop`, gated the same
321
+ as any other layer.
322
+ - **Never propose converting the repo's stack, structure, or conventions
323
+ toward any Golden Core's** — not Nx, not a particular ORM, not a
324
+ particular framework. Not even phrased as a suggestion. This is the one
325
+ headline pillar (opinionated stack + generators) that deliberately does
326
+ not come along to a brownfield adoption — say so if asked, don't quietly
327
+ work around it.
328
+ - **Never invent a `verify` command.** Every one comes from something
329
+ Step 1 actually found in the repo and Step 2 actually confirmed with
330
+ the user. A wrong `verify` command is the worst failure mode available
331
+ — it looks like success while checking nothing.
332
+ - **Never create a task for pre-existing code.** The graph is
333
+ change-scoped by construction; a task exists only for work an intent
334
+ actually asked for.
335
+ - **No `{module}` anywhere in `core.yaml`.** Linear chain only — see Step
336
+ 3 for why.
337
+ - **Always end the chain with an `exclusive: true`, `scope: ["**"]` join
338
+ layer.** This is the cross-cutting net that catches what a narrower
339
+ layer's verify can't see.
340
+ - **`.hedgehog/core.yaml` is locked once written, and so is everything in
341
+ `adoption.md` except its "Repo shape" section.** A layer chain that
342
+ turns out wrong is a re-run of this skill to add or adjust a layer via
343
+ a fresh Confirm & Lock, not a silent edit — and never touches tasks
344
+ already compiled or completed (see `hedgehog-authored-loop`'s
345
+ "core.yaml vs. the packet" for the drift/reconcile mechanics, which
346
+ apply here unchanged). "Repo shape" is the one section a later run may
347
+ regenerate on request (see "Adding the first (or next) change-work"),
348
+ and even then only by re-running Step 1/4, never a hand edit.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: hedgehog-adopt-elicit
3
+ description: Use when `hedgehog-adopt` is about to add an intent for a large or under-specified unit of change on an already-adopted repo — "add billing," "support multi-tenancy," anything whose scope isn't already obvious from how the user asked for it. Runs a short, targeted clarifying pass (a handful of questions, not a shelf) and returns goal/outcome text ready for `hedgehog intent add`. Invoked by `hedgehog-adopt`'s "Adding the first (or next) change-work" step; don't run standalone, and don't run for a clear, bounded request — that goes straight to `hedgehog intent add` without this skill.
4
+ ---
5
+
6
+ # Hedgehog Adopt Elicit
7
+
8
+ A short clarifying pass for one oversized or ambiguous change request on
9
+ an adopted repo, run in the same conversation already talking to the
10
+ user — never as a detached subagent, since the answers are the point of
11
+ asking. This is not `hedgehog-planning-intake`'s BMAD shelf run small:
12
+ that shelf elicits product drivers (persistence, deployment target,
13
+ integration surface) for a project that doesn't exist yet. Here the
14
+ project already exists; what's missing is only the shape of *this one
15
+ change*.
16
+
17
+ ## When this runs
18
+
19
+ `hedgehog-adopt` calls this skill for one request at a time, right before
20
+ it would otherwise call `hedgehog intent add` directly. A request needs
21
+ this pass when its scope isn't already clear from how it was asked —
22
+ "add billing," "support multi-tenancy," anything where a reasonable
23
+ `--goal`/`--outcome` pair isn't obvious without more information. A
24
+ request that's already bounded ("fix the auth timeout bug", "add a rate
25
+ limit to the signup endpoint") skips this skill entirely.
26
+
27
+ ## Ask, then fold the answers in
28
+
29
+ Ask a small number of targeted questions — usually three or four, never
30
+ a fixed script:
31
+
32
+ - What's actually in scope for this change, in the user's own terms.
33
+ - What's explicitly out of scope, if anything is likely to be assumed in
34
+ by mistake.
35
+ - Any constraint the user already knows and hasn't said yet (a
36
+ compliance requirement, an existing table or endpoint this has to work
37
+ with, a deadline that affects how big a first cut should be).
38
+
39
+ Stop once the answers are enough to write a `--goal` and `--outcome` a
40
+ stranger could build from without guessing — don't keep probing past
41
+ that point, and don't ask about anything `hedgehog-adopt`'s own read of
42
+ the repo (commands, seams, shape) already answered.
43
+
44
+ Write the answers straight into the intent's `--goal`/`--outcome` text
45
+ when `hedgehog-adopt` calls `hedgehog intent add`. Nothing here gets
46
+ archived, written to disk, or locked — no file, no `.hedgehog/BMAD/`-style
47
+ record. If the request turns out too large for one intent, say so and
48
+ propose splitting it into more than one `hedgehog intent add` call,
49
+ each sized the way every other adopted-repo intent is: a unit of change,
50
+ not a domain module.
51
+
52
+ ## Constraints
53
+
54
+ - Never elicit product-level drivers already settled by the repo's
55
+ existence — stack, persistence, deployment target. Those are
56
+ `hedgehog-planning-intake`'s questions for a project being built, not
57
+ this skill's for a change to one that exists.
58
+ - Never write a file. This skill's only output is text that becomes part
59
+ of an intent's `--goal`/`--outcome`.
60
+ - Never run for a request that's already bounded. Asking questions a
61
+ clear request already answered is friction, not diligence.
@@ -1,31 +1,42 @@
1
1
  ---
2
2
  name: hedgehog-authored-loop
3
- description: Use for every unit of work on an authored core (`.hedgehog/core.yaml` present) once bootstrap has closed — building one layer per claimed packet, gated by `hedgehog verify` and committed one layer at a time. Triggers on "next step", "what's next", "build this", or the start of any work session on a bootstrapped authored-core project. Also covers the Correction Protocol and the Stop Condition for this core.
3
+ description: Use for every unit of work on an authored core (`.hedgehog/core.yaml` present, no shipped Golden Core name) once its workspace is ready — building one layer per claimed packet, gated by `hedgehog verify` and committed one layer at a time. Triggers on "next step", "what's next", "build this", or the start of any work session on such a project. Covers two cases: a project `hedgehog-core-design` designed from scratch (workspace generated by `hedgehog-bootstrap-authored-core`) and an existing repo `hedgehog-adopt` brought under discipline (no workspace generated — the repo already had one). Also covers the Correction Protocol and the Stop Condition for both.
4
4
  ---
5
5
 
6
6
  # Hedgehog Authored Loop
7
7
 
8
- The operating loop for a bootstrapped project on an authored core:
9
- `hedgehog claim` reserves the packet(s) for ready layers, `layer-eng`
10
- builds each, `hedgehog verify` gates and commits it. The build graph
8
+ The operating loop for a project on an authored-shaped core: `hedgehog
9
+ claim` reserves the packet(s) for ready layers, `layer-eng` builds each,
10
+ `hedgehog verify` gates and commits it. The build graph
11
11
  (`.hedgehog/hedgehog.db`) is the live list — query it via `hedgehog
12
12
  status`/`hedgehog ready`, never re-derive state from prose.
13
13
 
14
14
  ## Where this core's shape lives
15
15
 
16
- An authored core's layer sequence and stack were designed for this
17
- project by `hedgehog-core-design`. Two files carry them, and both are
18
- locked:
19
-
20
- - **`.hedgehog/core.yaml`** the design authority: layer order, each
21
- layer's `scope` globs, `verify` command, commit message. `hedgehog
22
- plan` compiled the graph from it.
23
- - **`.hedgehog/core-design.md`** the rationale: system shape, stack,
24
- what each layer owns and why it sits where it does, and the module-axis
25
- decision.
26
-
27
- Read `core-design.md` at the start of a session to know what this project
28
- is.
16
+ Two files carry the layer sequence, and both are locked. Which pair
17
+ depends on how this core came to exist:
18
+
19
+ - **Designed from scratch** (`hedgehog-core-design` ran) —
20
+ **`.hedgehog/core.yaml`** is the design authority; **`.hedgehog/
21
+ core-design.md`** is the rationale: system shape, stack, what each
22
+ layer owns and why it sits where it does, and the module-axis decision.
23
+ - **Adopted onto an existing repo** (`hedgehog-adopt` ran) —
24
+ **`.hedgehog/core.yaml`** is the same design authority, always a linear
25
+ chain (no module axis); **`.hedgehog/adoption.md`** is the rationale:
26
+ the repo's own commands and their source, why the layers are ordered
27
+ the way they are, and what was deliberately left unmodeled (see
28
+ `hedgehog-adopt`'s "No global Stop Condition" and "Coverage is
29
+ partial" — both apply here and are not repeated below).
30
+
31
+ Either way, `.hedgehog/core.yaml` is what the compiler and every command
32
+ below actually read. Read the rationale file at the start of a session to
33
+ know what this project (or this adopted repo's discipline) is —
34
+ `layer-eng` reads it before writing any layer, the same standing
35
+ `core-design.md` has on a designed core. On an adopted core,
36
+ `adoption.md`'s "Repo shape" section is a dated snapshot, not a live
37
+ model — treat it as calibration for how new code should look, and read
38
+ the actual files it describes when precision matters more than a snapshot
39
+ can offer.
29
40
 
30
41
  ### core.yaml vs. the packet
31
42
 
@@ -102,7 +113,8 @@ runtime detail.
102
113
  claimable/held-back split without claiming anything.
103
114
  2. **Dispatch each claimed packet to its own `layer-eng` subagent** — in
104
115
  ONE message with parallel tool calls when there's more than one — along
105
- with the reminder to read `.hedgehog/core-design.md` for what its
116
+ with the reminder to read this core's rationale file
117
+ (`.hedgehog/core-design.md` or `.hedgehog/adoption.md`) for what its
106
118
  layer owns.
107
119
  3. Each agent **runs the packet's VERIFICATION command on its own work**
108
120
  as a sanity check before reporting back — necessary, not sufficient.
@@ -190,8 +202,8 @@ with what's there.
190
202
 
191
203
  Three hold on every authored core regardless of stack:
192
204
 
193
- - **A layer owns one artifact, reached through the interface
194
- `core-design.md` named.** The layer below is consumed through that
205
+ - **A layer owns one artifact, reached through the interface the
206
+ rationale file named.** The layer below is consumed through that
195
207
  interface, not reached around — the boundary is what makes the layer
196
208
  independently verifiable.
197
209
  - **Errors carry their meaning.** A failure surfaces as the stack's
@@ -227,10 +239,10 @@ built output.
227
239
 
228
240
  When the correction is to the **layer sequence itself** — a layer in the
229
241
  wrong place, a missing layer, a scope glob that never fits — that's a
230
- `planner` case, not a patch: `.hedgehog/core.yaml` and
231
- `.hedgehog/core-design.md` are locked, and changing them re-shapes every
232
- task the graph compiles. Stop, say what the design got wrong, and hand to
233
- `planner`.
242
+ `planner` case (or, on an adopted core, a `hedgehog-adopt` re-run), not a
243
+ patch: `.hedgehog/core.yaml` and the rationale file are locked outside
244
+ that path, and changing them re-shapes every task the graph compiles.
245
+ Stop, say what the design got wrong, and hand to `planner`.
234
246
 
235
247
  Once `planner` has changed `core.yaml`, the edit still has to be pushed
236
248
  into the already-compiled graph — run `hedgehog plan --recompile` (see
@@ -255,7 +267,7 @@ by hand after an interruption.
255
267
 
256
268
  Use the `reviewer` agent at the point a layer closes for the last intent
257
269
  on a module axis, or at the last layer on a linear chain — it checks what
258
- the mechanical gate can't: whether the layer boundary `core-design.md`
270
+ the mechanical gate can't: whether the layer boundary the rationale file
259
271
  described actually held, and whether the interfaces between layers stayed
260
272
  the ones that were designed.
261
273
 
@@ -275,16 +287,23 @@ the ones that were designed.
275
287
  - **Scope is the boundary.** A layer writes inside its ALLOWED SCOPE and
276
288
  nowhere else; a change that needs to land elsewhere is a correction,
277
289
  not a wider write.
278
- - **`.hedgehog/core.yaml` and `.hedgehog/core-design.md` are locked.**
279
- Changing either is a `planner` decision through the Correction
280
- Protocol.
290
+ - **`.hedgehog/core.yaml` and the rationale file are locked** (except
291
+ `adoption.md`'s "Repo shape" section on an adopted core, refreshable via
292
+ `hedgehog-adopt`). Changing anything else is a `planner` decision
293
+ through the Correction Protocol.
281
294
 
282
295
  ## Stop Condition
283
296
 
297
+ **On an adopted repo (`hedgehog-adopt` wrote this core), skip this
298
+ section's whole-graph framing** — there is no global Stop Condition;
299
+ adoption is the permanent way change lands on the repo, not a build that
300
+ finishes. Only the mid-build `hedgehog boundary` check below applies, per
301
+ change, forever. See `hedgehog-adopt`'s "No global Stop Condition".
302
+
284
303
  Same fresh-context handoff as `hedgehog-loop`'s Stop Condition (offer it
285
304
  once every task is `complete`, `hedgehog boundary` exits 0, and
286
305
  scope isn't genuinely ambiguous; the permanent record is the committed
287
- intents, friction log, and `core.yaml`, not `.hedgehog/hedgehog.db`,
306
+ intents, friction log, and `.hedgehog/core.yaml`, not `.hedgehog/hedgehog.db`,
288
307
  which is gitignored and derived; a `tweaker` session in a *new* chat
289
308
  window handles adjustments, using the same paste-in prompt that skill's
290
309
  Stop Condition gives). On a module axis, "every task complete" means
@@ -306,7 +325,10 @@ work without re-running planning from scratch, compiling them through
306
325
  the layer sequence `.hedgehog/core.yaml` already defines, and without
307
326
  disturbing anything already built. A completed build is extendable, not
308
327
  sealed. Changing the **layer sequence itself** is the separate case
309
- above — a Correction Protocol entry, not a re-entry pass.
328
+ above — a Correction Protocol entry, not a re-entry pass. On an adopted
329
+ repo, new change-work goes to `hedgehog-adopt`'s "Adding the first (or
330
+ next) change-work" instead of the Re-entry pass — there is no BMAD
331
+ archive here to read as context.
310
332
 
311
333
  Don't start making tweaks or planning new scope in the current,
312
334
  already-large context; that's what the fresh session is for.
@@ -36,7 +36,11 @@ copied to the repo root:
36
36
  (`DATABASE_URL`/`NODE_ENV`/`WEB_ORIGIN`, copied to `.env` in step 4),
37
37
  `lefthook.yml`, `commitlint.config.cjs`,
38
38
  `tools/phase-gate.cjs`, `.github/workflows/phase-gate.yml`,
39
- `tsconfig.base.json`, `pnpm-lock.yaml`.
39
+ `tsconfig.base.json`, `pnpm-lock.yaml`, and `core.yaml` — the shipped
40
+ layer sequence `hedgehog plan`/`verify`/`next` read for this project.
41
+ This root `core.yaml` is a different file from `.hedgehog/core.yaml`,
42
+ which only exists on an authored core (see `hedgehog-core-design`) —
43
+ the two never coexist on the same project.
40
44
  - `packages/config/` — `eslint-base.js`, `prettier.js` (no
41
45
  `prettier-plugin-tailwindcss` — that's `apps/web`'s own config, already
42
46
  wired), `env.schema.ts` (core fields only: `DATABASE_URL`, `NODE_ENV`,
@@ -17,7 +17,7 @@ renderer — the UI, reaching the privileged process only through ipc
17
17
  - Merge `domain` into `main` for an app whose logic is mostly OS
18
18
  orchestration (a launcher, a sync daemon with a thin window) — there's
19
19
  no separable domain to isolate.
20
- - Add a `persistence` layer between `domain` and `main`, depending on
20
+ - Add a `persistence` layer between `main` and `domain`, depending on
21
21
  `domain`, when the app owns a real local store (SQLite, a document
22
22
  format) rather than plain preference files.
23
23
  - On a native stack (Swift/AppKit, C#/WinUI) the `ipc` layer disappears —
@@ -514,8 +514,10 @@ question and wait.
514
514
  On the former (a real build completion, not an ambiguity stop), offer a
515
515
  fresh-context handoff before doing anything else: tell the user the
516
516
  build is complete, and that clearing context now costs nothing. The
517
- permanent record is the committed intents, friction log, `core.yaml`,
518
- and the commit history itself — not `.hedgehog/hedgehog.db`, which is
517
+ permanent record is the committed intents, friction log, root
518
+ `core.yaml` (the shipped core definition — not `.hedgehog/core.yaml`,
519
+ which only exists on an authored core), and the commit history itself —
520
+ not `.hedgehog/hedgehog.db`, which is
519
521
  gitignored and derived, rebuildable at any time via `hedgehog db
520
522
  rebuild`. That's what makes the next session cheap.
521
523
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hedgehog-planning-intake
3
- description: Use on any core for first-run planning intake — Phase 0 runs the vendored BMAD-METHOD planning shelf, shared by every core, and Phase 1 (mining `04-prd.md` into intent records plus the Add-ons decision) is full-stack-app's own procedure. Also use for the Re-entry pass, which mines new scope into additional intents without re-running the shelf, on any core with a module axis to add an intent to (full-stack-app, authored) — landing-page has none, so its own new-scope path runs through `hedgehog-landing-loop`'s Correction Protocol instead. Invoked by the `planner` agent, which decides the path; don't run standalone. landing-page runs this skill's Phase 0 on first run, then mines the same archive through `hedgehog-landing-loop`'s own planning-intake section, that core's counterpart to this skill's Phase 1. An authored core runs this skill's Phase 0, then `hedgehog-core-design`, then this skill's Phase 1 mining against the designed layer sequence.
3
+ description: Use on any core for first-run planning intake — Phase 0 runs the vendored BMAD-METHOD planning shelf, shared by every core, and Phase 1 (mining `04-prd.md` into intent records plus the Add-ons decision) is full-stack-app's own procedure. Also use for the Re-entry pass, which mines new scope into additional intents without re-running the shelf, on any core with a module axis to add an intent to (full-stack-app, authored) — landing-page has none, so its own new-scope path runs through `hedgehog-landing-loop`'s Correction Protocol instead. Invoked by the `planner` agent, which decides the path; don't run standalone. landing-page runs this skill's Phase 0 on first run, then mines the same archive through `hedgehog-landing-loop`'s own planning-intake section, that core's counterpart to this skill's Phase 1. An authored core runs this skill's Phase 0, then `hedgehog-core-design`, then this skill's Phase 1 mining against the designed layer sequence. A brownfield adoption (`hedgehog-adopt`) never runs this skill's shelf at all — the drivers BMAD elicits are already settled facts of a repo that already exists.
4
4
  ---
5
5
 
6
6
  # Hedgehog Planning Intake
@@ -0,0 +1,107 @@
1
+ ## This project's core: adopted (brownfield)
2
+
3
+ Hedgehog was adopted onto this repo's existing codebase by
4
+ `hedgehog-adopt` rather than building a workspace from scratch. The build
5
+ graph here covers **new change only**, and no task, commit, or artifact
6
+ record in it is ever fabricated for code Hedgehog didn't touch — that's
7
+ absolute. Pre-existing code is context to read and respect, never a node
8
+ in the build graph.
9
+
10
+ - **`.hedgehog/core.yaml`** — a linear chain of change-order layers (no
11
+ module axis), each `verify` command drawn from this repo's own
12
+ test/lint/typecheck commands, confirmed at adoption time. `hedgehog
13
+ plan` compiles the build graph from it.
14
+ - **`.hedgehog/adoption.md`** — the rationale: what the repo's own
15
+ commands are, why the layers are ordered the way they are, what
16
+ `hedgehog-adopt` deliberately chose not to do (stack migration, legacy
17
+ review), and a "Repo shape" section — module boundaries, entry points,
18
+ and conventions observed, dated to when it was read. That section is a
19
+ snapshot, refreshable by re-running `hedgehog-adopt`, never build-graph
20
+ state and never treated as current past its date.
21
+
22
+ Read `adoption.md` to know what each layer covers and why, and to get
23
+ your bearings in this repo's shape before writing new code — then confirm
24
+ against the actual files, since the snapshot ages and the code doesn't
25
+ wait for a refresh. There is no `core-design.md` on this core —
26
+ `hedgehog-adopt` never designs a stack or proposes converting this repo
27
+ toward one; it only wraps the commands and seams already here.
28
+
29
+ **Coverage is partial, always.** `hedgehog status` and `hedgehog boundary`
30
+ describe the state of work under discipline, not the state of this repo.
31
+ A file with no entry under `hedgehog why` was never touched by Hedgehog —
32
+ that's expected on an adopted repo, not a bug.
33
+
34
+ **The packet is what actually runs**, same as any other core: `hedgehog
35
+ plan` copies each layer's scope globs, verify command, and commit message
36
+ onto the task row at compile time, and the packet is gated against that
37
+ row, not against a live re-read of `core.yaml`. See `hedgehog-authored-
38
+ loop`'s "core.yaml vs. the packet" for the drift/reconcile mechanics —
39
+ they apply here unchanged.
40
+
41
+ ### The skills — invoke these, don't improvise
42
+
43
+ - **`hedgehog-authored-loop`** — every unit of change: `hedgehog next`
44
+ emits the packet for one ready layer, `layer-eng` builds it, `hedgehog
45
+ verify` gates and commits it. Also holds the Correction Protocol and
46
+ this core's Stop Condition (per-change here, not whole-graph — see
47
+ below).
48
+ - **`hedgehog-adopt`** — run again whenever new change-work enters play:
49
+ sizes the request (a large or ambiguous one gets a short clarifying
50
+ pass first), adds one or more intents for the change (goal, outcome,
51
+ which seam it touches), and runs `hedgehog plan`. Never re-proposes the
52
+ layer chain — that was fixed at adoption time. Can also refresh
53
+ `adoption.md`'s "Repo shape" section on request, but only that section.
54
+
55
+ ### The agents — delegate the judgment calls
56
+
57
+ - **`planner`** — routes new change-work here via `hedgehog intent add`
58
+ once this repo is under adoption; does not re-run intake or re-decide
59
+ the core.
60
+ - **`layer-eng`** — builds one layer per `hedgehog next` packet, working
61
+ from the packet's ALLOWED SCOPE. Reports the work done; never commits
62
+ it.
63
+ - **`reviewer`** — judges only the unit under change, never pre-existing
64
+ code the current work didn't touch. A day-one dump of legacy findings
65
+ is out of scope by design — see `adoption.md`.
66
+ - **`tweaker`** — adjustments to what Hedgehog itself has built under
67
+ this adoption; not a channel for legacy-code cleanup.
68
+
69
+ ## The constants (do not deviate)
70
+
71
+ ### Stack: not Hedgehog's to choose
72
+
73
+ This repo's language, package manager, and tooling are whatever they
74
+ already were before adoption. Hedgehog never proposes converting them
75
+ toward a Golden Core's stack — not even as a suggestion. Every `verify`
76
+ command in `.hedgehog/core.yaml` is one of this repo's own commands.
77
+
78
+ ### Layout
79
+
80
+ ```text
81
+ .hedgehog/
82
+ hedgehog.db the build graph — intents, compiled tasks, verifications, committed to git
83
+ core.yaml the change-order layer chain, scope, verification, commit messages — locked
84
+ adoption.md the rationale behind core.yaml, this repo's own commands, and a dated repo-shape snapshot — locked except that snapshot
85
+ ```
86
+
87
+ ### Core rules
88
+
89
+ - **Change-scoped only.** No task ever describes pre-existing code as
90
+ work to do. A file with no artifact record was never built by
91
+ Hedgehog — `hedgehog why` says so plainly rather than erroring.
92
+ - **One layer, one commit**, in the exact message `.hedgehog/core.yaml`
93
+ names for that layer.
94
+ - **Scope is the boundary**, more load-bearing here than on a greenfield
95
+ core: on an unfamiliar codebase, blast radius is the primary risk, and
96
+ scope enforcement is the only mechanism that bounds it.
97
+ - **The layer's own `verify` command — this repo's own command — gates
98
+ every commit.** Never weaken it to clear a gate.
99
+ - **No global Stop Condition.** Adoption has no terminal state: it is the
100
+ permanent way change lands on this repo from here on, not a project
101
+ that finishes. "Done" is per-change (`hedgehog boundary` on the current
102
+ intent), never whole-graph.
103
+ - **Fix wrong layers at the source** via the Correction Protocol — never
104
+ a downstream workaround.
105
+ - **The layer chain itself is locked.** A layer in the wrong place or a
106
+ missing seam is a `hedgehog-adopt` re-run (adding a layer, never
107
+ reshaping history), not a quiet edit to `core.yaml`.
@@ -63,6 +63,14 @@ context loses nothing: the architecture is known a priori, and the
63
63
  project's specifics are re-read on demand. Use that (see **Managing
64
64
  context** below).
65
65
 
66
+ **Use only the skills and agents this repo provides**, including its
67
+ vendored BMAD shelf — never a general-purpose build-tool skill pack
68
+ (e.g. "superpowers") or another project's agent set. Hedgehog's
69
+ enforcement (scope boundaries, no self-certification, the commit-gated
70
+ loop) is what a generic skill pack has no notion of, and running one
71
+ alongside Hedgehog's own skills produces work that bypasses the very
72
+ discipline this file describes.
73
+
66
74
  {{CORE_SECTION}}
67
75
 
68
76
  ## Consuming the graph
@@ -119,8 +127,9 @@ state.
119
127
  below — it checks nothing-in-flight, a clean tree, and a closed intent
120
128
  together), the build session is complete. The permanent record is the committed
121
129
  intents (`.hedgehog/intents/*.json`), the friction log
122
- (`.hedgehog/friction/*.md`), `core.yaml`, and the git commit history
123
- itself not the database. `.hedgehog/hedgehog.db` is gitignored: a
130
+ (`.hedgehog/friction/*.md`), the core definition (root `core.yaml` for a
131
+ shipped core, `.hedgehog/core.yaml` for an authored one), and the git
132
+ commit history itself — not the database. `.hedgehog/hedgehog.db` is gitignored: a
124
133
  derived index, rebuildable at any time via `hedgehog db rebuild`, which
125
134
  replays those committed sources against git history. That rebuild also
126
135
  runs automatically on a fresh clone when the DB is missing but