claude-cook 1.10.8 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/agents/cook-pm.md +135 -59
  2. package/commands/cook/help.md +110 -417
  3. package/commands/cook/pm-start.md +73 -120
  4. package/cook/workflows/pm-check.md +9 -8
  5. package/cook/workflows/pm-cycle.md +87 -21
  6. package/package.json +1 -1
  7. package/scripts/pm-loop.sh +30 -10
  8. package/agents/cook-debugger.md +0 -1203
  9. package/agents/cook-executor.md +0 -784
  10. package/agents/cook-integration-checker.md +0 -423
  11. package/agents/cook-phase-researcher.md +0 -641
  12. package/agents/cook-verifier.md +0 -778
  13. package/commands/cook/add-todo.md +0 -193
  14. package/commands/cook/audit-milestone.md +0 -277
  15. package/commands/cook/check-todos.md +0 -228
  16. package/commands/cook/debug.md +0 -169
  17. package/commands/cook/discuss-phase.md +0 -86
  18. package/commands/cook/execute-phase.md +0 -339
  19. package/commands/cook/list-phase-assumptions.md +0 -50
  20. package/commands/cook/pause-work.md +0 -134
  21. package/commands/cook/plan-milestone-gaps.md +0 -295
  22. package/commands/cook/quick.md +0 -309
  23. package/commands/cook/research-phase.md +0 -200
  24. package/commands/cook/resume-work.md +0 -40
  25. package/commands/cook/verify-work.md +0 -219
  26. package/cook/references/checkpoints.md +0 -1078
  27. package/cook/references/tdd.md +0 -263
  28. package/cook/references/verification-patterns.md +0 -612
  29. package/cook/templates/DEBUG.md +0 -159
  30. package/cook/templates/UAT.md +0 -247
  31. package/cook/templates/debug-subagent-prompt.md +0 -91
  32. package/cook/templates/verification-report.md +0 -322
  33. package/cook/workflows/diagnose-issues.md +0 -231
  34. package/cook/workflows/discuss-phase.md +0 -433
  35. package/cook/workflows/execute-phase.md +0 -671
  36. package/cook/workflows/execute-plan.md +0 -1844
  37. package/cook/workflows/list-phase-assumptions.md +0 -178
  38. package/cook/workflows/verify-phase.md +0 -628
  39. package/cook/workflows/verify-work.md +0 -596
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: cook:pm-start
3
- description: Start fully autonomous PM — plans, syncs, dispatches, monitors, and advances phases automatically
4
- argument-hint: "<phase> [--manual] [--background] [--executor=CLAUDE_CODE] [--skip-plan] [--max-iterations=0] [--max-replans=3] [--calls=0]"
3
+ description: Start fully autonomous PM — runs the entire lifecycle from init to milestone completion
4
+ argument-hint: "[phase] [--init] [--prd=<file>] [--manual] [--background] [--executor=CLAUDE_CODE] [--skip-plan] [--max-iterations=0] [--max-replans=3] [--calls=0]"
5
5
  agent: cook-pm
6
6
  allowed-tools:
7
7
  - Read
@@ -18,29 +18,34 @@ allowed-tools:
18
18
  <execution_context>
19
19
  @~/.claude/cook/references/ui-brand.md
20
20
  @~/.claude/cook/references/vibe-kanban.md
21
+ @~/.claude/cook/workflows/pm-cycle.md
21
22
  @~/.claude/cook/workflows/pm-sync.md
22
23
  @~/.claude/cook/workflows/pm-dispatch.md
23
24
  @~/.claude/agents/cook-pm.md
24
25
  </execution_context>
25
26
 
26
27
  <objective>
27
- Start the fully autonomous PM agent. Validates environment, sets up VK connection, and launches `pm-loop.sh` the Ralph-style infinite loop that handles the ENTIRE lifecycle:
28
+ Start the fully autonomous PM agent. Auto-detects the current project state and picks up from the right point in the lifecycle:
28
29
 
29
- **plan → sync tickets → dispatch workers → monitor → replan on failure → advance phases → complete milestone**
30
+ ```
31
+ NEEDS_INIT → NEEDS_RESEARCH → NEEDS_ROADMAP → NEEDS_PLANNING → NEEDS_SYNC → NEEDS_DISPATCH → MONITORING → NEEDS_REVIEW → PHASE_COMPLETE → ... → MILESTONE_COMPLETE
32
+ ```
30
33
 
31
- After this command, the PM runs unattended. Each loop cycle is a fresh Claude invocation via `/cook:pm-cycle` no context rot.
34
+ The PM runs the **entire lifecycle** unattended from project init through research, planning, ticket creation, worker dispatch, code review (via VK review agent), phase advancement, and milestone completion.
32
35
 
33
- Use `--manual` to skip the loop and manage phases manually with `/cook:pm-cycle`.
36
+ Each loop cycle is a fresh Claude invocation via `/cook:pm-cycle` — no context rot.
34
37
  </objective>
35
38
 
36
39
  <context>
37
- Phase number: $ARGUMENTS (requiredstarting phase)
40
+ Phase number: $ARGUMENTS (optionalauto-detected if omitted)
38
41
 
39
42
  **Flags:**
43
+ - `--init` — Start from scratch, create .planning/ and PROJECT.md
44
+ - `--prd=<file>` — Provide a PRD file for project initialization
40
45
  - `--manual` — Don't launch the loop, manage manually with `/cook:pm-cycle`
41
46
  - `--background` — Run loop detached (default: background when autonomous)
42
47
  - `--executor=X` — Override default executor (CLAUDE_CODE, CURSOR_AGENT, CODEX, etc.)
43
- - `--skip-plan` — Skip initial planning, assume plans already exist
48
+ - `--skip-plan` — Skip planning, assume plans already exist
44
49
  - `--max-iterations=N` — Safety cap on loop cycles (default: 0 = unlimited)
45
50
  - `--max-replans=N` — Auto replan attempts on repeated errors (default: 3)
46
51
  - `--calls=N` — Max Claude calls per hour (default: 0 = unlimited)
@@ -49,23 +54,54 @@ Phase number: $ARGUMENTS (required — starting phase)
49
54
 
50
55
  <process>
51
56
 
52
- ## 1. Validate Environment
57
+ ## 1. Auto-Detect State
58
+
59
+ Classify the current project state to determine where to start:
53
60
 
54
61
  ```bash
55
- test -d .planning && echo "exists" || echo "missing"
62
+ # Check each condition in order
63
+ test -d .planning && echo "planning_exists" || echo "no_planning"
64
+ test -f .planning/PROJECT.md && echo "project_exists" || echo "no_project"
65
+ test -f .planning/research/SUMMARY.md && echo "research_done" || echo "no_research"
66
+ test -f .planning/ROADMAP.md && echo "roadmap_exists" || echo "no_roadmap"
67
+ ```
68
+
69
+ **State detection logic:**
70
+
71
+ | Condition | Detected State | Action |
72
+ |-----------|---------------|--------|
73
+ | No `.planning/` or no `PROJECT.md` | NEEDS_INIT | Scaffold project |
74
+ | No `.planning/research/SUMMARY.md` | NEEDS_RESEARCH | Run research agents |
75
+ | No `ROADMAP.md` | NEEDS_ROADMAP | Create roadmap |
76
+ | Phase has no PLAN.md files | NEEDS_PLANNING | Create plans |
77
+ | Plans exist, no TICKET-MAP | NEEDS_SYNC | Create tickets |
78
+ | TICKET-MAP has todo tickets | NEEDS_DISPATCH | Launch workers |
79
+ | Tickets inprogress/inreview | MONITORING | Poll and react |
80
+ | All tickets done | PHASE_COMPLETE | Advance phase |
81
+
82
+ **Override:** If `--init` flag is set, always start from NEEDS_INIT regardless of current state.
83
+
84
+ Present detected state:
56
85
  ```
86
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
87
+ PM ► STATE DETECTED: {state}
88
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
89
 
58
- If no `.planning/`: Error — run `/cook:new-project` first.
90
+ Starting from: {state description}
91
+ Phase: {N or "new project"}
92
+ ```
59
93
 
60
- Read config:
94
+ ## 2. Setup Config
95
+
96
+ Read or create config:
61
97
  ```bash
62
98
  cat .planning/config.json 2>/dev/null
63
99
  ```
64
100
 
65
- Check for pm section. If missing, initialize it:
101
+ If missing or no pm section, initialize:
66
102
  ```json
67
103
  "pm": {
68
- "mode": "manual",
104
+ "mode": "autonomous",
69
105
  "poll_interval_seconds": 60,
70
106
  "project_id": null,
71
107
  "repos": [],
@@ -77,21 +113,9 @@ Check for pm section. If missing, initialize it:
77
113
  ```
78
114
 
79
115
  Apply flag overrides:
80
- - `--autonomous` → set `pm.mode` to `"autonomous"`
81
116
  - `--manual` → set `pm.mode` to `"manual"`
82
117
  - `--executor=X` → set `pm.default_executor`
83
118
 
84
- Write updated config.json.
85
-
86
- ## 2. Parse Phase Number
87
-
88
- Extract phase number from $ARGUMENTS. Validate it exists in ROADMAP.md.
89
-
90
- Find or create phase directory:
91
- ```bash
92
- ls .planning/phases/ | grep "^{phase_num}"
93
- ```
94
-
95
119
  ## 3. Setup Vibe Kanban Connection
96
120
 
97
121
  If `pm.project_id` is null:
@@ -101,110 +125,39 @@ If `pm.project_id` is null:
101
125
  3. Call `mcp__vibe_kanban__list_repos(project_id)` — get repo details
102
126
  4. Save project_id and repos to config.json
103
127
 
104
- Present:
105
- ```
106
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
107
- PM ► CONNECTED TO VIBE KANBAN
108
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
109
-
110
- Project: {name} ({project_id})
111
- Repos: {repo_list}
112
- Executor: {default_executor}
113
- ```
114
-
115
- ## 4. Plan Phase (unless --skip-plan)
116
-
117
- If plans already exist for this phase AND --skip-plan not specified:
118
- - Ask user: "Plans already exist. Re-plan or use existing?"
119
-
120
- If no plans exist OR user wants to re-plan:
121
- - Follow the same planning pipeline as `/cook:plan-phase`:
122
- 1. Resolve model profile
123
- 2. Optionally run phase researcher
124
- 3. Spawn cook-planner via Task tool
125
- 4. Spawn cook-plan-checker to verify
126
- 5. Iterate planner ↔ checker until plans pass (max 3)
127
-
128
- **Key difference from /cook:plan-phase:** After planning, continue to sync+dispatch instead of stopping.
128
+ ## 4. Execute First Cycle Inline
129
129
 
130
- ## 5. Sync Plans to Agile Tickets
130
+ Run one cycle of the pm-cycle state machine inline (based on detected state from step 1). This ensures the first action happens immediately without waiting for the loop.
131
131
 
132
- Follow the pm-sync workflow create **Agile-style tickets**, not code dumps:
132
+ Follow the action for the detected state as defined in `pm-cycle.md`:
133
+ - NEEDS_INIT → scaffold project
134
+ - NEEDS_RESEARCH → spawn research agents
135
+ - NEEDS_ROADMAP → spawn roadmapper
136
+ - NEEDS_PLANNING → spawn planner + checker
137
+ - NEEDS_SYNC → create tickets
138
+ - NEEDS_DISPATCH → dispatch workers
139
+ - MONITORING → poll and react
133
140
 
134
- 1. Read all PLAN.md files in the phase directory
135
- 2. For each plan, build an Agile ticket:
136
- - Extract: objective, acceptance criteria (must_haves), wave, dependencies
137
- - Build title: `"Phase {X} Plan {Y}: {objective}"`
138
- - Build description: structured Agile ticket (Task, Why, Acceptance Criteria, Dependencies, Scope)
139
- - **No file paths, function names, or code snippets** — tickets describe WHAT to deliver
140
- - `create_task(project_id, title, agile_description)`
141
- 3. Write TICKET-MAP.md with all mappings
142
-
143
- Present:
144
- ```
145
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
146
- PM ► TICKETS SYNCED
147
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
148
-
149
- {N} plans → {N} tickets created
150
-
151
- | Wave | Plan | Ticket | Title |
152
- | ---- | ---- | ------ | ----- |
153
- | ... | ... | ... | ... |
154
- ```
155
-
156
- ## 6. Dispatch Wave 1
157
-
158
- Follow the pm-dispatch workflow:
159
-
160
- 1. Collect all wave 1 tickets from TICKET-MAP
161
- 2. For each:
162
- - `start_workspace_session(task_id, executor, repos)`
163
- - Update TICKET-MAP: status=inprogress, dispatched=now
164
- 3. Log dispatches to PM-LOG.md
165
-
166
- Present:
167
- ```
168
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
169
- PM ► WAVE 1 DISPATCHED
170
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
171
-
172
- {N} workers launched:
173
-
174
- | Ticket | Plan | Executor | Status |
175
- | ------ | ---- | -------- | ------ |
176
- | ... | ... | ... | launched |
177
- ```
178
-
179
- ## 7. Launch PM Loop (default: background in autonomous mode)
141
+ ## 5. Launch PM Loop
180
142
 
181
143
  ### Autonomous Mode (default) — BACKGROUND
182
144
 
183
- Launch pm-loop.sh in the **background** by default in autonomous mode. This avoids blocking the command while keeping the loop running. The loop will automatically trigger `/cook:pm-replan` after repeated failures, up to the configured max.
145
+ Build the pm-loop.sh command with all detected parameters:
184
146
 
185
147
  ```bash
186
- ~/.claude/scripts/pm-loop.sh --phase={X} --interval={poll_interval} --max-iterations={max_iterations} --background
148
+ ~/.claude/scripts/pm-loop.sh \
149
+ --phase={X} \
150
+ --interval={poll_interval} \
151
+ --max-iterations={max_iterations} \
152
+ --background \
153
+ ${prd_flag}
187
154
  ```
188
155
 
189
- Output goes to `.planning/pm-loop.log`. Desktop notifications still work in background mode (macOS/Linux).
156
+ Where `${prd_flag}` is `--prd=<file>` if provided.
190
157
 
191
158
  Stop with: `touch .planning/.pm-stop` | `/cook:pm-stop`
192
159
 
193
- If the user explicitly asks for foreground mode, run without `--background`.
194
-
195
- ### Foreground Mode (explicit)
196
-
197
- If the user explicitly asks for foreground/live output, launch without `--background`:
198
-
199
- ```bash
200
- ~/.claude/scripts/pm-loop.sh --phase={X} --interval={poll_interval} --max-iterations={max_iterations}
201
- ```
202
-
203
- This blocks the terminal and streams live output.
204
-
205
- ### Manual Mode (--manual only)
206
-
207
- Only use manual mode if the user explicitly passes `--manual`. Otherwise always launch the loop.
160
+ ### Manual Mode (--manual)
208
161
 
209
162
  Present:
210
163
  ```
@@ -212,17 +165,17 @@ Present:
212
165
  PM ► MANUAL MODE
213
166
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
214
167
 
215
- Workers dispatched. Run these commands to manage:
168
+ Run these commands to manage:
216
169
 
217
170
  /cook:pm-cycle — Run one full-brain cycle (decides + acts)
218
171
  /cook:pm-status — View dashboard
219
172
  /cook:pm-replan — Modify plans with feedback
220
173
  ```
221
174
 
222
- ## 8. Update STATE.md
175
+ ## 6. Update STATE.md
223
176
 
224
177
  Update STATE.md with PM status:
225
- - Current position: Phase X, PM mode active
178
+ - Current position: Phase X (or "initializing"), PM mode active
226
179
  - Vibe Kanban Status section: project, tickets, last polled
227
180
 
228
181
  </process>
@@ -133,14 +133,15 @@ Run /cook:pm-start {X+1} to begin next phase.
133
133
  ### WORKER_COMPLETED (inprogress → inreview)
134
134
  1. Call `get_task(task_id)` to read worker output/notes
135
135
  2. Update TICKET-MAP.md: status=inreview, review_started=timestamp
136
- 3. Trigger automated code review:
137
- - Spawn `feature-dev:code-reviewer` agent via Task tool
138
- - Provide: ticket title, acceptance criteria from ticket description, recent commits (use `git log --oneline -10` to find relevant commits)
139
- - The reviewer examines the diff and returns a verdict: **PASS** or **FAIL** with issues
140
- 4. Based on review result:
141
- - **PASS:** Update ticket status to `done` via `mcp__vibe_kanban__update_task(task_id, status="done")`. Update TICKET-MAP.md: status=done, completed=timestamp, review=passed. Check if this completes the wave.
142
- - **FAIL:** Update ticket status back to `inprogress` via `mcp__vibe_kanban__update_task(task_id, status="inprogress")`. Update TICKET-MAP.md: status=inprogress, review=failed. Append review feedback as a task note via `mcp__vibe_kanban__update_task(task_id, description=original_description + "\n\n## Review Feedback\n\n" + reviewer_issues)`. Re-dispatch the ticket so the worker can address review feedback.
143
- 5. Log review result to PM-LOG.md
136
+ 3. Delegate review to Vibe Kanban's review agent:
137
+ - Call `mcp__vibe_kanban__start_workspace_session(task_id, executor="REVIEW_AGENT", repos=[...])`
138
+ - This launches VK's review agent on the worker's changes
139
+ - Update TICKET-MAP: review_dispatched=timestamp
140
+ 4. Transition back to MONITORING — PM polls `list_tasks()` to detect review outcomes:
141
+ - VK review agent marks ticket `done` (review passed)
142
+ - VK review agent marks ticket `inprogress` with feedback (review failed, needs fixes)
143
+ - PM reacts to these transitions in subsequent poll cycles
144
+ 5. Log review dispatch to PM-LOG.md
144
145
 
145
146
  ### WORKER_AUTO_COMPLETED (inprogress → done, bypass review)
146
147
  1. Call `get_task(task_id)` to read worker output/notes
@@ -4,16 +4,21 @@
4
4
 
5
5
  This workflow powers `/cook:pm-cycle` — the autonomous PM brain. Each invocation reads all state, classifies the situation, executes one action, updates state, and exits. The shell loop (`pm-loop.sh`) handles repetition.
6
6
 
7
+ The PM runs the **entire project lifecycle** end-to-end: from project initialization through research, roadmapping, planning, ticket creation, worker dispatch, monitoring, code review, phase advancement, and milestone completion — all without stopping.
8
+
7
9
  ## State Classification
8
10
 
9
- Read phase directory and TICKET-MAP.md to classify into exactly one state:
11
+ Read `.planning/` directory and state files to classify into exactly one state:
10
12
 
11
13
  ```
12
- NEEDS_PLANNING → No PLAN.md files
14
+ NEEDS_INIT → No .planning/ directory or no PROJECT.md
15
+ NEEDS_RESEARCH → PROJECT.md exists but no .planning/research/SUMMARY.md
16
+ NEEDS_ROADMAP → Research done but no ROADMAP.md
17
+ NEEDS_PLANNING → Phase has no PLAN.md files
13
18
  NEEDS_SYNC → Plans exist, no TICKET-MAP.md
14
19
  NEEDS_DISPATCH → TICKET-MAP has todo tickets in ready wave
15
20
  MONITORING → Tickets inprogress
16
- NEEDS_REVIEW → Tickets inreview (awaiting code review)
21
+ NEEDS_REVIEW → Tickets inreview (awaiting VK review agent)
17
22
  PHASE_COMPLETE → All tickets done, more phases in roadmap
18
23
  MILESTONE_COMPLETE → All tickets done, last phase in roadmap
19
24
  ```
@@ -21,6 +26,9 @@ MILESTONE_COMPLETE → All tickets done, last phase in roadmap
21
26
  ## State Machine
22
27
 
23
28
  ```
29
+ NEEDS_INIT ──scaffold project──→ NEEDS_RESEARCH
30
+ NEEDS_RESEARCH ──spawn researchers──→ NEEDS_ROADMAP
31
+ NEEDS_ROADMAP ──spawn roadmapper──→ NEEDS_PLANNING
24
32
  NEEDS_PLANNING ──spawn planner──→ NEEDS_SYNC
25
33
  NEEDS_SYNC ──create tickets──→ NEEDS_DISPATCH
26
34
  NEEDS_DISPATCH ──launch workers──→ MONITORING
@@ -29,8 +37,8 @@ MONITORING ──poll + react──→ MONITORING (loop)
29
37
  ──→ NEEDS_DISPATCH (wave complete, next wave ready)
30
38
  ──→ PHASE_COMPLETE (all done)
31
39
  ──→ MONITORING + replan (ticket failed)
32
- NEEDS_REVIEW ──code review──→ MONITORING (review passed → done, check wave)
33
- ──→ MONITORING (review failed → re-dispatch)
40
+ NEEDS_REVIEW ──VK review agent──→ MONITORING (review passed → done, check wave)
41
+ ──→ MONITORING (review failed → re-dispatch)
34
42
  PHASE_COMPLETE ──advance phase──→ NEEDS_PLANNING (next phase)
35
43
  ──→ MILESTONE_COMPLETE (last phase)
36
44
  MILESTONE_COMPLETE ──stop signal──→ EXIT
@@ -38,6 +46,62 @@ MILESTONE_COMPLETE ──stop signal──→ EXIT
38
46
 
39
47
  ## Action Details
40
48
 
49
+ ### NEEDS_INIT
50
+
51
+ **Goal:** Scaffold the project structure so the PM can operate.
52
+
53
+ 1. Check if `.planning/` directory exists. If not, create it.
54
+ 2. Check for PRD or project description:
55
+ - If `--prd <file>` was passed via pm-loop.sh: read that file as the project description
56
+ - If a `PRD.md` or `prd.md` exists in the repo root: use it
57
+ - Otherwise: read any README.md or project files to infer scope
58
+ 3. Create `PROJECT.md` from template (follow @~/.claude/cook/templates/project.md):
59
+ - Fill in: project name, description, goals, tech stack (from existing code or PRD)
60
+ 4. Create `config.json` from template (follow @~/.claude/cook/templates/config.json):
61
+ - Set `pm.project_id` to null (will be discovered during NEEDS_SYNC)
62
+ - Set defaults for model profile, executor, intervals
63
+ 5. Create initial `STATE.md` from template (follow @~/.claude/cook/templates/state.md)
64
+ 6. Log to PM-LOG.md:
65
+ ```markdown
66
+ ## [{timestamp}] INIT
67
+
68
+ - Project scaffolded from {source: PRD/README/description}
69
+ - Created: PROJECT.md, config.json, STATE.md
70
+ - Next: Research phase
71
+ ```
72
+
73
+ ### NEEDS_RESEARCH
74
+
75
+ **Goal:** Gather domain knowledge and technical context before roadmapping.
76
+
77
+ 1. Read PROJECT.md for project scope and goals
78
+ 2. Spawn 4 research agents in parallel via Task tool (run_in_background=true):
79
+ - **cook-project-researcher** (focus: "architecture") — evaluate architecture patterns
80
+ - **cook-project-researcher** (focus: "stack") — evaluate tech stack choices
81
+ - **cook-project-researcher** (focus: "features") — break down feature requirements
82
+ - **cook-project-researcher** (focus: "pitfalls") — identify risks and common pitfalls
83
+ 3. Each researcher writes to `.planning/research/`:
84
+ - `ARCHITECTURE.md`, `STACK.md`, `FEATURES.md`, `PITFALLS.md`
85
+ 4. After all 4 complete, spawn **cook-research-synthesizer**:
86
+ - Reads all 4 research files
87
+ - Writes `.planning/research/SUMMARY.md`
88
+ 5. Update STATE.md: status → "researched"
89
+ 6. Log to PM-LOG.md
90
+
91
+ ### NEEDS_ROADMAP
92
+
93
+ **Goal:** Create a phased roadmap from research findings.
94
+
95
+ 1. Read `.planning/research/SUMMARY.md` for synthesized findings
96
+ 2. Read PROJECT.md for goals and constraints
97
+ 3. Spawn **cook-roadmapper** agent via Task tool:
98
+ - Provide: project context, research summary, milestone goals
99
+ - Agent writes `ROADMAP.md` to `.planning/`
100
+ - Roadmap contains: phases with goals, scope, dependencies, success criteria
101
+ 4. Create phase directories: `.planning/phases/phase-{N}-{slug}/`
102
+ 5. Update STATE.md: current_phase → phase 1, status → "roadmapped"
103
+ 6. Log to PM-LOG.md
104
+
41
105
  ### NEEDS_PLANNING
42
106
 
43
107
  **Goal:** Create PLAN.md files for the current phase.
@@ -109,27 +173,28 @@ Follow `pm-check.md` workflow:
109
173
 
110
174
  ### NEEDS_REVIEW
111
175
 
112
- **Goal:** Run automated code review on tickets that workers have completed.
176
+ **Goal:** Delegate code review to Vibe Kanban's review agent.
177
+
178
+ The PM does **not** run its own code reviewer. Instead, it delegates review to the Vibe Kanban platform's review capabilities:
113
179
 
114
180
  1. Find all tickets with status `inreview` in TICKET-MAP.md
115
181
  2. For each `inreview` ticket:
116
182
  a. Read ticket details via `mcp__vibe_kanban__get_task(task_id)`
117
- b. Spawn `feature-dev:code-reviewer` agent via Task tool:
118
- - Provide: ticket title, acceptance criteria, recent git commits
119
- - Reviewer examines the diff for bugs, security issues, and code quality
120
- c. Based on review verdict:
121
- - **PASS:** Update ticket `done` via `mcp__vibe_kanban__update_task(task_id, status="done")`. Update TICKET-MAP: status=done, review=passed.
122
- - **FAIL:** Update ticket → `inprogress` via `mcp__vibe_kanban__update_task(task_id, status="inprogress")`. Append review feedback to ticket description. Re-dispatch worker to address feedback.
123
- 3. After all reviews processed:
124
- - Check wave completion (all done dispatch next wave or PHASE_COMPLETE)
125
- 4. Log review results to PM-LOG.md:
183
+ b. Dispatch review via Vibe Kanban:
184
+ - Call `mcp__vibe_kanban__start_workspace_session(task_id, executor="REVIEW_AGENT", repos=[...])`
185
+ - This launches VK's review agent on the worker's changes
186
+ c. Update TICKET-MAP: review_dispatched=timestamp
187
+ 3. After dispatching reviews, transition back to MONITORING:
188
+ - PM polls `list_tasks()` to detect review outcomes
189
+ - When VK review agent completes: ticket → `done` (passed) or → `inprogress` (failed with feedback)
190
+ - PM reacts to these transitions in the normal MONITORING flow
191
+ 4. Log review dispatch to PM-LOG.md:
126
192
  ```markdown
127
- ## [{timestamp}] CODE_REVIEW
193
+ ## [{timestamp}] REVIEW_DISPATCH
128
194
 
129
- - Reviewed {N} tickets
130
- - Passed: {list}
131
- - Failed: {list with issue summaries}
132
- - Actions: {re-dispatched / wave advanced / etc.}
195
+ - Dispatched VK review for {N} tickets
196
+ - Tickets: {list}
197
+ - Next: Monitoring for review outcomes
133
198
  ```
134
199
 
135
200
  ### PHASE_COMPLETE
@@ -169,6 +234,7 @@ Every action writes a timestamped entry:
169
234
 
170
235
  - VK API errors: Log error, exit with code 1 (shell loop retries next cycle)
171
236
  - Planner spawn failure: Log error, exit with code 1
237
+ - Research agent failure: Log error, retry next cycle (partial research is ok)
172
238
  - Dispatch failure (single ticket): Skip that ticket, continue with others, log
173
239
  - All dispatches fail: Log error, exit with code 1
174
- - State file missing: Log error, suggest `/cook:pm-start`
240
+ - State file missing: Auto-detect correct state from filesystem and recover
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-cook",
3
- "version": "1.10.8",
3
+ "version": "1.11.0",
4
4
  "description": "A meta-prompting, context engineering and spec-driven development system for Claude Code, OpenCode and Gemini by TÂCHES.",
5
5
  "bin": {
6
6
  "claude-cook": "bin/install.js"
@@ -7,13 +7,14 @@
7
7
  # State persists via .planning/ files.
8
8
  #
9
9
  # The PM brain handles the ENTIRE lifecycle autonomously:
10
- # plan → sync tickets → dispatch workers → monitor → replan → advance phases → complete milestone
10
+ # init → research → roadmap → plan → sync tickets → dispatch workers → monitor → review → advance phases → complete milestone
11
11
  #
12
12
  # RUNS IN FOREGROUND by default — you see live progress.
13
13
  # Use --background to detach (output goes to .planning/pm-loop.log).
14
14
  #
15
15
  # Usage:
16
16
  # ./scripts/pm-loop.sh [--phase=N] [--interval=60] [--max-iterations=50]
17
+ # ./scripts/pm-loop.sh --init --prd=PRD.md # Start from scratch with PRD
17
18
  # PM_PHASE=1 PM_POLL_INTERVAL=30 ./scripts/pm-loop.sh
18
19
  #
19
20
  # Stop:
@@ -32,9 +33,18 @@ MAX_CALLS_PER_HOUR="${PM_MAX_CALLS_PER_HOUR:-0}" # 0 = unlimited
32
33
  MAX_REPLAN_ATTEMPTS="${PM_MAX_REPLAN_ATTEMPTS:-3}"
33
34
  BACKGROUND=false
34
35
  NOTIFY=true
36
+ INIT_MODE=false
37
+ PRD_FILE=""
35
38
 
36
39
  for arg in "$@"; do
37
40
  case $arg in
41
+ --init)
42
+ INIT_MODE=true
43
+ ;;
44
+ --prd=*)
45
+ PRD_FILE="${arg#*=}"
46
+ INIT_MODE=true
47
+ ;;
38
48
  --phase=*)
39
49
  PHASE="${arg#*=}"
40
50
  ;;
@@ -68,15 +78,16 @@ for arg in "$@"; do
68
78
  exit 0
69
79
  ;;
70
80
  --help|-h)
71
- echo "Usage: pm-loop.sh [--phase=N] [--interval=60] [--max-iterations=0] [--calls=0]"
81
+ echo "Usage: pm-loop.sh [--phase=N] [--init] [--prd=FILE] [--interval=60] [--max-iterations=0]"
72
82
  echo ""
73
- echo "Fully autonomous PM loop. Each cycle invokes /cook:pm-cycle which"
74
- echo "reads state and decides what to do: plan, sync, dispatch, monitor,"
75
- echo "replan, advance phases, or complete milestone."
83
+ echo "Fully autonomous PM loop. Runs the ENTIRE project lifecycle:"
84
+ echo "init research roadmap plan sync dispatch monitor → review → advance"
76
85
  echo ""
77
86
  echo "Runs in FOREGROUND by default — you see live progress."
78
87
  echo ""
79
88
  echo "Options:"
89
+ echo " --init Start from scratch (create .planning/)"
90
+ echo " --prd=FILE Provide PRD file for project init (implies --init)"
80
91
  echo " --phase=N Starting phase number (auto-detected if omitted)"
81
92
  echo " --interval=N Seconds between cycles (default: 60)"
82
93
  echo " --max-iterations=N Safety cap on cycles (default: 0 = unlimited)"
@@ -106,12 +117,18 @@ done
106
117
 
107
118
  # ─── Validate ─────────────────────────────────────────────────────
108
119
 
109
- if [ ! -d ".planning" ]; then
120
+ if [ ! -d ".planning" ] && [ "$INIT_MODE" = false ]; then
110
121
  echo "ERROR: No .planning/ directory found."
111
- echo "Run /cook:new-project first, then /cook:pm-start"
122
+ echo "Run with --init to start from scratch, or /cook:new-project first"
112
123
  exit 1
113
124
  fi
114
125
 
126
+ # Create .planning/ if --init and it doesn't exist
127
+ if [ "$INIT_MODE" = true ] && [ ! -d ".planning" ]; then
128
+ mkdir -p .planning
129
+ echo "Created .planning/ directory"
130
+ fi
131
+
115
132
  if ! command -v claude &> /dev/null; then
116
133
  echo "ERROR: claude CLI not found in PATH."
117
134
  echo "Install: https://docs.anthropic.com/en/docs/claude-code"
@@ -470,10 +487,13 @@ while true; do
470
487
  echo ""
471
488
 
472
489
  # Build the prompt
473
- # Only pass phase hint on cycle 1 after that, pm-cycle auto-detects
490
+ # Cycle 1: pass phase hint and PRD if provided. After that, pm-cycle auto-detects
474
491
  # from STATE.md so it can advance through phases autonomously.
475
- if [ "$CYCLE" -eq 1 ] && [ -n "$PHASE" ]; then
476
- PROMPT="/cook:pm-cycle $PHASE"
492
+ if [ "$CYCLE" -eq 1 ]; then
493
+ PROMPT="/cook:pm-cycle"
494
+ [ -n "$PHASE" ] && PROMPT="$PROMPT $PHASE"
495
+ [ "$INIT_MODE" = true ] && PROMPT="$PROMPT --init"
496
+ [ -n "$PRD_FILE" ] && PROMPT="$PROMPT --prd=$PRD_FILE"
477
497
  else
478
498
  PROMPT="/cook:pm-cycle"
479
499
  fi