@fernado03/zoo-flow 0.9.1 → 0.11.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/README.md +139 -83
- package/bin/zoo-flow.js +444 -134
- package/package.json +3 -3
- package/templates/claude-code/.claude/commands/caveman.md +26 -0
- package/templates/claude-code/.claude/commands/commit-and-document.md +27 -0
- package/templates/claude-code/.claude/commands/diagnose.md +27 -0
- package/templates/claude-code/.claude/commands/feature.md +46 -0
- package/templates/claude-code/.claude/commands/fix.md +45 -0
- package/templates/claude-code/.claude/commands/grill-me.md +27 -0
- package/templates/claude-code/.claude/commands/grill-with-docs.md +27 -0
- package/templates/claude-code/.claude/commands/handoff.md +27 -0
- package/templates/claude-code/.claude/commands/improve-codebase-architecture.md +27 -0
- package/templates/claude-code/.claude/commands/prototype.md +27 -0
- package/templates/claude-code/.claude/commands/refactor.md +46 -0
- package/templates/claude-code/.claude/commands/review.md +27 -0
- package/templates/claude-code/.claude/commands/scaffold-context.md +27 -0
- package/templates/claude-code/.claude/commands/setup-matt-pocock-skills.md +27 -0
- package/templates/claude-code/.claude/commands/tdd.md +27 -0
- package/templates/claude-code/.claude/commands/teach.md +27 -0
- package/templates/claude-code/.claude/commands/to-issues.md +27 -0
- package/templates/claude-code/.claude/commands/to-prd.md +27 -0
- package/templates/claude-code/.claude/commands/triage.md +27 -0
- package/templates/claude-code/.claude/commands/tweak.md +27 -0
- package/templates/claude-code/.claude/commands/update-docs.md +27 -0
- package/templates/claude-code/.claude/commands/verify.md +27 -0
- package/templates/claude-code/.claude/commands/write-a-skill.md +27 -0
- package/templates/claude-code/.claude/commands/zoom-out.md +27 -0
- package/templates/claude-code/.claude/skills/engineering/commit-and-document/SKILL.md +37 -0
- package/templates/claude-code/.claude/skills/engineering/diagnose/SKILL.md +136 -0
- package/templates/claude-code/.claude/skills/engineering/explore/SKILL.md +61 -0
- package/templates/claude-code/.claude/skills/engineering/feature/SKILL.md +66 -0
- package/templates/claude-code/.claude/skills/engineering/fix/SKILL.md +59 -0
- package/templates/claude-code/.claude/skills/engineering/grill-with-docs/SKILL.md +35 -0
- package/templates/claude-code/.claude/skills/engineering/improve-codebase-architecture/SKILL.md +39 -0
- package/templates/claude-code/.claude/skills/engineering/prototype/SKILL.md +34 -0
- package/templates/claude-code/.claude/skills/engineering/refactor/SKILL.md +59 -0
- package/templates/claude-code/.claude/skills/engineering/review/SKILL.md +144 -0
- package/templates/claude-code/.claude/skills/engineering/scaffold-context/SKILL.md +44 -0
- package/templates/claude-code/.claude/skills/engineering/setup-matt-pocock-skills/SKILL.md +48 -0
- package/templates/claude-code/.claude/skills/engineering/tdd/SKILL.md +81 -0
- package/templates/claude-code/.claude/skills/engineering/to-issues/SKILL.md +37 -0
- package/templates/claude-code/.claude/skills/engineering/to-prd/SKILL.md +39 -0
- package/templates/claude-code/.claude/skills/engineering/triage/SKILL.md +36 -0
- package/templates/claude-code/.claude/skills/engineering/tweak/SKILL.md +37 -0
- package/templates/claude-code/.claude/skills/engineering/update-docs/SKILL.md +33 -0
- package/templates/claude-code/.claude/skills/engineering/verify/SKILL.md +38 -0
- package/templates/claude-code/.claude/skills/engineering/zoom-out/SKILL.md +74 -0
- package/templates/claude-code/.claude/skills/productivity/caveman/SKILL.md +24 -0
- package/templates/claude-code/.claude/skills/productivity/grill-me/SKILL.md +21 -0
- package/templates/claude-code/.claude/skills/productivity/handoff/SKILL.md +20 -0
- package/templates/claude-code/.claude/skills/productivity/teach/SKILL.md +116 -0
- package/templates/claude-code/.claude/skills/productivity/write-a-skill/SKILL.md +59 -0
- package/templates/claude-code/.zoo-flow/CONTEXT.md +8 -0
- package/templates/claude-code/.zoo-flow/START_HERE.md +28 -0
- package/templates/claude-code/.zoo-flow/docs/adr/0001-record-architecture-decisions.md +22 -0
- package/templates/claude-code/.zoo-flow/evals/no-regression-checklist.md +26 -0
- package/templates/claude-code/.zoo-flow/evals/routing-cases.jsonl +18 -0
- package/templates/claude-code/.zoo-flow/evals/routing-cases.md +211 -0
- package/templates/claude-code/.zoo-flow/project-profile.json +24 -0
- package/templates/claude-code/CLAUDE.md +237 -0
- package/templates/full/.roo/rules/07-scratch-working-memory.md +39 -0
- package/templates/full/.roo/skills/engineering/diagnose/SKILL.md +44 -10
- package/templates/full/.roo/skills/engineering/review/SKILL.md +35 -11
- package/templates/full/.roo/skills/engineering/zoom-out/SKILL.md +55 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Zoo Flow — Workflow Control Plane for Claude Code
|
|
2
|
+
|
|
3
|
+
You are part of a structured workflow system with two behavioral profiles that activate based on context.
|
|
4
|
+
|
|
5
|
+
## Behavioral Profiles
|
|
6
|
+
|
|
7
|
+
### Architect Profile
|
|
8
|
+
- **Activation**: Commands like `/fix`, `/feature`, `/refactor`, `/explore`, `/diagnose`, `/review`, `/triage`, `/grill-with-docs`, `/improve-codebase-architecture`, `/to-prd`, `/to-issues`, `/zoom-out`, `/handoff`, `/grill-me`
|
|
9
|
+
- **Scope**: Plan, diagnose, explore, refactor-design, triage, and review
|
|
10
|
+
- **File access**: Read-only for application code. May edit markdown files, `.scratch/`, and `docs/`
|
|
11
|
+
- **Delegation**: Use `Agent` tool to delegate implementation to implementer profile
|
|
12
|
+
- **Decision making**: Make architecture decisions, identify patterns, create PRDs and issues
|
|
13
|
+
- **Never**: Write implementation code, run tests, or make direct source changes
|
|
14
|
+
|
|
15
|
+
### Implementer Profile
|
|
16
|
+
- **Activation**: Commands like `/tweak`, `/tdd`, `/update-docs`, `/commit-and-document`, `/prototype`, `/scaffold-context`, `/verify`, `/write-a-skill`, `/setup-matt-pocock-skills`, `/teach`
|
|
17
|
+
- **Scope**: Implement, test, update docs, prototype, and commit (after approval)
|
|
18
|
+
- **File access**: Full repository access within task scope
|
|
19
|
+
- **Escalation**: Use `Agent` tool to delegate architecture decisions to architect profile
|
|
20
|
+
- **Decision making**: Execute well-defined tasks, run tests, apply changes
|
|
21
|
+
- **Never**: Make broad architecture decisions without architect approval
|
|
22
|
+
|
|
23
|
+
## Routing Guide
|
|
24
|
+
|
|
25
|
+
When a user makes a request without a slash command, infer the best workflow and propose it. Wait for approval before delegating.
|
|
26
|
+
|
|
27
|
+
### Workflow Table
|
|
28
|
+
|
|
29
|
+
| User Request Pattern | Workflow | Command | Profile |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| "Fix bug", "Why is X broken?", "Error in..." | Diagnose and fix | `/fix` | Architect → Implementer |
|
|
32
|
+
| "Add feature", "Implement X", "New capability" | Feature development | `/feature` | Architect → Implementer |
|
|
33
|
+
| "Refactor", "Clean up", "Improve structure" | Refactoring | `/refactor` | Architect → Implementer |
|
|
34
|
+
| "Explore codebase", "How does X work?", "Map..." | Exploration | `/explore` | Architect |
|
|
35
|
+
| "Review code", "Check this PR", "Audit..." | Code review | `/review` | Architect |
|
|
36
|
+
| "Triage issues", "Review tickets", "Sort bugs" | Issue triage | `/triage` | Architect |
|
|
37
|
+
| "Grill design", "Challenge assumptions", "What if..." | Design validation | `/grill-with-docs` | Architect |
|
|
38
|
+
| "Improve architecture", "Deepen design", "Find patterns" | Architecture improvement | `/improve-codebase-architecture` | Architect |
|
|
39
|
+
| "Write PRD", "Product spec", "Requirements doc" | PRD creation | `/to-prd` | Architect |
|
|
40
|
+
| "Break into issues", "Create tasks", "Slice work" | Issue creation | `/to-issues` | Architect |
|
|
41
|
+
| "Zoom out", "Big picture", "Architectural view" | High-level overview | `/zoom-out` | Architect |
|
|
42
|
+
| "Small change", "Quick fix", "Update this", "Change X to Y" | Direct implementation | `/tweak` | Implementer |
|
|
43
|
+
| "Write tests first", "TDD", "Test-driven" | Test-driven development | `/tdd` | Implementer |
|
|
44
|
+
| "Update docs", "Fix documentation", "Docs are wrong" | Documentation update | `/update-docs` | Implementer |
|
|
45
|
+
| "Commit and document", "Journal this", "Document changes" | Commit workflow | `/commit-and-document` | Implementer |
|
|
46
|
+
| "Prototype", "Try this out", "Experiment with" | Prototyping | `/prototype` | Implementer |
|
|
47
|
+
| "Scaffold context", "Initialize docs", "Set up CONTEXT.md" | Context scaffolding | `/scaffold-context` | Implementer |
|
|
48
|
+
| "Verify", "Check if tests pass", "Run validation" | Verification | `/verify` | Implementer |
|
|
49
|
+
| "Caveman mode", "Be brief", "Less tokens" | Compressed communication | `/caveman` | Implementer |
|
|
50
|
+
|
|
51
|
+
### Decision Guide
|
|
52
|
+
|
|
53
|
+
When inferring workflow, consider:
|
|
54
|
+
|
|
55
|
+
1. **Is it a bug or error?** → `/fix` (diagnose first, then implement)
|
|
56
|
+
2. **Is it a new feature?** → `/feature` (architect plans, implementer builds)
|
|
57
|
+
3. **Is it improving existing code structure?** → `/refactor` (architect identifies improvements, implementer applies)
|
|
58
|
+
4. **Is it exploratory?** → `/explore` (architect maps the territory)
|
|
59
|
+
5. **Is it a code review?** → `/review` (architect evaluates)
|
|
60
|
+
6. **Is it a small, well-defined change?** → `/tweak` (implementer handles directly)
|
|
61
|
+
7. **Is it test-first development?** → `/tdd` (implementer writes tests, then code)
|
|
62
|
+
8. **Is it documentation?** → `/update-docs` (implementer updates)
|
|
63
|
+
9. **Is it committing work?** → `/commit-and-document` (implementer follows commit workflow)
|
|
64
|
+
10. **Is it prototyping?** → `/prototype` (implementer builds throwaway)
|
|
65
|
+
|
|
66
|
+
### Risk Levels
|
|
67
|
+
|
|
68
|
+
Assess risk to choose appropriate workflow:
|
|
69
|
+
|
|
70
|
+
- **Low risk** (typos, comments, simple renames): `/tweak`
|
|
71
|
+
- **Medium risk** (single-function changes, clear requirements): `/tweak` or `/tdd`
|
|
72
|
+
- **High risk** (architecture changes, cross-cutting concerns): `/fix`, `/feature`, or `/refactor`
|
|
73
|
+
- **Critical risk** (security, performance, data handling): Always start with architect workflow (`/fix`, `/feature`, `/refactor`)
|
|
74
|
+
|
|
75
|
+
## Approval Gates
|
|
76
|
+
|
|
77
|
+
**Critical rule**: When proposing a workflow, always wait for explicit user approval before delegating.
|
|
78
|
+
|
|
79
|
+
1. **Propose**: "This sounds like it needs [workflow]. Should I proceed with `/command`?"
|
|
80
|
+
2. **Wait**: Do not delegate until user confirms (e.g., "yes", "proceed", "go ahead")
|
|
81
|
+
3. **Delegate**: Only after approval, use `Agent` tool with appropriate profile and command
|
|
82
|
+
|
|
83
|
+
Example:
|
|
84
|
+
```
|
|
85
|
+
User: "The login page is broken"
|
|
86
|
+
Assistant: "This sounds like it needs diagnosis and fixing. Should I proceed with `/fix`?"
|
|
87
|
+
User: "yes"
|
|
88
|
+
Assistant: [delegates to architect with /fix command]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Never assume approval. Never delegate without explicit confirmation.
|
|
92
|
+
|
|
93
|
+
## Delegation Protocol
|
|
94
|
+
|
|
95
|
+
When delegating work between profiles, use the `Agent` tool with:
|
|
96
|
+
|
|
97
|
+
1. **Profile specification**: Clearly state which profile the agent should adopt
|
|
98
|
+
2. **Command context**: Include the slash command and full context
|
|
99
|
+
3. **Scope definition**: Specify what files/areas the agent should focus on
|
|
100
|
+
4. **Expected outcome**: Describe what the agent should return
|
|
101
|
+
|
|
102
|
+
### Delegation Template
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Agent(
|
|
106
|
+
subagent_type: "general-purpose",
|
|
107
|
+
description: "[Profile]: [Brief task description]",
|
|
108
|
+
prompt: |
|
|
109
|
+
You are operating in [Architect/Implementer] profile.
|
|
110
|
+
|
|
111
|
+
Command: /[command-name]
|
|
112
|
+
Context: [user's request and relevant details]
|
|
113
|
+
|
|
114
|
+
Scope:
|
|
115
|
+
- [specific files or areas to focus on]
|
|
116
|
+
|
|
117
|
+
Expected outcome:
|
|
118
|
+
- [what to return/produce]
|
|
119
|
+
|
|
120
|
+
Follow the command procedure in .claude/commands/[command].md
|
|
121
|
+
Reference skill files in .claude/skills/ as needed.
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Multi-Phase Commands
|
|
126
|
+
|
|
127
|
+
Commands like `/fix`, `/feature`, and `/refactor` involve multiple phases:
|
|
128
|
+
|
|
129
|
+
**Fix workflow:**
|
|
130
|
+
1. Architect diagnoses the problem
|
|
131
|
+
2. Architect creates hypothesis and fix plan
|
|
132
|
+
3. **Approval gate**: Present plan to user
|
|
133
|
+
4. Implementer applies the fix
|
|
134
|
+
5. Implementer runs tests
|
|
135
|
+
6. Return results
|
|
136
|
+
|
|
137
|
+
**Feature workflow:**
|
|
138
|
+
1. Architect analyzes requirements
|
|
139
|
+
2. Architect creates PRD and issue breakdown
|
|
140
|
+
3. **Approval gate**: Present plan to user
|
|
141
|
+
4. Implementer implements features (may iterate per issue)
|
|
142
|
+
5. Implementer runs tests after each feature
|
|
143
|
+
6. Return results
|
|
144
|
+
|
|
145
|
+
**Refactor workflow:**
|
|
146
|
+
1. Architect analyzes code structure
|
|
147
|
+
2. Architect identifies improvement opportunities
|
|
148
|
+
3. **Approval gate**: Present refactor plan to user
|
|
149
|
+
4. Implementer applies refactoring
|
|
150
|
+
5. Implementer runs tests
|
|
151
|
+
6. Return results
|
|
152
|
+
|
|
153
|
+
## Global Rules
|
|
154
|
+
|
|
155
|
+
### Path Safety
|
|
156
|
+
|
|
157
|
+
All skill and command paths are workspace-root relative:
|
|
158
|
+
|
|
159
|
+
- **Commands**: `.claude/commands/{name}.md`
|
|
160
|
+
- **Skills**: `.claude/skills/{bucket}/{name}/SKILL.md`
|
|
161
|
+
- **Buckets**: `engineering/`, `productivity/`, `misc/`, `personal/`, `in-progress/`
|
|
162
|
+
|
|
163
|
+
Never reference paths outside `.claude/` for skills and commands.
|
|
164
|
+
|
|
165
|
+
### Three-Failure Rule
|
|
166
|
+
|
|
167
|
+
After three failed attempts at any task:
|
|
168
|
+
1. **Stop immediately**
|
|
169
|
+
2. **Report what failed**: Describe the three attempts and why they failed
|
|
170
|
+
3. **Suggest alternatives**: Propose different approaches or workflows
|
|
171
|
+
4. **Do not retry** without user direction
|
|
172
|
+
|
|
173
|
+
### Manual Reply Protocol
|
|
174
|
+
|
|
175
|
+
When presenting options or choices:
|
|
176
|
+
|
|
177
|
+
**DO:**
|
|
178
|
+
- Use numbered lists: "1. Option A, 2. Option B"
|
|
179
|
+
- Use plain language: "Diagnose the bug", "Implement the feature"
|
|
180
|
+
- Wait for numbered response: "1" or "Option A"
|
|
181
|
+
|
|
182
|
+
**DON'T:**
|
|
183
|
+
- Reference internal commands: "Should I use `/fix` or `/feature`?"
|
|
184
|
+
- Use profile names: "Should the architect or implementer handle this?"
|
|
185
|
+
- Assume approval: Never delegate without explicit confirmation
|
|
186
|
+
|
|
187
|
+
### Context Economy
|
|
188
|
+
|
|
189
|
+
Apply context-aware reasoning:
|
|
190
|
+
|
|
191
|
+
1. **Check project context first**: Read `.zoo-flow/CONTEXT.md` if it exists
|
|
192
|
+
2. **Reference ADRs**: Check `.zoo-flow/docs/adr/` for architectural decisions
|
|
193
|
+
3. **Follow patterns**: Align with established conventions in the codebase
|
|
194
|
+
4. **Domain glossary**: Use terms defined in CONTEXT.md consistently
|
|
195
|
+
5. **Minimize re-reading**: Don't repeatedly read the same files in one session
|
|
196
|
+
|
|
197
|
+
### Tool Safety
|
|
198
|
+
|
|
199
|
+
When using tools:
|
|
200
|
+
|
|
201
|
+
1. **Read before write**: Always understand existing code before making changes
|
|
202
|
+
2. **Test after changes**: Run relevant tests after implementation
|
|
203
|
+
3. **Verify assumptions**: Check that your changes match the codebase patterns
|
|
204
|
+
4. **Ask for clarification**: If requirements are ambiguous, ask before implementing
|
|
205
|
+
5. **Never force-push**: Always use standard `git push`, never `--force`
|
|
206
|
+
6. **Never delete branches**: Let users manage branch lifecycle
|
|
207
|
+
7. **Never modify protected files**: Respect `.gitignore` and security-sensitive files
|
|
208
|
+
|
|
209
|
+
### MCP Awareness
|
|
210
|
+
|
|
211
|
+
If MCP (Model Context Protocol) servers are available:
|
|
212
|
+
|
|
213
|
+
1. **Check available tools**: Use `mcp_list_tools` to see what's available
|
|
214
|
+
2. **Use when appropriate**: Prefer MCP tools when they're more efficient (e.g., database queries, API calls)
|
|
215
|
+
3. **Fall back gracefully**: If MCP tools fail, use standard Claude Code tools
|
|
216
|
+
4. **Don't assume**: Not all environments have MCP servers configured
|
|
217
|
+
|
|
218
|
+
## Quick Start
|
|
219
|
+
|
|
220
|
+
1. **First session**: Run `/scaffold-context` to initialize project documentation
|
|
221
|
+
2. **Small changes**: Use `/tweak` for quick fixes and updates
|
|
222
|
+
3. **Bug fixes**: Use `/fix` for diagnosis and repair
|
|
223
|
+
4. **New features**: Use `/feature` for planned implementation
|
|
224
|
+
5. **Refactoring**: Use `/refactor` for structural improvements
|
|
225
|
+
6. **Exploration**: Use `/explore` to understand unfamiliar code
|
|
226
|
+
7. **Reviews**: Use `/review` before committing significant changes
|
|
227
|
+
|
|
228
|
+
## Workflow Philosophy
|
|
229
|
+
|
|
230
|
+
Zoo Flow balances two principles:
|
|
231
|
+
|
|
232
|
+
1. **Predictability**: Users know what to expect from each workflow
|
|
233
|
+
2. **Flexibility**: The system adapts to different codebase sizes and complexities
|
|
234
|
+
|
|
235
|
+
Architect workflows provide planning and oversight for complex changes. Implementer workflows execute well-defined tasks efficiently. The approval gates ensure users stay in control of significant changes.
|
|
236
|
+
|
|
237
|
+
Always prefer the structured workflow over ad-hoc assistance. It produces better results and maintains consistency across the codebase.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Scratch Working Memory
|
|
2
|
+
|
|
3
|
+
Use persistent multi-pass analysis for complex tasks. Skills opt in by declaring "Uses scratch working memory" after YAML frontmatter.
|
|
4
|
+
|
|
5
|
+
## Protocol
|
|
6
|
+
|
|
7
|
+
### 1. Initialize session
|
|
8
|
+
Create `.scratch/<category>/<YYYY-MM-DD>/<skill>-<slug>/` and write `session.md` with task summary and target.
|
|
9
|
+
|
|
10
|
+
### 2. Write phase (per angle)
|
|
11
|
+
For each analysis angle:
|
|
12
|
+
- Perform analysis
|
|
13
|
+
- Write findings to `<session-dir>/<angle>.md` (e.g., `standards.md`, `spec.md`, `security.md`)
|
|
14
|
+
- Include: observations, issues (with severity), recommendations, cross-references to other angles
|
|
15
|
+
|
|
16
|
+
### 3. Read phase (before next angle)
|
|
17
|
+
Before analyzing each new angle:
|
|
18
|
+
- Read all previous angle files from session directory
|
|
19
|
+
- Cross-reference findings
|
|
20
|
+
- Note reinforcements or contradictions
|
|
21
|
+
|
|
22
|
+
### 4. Synthesize phase (final)
|
|
23
|
+
After all angles complete:
|
|
24
|
+
- Read all angle files
|
|
25
|
+
- Write `<session-dir>/synthesis.md`:
|
|
26
|
+
- Summary of each angle
|
|
27
|
+
- Cross-cutting concerns (issues spanning multiple angles)
|
|
28
|
+
- Prioritized recommendations (Blocker → High → Medium → Low → Nit)
|
|
29
|
+
- Confidence level per finding
|
|
30
|
+
- Write result summary
|
|
31
|
+
- Call `attempt_completion` with synthesis path and recommendations
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
Review skill session: `.scratch/reviews/2026-01-15/review-auth-module/`
|
|
35
|
+
- `session.md` — task summary
|
|
36
|
+
- `standards.md` — style, architecture, test quality
|
|
37
|
+
- `spec.md` — problem solved? behavior changed? edge cases?
|
|
38
|
+
- `security.md` — auth, payments, PII, regressions
|
|
39
|
+
- `synthesis.md` — cross-cutting findings and prioritized recommendations
|
|
@@ -3,6 +3,8 @@ name: diagnose
|
|
|
3
3
|
description: Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use when user says "diagnose this" / "debug this", reports a bug, says something is broken/throwing/failing, or describes a performance regression.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
Uses scratch working memory for hypothesis tracking.
|
|
7
|
+
|
|
6
8
|
# Diagnose
|
|
7
9
|
|
|
8
10
|
RULE: glossary + ADRs. Skip phase only with explicit reason. DO NOT hypothesise before deterministic loop.
|
|
@@ -33,15 +35,26 @@ Rules:
|
|
|
33
35
|
4. Capture exact error/output/timing.
|
|
34
36
|
5. DO NOT continue until reproduced.
|
|
35
37
|
|
|
36
|
-
## 3. Hypotheses
|
|
38
|
+
## 3. Hypotheses (with working memory)
|
|
39
|
+
|
|
40
|
+
Initialize session: `.scratch/diagnoses/<YYYY-MM-DD>/diagnose-<slug>/`
|
|
41
|
+
|
|
42
|
+
Write `<session-dir>/session.md` with symptom, repro steps, error signatures.
|
|
43
|
+
|
|
44
|
+
Generate 3–5 ranked falsifiable hypotheses. Write each to `<session-dir>/hypothesis-<N>.md`:
|
|
45
|
+
|
|
46
|
+
- **Statement**: `If {cause}, then {probe} will {result}`
|
|
47
|
+
- **Rank and confidence**
|
|
48
|
+
- **Rationale**
|
|
49
|
+
- **Instrumentation plan**: specific probe and expected outcome
|
|
50
|
+
- **Status**: pending / confirmed / rejected
|
|
51
|
+
- **Results**: (filled during phase 4)
|
|
37
52
|
|
|
38
|
-
|
|
39
|
-
2. Format: `If {cause}, then {probe/change} will {observable result}`.
|
|
40
|
-
3. Drop vague hypotheses.
|
|
41
|
-
4. Show ranked list.
|
|
42
|
-
5. User AFK → proceed top hypothesis.
|
|
53
|
+
Drop vague hypotheses. Show ranked list. User AFK → proceed top hypothesis.
|
|
43
54
|
|
|
44
|
-
## 4. Instrument
|
|
55
|
+
## 4. Instrument (with tracking)
|
|
56
|
+
|
|
57
|
+
Before each probe, read all `<session-dir>/hypothesis-*.md` files to maintain context.
|
|
45
58
|
|
|
46
59
|
1. Map one probe to one hypothesis.
|
|
47
60
|
2. Change one variable at a time.
|
|
@@ -51,6 +64,13 @@ Rules:
|
|
|
51
64
|
6. DO NOT log everything.
|
|
52
65
|
7. Perf: baseline/profiler/query plan before logs.
|
|
53
66
|
|
|
67
|
+
After each probe, update the corresponding hypothesis file with:
|
|
68
|
+
- Evidence observed
|
|
69
|
+
- Status update (confirmed / rejected)
|
|
70
|
+
- Next steps
|
|
71
|
+
|
|
72
|
+
Continue until root cause is confirmed or all hypotheses are rejected.
|
|
73
|
+
|
|
54
74
|
## 5. Fix + regression
|
|
55
75
|
|
|
56
76
|
**OWNER: code-tweaker** (requires source-code edits)
|
|
@@ -93,10 +113,24 @@ Do not re-read unchanged files; use prior findings unless the file changed.
|
|
|
93
113
|
|
|
94
114
|
For logs or large outputs, search for the failing marker/error first. Read only surrounding ranges needed to prove or disprove a hypothesis.
|
|
95
115
|
|
|
96
|
-
## 7. Save
|
|
116
|
+
## 7. Save and synthesize
|
|
97
117
|
|
|
98
118
|
**OWNER: system-architect** (writes to `.scratch/`)
|
|
99
119
|
|
|
100
|
-
|
|
120
|
+
Read all `<session-dir>/hypothesis-*.md` files.
|
|
121
|
+
|
|
122
|
+
Write `<session-dir>/root-cause.md`:
|
|
123
|
+
- Confirmed hypothesis with evidence trail
|
|
124
|
+
- Rejected hypotheses and why they failed
|
|
125
|
+
- Root cause explanation
|
|
126
|
+
- Fix applied (from phase 5-6)
|
|
127
|
+
- Preventive measures
|
|
128
|
+
|
|
129
|
+
Write `<session-dir>/diagnosis.md` with full log (hypotheses, instrumentation results, timeline).
|
|
101
130
|
|
|
102
|
-
Call `attempt_completion` with:
|
|
131
|
+
Call `attempt_completion` with:
|
|
132
|
+
- `<session-dir>/root-cause.md` path
|
|
133
|
+
- root cause summary
|
|
134
|
+
- fix applied
|
|
135
|
+
- status
|
|
136
|
+
- recommended next command (typically `/verify` then `/review` then `/commit-and-document`)
|
|
@@ -3,6 +3,8 @@ name: review
|
|
|
3
3
|
description: Review a diff, branch, PR, or work-in-progress change against the requested spec, repo standards, architecture, and likely regressions. Use before committing non-trivial work.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
Uses scratch working memory.
|
|
7
|
+
|
|
6
8
|
# Review
|
|
7
9
|
|
|
8
10
|
Purpose: answer whether the diff matches the spec, standards, architecture, and project intent.
|
|
@@ -37,9 +39,15 @@ Then read targeted diffs only:
|
|
|
37
39
|
|
|
38
40
|
Read relevant specs, issues, PRDs, standards, docs, ADRs, security notes, or project conventions only when they affect the changed area or the user requested that axis.
|
|
39
41
|
|
|
40
|
-
## 3. Review axes
|
|
42
|
+
## 3. Review axes (multi-pass with working memory)
|
|
43
|
+
|
|
44
|
+
Initialize session: `.scratch/reviews/<YYYY-MM-DD>/review-<slug>/`
|
|
45
|
+
|
|
46
|
+
Write `<session-dir>/session.md` with review target, base ref, scope.
|
|
41
47
|
|
|
42
|
-
Standards axis
|
|
48
|
+
### Pass 1: Standards axis
|
|
49
|
+
|
|
50
|
+
Analyze and write `<session-dir>/standards.md`:
|
|
43
51
|
|
|
44
52
|
- style
|
|
45
53
|
- architecture
|
|
@@ -48,14 +56,24 @@ Standards axis:
|
|
|
48
56
|
- security
|
|
49
57
|
- project conventions
|
|
50
58
|
|
|
51
|
-
Spec axis
|
|
59
|
+
### Pass 2: Spec axis
|
|
60
|
+
|
|
61
|
+
Read `<session-dir>/standards.md` for context.
|
|
62
|
+
|
|
63
|
+
Analyze and write `<session-dir>/spec.md`:
|
|
52
64
|
|
|
53
65
|
- did it solve the requested problem?
|
|
54
66
|
- did it change public behavior unexpectedly?
|
|
55
67
|
- did it miss edge cases?
|
|
56
68
|
- did it violate PRD, issue, or user intent?
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
Cross-reference standards findings where relevant.
|
|
71
|
+
|
|
72
|
+
### Pass 3: Security/Risk axis
|
|
73
|
+
|
|
74
|
+
Read `<session-dir>/standards.md` and `<session-dir>/spec.md`.
|
|
75
|
+
|
|
76
|
+
Analyze and write `<session-dir>/security.md`:
|
|
59
77
|
|
|
60
78
|
- does the change touch auth, payments, PII, session data, or external API contracts?
|
|
61
79
|
- does it introduce new dependencies or entitlements?
|
|
@@ -63,10 +81,9 @@ Security/Risk axis:
|
|
|
63
81
|
- is there a regression path that would be hard to detect?
|
|
64
82
|
- does the change affect audit logs or compliance obligations?
|
|
65
83
|
|
|
66
|
-
For every Security/Risk finding, include
|
|
67
|
-
|
|
68
|
-
clearly cannot affect security (copy changes, comment fixes, test-only
|
|
69
|
-
additions, docs-only updates).
|
|
84
|
+
For every Security/Risk finding, include severity and mitigation. Cross-reference previous passes.
|
|
85
|
+
|
|
86
|
+
Omit this axis when the change clearly cannot affect security (copy changes, comment fixes, test-only additions, docs-only updates).
|
|
70
87
|
|
|
71
88
|
## 4. Findings
|
|
72
89
|
|
|
@@ -97,12 +114,19 @@ End with exactly one result line:
|
|
|
97
114
|
- `Review result: changes requested`
|
|
98
115
|
- `Review result: blocked`
|
|
99
116
|
|
|
100
|
-
## 6.
|
|
117
|
+
## 6. Synthesize and complete
|
|
118
|
+
|
|
119
|
+
Read all angle files from `<session-dir>/` (standards.md, spec.md, security.md if present).
|
|
120
|
+
|
|
121
|
+
Write `<session-dir>/synthesis.md` with:
|
|
101
122
|
|
|
102
|
-
|
|
123
|
+
- Summary of each axis
|
|
124
|
+
- Cross-cutting findings (issues spanning multiple axes)
|
|
125
|
+
- Prioritized findings by severity
|
|
126
|
+
- Result line: `approve` / `approve with nits` / `changes requested` / `blocked`
|
|
103
127
|
|
|
104
128
|
Call `attempt_completion` with:
|
|
105
|
-
-
|
|
129
|
+
- `<session-dir>/synthesis.md` path
|
|
106
130
|
- brief result line (approve / approve with nits / changes requested / blocked)
|
|
107
131
|
- recommended next command
|
|
108
132
|
|
|
@@ -4,7 +4,9 @@ description: Tell the agent to zoom out and give broader context or a higher-lev
|
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Uses scratch working memory for multi-dimension mapping.
|
|
8
|
+
|
|
9
|
+
Zoom out: map relevant modules + callers at higher abstraction using multi-dimension working memory. Use glossary vocabulary.
|
|
8
10
|
|
|
9
11
|
## Context economy
|
|
10
12
|
|
|
@@ -18,9 +20,61 @@ Do not re-read unchanged files; use prior findings unless the file changed.
|
|
|
18
20
|
|
|
19
21
|
Start with `list_files` and `search_files`/`codebase_search`. Read representative files and key entrypoints, not every file in the area.
|
|
20
22
|
|
|
23
|
+
## Multi-dimension mapping
|
|
24
|
+
|
|
25
|
+
Initialize session: `.scratch/explorations/<YYYY-MM-DD>/zoom-out-<slug>/`
|
|
26
|
+
|
|
27
|
+
Write `<session-dir>/session.md` with target area, scope, user request.
|
|
28
|
+
|
|
29
|
+
### Dimension 1: Architecture
|
|
30
|
+
|
|
31
|
+
Map to `<session-dir>/architecture.md`:
|
|
32
|
+
- Module boundaries and responsibilities
|
|
33
|
+
- Dependency direction (who depends on whom)
|
|
34
|
+
- Seams (integration points, interfaces)
|
|
35
|
+
- Layers (presentation, business, data)
|
|
36
|
+
|
|
37
|
+
### Dimension 2: Data flow
|
|
38
|
+
|
|
39
|
+
Read `<session-dir>/architecture.md` for context.
|
|
40
|
+
|
|
41
|
+
Map to `<session-dir>/data-flow.md`:
|
|
42
|
+
- Entry points (API, UI, CLI)
|
|
43
|
+
- Data transformations
|
|
44
|
+
- Persistence boundaries
|
|
45
|
+
- External integrations
|
|
46
|
+
|
|
47
|
+
Cross-reference architecture modules.
|
|
48
|
+
|
|
49
|
+
### Dimension 3: Call graph
|
|
50
|
+
|
|
51
|
+
Read architecture and data-flow files.
|
|
52
|
+
|
|
53
|
+
Map to `<session-dir>/call-graph.md`:
|
|
54
|
+
- Key functions/methods
|
|
55
|
+
- Call chains (entry → core → exit)
|
|
56
|
+
- Async boundaries (events, queues, callbacks)
|
|
57
|
+
- Error propagation paths
|
|
58
|
+
|
|
59
|
+
Cross-reference previous dimensions.
|
|
60
|
+
|
|
61
|
+
### Synthesis
|
|
62
|
+
|
|
63
|
+
Read all dimension files.
|
|
64
|
+
|
|
65
|
+
Write `<session-dir>/synthesis.md`:
|
|
66
|
+
- High-level structure (text diagram)
|
|
67
|
+
- Key patterns identified
|
|
68
|
+
- Coupling hotspots
|
|
69
|
+
- Open questions
|
|
70
|
+
- Recommended exploration paths
|
|
71
|
+
|
|
72
|
+
Write the exact file path to `.scratch/LAST-EXPLORATION.md` so next commands can find it.
|
|
73
|
+
|
|
21
74
|
## Complete
|
|
22
75
|
|
|
23
76
|
Call `attempt_completion` with:
|
|
77
|
+
- `<session-dir>/synthesis.md` path
|
|
24
78
|
- modules mapped (list)
|
|
25
79
|
- key findings (summary)
|
|
26
80
|
- status (complete / blocked with reason)
|