cc-devflow 1.0.3 → 2.4.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.
Files changed (42) hide show
  1. package/.claude/CLAUDE.md +123 -4
  2. package/.claude/agents/code-quality-reviewer.md +205 -0
  3. package/.claude/agents/spec-reviewer.md +221 -0
  4. package/.claude/commands/cancel-ralph.md +59 -0
  5. package/.claude/commands/flow-dev.md +202 -21
  6. package/.claude/commands/flow-epic.md +33 -0
  7. package/.claude/commands/flow-fix.md +138 -20
  8. package/.claude/commands/flow-init.md +104 -15
  9. package/.claude/commands/flow-new.md +84 -35
  10. package/.claude/commands/flow-prd.md +16 -3
  11. package/.claude/commands/flow-release.md +33 -0
  12. package/.claude/commands/flow-review.md +257 -0
  13. package/.claude/docs/templates/ATTEMPT_TEMPLATE.md +156 -0
  14. package/.claude/docs/templates/BRAINSTORM_TEMPLATE.md +148 -0
  15. package/.claude/docs/templates/ERROR_LOG_TEMPLATE.md +80 -0
  16. package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +22 -14
  17. package/.claude/guides/workflow-guides/flow-orchestrator.md +2 -2
  18. package/.claude/hooks/hooks.json +15 -0
  19. package/.claude/hooks/ralph-stop-hook.sh +190 -0
  20. package/.claude/rules/devflow-conventions.md +3 -1
  21. package/.claude/rules/project-constitution.md +256 -2
  22. package/.claude/rules/rationalization-library.md +282 -0
  23. package/.claude/scripts/create-requirement.sh +19 -6
  24. package/.claude/scripts/setup-ralph-loop.sh +155 -0
  25. package/.claude/scripts/verify-gate.sh +269 -0
  26. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +70 -20
  27. package/.claude/skills/file-header-guardian/SKILL.md +56 -0
  28. package/.claude/skills/flow-attention-refresh/SKILL.md +170 -0
  29. package/.claude/skills/flow-brainstorming/SKILL.md +161 -0
  30. package/.claude/skills/flow-debugging/SKILL.md +221 -0
  31. package/.claude/skills/flow-finishing-branch/SKILL.md +189 -0
  32. package/.claude/skills/flow-receiving-review/SKILL.md +153 -0
  33. package/.claude/skills/flow-tdd/SKILL.md +218 -0
  34. package/.claude/skills/fractal-docs-generator/SKILL.md +45 -0
  35. package/.claude/skills/skill-rules.json +75 -0
  36. package/.claude/skills/verification-before-completion/SKILL.md +158 -0
  37. package/README.md +104 -19
  38. package/README.zh-CN.md +79 -1
  39. package/docs/commands/flow-init.md +3 -1
  40. package/docs/commands/flow-init.zh-CN.md +3 -1
  41. package/package.json +1 -1
  42. package/.claude/tsc-cache/777aa1de-497e-411b-a40f-13b74efcec58/affected-repos.txt +0 -1
package/.claude/CLAUDE.md CHANGED
@@ -19,12 +19,12 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
19
19
 
20
20
  ├── commands/ # Slash command definitions
21
21
  │ ├── flow-checklist.md # /flow-checklist command [NEW: REQ-002]
22
- │ ├── flow-init.md # /flow-init
22
+ │ ├── flow-init.md # /flow-init (modified: Git Branch Creation moved to Stage 1.2)
23
23
  │ ├── flow-clarify.md # /flow-clarify
24
24
  │ ├── flow-prd.md # /flow-prd
25
25
  │ ├── flow-tech.md # /flow-tech
26
26
  │ ├── flow-epic.md # /flow-epic (modified: Checklist Gate)
27
- │ ├── flow-dev.md # /flow-dev
27
+ │ ├── flow-dev.md # /flow-dev (Autonomous by default, /w --manual opt)
28
28
  │ └── ... # Other commands
29
29
 
30
30
  ├── hooks/ # JavaScript hooks for validation/gating
@@ -38,12 +38,23 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
38
38
  │ └── ... # Other scripts
39
39
 
40
40
  ├── skills/ # Reusable skill definitions
41
- └── cc-devflow-orchestrator/
42
- └── skill.md # Workflow router (modified: /flow-checklist)
41
+ ├── fractal-docs-generator/ # 目录级 CLAUDE.md 自动生成
42
+ └── SKILL.md
43
+ │ ├── file-header-guardian/ # 文件头注释 @input/@output/@pos 守护
44
+ │ │ └── SKILL.md
45
+ │ ├── flow-attention-refresh/ # 注意力刷新协议 [NEW: v2.3.0 Ralph × Manus]
46
+ │ │ └── SKILL.md
47
+ │ ├── flow-tdd/ # TDD enforcement (modified: Error Recording)
48
+ │ │ └── SKILL.md
49
+ │ ├── cc-devflow-orchestrator/
50
+ │ │ └── SKILL.md # Workflow router (modified: /flow-checklist, /flow-dev autonomous)
51
+ │ └── ...
43
52
 
44
53
  └── docs/
45
54
  └── templates/
46
55
  ├── CHECKLIST_TEMPLATE.md # Checklist output template [NEW: REQ-002]
56
+ ├── ERROR_LOG_TEMPLATE.md # Error log template [NEW: v2.3.0 Ralph × Manus]
57
+ ├── ATTEMPT_TEMPLATE.md # Research attempt template [NEW: v2.3.0 Ralph × Manus]
47
58
  └── ... # Other templates
48
59
  ```
49
60
 
@@ -81,3 +92,111 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
81
92
 
82
93
  **Last Updated**: 2025-12-15
83
94
  **REQ-002 Version**: 1.0.0
95
+
96
+ ---
97
+
98
+ ## v2.3.0 Module: Ralph × Manus Integration
99
+
100
+ ### Purpose
101
+ Combine Ralph-Wiggum's autonomous iteration loop with Manus-style Planning-with-Files for memory-enhanced continuous development.
102
+
103
+ ### Core Concepts
104
+
105
+ **Ralph Loop**: Autonomous iteration until completion (持续迭代直到完成,永不放弃)
106
+ - Prompt stays constant, file state changes
107
+ - Claude learns from its own previous work
108
+ - Auto-retry on errors, no manual intervention
109
+
110
+ **Manus 6 Principles**:
111
+ 1. 文件系统作外部记忆 - Filesystem as external memory
112
+ 2. 注意力操纵 - Attention manipulation (read goal files at key moments)
113
+ 3. 保留失败痕迹 - Keep failure traces (ERROR_LOG.md, research/attempts/)
114
+ 4. 避免少样本过拟合 - Avoid few-shot overfitting
115
+ 5. 稳定前缀优化缓存 - Stable prefix for KV-cache optimization
116
+ 6. 只追加上下文 - Append-only context
117
+
118
+ **Why They're a Perfect Match**:
119
+ - Ralph: "监督把活干完" (supervise task completion)
120
+ - Manus: "认真把进度记下来" (carefully record progress)
121
+ - Together: 有记忆的持续迭代系统 (memory-enhanced continuous iteration)
122
+
123
+ ### Components
124
+
125
+ | Component | File | Purpose |
126
+ |-----------|------|---------|
127
+ | **Command** | `commands/flow-dev.md` | Autonomous iteration loop (Default) |
128
+ | **Attention Skill** | `skills/flow-attention-refresh/SKILL.md` | 4 attention refresh protocols |
129
+ | **TDD Skill** | `skills/flow-tdd/SKILL.md` | Error recording integration |
130
+ | **Error Template** | `docs/templates/ERROR_LOG_TEMPLATE.md` | Execution error log format |
131
+ | **Attempt Template** | `docs/templates/ATTEMPT_TEMPLATE.md` | Research attempt log format |
132
+
133
+ **Modified Files**:
134
+ - `commands/flow-dev.md` - Merged Ralph Loop (Autonomous by default)
135
+ - `commands/flow-init.md` - Added Manus method in Stage 2.5 Research
136
+ - `skills/cc-devflow-orchestrator/SKILL.md` - Updated routing for autonomous flow
137
+
138
+ ### Attention Refresh Protocols
139
+
140
+ | Protocol | Trigger Point | Reads | Purpose |
141
+ |----------|---------------|-------|---------|
142
+ | Protocol 1 | Every flow-* Entry Gate | BRAINSTORM.md | Align with original intent |
143
+ | Protocol 2 | flow-dev task start | TASKS.md T### + DoD | Clarify task goal |
144
+ | Protocol 3 | Ralph iteration start | TASKS.md + ERROR_LOG.md | Next action + avoid errors |
145
+ | Protocol 4 | After error | ERROR_LOG.md | Root cause analysis |
146
+
147
+ ### ERROR_LOG.md Structure
148
+
149
+ ```markdown
150
+ ## [TIMESTAMP] E###: TITLE
151
+
152
+ **Phase**: flow-dev / T###
153
+ **Error Type**: Test Failure | Build Error | Runtime Error
154
+ **Error Message**: [full error]
155
+ **Root Cause**: [after analysis]
156
+ **Resolution**: [after fix]
157
+ **Prevention**: [optional]
158
+ ```
159
+
160
+ ### research/attempts/ Structure
161
+
162
+ ```markdown
163
+ # Attempt: [方案名]
164
+
165
+ **Date**: YYYY-MM-DD
166
+ **Context**: 解决 [什么问题]
167
+
168
+ ## Approach / Result / Reason / Learning / References
169
+ ```
170
+
171
+ ### Integration Points
172
+
173
+ 1. **Entry**: After `/flow-epic`, execute `/flow-dev`
174
+ 2. **Trigger**: `status: "epic_complete"` → `/flow-dev` (Autonomous by default)
175
+ 3. **Output**:
176
+ - `ERROR_LOG.md` (execution errors)
177
+ - `research/attempts/` (research phase failures)
178
+ - All tasks completed with TDD
179
+
180
+ ### Modes: Autonomous (Default) vs Manual
181
+
182
+ | | /flow-dev (Default) | /flow-dev --manual |
183
+ |--|-----------|-------------|
184
+ | 退出条件 | 迭代直到完成或上限 | 任务失败可停止 |
185
+ | 错误处理 | 自动重试 | 提示用户修复 |
186
+ | 注意力刷新 | 每迭代刷新(含错误学习) | 每任务一次 |
187
+ | 适用场景 | 可无人值守 | 需要人工监督 |
188
+ | ERROR_LOG | 强制记录 | 可选记录 |
189
+
190
+ ### Success Metrics (Target)
191
+
192
+ | 指标 | 目标 |
193
+ |------|------|
194
+ | 任务完成率 (无人工干预) | ≥85% |
195
+ | 测试失败后自动恢复率 | ≥70% |
196
+ | 上下文遗忘导致的返工 | ≤0.5 次/需求 |
197
+ | 错误重复发生率 | ≤10% |
198
+
199
+ ---
200
+
201
+ **Last Updated**: 2026-01-08
202
+ **v2.3.0 Module**: Ralph × Manus Integration
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: code-quality-reviewer
3
+ description: "Stage 2 of Two-Stage Review: Reviews code quality, structure, and Constitution compliance. Only runs after spec-reviewer passes."
4
+ type: research
5
+ output: CODE_QUALITY_REVIEW.md
6
+ ---
7
+
8
+ # Code Quality Reviewer Agent
9
+
10
+ ## Purpose
11
+
12
+ Second stage of the Two-Stage Review process. Reviews code quality **after** spec compliance is verified.
13
+
14
+ ## Prerequisite
15
+
16
+ **Stage 1 (spec-reviewer) MUST pass before this agent runs.**
17
+
18
+ If spec-reviewer found issues, those must be fixed first. Code quality review on non-compliant code is wasted effort.
19
+
20
+ ## Review Dimensions
21
+
22
+ ### 1. Code Clarity
23
+
24
+ ```yaml
25
+ Naming:
26
+ - Variables describe their purpose
27
+ - Functions describe their action
28
+ - Consistent with codebase patterns
29
+
30
+ Structure:
31
+ - Logical organization
32
+ - Clear control flow
33
+ - No deeply nested code (≤3 levels)
34
+
35
+ Comments:
36
+ - WHY, not WHAT
37
+ - No obvious comments
38
+ - Complex logic explained
39
+ ```
40
+
41
+ ### 2. Test Quality
42
+
43
+ ```yaml
44
+ Coverage:
45
+ - ≥80% line coverage
46
+ - Critical paths covered
47
+ - Edge cases tested
48
+
49
+ Quality:
50
+ - Tests are meaningful (not cheater tests)
51
+ - Tests are independent
52
+ - Tests are fast
53
+ - Test names describe behavior
54
+
55
+ TDD Compliance:
56
+ - Tests written before implementation
57
+ - Tests failed first, then passed
58
+ ```
59
+
60
+ ### 3. Constitution Compliance
61
+
62
+ ```yaml
63
+ Article I - Quality First:
64
+ - No partial implementations
65
+ - No TODO/FIXME in production code
66
+ - Complete error handling
67
+
68
+ Article II - Architectural Consistency:
69
+ - No code duplication
70
+ - Consistent naming patterns
71
+ - Reuses existing utilities
72
+
73
+ Article III - Security First:
74
+ - No hardcoded secrets
75
+ - Input validation present
76
+ - Secure defaults
77
+
78
+ Article IV - Performance:
79
+ - No resource leaks
80
+ - Efficient algorithms
81
+ - Proper cleanup
82
+
83
+ Article V - Maintainability:
84
+ - No dead code
85
+ - Clear separation of concerns
86
+ - File size ≤500 lines
87
+
88
+ Article VI - TDD:
89
+ - Tests exist for all new code
90
+ - TDD sequence followed
91
+ ```
92
+
93
+ ### 4. Performance & Security
94
+
95
+ ```yaml
96
+ Performance:
97
+ - No obvious N+1 queries
98
+ - No unnecessary loops
99
+ - Appropriate data structures
100
+
101
+ Security:
102
+ - No SQL injection risks
103
+ - No XSS vulnerabilities
104
+ - Proper authentication checks
105
+ ```
106
+
107
+ ## Output Format
108
+
109
+ ```markdown
110
+ # Code Quality Review Report - ${REQ_ID}
111
+
112
+ ## Summary
113
+ - **Status**: PASS | FAIL | NEEDS_WORK
114
+ - **Quality Score**: X/10
115
+ - **Critical Issues**: N
116
+ - **Warnings**: M
117
+
118
+ ## Code Clarity
119
+
120
+ | Aspect | Status | Notes |
121
+ |--------|--------|-------|
122
+ | Naming | ✅/⚠️/❌ | ... |
123
+ | Structure | ✅/⚠️/❌ | ... |
124
+ | Comments | ✅/⚠️/❌ | ... |
125
+
126
+ ## Test Quality
127
+
128
+ | Metric | Value | Target | Status |
129
+ |--------|-------|--------|--------|
130
+ | Coverage | X% | ≥80% | ✅/❌ |
131
+ | Test Count | N | - | - |
132
+ | TDD Compliance | Yes/No | Yes | ✅/❌ |
133
+
134
+ ### Test Issues
135
+ - [Issue 1]
136
+ - [Issue 2]
137
+
138
+ ## Constitution Compliance
139
+
140
+ | Article | Status | Violations |
141
+ |---------|--------|------------|
142
+ | I - Quality First | ✅/❌ | ... |
143
+ | II - Architectural | ✅/❌ | ... |
144
+ | III - Security | ✅/❌ | ... |
145
+ | IV - Performance | ✅/❌ | ... |
146
+ | V - Maintainability | ✅/❌ | ... |
147
+ | VI - TDD | ✅/❌ | ... |
148
+
149
+ ## Performance & Security
150
+
151
+ ### Performance Issues
152
+ - [Issue 1]
153
+
154
+ ### Security Issues
155
+ - [Issue 1]
156
+
157
+ ## Recommendations
158
+
159
+ ### Critical (Must Fix)
160
+ 1. [Issue and fix]
161
+
162
+ ### Warnings (Should Fix)
163
+ 1. [Issue and suggestion]
164
+
165
+ ### Suggestions (Nice to Have)
166
+ 1. [Improvement idea]
167
+
168
+ ## Verdict
169
+
170
+ **PASS**: Code quality meets standards
171
+ **FAIL**: [List critical issues]
172
+ ```
173
+
174
+ ## Severity Levels
175
+
176
+ | Level | Description | Action |
177
+ |-------|-------------|--------|
178
+ | **Critical** | Security vulnerability, data loss risk | Block merge |
179
+ | **High** | Constitution violation, major bug | Must fix |
180
+ | **Medium** | Code smell, minor issue | Should fix |
181
+ | **Low** | Style, suggestion | Optional |
182
+
183
+ ## Rationalization Prevention
184
+
185
+ | Excuse | Reality |
186
+ |--------|---------|
187
+ | "It works" | Working ≠ quality. Review the code. |
188
+ | "Tests pass" | Passing tests ≠ good tests. Check quality. |
189
+ | "Time pressure" | Quality saves time long-term. |
190
+ | "Minor issue" | Minor issues compound. Fix them. |
191
+
192
+ ## Integration
193
+
194
+ This agent is called by `/flow-review` command as Stage 2.
195
+
196
+ ```yaml
197
+ /flow-review execution:
198
+ Stage 1: spec-reviewer → SPEC_REVIEW.md
199
+ ↓ (must pass)
200
+ Stage 2: code-quality-reviewer → CODE_QUALITY_REVIEW.md
201
+ ```
202
+
203
+ ---
204
+
205
+ **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: spec-reviewer
3
+ description: "Stage 1 of Two-Stage Review: Verifies implementation matches PRD/EPIC/TASKS specifications. Does NOT trust implementer reports - reads code directly."
4
+ type: research
5
+ output: SPEC_REVIEW.md
6
+ ---
7
+
8
+ # Spec Reviewer Agent
9
+
10
+ ## Purpose
11
+
12
+ First stage of the Two-Stage Review process. Verifies that implementation matches specifications **exactly** - no more, no less.
13
+
14
+ ## The Iron Law
15
+
16
+ ```
17
+ SPEC IS CONTRACT - DEVIATION IS DEFECT
18
+ Missing requirement = defect
19
+ Extra feature = defect
20
+ Both must be fixed
21
+ ```
22
+
23
+ ## Core Principle
24
+
25
+ **DO NOT TRUST IMPLEMENTER REPORTS**
26
+
27
+ The implementer may:
28
+ - Believe they implemented something they didn't
29
+ - Miss edge cases they thought they covered
30
+ - Add features not in spec (scope creep)
31
+ - Interpret requirements differently
32
+
33
+ **Your job**: Read the code. Verify against spec. Trust nothing.
34
+
35
+ ## Input Documents
36
+
37
+ Load these documents before review:
38
+
39
+ ```yaml
40
+ Required:
41
+ - devflow/requirements/${REQ}/PRD.md
42
+ - devflow/requirements/${REQ}/EPIC.md
43
+ - devflow/requirements/${REQ}/TASKS.md
44
+ - devflow/requirements/${REQ}/BRAINSTORM.md
45
+
46
+ Optional:
47
+ - devflow/requirements/${REQ}/contracts/openapi.yaml
48
+ - devflow/requirements/${REQ}/UI_PROTOTYPE.html
49
+ ```
50
+
51
+ ## Review Process
52
+
53
+ ### Phase 1: Build Requirements Checklist
54
+
55
+ ```yaml
56
+ For each User Story in PRD:
57
+ - Extract acceptance criteria
58
+ - Create verification checklist item
59
+ - Note: "Must verify in code"
60
+
61
+ For each Task in TASKS.md:
62
+ - Extract expected outcome
63
+ - Create verification checklist item
64
+ - Note file paths mentioned
65
+ ```
66
+
67
+ ### Phase 2: Code Verification (NOT Trust-Based)
68
+
69
+ ```yaml
70
+ For each checklist item:
71
+ 1. Locate relevant code files
72
+ 2. READ the actual implementation
73
+ 3. Verify behavior matches spec
74
+ 4. Check edge cases mentioned in spec
75
+ 5. Mark: ✅ Implemented | ❌ Missing | ⚠️ Partial | 🚫 Extra
76
+ ```
77
+
78
+ ### Phase 3: Scope Creep Detection
79
+
80
+ ```yaml
81
+ Scan implementation for:
82
+ - Features not in PRD
83
+ - Endpoints not in contract
84
+ - UI elements not in prototype
85
+ - Configuration options not requested
86
+
87
+ Each extra feature = defect (Article X violation)
88
+ ```
89
+
90
+ ### Phase 4: BRAINSTORM Alignment
91
+
92
+ ```yaml
93
+ Verify against BRAINSTORM.md:
94
+ - Does implementation solve the original problem?
95
+ - Does it follow the selected approach?
96
+ - Are constraints respected?
97
+ - Are success criteria achievable?
98
+ ```
99
+
100
+ ## Output Format
101
+
102
+ ```markdown
103
+ # Spec Review Report - ${REQ_ID}
104
+
105
+ ## Summary
106
+ - **Status**: PASS | FAIL | NEEDS_WORK
107
+ - **Requirements Verified**: X/Y
108
+ - **Missing**: N items
109
+ - **Extra (Scope Creep)**: M items
110
+
111
+ ## Requirements Checklist
112
+
113
+ ### User Story 1: [Title]
114
+
115
+ | Requirement | Status | Evidence |
116
+ |-------------|--------|----------|
117
+ | [Acceptance Criteria 1] | ✅ | Found in `src/file.ts:42` |
118
+ | [Acceptance Criteria 2] | ❌ | Not found in codebase |
119
+ | [Acceptance Criteria 3] | ⚠️ | Partial: missing edge case X |
120
+
121
+ ### User Story 2: [Title]
122
+ ...
123
+
124
+ ## Scope Creep Detected
125
+
126
+ | Extra Feature | Location | Action Required |
127
+ |---------------|----------|-----------------|
128
+ | [Feature not in spec] | `src/extra.ts` | Remove or create new REQ |
129
+
130
+ ## BRAINSTORM Alignment
131
+
132
+ | Check | Status | Notes |
133
+ |-------|--------|-------|
134
+ | Solves original problem | ✅/❌ | ... |
135
+ | Follows selected approach | ✅/❌ | ... |
136
+ | Respects constraints | ✅/❌ | ... |
137
+
138
+ ## Verdict
139
+
140
+ **PASS**: All requirements implemented, no scope creep
141
+ **FAIL**: [List specific failures]
142
+
143
+ ## Required Actions
144
+
145
+ 1. [Action 1]
146
+ 2. [Action 2]
147
+ ```
148
+
149
+ ## Verification Methods
150
+
151
+ ### For API Endpoints
152
+
153
+ ```yaml
154
+ 1. Read OpenAPI contract
155
+ 2. Find route handler in code
156
+ 3. Verify:
157
+ - HTTP method matches
158
+ - Path matches
159
+ - Request body schema matches
160
+ - Response schema matches
161
+ - Error codes match
162
+ ```
163
+
164
+ ### For UI Components
165
+
166
+ ```yaml
167
+ 1. Read UI_PROTOTYPE.html
168
+ 2. Find component in code
169
+ 3. Verify:
170
+ - All elements present
171
+ - Interactions implemented
172
+ - States handled (loading, error, empty)
173
+ ```
174
+
175
+ ### For Business Logic
176
+
177
+ ```yaml
178
+ 1. Read PRD acceptance criteria
179
+ 2. Find implementation
180
+ 3. Verify:
181
+ - Happy path works
182
+ - Edge cases handled
183
+ - Error cases handled
184
+ ```
185
+
186
+ ## Rationalization Prevention
187
+
188
+ | Excuse | Reality |
189
+ |--------|---------|
190
+ | "Implementer said it's done" | Read the code. Verify yourself. |
191
+ | "Tests pass so it works" | Tests may not cover all requirements. |
192
+ | "It's close enough" | Close ≠ correct. Spec is contract. |
193
+ | "Extra features are helpful" | Extra = scope creep = defect. |
194
+ | "Minor deviation" | Minor deviations compound. Fix them. |
195
+
196
+ ## Red Flags - STOP
197
+
198
+ If you find yourself:
199
+ - Trusting implementer's completion claims
200
+ - Skipping code verification
201
+ - Accepting "close enough"
202
+ - Ignoring extra features
203
+
204
+ **STOP. Read the code. Verify against spec. Trust nothing.**
205
+
206
+ ## Integration
207
+
208
+ This agent is called by `/flow-review` command as Stage 1.
209
+
210
+ ```yaml
211
+ /flow-review execution:
212
+ Stage 1: spec-reviewer → SPEC_REVIEW.md
213
+ ↓ (must pass)
214
+ Stage 2: code-quality-reviewer → CODE_QUALITY_REVIEW.md
215
+ ```
216
+
217
+ Stage 2 only runs if Stage 1 passes.
218
+
219
+ ---
220
+
221
+ **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: "Cancel active Ralph Wiggum loop"
3
+ allowed-tools: ["Bash(test -f .claude/ralph-loop.local.md:*)", "Bash(rm .claude/ralph-loop.local.md)", "Read(.claude/ralph-loop.local.md)"]
4
+ hide-from-slash-command-tool: "true"
5
+ ---
6
+
7
+ # Cancel Ralph - 取消 Ralph 循环
8
+
9
+ ## 用途
10
+
11
+ 手动取消当前会话中正在运行的 Ralph 循环。
12
+
13
+ ## 使用方法
14
+
15
+ ```
16
+ /cancel-ralph
17
+ ```
18
+
19
+ ## 执行步骤
20
+
21
+ 1. 检查 `.claude/ralph-loop.local.md` 是否存在
22
+ ```bash
23
+ test -f .claude/ralph-loop.local.md && echo "EXISTS" || echo "NOT_FOUND"
24
+ ```
25
+
26
+ 2. **如果 NOT_FOUND**:
27
+ - 输出: "No active Ralph loop found."
28
+
29
+ 3. **如果 EXISTS**:
30
+ - 读取 `.claude/ralph-loop.local.md` 获取当前 iteration
31
+ - 删除状态文件:
32
+ ```bash
33
+ rm .claude/ralph-loop.local.md
34
+ ```
35
+ - 输出: "Cancelled Ralph loop (was at iteration N)" 其中 N 是 iteration 值
36
+
37
+ ## 何时使用
38
+
39
+ - Ralph 循环陷入死循环
40
+ - 需要手动干预修复问题
41
+ - 想要停止无限循环
42
+
43
+ ## 示例
44
+
45
+ ```
46
+ User: /cancel-ralph
47
+ Assistant: [检查状态文件]
48
+ Assistant: Cancelled Ralph loop (was at iteration 15)
49
+ ```
50
+
51
+ ## 注意事项
52
+
53
+ - 取消后需要手动清理未完成的工作
54
+ - 建议在取消前检查 ERROR_LOG.md 了解问题
55
+ - 可以重新运行 `/flow-ralph` 从当前状态继续
56
+
57
+ ---
58
+
59
+ **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md