planflow-ai 1.3.4 → 1.4.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 (90) hide show
  1. package/.claude/commands/create-plan.md +11 -0
  2. package/.claude/commands/discovery-plan.md +12 -0
  3. package/.claude/commands/execute-plan.md +114 -23
  4. package/.claude/commands/flow.md +30 -5
  5. package/.claude/commands/resume-work.md +261 -0
  6. package/.claude/commands/review-code.md +11 -0
  7. package/.claude/commands/review-pr.md +11 -0
  8. package/.claude/resources/core/_index.md +45 -2
  9. package/.claude/resources/core/atomic-commits.md +380 -0
  10. package/.claude/resources/core/autopilot-mode.md +3 -2
  11. package/.claude/resources/core/compaction-guide.md +15 -1
  12. package/.claude/resources/core/heartbeat.md +129 -1
  13. package/.claude/resources/core/model-routing.md +6 -2
  14. package/.claude/resources/core/per-task-verification.md +362 -0
  15. package/.claude/resources/core/phase-isolation.md +192 -4
  16. package/.claude/resources/core/session-scratchpad.md +1 -0
  17. package/.claude/resources/core/wave-execution.md +329 -0
  18. package/.claude/resources/patterns/plans-patterns.md +56 -0
  19. package/.claude/resources/patterns/plans-templates.md +152 -0
  20. package/.claude/resources/skills/_index.md +8 -6
  21. package/.claude/resources/skills/create-plan-skill.md +71 -5
  22. package/.claude/resources/skills/execute-plan-skill.md +357 -12
  23. package/.claude/resources/skills/resume-work-skill.md +159 -0
  24. package/.claude/rules/core/forbidden-patterns.md +38 -0
  25. package/dist/cli/commands/init.js +1 -1
  26. package/dist/cli/commands/init.js.map +1 -1
  27. package/dist/cli/commands/state.d.ts +12 -0
  28. package/dist/cli/commands/state.d.ts.map +1 -0
  29. package/dist/cli/commands/state.js +47 -0
  30. package/dist/cli/commands/state.js.map +1 -0
  31. package/dist/cli/daemon/desktop-notifier.d.ts +16 -0
  32. package/dist/cli/daemon/desktop-notifier.d.ts.map +1 -0
  33. package/dist/cli/daemon/desktop-notifier.js +53 -0
  34. package/dist/cli/daemon/desktop-notifier.js.map +1 -0
  35. package/dist/cli/daemon/event-writer.d.ts +22 -0
  36. package/dist/cli/daemon/event-writer.d.ts.map +1 -0
  37. package/dist/cli/daemon/event-writer.js +76 -0
  38. package/dist/cli/daemon/event-writer.js.map +1 -0
  39. package/dist/cli/daemon/heartbeat-daemon.js +81 -1
  40. package/dist/cli/daemon/heartbeat-daemon.js.map +1 -1
  41. package/dist/cli/daemon/log-writer.d.ts +17 -0
  42. package/dist/cli/daemon/log-writer.d.ts.map +1 -0
  43. package/dist/cli/daemon/log-writer.js +62 -0
  44. package/dist/cli/daemon/log-writer.js.map +1 -0
  45. package/dist/cli/daemon/notification-router.d.ts +17 -0
  46. package/dist/cli/daemon/notification-router.d.ts.map +1 -0
  47. package/dist/cli/daemon/notification-router.js +35 -0
  48. package/dist/cli/daemon/notification-router.js.map +1 -0
  49. package/dist/cli/daemon/prompt-manager.d.ts +27 -0
  50. package/dist/cli/daemon/prompt-manager.d.ts.map +1 -0
  51. package/dist/cli/daemon/prompt-manager.js +107 -0
  52. package/dist/cli/daemon/prompt-manager.js.map +1 -0
  53. package/dist/cli/index.js +9 -0
  54. package/dist/cli/index.js.map +1 -1
  55. package/dist/cli/state/flowconfig-parser.d.ts +16 -0
  56. package/dist/cli/state/flowconfig-parser.d.ts.map +1 -0
  57. package/dist/cli/state/flowconfig-parser.js +166 -0
  58. package/dist/cli/state/flowconfig-parser.js.map +1 -0
  59. package/dist/cli/state/heartbeat-state.d.ts +16 -0
  60. package/dist/cli/state/heartbeat-state.d.ts.map +1 -0
  61. package/dist/cli/state/heartbeat-state.js +97 -0
  62. package/dist/cli/state/heartbeat-state.js.map +1 -0
  63. package/dist/cli/state/model-router.d.ts +8 -0
  64. package/dist/cli/state/model-router.d.ts.map +1 -0
  65. package/dist/cli/state/model-router.js +36 -0
  66. package/dist/cli/state/model-router.js.map +1 -0
  67. package/dist/cli/state/plan-parser.d.ts +16 -0
  68. package/dist/cli/state/plan-parser.d.ts.map +1 -0
  69. package/dist/cli/state/plan-parser.js +124 -0
  70. package/dist/cli/state/plan-parser.js.map +1 -0
  71. package/dist/cli/state/session-state.d.ts +21 -0
  72. package/dist/cli/state/session-state.d.ts.map +1 -0
  73. package/dist/cli/state/session-state.js +36 -0
  74. package/dist/cli/state/session-state.js.map +1 -0
  75. package/dist/cli/state/state-md-parser.d.ts +18 -0
  76. package/dist/cli/state/state-md-parser.d.ts.map +1 -0
  77. package/dist/cli/state/state-md-parser.js +222 -0
  78. package/dist/cli/state/state-md-parser.js.map +1 -0
  79. package/dist/cli/state/types.d.ts +106 -0
  80. package/dist/cli/state/types.d.ts.map +1 -0
  81. package/dist/cli/state/types.js +8 -0
  82. package/dist/cli/state/types.js.map +1 -0
  83. package/dist/cli/state/wave-calculator.d.ts +18 -0
  84. package/dist/cli/state/wave-calculator.d.ts.map +1 -0
  85. package/dist/cli/state/wave-calculator.js +134 -0
  86. package/dist/cli/state/wave-calculator.js.map +1 -0
  87. package/dist/cli/types.d.ts +15 -0
  88. package/dist/cli/types.d.ts.map +1 -1
  89. package/package.json +4 -2
  90. package/templates/shared/CLAUDE.md.template +4 -0
@@ -301,6 +301,17 @@ Present recommendations after the plan summary.
301
301
 
302
302
  ---
303
303
 
304
+ ## STATE.md Updates
305
+
306
+ Update `flow/STATE.md` at these transition points to enable session resumability.
307
+
308
+ | Transition Point | Action |
309
+ |-----------------|--------|
310
+ | **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` |
311
+ | **Plan complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
312
+
313
+ ---
314
+
304
315
  ## Brain Capture
305
316
 
306
317
  After plan creation completes successfully, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
@@ -355,6 +355,18 @@ These are optional but recommended to reduce implementation friction.
355
355
 
356
356
  ---
357
357
 
358
+ ## STATE.md Updates
359
+
360
+ Update `flow/STATE.md` at these transition points to enable session resumability.
361
+
362
+ | Transition Point | Action |
363
+ |-----------------|--------|
364
+ | **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` |
365
+ | **Question batch complete** | Append answered questions to `## Decisions`: `{question} → {answer} (reason: user response)` |
366
+ | **Discovery complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
367
+
368
+ ---
369
+
358
370
  ## Brain Capture
359
371
 
360
372
  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
  ```
@@ -347,6 +392,15 @@ This command uses hierarchical context loading to reduce context consumption. In
347
392
  | COR-PI-2 | Sub-agent context template | Preparing focused prompt for sub-agent |
348
393
  | COR-PI-3 | Return format schema | Parsing sub-agent JSON response |
349
394
  | COR-PI-4 | Coordinator processing rules | Handling success/failure/partial returns |
395
+ | COR-WAVE-1 | Wave execution architecture and dependency syntax | Need wave execution architecture or dependency declaration syntax |
396
+ | COR-WAVE-2 | Wave grouping algorithm (topological sort) | Need wave grouping algorithm or backward compatibility rules |
397
+ | COR-WAVE-3 | Parallel spawning rules and wave summary format | Need parallel spawning rules or wave execution summary format |
398
+ | COR-WAVE-4 | Wave coordinator behavior and failure handling | Need wave coordinator behavior, file conflict detection, or failure handling |
399
+ | COR-WAVE-5 | Wave execution configuration and interaction matrix | Need wave execution configuration, interaction matrix, or aggregation rules |
400
+ | COR-PTV-1 | Per-task verification architecture and verify tag syntax | Need verification system overview or `<verify>` tag parsing rules |
401
+ | COR-PTV-2 | Debug sub-agent prompt template and return schema | Need debug sub-agent configuration or diagnosis JSON format |
402
+ | COR-PTV-3 | Verification loop flow and retry behavior | Need verification loop details or retry/escalation rules |
403
+ | COR-PTV-4 | Task verifications JSON return field schema | Need `task_verifications` array format or field descriptions |
350
404
 
351
405
  ### Expansion Instructions
352
406
 
@@ -366,6 +420,7 @@ When executing this command:
366
420
  | `resources/skills/_index.md` | Index of skills with reference codes |
367
421
  | `resources/core/_index.md` | Index of core rules with reference codes |
368
422
  | `resources/tools/_index.md` | Index of tools with reference codes |
423
+ | `per-task-verification.md` | Per-task verification system, debug sub-agents, JSON schemas |
369
424
  | `execute-plan-skill.md` | Skill that executes the plan |
370
425
  | `plans-patterns.md` | Rules and patterns for plans |
371
426
  | `complexity-scoring.md` | Complexity scoring system |
@@ -375,6 +430,25 @@ When executing this command:
375
430
 
376
431
  ---
377
432
 
433
+ ## STATE.md Updates
434
+
435
+ 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.
436
+
437
+ | Transition Point | Action |
438
+ |-----------------|--------|
439
+ | **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` |
440
+ | **Phase start** | Update `Current Phase: {N} — {Phase Name}`, `Current Task: first task description`, `Next Action: Implement phase {N}` |
441
+ | **Phase complete** | Append to `Completed Phases` list: `Phase N: Name — {outcome}`, set `Current Phase: none`, `Current Task: none`, `Next Action: Begin next phase` |
442
+ | **Decision made** | Append to `## Decisions`: `{description} (reason: {rationale})` |
443
+ | **Blocker encountered** | Append to `## Blockers`: `{description} (status: open, tried: {what was attempted})` |
444
+ | **Files modified** | Append new file paths to `## Files Modified` (deduplicate) |
445
+ | **Plan complete** | Delete `flow/STATE.md` (execution is done, no state to preserve) |
446
+ | **User cancellation** | Update `Next Action: Resume from phase {N}`, keep STATE.md intact for resumability |
447
+
448
+ **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).
449
+
450
+ ---
451
+
378
452
  ## Brain Capture
379
453
 
380
454
  After each phase completes (and after full execution), append brain-capture blocks. See `.claude/resources/core/brain-capture.md` for processing rules.
@@ -481,6 +555,23 @@ Disable with `/flow model_routing=false`. See `.claude/resources/core/model-rout
481
555
 
482
556
  ---
483
557
 
558
+ ## Wave Execution
559
+
560
+ 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.
561
+
562
+ Key behaviors:
563
+ - **Planning stays sequential** — each phase is approved in Plan mode before wave execution begins
564
+ - **Tests never parallel** — tests phase always runs alone in the final wave
565
+ - **Backward compatible** — plans without `Dependencies` fields execute sequentially (no behavior change)
566
+ - **File conflict detection** — overlapping files_modified between parallel phases are flagged for user resolution
567
+ - **Deterministic commits** — git commits happen per-task in phase/task order after each wave completes: `feat(phase-N.task-M): <desc> — <feature>`
568
+
569
+ User can always choose sequential execution at the wave summary prompt. Disable globally with `/flow wave_execution=false`.
570
+
571
+ See `.claude/resources/core/wave-execution.md` for the full dependency analysis rules, wave grouping algorithm, parallel spawning rules, coordinator behavior, and configuration.
572
+
573
+ ---
574
+
484
575
  ## Phase Isolation
485
576
 
486
577
  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
@@ -39,8 +39,13 @@ SETTINGS:
39
39
  commit=true|false Auto-commit after each completed phase (default: false)
40
40
  push=true|false Auto-push after all phases + build/test pass (default: false)
41
41
  branch=<name> Target branch for git operations (default: current branch)
42
- model_routing=true|false Auto-select model per phase based on complexity (default: true)
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
@@ -111,8 +123,13 @@ Parse the user input to determine what action to take:
111
123
  | `commit` | `true`, `false` | `false` | Auto-commit after each phase |
112
124
  | `push` | `true`, `false` | `false` | Auto-push after completion |
113
125
  | `branch` | any string | current branch | Target branch for git ops |
114
- | `model_routing` | `true`, `false` | `true` | Auto-select model per phase based on complexity |
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
 
@@ -242,8 +262,13 @@ autopilot: false
242
262
  commit: false
243
263
  push: false
244
264
  branch: ""
245
- model_routing: true
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`
@@ -0,0 +1,261 @@
1
+ # Resume Work
2
+
3
+ ## Command Description
4
+
5
+ This command reads `flow/STATE.md` and reconstructs full session context after a context reset (compaction, new session, crash). It identifies the active work, reads the relevant plan/discovery file, and outputs a structured summary that puts the LLM back in context.
6
+
7
+ **Output**: Structured context summary displayed in chat — no files created or modified.
8
+
9
+ ---
10
+
11
+ ## Help
12
+
13
+ **If the user invokes this command with `-help`, display only this section and stop:**
14
+
15
+ ```
16
+ /resume-work - Resume Work from Saved State
17
+
18
+ DESCRIPTION:
19
+ Reads flow/STATE.md and reconstructs session context after a context
20
+ reset. Identifies active work, reads relevant plan files, and outputs
21
+ a structured summary to resume where you left off.
22
+
23
+ USAGE:
24
+ /resume-work
25
+ /resume-work -help
26
+
27
+ ARGUMENTS:
28
+ None — reads STATE.md automatically.
29
+
30
+ EXAMPLES:
31
+ /resume-work
32
+
33
+ OUTPUT:
34
+ Displays structured context summary with:
35
+ - Active skill and plan
36
+ - Current phase and task
37
+ - Decisions made so far
38
+ - Blockers encountered
39
+ - Files modified
40
+ - Next action to take
41
+
42
+ WORKFLOW:
43
+ 1. Validates flow/STATE.md exists
44
+ 2. Reads and parses STATE.md
45
+ 3. Checks staleness (warns if >24h old)
46
+ 4. Reads active plan file (if any)
47
+ 5. Identifies next task/phase
48
+ 6. Outputs structured context summary
49
+
50
+ RELATED COMMANDS:
51
+ /execute-plan Continue executing a plan
52
+ /flow Check flow configuration
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Critical Rules
58
+
59
+ | Rule | Description |
60
+ |------|-------------|
61
+ | **Read-Only** | This command does NOT create, modify, or delete any files |
62
+ | **No Auto-Chaining** | After presenting the summary, STOP and wait for user (unless autopilot ON) |
63
+ | **No Code Execution** | Do NOT run build, test, or any implementation commands |
64
+ | **STATE.md Required** | If STATE.md doesn't exist, inform the user — do NOT create it |
65
+ | **Plan File is Truth** | If STATE.md references a plan, read the plan file for authoritative task status |
66
+
67
+ ---
68
+
69
+ ## Instructions
70
+
71
+ ### Step 1: Validate STATE.md Exists
72
+
73
+ Check if `flow/STATE.md` exists.
74
+
75
+ **If it does NOT exist**:
76
+ ```markdown
77
+ No active session state found (`flow/STATE.md` does not exist).
78
+
79
+ This means either:
80
+ - No skill was in progress when the session ended
81
+ - The previous skill completed successfully and cleared its state
82
+
83
+ Use `/execute-plan`, `/discovery-plan`, or another command to start new work.
84
+ ```
85
+ **STOP** — do not proceed.
86
+
87
+ ---
88
+
89
+ ### Step 2: Read and Parse STATE.md
90
+
91
+ Read `flow/STATE.md` and extract:
92
+ - **Active Skill**: The skill that was running
93
+ - **Active Plan**: Path to the plan file being executed
94
+ - **Current Phase**: Phase number and name
95
+ - **Current Task**: The specific task in progress
96
+ - **Completed Phases**: List of completed phases with outcomes
97
+ - **Decisions**: Decisions made during the session
98
+ - **Blockers**: Issues encountered and their status
99
+ - **Files Modified**: Files changed during the session
100
+ - **Next Action**: What to do immediately
101
+
102
+ ---
103
+
104
+ ### Step 3: Staleness Check
105
+
106
+ Parse the `**Updated**` timestamp from STATE.md.
107
+
108
+ **If the timestamp is more than 24 hours old**:
109
+ ```markdown
110
+ > **Stale State Warning**: STATE.md was last updated {time_ago} ({timestamp}).
111
+ > The session state may be outdated.
112
+ >
113
+ > Options:
114
+ > 1. **Resume anyway** — continue from where STATE.md left off
115
+ > 2. **Start fresh** — delete STATE.md and begin new work
116
+ ```
117
+
118
+ Wait for user response before proceeding.
119
+
120
+ **If the timestamp is within 24 hours**: Continue silently.
121
+
122
+ ---
123
+
124
+ ### Step 4: Read Active Plan File
125
+
126
+ If STATE.md references an active plan (`Active Plan` is not "none"):
127
+ 1. Read the plan file
128
+ 2. Cross-reference completed phases in STATE.md with task checkboxes in the plan
129
+ 3. Identify the next uncompleted task
130
+
131
+ If the plan file doesn't exist, note this as a warning.
132
+
133
+ ---
134
+
135
+ ### Step 5: Output Context Summary
136
+
137
+ Present the reconstructed context:
138
+
139
+ ```markdown
140
+ ## Session Resumed
141
+
142
+ **Active Skill**: {skill name}
143
+ **Active Plan**: `{plan file path}`
144
+ **Progress**: Phase {N} of {total} — {phase name}
145
+
146
+ ### Completed Phases
147
+ {list of completed phases with outcomes}
148
+
149
+ ### Decisions Made
150
+ {list of decisions with rationale}
151
+
152
+ ### Blockers
153
+ {list of blockers with status}
154
+
155
+ ### Files Modified
156
+ {list of files changed}
157
+
158
+ ### Next Action
159
+ > {next action from STATE.md}
160
+
161
+ ---
162
+
163
+ Ready to continue. Run the active skill command or describe what you'd like to do next.
164
+ ```
165
+
166
+ ---
167
+
168
+ ### Step 6: Stop and Wait
169
+
170
+ After presenting the summary, **STOP**. Do not auto-invoke any commands.
171
+
172
+ ---
173
+
174
+ ## Flow Diagram
175
+
176
+ ```
177
+ +------------------------------------------+
178
+ | /resume-work COMMAND |
179
+ +------------------------------------------+
180
+ |
181
+ v
182
+ +------------------------------------------+
183
+ | Step 1: Validate STATE.md Exists |
184
+ | - If missing: inform user and stop |
185
+ +------------------------------------------+
186
+ |
187
+ v
188
+ +------------------------------------------+
189
+ | Step 2: Read and Parse STATE.md |
190
+ | - Extract all sections |
191
+ +------------------------------------------+
192
+ |
193
+ v
194
+ +------------------------------------------+
195
+ | Step 3: Staleness Check |
196
+ | - Warn if >24h old |
197
+ | - Ask user: resume or start fresh |
198
+ +------------------------------------------+
199
+ |
200
+ v
201
+ +------------------------------------------+
202
+ | Step 4: Read Active Plan File |
203
+ | - Cross-reference with STATE.md |
204
+ | - Identify next task |
205
+ +------------------------------------------+
206
+ |
207
+ v
208
+ +------------------------------------------+
209
+ | Step 5: Output Context Summary |
210
+ | - Structured markdown with all state |
211
+ +------------------------------------------+
212
+ |
213
+ v
214
+ +------------------------------------------+
215
+ | Step 6: Stop and Wait |
216
+ | - User decides next action |
217
+ +------------------------------------------+
218
+ ```
219
+
220
+ ---
221
+
222
+ ## STATE.md Updates
223
+
224
+ This command does NOT update STATE.md. It is read-only.
225
+
226
+ ---
227
+
228
+ ## Brain Capture
229
+
230
+ After resume completes, append a brain-capture block:
231
+
232
+ ```
233
+ <!-- brain-capture
234
+ skill: resume-work
235
+ feature: [feature from active plan]
236
+ status: completed
237
+ data:
238
+ active_skill: [skill being resumed]
239
+ active_plan: [plan file path]
240
+ phase_resumed: [phase number]
241
+ staleness_hours: [hours since last update]
242
+ -->
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Tasklist Updates
248
+
249
+ This command does NOT update the tasklist. It is read-only.
250
+
251
+ ---
252
+
253
+ ## Related Resources
254
+
255
+ | Resource | Purpose |
256
+ |----------|---------|
257
+ | `resources/skills/resume-work-skill.md` | Skill implementation details |
258
+ | `resources/core/compaction-guide.md` | What to preserve during compaction |
259
+ | `resources/core/session-scratchpad.md` | Complementary session notes |
260
+ | `/execute-plan` command | Continue plan execution |
261
+ | `/flow` command | Check flow configuration |
@@ -225,6 +225,17 @@ Run any of these to build structured understanding before or after merging.
225
225
 
226
226
  ---
227
227
 
228
+ ## STATE.md Updates
229
+
230
+ Update `flow/STATE.md` at these transition points to enable session resumability.
231
+
232
+ | Transition Point | Action |
233
+ |-----------------|--------|
234
+ | **Review start** | Create `flow/STATE.md` with `Active Skill: review-code`, `Active Plan: none`, `Current Phase: none`, `Current Task: reviewing {scope}`, `Next Action: Analyze changes and generate review` |
235
+ | **Review complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
236
+
237
+ ---
238
+
228
239
  ## Brain Capture
229
240
 
230
241
  After code review completes, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
@@ -225,6 +225,17 @@ Run any of these to build structured understanding before or after merging.
225
225
 
226
226
  ---
227
227
 
228
+ ## STATE.md Updates
229
+
230
+ Update `flow/STATE.md` at these transition points to enable session resumability.
231
+
232
+ | Transition Point | Action |
233
+ |-----------------|--------|
234
+ | **Review start** | Create `flow/STATE.md` with `Active Skill: review-pr`, `Active Plan: none`, `Current Phase: none`, `Current Task: reviewing PR #{number}`, `Next Action: Authenticate, fetch PR, and analyze` |
235
+ | **Review complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
236
+
237
+ ---
238
+
228
239
  ## Brain Capture
229
240
 
230
241
  After PR review completes, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.