specdacular 0.8.1 → 0.9.2

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
@@ -25,8 +25,10 @@ npx specdacular
25
25
  - [Utilities](#utilities)
26
26
  - [The Flow in Detail](#the-flow-in-detail)
27
27
  - [How It Works](#how-it-works)
28
+ - [The Brain](#the-brain)
29
+ - [Pipeline Configuration](#pipeline-configuration)
30
+ - [Hooks](#hooks)
28
31
  - [Parallel Agents](#parallel-agents)
29
- - [Task Flow](#task-flow)
30
32
  - [Multi-Project Support](#multi-project-support)
31
33
  - [Project Structure](#project-structure)
32
34
  - [Philosophy](#philosophy)
@@ -64,7 +66,7 @@ Three commands drive the entire task lifecycle:
64
66
 
65
67
  `continue` reads your task's current state and offers the natural next step. You never need to remember which command comes next.
66
68
 
67
- `toolbox` gives you direct access to advanced operations — discuss, research, plan, execute, review — when you want to jump to a specific action outside the normal flow.
69
+ `toolbox` gives you direct access to advanced operations — discuss, research, plan, execute, review — and codebase context management (status dashboard, section-by-section review with edit/re-map/add).
68
70
 
69
71
  Works with single projects and multi-project setups (monorepos, multi-repo). In multi-project mode, features are discussed at the system level and routed to the relevant sub-projects, with cross-project dependency tracking and contract validation.
70
72
 
@@ -127,8 +129,8 @@ That's it. `continue` reads the current state and guides you through each stage:
127
129
 
128
130
  1. **Discussion** — Probes gray areas until clear
129
131
  2. **Research** — Spawns parallel agents for patterns/pitfalls
130
- 3. **Planning** — Creates roadmap with phases, one PLAN.md per phase
131
- 4. **Phase execution** — Implements with progress tracking
132
+ 3. **Planning** — Creates roadmap with phase goals
133
+ 4. **Phase execution** — Plans each phase just-in-time, then implements with progress tracking
132
134
  5. **Phase review** — Code review agent compares plans against actual code
133
135
 
134
136
  After each step, you can continue or stop. Resume anytime with `/specd:continue`.
@@ -136,8 +138,8 @@ After each step, you can continue or stop. Resume anytime with `/specd:continue`
136
138
  **Execution modes:**
137
139
 
138
140
  ```
139
- /specd:continue user-dashboard # Interactive (default) pause after each step
140
- /specd:continue user-dashboard --semi-auto # Auto through planning, pause after review
141
+ /specd:continue user-dashboard # Defaultauto-runs, pauses at phase steps
142
+ /specd:continue user-dashboard --interactive # Prompt at every step with skip/jump options
141
143
  /specd:continue user-dashboard --auto # Run everything, stop only on review issues
142
144
  ```
143
145
 
@@ -155,7 +157,7 @@ Scans for in-progress tasks and shows a picker.
155
157
  /specd:toolbox user-dashboard
156
158
  ```
157
159
 
158
- Opens a menu with: Discuss, Research, Plan, Execute, Review. Useful when you want to jump to a specific action outside the normal flow.
160
+ Opens a menu with task operations (Discuss, Research, Plan, Execute, Review) and context management (Status, Review). Useful when you want to jump to a specific action outside the normal flow.
159
161
 
160
162
  ---
161
163
 
@@ -166,14 +168,15 @@ Opens a menu with: Discuss, Research, Plan, Execute, Review. Useful when you wan
166
168
  | Command | Description |
167
169
  |---------|-------------|
168
170
  | `/specd:new [name]` | Initialize a task, start first discussion |
169
- | `/specd:continue [name] [--semi-auto\|--auto]` | **Drive the entire lifecycle** — picks up where you left off |
170
- | `/specd:toolbox [name]` | Advanced operations: discuss, research, plan, execute, review |
171
+ | `/specd:continue [name] [--interactive\|--auto]` | **Drive the entire lifecycle** — picks up where you left off |
172
+ | `/specd:toolbox [tasks name\|context]` | Task operations or codebase context management |
171
173
 
172
174
  ### Codebase Documentation
173
175
 
174
176
  | Command | Description |
175
177
  |---------|-------------|
176
178
  | `/specd:map-codebase` | Analyze codebase with parallel agents |
179
+ | `/specd:toolbox context` | Status dashboard or section-by-section review |
177
180
 
178
181
  ### Utilities
179
182
 
@@ -195,26 +198,170 @@ Opens a menu with: Discuss, Research, Plan, Execute, Review. Useful when you wan
195
198
  - `STATE.md` — Progress tracking
196
199
  - `config.json` — Task configuration
197
200
 
198
- **`continue`** is the smart state machine. It reads `config.json` and `STATE.md` to determine where the task is, shows a status summary, and offers the natural next step. After each action it loops back you keep going until you choose to stop. Under the hood it delegates to these stages:
201
+ **`continue`** delegates to the brain a config-driven orchestrator that reads `pipeline.json` and drives the lifecycle. It determines the next step from task state, executes pre-hooks step workflow post-hooks, updates state, and loops. The default pipeline stages:
199
202
 
200
203
  - **Discussion** — Probes gray areas, records decisions. Context accumulates across sessions.
201
204
  - **Research** — Spawns 3 parallel agents: codebase integration, external patterns, and pitfalls. Output: `RESEARCH.md`.
202
- - **Planning** — Creates `ROADMAP.md` with phases derived from dependency analysis, plus one `phases/phase-NN/PLAN.md` per phase. Plans are self-contained prompts for an implementing agent.
203
- - **Phase execution** — Implements plans with verification after each task, commits per task, and progress tracking in `STATE.md`.
204
- - **Phase review** — Code review agent inspects executed code against plan intent using semantic analysis and git diff. Generates fix plans (decimal phases like `phase-01.1`) if needed.
205
+ - **Planning** — Creates `ROADMAP.md` with phases derived from dependency analysis. Phase goals only no detailed PLAN.md files yet.
206
+ - **Phase execution** — Nested sub-pipeline that loops per phase: plan → execute → review → revise. Each phase gets just-in-time planning (detailed PLAN.md from ROADMAP.md goal), then implementation with verification, commits per task, and progress tracking. Later phases can adapt based on earlier execution.
207
+ - **Phase review** — Code review agent inspects executed code against plan intent. Generates fix plans (decimal phases like `phase-01.1`) if needed.
208
+ - **Revise** — Collects feedback from review, creates fix plans, signals brain to re-execute.
205
209
 
206
- **`toolbox`** provides direct access to advanced operations outside the normal flow:
210
+ **`toolbox`** provides direct access to advanced operations outside the normal flow. Two subdomains:
207
211
 
212
+ **Tasks** (`/specd:toolbox tasks my-feature`):
208
213
  - **Discuss** — Explore open questions, record decisions
209
214
  - **Research** — Spawn parallel agents for patterns/pitfalls
210
215
  - **Plan** — Create execution phases from task context
211
216
  - **Execute** — Execute the next phase's plan
212
217
  - **Review** — Review executed phase, approve or request fixes
213
218
 
219
+ **Context** (`/specd:toolbox context`):
220
+ - **Status** — Dashboard showing all context files with freshness indicators
221
+ - **Review** — Section-by-section review of any context file: confirm, edit, remove, re-map (spawns a mapper agent to regenerate a section), or add new content. Sections are tracked with `AUTO_GENERATED` and `USER_MODIFIED` tags with dates.
222
+
214
223
  ---
215
224
 
216
225
  ## How It Works
217
226
 
227
+ ### The Brain
228
+
229
+ The brain (`brain.md`) is a config-driven orchestrator that reads `pipeline.json` and drives the entire task lifecycle. Step workflows are pure execution — they do their work and return. The brain decides what comes next.
230
+
231
+ ```
232
+ ┌─────────────────────┐
233
+ │ BRAIN │
234
+ │ (config-driven │
235
+ │ orchestrator) │
236
+ └────────┬────────────┘
237
+
238
+ ┌────────────┼────────────┐
239
+ ▼ ▼ ▼
240
+ Read State Load Pipeline Check Mode
241
+ │ │ │
242
+ └────────────┼────────────┘
243
+
244
+
245
+ ┌─────────────────────────┐
246
+ │ Main Pipeline │
247
+ │ │
248
+ │ discuss → research → │
249
+ │ plan → phase-execution │
250
+ └────────────┬────────────┘
251
+
252
+ ┌───────┴───────┐
253
+ ▼ │
254
+ ┌─────────────────────┐ │
255
+ │ Phase-Execution │ │
256
+ │ Sub-Pipeline │ │
257
+ │ │ │
258
+ │ plan → execute → │ │
259
+ │ review → revise │ │
260
+ │ ──loop──┘ │ │
261
+ │ │ │
262
+ │ Per phase, repeats │ │
263
+ │ until all phases │ │
264
+ │ complete │ │
265
+ └─────────────────────┘ │
266
+ │ │
267
+ └───────────────┘
268
+
269
+
270
+ TASK COMPLETE
271
+ ```
272
+
273
+ **The brain loop:**
274
+ 1. Read current state (`config.json`, `STATE.md`)
275
+ 2. Determine next step from pipeline config
276
+ 3. Execute pre-hooks → step workflow → post-hooks
277
+ 4. Update state → loop back
278
+
279
+ **Execution modes:**
280
+
281
+ | Mode | Behavior |
282
+ |------|----------|
283
+ | **Default** | Auto-runs steps, pauses where `pause: true`. Smart-skips unnecessary steps. |
284
+ | **Interactive** (`--interactive`) | Prompts at each stage transition with skip/jump options |
285
+ | **Auto** (`--auto`) | Runs everything, only stops on errors or task completion |
286
+
287
+ ### Pipeline Configuration
288
+
289
+ The pipeline is defined in `pipeline.json` — nothing is hardcoded. The default pipeline ships with Specdacular and can be fully replaced by placing a `.specd/pipeline.json` in your project (full replace, not merge).
290
+
291
+ **Default pipeline structure:**
292
+
293
+ ```json
294
+ {
295
+ "schema_version": "1.0",
296
+ "pipelines": {
297
+ "main": [
298
+ { "name": "discuss", "workflow": "discuss.md" },
299
+ { "name": "research", "workflow": "research.md" },
300
+ { "name": "plan", "workflow": "plan.md" },
301
+ { "name": "phase-execution", "pipeline": "phase-execution" }
302
+ ],
303
+ "phase-execution": [
304
+ { "name": "plan", "workflow": "phase-plan.md" },
305
+ { "name": "execute", "workflow": "execute.md", "pause": true },
306
+ { "name": "review", "workflow": "review.md", "pause": true },
307
+ { "name": "revise", "workflow": "revise.md", "pause": true }
308
+ ]
309
+ },
310
+ "hooks": { "pre-step": null, "post-step": null }
311
+ }
312
+ ```
313
+
314
+ **Customization options:**
315
+ - **Swap workflows:** Point any step's `workflow` to your own `.md` file
316
+ - **Add hooks:** Configure pre/post hooks per step or globally
317
+ - **Full replace:** Drop `.specd/pipeline.json` to replace the entire pipeline
318
+
319
+ ### Hooks
320
+
321
+ Hooks are markdown workflow files (`.md`) that run before and after pipeline steps. They can read and modify task files just like any other workflow.
322
+
323
+ ```
324
+ Global pre-step hook
325
+
326
+
327
+ Step pre-hook
328
+
329
+
330
+ ┌─────────────┐
331
+ │ Step runs │
332
+ │ (discuss, │
333
+ │ execute, │
334
+ │ etc.) │
335
+ └──────┬──────┘
336
+
337
+
338
+ Step post-hook
339
+
340
+
341
+ Global post-step hook
342
+ ```
343
+
344
+ **Configuration in pipeline.json:**
345
+
346
+ ```json
347
+ {
348
+ "name": "execute",
349
+ "workflow": "execute.md",
350
+ "hooks": {
351
+ "pre": { "workflow": ".specd/hooks/pre-execute.md", "mode": "inline", "optional": false },
352
+ "post": { "workflow": ".specd/hooks/post-execute.md", "mode": "subagent", "optional": true }
353
+ }
354
+ }
355
+ ```
356
+
357
+ **Hook modes:**
358
+ - **`inline`** — Runs in the brain's context (can see all state)
359
+ - **`subagent`** — Spawns a separate agent (fresh context, isolated)
360
+
361
+ **Convention fallback:** If no hooks are configured explicitly, the brain checks for `.specd/hooks/pre-{step}.md` and `.specd/hooks/post-{step}.md` automatically.
362
+
363
+ **Error handling:** Required hooks (`optional: false`) stop the pipeline on failure. Optional hooks log a warning and continue.
364
+
218
365
  ### Parallel Agents
219
366
 
220
367
  Specdacular spawns specialized agents that run simultaneously:
@@ -240,46 +387,6 @@ Specdacular spawns specialized agents that run simultaneously:
240
387
  - Faster execution (parallel, not sequential)
241
388
  - Agents write directly to files
242
389
 
243
- ### Task Flow
244
-
245
- ```
246
- /specd:new /specd:continue
247
- │ │
248
- ▼ ▼
249
- Create task ┌─── Read state ◀──────────────┐
250
- First discussion │ Show status │
251
- Offer to continue │ Offer next step │
252
- │ │ │ │
253
- ▼ │ ▼ │
254
- "Keep discussing?" │ ┌──────────────┐ │
255
- Yes → discuss loop │ │ Execute the │ │
256
- No → continue │ │ next action │ │
257
- │ └──────────────┘ │
258
- │ │ │
259
- │ ┌────┴────┐ │
260
- │ │ Discuss │ Research │
261
- │ │ Plan │ Execute │
262
- │ │ Review │ │
263
- │ └────┬────┘ │
264
- │ │ │
265
- │ ▼ │
266
- │ "Continue or stop?" │
267
- │ Continue ──────────────────┘
268
- │ Stop → clean exit
269
-
270
- └─── No tasks? → /specd:new
271
- ```
272
-
273
- **Under the hood,** `continue` delegates to specialized workflows:
274
-
275
- ```
276
- discussion → discuss workflow
277
- research → research workflow (3 parallel agents)
278
- planning → plan workflow
279
- execution → execute workflow
280
- review → review workflow (code review agent)
281
- ```
282
-
283
390
  ---
284
391
 
285
392
  ## Multi-Project Support
@@ -329,6 +436,11 @@ Planning creates per-project roadmaps plus a cross-project dependency graph (`DE
329
436
  ```
330
437
  your-project/
331
438
  ├── .specd/
439
+ │ ├── pipeline.json # Optional — custom pipeline (full replace)
440
+ │ ├── hooks/ # Optional — convention-based hooks
441
+ │ │ ├── pre-execute.md
442
+ │ │ └── post-review.md
443
+ │ │
332
444
  │ ├── codebase/ # From /specd:map-codebase
333
445
  │ │ ├── MAP.md
334
446
  │ │ ├── PATTERNS.md
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specd:continue
3
3
  description: Continue task lifecycle — picks up where you left off
4
- argument-hint: "[task-name] [--semi-auto|--auto]"
4
+ argument-hint: "[task-name] [--interactive|--auto]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -14,22 +14,24 @@ allowed-tools:
14
14
  ---
15
15
 
16
16
  <objective>
17
- Smart state machine that reads current task state and drives the entire lifecycle. One command from discussion through execution and review.
17
+ Config-driven orchestrator that reads pipeline.json and drives the entire task lifecycle. One command from discussion through execution and review.
18
18
 
19
19
  **Modes:**
20
- - **Default (interactive):** Prompts at each stage transition
21
- - **--semi-auto:** Auto-runs discuss→research→plan, pauses after each phase execution + review
22
- - **--auto:** Runs everything, only stops on review issues or task completion
20
+ - **Default:** Auto-runs steps, pauses where `pause: true`. Smart-skips unnecessary steps.
21
+ - **--interactive:** Prompts at every stage transition with skip/jump options
22
+ - **--auto:** Runs everything, only stops on errors or task completion
23
23
 
24
24
  **How it works:**
25
25
  1. Select task (from argument or picker)
26
- 2. Read current state
27
- 3. Determine natural next step
28
- 4. Execute it (delegating to workflows)
29
- 5. Loop back offer the next step or stop
26
+ 2. Load pipeline.json (user override or default)
27
+ 3. Read current state → determine next step
28
+ 4. Execute pre-hooks step → post-hooks
29
+ 5. Update state loop back or stop
30
30
 
31
- **Covers the full lifecycle:**
32
- - Discussion Research Planning Execution → Review → Next phase
31
+ **Pipeline customization:**
32
+ - Place `.specd/pipeline.json` to fully replace the default pipeline
33
+ - Swap any step's workflow to a custom `.md` file
34
+ - Add pre/post hooks (markdown workflow files)
33
35
  </objective>
34
36
 
35
37
  <execution_context>
@@ -39,21 +41,27 @@ Smart state machine that reads current task state and drives the entire lifecycl
39
41
  <context>
40
42
  Task name and flags: $ARGUMENTS
41
43
 
44
+ **Pipeline config:**
45
+ @.specd/pipeline.json (user override, if exists)
46
+ @~/.claude/specdacular/pipeline.json (default)
47
+
42
48
  **Scans for tasks:**
43
49
  @.specd/tasks/*/config.json
44
50
 
45
- **Delegates to workflows:**
51
+ **Delegates to brain which dispatches:**
46
52
  @~/.claude/specdacular/workflows/discuss.md
47
53
  @~/.claude/specdacular/workflows/research.md
48
54
  @~/.claude/specdacular/workflows/plan.md
49
55
  @~/.claude/specdacular/workflows/execute.md
50
56
  @~/.claude/specdacular/workflows/review.md
57
+ @~/.claude/specdacular/workflows/revise.md
51
58
  </context>
52
59
 
53
60
  <success_criteria>
54
61
  - [ ] Task selected (from argument or picker)
62
+ - [ ] Pipeline loaded and validated
55
63
  - [ ] Current state accurately assessed
56
- - [ ] Correct next action offered/executed
57
- - [ ] Mode flags (--semi-auto, --auto) respected
64
+ - [ ] Correct next step dispatched with hooks
65
+ - [ ] Mode flags (--interactive, --auto) respected
58
66
  - [ ] User can stop at any natural boundary
59
67
  </success_criteria>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specd:toolbox
3
- description: "Advanced task operations discuss, research, plan, execute, review"
4
- argument-hint: "[task-name]"
3
+ description: "Advanced task operations and context management"
4
+ argument-hint: "[tasks <task-name>|context]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -16,18 +16,35 @@ allowed-tools:
16
16
  ---
17
17
 
18
18
  <objective>
19
- Menu of advanced task operations. Presents options and dispatches to the appropriate workflow.
20
-
21
- **Operations:**
22
- - **Discuss** — Explore open questions, record decisions
23
- - **Research** — Spawn parallel research agents
24
- - **Plan** — Create execution phases from task context
25
- - **Execute** — Execute the next phase's plan
26
- - **Review** — Review executed phase, approve or request fixes
19
+ Toolbox with two subdomains:
20
+
21
+ 1. **tasks** — Task lifecycle operations (requires task name): discuss, research, plan, execute, review
22
+ 2. **context** — Codebase context management (no task name): review, add
27
23
  </objective>
28
24
 
29
25
  <execution_context>
30
- First, select the task using:
26
+ **Parse $ARGUMENTS to determine subdomain:**
27
+
28
+ - If starts with "tasks" → extract remaining words as task name, go to Tasks flow
29
+ - If starts with "context" → go to Context flow
30
+ - If a bare word that matches a directory in `.specd/tasks/` or `.specd/features/` → treat as `tasks {name}`
31
+ - If empty or unrecognized → ask user which subdomain
32
+
33
+ **If subdomain unclear, ask:**
34
+ Use AskUserQuestion:
35
+ - header: "Toolbox"
36
+ - question: "Which toolbox?"
37
+ - options:
38
+ - "Tasks" — Discuss, research, plan, execute, or review a task
39
+ - "Context" — Review or add to codebase context
40
+
41
+ ---
42
+
43
+ ## Tasks Flow
44
+
45
+ Requires a task name. If not provided after "tasks", check `.specd/tasks/` for available tasks. If only one task exists, use it automatically. If multiple, ask.
46
+
47
+ Validate using:
31
48
  @~/.claude/specdacular/references/validate-task.md
32
49
 
33
50
  Then present the menu using AskUserQuestion:
@@ -46,14 +63,41 @@ Based on selection, delegate to the appropriate workflow:
46
63
  - Plan → @~/.claude/specdacular/workflows/plan.md
47
64
  - Execute → @~/.claude/specdacular/workflows/execute.md
48
65
  - Review → @~/.claude/specdacular/workflows/review.md
66
+
67
+ ---
68
+
69
+ ## Context Flow
70
+
71
+ No task name needed. Present the menu using AskUserQuestion:
72
+ - header: "Context"
73
+ - question: "What would you like to do with codebase context?"
74
+ - options:
75
+ - "Review" — Walk through and review a context file section by section
76
+ - "Add" — Add new content to a context file
77
+
78
+ Based on selection, delegate to the appropriate workflow:
79
+ - Review → follow the context-manual-review.md workflow
80
+ - Add → follow the context-add.md workflow
49
81
  </execution_context>
50
82
 
51
83
  <context>
52
- Task name: $ARGUMENTS
84
+ Arguments: $ARGUMENTS
85
+
86
+ **Task workflows:**
87
+ @~/.claude/specdacular/workflows/discuss.md
88
+ @~/.claude/specdacular/workflows/research.md
89
+ @~/.claude/specdacular/workflows/plan.md
90
+ @~/.claude/specdacular/workflows/execute.md
91
+ @~/.claude/specdacular/workflows/review.md
92
+
93
+ **Context workflows:**
94
+ @~/.claude/specdacular/workflows/context-manual-review.md
95
+ @~/.claude/specdacular/workflows/context-add.md
53
96
  </context>
54
97
 
55
98
  <success_criteria>
56
- - [ ] Task selected (from argument or picker)
57
- - [ ] Menu presented with operations
99
+ - [ ] Subdomain selected (tasks or context) — from argument or prompt
100
+ - [ ] For tasks: task validated and operation menu shown
101
+ - [ ] For context: context operation menu shown
58
102
  - [ ] Selected operation executed via correct workflow
59
103
  </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdacular",
3
- "version": "0.8.1",
3
+ "version": "0.9.2",
4
4
  "description": "Feature planning system for existing codebases. Map, understand, and plan features in large projects.",
5
5
  "bin": {
6
6
  "specdacular": "bin/install.js"
@@ -9,9 +9,9 @@
9
9
  | Command | Description |
10
10
  |---------|-------------|
11
11
  | `/specd:new [name]` | Initialize a task, start first discussion |
12
- | `/specd:continue [name] [--semi-auto\|--auto]` | Continue task lifecycle — picks up where you left off |
12
+ | `/specd:continue [name] [--interactive\|--auto]` | Continue task lifecycle — picks up where you left off |
13
13
 
14
- | `/specd:toolbox [name]` | Advanced operations: discuss, research, plan, execute, review |
14
+ | `/specd:toolbox [tasks <name>\|context]` | Task operations or context management |
15
15
 
16
16
  ### Utilities
17
17
 
@@ -38,13 +38,12 @@
38
38
  - Discussion → Research → Planning → Phase Execution → Review
39
39
  - After each step, offers the next step or "stop for now"
40
40
  - Works across context windows — reads state fresh each time
41
- - Modes: interactive (default), `--semi-auto` (auto through planning, pause after review), `--auto` (run everything)
42
- 3. **`/specd:toolbox [name]`** — Advanced operations menu:
43
- - **Discuss** Explore open questions, record decisions
44
- - **Research** Spawn parallel agents for patterns/pitfalls
45
- - **Plan**Create execution phases
46
- - **Execute** Execute the next phase
47
- - **Review** — Review executed phase, approve or request fixes
41
+ - Modes: default (auto-runs, pauses at phase steps), `--interactive` (prompt at each step), `--auto` (run everything)
42
+ 3. **`/specd:toolbox`** — Two subdomains:
43
+ - **`/specd:toolbox tasks <name>`** Task operations:
44
+ - Discuss, Research, Plan, Execute, Review
45
+ - **`/specd:toolbox context`** Context management:
46
+ - Status, Review, Add
48
47
 
49
48
  ### Quick Start
50
49
 
@@ -57,6 +56,68 @@ After initialization, just keep running `continue`. It figures out what's next.
57
56
 
58
57
  ---
59
58
 
59
+ ## The Brain
60
+
61
+ The `continue` command is powered by the **brain** — a config-driven orchestrator that reads `pipeline.json` and drives the entire task lifecycle. Step workflows are pure execution; the brain decides what comes next.
62
+
63
+ **The brain loop:**
64
+ 1. Read current state (`config.json`, `STATE.md`)
65
+ 2. Determine next step from pipeline config
66
+ 3. Execute pre-hooks → step workflow → post-hooks
67
+ 4. Update state → loop back
68
+
69
+ **Execution modes:**
70
+
71
+ | Mode | Behavior |
72
+ |------|----------|
73
+ | **Default** | Auto-runs steps, pauses where `pause: true`. Smart-skips unnecessary steps. |
74
+ | **Interactive** (`--interactive`) | Prompts at each stage transition with skip/jump options |
75
+ | **Auto** (`--auto`) | Runs everything, only stops on errors or task completion |
76
+
77
+ ---
78
+
79
+ ## Pipeline Configuration
80
+
81
+ The pipeline is defined in `pipeline.json` — nothing is hardcoded. The default pipeline ships with Specdacular and can be fully replaced by placing a `.specd/pipeline.json` in your project.
82
+
83
+ **Default pipeline:** `discuss → research → plan → phase-execution (execute → review → revise loop)`
84
+
85
+ **Customization options:**
86
+ - **Swap workflows:** Point any step's `workflow` to your own `.md` file
87
+ - **Add hooks:** Configure pre/post hooks per step or globally
88
+ - **Full replace:** Drop `.specd/pipeline.json` to replace the entire pipeline
89
+
90
+ ---
91
+
92
+ ## Hooks
93
+
94
+ Hooks are markdown workflow files that run before and after pipeline steps. They can read and modify task files just like any other workflow.
95
+
96
+ **Execution order:** Global pre-step → Step pre-hook → **Step runs** → Step post-hook → Global post-step
97
+
98
+ **Configuration in pipeline.json:**
99
+
100
+ ```json
101
+ {
102
+ "name": "execute",
103
+ "workflow": "execute.md",
104
+ "hooks": {
105
+ "pre": { "workflow": ".specd/hooks/pre-execute.md", "mode": "inline" },
106
+ "post": { "workflow": ".specd/hooks/post-execute.md", "mode": "subagent", "optional": true }
107
+ }
108
+ }
109
+ ```
110
+
111
+ **Hook modes:**
112
+ - **`inline`** — Runs in the brain's context (can see all state)
113
+ - **`subagent`** — Spawns a separate agent (fresh context, isolated)
114
+
115
+ **Convention fallback:** If no hooks are configured, the brain auto-discovers `.specd/hooks/pre-{step}.md` and `.specd/hooks/post-{step}.md`.
116
+
117
+ **Error handling:** Required hooks (`optional: false`, default) stop the pipeline on failure. Optional hooks log a warning and continue.
118
+
119
+ ---
120
+
60
121
  ## Codebase Documentation
61
122
 
62
123
  ```