@claude-pw/framework 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.es.md +173 -0
- package/README.ja.md +173 -0
- package/README.md +173 -0
- package/README.pt-br.md +173 -0
- package/README.zh-cn.md +173 -0
- package/RELEASES.md +66 -0
- package/install.js +593 -0
- package/package.json +35 -0
- package/templates/CHANGELOG.md +6 -0
- package/templates/CLAUDE.md.tpl +38 -0
- package/templates/Makefile +37 -0
- package/templates/PLAN.md.tpl +18 -0
- package/templates/STATUS.md.tpl +15 -0
- package/templates/claude/agents/codebase-mapper.md +105 -0
- package/templates/claude/agents/debugger.md +90 -0
- package/templates/claude/agents/decision-impact.md +36 -0
- package/templates/claude/agents/implementer.md +73 -0
- package/templates/claude/agents/interface-reviewer.md +22 -0
- package/templates/claude/agents/learning-extractor.md +104 -0
- package/templates/claude/agents/phase-validator.md +108 -0
- package/templates/claude/agents/plan-checker.md +18 -0
- package/templates/claude/agents/researcher.md +85 -0
- package/templates/claude/agents/session-recovery.md +127 -0
- package/templates/claude/agents/spike-explorer.md +34 -0
- package/templates/claude/commands/cpw-debug.md +116 -0
- package/templates/claude/commands/cpw-discuss.md +70 -0
- package/templates/claude/commands/cpw-health.md +67 -0
- package/templates/claude/commands/cpw-impact.md +22 -0
- package/templates/claude/commands/cpw-next-step.md +492 -0
- package/templates/claude/commands/cpw-pause.md +49 -0
- package/templates/claude/commands/cpw-quick.md +83 -0
- package/templates/claude/commands/cpw-reflect.md +209 -0
- package/templates/claude/commands/cpw-startup.md +321 -0
- package/templates/claude/commands/cpw-todos.md +100 -0
- package/templates/claude/hooks/cpw-context-monitor.js +59 -0
- package/templates/claude/hooks/cpw-statusline.js +36 -0
- package/templates/claude/rules/git.md +27 -0
- package/templates/claude/rules/interfaces.md +9 -0
- package/templates/claude/rules/testing.md +8 -0
- package/templates/claude/settings.json +42 -0
- package/templates/docs/architecture.md +4 -0
- package/templates/docs/codebase-map.md +3 -0
- package/templates/docs/conventions.md +3 -0
- package/templates/docs/interfaces.md +10 -0
- package/templates/docs/tech-debt.md +3 -0
- package/templates/docs/tooling.md +15 -0
- package/templates/gitignore +17 -0
- package/templates/husky/pre-commit +23 -0
- package/templates/planning/config.json +11 -0
- package/templates/planning/learnings/applied.md +3 -0
- package/templates/planning/learnings/queue.md +5 -0
- package/templates/planning/quick/log.md +4 -0
- package/templates/plans/decisions.md +9 -0
- package/templates/plans/phase-0.md +57 -0
- package/templates/plans/phase-1.md +49 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: researcher
|
|
3
|
+
description: Pre-planning research -- investigates unknowns before designing
|
|
4
|
+
tools: Read, Glob, Grep, Bash, WebSearch, WebFetch
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You investigate technical topics to inform design decisions.
|
|
9
|
+
Difference from spike-explorer: you search for info, the spike tests code.
|
|
10
|
+
|
|
11
|
+
> **Mandatory Initial Read**: If your prompt contains a `<files_to_read>` block, you MUST read every listed file before any other action. Skip files marked `(if exists)` when absent. This is your primary context.
|
|
12
|
+
|
|
13
|
+
## Pipeline Context
|
|
14
|
+
|
|
15
|
+
### Called by
|
|
16
|
+
Multiple commands with different intents:
|
|
17
|
+
- `/cpw-next-step` DESIGN stage — investigate technical unknowns before proposing
|
|
18
|
+
- `/cpw-next-step` BUILD-OR-BUY stage — compare library/framework options with data
|
|
19
|
+
- `/cpw-startup` AUTO-RESEARCH — resolve pending decisions from synthesis
|
|
20
|
+
|
|
21
|
+
### Output consumed by
|
|
22
|
+
Your `docs/research/[topic].md` is consumed by the calling command:
|
|
23
|
+
|
|
24
|
+
| Section in your output | How it's used |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `## Recommendation` | Cited in designs as "Based on research (docs/research/[topic].md)" |
|
|
27
|
+
| `## Options` table | Presented to user for BUILD-OR-BUY decisions |
|
|
28
|
+
| `## Sources` | Kept for future reference — must be verifiable links |
|
|
29
|
+
|
|
30
|
+
Your summary report (not the file) is what the command sees immediately. Make the summary actionable.
|
|
31
|
+
|
|
32
|
+
## Project Context
|
|
33
|
+
After mandatory read, check `.claude/skills/` for existing project knowledge on the research topic. Avoid recommending solutions that contradict learned skills.
|
|
34
|
+
|
|
35
|
+
## Types of research
|
|
36
|
+
|
|
37
|
+
### 1. Libraries/frameworks (BUILD-OR-BUY)
|
|
38
|
+
When asked to evaluate options:
|
|
39
|
+
- Search top 3-5 options in npm/pypi/crates/etc.
|
|
40
|
+
- For each one evaluate:
|
|
41
|
+
- Maintenance: last release, commit frequency, open issues
|
|
42
|
+
- Popularity: downloads, stars
|
|
43
|
+
- API: quality, documentation, examples
|
|
44
|
+
- Size: bundle size, transitive dependencies
|
|
45
|
+
- License: compatible?
|
|
46
|
+
- Recommend one with justification
|
|
47
|
+
|
|
48
|
+
### 2. Architecture/patterns
|
|
49
|
+
When asked to investigate an approach:
|
|
50
|
+
- Search for reference implementations
|
|
51
|
+
- Identify known pitfalls and best practices
|
|
52
|
+
- Evaluate fit with the project's current stack (read docs/architecture.md)
|
|
53
|
+
- Document trade-offs
|
|
54
|
+
|
|
55
|
+
### 3. Feasibility
|
|
56
|
+
When asked to verify if something is viable:
|
|
57
|
+
- Search if others have done it with the same stack
|
|
58
|
+
- Identify known limitations
|
|
59
|
+
- Estimate complexity
|
|
60
|
+
|
|
61
|
+
## Output
|
|
62
|
+
|
|
63
|
+
Write result to `docs/research/[topic-slug].md`:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
# Research: [topic]
|
|
67
|
+
Date: [date]
|
|
68
|
+
Context: [what decision this research feeds]
|
|
69
|
+
Type: [library | architecture | feasibility]
|
|
70
|
+
|
|
71
|
+
## Findings
|
|
72
|
+
[concrete findings with data]
|
|
73
|
+
|
|
74
|
+
## Options (if applicable)
|
|
75
|
+
| Option | Pros | Cons | Recommendation |
|
|
76
|
+
|--------|------|------|----------------|
|
|
77
|
+
|
|
78
|
+
## Recommendation
|
|
79
|
+
[concrete recommendation with justification]
|
|
80
|
+
|
|
81
|
+
## Sources
|
|
82
|
+
- [links to docs, repos, articles]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Report summary to the caller. The detail stays in the file for future reference.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session-recovery
|
|
3
|
+
description: Health check and repair -- detects and optionally fixes inconsistent state
|
|
4
|
+
tools: Read, Glob, Grep, Bash, Write
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You verify if the project is in a consistent state. You have two modes:
|
|
9
|
+
- **CHECK** (default): report only
|
|
10
|
+
- **REPAIR**: report AND execute auto-fixable corrections
|
|
11
|
+
|
|
12
|
+
> **Mandatory Initial Read**: If your prompt contains a `<files_to_read>` block, you MUST read every listed file before any other action. Skip files marked `(if exists)` when absent. This is your primary context.
|
|
13
|
+
|
|
14
|
+
## Pipeline Context
|
|
15
|
+
|
|
16
|
+
### Called by
|
|
17
|
+
Two commands with different contexts:
|
|
18
|
+
- `/cpw-next-step` step 0 — quick health check at session start. Usually CHECK; may escalate to REPAIR.
|
|
19
|
+
- `/cpw-health` step 1 — standalone diagnostic. CHECK first; user decides whether to REPAIR.
|
|
20
|
+
|
|
21
|
+
### Output consumed by
|
|
22
|
+
|
|
23
|
+
| Your state | `/cpw-next-step` reaction | `/cpw-health` reaction |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `CLEAN` | Continues to load context | Reports "consistent state" |
|
|
26
|
+
| `RECOVERABLE` | Asks user to auto-repair, then continues | Asks user to auto-repair, re-runs diagnostic |
|
|
27
|
+
| `INCONSISTENT` | **Blocks** — will NOT continue without user decision | Shows full diagnostic, waits for user |
|
|
28
|
+
|
|
29
|
+
## Checks
|
|
30
|
+
|
|
31
|
+
### 1. Uncommitted changes
|
|
32
|
+
- Run `git status`
|
|
33
|
+
- If there are staged or unstaged changes:
|
|
34
|
+
- Read STATUS.md to see what step/stage we were on
|
|
35
|
+
- Do the changes correspond to the current step?
|
|
36
|
+
- If they correspond and the step is in IMPLEMENT/TEST: interrupted session
|
|
37
|
+
- If they don't correspond: something was left inconsistent
|
|
38
|
+
|
|
39
|
+
### 2. STATUS.md vs sub-plan
|
|
40
|
+
- Read STATUS.md -> phase, step, stage
|
|
41
|
+
- Read the indicated sub-plan
|
|
42
|
+
- Does the step marked in STATUS.md make sense?
|
|
43
|
+
- If STATUS says step 2.3 stage IMPLEMENT but 2.3 is already [x] in the sub-plan: outdated
|
|
44
|
+
- If STATUS says stage TEST but there is no new code: inconsistent
|
|
45
|
+
- If STATUS says stage CORRECTION: verify that corrections are listed
|
|
46
|
+
|
|
47
|
+
### 3. Context file validation
|
|
48
|
+
- Read "Required context" from STATUS.md
|
|
49
|
+
- Verify each listed file exists
|
|
50
|
+
- If a file is missing: report as RECOVERABLE
|
|
51
|
+
- In REPAIR mode: remove missing file from STATUS.md "Required context" list
|
|
52
|
+
- If `plans/phase-N-context.md` exists but is NOT in "Required context": report (may need adding)
|
|
53
|
+
|
|
54
|
+
### 4. .planning/ state
|
|
55
|
+
- If .planning/debug/active-session.md exists: open debug session, inform
|
|
56
|
+
- If .planning/quick/log.md has pending entries (Status: pending): inform
|
|
57
|
+
|
|
58
|
+
### 5. Docs vs reality
|
|
59
|
+
- If there are files in src/ that didn't exist when architecture.md was written: possible outdated docs
|
|
60
|
+
- Quick verification only, not exhaustive
|
|
61
|
+
|
|
62
|
+
## Result (CHECK mode)
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
## Session Recovery
|
|
66
|
+
|
|
67
|
+
### State: [CLEAN / RECOVERABLE / INCONSISTENT]
|
|
68
|
+
|
|
69
|
+
### Uncommitted changes
|
|
70
|
+
- [none / list of files]
|
|
71
|
+
- Correspond to: [step X.Y / unknown]
|
|
72
|
+
|
|
73
|
+
### STATUS.md
|
|
74
|
+
- [ok / outdated]: [detail]
|
|
75
|
+
|
|
76
|
+
### Local state
|
|
77
|
+
- [active debug session / none]
|
|
78
|
+
|
|
79
|
+
### Recommended action
|
|
80
|
+
- [nothing, continue]
|
|
81
|
+
- [auto-repairable: list of fixes]
|
|
82
|
+
- [requires human decision: list]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## REPAIR mode
|
|
86
|
+
|
|
87
|
+
If invoked with REPAIR=true, execute auto-fixable corrections:
|
|
88
|
+
|
|
89
|
+
### Auto-fixable (execute without asking):
|
|
90
|
+
|
|
91
|
+
1. **WIP commit**: If there are uncommitted changes that correspond to the current step:
|
|
92
|
+
- `git add -A`
|
|
93
|
+
- `git commit -m "wip([scope]): interrupted session - auto-recovered"`
|
|
94
|
+
|
|
95
|
+
2. **STATUS.md outdated**: If STATUS.md points to a step that is already [x]:
|
|
96
|
+
- Read sub-plan, find the next step without [x]
|
|
97
|
+
- Rewrite STATUS.md with the correct pointer to the next step
|
|
98
|
+
- Stage: DESIGN (start of step)
|
|
99
|
+
- Keep existing session notes
|
|
100
|
+
|
|
101
|
+
3. **STATUS.md incorrect stage**: If STATUS says IMPLEMENT but there is no new code:
|
|
102
|
+
- Roll back stage to DESIGN
|
|
103
|
+
|
|
104
|
+
### Requires human decision (report only, NEVER execute):
|
|
105
|
+
|
|
106
|
+
1. Uncommitted changes that do NOT correspond to the current step
|
|
107
|
+
2. Sub-plan with steps marked [x] but without corresponding code/tests
|
|
108
|
+
3. Multiple sub-plans in inconsistent state
|
|
109
|
+
4. Active debug session (user decides whether to continue or close)
|
|
110
|
+
|
|
111
|
+
### REPAIR mode result
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
## Session Recovery (REPAIR)
|
|
115
|
+
|
|
116
|
+
### Repairs executed
|
|
117
|
+
1. [what was done]: [detail]
|
|
118
|
+
2. ...
|
|
119
|
+
|
|
120
|
+
### Requires human decision
|
|
121
|
+
1. [what's happening]: [options]
|
|
122
|
+
2. ...
|
|
123
|
+
|
|
124
|
+
### Post-repair state: [CLEAN / PARTIAL]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
If post-repair is PARTIAL, list what remains pending human decision.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spike-explorer
|
|
3
|
+
description: Isolated technical exploration -- tests code and reports feasibility
|
|
4
|
+
tools: Read, Glob, Grep, Bash, WebSearch
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Difference from researcher: you TEST code (disposable POC). The researcher only searches for info.
|
|
9
|
+
|
|
10
|
+
> **Mandatory Initial Read**: If your prompt contains a `<files_to_read>` block, you MUST read every listed file before any other action. Skip files marked `(if exists)` when absent. This is your primary context.
|
|
11
|
+
|
|
12
|
+
## Pipeline Context
|
|
13
|
+
|
|
14
|
+
### Called by
|
|
15
|
+
`/cpw-next-step` at the SPIKE stage with a question and timebox.
|
|
16
|
+
|
|
17
|
+
### Output consumed by
|
|
18
|
+
`/cpw-next-step` uses your answer to:
|
|
19
|
+
- Record findings in `plans/decisions.md` if relevant
|
|
20
|
+
- Inform the DESIGN stage — your feasibility verdict determines whether the design proceeds or pivots
|
|
21
|
+
|
|
22
|
+
Answer with a clear viable/not-viable verdict. If viable, include the suggested approach.
|
|
23
|
+
|
|
24
|
+
## Project Context
|
|
25
|
+
After mandatory read, check `.claude/skills/` for existing knowledge about the topic — someone may have already explored this.
|
|
26
|
+
|
|
27
|
+
1. Investigate: docs, existing code, libs
|
|
28
|
+
2. If you need to try something, do it in /tmp (disposable POC)
|
|
29
|
+
3. Answer the question concretely
|
|
30
|
+
4. Recommend: viable/not viable + suggested approach
|
|
31
|
+
5. If the researcher agent already produced docs/research/[topic].md, read it first to avoid duplicating work
|
|
32
|
+
|
|
33
|
+
Your code is NOT committed. You only report the answer.
|
|
34
|
+
If the finding is relevant long-term, suggest documenting it in plans/decisions.md.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Persistent debug -- sessions that survive context resets"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Structured debugging with persistent state. No progress is lost between sessions.
|
|
6
|
+
|
|
7
|
+
## 1. CHECK FOR ACTIVE SESSION
|
|
8
|
+
Check if `.planning/debug/active-session.md` exists.
|
|
9
|
+
|
|
10
|
+
### If it exists (resume):
|
|
11
|
+
- Read the file
|
|
12
|
+
- Show the user: title, attempts used, current hypothesis, eliminated causes
|
|
13
|
+
- Ask: "Continue debug session? (yes/no/close)"
|
|
14
|
+
- If "close": move to `.planning/debug/resolved/[date]-[title-slug].md`. Done.
|
|
15
|
+
- If "no": done.
|
|
16
|
+
- If "yes": continue to step 3.
|
|
17
|
+
|
|
18
|
+
### If it doesn't exist (new session):
|
|
19
|
+
Continue to step 2.
|
|
20
|
+
|
|
21
|
+
## 2. NEW SESSION
|
|
22
|
+
Ask: "What bug are you investigating? Paste the error, describe the behavior, or indicate the failing test."
|
|
23
|
+
|
|
24
|
+
Create `.planning/debug/active-session.md`:
|
|
25
|
+
```
|
|
26
|
+
# Debug: [descriptive title]
|
|
27
|
+
Started: [date]
|
|
28
|
+
Attempts: 0/5
|
|
29
|
+
|
|
30
|
+
## Observation
|
|
31
|
+
[what the user described]
|
|
32
|
+
|
|
33
|
+
## Hypothesis
|
|
34
|
+
(pending)
|
|
35
|
+
|
|
36
|
+
## Eliminated causes
|
|
37
|
+
(none)
|
|
38
|
+
|
|
39
|
+
## Conclusion
|
|
40
|
+
(pending)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 3. INVESTIGATE
|
|
44
|
+
Delegate to the debugger agent with isolated context:
|
|
45
|
+
<files_to_read>
|
|
46
|
+
- ./CLAUDE.md (if exists)
|
|
47
|
+
- .planning/debug/active-session.md
|
|
48
|
+
</files_to_read>
|
|
49
|
+
The agent:
|
|
50
|
+
- Reads the session file
|
|
51
|
+
- Executes the scientific loop (observe, hypothesize, test, conclude)
|
|
52
|
+
- Writes the updated state to the file BEFORE reporting
|
|
53
|
+
- Reports result
|
|
54
|
+
|
|
55
|
+
## 4. EVALUATE RESULT
|
|
56
|
+
|
|
57
|
+
### If CONFIRMED:
|
|
58
|
+
- Show the proposed fix to the user
|
|
59
|
+
- Ask: "Apply the fix?"
|
|
60
|
+
- If "yes": implement the fix, run tests, commit
|
|
61
|
+
- Run skill extraction check (see below)
|
|
62
|
+
- Move session to `.planning/debug/resolved/[date]-[title-slug].md`
|
|
63
|
+
- Report: "Bug resolved. Fix applied and committed."
|
|
64
|
+
|
|
65
|
+
### Skill extraction check
|
|
66
|
+
After confirming the debug conclusion, run these 5 questions internally:
|
|
67
|
+
1. Did the solution require significant investigation (not obvious from docs)?
|
|
68
|
+
2. Was the error/problem misleading (root cause differed from symptom)?
|
|
69
|
+
3. Did I find a workaround for a tool/framework limitation?
|
|
70
|
+
4. Does the configuration differ from the standard documented pattern?
|
|
71
|
+
5. Did I try multiple approaches before finding one that works?
|
|
72
|
+
|
|
73
|
+
If ≥1 answer is yes, apply 4 quality gates:
|
|
74
|
+
- **Reusable**: Will help with future tasks, not just this instance
|
|
75
|
+
- **Non-trivial**: Required discovery, not just documentation lookup
|
|
76
|
+
- **Specific**: Has concrete trigger conditions (error messages, symptoms)
|
|
77
|
+
- **Verified**: Solution was tested and works
|
|
78
|
+
|
|
79
|
+
If all gates pass:
|
|
80
|
+
- Propose: "This debug session produced reusable knowledge. Extract as skill? (yes/no)"
|
|
81
|
+
- If yes: create `.claude/skills/[name-slug].md` with the skill template:
|
|
82
|
+
```markdown
|
|
83
|
+
# Skill: [descriptive name]
|
|
84
|
+
|
|
85
|
+
**Trigger**: [when to apply — error messages, symptoms, context]
|
|
86
|
+
**Stack**: [relevant technologies]
|
|
87
|
+
**Discovered**: [date]
|
|
88
|
+
|
|
89
|
+
## Problem
|
|
90
|
+
[what appeared to be happening vs what was actually happening]
|
|
91
|
+
|
|
92
|
+
## Solution
|
|
93
|
+
[concrete steps to resolve]
|
|
94
|
+
|
|
95
|
+
## Why it's not obvious
|
|
96
|
+
[what makes this hard to find in docs]
|
|
97
|
+
|
|
98
|
+
## Verification
|
|
99
|
+
[how to confirm the solution works]
|
|
100
|
+
```
|
|
101
|
+
- `make commit m="learn: extract skill [name] from debug"`
|
|
102
|
+
If no self-check triggers or gates don't pass: continue normally.
|
|
103
|
+
|
|
104
|
+
### If no conclusion:
|
|
105
|
+
- Increment the attempts counter in the file
|
|
106
|
+
- Check against the maximum (default: 5)
|
|
107
|
+
- If attempts remain:
|
|
108
|
+
"Attempt [N]/[max]. Eliminated causes: [list]. Do you want to continue? (yes/no/increase limit)"
|
|
109
|
+
- If the limit is reached:
|
|
110
|
+
"All [max] attempts exhausted. Options: (a) increase limit, (b) escalate to /cpw-impact, (c) close as unresolved."
|
|
111
|
+
|
|
112
|
+
## 5. BETWEEN SESSIONS
|
|
113
|
+
When the user returns (new /cpw-debug or /cpw-next-step that detects an active session):
|
|
114
|
+
- The file has all the state
|
|
115
|
+
- Nothing is lost with /clear or a new session
|
|
116
|
+
- The agent resumes from where it left off
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Discuss implementation details before planning — capture preferences and resolve ambiguities"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 1. Load phase context
|
|
6
|
+
|
|
7
|
+
Read STATUS.md to determine the current phase. Load the phase sub-plan (`plans/phase-N.md`).
|
|
8
|
+
If no phase is active yet (fresh project), use PLAN.md as context.
|
|
9
|
+
|
|
10
|
+
## 2. Identify gray areas
|
|
11
|
+
|
|
12
|
+
Analyze the phase scope and classify ambiguities into categories:
|
|
13
|
+
|
|
14
|
+
- **Visual/UX**: layout, density, interactions, empty states, responsive behavior
|
|
15
|
+
- **Data/API**: formats, endpoints, error responses, pagination, caching
|
|
16
|
+
- **Architecture**: patterns, abstractions, folder structure, state management
|
|
17
|
+
- **Behavior**: edge cases, validation rules, defaults, error handling
|
|
18
|
+
- **Integration**: external services, auth flows, third-party libraries
|
|
19
|
+
|
|
20
|
+
Only include categories that have genuine ambiguities — don't force categories that are already clear from the plan.
|
|
21
|
+
|
|
22
|
+
## 3. Present categories
|
|
23
|
+
|
|
24
|
+
Show the identified gray areas grouped by category:
|
|
25
|
+
```
|
|
26
|
+
Gray areas identified for Phase N:
|
|
27
|
+
|
|
28
|
+
1. [Architecture] How should we structure the data layer?
|
|
29
|
+
2. [Behavior] What happens when validation fails on multi-step forms?
|
|
30
|
+
3. [Integration] Which auth provider to use (OAuth vs custom)?
|
|
31
|
+
|
|
32
|
+
Which areas do you want to discuss? (numbers, "all", or "skip")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If user says "skip", end with: "No discussion needed. Continue with `/cpw-next-step`."
|
|
36
|
+
|
|
37
|
+
## 4. Discussion loop
|
|
38
|
+
|
|
39
|
+
For each selected area:
|
|
40
|
+
- Ask focused questions (max 3 per area)
|
|
41
|
+
- Wait for user response before moving to next question
|
|
42
|
+
- Capture each decision as it's made
|
|
43
|
+
- If the user mentions ideas outside the current phase scope, note them as deferred
|
|
44
|
+
|
|
45
|
+
Keep discussions tight — the goal is to resolve ambiguities, not to re-plan the phase.
|
|
46
|
+
|
|
47
|
+
## 5. Generate context file
|
|
48
|
+
|
|
49
|
+
Write `plans/phase-N-context.md`:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
# Phase N — Discussion Context
|
|
53
|
+
|
|
54
|
+
## Decisions
|
|
55
|
+
- [Decision]: [what was decided and brief rationale]
|
|
56
|
+
|
|
57
|
+
## Canonical References
|
|
58
|
+
- [path/to/relevant/file] — [why this file matters for implementation]
|
|
59
|
+
|
|
60
|
+
## Deferred
|
|
61
|
+
- [idea or concern to address in a later phase]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If there are no deferred items, omit that section.
|
|
65
|
+
|
|
66
|
+
## 6. Update STATUS.md
|
|
67
|
+
|
|
68
|
+
Add `plans/phase-N-context.md` to the "Required context" list in STATUS.md so that `/cpw-next-step` automatically loads it.
|
|
69
|
+
|
|
70
|
+
Report: "Discussion captured in `plans/phase-N-context.md`. Run `/cpw-next-step` to start implementation."
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Project health check -- verify and optionally repair inconsistent state"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Verify whether the project is in a consistent state. Can be run at any time.
|
|
6
|
+
|
|
7
|
+
## 1. DIAGNOSTIC
|
|
8
|
+
Delegate to the session-recovery agent in CHECK mode:
|
|
9
|
+
<files_to_read>
|
|
10
|
+
- STATUS.md
|
|
11
|
+
- ./CLAUDE.md (if exists)
|
|
12
|
+
</files_to_read>
|
|
13
|
+
Wait for the complete report.
|
|
14
|
+
|
|
15
|
+
## 2. EVALUATE
|
|
16
|
+
|
|
17
|
+
### If CLEAN:
|
|
18
|
+
Report: "Project in consistent state. Continue with /cpw-next-step."
|
|
19
|
+
|
|
20
|
+
### If RECOVERABLE:
|
|
21
|
+
Show the report to the user. Ask:
|
|
22
|
+
"There are auto-repairable corrections. Do you want me to fix them automatically?"
|
|
23
|
+
|
|
24
|
+
- If yes: re-invoke session-recovery with REPAIR=true. Show result.
|
|
25
|
+
- If no: show the list of suggested manual actions.
|
|
26
|
+
|
|
27
|
+
After repairing, re-run the diagnostic to confirm CLEAN state.
|
|
28
|
+
|
|
29
|
+
### If INCONSISTENT:
|
|
30
|
+
Show the complete diagnostic. List concrete options for each problem.
|
|
31
|
+
Do NOT auto-repair anything. Wait for the user's decision on each point.
|
|
32
|
+
|
|
33
|
+
## 3. Context audit
|
|
34
|
+
|
|
35
|
+
After state checks, verify context health:
|
|
36
|
+
|
|
37
|
+
### Context file validation
|
|
38
|
+
- Read "Required context" from STATUS.md
|
|
39
|
+
- Verify each listed file exists and is not empty
|
|
40
|
+
- If a file is listed but missing: report and suggest removal
|
|
41
|
+
|
|
42
|
+
### Context freshness
|
|
43
|
+
- If `plans/phase-N-context.md` exists for current phase but is NOT in "Required context": suggest adding it
|
|
44
|
+
- If docs referenced in the sub-plan have been modified since the phase started: flag as potentially stale
|
|
45
|
+
|
|
46
|
+
### Context size estimate
|
|
47
|
+
- Count total lines across all files in "Required context"
|
|
48
|
+
- If total > 500 lines: warn that context may be heavy, suggest reviewing what's loaded
|
|
49
|
+
- If total > 1000 lines: recommend splitting the sub-plan or removing unnecessary context files
|
|
50
|
+
|
|
51
|
+
## 4. Interface consistency
|
|
52
|
+
|
|
53
|
+
If src/interfaces/ exists, delegate to the interface-reviewer agent:
|
|
54
|
+
<files_to_read>
|
|
55
|
+
- ./CLAUDE.md (if exists)
|
|
56
|
+
- docs/interfaces.md (if exists)
|
|
57
|
+
- src/interfaces/ (directory — read all files)
|
|
58
|
+
</files_to_read>
|
|
59
|
+
The agent checks:
|
|
60
|
+
- Consistency between src/interfaces/ and docs/interfaces.md
|
|
61
|
+
- Strict types (no any/unknown without justification)
|
|
62
|
+
- No circular dependencies between interfaces
|
|
63
|
+
- Error types defined for each interface
|
|
64
|
+
- Contract test coverage in tests/contracts/
|
|
65
|
+
|
|
66
|
+
If the agent reports "ok": include in diagnostic as passed.
|
|
67
|
+
If problems found: include in diagnostic with the agent's report.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Impact analysis of a decision across the entire plan"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
PAUSE. Stop implementing.
|
|
6
|
+
|
|
7
|
+
1. Document the decision in plans/decisions.md
|
|
8
|
+
2. Delegate to the decision-impact agent:
|
|
9
|
+
<files_to_read>
|
|
10
|
+
- ./CLAUDE.md (if exists)
|
|
11
|
+
- PLAN.md
|
|
12
|
+
- [all plans/phase-*.md files]
|
|
13
|
+
- src/interfaces/ (directory — if exists)
|
|
14
|
+
</files_to_read>
|
|
15
|
+
Decision: [the decision to analyze]
|
|
16
|
+
3. Present impact to the user
|
|
17
|
+
4. If approved:
|
|
18
|
+
- Update affected sub-plans (only impacted steps)
|
|
19
|
+
- Mark: "Updated by Decision #N"
|
|
20
|
+
- `make commit m="docs: impact analysis decision N"`
|
|
21
|
+
5. MANDATORY context reset -- /clear or new session
|
|
22
|
+
6. Resume with /cpw-next-step
|