planflow-ai 1.3.5 → 1.4.3

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 (123) hide show
  1. package/.claude/commands/brainstorm.md +6 -14
  2. package/.claude/commands/create-contract.md +6 -38
  3. package/.claude/commands/create-plan.md +18 -38
  4. package/.claude/commands/discovery-plan.md +19 -49
  5. package/.claude/commands/execute-plan.md +116 -77
  6. package/.claude/commands/flow.md +27 -2
  7. package/.claude/commands/heartbeat.md +12 -14
  8. package/.claude/commands/learn.md +20 -80
  9. package/.claude/commands/note.md +6 -23
  10. package/.claude/commands/resume-work.md +261 -0
  11. package/.claude/commands/review-code.md +19 -51
  12. package/.claude/commands/review-pr.md +21 -57
  13. package/.claude/commands/setup.md +8 -56
  14. package/.claude/commands/write-tests.md +7 -41
  15. package/.claude/resources/core/atomic-commits.md +380 -0
  16. package/.claude/resources/core/autopilot-mode.md +3 -2
  17. package/.claude/resources/core/compaction-guide.md +15 -1
  18. package/.claude/resources/core/heartbeat.md +129 -1
  19. package/.claude/resources/core/per-task-verification.md +362 -0
  20. package/.claude/resources/core/phase-isolation.md +237 -4
  21. package/.claude/resources/core/session-scratchpad.md +1 -0
  22. package/.claude/resources/core/shared-context.md +110 -0
  23. package/.claude/resources/core/wave-execution.md +407 -0
  24. package/.claude/resources/patterns/plans-patterns.md +56 -0
  25. package/.claude/resources/patterns/plans-templates.md +152 -0
  26. package/.claude/resources/skills/create-plan-skill.md +71 -5
  27. package/.claude/resources/skills/execute-plan-skill.md +420 -14
  28. package/.claude/resources/skills/resume-work-skill.md +159 -0
  29. package/README.md +154 -96
  30. package/dist/cli/commands/brain.d.ts +20 -0
  31. package/dist/cli/commands/brain.d.ts.map +1 -0
  32. package/dist/cli/commands/brain.js +127 -0
  33. package/dist/cli/commands/brain.js.map +1 -0
  34. package/dist/cli/commands/init.d.ts.map +1 -1
  35. package/dist/cli/commands/init.js +10 -1
  36. package/dist/cli/commands/init.js.map +1 -1
  37. package/dist/cli/commands/state-query.d.ts +13 -0
  38. package/dist/cli/commands/state-query.d.ts.map +1 -0
  39. package/dist/cli/commands/state-query.js +32 -0
  40. package/dist/cli/commands/state-query.js.map +1 -0
  41. package/dist/cli/commands/state.d.ts +12 -0
  42. package/dist/cli/commands/state.d.ts.map +1 -0
  43. package/dist/cli/commands/state.js +47 -0
  44. package/dist/cli/commands/state.js.map +1 -0
  45. package/dist/cli/daemon/desktop-notifier.d.ts +16 -0
  46. package/dist/cli/daemon/desktop-notifier.d.ts.map +1 -0
  47. package/dist/cli/daemon/desktop-notifier.js +53 -0
  48. package/dist/cli/daemon/desktop-notifier.js.map +1 -0
  49. package/dist/cli/daemon/event-writer.d.ts +22 -0
  50. package/dist/cli/daemon/event-writer.d.ts.map +1 -0
  51. package/dist/cli/daemon/event-writer.js +76 -0
  52. package/dist/cli/daemon/event-writer.js.map +1 -0
  53. package/dist/cli/daemon/heartbeat-daemon.js +81 -1
  54. package/dist/cli/daemon/heartbeat-daemon.js.map +1 -1
  55. package/dist/cli/daemon/log-writer.d.ts +17 -0
  56. package/dist/cli/daemon/log-writer.d.ts.map +1 -0
  57. package/dist/cli/daemon/log-writer.js +62 -0
  58. package/dist/cli/daemon/log-writer.js.map +1 -0
  59. package/dist/cli/daemon/notification-router.d.ts +17 -0
  60. package/dist/cli/daemon/notification-router.d.ts.map +1 -0
  61. package/dist/cli/daemon/notification-router.js +35 -0
  62. package/dist/cli/daemon/notification-router.js.map +1 -0
  63. package/dist/cli/daemon/prompt-manager.d.ts +27 -0
  64. package/dist/cli/daemon/prompt-manager.d.ts.map +1 -0
  65. package/dist/cli/daemon/prompt-manager.js +107 -0
  66. package/dist/cli/daemon/prompt-manager.js.map +1 -0
  67. package/dist/cli/daemon/shared-context.d.ts +38 -0
  68. package/dist/cli/daemon/shared-context.d.ts.map +1 -0
  69. package/dist/cli/daemon/shared-context.js +129 -0
  70. package/dist/cli/daemon/shared-context.js.map +1 -0
  71. package/dist/cli/handlers/claude.d.ts.map +1 -1
  72. package/dist/cli/handlers/claude.js +18 -0
  73. package/dist/cli/handlers/claude.js.map +1 -1
  74. package/dist/cli/handlers/shared.js +1 -1
  75. package/dist/cli/handlers/shared.js.map +1 -1
  76. package/dist/cli/index.js +30 -0
  77. package/dist/cli/index.js.map +1 -1
  78. package/dist/cli/state/brain-query.d.ts +48 -0
  79. package/dist/cli/state/brain-query.d.ts.map +1 -0
  80. package/dist/cli/state/brain-query.js +113 -0
  81. package/dist/cli/state/brain-query.js.map +1 -0
  82. package/dist/cli/state/flowconfig-parser.d.ts +16 -0
  83. package/dist/cli/state/flowconfig-parser.d.ts.map +1 -0
  84. package/dist/cli/state/flowconfig-parser.js +166 -0
  85. package/dist/cli/state/flowconfig-parser.js.map +1 -0
  86. package/dist/cli/state/heartbeat-state.d.ts +16 -0
  87. package/dist/cli/state/heartbeat-state.d.ts.map +1 -0
  88. package/dist/cli/state/heartbeat-state.js +97 -0
  89. package/dist/cli/state/heartbeat-state.js.map +1 -0
  90. package/dist/cli/state/model-router.d.ts +8 -0
  91. package/dist/cli/state/model-router.d.ts.map +1 -0
  92. package/dist/cli/state/model-router.js +36 -0
  93. package/dist/cli/state/model-router.js.map +1 -0
  94. package/dist/cli/state/plan-parser.d.ts +16 -0
  95. package/dist/cli/state/plan-parser.d.ts.map +1 -0
  96. package/dist/cli/state/plan-parser.js +124 -0
  97. package/dist/cli/state/plan-parser.js.map +1 -0
  98. package/dist/cli/state/session-state.d.ts +21 -0
  99. package/dist/cli/state/session-state.d.ts.map +1 -0
  100. package/dist/cli/state/session-state.js +36 -0
  101. package/dist/cli/state/session-state.js.map +1 -0
  102. package/dist/cli/state/state-md-parser.d.ts +18 -0
  103. package/dist/cli/state/state-md-parser.d.ts.map +1 -0
  104. package/dist/cli/state/state-md-parser.js +222 -0
  105. package/dist/cli/state/state-md-parser.js.map +1 -0
  106. package/dist/cli/state/types.d.ts +137 -0
  107. package/dist/cli/state/types.d.ts.map +1 -0
  108. package/dist/cli/state/types.js +8 -0
  109. package/dist/cli/state/types.js.map +1 -0
  110. package/dist/cli/state/wave-calculator.d.ts +18 -0
  111. package/dist/cli/state/wave-calculator.d.ts.map +1 -0
  112. package/dist/cli/state/wave-calculator.js +134 -0
  113. package/dist/cli/state/wave-calculator.js.map +1 -0
  114. package/dist/cli/types.d.ts +15 -0
  115. package/dist/cli/types.d.ts.map +1 -1
  116. package/package.json +7 -2
  117. package/templates/shared/CLAUDE.md.template +4 -0
  118. package/.claude/resources/core/_index.md +0 -304
  119. package/.claude/resources/languages/_index.md +0 -76
  120. package/.claude/resources/patterns/_index.md +0 -200
  121. package/.claude/resources/skills/_index.md +0 -285
  122. package/.claude/resources/tools/_index.md +0 -110
  123. package/.claude/resources/tools/reference-expansion-tool.md +0 -326
@@ -179,22 +179,15 @@ After the skill completes:
179
179
  +------------------------------------------+
180
180
  ```
181
181
 
182
- ---
183
-
184
- ## Context Optimization
185
-
186
- ### Recommended Loading Order
182
+ ## Context Loading
187
183
 
188
- 1. **Always load first**: This command file (`commands/brainstorm.md`)
189
- 2. **Expand on-demand**: Load skill file when entering conversational loop
184
+ This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
190
185
 
191
- ### Reference Codes for Brainstorm
186
+ **Queries**:
187
+ - `planflow-ai state-query "brainstorm workflow" --scope resources`
188
+ - `planflow-ai state-query "interactive questions" --scope resources`
192
189
 
193
- | Code | Description | When to Expand |
194
- |------|-------------|----------------|
195
- | SKL-BS-1 | Brainstorm skill restrictions and inputs | Understanding allowed actions |
196
- | SKL-BS-2 | Conversational loop and tracking | During the brainstorm |
197
- | SKL-BS-3 | End detection, summary, and output | When wrapping up |
190
+ The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
198
191
 
199
192
  ---
200
193
 
@@ -202,7 +195,6 @@ After the skill completes:
202
195
 
203
196
  | Resource | Purpose |
204
197
  |----------|---------|
205
- | `resources/skills/_index.md` | Index of skills with reference codes |
206
198
  | `brainstorm-skill.md` | Skill that runs the brainstorm |
207
199
  | `brainstorm-templates.md` | Output file template |
208
200
  | `/discovery-plan` command | Next step after brainstorm |
@@ -193,44 +193,15 @@ The user will read the `.md` file themselves and decide when to proceed.
193
193
  4. Present contract summary
194
194
  5. User reviews and proceeds to `/discovery-plan`
195
195
 
196
- ---
197
-
198
- ## Context Optimization
199
-
200
- This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
201
-
202
- ### Recommended Loading Order
203
-
204
- 1. **Always load first**: This command file (`commands/create-contract.md`)
205
- 2. **Load indexes**: Load `_index.md` files for relevant folders
206
- 3. **Expand on-demand**: Use reference codes to load specific sections when needed
207
-
208
- ### Index Files for Contract Creation
209
-
210
- | Index | When to Load |
211
- |-------|--------------|
212
- | `resources/patterns/_index.md` | To find contract patterns |
213
- | `resources/skills/_index.md` | To understand skill workflow |
214
- | `resources/tools/_index.md` | When using interactive questions |
215
-
216
- ### Reference Codes for Contract Creation
217
-
218
- | Code | Description | When to Expand |
219
- |------|-------------|----------------|
220
- | PTN-CON-1 | Contract document structure | Creating new contract |
221
- | PTN-CON-2 | Endpoint documentation format | Documenting API endpoints |
222
- | SKL-CON-1 | Contract skill workflow | Understanding full process |
223
- | TLS-IQ-2 | How to switch to Plan mode | Before asking questions |
224
- | TLS-IQ-3 | How to ask questions | When gathering scope info |
196
+ ## Context Loading
225
197
 
226
- ### Expansion Instructions
198
+ This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
227
199
 
228
- When executing this command:
200
+ **Queries**:
201
+ - `planflow-ai state-query "contract creation" --scope resources`
202
+ - `planflow-ai state-query "contract patterns" --scope resources`
229
203
 
230
- 1. **Start with indexes**: Read `resources/patterns/_index.md` and `resources/skills/_index.md`
231
- 2. **Identify needed codes**: Based on current step, identify which codes are relevant
232
- 3. **Expand as needed**: Use the Read tool with specific line ranges from the index
233
- 4. **Don't expand everything**: Only load content required for the current step
204
+ The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
234
205
 
235
206
  ---
236
207
 
@@ -238,9 +209,6 @@ When executing this command:
238
209
 
239
210
  | Resource | Purpose |
240
211
  | ------------------------------ | -------------------------------------- |
241
- | `resources/skills/_index.md` | Index of skills with reference codes |
242
- | `resources/patterns/_index.md` | Index of patterns with reference codes |
243
- | `resources/tools/_index.md` | Index of tools with reference codes |
244
212
  | `create-contract-skill.md` | Skill that creates the contract |
245
213
  | `contract-patterns.md` | Rules and patterns for contracts |
246
214
  | `interactive-questions-tool.md` | Interactive Questions UI workflow |
@@ -221,44 +221,16 @@ The user will read the `.md` file themselves and decide when to proceed.
221
221
  5. Present plan summary
222
222
  6. User reviews and proceeds to `/execute-plan`
223
223
 
224
- ---
225
-
226
- ## Context Optimization
227
-
228
- This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
229
-
230
- ### Recommended Loading Order
231
-
232
- 1. **Always load first**: This command file (`commands/create-plan.md`)
233
- 2. **Load indexes**: Load `_index.md` files for relevant folders
234
- 3. **Expand on-demand**: Use reference codes to load specific sections when needed
235
-
236
- ### Index Files for Plan Creation
237
-
238
- | Index | When to Load |
239
- |-------|--------------|
240
- | `resources/patterns/_index.md` | To find plan patterns and templates |
241
- | `resources/skills/_index.md` | To understand skill workflow |
242
- | `resources/core/_index.md` | For complexity scoring reference |
224
+ ## Context Loading
243
225
 
244
- ### Reference Codes for Plan Creation
226
+ This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
245
227
 
246
- | Code | Description | When to Expand |
247
- |------|-------------|----------------|
248
- | PTN-PLN-1 | Plan document structure | Creating new plan |
249
- | PTN-PLN-2 | Phase organization | Structuring phases |
250
- | PTN-PLNT-1 | Plan template | Creating output file |
251
- | SKL-PLN-1 | Create plan skill workflow | Understanding full process |
252
- | COR-CS-1 | Complexity scoring table | Assigning complexity scores |
228
+ **Queries**:
229
+ - `planflow-ai state-query "plan creation" --scope resources`
230
+ - `planflow-ai state-query "complexity scoring" --scope resources`
231
+ - `planflow-ai state-query "phase structure" --scope resources`
253
232
 
254
- ### Expansion Instructions
255
-
256
- When executing this command:
257
-
258
- 1. **Start with indexes**: Read `resources/patterns/_index.md` and `resources/core/_index.md`
259
- 2. **Identify needed codes**: Based on current step, identify which codes are relevant
260
- 3. **Expand as needed**: Use the Read tool with specific line ranges from the index
261
- 4. **Don't expand everything**: Only load content required for the current step
233
+ The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
262
234
 
263
235
  ---
264
236
 
@@ -266,9 +238,6 @@ When executing this command:
266
238
 
267
239
  | Resource | Purpose |
268
240
  | --------------------------- | --------------------------------- |
269
- | `resources/skills/_index.md` | Index of skills with reference codes |
270
- | `resources/patterns/_index.md` | Index of patterns with reference codes |
271
- | `resources/core/_index.md` | Index of core rules with reference codes |
272
241
  | `create-plan-skill.md` | Skill that creates the plan |
273
242
  | `plans-patterns.md` | Rules and patterns for plans |
274
243
  | `plans-templates.md` | Plan templates |
@@ -301,6 +270,17 @@ Present recommendations after the plan summary.
301
270
 
302
271
  ---
303
272
 
273
+ ## STATE.md Updates
274
+
275
+ Update `flow/STATE.md` at these transition points to enable session resumability.
276
+
277
+ | Transition Point | Action |
278
+ |-----------------|--------|
279
+ | **Plan creation start** | Create `flow/STATE.md` with `Active Skill: create-plan`, `Active Plan: none`, `Current Phase: none`, `Current Task: creating plan from discovery`, `Next Action: Extract requirements and structure phases` |
280
+ | **Plan complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
281
+
282
+ ---
283
+
304
284
  ## Brain Capture
305
285
 
306
286
  After plan creation completes successfully, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
@@ -248,55 +248,16 @@ The user will read the `.md` file themselves and decide when to proceed.
248
248
  6. User reviews and requests refinements (if any)
249
249
  7. User invokes `/create-plan` when ready
250
250
 
251
- ---
252
-
253
- ## Context Optimization
254
-
255
- This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
256
-
257
- ### Recommended Loading Order
258
-
259
- 1. **Always load first**: This command file (`commands/discovery-plan.md`)
260
- 2. **Load indexes**: Load `_index.md` files for relevant folders
261
- 3. **Expand on-demand**: Use reference codes to load specific sections when needed
262
-
263
- ### Index Files for Discovery
264
-
265
- | Index | When to Load |
266
- |-------|--------------|
267
- | `resources/patterns/_index.md` | To find discovery templates and patterns |
268
- | `resources/skills/_index.md` | To understand skill workflow |
269
- | `resources/tools/_index.md` | When using interactive questions |
270
-
271
- ### Reference Codes for Discovery
272
-
273
- | Code | Description | When to Expand |
274
- |------|-------------|----------------|
275
- | PTN-DIS-1 | Discovery document structure | Creating new discovery doc |
276
- | PTN-DIS-2 | Requirements gathering example | Need example format |
277
- | PTN-DIST-1 | Discovery template | Creating output file |
278
- | SKL-DIS-1 | Discovery skill workflow | Understanding full process |
279
- | TLS-IQ-2 | How to switch to Plan mode | Before asking questions |
280
- | TLS-IQ-3 | How to ask questions | When gathering requirements |
281
- | COR-CG-1 | Compaction guide | Load when compacting mid-discovery |
251
+ ## Context Loading
282
252
 
283
- ### Expansion Instructions
253
+ This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
284
254
 
285
- When executing this command:
255
+ **Queries**:
256
+ - `planflow-ai state-query "discovery workflow" --scope resources`
257
+ - `planflow-ai state-query "requirements gathering" --scope resources`
258
+ - `planflow-ai state-query "codebase analysis" --scope resources`
286
259
 
287
- 1. **Start with indexes**: Read `resources/patterns/_index.md` and `resources/skills/_index.md`
288
- 2. **Identify needed codes**: Based on current step, identify which codes are relevant
289
- 3. **Expand as needed**: Use the Read tool with specific line ranges from the index
290
- 4. **Don't expand everything**: Only load content required for the current step
291
-
292
- **Example expansion**:
293
- ```
294
- # To get the discovery template
295
- Read: resources/patterns/discovery-templates.md (lines from PTN-DIST-1)
296
-
297
- # To understand question workflow
298
- Read: resources/tools/interactive-questions-tool.md (lines from TLS-IQ-3)
299
- ```
260
+ The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
300
261
 
301
262
  ---
302
263
 
@@ -304,9 +265,6 @@ Read: resources/tools/interactive-questions-tool.md (lines from TLS-IQ-3)
304
265
 
305
266
  | Resource | Purpose |
306
267
  | ------------------------------ | -------------------------------------- |
307
- | `resources/skills/_index.md` | Index of skills with reference codes |
308
- | `resources/patterns/_index.md` | Index of patterns with reference codes |
309
- | `resources/tools/_index.md` | Index of tools with reference codes |
310
268
  | `discovery-skill.md` | Skill that executes the discovery |
311
269
  | `discovery-patterns.md` | Rules and patterns for discovery |
312
270
  | `discovery-templates.md` | Document templates |
@@ -355,6 +313,18 @@ These are optional but recommended to reduce implementation friction.
355
313
 
356
314
  ---
357
315
 
316
+ ## STATE.md Updates
317
+
318
+ Update `flow/STATE.md` at these transition points to enable session resumability.
319
+
320
+ | Transition Point | Action |
321
+ |-----------------|--------|
322
+ | **Discovery start** | Create `flow/STATE.md` with `Active Skill: discovery-plan`, `Active Plan: none`, `Current Phase: none`, `Current Task: gathering requirements`, `Next Action: Read references and ask clarifying questions` |
323
+ | **Question batch complete** | Append answered questions to `## Decisions`: `{question} → {answer} (reason: user response)` |
324
+ | **Discovery complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
325
+
326
+ ---
327
+
358
328
  ## Brain Capture
359
329
 
360
330
  After discovery completes successfully, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
@@ -1,14 +1,14 @@
1
1
  ---
2
- description: This command executes an implementation plan phase by phase, using complexity scores to determine ex
2
+ description: This command executes an implementation plan phase by phase, using complexity scores and wave-based parallel execution to determine ex
3
3
  ---
4
4
 
5
5
  # Execute Implementation Plan
6
6
 
7
7
  ## Command Description
8
8
 
9
- This command executes an implementation plan phase by phase, using complexity scores to determine execution strategy. The command validates inputs and orchestrates the execution process by invoking the `execute-plan` skill.
9
+ This command executes an implementation plan phase by phase, using complexity scores to determine execution strategy. When `wave_execution: true` in `.flowconfig` (default), phases are analyzed for dependencies, grouped into **waves** of independent phases, and executed in parallel within each wave using Agent sub-agents. Tasks with `<verify>` tags are verified immediately after completion — failures are auto-diagnosed by debug sub-agents and repaired in place (up to `max_verify_retries` attempts). The command validates inputs and orchestrates the execution process by invoking the `execute-plan` skill.
10
10
 
11
- **Output**: Implements all phases from the plan, updates progress, and auto-archives the completed plan and its discovery document.
11
+ **Output**: Implements all phases from the plan (sequentially or in parallel waves), updates progress, and auto-archives the completed plan and its discovery document.
12
12
 
13
13
  ---
14
14
 
@@ -22,7 +22,9 @@ This command executes an implementation plan phase by phase, using complexity sc
22
22
 
23
23
  DESCRIPTION:
24
24
  Executes an implementation plan phase by phase, using complexity scores
25
- to determine execution strategy. Switches to Plan mode for each phase.
25
+ to determine execution strategy. Analyzes phase dependencies and groups
26
+ independent phases into parallel waves for faster execution. Switches
27
+ to Plan mode for each phase.
26
28
 
27
29
  USAGE:
28
30
  /execute-plan <plan_file>
@@ -44,13 +46,15 @@ OUTPUT:
44
46
  WORKFLOW:
45
47
  1. Reads and parses the plan file
46
48
  2. Groups phases by complexity score
47
- 3. For EACH phase:
48
- - Auto-switches to Plan mode
49
- - Presents phase details for approval
50
- - Implements after approval
51
- - Updates progress in plan file
52
- 4. Runs npm run build && npm run test (ONLY at the end)
53
- 5. Auto-archives plan and discovery to flow/archive/
49
+ 2b. Analyzes dependencies and groups into waves (if wave_execution enabled)
50
+ 3. Presents wave execution summary (waves, parallelism, estimated speedup)
51
+ 4. For EACH wave:
52
+ - Approves each phase in Plan mode (sequential)
53
+ - Executes wave phases in parallel (or sequential if single phase)
54
+ - Collects results, detects file conflicts
55
+ - Commits per-task in phase/task order (if git enabled)
56
+ 5. Runs npm run build && npm run test (ONLY at the end)
57
+ 6. Auto-archives plan and discovery to flow/archive/
54
58
 
55
59
  EXECUTION STRATEGIES:
56
60
  Combined Score <= 6 Aggregate phases together
@@ -141,6 +145,24 @@ Please run this command and let me know when it's complete.
141
145
 
142
146
  ---
143
147
 
148
+ ## Per-Task Verification
149
+
150
+ When plan phases include tasks with `<verify>` tags, each task is verified immediately after completion using targeted commands (e.g., `npx tsc --noEmit <file>`). Failed verifications trigger a debug sub-agent (haiku) for diagnosis, and the implementation sub-agent applies repairs automatically.
151
+
152
+ ### Configuration
153
+
154
+ | Setting | Default | Range | Description |
155
+ |---------|---------|-------|-------------|
156
+ | `max_verify_retries` | `2` | `1-5` | Max repair attempts per task verification failure |
157
+
158
+ Set via `/flow max_verify_retries=3` or directly in `flow/.flowconfig`.
159
+
160
+ Plans without `<verify>` tags work unchanged — verification is fully backward compatible.
161
+
162
+ See `.claude/resources/core/per-task-verification.md` for verify tag syntax, debug sub-agent details, and JSON schemas.
163
+
164
+ ---
165
+
144
166
  ## Git Control
145
167
 
146
168
  On execution start, check if `flow/.flowconfig` exists — if yes, read git control settings (`commit`, `push`, `branch`) from it. Fallback: check `flow/.gitcontrol` for backward compatibility. If neither exists, no git operations are performed.
@@ -149,20 +171,23 @@ On execution start, check if `flow/.flowconfig` exists — if yes, read git cont
149
171
 
150
172
  ```yaml
151
173
  # flow/.gitcontrol
152
- commit: true # Auto-commit after each completed phase
174
+ commit: true # Auto-commit after each completed task (per-task atomic commits)
153
175
  push: true # Auto-push after all phases complete (requires commit: true)
154
176
  branch: develop # Target branch (optional, defaults to current branch)
177
+ pr: true # Auto-create PR via gh after push (requires push: true)
155
178
  ```
156
179
 
157
180
  ### Git Behavior During Execution
158
181
 
159
182
  | Setting | Behavior |
160
183
  |---------|----------|
161
- | `commit: true` | After each phase completes successfully, run `git add -A && git commit -m "Phase N: <phase name> — <feature>"` |
184
+ | `commit: true` | After each task completes successfully, commit: `git add -A && git commit -m "feat(phase-N.task-M): <desc> — <feature>"` |
162
185
  | `commit: false` or no `.gitcontrol` | No automatic git operations (default behavior) |
163
186
  | `push: true` | After ALL phases complete AND build/test pass, run `git push origin <branch>` |
164
187
  | `push: false` or not set | No automatic push |
165
188
  | `branch: <name>` | Use this branch for push (default: current branch) |
189
+ | `pr: true` | After push, create feature branch feat/<feature> and open PR via gh pr create |
190
+ | `pr: false` or not set | No automatic PR creation |
166
191
 
167
192
  ### Git Safety Rules
168
193
 
@@ -171,21 +196,31 @@ branch: develop # Target branch (optional, defaults to current branch)
171
196
  | **Commit only on success** | Only commit after a phase completes successfully. Never commit broken code. |
172
197
  | **Push only after build+test** | Push only after `npm run build && npm run test` pass at the very end. |
173
198
  | **No force push** | NEVER use `--force`. If push fails, stop and ask the user. |
174
- | **Commit message format** | `Phase N: <phase name> — <feature>` (e.g., "Phase 2: API endpoints — user-auth") |
199
+ | **Commit message format** | `feat(phase-N.task-M): <desc> — <feature>` (e.g., "feat(phase-2.task-1): Implement auth middleware — user-auth") |
175
200
  | **Final commit** | After build+test pass, make one final commit: `Complete: <feature> — all phases done, build passing` |
176
201
  | **Include flow artifacts** | Commits should include updated plan files with progress markers |
202
+ | **PR best-effort** | If gh CLI is missing or PR creation fails, warn and continue. Never block completion. |
203
+ | **Branch naming** | Feature branches use feat/<sanitized-feature-name> (lowercase, hyphens only) |
177
204
 
178
- ### Example Flow with `commit=true push=true`
205
+ ### Example Flow with `commit=true push=true pr=true`
179
206
 
180
207
  ```
181
- Phase 1: Setup types completes → git commit "Phase 1: Setup types — user-auth"
182
- Phase 2: API endpoints completes → git commit "Phase 2: API endpoints — user-auth"
183
- Phase 3: Frontend UI completes → git commit "Phase 3: Frontend UI — user-auth"
184
- Phase 4: Tests completes → git commit "Phase 4: Tests — user-auth"
185
- Build + Test pass → git commit "Complete: user-auth — all phases done, build passing"
208
+ Phase 1: Setup types (2 tasks)
209
+ → git commit "feat(phase-1.task-1): Define user and session types — user-auth"
210
+ → git commit "feat(phase-1.task-2): Create user schema with Prisma — user-auth"
211
+ Phase 2: API endpoints (2 tasks)
212
+ → git commit "feat(phase-2.task-1): Implement auth middleware user-auth"
213
+ → git commit "feat(phase-2.task-2): Add rate limiting to API routes — user-auth"
214
+ Phase 3: Frontend UI (1 task)
215
+ → git commit "feat(phase-3.task-1): Create login form component — user-auth"
216
+ Phase 4: Tests (1 task)
217
+ → git commit "feat(phase-4.task-1): Add unit tests for auth flow — user-auth"
218
+ Build + Test → pass → git commit "Complete: user-auth — all phases done, build passing (vX.Y.Z)"
186
219
  → git push origin development
220
+ → git checkout -b feat/user-auth
221
+ → git push -u origin feat/user-auth
222
+ → gh pr create --title "feat: user-auth" --body "..."
187
223
  ```
188
-
189
224
  ---
190
225
 
191
226
  ## Instructions
@@ -249,6 +284,7 @@ Execution Complete!
249
284
  - X phases completed
250
285
  - All tests passing
251
286
  - Build successful
287
+ - PR: <url> (or "PR creation skipped" if pr=false)
252
288
  - Archived: plan and discovery moved to flow/archive/
253
289
  ```
254
290
 
@@ -276,15 +312,24 @@ Execution Complete!
276
312
  |
277
313
  v
278
314
  +------------------------------------------+
315
+ | Step 2b: Wave Analysis (if enabled) |
316
+ | - Parse Dependencies from each phase |
317
+ | - Build dependency graph |
318
+ | - Group independent phases into waves |
319
+ +------------------------------------------+
320
+ |
321
+ v
322
+ +------------------------------------------+
279
323
  | Step 3: Invoke Execute Plan Skill |
280
- | - Skill handles all execution logic |
324
+ | - Present wave execution summary |
325
+ | - Execute waves (parallel or sequential) |
281
326
  | - See execute-plan-skill.md |
282
327
  +------------------------------------------+
283
328
  |
284
329
  v
285
330
  +------------------------------------------+
286
331
  | Step 4: Handle Completion |
287
- | - Present summary |
332
+ | - Present summary with wave stats |
288
333
  | - Auto-archive plan and discovery |
289
334
  +------------------------------------------+
290
335
  ```
@@ -304,58 +349,18 @@ Execution Complete!
304
349
  5. Final build and test verification
305
350
  6. Auto-archive plan and discovery to flow/archive/
306
351
 
307
- ---
352
+ ## Context Loading
308
353
 
309
- ## Context Optimization
310
-
311
- This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
312
-
313
- ### Recommended Loading Order
314
-
315
- 1. **Always load first**: This command file (`commands/execute-plan.md`)
316
- 2. **Load indexes**: Load `_index.md` files for relevant folders
317
- 3. **Expand on-demand**: Use reference codes to load specific sections when needed
318
-
319
- ### Index Files for Plan Execution
320
-
321
- | Index | When to Load |
322
- |-------|--------------|
323
- | `resources/skills/_index.md` | To understand execution workflow |
324
- | `resources/core/_index.md` | For complexity scoring reference |
325
- | `resources/tools/_index.md` | When switching to Plan mode |
326
-
327
- ### Reference Codes for Plan Execution
328
-
329
- | Code | Description | When to Expand |
330
- |------|-------------|----------------|
331
- | SKL-EXEC-2 | Critical rules (build, DB) | Need build/DB command restrictions |
332
- | SKL-EXEC-4 | Analyze complexity | Determining execution strategy |
333
- | SKL-EXEC-6 | Execute phase with Plan mode | Running a specific phase |
334
- | SKL-EXEC-8 | Phase-boundary compaction | Compacting between phases |
335
- | SKL-EXEC-9 | Handle tests phase | Executing the tests phase |
336
- | SKL-EXEC-10 | Build and test verification | Final verification step |
337
- | SKL-EXEC-11 | Complexity-based behavior | Need low/medium/high behavior details |
338
- | SKL-EXEC-12 | Error handling | Build/test failure or cancellation |
339
- | COR-CS-1 | Complexity scoring table | Interpreting phase complexity |
340
- | TLS-PLN-1 | Plan mode switching | Before each phase |
341
- | TLS-PLN-2 | Plan mode workflow | Presenting phase details |
342
- | COR-CG-1 | Compaction guide purpose | When compacting at phase boundaries |
343
- | COR-CG-2 | Preserve rules | Crafting compact summary — what to keep |
344
- | COR-CG-3 | Discard rules | Crafting compact summary — what to drop |
345
- | COR-CG-4 | Compact summary template | Structuring compact instructions |
346
- | COR-PI-1 | Phase isolation architecture | Understanding isolated sub-agent flow |
347
- | COR-PI-2 | Sub-agent context template | Preparing focused prompt for sub-agent |
348
- | COR-PI-3 | Return format schema | Parsing sub-agent JSON response |
349
- | COR-PI-4 | Coordinator processing rules | Handling success/failure/partial returns |
350
-
351
- ### Expansion Instructions
352
-
353
- When executing this command:
354
-
355
- 1. **Start with indexes**: Read `resources/skills/_index.md` and `resources/core/_index.md`
356
- 2. **Identify needed codes**: Based on current phase, identify which codes are relevant
357
- 3. **Expand as needed**: Use the Read tool with specific line ranges from the index
358
- 4. **Don't expand everything**: Only load content required for the current phase
354
+ This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
355
+
356
+ **Queries**:
357
+ - `planflow-ai state-query "phase execution" --scope resources`
358
+ - `planflow-ai state-query "wave execution" --scope resources`
359
+ - `planflow-ai state-query "phase isolation" --scope resources`
360
+ - `planflow-ai state-query "per-task verification" --scope resources`
361
+ - `planflow-ai state-query "atomic commits" --scope resources`
362
+
363
+ The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
359
364
 
360
365
  ---
361
366
 
@@ -363,9 +368,7 @@ When executing this command:
363
368
 
364
369
  | Resource | Purpose |
365
370
  | -------------------------- | --------------------------------- |
366
- | `resources/skills/_index.md` | Index of skills with reference codes |
367
- | `resources/core/_index.md` | Index of core rules with reference codes |
368
- | `resources/tools/_index.md` | Index of tools with reference codes |
371
+ | `per-task-verification.md` | Per-task verification system, debug sub-agents, JSON schemas |
369
372
  | `execute-plan-skill.md` | Skill that executes the plan |
370
373
  | `plans-patterns.md` | Rules and patterns for plans |
371
374
  | `complexity-scoring.md` | Complexity scoring system |
@@ -375,6 +378,25 @@ When executing this command:
375
378
 
376
379
  ---
377
380
 
381
+ ## STATE.md Updates
382
+
383
+ Update `flow/STATE.md` at these transition points to enable session resumability. Use the Edit tool for single-field updates; overwrite the file on skill start.
384
+
385
+ | Transition Point | Action |
386
+ |-----------------|--------|
387
+ | **Plan start** | Create `flow/STATE.md` with `Active Skill: execute-plan`, `Active Plan: {plan file path}`, `Current Phase: none`, empty Decisions/Blockers/Files Modified, `Next Action: Begin phase execution` |
388
+ | **Phase start** | Update `Current Phase: {N} — {Phase Name}`, `Current Task: first task description`, `Next Action: Implement phase {N}` |
389
+ | **Phase complete** | Append to `Completed Phases` list: `Phase N: Name — {outcome}`, set `Current Phase: none`, `Current Task: none`, `Next Action: Begin next phase` |
390
+ | **Decision made** | Append to `## Decisions`: `{description} (reason: {rationale})` |
391
+ | **Blocker encountered** | Append to `## Blockers`: `{description} (status: open, tried: {what was attempted})` |
392
+ | **Files modified** | Append new file paths to `## Files Modified` (deduplicate) |
393
+ | **Plan complete** | Delete `flow/STATE.md` (execution is done, no state to preserve) |
394
+ | **User cancellation** | Update `Next Action: Resume from phase {N}`, keep STATE.md intact for resumability |
395
+
396
+ **Wave mode**: Update STATE.md before each wave starts (set current wave info) and after each wave completes (update completed phases for all wave phases).
397
+
398
+ ---
399
+
378
400
  ## Brain Capture
379
401
 
380
402
  After each phase completes (and after full execution), append brain-capture blocks. See `.claude/resources/core/brain-capture.md` for processing rules.
@@ -481,6 +503,23 @@ Disable with `/flow model_routing=false`. See `.claude/resources/core/model-rout
481
503
 
482
504
  ---
483
505
 
506
+ ## Wave Execution
507
+
508
+ When `wave_execution: true` in `flow/.flowconfig` (default), the coordinator analyzes phase dependencies, groups independent phases into **waves**, and executes phases within each wave **in parallel** using Agent sub-agents. Waves are sequenced — Wave N+1 starts only after all Wave N phases complete.
509
+
510
+ Key behaviors:
511
+ - **Planning stays sequential** — each phase is approved in Plan mode before wave execution begins
512
+ - **Tests never parallel** — tests phase always runs alone in the final wave
513
+ - **Backward compatible** — plans without `Dependencies` fields execute sequentially (no behavior change)
514
+ - **File conflict detection** — overlapping files_modified between parallel phases are flagged for user resolution
515
+ - **Deterministic commits** — git commits happen per-task in phase/task order after each wave completes: `feat(phase-N.task-M): <desc> — <feature>`
516
+
517
+ User can always choose sequential execution at the wave summary prompt. Disable globally with `/flow wave_execution=false`.
518
+
519
+ See `.claude/resources/core/wave-execution.md` for the full dependency analysis rules, wave grouping algorithm, parallel spawning rules, coordinator behavior, and configuration.
520
+
521
+ ---
522
+
484
523
  ## Phase Isolation
485
524
 
486
525
  When `phase_isolation: true` in `flow/.flowconfig` (default), each phase implementation runs in an **isolated Agent sub-agent** with a clean context window. The sub-agent receives only: phase spec, files modified so far, pattern file paths, and design context (if UI phase). It returns a structured JSON summary (1-2K tokens) with status, files changed, decisions, errors, and captured patterns.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Configure plan-flow settings — autopilot mode, git control, and other runtime options. Use key=value syntax.
2
+ description: Configure plan-flow settings — autopilot mode, git control, PR creation, and other runtime options. Use key=value syntax.
3
3
  ---
4
4
 
5
5
  # Flow: Plan-Flow Configuration
@@ -41,6 +41,11 @@ SETTINGS:
41
41
  branch=<name> Target branch for git operations (default: current branch)
42
42
  model_routing=true|false Auto-select model per phase based on complexity (default: false)
43
43
  phase_isolation=true|false Run each phase in isolated sub-agent with clean context (default: true)
44
+ max_verify_retries=1-5 Max repair attempts per task verification failure (default: 2)
45
+ pr=true|false Auto-create PR via gh after execution (default: false)
46
+ webhook_url=<url> Webhook URL(s) for external notifications, comma-separated (default: "")
47
+ telegram_bot_token=<token> Telegram bot token for two-way messaging (default: "")
48
+ telegram_chat_id=<id> Telegram chat ID for two-way messaging (default: "")
44
49
 
45
50
  COST REPORTING:
46
51
  /flow cost Last 7 days summary (default)
@@ -59,6 +64,12 @@ EXAMPLES:
59
64
  /flow commit=false push=false # Disable git control
60
65
  /flow model_routing=false # Disable model routing (use session model for all phases)
61
66
  /flow phase_isolation=false # Disable phase isolation (inline execution, for debugging)
67
+ /flow max_verify_retries=3 # Set max repair attempts per task verification to 3
68
+ /flow pr=true # Enable auto-PR creation after execute-plan
69
+ /flow commit=true push=true pr=true # Full git control with auto-PR
70
+ /flow webhook_url=https://hooks.slack.com/services/T.../B.../xxx # Set Slack webhook
71
+ /flow webhook_url=https://discord.com/api/webhooks/123/abc,https://hooks.slack.com/services/T.../B.../xxx # Multiple webhooks
72
+ /flow telegram_bot_token=123456:ABC-DEF telegram_chat_id=5635356808 # Enable Telegram two-way
62
73
  /flow cost # Show cost report (last 7 days)
63
74
  /flow cost --today --detail # Today's costs with model breakdown
64
75
  /flow -status # Show current config
@@ -80,6 +91,7 @@ GIT CONTROL (when commit=true):
80
91
  - After all phases + build/test pass: auto-push if push=true
81
92
  - If build/test fails: commit is made but push is skipped
82
93
  - push=true without commit=true: auto-enables commit=true
94
+ - If pr=true: after push, create feature branch and open PR via gh pr create
83
95
 
84
96
  MANDATORY CHECKPOINTS (even in autopilot):
85
97
  - Discovery phase: pauses for user Q&A
@@ -113,6 +125,11 @@ Parse the user input to determine what action to take:
113
125
  | `branch` | any string | current branch | Target branch for git ops |
114
126
  | `model_routing` | `true`, `false` | `false` | Auto-select model per phase based on complexity |
115
127
  | `phase_isolation` | `true`, `false` | `true` | Run each phase in isolated sub-agent with clean context |
128
+ | `max_verify_retries` | `1`-`5` | `2` | Max repair attempts per task verification failure |
129
+ | `pr` | `true`, `false` | `false` | Auto-create PR after execution completes (requires push: true) |
130
+ | `webhook_url` | URL string | `""` | Webhook URL(s) for Telegram/Discord/Slack notifications (comma-separated) |
131
+ | `telegram_bot_token` | any string | `""` | Telegram bot token for two-way polling |
132
+ | `telegram_chat_id` | any string | `""` | Telegram chat ID for two-way polling |
116
133
 
117
134
  ---
118
135
 
@@ -130,7 +147,10 @@ Parse the user input to determine what action to take:
130
147
 
131
148
  1. If `push=true` but `commit` is not `true`, auto-enable `commit=true` and warn:
132
149
  > `push=true` requires `commit=true`. Enabling auto-commit as well.
133
- 2. If `autopilot=false` and `commit=false` and no other settings, consider removing `.flowconfig`
150
+ 2. If `pr=true` but `push` is not `true`, auto-enable `push=true` and `commit=true` and warn:
151
+ > `pr=true` requires `push=true` and `commit=true`. Enabling both.
152
+ 3. If `autopilot=false` and `commit=false` and no other settings, consider removing `.flowconfig`
153
+ 4. If `max_verify_retries` is set, validate it is an integer between 1 and 5 (inclusive). If out of range, warn and clamp to nearest valid value.
134
154
 
135
155
  ---
136
156
 
@@ -244,6 +264,11 @@ push: false
244
264
  branch: ""
245
265
  model_routing: false
246
266
  phase_isolation: true
267
+ max_verify_retries: 2
268
+ pr: false
269
+ webhook_url: ""
270
+ telegram_bot_token: ""
271
+ telegram_chat_id: ""
247
272
  ```
248
273
 
249
274
  **Location**: `flow/.flowconfig`