claude-cook 1.10.1

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 (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +607 -0
  3. package/agents/gsd-codebase-mapper.md +738 -0
  4. package/agents/gsd-debugger.md +1203 -0
  5. package/agents/gsd-executor.md +784 -0
  6. package/agents/gsd-integration-checker.md +423 -0
  7. package/agents/gsd-phase-researcher.md +641 -0
  8. package/agents/gsd-plan-checker.md +745 -0
  9. package/agents/gsd-planner.md +1386 -0
  10. package/agents/gsd-pm.md +331 -0
  11. package/agents/gsd-project-researcher.md +865 -0
  12. package/agents/gsd-research-synthesizer.md +256 -0
  13. package/agents/gsd-roadmapper.md +605 -0
  14. package/agents/gsd-verifier.md +778 -0
  15. package/bin/install.js +1477 -0
  16. package/commands/gsd/add-phase.md +207 -0
  17. package/commands/gsd/add-todo.md +193 -0
  18. package/commands/gsd/audit-milestone.md +277 -0
  19. package/commands/gsd/check-todos.md +228 -0
  20. package/commands/gsd/complete-milestone.md +136 -0
  21. package/commands/gsd/debug.md +169 -0
  22. package/commands/gsd/discuss-phase.md +86 -0
  23. package/commands/gsd/execute-phase.md +339 -0
  24. package/commands/gsd/help.md +545 -0
  25. package/commands/gsd/insert-phase.md +227 -0
  26. package/commands/gsd/join-discord.md +18 -0
  27. package/commands/gsd/list-phase-assumptions.md +50 -0
  28. package/commands/gsd/map-codebase.md +71 -0
  29. package/commands/gsd/new-milestone.md +721 -0
  30. package/commands/gsd/new-project.md +1008 -0
  31. package/commands/gsd/pause-work.md +134 -0
  32. package/commands/gsd/plan-milestone-gaps.md +295 -0
  33. package/commands/gsd/plan-phase.md +525 -0
  34. package/commands/gsd/pm-check.md +115 -0
  35. package/commands/gsd/pm-replan.md +102 -0
  36. package/commands/gsd/pm-start.md +218 -0
  37. package/commands/gsd/pm-status.md +116 -0
  38. package/commands/gsd/pm-stop.md +72 -0
  39. package/commands/gsd/progress.md +415 -0
  40. package/commands/gsd/quick.md +309 -0
  41. package/commands/gsd/remove-phase.md +349 -0
  42. package/commands/gsd/research-phase.md +200 -0
  43. package/commands/gsd/resume-work.md +40 -0
  44. package/commands/gsd/set-profile.md +106 -0
  45. package/commands/gsd/settings.md +151 -0
  46. package/commands/gsd/update.md +172 -0
  47. package/commands/gsd/verify-work.md +219 -0
  48. package/get-shit-done/references/checkpoints.md +1078 -0
  49. package/get-shit-done/references/continuation-format.md +249 -0
  50. package/get-shit-done/references/git-integration.md +254 -0
  51. package/get-shit-done/references/model-profiles.md +73 -0
  52. package/get-shit-done/references/planning-config.md +189 -0
  53. package/get-shit-done/references/questioning.md +141 -0
  54. package/get-shit-done/references/tdd.md +263 -0
  55. package/get-shit-done/references/ui-brand.md +172 -0
  56. package/get-shit-done/references/verification-patterns.md +612 -0
  57. package/get-shit-done/references/vibe-kanban.md +142 -0
  58. package/get-shit-done/templates/DEBUG.md +159 -0
  59. package/get-shit-done/templates/UAT.md +247 -0
  60. package/get-shit-done/templates/codebase/architecture.md +255 -0
  61. package/get-shit-done/templates/codebase/concerns.md +310 -0
  62. package/get-shit-done/templates/codebase/conventions.md +307 -0
  63. package/get-shit-done/templates/codebase/integrations.md +280 -0
  64. package/get-shit-done/templates/codebase/stack.md +186 -0
  65. package/get-shit-done/templates/codebase/structure.md +285 -0
  66. package/get-shit-done/templates/codebase/testing.md +480 -0
  67. package/get-shit-done/templates/config.json +35 -0
  68. package/get-shit-done/templates/context.md +283 -0
  69. package/get-shit-done/templates/continue-here.md +78 -0
  70. package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  71. package/get-shit-done/templates/discovery.md +146 -0
  72. package/get-shit-done/templates/milestone-archive.md +123 -0
  73. package/get-shit-done/templates/milestone.md +115 -0
  74. package/get-shit-done/templates/phase-prompt.md +567 -0
  75. package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  76. package/get-shit-done/templates/pm-config.md +55 -0
  77. package/get-shit-done/templates/pm-log.md +27 -0
  78. package/get-shit-done/templates/project.md +184 -0
  79. package/get-shit-done/templates/requirements.md +231 -0
  80. package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  81. package/get-shit-done/templates/research-project/FEATURES.md +147 -0
  82. package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  83. package/get-shit-done/templates/research-project/STACK.md +120 -0
  84. package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  85. package/get-shit-done/templates/research.md +529 -0
  86. package/get-shit-done/templates/roadmap.md +202 -0
  87. package/get-shit-done/templates/state.md +205 -0
  88. package/get-shit-done/templates/summary.md +246 -0
  89. package/get-shit-done/templates/ticket-map.md +28 -0
  90. package/get-shit-done/templates/user-setup.md +311 -0
  91. package/get-shit-done/templates/verification-report.md +322 -0
  92. package/get-shit-done/workflows/complete-milestone.md +903 -0
  93. package/get-shit-done/workflows/diagnose-issues.md +231 -0
  94. package/get-shit-done/workflows/discovery-phase.md +289 -0
  95. package/get-shit-done/workflows/discuss-phase.md +433 -0
  96. package/get-shit-done/workflows/execute-phase.md +671 -0
  97. package/get-shit-done/workflows/execute-plan.md +1844 -0
  98. package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  99. package/get-shit-done/workflows/map-codebase.md +322 -0
  100. package/get-shit-done/workflows/pm-check.md +210 -0
  101. package/get-shit-done/workflows/pm-dispatch.md +104 -0
  102. package/get-shit-done/workflows/pm-replan.md +203 -0
  103. package/get-shit-done/workflows/pm-sync.md +130 -0
  104. package/get-shit-done/workflows/resume-project.md +307 -0
  105. package/get-shit-done/workflows/transition.md +556 -0
  106. package/get-shit-done/workflows/verify-phase.md +628 -0
  107. package/get-shit-done/workflows/verify-work.md +596 -0
  108. package/hooks/dist/gsd-check-update.js +61 -0
  109. package/hooks/dist/gsd-statusline.js +87 -0
  110. package/package.json +47 -0
  111. package/scripts/build-hooks.js +42 -0
  112. package/scripts/pm-loop.sh +155 -0
@@ -0,0 +1,178 @@
1
+ <purpose>
2
+ Surface Claude's assumptions about a phase before planning, enabling users to correct misconceptions early.
3
+
4
+ Key difference from discuss-phase: This is ANALYSIS of what Claude thinks, not INTAKE of what user knows. No file output - purely conversational to prompt discussion.
5
+ </purpose>
6
+
7
+ <process>
8
+
9
+ <step name="validate_phase" priority="first">
10
+ Phase number: $ARGUMENTS (required)
11
+
12
+ **If argument missing:**
13
+
14
+ ```
15
+ Error: Phase number required.
16
+
17
+ Usage: /gsd:list-phase-assumptions [phase-number]
18
+ Example: /gsd:list-phase-assumptions 3
19
+ ```
20
+
21
+ Exit workflow.
22
+
23
+ **If argument provided:**
24
+ Validate phase exists in roadmap:
25
+
26
+ ```bash
27
+ cat .planning/ROADMAP.md | grep -i "Phase ${PHASE}"
28
+ ```
29
+
30
+ **If phase not found:**
31
+
32
+ ```
33
+ Error: Phase ${PHASE} not found in roadmap.
34
+
35
+ Available phases:
36
+ [list phases from roadmap]
37
+ ```
38
+
39
+ Exit workflow.
40
+
41
+ **If phase found:**
42
+ Parse phase details from roadmap:
43
+
44
+ - Phase number
45
+ - Phase name
46
+ - Phase description/goal
47
+ - Any scope details mentioned
48
+
49
+ Continue to analyze_phase.
50
+ </step>
51
+
52
+ <step name="analyze_phase">
53
+ Based on roadmap description and project context, identify assumptions across five areas:
54
+
55
+ **1. Technical Approach:**
56
+ What libraries, frameworks, patterns, or tools would Claude use?
57
+ - "I'd use X library because..."
58
+ - "I'd follow Y pattern because..."
59
+ - "I'd structure this as Z because..."
60
+
61
+ **2. Implementation Order:**
62
+ What would Claude build first, second, third?
63
+ - "I'd start with X because it's foundational"
64
+ - "Then Y because it depends on X"
65
+ - "Finally Z because..."
66
+
67
+ **3. Scope Boundaries:**
68
+ What's included vs excluded in Claude's interpretation?
69
+ - "This phase includes: A, B, C"
70
+ - "This phase does NOT include: D, E, F"
71
+ - "Boundary ambiguities: G could go either way"
72
+
73
+ **4. Risk Areas:**
74
+ Where does Claude expect complexity or challenges?
75
+ - "The tricky part is X because..."
76
+ - "Potential issues: Y, Z"
77
+ - "I'd watch out for..."
78
+
79
+ **5. Dependencies:**
80
+ What does Claude assume exists or needs to be in place?
81
+ - "This assumes X from previous phases"
82
+ - "External dependencies: Y, Z"
83
+ - "This will be consumed by..."
84
+
85
+ Be honest about uncertainty. Mark assumptions with confidence levels:
86
+ - "Fairly confident: ..." (clear from roadmap)
87
+ - "Assuming: ..." (reasonable inference)
88
+ - "Unclear: ..." (could go multiple ways)
89
+ </step>
90
+
91
+ <step name="present_assumptions">
92
+ Present assumptions in a clear, scannable format:
93
+
94
+ ```
95
+ ## My Assumptions for Phase ${PHASE}: ${PHASE_NAME}
96
+
97
+ ### Technical Approach
98
+ [List assumptions about how to implement]
99
+
100
+ ### Implementation Order
101
+ [List assumptions about sequencing]
102
+
103
+ ### Scope Boundaries
104
+ **In scope:** [what's included]
105
+ **Out of scope:** [what's excluded]
106
+ **Ambiguous:** [what could go either way]
107
+
108
+ ### Risk Areas
109
+ [List anticipated challenges]
110
+
111
+ ### Dependencies
112
+ **From prior phases:** [what's needed]
113
+ **External:** [third-party needs]
114
+ **Feeds into:** [what future phases need from this]
115
+
116
+ ---
117
+
118
+ **What do you think?**
119
+
120
+ Are these assumptions accurate? Let me know:
121
+ - What I got right
122
+ - What I got wrong
123
+ - What I'm missing
124
+ ```
125
+
126
+ Wait for user response.
127
+ </step>
128
+
129
+ <step name="gather_feedback">
130
+ **If user provides corrections:**
131
+
132
+ Acknowledge the corrections:
133
+
134
+ ```
135
+ Key corrections:
136
+ - [correction 1]
137
+ - [correction 2]
138
+
139
+ This changes my understanding significantly. [Summarize new understanding]
140
+ ```
141
+
142
+ **If user confirms assumptions:**
143
+
144
+ ```
145
+ Assumptions validated.
146
+ ```
147
+
148
+ Continue to offer_next.
149
+ </step>
150
+
151
+ <step name="offer_next">
152
+ Present next steps:
153
+
154
+ ```
155
+ What's next?
156
+ 1. Discuss context (/gsd:discuss-phase ${PHASE}) - Let me ask you questions to build comprehensive context
157
+ 2. Plan this phase (/gsd:plan-phase ${PHASE}) - Create detailed execution plans
158
+ 3. Re-examine assumptions - I'll analyze again with your corrections
159
+ 4. Done for now
160
+ ```
161
+
162
+ Wait for user selection.
163
+
164
+ If "Discuss context": Note that CONTEXT.md will incorporate any corrections discussed here
165
+ If "Plan this phase": Proceed knowing assumptions are understood
166
+ If "Re-examine": Return to analyze_phase with updated understanding
167
+ </step>
168
+
169
+ </process>
170
+
171
+ <success_criteria>
172
+ - Phase number validated against roadmap
173
+ - Assumptions surfaced across five areas: technical approach, implementation order, scope, risks, dependencies
174
+ - Confidence levels marked where appropriate
175
+ - "What do you think?" prompt presented
176
+ - User feedback acknowledged
177
+ - Clear next steps offered
178
+ </success_criteria>
@@ -0,0 +1,322 @@
1
+ <purpose>
2
+ Orchestrate parallel codebase mapper agents to analyze codebase and produce structured documents in .planning/codebase/
3
+
4
+ Each agent has fresh context, explores a specific focus area, and **writes documents directly**. The orchestrator only receives confirmation + line counts, then writes a summary.
5
+
6
+ Output: .planning/codebase/ folder with 7 structured documents about the codebase state.
7
+ </purpose>
8
+
9
+ <philosophy>
10
+ **Why dedicated mapper agents:**
11
+ - Fresh context per domain (no token contamination)
12
+ - Agents write documents directly (no context transfer back to orchestrator)
13
+ - Orchestrator only summarizes what was created (minimal context usage)
14
+ - Faster execution (agents run simultaneously)
15
+
16
+ **Document quality over length:**
17
+ Include enough detail to be useful as reference. Prioritize practical examples (especially code patterns) over arbitrary brevity.
18
+
19
+ **Always include file paths:**
20
+ Documents are reference material for Claude when planning/executing. Always include actual file paths formatted with backticks: `src/services/user.ts`.
21
+ </philosophy>
22
+
23
+ <process>
24
+
25
+ <step name="resolve_model_profile" priority="first">
26
+ Read model profile for agent spawning:
27
+
28
+ ```bash
29
+ MODEL_PROFILE=$(cat .planning/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")
30
+ ```
31
+
32
+ Default to "balanced" if not set.
33
+
34
+ **Model lookup table:**
35
+
36
+ | Agent | quality | balanced | budget |
37
+ |-------|---------|----------|--------|
38
+ | gsd-codebase-mapper | sonnet | haiku | haiku |
39
+
40
+ Store resolved model for use in Task calls below.
41
+ </step>
42
+
43
+ <step name="check_existing">
44
+ Check if .planning/codebase/ already exists:
45
+
46
+ ```bash
47
+ ls -la .planning/codebase/ 2>/dev/null
48
+ ```
49
+
50
+ **If exists:**
51
+
52
+ ```
53
+ .planning/codebase/ already exists with these documents:
54
+ [List files found]
55
+
56
+ What's next?
57
+ 1. Refresh - Delete existing and remap codebase
58
+ 2. Update - Keep existing, only update specific documents
59
+ 3. Skip - Use existing codebase map as-is
60
+ ```
61
+
62
+ Wait for user response.
63
+
64
+ If "Refresh": Delete .planning/codebase/, continue to create_structure
65
+ If "Update": Ask which documents to update, continue to spawn_agents (filtered)
66
+ If "Skip": Exit workflow
67
+
68
+ **If doesn't exist:**
69
+ Continue to create_structure.
70
+ </step>
71
+
72
+ <step name="create_structure">
73
+ Create .planning/codebase/ directory:
74
+
75
+ ```bash
76
+ mkdir -p .planning/codebase
77
+ ```
78
+
79
+ **Expected output files:**
80
+ - STACK.md (from tech mapper)
81
+ - INTEGRATIONS.md (from tech mapper)
82
+ - ARCHITECTURE.md (from arch mapper)
83
+ - STRUCTURE.md (from arch mapper)
84
+ - CONVENTIONS.md (from quality mapper)
85
+ - TESTING.md (from quality mapper)
86
+ - CONCERNS.md (from concerns mapper)
87
+
88
+ Continue to spawn_agents.
89
+ </step>
90
+
91
+ <step name="spawn_agents">
92
+ Spawn 4 parallel gsd-codebase-mapper agents.
93
+
94
+ Use Task tool with `subagent_type="gsd-codebase-mapper"`, `model="{mapper_model}"`, and `run_in_background=true` for parallel execution.
95
+
96
+ **CRITICAL:** Use the dedicated `gsd-codebase-mapper` agent, NOT `Explore`. The mapper agent writes documents directly.
97
+
98
+ **Agent 1: Tech Focus**
99
+
100
+ Task tool parameters:
101
+ ```
102
+ subagent_type: "gsd-codebase-mapper"
103
+ model: "{mapper_model}"
104
+ run_in_background: true
105
+ description: "Map codebase tech stack"
106
+ ```
107
+
108
+ Prompt:
109
+ ```
110
+ Focus: tech
111
+
112
+ Analyze this codebase for technology stack and external integrations.
113
+
114
+ Write these documents to .planning/codebase/:
115
+ - STACK.md - Languages, runtime, frameworks, dependencies, configuration
116
+ - INTEGRATIONS.md - External APIs, databases, auth providers, webhooks
117
+
118
+ Explore thoroughly. Write documents directly using templates. Return confirmation only.
119
+ ```
120
+
121
+ **Agent 2: Architecture Focus**
122
+
123
+ Task tool parameters:
124
+ ```
125
+ subagent_type: "gsd-codebase-mapper"
126
+ model: "{mapper_model}"
127
+ run_in_background: true
128
+ description: "Map codebase architecture"
129
+ ```
130
+
131
+ Prompt:
132
+ ```
133
+ Focus: arch
134
+
135
+ Analyze this codebase architecture and directory structure.
136
+
137
+ Write these documents to .planning/codebase/:
138
+ - ARCHITECTURE.md - Pattern, layers, data flow, abstractions, entry points
139
+ - STRUCTURE.md - Directory layout, key locations, naming conventions
140
+
141
+ Explore thoroughly. Write documents directly using templates. Return confirmation only.
142
+ ```
143
+
144
+ **Agent 3: Quality Focus**
145
+
146
+ Task tool parameters:
147
+ ```
148
+ subagent_type: "gsd-codebase-mapper"
149
+ model: "{mapper_model}"
150
+ run_in_background: true
151
+ description: "Map codebase conventions"
152
+ ```
153
+
154
+ Prompt:
155
+ ```
156
+ Focus: quality
157
+
158
+ Analyze this codebase for coding conventions and testing patterns.
159
+
160
+ Write these documents to .planning/codebase/:
161
+ - CONVENTIONS.md - Code style, naming, patterns, error handling
162
+ - TESTING.md - Framework, structure, mocking, coverage
163
+
164
+ Explore thoroughly. Write documents directly using templates. Return confirmation only.
165
+ ```
166
+
167
+ **Agent 4: Concerns Focus**
168
+
169
+ Task tool parameters:
170
+ ```
171
+ subagent_type: "gsd-codebase-mapper"
172
+ model: "{mapper_model}"
173
+ run_in_background: true
174
+ description: "Map codebase concerns"
175
+ ```
176
+
177
+ Prompt:
178
+ ```
179
+ Focus: concerns
180
+
181
+ Analyze this codebase for technical debt, known issues, and areas of concern.
182
+
183
+ Write this document to .planning/codebase/:
184
+ - CONCERNS.md - Tech debt, bugs, security, performance, fragile areas
185
+
186
+ Explore thoroughly. Write document directly using template. Return confirmation only.
187
+ ```
188
+
189
+ Continue to collect_confirmations.
190
+ </step>
191
+
192
+ <step name="collect_confirmations">
193
+ Wait for all 4 agents to complete.
194
+
195
+ Read each agent's output file to collect confirmations.
196
+
197
+ **Expected confirmation format from each agent:**
198
+ ```
199
+ ## Mapping Complete
200
+
201
+ **Focus:** {focus}
202
+ **Documents written:**
203
+ - `.planning/codebase/{DOC1}.md` ({N} lines)
204
+ - `.planning/codebase/{DOC2}.md` ({N} lines)
205
+
206
+ Ready for orchestrator summary.
207
+ ```
208
+
209
+ **What you receive:** Just file paths and line counts. NOT document contents.
210
+
211
+ If any agent failed, note the failure and continue with successful documents.
212
+
213
+ Continue to verify_output.
214
+ </step>
215
+
216
+ <step name="verify_output">
217
+ Verify all documents created successfully:
218
+
219
+ ```bash
220
+ ls -la .planning/codebase/
221
+ wc -l .planning/codebase/*.md
222
+ ```
223
+
224
+ **Verification checklist:**
225
+ - All 7 documents exist
226
+ - No empty documents (each should have >20 lines)
227
+
228
+ If any documents missing or empty, note which agents may have failed.
229
+
230
+ Continue to commit_codebase_map.
231
+ </step>
232
+
233
+ <step name="commit_codebase_map">
234
+ Commit the codebase map:
235
+
236
+ **Check planning config:**
237
+
238
+ ```bash
239
+ COMMIT_PLANNING_DOCS=$(cat .planning/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
240
+ git check-ignore -q .planning 2>/dev/null && COMMIT_PLANNING_DOCS=false
241
+ ```
242
+
243
+ **If `COMMIT_PLANNING_DOCS=false`:** Skip git operations
244
+
245
+ **If `COMMIT_PLANNING_DOCS=true` (default):**
246
+
247
+ ```bash
248
+ git add .planning/codebase/*.md
249
+ git commit -m "$(cat <<'EOF'
250
+ docs: map existing codebase
251
+
252
+ - STACK.md - Technologies and dependencies
253
+ - ARCHITECTURE.md - System design and patterns
254
+ - STRUCTURE.md - Directory layout
255
+ - CONVENTIONS.md - Code style and patterns
256
+ - TESTING.md - Test structure
257
+ - INTEGRATIONS.md - External services
258
+ - CONCERNS.md - Technical debt and issues
259
+ EOF
260
+ )"
261
+ ```
262
+
263
+ Continue to offer_next.
264
+ </step>
265
+
266
+ <step name="offer_next">
267
+ Present completion summary and next steps.
268
+
269
+ **Get line counts:**
270
+ ```bash
271
+ wc -l .planning/codebase/*.md
272
+ ```
273
+
274
+ **Output format:**
275
+
276
+ ```
277
+ Codebase mapping complete.
278
+
279
+ Created .planning/codebase/:
280
+ - STACK.md ([N] lines) - Technologies and dependencies
281
+ - ARCHITECTURE.md ([N] lines) - System design and patterns
282
+ - STRUCTURE.md ([N] lines) - Directory layout and organization
283
+ - CONVENTIONS.md ([N] lines) - Code style and patterns
284
+ - TESTING.md ([N] lines) - Test structure and practices
285
+ - INTEGRATIONS.md ([N] lines) - External services and APIs
286
+ - CONCERNS.md ([N] lines) - Technical debt and issues
287
+
288
+
289
+ ---
290
+
291
+ ## ▶ Next Up
292
+
293
+ **Initialize project** — use codebase context for planning
294
+
295
+ `/gsd:new-project`
296
+
297
+ <sub>`/clear` first → fresh context window</sub>
298
+
299
+ ---
300
+
301
+ **Also available:**
302
+ - Re-run mapping: `/gsd:map-codebase`
303
+ - Review specific file: `cat .planning/codebase/STACK.md`
304
+ - Edit any document before proceeding
305
+
306
+ ---
307
+ ```
308
+
309
+ End workflow.
310
+ </step>
311
+
312
+ </process>
313
+
314
+ <success_criteria>
315
+ - .planning/codebase/ directory created
316
+ - 4 parallel gsd-codebase-mapper agents spawned with run_in_background=true
317
+ - Agents write documents directly (orchestrator doesn't receive document contents)
318
+ - Read agent output files to collect confirmations
319
+ - All 7 codebase documents exist
320
+ - Clear completion summary with line counts
321
+ - User offered clear next steps in GSD style
322
+ </success_criteria>
@@ -0,0 +1,210 @@
1
+ # PM Check Workflow — Single Poll+React Cycle
2
+
3
+ <purpose>
4
+ Execute one stateless monitoring cycle: poll Vibe Kanban tickets, diff against TICKET-MAP.md, react to state changes, log decisions, update persistent state.
5
+
6
+ This workflow is the atomic unit of the PM loop. Called by:
7
+ - `pm-loop.sh` (autonomous mode — once per interval)
8
+ - `/gsd:pm-check` (manual mode — user-triggered)
9
+
10
+ Each invocation is a fresh Claude context. All state comes from files.
11
+ </purpose>
12
+
13
+ <process>
14
+
15
+ <step name="load_state" priority="first">
16
+
17
+ ## 1. Load Persistent State
18
+
19
+ Read the following files to reconstruct PM context:
20
+
21
+ ```bash
22
+ cat .planning/config.json # pm section
23
+ cat .planning/STATE.md # current position
24
+ ```
25
+
26
+ From config.json, extract:
27
+ - `pm.project_id` — VK project UUID
28
+ - `pm.repos` — repo configs for dispatch
29
+ - `pm.default_executor` — which agent to use
30
+ - `pm.auto_replan_on_failure` — whether to auto-fix
31
+ - `pm.auto_dispatch_next_wave` — whether to auto-advance
32
+ - `pm.max_replan_attempts` — replan limit
33
+
34
+ Find the active phase:
35
+ ```bash
36
+ # Get current phase from STATE.md
37
+ grep "Phase:" .planning/STATE.md | head -1
38
+ ```
39
+
40
+ Read the active TICKET-MAP:
41
+ ```bash
42
+ cat .planning/phases/{phase_dir}/TICKET-MAP.md
43
+ ```
44
+
45
+ **If no TICKET-MAP exists:** This phase has no tickets yet. Exit with message suggesting `/gsd:pm-start`.
46
+
47
+ **If phase_status is `complete`:** Exit with message that phase is done.
48
+
49
+ </step>
50
+
51
+ <step name="poll_vk">
52
+
53
+ ## 2. Poll Vibe Kanban
54
+
55
+ Call `mcp__vibe_kanban__list_tasks(project_id)` to get all tickets.
56
+
57
+ For each ticket returned, build a map:
58
+ ```
59
+ current_state = {
60
+ ticket_id: { status, title, description_snippet }
61
+ }
62
+ ```
63
+
64
+ </step>
65
+
66
+ <step name="diff">
67
+
68
+ ## 3. Diff Against TICKET-MAP
69
+
70
+ For each ticket tracked in TICKET-MAP.md:
71
+
72
+ ```
73
+ previous_status = TICKET-MAP[ticket_id].status
74
+ current_status = current_state[ticket_id].status
75
+
76
+ if previous_status != current_status:
77
+ events.push({
78
+ ticket_id, title,
79
+ from: previous_status,
80
+ to: current_status
81
+ })
82
+ ```
83
+
84
+ Classify each event:
85
+
86
+ | Transition | Event Type |
87
+ | ---------- | ---------- |
88
+ | todo → inprogress | WORKER_STARTED |
89
+ | inprogress → inreview | WORKER_COMPLETED |
90
+ | inprogress → done | WORKER_AUTO_COMPLETED |
91
+ | any → cancelled | TICKET_CANCELLED |
92
+ | (no change, inprogress for too long) | POTENTIALLY_STUCK |
93
+
94
+ Aggregate events:
95
+
96
+ | Condition | Aggregate Event |
97
+ | --------- | --------------- |
98
+ | All wave N tickets are `done` | WAVE_COMPLETE |
99
+ | All tickets across all waves are `done` | PHASE_COMPLETE |
100
+ | No changes detected | NO_CHANGE |
101
+
102
+ </step>
103
+
104
+ <step name="react">
105
+
106
+ ## 4. React to Events
107
+
108
+ Process events in priority order:
109
+
110
+ ### PHASE_COMPLETE (highest priority)
111
+ 1. Update TICKET-MAP.md: `phase_status: complete`
112
+ 2. Update STATE.md: mark phase complete, advance current position
113
+ 3. Log phase completion summary to PM-LOG.md
114
+ 4. Present to user:
115
+ ```
116
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
117
+ PM ► PHASE COMPLETE
118
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
119
+
120
+ Phase {X}: {name} — all tickets done.
121
+
122
+ Run /gsd:pm-start {X+1} to begin next phase.
123
+ ```
124
+
125
+ ### WAVE_COMPLETE
126
+ 1. Identify next wave tickets in TICKET-MAP
127
+ 2. Check `pm.auto_dispatch_next_wave` in config
128
+ 3. If true: dispatch all next-wave tickets (call dispatch flow from gsd-pm agent)
129
+ 4. If false: log and present suggestion to user
130
+ 5. Update STATE.md wave summary
131
+
132
+ ### WORKER_COMPLETED / WORKER_AUTO_COMPLETED
133
+ 1. Call `get_task(task_id)` to read worker output/notes
134
+ 2. Update TICKET-MAP.md: status=done, completed=timestamp
135
+ 3. Check if this completes the wave
136
+
137
+ ### TICKET_CANCELLED (potential failure)
138
+ 1. Call `get_task(task_id)` to read cancellation reason
139
+ 2. Check `pm.auto_replan_on_failure` in config
140
+ 3. Read current replan_count from TICKET-MAP Replan History
141
+ 4. If auto_replan AND replan_count < max_replan_attempts:
142
+ - Spawn gsd-planner via Task tool in gap-closure mode
143
+ - Pass: failed ticket details, phase goal, existing plans
144
+ - After planner returns: sync new plan to VK ticket
145
+ - Dispatch fix ticket
146
+ - Increment replan_count
147
+ 5. If not auto or max reached: log and present failure to user with options
148
+
149
+ ### POTENTIALLY_STUCK
150
+ 1. Log warning
151
+ 2. If autonomous: consider re-dispatching
152
+ 3. Present to user if manual mode
153
+
154
+ ### NO_CHANGE
155
+ 1. Brief log entry only
156
+
157
+ </step>
158
+
159
+ <step name="log">
160
+
161
+ ## 5. Log to PM-LOG.md
162
+
163
+ Append a timestamped entry:
164
+
165
+ ```markdown
166
+ ## [YYYY-MM-DD HH:MM:SS] POLL
167
+
168
+ - Checked {N} tickets for phase {X}
169
+ - Events: {list of transitions, or "No changes"}
170
+ - Actions: {list of actions taken, or "None"}
171
+ - Next: {what to expect}
172
+ ```
173
+
174
+ For significant events (dispatch, replan, phase complete), use the specific event type instead of POLL:
175
+
176
+ ```markdown
177
+ ## [YYYY-MM-DD HH:MM:SS] DISPATCH
178
+
179
+ - Dispatched wave {N}: {ticket list}
180
+ - Executor: {name}
181
+
182
+ ## [YYYY-MM-DD HH:MM:SS] REPLAN
183
+
184
+ - Failed ticket: {title} ({ticket_id})
185
+ - Reason: {error details}
186
+ - Fix plan created: {plan_name}
187
+ - Fix ticket: {new_ticket_id}
188
+ ```
189
+
190
+ </step>
191
+
192
+ <step name="update_state">
193
+
194
+ ## 6. Update Persistent State
195
+
196
+ ### TICKET-MAP.md
197
+ - Update status column for all changed tickets
198
+ - Update last_polled timestamp
199
+ - Add replan entries if applicable
200
+
201
+ ### STATE.md — Vibe Kanban Status section
202
+ - Update ticket summary table
203
+ - Update last_polled
204
+ - Update PM loop status
205
+ - Update next action description
206
+ - Update Recent Ticket Events (keep last 5)
207
+
208
+ </step>
209
+
210
+ </process>