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.
- package/.claude/commands/brainstorm.md +6 -14
- package/.claude/commands/create-contract.md +6 -38
- package/.claude/commands/create-plan.md +18 -38
- package/.claude/commands/discovery-plan.md +19 -49
- package/.claude/commands/execute-plan.md +116 -77
- package/.claude/commands/flow.md +27 -2
- package/.claude/commands/heartbeat.md +12 -14
- package/.claude/commands/learn.md +20 -80
- package/.claude/commands/note.md +6 -23
- package/.claude/commands/resume-work.md +261 -0
- package/.claude/commands/review-code.md +19 -51
- package/.claude/commands/review-pr.md +21 -57
- package/.claude/commands/setup.md +8 -56
- package/.claude/commands/write-tests.md +7 -41
- package/.claude/resources/core/atomic-commits.md +380 -0
- package/.claude/resources/core/autopilot-mode.md +3 -2
- package/.claude/resources/core/compaction-guide.md +15 -1
- package/.claude/resources/core/heartbeat.md +129 -1
- package/.claude/resources/core/per-task-verification.md +362 -0
- package/.claude/resources/core/phase-isolation.md +237 -4
- package/.claude/resources/core/session-scratchpad.md +1 -0
- package/.claude/resources/core/shared-context.md +110 -0
- package/.claude/resources/core/wave-execution.md +407 -0
- package/.claude/resources/patterns/plans-patterns.md +56 -0
- package/.claude/resources/patterns/plans-templates.md +152 -0
- package/.claude/resources/skills/create-plan-skill.md +71 -5
- package/.claude/resources/skills/execute-plan-skill.md +420 -14
- package/.claude/resources/skills/resume-work-skill.md +159 -0
- package/README.md +154 -96
- package/dist/cli/commands/brain.d.ts +20 -0
- package/dist/cli/commands/brain.d.ts.map +1 -0
- package/dist/cli/commands/brain.js +127 -0
- package/dist/cli/commands/brain.js.map +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +10 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/state-query.d.ts +13 -0
- package/dist/cli/commands/state-query.d.ts.map +1 -0
- package/dist/cli/commands/state-query.js +32 -0
- package/dist/cli/commands/state-query.js.map +1 -0
- package/dist/cli/commands/state.d.ts +12 -0
- package/dist/cli/commands/state.d.ts.map +1 -0
- package/dist/cli/commands/state.js +47 -0
- package/dist/cli/commands/state.js.map +1 -0
- package/dist/cli/daemon/desktop-notifier.d.ts +16 -0
- package/dist/cli/daemon/desktop-notifier.d.ts.map +1 -0
- package/dist/cli/daemon/desktop-notifier.js +53 -0
- package/dist/cli/daemon/desktop-notifier.js.map +1 -0
- package/dist/cli/daemon/event-writer.d.ts +22 -0
- package/dist/cli/daemon/event-writer.d.ts.map +1 -0
- package/dist/cli/daemon/event-writer.js +76 -0
- package/dist/cli/daemon/event-writer.js.map +1 -0
- package/dist/cli/daemon/heartbeat-daemon.js +81 -1
- package/dist/cli/daemon/heartbeat-daemon.js.map +1 -1
- package/dist/cli/daemon/log-writer.d.ts +17 -0
- package/dist/cli/daemon/log-writer.d.ts.map +1 -0
- package/dist/cli/daemon/log-writer.js +62 -0
- package/dist/cli/daemon/log-writer.js.map +1 -0
- package/dist/cli/daemon/notification-router.d.ts +17 -0
- package/dist/cli/daemon/notification-router.d.ts.map +1 -0
- package/dist/cli/daemon/notification-router.js +35 -0
- package/dist/cli/daemon/notification-router.js.map +1 -0
- package/dist/cli/daemon/prompt-manager.d.ts +27 -0
- package/dist/cli/daemon/prompt-manager.d.ts.map +1 -0
- package/dist/cli/daemon/prompt-manager.js +107 -0
- package/dist/cli/daemon/prompt-manager.js.map +1 -0
- package/dist/cli/daemon/shared-context.d.ts +38 -0
- package/dist/cli/daemon/shared-context.d.ts.map +1 -0
- package/dist/cli/daemon/shared-context.js +129 -0
- package/dist/cli/daemon/shared-context.js.map +1 -0
- package/dist/cli/handlers/claude.d.ts.map +1 -1
- package/dist/cli/handlers/claude.js +18 -0
- package/dist/cli/handlers/claude.js.map +1 -1
- package/dist/cli/handlers/shared.js +1 -1
- package/dist/cli/handlers/shared.js.map +1 -1
- package/dist/cli/index.js +30 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/state/brain-query.d.ts +48 -0
- package/dist/cli/state/brain-query.d.ts.map +1 -0
- package/dist/cli/state/brain-query.js +113 -0
- package/dist/cli/state/brain-query.js.map +1 -0
- package/dist/cli/state/flowconfig-parser.d.ts +16 -0
- package/dist/cli/state/flowconfig-parser.d.ts.map +1 -0
- package/dist/cli/state/flowconfig-parser.js +166 -0
- package/dist/cli/state/flowconfig-parser.js.map +1 -0
- package/dist/cli/state/heartbeat-state.d.ts +16 -0
- package/dist/cli/state/heartbeat-state.d.ts.map +1 -0
- package/dist/cli/state/heartbeat-state.js +97 -0
- package/dist/cli/state/heartbeat-state.js.map +1 -0
- package/dist/cli/state/model-router.d.ts +8 -0
- package/dist/cli/state/model-router.d.ts.map +1 -0
- package/dist/cli/state/model-router.js +36 -0
- package/dist/cli/state/model-router.js.map +1 -0
- package/dist/cli/state/plan-parser.d.ts +16 -0
- package/dist/cli/state/plan-parser.d.ts.map +1 -0
- package/dist/cli/state/plan-parser.js +124 -0
- package/dist/cli/state/plan-parser.js.map +1 -0
- package/dist/cli/state/session-state.d.ts +21 -0
- package/dist/cli/state/session-state.d.ts.map +1 -0
- package/dist/cli/state/session-state.js +36 -0
- package/dist/cli/state/session-state.js.map +1 -0
- package/dist/cli/state/state-md-parser.d.ts +18 -0
- package/dist/cli/state/state-md-parser.d.ts.map +1 -0
- package/dist/cli/state/state-md-parser.js +222 -0
- package/dist/cli/state/state-md-parser.js.map +1 -0
- package/dist/cli/state/types.d.ts +137 -0
- package/dist/cli/state/types.d.ts.map +1 -0
- package/dist/cli/state/types.js +8 -0
- package/dist/cli/state/types.js.map +1 -0
- package/dist/cli/state/wave-calculator.d.ts +18 -0
- package/dist/cli/state/wave-calculator.d.ts.map +1 -0
- package/dist/cli/state/wave-calculator.js +134 -0
- package/dist/cli/state/wave-calculator.js.map +1 -0
- package/dist/cli/types.d.ts +15 -0
- package/dist/cli/types.d.ts.map +1 -1
- package/package.json +7 -2
- package/templates/shared/CLAUDE.md.template +4 -0
- package/.claude/resources/core/_index.md +0 -304
- package/.claude/resources/languages/_index.md +0 -76
- package/.claude/resources/patterns/_index.md +0 -200
- package/.claude/resources/skills/_index.md +0 -285
- package/.claude/resources/tools/_index.md +0 -110
- package/.claude/resources/tools/reference-expansion-tool.md +0 -326
|
@@ -93,19 +93,6 @@ RELATED COMMANDS:
|
|
|
93
93
|
1. Read `flow/heartbeat.md`
|
|
94
94
|
2. Display all tasks with their schedule, status, and description
|
|
95
95
|
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Context Optimization
|
|
99
|
-
|
|
100
|
-
### Reference Codes for Heartbeat
|
|
101
|
-
|
|
102
|
-
| Code | Description | When to Expand |
|
|
103
|
-
|------|-------------|----------------|
|
|
104
|
-
| COR-HB-1 | Heartbeat file format and schedule syntax | Creating or editing heartbeat tasks |
|
|
105
|
-
| COR-HB-2 | Daemon architecture and CLI commands | Starting/stopping the daemon |
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
96
|
## Brain Capture
|
|
110
97
|
|
|
111
98
|
<!-- brain-capture
|
|
@@ -117,9 +104,20 @@ captures:
|
|
|
117
104
|
|
|
118
105
|
---
|
|
119
106
|
|
|
107
|
+
## Context Loading
|
|
108
|
+
|
|
109
|
+
This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
|
|
110
|
+
|
|
111
|
+
**Queries**:
|
|
112
|
+
- `planflow-ai state-query "heartbeat daemon" --scope resources`
|
|
113
|
+
- `planflow-ai state-query "scheduled tasks" --scope resources`
|
|
114
|
+
|
|
115
|
+
The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
120
119
|
## Related Resources
|
|
121
120
|
|
|
122
121
|
| Resource | Purpose |
|
|
123
122
|
|----------|---------|
|
|
124
123
|
| `resources/core/heartbeat.md` | File format rules and daemon architecture |
|
|
125
|
-
| `resources/core/_index.md` | Index of core rules with reference codes |
|
|
@@ -76,7 +76,7 @@ TEACHING MODE (/learn about <topic>):
|
|
|
76
76
|
Completed curricula are saved globally and reused across projects.
|
|
77
77
|
|
|
78
78
|
Output: ~/plan-flow/brain/learns/{topic-kebab}.md (global)
|
|
79
|
-
Index:
|
|
79
|
+
Index: Indexed via brain query system (searchable with state-query)
|
|
80
80
|
|
|
81
81
|
RELATED COMMANDS:
|
|
82
82
|
/note Capture meeting notes, ideas, brainstorms
|
|
@@ -248,7 +248,7 @@ Before designing the curriculum:
|
|
|
248
248
|
|
|
249
249
|
1. **Use web search** to get up-to-date information (official docs, latest version, recent changes)
|
|
250
250
|
2. **Read the project's stack** from `flow/brain/index.md` and `flow/references/tech-foundation.md`
|
|
251
|
-
3. **Check existing learns**
|
|
251
|
+
3. **Check existing learns** via `planflow-ai state-query "{topic}" --scope learns` — if the topic already exists, offer to resume, expand, or start fresh
|
|
252
252
|
|
|
253
253
|
### Step 3: Design an Adaptive Curriculum
|
|
254
254
|
|
|
@@ -305,7 +305,7 @@ After all steps are confirmed (or user stops early):
|
|
|
305
305
|
|
|
306
306
|
**For general knowledge / concept:**
|
|
307
307
|
1. Save to `~/plan-flow/brain/learns/{topic-kebab}.md`
|
|
308
|
-
2. Auto-
|
|
308
|
+
2. Auto-indexed by the brain query system (searchable via `planflow-ai state-query`)
|
|
309
309
|
3. Update `flow/brain/index.md` with `## Global Learns` section
|
|
310
310
|
|
|
311
311
|
**For project implementation:**
|
|
@@ -370,65 +370,15 @@ After all steps are confirmed (or user stops early):
|
|
|
370
370
|
- [[{project-name}]]
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
### Learns Index
|
|
373
|
+
### Learns Index
|
|
374
374
|
|
|
375
|
-
|
|
376
|
-
# Global Learns Index
|
|
377
|
-
|
|
378
|
-
## Overview
|
|
379
|
-
|
|
380
|
-
Shared learning curricula accumulated across all projects. Use reference codes to load specific sections on-demand.
|
|
381
|
-
|
|
382
|
-
**Total Files**: X files
|
|
383
|
-
**Reference Codes**: LRN-{ABBR}-1 through LRN-{ABBR}-N
|
|
384
|
-
**Last Updated**: YYYY-MM-DD
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
## Reference Codes
|
|
389
|
-
|
|
390
|
-
### MCP (`mcp.md`)
|
|
391
|
-
|
|
392
|
-
| Code | Description | Lines |
|
|
393
|
-
|------|-------------|-------|
|
|
394
|
-
| LRN-MCP-1 | What is MCP and why it matters | 10-35 |
|
|
395
|
-
| LRN-MCP-2 | MCP server architecture | 36-70 |
|
|
396
|
-
| LRN-MCP-3 | Building your first MCP server | 71-120 |
|
|
375
|
+
Learns are automatically indexed by the brain query system. Query existing curricula with:
|
|
397
376
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
## When to Expand
|
|
401
|
-
|
|
402
|
-
| Code | Expand When |
|
|
403
|
-
|------|-------------|
|
|
404
|
-
| LRN-MCP-1 | Need to understand MCP fundamentals |
|
|
405
|
-
| LRN-MCP-2 | Designing an MCP server |
|
|
406
|
-
|
|
407
|
-
---
|
|
408
|
-
|
|
409
|
-
## Projects Using Learns
|
|
410
|
-
|
|
411
|
-
| Learn | Projects |
|
|
412
|
-
|-------|----------|
|
|
413
|
-
| mcp | [[project-1]], [[project-2]] |
|
|
377
|
+
```
|
|
378
|
+
planflow-ai state-query "{topic}" --scope learns
|
|
414
379
|
```
|
|
415
380
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
| Learn File | Code Prefix | Example Codes |
|
|
419
|
-
|---|---|---|
|
|
420
|
-
| `mcp.md` | `LRN-MCP` | LRN-MCP-1, LRN-MCP-2, LRN-MCP-3 |
|
|
421
|
-
| `docker.md` | `LRN-DK` | LRN-DK-1, LRN-DK-2 |
|
|
422
|
-
| `graphql.md` | `LRN-GQ` | LRN-GQ-1, LRN-GQ-2 |
|
|
423
|
-
| Other `<name>.md` | `LRN-XX` | Use first 2-3 consonants or unique abbreviation |
|
|
424
|
-
|
|
425
|
-
### Reference Codes for Teaching
|
|
426
|
-
|
|
427
|
-
| Code | Description | When to Expand |
|
|
428
|
-
|------|-------------|----------------|
|
|
429
|
-
| SKL-LRN-3 | Teaching mode restrictions and workflow | Starting teaching mode |
|
|
430
|
-
| SKL-LRN-4 | Curriculum template and global storage | Generating curriculum |
|
|
431
|
-
| SKL-LRN-5 | Learns index template and LRN-* code convention | Updating learns index |
|
|
381
|
+
Learns are stored at `~/plan-flow/brain/learns/{topic-kebab}.md` and automatically discoverable via brain queries. No manual index maintenance required.
|
|
432
382
|
|
|
433
383
|
---
|
|
434
384
|
|
|
@@ -471,25 +421,6 @@ Teach step by step (adaptive: skip / deep dive / tangent / rephrase)
|
|
|
471
421
|
Save to ~/plan-flow/brain/learns/ → Auto-index LRN-* codes → Link to project
|
|
472
422
|
```
|
|
473
423
|
|
|
474
|
-
---
|
|
475
|
-
|
|
476
|
-
## Context Optimization
|
|
477
|
-
|
|
478
|
-
### Recommended Loading Order
|
|
479
|
-
|
|
480
|
-
1. **Always load first**: This command file (`commands/learn.md`)
|
|
481
|
-
2. **Load indexes**: Load `_index.md` files for relevant folders
|
|
482
|
-
3. **Expand on-demand**: Use reference codes to load specific sections when needed
|
|
483
|
-
|
|
484
|
-
### Reference Codes for Learn
|
|
485
|
-
|
|
486
|
-
| Code | Description | When to Expand |
|
|
487
|
-
|------|-------------|----------------|
|
|
488
|
-
| SKL-LRN-1 | Purpose, restrictions, and extraction criteria | Understanding what to extract |
|
|
489
|
-
| SKL-LRN-2 | Workflow, output format, and validation | Processing and saving patterns |
|
|
490
|
-
|
|
491
|
-
---
|
|
492
|
-
|
|
493
424
|
## Brain Capture
|
|
494
425
|
|
|
495
426
|
<!-- brain-capture
|
|
@@ -507,11 +438,20 @@ During pattern extraction, if you encounter valuable reference materials (API sp
|
|
|
507
438
|
|
|
508
439
|
---
|
|
509
440
|
|
|
441
|
+
## Context Loading
|
|
442
|
+
|
|
443
|
+
This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
|
|
444
|
+
|
|
445
|
+
**Queries**:
|
|
446
|
+
- `planflow-ai state-query "learn skill" --scope resources`
|
|
447
|
+
- `planflow-ai state-query "pattern extraction" --scope resources`
|
|
448
|
+
|
|
449
|
+
The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
510
453
|
## Related Resources
|
|
511
454
|
|
|
512
455
|
| Resource | Purpose |
|
|
513
456
|
| --------------------------- | --------------------------------- |
|
|
514
|
-
| `resources/skills/_index.md` | Index of skills with reference codes |
|
|
515
457
|
| `resources/skills/learn-skill.md` | Detailed skill implementation |
|
|
516
|
-
| `resources/patterns/_index.md` | Index of patterns with reference codes |
|
|
517
|
-
| `resources/core/_index.md` | Index of core rules with reference codes |
|
package/.claude/commands/note.md
CHANGED
|
@@ -208,29 +208,15 @@ Brain entry captured!
|
|
|
208
208
|
+------------------------------------------+
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
## Context Optimization
|
|
214
|
-
|
|
215
|
-
### Recommended Loading Order
|
|
211
|
+
## Context Loading
|
|
216
212
|
|
|
217
|
-
|
|
218
|
-
2. **Load indexes**: Load `_index.md` files for relevant folders
|
|
219
|
-
3. **Expand on-demand**: Use reference codes to load specific sections when needed
|
|
213
|
+
This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
|
|
220
214
|
|
|
221
|
-
|
|
215
|
+
**Queries**:
|
|
216
|
+
- `planflow-ai state-query "brain capture" --scope resources`
|
|
217
|
+
- `planflow-ai state-query "brain patterns" --scope resources`
|
|
222
218
|
|
|
223
|
-
|
|
224
|
-
|------|-------------|----------------|
|
|
225
|
-
| SKL-BR-1 | Brain skill restrictions | Understanding allowed actions |
|
|
226
|
-
| SKL-BR-2 | Brain skill workflow | Processing entries |
|
|
227
|
-
| SKL-BR-3 | Output format and validation | Formatting output |
|
|
228
|
-
| PTN-BR-1 | Directory structure and naming | Creating brain files |
|
|
229
|
-
| PTN-BR-2 | Wiki-link patterns | Creating cross-references |
|
|
230
|
-
| PTN-BR-3 | Feature status lifecycle | Updating feature entries |
|
|
231
|
-
| COR-BR-1 | Session start behavior | Understanding brain loading |
|
|
232
|
-
| COR-BR-2 | File templates | Creating new brain files |
|
|
233
|
-
| COR-BR-3 | Index management caps | Enforcing index limits |
|
|
219
|
+
The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
|
|
234
220
|
|
|
235
221
|
---
|
|
236
222
|
|
|
@@ -238,9 +224,6 @@ Brain entry captured!
|
|
|
238
224
|
|
|
239
225
|
| Resource | Purpose |
|
|
240
226
|
| --------------------------- | --------------------------------- |
|
|
241
|
-
| `resources/skills/_index.md` | Index of skills with reference codes |
|
|
242
|
-
| `resources/patterns/_index.md` | Index of patterns with reference codes |
|
|
243
|
-
| `resources/core/_index.md` | Index of core rules with reference codes |
|
|
244
227
|
| `brain-skill.md` | Skill that processes brain entries |
|
|
245
228
|
| `brain-patterns.md` | File naming and link conventions |
|
|
246
229
|
| `brain-capture.md` | Processing rules and templates |
|
|
@@ -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 |
|
|
@@ -126,57 +126,17 @@ review-code --scope staged
|
|
|
126
126
|
review-code src/services/userService.ts
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
## Context Optimization
|
|
132
|
-
|
|
133
|
-
This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
|
|
134
|
-
|
|
135
|
-
### Recommended Loading Order
|
|
136
|
-
|
|
137
|
-
1. **Always load first**: This command file (`commands/review-code.md`)
|
|
138
|
-
2. **Load indexes**: Load `_index.md` files for relevant folders
|
|
139
|
-
3. **Expand on-demand**: Use reference codes to load specific sections when needed
|
|
140
|
-
|
|
141
|
-
### Index Files for Code Review
|
|
142
|
-
|
|
143
|
-
| Index | When to Load |
|
|
144
|
-
|-------|--------------|
|
|
145
|
-
| `resources/skills/_index.md` | To understand review workflow |
|
|
146
|
-
| `resources/patterns/_index.md` | For review patterns and templates |
|
|
147
|
-
| `resources/core/_index.md` | For allowed/forbidden patterns reference |
|
|
129
|
+
## Context Loading
|
|
148
130
|
|
|
149
|
-
|
|
131
|
+
This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
|
|
150
132
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
| SKL-REV-5 | Find similar implementations | Searching for comparable code |
|
|
157
|
-
| SKL-REV-7 | Pattern conflicts + verify + re-rank | Processing findings |
|
|
158
|
-
| SKL-REV-8 | Generate review document | Creating the output file |
|
|
159
|
-
| SKL-REV-9 | Severity and conflict resolution | Severity levels and resolution options |
|
|
160
|
-
| PTN-REV-1 | Review document structure | Creating review output |
|
|
161
|
-
| COR-AP-1 | Allowed patterns overview | Checking pattern compliance |
|
|
162
|
-
| COR-FP-1 | Forbidden patterns overview | Identifying anti-patterns |
|
|
163
|
-
| COR-MA-1 | Multi-agent subagent definitions | Deep mode parallel review setup |
|
|
164
|
-
| COR-MA-2 | Coordinator dedup and merge | Deep mode result processing |
|
|
165
|
-
| COR-SR-1 | Severity re-ranking algorithm | Ordering findings by impact |
|
|
166
|
-
| COR-SR-2 | Finding grouping rules | Grouping related findings |
|
|
167
|
-
| COR-AD-1 | Adaptive depth size detection | Determining review mode |
|
|
168
|
-
| COR-AD-2 | Lightweight review mode | Changeset < 50 lines |
|
|
169
|
-
| COR-AD-3 | Deep review mode | Changeset 500+ lines |
|
|
170
|
-
| COR-CG-1 | Compaction guide | Load when compacting mid-review |
|
|
133
|
+
**Queries**:
|
|
134
|
+
- `planflow-ai state-query "code review workflow" --scope resources`
|
|
135
|
+
- `planflow-ai state-query "adaptive depth" --scope resources`
|
|
136
|
+
- `planflow-ai state-query "severity ranking" --scope resources`
|
|
137
|
+
- `planflow-ai state-query "multi-agent review" --scope resources`
|
|
171
138
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
When executing this command:
|
|
175
|
-
|
|
176
|
-
1. **Start with indexes**: Read `resources/skills/_index.md` and `resources/patterns/_index.md`
|
|
177
|
-
2. **Identify needed codes**: Based on detected language/framework, expand relevant patterns
|
|
178
|
-
3. **Expand as needed**: Use the Read tool with specific line ranges from the index
|
|
179
|
-
4. **Don't expand everything**: Only load patterns relevant to the files being reviewed
|
|
139
|
+
The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
|
|
180
140
|
|
|
181
141
|
---
|
|
182
142
|
|
|
@@ -184,9 +144,6 @@ When executing this command:
|
|
|
184
144
|
|
|
185
145
|
| Resource | Purpose |
|
|
186
146
|
| ------------------------------ | -------------------------------------- |
|
|
187
|
-
| `resources/skills/_index.md` | Index of skills with reference codes |
|
|
188
|
-
| `resources/patterns/_index.md` | Index of patterns with reference codes |
|
|
189
|
-
| `resources/core/_index.md` | Index of core rules with reference codes |
|
|
190
147
|
| `review-code-skill.md` | Skill that executes the review |
|
|
191
148
|
| `review-pr-patterns.md` | Review patterns and guidelines |
|
|
192
149
|
|
|
@@ -225,6 +182,17 @@ Run any of these to build structured understanding before or after merging.
|
|
|
225
182
|
|
|
226
183
|
---
|
|
227
184
|
|
|
185
|
+
## STATE.md Updates
|
|
186
|
+
|
|
187
|
+
Update `flow/STATE.md` at these transition points to enable session resumability.
|
|
188
|
+
|
|
189
|
+
| Transition Point | Action |
|
|
190
|
+
|-----------------|--------|
|
|
191
|
+
| **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` |
|
|
192
|
+
| **Review complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
228
196
|
## Brain Capture
|
|
229
197
|
|
|
230
198
|
After code review completes, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
|
|
@@ -120,60 +120,17 @@ review-pr https://github.com/org/repo/pull/123
|
|
|
120
120
|
review-pr https://dev.azure.com/org/project/_git/repo/pullrequest/456
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
## Context Loading
|
|
124
|
+
|
|
125
|
+
This command uses the **brain index** for context retrieval. Before executing, query the project brain for relevant documentation:
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
2. **Load indexes**: Load `_index.md` files for relevant folders
|
|
133
|
-
3. **Expand on-demand**: Use reference codes to load specific sections when needed
|
|
134
|
-
|
|
135
|
-
### Index Files for PR Review
|
|
136
|
-
|
|
137
|
-
| Index | When to Load |
|
|
138
|
-
|-------|--------------|
|
|
139
|
-
| `resources/skills/_index.md` | To understand review workflow |
|
|
140
|
-
| `resources/tools/_index.md` | For authentication tool |
|
|
141
|
-
| `resources/patterns/_index.md` | For review patterns |
|
|
142
|
-
| `resources/core/_index.md` | For allowed/forbidden patterns |
|
|
143
|
-
|
|
144
|
-
### Reference Codes for PR Review
|
|
145
|
-
|
|
146
|
-
| Code | Description | When to Expand |
|
|
147
|
-
|------|-------------|----------------|
|
|
148
|
-
| SKL-PR-1 | Purpose and restrictions | Understanding allowed actions |
|
|
149
|
-
| SKL-PR-2 | Authenticate for PR access | Setting up authentication |
|
|
150
|
-
| SKL-PR-3 | Fetch PR info + determine depth | Getting PR data and review mode |
|
|
151
|
-
| SKL-PR-5 | Analyze + verify + re-rank | Processing findings |
|
|
152
|
-
| SKL-PR-6 | Generate review document | Creating the output file |
|
|
153
|
-
| SKL-PR-7 | Output template | Review document structure |
|
|
154
|
-
| SKL-PR-8 | Fix complexity scoring | Severity and complexity details |
|
|
155
|
-
| SKL-PR-9 | Link format (GitHub/Azure DevOps) | Platform-specific link formats |
|
|
156
|
-
| TLS-AUTH-1 | Auth tool configuration | Setting up authentication |
|
|
157
|
-
| TLS-AUTH-2 | Authentication workflow | Authenticating to platform |
|
|
158
|
-
| PTN-PR-1 | PR review patterns | Creating review output |
|
|
159
|
-
| COR-AP-1 | Allowed patterns overview | Checking pattern compliance |
|
|
160
|
-
| COR-FP-1 | Forbidden patterns overview | Identifying anti-patterns |
|
|
161
|
-
| COR-MA-1 | Multi-agent subagent definitions | Deep mode parallel review setup |
|
|
162
|
-
| COR-MA-2 | Coordinator dedup and merge | Deep mode result processing |
|
|
163
|
-
| COR-SR-1 | Severity re-ranking algorithm | Ordering findings by impact |
|
|
164
|
-
| COR-SR-2 | Finding grouping rules | Grouping related findings |
|
|
165
|
-
| COR-AD-1 | Adaptive depth size detection | Determining review mode |
|
|
166
|
-
| COR-AD-2 | Lightweight review mode | Changeset < 50 lines |
|
|
167
|
-
| COR-AD-3 | Deep review mode | Changeset 500+ lines |
|
|
168
|
-
|
|
169
|
-
### Expansion Instructions
|
|
170
|
-
|
|
171
|
-
When executing this command:
|
|
172
|
-
|
|
173
|
-
1. **Start with indexes**: Read `resources/skills/_index.md` and `resources/tools/_index.md`
|
|
174
|
-
2. **Expand auth first**: Load TLS-AUTH-* codes for authentication
|
|
175
|
-
3. **Then expand review patterns**: Load PTN-PR-* codes for review structure
|
|
176
|
-
4. **Don't expand everything**: Only load patterns relevant to the PR being reviewed
|
|
127
|
+
**Queries**:
|
|
128
|
+
- `planflow-ai state-query "PR review workflow" --scope resources`
|
|
129
|
+
- `planflow-ai state-query "adaptive depth" --scope resources`
|
|
130
|
+
- `planflow-ai state-query "severity ranking" --scope resources`
|
|
131
|
+
- `planflow-ai state-query "PR authentication" --scope resources`
|
|
132
|
+
|
|
133
|
+
The brain returns ranked chunks from indexed markdown files. Use the top results to inform execution.
|
|
177
134
|
|
|
178
135
|
---
|
|
179
136
|
|
|
@@ -181,10 +138,6 @@ When executing this command:
|
|
|
181
138
|
|
|
182
139
|
| Resource | Purpose |
|
|
183
140
|
| ------------------------------ | -------------------------------------- |
|
|
184
|
-
| `resources/skills/_index.md` | Index of skills with reference codes |
|
|
185
|
-
| `resources/tools/_index.md` | Index of tools with reference codes |
|
|
186
|
-
| `resources/patterns/_index.md` | Index of patterns with reference codes |
|
|
187
|
-
| `resources/core/_index.md` | Index of core rules with reference codes |
|
|
188
141
|
| `review-pr-skill.md` | Skill that executes the review |
|
|
189
142
|
| `auth-pr-tool.md` | Authentication tool for PR platforms |
|
|
190
143
|
| `review-pr-patterns.md` | Review patterns and guidelines |
|
|
@@ -225,6 +178,17 @@ Run any of these to build structured understanding before or after merging.
|
|
|
225
178
|
|
|
226
179
|
---
|
|
227
180
|
|
|
181
|
+
## STATE.md Updates
|
|
182
|
+
|
|
183
|
+
Update `flow/STATE.md` at these transition points to enable session resumability.
|
|
184
|
+
|
|
185
|
+
| Transition Point | Action |
|
|
186
|
+
|-----------------|--------|
|
|
187
|
+
| **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` |
|
|
188
|
+
| **Review complete** | Delete `flow/STATE.md` (skill is done, no state to preserve) |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
228
192
|
## Brain Capture
|
|
229
193
|
|
|
230
194
|
After PR review completes, append a brain-capture block. See `.claude/resources/core/brain-capture.md` for processing rules.
|