cc-devflow 4.1.4 → 4.1.6
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/CLAUDE.md +87 -1183
- package/.claude/commands/core/architecture.md +2 -2
- package/.claude/commands/core/guidelines.md +2 -2
- package/.claude/commands/core/roadmap.md +4 -4
- package/.claude/commands/core/style.md +40 -268
- package/.claude/commands/flow/CLAUDE.md +28 -0
- package/.claude/commands/flow/archive.md +2 -2
- package/.claude/commands/flow/checklist.md +9 -251
- package/.claude/commands/flow/clarify.md +9 -127
- package/.claude/commands/flow/constitution.md +1 -1
- package/.claude/commands/flow/context.md +1 -1
- package/.claude/commands/flow/dev.md +19 -395
- package/.claude/commands/flow/fix.md +1 -6
- package/.claude/commands/flow/ideate.md +13 -13
- package/.claude/commands/flow/init.md +19 -41
- package/.claude/commands/flow/new.md +12 -268
- package/.claude/commands/flow/quality.md +10 -153
- package/.claude/commands/flow/release.md +18 -131
- package/.claude/commands/flow/restart.md +15 -16
- package/.claude/commands/flow/spec.md +14 -164
- package/.claude/commands/flow/status.md +12 -12
- package/.claude/commands/flow/update.md +4 -4
- package/.claude/commands/flow/upgrade.md +6 -6
- package/.claude/commands/flow/verify.md +19 -78
- package/.claude/commands/flow/workspace.md +3 -20
- package/.claude/docs/guides/INIT_TROUBLESHOOTING.md +7 -7
- package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +44 -96
- package/.claude/docs/guides/ROADMAP_TROUBLESHOOTING.md +1 -1
- package/.claude/docs/guides/TASK_COMPLETION_MARKING.md +5 -5
- package/.claude/docs/guides/TEAM_MODE_GUIDE.md +0 -1
- package/.claude/docs/templates/ATTEMPT_TEMPLATE.md +1 -1
- package/.claude/docs/templates/BACKLOG_TEMPLATE.md +3 -3
- package/.claude/docs/templates/CLARIFICATION_REPORT_TEMPLATE.md +5 -5
- package/.claude/docs/templates/ERROR_LOG_TEMPLATE.md +2 -2
- package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +3 -3
- package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +33 -64
- package/.claude/docs/templates/RESEARCH_TEMPLATE.md +3 -3
- package/.claude/docs/templates/ROADMAP_DIALOGUE_TEMPLATE.md +2 -2
- package/.claude/docs/templates/ROADMAP_TEMPLATE.md +2 -2
- package/.claude/docs/templates/STYLE_TEMPLATE.md +3 -3
- package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +8 -9
- package/.claude/guides/workflow-guides/flow-orchestrator.md +31 -265
- package/.claude/hooks/CLAUDE.md +1 -1
- package/.claude/hooks/checklist-gate.js +4 -4
- package/.claude/hooks/inject-agent-context.ts +2 -2
- package/.claude/hooks/teammate-idle-hook.ts +1 -1
- package/.claude/rules/devflow-conventions.md +2 -93
- package/.claude/scripts/CLAUDE.md +1 -4
- package/.claude/scripts/calculate-checklist-completion.sh +2 -2
- package/.claude/scripts/check-prerequisites.sh +2 -2
- package/.claude/scripts/checklist-errors.sh +4 -4
- package/.claude/scripts/common.sh +12 -147
- package/.claude/scripts/flow-quality-full.sh +5 -5
- package/.claude/scripts/flow-quality-quick.sh +4 -4
- package/.claude/scripts/flow-workspace-init.sh +2 -2
- package/.claude/scripts/generate-clarification-report.sh +4 -4
- package/.claude/scripts/recover-workflow.sh +70 -73
- package/.claude/scripts/run-quality-gates.sh +1 -1
- package/.claude/scripts/setup-epic.sh +2 -2
- package/.claude/scripts/setup-ralph-loop.sh +2 -2
- package/.claude/scripts/validate-research.sh +1 -1
- package/.claude/scripts/verify-setup.sh +1 -1
- package/.claude/skills/cc-devflow-orchestrator/SKILL.md +88 -108
- package/.claude/skills/workflow/CLAUDE.md +24 -0
- package/.claude/skills/workflow/flow-dev/CLAUDE.md +14 -76
- package/.claude/skills/workflow/flow-dev/SKILL.md +29 -67
- package/.claude/skills/workflow/flow-dev/context.jsonl +4 -8
- package/.claude/skills/workflow/flow-init/SKILL.md +23 -186
- package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +1 -1
- package/.claude/skills/workflow/flow-init/context.jsonl +3 -3
- package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +1 -1
- package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +15 -134
- package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +1 -1
- package/.claude/skills/workflow/flow-release/SKILL.md +20 -110
- package/.claude/skills/workflow/flow-release/context.jsonl +5 -7
- package/.claude/skills/workflow/flow-spec/CLAUDE.md +15 -101
- package/.claude/skills/workflow/flow-spec/SKILL.md +15 -518
- package/.claude/skills/workflow/flow-spec/context.jsonl +5 -7
- package/.claude/skills/workflow/flow-verify/CLAUDE.md +10 -0
- package/.claude/skills/workflow/flow-verify/SKILL.md +53 -0
- package/.claude/skills/workflow/flow-verify/context.jsonl +5 -0
- package/.claude/skills/workflow.yaml +72 -270
- package/CHANGELOG.md +72 -0
- package/README.md +91 -69
- package/README.zh-CN.md +90 -67
- package/bin/harness.js +22 -0
- package/docs/commands/README.md +34 -38
- package/docs/commands/README.zh-CN.md +34 -36
- package/docs/commands/core-roadmap.md +2 -2
- package/docs/commands/core-roadmap.zh-CN.md +2 -2
- package/docs/commands/core-style.md +29 -381
- package/docs/commands/core-style.zh-CN.md +29 -381
- package/docs/commands/flow-init.md +10 -10
- package/docs/commands/flow-init.zh-CN.md +11 -11
- package/docs/commands/flow-new.md +25 -260
- package/docs/commands/flow-new.zh-CN.md +26 -257
- package/docs/guides/getting-started.md +16 -15
- package/docs/guides/getting-started.zh-CN.md +10 -12
- package/lib/compiler/__tests__/manifest.test.js +156 -0
- package/lib/compiler/__tests__/parser.test.js +21 -0
- package/lib/compiler/index.js +17 -1
- package/lib/compiler/manifest.js +68 -6
- package/lib/compiler/parser.js +5 -0
- package/lib/harness/CLAUDE.md +21 -0
- package/lib/harness/cli.js +208 -0
- package/lib/harness/index.js +16 -0
- package/lib/harness/operations/dispatch.js +285 -0
- package/lib/harness/operations/init.js +48 -0
- package/lib/harness/operations/janitor.js +74 -0
- package/lib/harness/operations/pack.js +100 -0
- package/lib/harness/operations/plan.js +29 -0
- package/lib/harness/operations/release.js +83 -0
- package/lib/harness/operations/resume.js +44 -0
- package/lib/harness/operations/verify.js +163 -0
- package/lib/harness/planner.js +141 -0
- package/lib/harness/schemas.js +108 -0
- package/lib/harness/store.js +240 -0
- package/package.json +9 -1
- package/.claude/scripts/flow-workspace-start.sh +0 -217
- package/.claude/scripts/flow-workspace-switch.sh +0 -234
- package/.claude/skills/domain/using-git-worktrees/SKILL.md +0 -252
- package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +0 -133
- package/.claude/skills/domain/using-git-worktrees/context.jsonl +0 -4
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +0 -218
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +0 -232
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +0 -130
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +0 -140
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +0 -70
package/.claude/CLAUDE.md
CHANGED
|
@@ -1,1221 +1,125 @@
|
|
|
1
1
|
# CC-DevFlow .claude Directory Architecture
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
|
-
|
|
4
|
+
`.claude/` 是 CC-DevFlow 的执行控制层:定义命令入口、Skill 依赖、运行时脚本、Hook 策略与模板约束。
|
|
5
5
|
|
|
6
|
-
## Directory Structure (
|
|
6
|
+
## Directory Structure (v6.0 Harness-First)
|
|
7
7
|
|
|
8
|
-
```
|
|
8
|
+
```text
|
|
9
9
|
.claude/
|
|
10
|
-
├── skills/
|
|
11
|
-
│ ├── workflow.yaml
|
|
12
|
-
│
|
|
13
|
-
│ ├──
|
|
14
|
-
│ │ ├── flow-
|
|
15
|
-
│ │
|
|
16
|
-
│ │
|
|
17
|
-
│ │
|
|
18
|
-
│ │
|
|
19
|
-
│ │
|
|
20
|
-
│
|
|
21
|
-
│
|
|
22
|
-
│
|
|
23
|
-
|
|
24
|
-
│
|
|
25
|
-
│
|
|
26
|
-
│
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
│ │ ├── debugging/ # 系统化调试
|
|
31
|
-
│ │ ├── brainstorming/ # 头脑风暴
|
|
32
|
-
│ │ └── using-git-worktrees/ # Git Worktree 管理 [NEW: v4.3] ⭐
|
|
33
|
-
│ │
|
|
34
|
-
│ ├── guardrail/ # 守护 Skills
|
|
35
|
-
│ │ ├── constitution-guardian/
|
|
36
|
-
│ │ └── tdd-enforcer/
|
|
37
|
-
│ │
|
|
38
|
-
│ └── utility/ # 工具 Skills
|
|
39
|
-
│ ├── git-commit/
|
|
40
|
-
│ └── npm-release/
|
|
41
|
-
│
|
|
42
|
-
├── commands/ # 命令目录 (v4.2 命名空间重构)
|
|
43
|
-
│ ├── flow/ # 工作流命令 (20个) → /flow:xxx
|
|
44
|
-
│ ├── core/ # 核心命令 (4个) → /core:xxx
|
|
45
|
-
│ └── util/ # 工具命令 (4个) → /util:xxx
|
|
46
|
-
├── agents/ # Agent 指令 (迁移到 skills/*/references/)
|
|
47
|
-
├── hooks/ # 钩子脚本
|
|
48
|
-
│ ├── inject-skill-context.ts # 上下文注入钩子 [NEW: v4.0]
|
|
49
|
-
│ ├── ralph-loop.ts # Ralph Loop 程序化验证 [NEW: v4.4]
|
|
50
|
-
│ ├── teammate-idle-hook.ts # Team 任务调度器 [NEW: v4.7] ⭐
|
|
51
|
-
│ ├── task-completed-hook.ts # 任务完成验证器 [NEW: v4.7] ⭐
|
|
52
|
-
│ └── types/
|
|
53
|
-
│ └── team-types.d.ts # Team 状态类型定义 [NEW: v4.7]
|
|
54
|
-
├── scripts/ # 共享脚本
|
|
55
|
-
│ ├── CLAUDE.md # scripts 子目录地图(成员清单与职责边界)
|
|
56
|
-
│ ├── common.sh # 通用函数 (含 worktree 辅助函数)
|
|
57
|
-
│ └── flow-workspace-switch.sh # workspace REQ 切换与 worktree 快捷切换
|
|
58
|
-
└── docs/templates/ # 共享模板
|
|
59
|
-
└── _shared/ # 共享模板组件 [NEW: v4.1]
|
|
60
|
-
├── CONSTITUTION_CHECK.md
|
|
61
|
-
├── VALIDATION_CHECKLIST.md
|
|
62
|
-
└── YAML_FRONTMATTER.md
|
|
63
|
-
|
|
64
|
-
devflow/
|
|
65
|
-
├── spec/ # 分层规范库 [NEW: v4.0]
|
|
66
|
-
│ ├── frontend/index.md # 前端规范
|
|
67
|
-
│ ├── backend/index.md # 后端规范
|
|
68
|
-
│ └── shared/index.md # 共享规范
|
|
69
|
-
└── requirements/ # 需求目录
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## v4.0 Skills-First Architecture
|
|
73
|
-
|
|
74
|
-
### 核心创新 (借鉴 Trellis + OpenSpec)
|
|
75
|
-
|
|
76
|
-
| 来源 | 创新点 | 应用方式 |
|
|
77
|
-
|------|--------|----------|
|
|
78
|
-
| **Trellis** | JSONL 上下文注入 | 每个 Skill 有 `context.jsonl` |
|
|
79
|
-
| **Trellis** | 分层规范库 | `devflow/spec/{frontend,backend}/` |
|
|
80
|
-
| **OpenSpec** | Schema 驱动工作流 | `workflow.yaml` 定义依赖图 |
|
|
81
|
-
| **OpenSpec** | 文件存在性状态检测 | 通过 generates 判断完成状态 |
|
|
82
|
-
|
|
83
|
-
### Skill 结构规范
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
skill-name/
|
|
87
|
-
├── SKILL.md # 核心指令 (<500 行)
|
|
88
|
-
├── context.jsonl # 上下文定义
|
|
89
|
-
├── scripts/ # 内嵌脚本
|
|
90
|
-
├── references/ # Agent 指令
|
|
91
|
-
└── assets/ # 模板
|
|
10
|
+
├── skills/
|
|
11
|
+
│ ├── workflow.yaml
|
|
12
|
+
│ ├── workflow/
|
|
13
|
+
│ │ ├── flow-init/
|
|
14
|
+
│ │ ├── flow-spec/
|
|
15
|
+
│ │ ├── flow-dev/
|
|
16
|
+
│ │ ├── flow-verify/
|
|
17
|
+
│ │ ├── flow-release/
|
|
18
|
+
│ │ ├── flow-fix/
|
|
19
|
+
│ │ └── flow-quality/ # 兼容保留
|
|
20
|
+
│ ├── domain/
|
|
21
|
+
│ ├── guardrail/
|
|
22
|
+
│ └── utility/
|
|
23
|
+
├── commands/
|
|
24
|
+
│ ├── flow/ # /flow:*
|
|
25
|
+
│ ├── core/ # /core:*
|
|
26
|
+
│ └── util/ # /util:*
|
|
27
|
+
├── hooks/
|
|
28
|
+
├── scripts/
|
|
29
|
+
└── docs/templates/
|
|
92
30
|
```
|
|
93
31
|
|
|
94
|
-
|
|
32
|
+
## Current Canonical Flow (Default)
|
|
95
33
|
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
{"file": "devflow/spec/frontend/index.md", "reason": "Frontend conventions", "optional": true}
|
|
34
|
+
```text
|
|
35
|
+
/flow:init -> /flow:spec -> /flow:dev -> /flow:verify -> /flow:release
|
|
99
36
|
```
|
|
100
37
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
## v4.2.0 Module: Commands Namespace Restructure
|
|
38
|
+
### Runtime Mapping
|
|
104
39
|
|
|
105
|
-
|
|
40
|
+
| Command | Runtime Ops | Core Output |
|
|
41
|
+
|---------|-------------|-------------|
|
|
42
|
+
| `/flow:init` | `harness:init` + `harness:pack` | `context-package.md`, `harness-state.json` |
|
|
43
|
+
| `/flow:spec` | `harness:plan` | `task-manifest.json` |
|
|
44
|
+
| `/flow:dev` | `harness:dispatch` / `harness:resume` | `runtime-events.jsonl` |
|
|
45
|
+
| `/flow:verify` | `harness:verify` | `report-card.json` |
|
|
46
|
+
| `/flow:release` | `harness:release` + `harness:janitor` | `release-note.md` |
|
|
106
47
|
|
|
107
|
-
|
|
48
|
+
## Command Namespace
|
|
108
49
|
|
|
109
|
-
###
|
|
50
|
+
### Active Namespaces
|
|
110
51
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
│ ├── dev.md # /flow:dev
|
|
117
|
-
│ ├── quality.md # /flow:quality
|
|
118
|
-
│ ├── release.md # /flow:release
|
|
119
|
-
│ ├── fix.md # /flow:fix
|
|
120
|
-
│ ├── new.md # /flow:new
|
|
121
|
-
│ ├── ideate.md # /flow:ideate
|
|
122
|
-
│ ├── clarify.md # /flow:clarify
|
|
123
|
-
│ ├── restart.md # /flow:restart
|
|
124
|
-
│ ├── status.md # /flow:status
|
|
125
|
-
│ ├── update.md # /flow:update
|
|
126
|
-
│ ├── upgrade.md # /flow:upgrade
|
|
127
|
-
│ ├── verify.md # /flow:verify
|
|
128
|
-
│ ├── archive.md # /flow:archive
|
|
129
|
-
│ ├── checklist.md # /flow:checklist
|
|
130
|
-
│ ├── context.md # /flow:context
|
|
131
|
-
│ ├── delta.md # /flow:delta
|
|
132
|
-
│ ├── workspace.md # /flow:workspace
|
|
133
|
-
│ └── constitution.md # /flow:constitution
|
|
134
|
-
│
|
|
135
|
-
├── core/ # 核心命令 (4个)
|
|
136
|
-
│ ├── architecture.md # /core:architecture
|
|
137
|
-
│ ├── guidelines.md # /core:guidelines
|
|
138
|
-
│ ├── roadmap.md # /core:roadmap
|
|
139
|
-
│ └── style.md # /core:style
|
|
140
|
-
│
|
|
141
|
-
└── util/ # 工具命令 (4个)
|
|
142
|
-
├── git-commit.md # /util:git-commit
|
|
143
|
-
├── code-review.md # /util:code-review
|
|
144
|
-
├── problem-analyzer.md # /util:problem-analyzer
|
|
145
|
-
└── cancel-ralph.md # /util:cancel-ralph
|
|
146
|
-
```
|
|
52
|
+
| Namespace | Scope | Example |
|
|
53
|
+
|-----------|-------|---------|
|
|
54
|
+
| `flow` | Requirement delivery | `/flow:spec "REQ-123"` |
|
|
55
|
+
| `core` | Project-level governance | `/core:roadmap` |
|
|
56
|
+
| `util` | Engineering utilities | `/util:code-review` |
|
|
147
57
|
|
|
148
|
-
###
|
|
58
|
+
### Migration (Legacy -> Current)
|
|
149
59
|
|
|
150
|
-
|
|
|
151
|
-
|
|
60
|
+
| Legacy | Current |
|
|
61
|
+
|--------|---------|
|
|
152
62
|
| `/flow-init` | `/flow:init` |
|
|
153
63
|
| `/flow-spec` | `/flow:spec` |
|
|
154
64
|
| `/flow-dev` | `/flow:dev` |
|
|
65
|
+
| `/flow-restart` | `/flow:restart` |
|
|
66
|
+
| `/flow-status` | `/flow:status` |
|
|
155
67
|
| `/core-architecture` | `/core:architecture` |
|
|
156
68
|
| `/git-commit` | `/util:git-commit` |
|
|
157
|
-
| `/code-review-high` | `/util:code-review` |
|
|
158
|
-
|
|
159
|
-
### Benefits
|
|
160
|
-
|
|
161
|
-
1. **清晰分类**: 28 个命令分为 3 组,一目了然
|
|
162
|
-
2. **命名空间**: 避免命令名冲突
|
|
163
|
-
3. **可扩展**: 新命令按类别添加
|
|
164
|
-
4. **对齐 Trellis**: 统一风格,便于跨项目协作
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
**Last Updated**: 2026-02-07
|
|
169
|
-
**v4.2.0 Module**: Commands Namespace Restructure
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## Legacy Structure (保留兼容)
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
.claude/
|
|
177
|
-
├── agents/ # Agent instruction files (迁移中)
|
|
178
|
-
├── commands/ # Slash command definitions (已重构为命名空间)
|
|
179
|
-
├── hooks/ # JavaScript hooks
|
|
180
|
-
├── scripts/ # Bash utility scripts
|
|
181
|
-
└── docs/templates/ # Templates
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
## REQ-002 Module: /flow-checklist
|
|
185
|
-
|
|
186
|
-
### Purpose
|
|
187
|
-
"Unit Tests for English" - Quality validation for requirement documents before task planning.
|
|
188
|
-
|
|
189
|
-
### Components
|
|
190
|
-
|
|
191
|
-
| Component | File | Lines | Purpose |
|
|
192
|
-
|-----------|------|-------|---------|
|
|
193
|
-
| Command | `commands/flow-checklist.md` | 256 | Command definition and flow |
|
|
194
|
-
| Agent | `agents/checklist-agent.md` | 176 | Generation logic with Anti-Example rules |
|
|
195
|
-
| Gate Hook | `hooks/checklist-gate.js` | 320 | Epic entry gate validation |
|
|
196
|
-
| Calculator | `scripts/calculate-checklist-completion.sh` | 244 | Completion percentage |
|
|
197
|
-
| Errors | `scripts/checklist-errors.sh` | 132 | Error codes and validation |
|
|
198
|
-
| Template | `docs/templates/CHECKLIST_TEMPLATE.md` | 53 | Output format |
|
|
199
|
-
|
|
200
|
-
### Integration Points
|
|
201
|
-
|
|
202
|
-
1. **Entry**: After `/flow-prd`, before `/flow-epic`
|
|
203
|
-
2. **Gate**: Integrated into `/flow-epic` Entry Gate (Step 5)
|
|
204
|
-
3. **Config**: `config/quality-rules.yml` (80% threshold)
|
|
205
|
-
4. **Output**: `devflow/requirements/{REQ}/checklists/*.md`
|
|
206
|
-
|
|
207
|
-
### Quality Dimensions
|
|
208
|
-
- Completeness
|
|
209
|
-
- Clarity
|
|
210
|
-
- Consistency
|
|
211
|
-
- Measurability
|
|
212
|
-
- Coverage
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
**Last Updated**: 2025-12-15
|
|
217
|
-
**REQ-002 Version**: 1.0.0
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## v2.3.0 Module: Ralph × Manus Integration
|
|
222
|
-
|
|
223
|
-
### Purpose
|
|
224
|
-
Combine Ralph-Wiggum's autonomous iteration loop with Manus-style Planning-with-Files for memory-enhanced continuous development.
|
|
225
|
-
|
|
226
|
-
### Core Concepts
|
|
227
|
-
|
|
228
|
-
**Ralph Loop**: Autonomous iteration until completion (持续迭代直到完成,永不放弃)
|
|
229
|
-
- Prompt stays constant, file state changes
|
|
230
|
-
- Claude learns from its own previous work
|
|
231
|
-
- Auto-retry on errors, no manual intervention
|
|
232
|
-
|
|
233
|
-
**Manus 6 Principles**:
|
|
234
|
-
1. 文件系统作外部记忆 - Filesystem as external memory
|
|
235
|
-
2. 注意力操纵 - Attention manipulation (read goal files at key moments)
|
|
236
|
-
3. 保留失败痕迹 - Keep failure traces (ERROR_LOG.md, research/attempts/)
|
|
237
|
-
4. 避免少样本过拟合 - Avoid few-shot overfitting
|
|
238
|
-
5. 稳定前缀优化缓存 - Stable prefix for KV-cache optimization
|
|
239
|
-
6. 只追加上下文 - Append-only context
|
|
240
|
-
|
|
241
|
-
**Why They're a Perfect Match**:
|
|
242
|
-
- Ralph: "监督把活干完" (supervise task completion)
|
|
243
|
-
- Manus: "认真把进度记下来" (carefully record progress)
|
|
244
|
-
- Together: 有记忆的持续迭代系统 (memory-enhanced continuous iteration)
|
|
245
|
-
|
|
246
|
-
### Components
|
|
247
|
-
|
|
248
|
-
| Component | File | Purpose |
|
|
249
|
-
|-----------|------|---------|
|
|
250
|
-
| **Command** | `commands/flow-dev.md` | Autonomous iteration loop (Default) |
|
|
251
|
-
| **Attention Skill** | `skills/flow-attention-refresh/SKILL.md` | 4 attention refresh protocols |
|
|
252
|
-
| **TDD Skill** | `skills/flow-tdd/SKILL.md` | Error recording integration |
|
|
253
|
-
| **Error Template** | `docs/templates/ERROR_LOG_TEMPLATE.md` | Execution error log format |
|
|
254
|
-
| **Attempt Template** | `docs/templates/ATTEMPT_TEMPLATE.md` | Research attempt log format |
|
|
255
|
-
|
|
256
|
-
**Modified Files**:
|
|
257
|
-
- `commands/flow-dev.md` - Merged Ralph Loop (Autonomous by default)
|
|
258
|
-
- `commands/flow-init.md` - Research made mandatory via `flow-researcher` subagent (context-isolated)
|
|
259
|
-
- `skills/cc-devflow-orchestrator/SKILL.md` - Updated routing for autonomous flow
|
|
260
|
-
|
|
261
|
-
### Attention Refresh Protocols
|
|
262
|
-
|
|
263
|
-
| Protocol | Trigger Point | Reads | Purpose |
|
|
264
|
-
|----------|---------------|-------|---------|
|
|
265
|
-
| Protocol 1 | Every flow-* Entry Gate | BRAINSTORM.md | Align with original intent |
|
|
266
|
-
| Protocol 2 | flow-dev task start | TASKS.md T### + DoD | Clarify task goal |
|
|
267
|
-
| Protocol 3 | Ralph iteration start | TASKS.md + ERROR_LOG.md | Next action + avoid errors |
|
|
268
|
-
| Protocol 4 | After error | ERROR_LOG.md | Root cause analysis |
|
|
269
|
-
|
|
270
|
-
### ERROR_LOG.md Structure
|
|
271
|
-
|
|
272
|
-
```markdown
|
|
273
|
-
## [TIMESTAMP] E###: TITLE
|
|
274
|
-
|
|
275
|
-
**Phase**: flow-dev / T###
|
|
276
|
-
**Error Type**: Test Failure | Build Error | Runtime Error
|
|
277
|
-
**Error Message**: [full error]
|
|
278
|
-
**Root Cause**: [after analysis]
|
|
279
|
-
**Resolution**: [after fix]
|
|
280
|
-
**Prevention**: [optional]
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
### research/attempts/ Structure
|
|
284
|
-
|
|
285
|
-
```markdown
|
|
286
|
-
# Attempt: [方案名]
|
|
287
|
-
|
|
288
|
-
**Date**: YYYY-MM-DD
|
|
289
|
-
**Context**: 解决 [什么问题]
|
|
290
|
-
|
|
291
|
-
## Approach / Result / Reason / Learning / References
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Integration Points
|
|
295
|
-
|
|
296
|
-
1. **Entry**: After `/flow-epic`, execute `/flow-dev`
|
|
297
|
-
2. **Trigger**: `status: "epic_complete"` → `/flow-dev` (Autonomous by default)
|
|
298
|
-
3. **Output**:
|
|
299
|
-
- `ERROR_LOG.md` (execution errors)
|
|
300
|
-
- `research/attempts/` (research phase failures)
|
|
301
|
-
- All tasks completed with TDD
|
|
302
|
-
|
|
303
|
-
### Modes: Autonomous (Default) vs Manual
|
|
304
|
-
|
|
305
|
-
| | /flow-dev (Default) | /flow-dev --manual |
|
|
306
|
-
|--|-----------|-------------|
|
|
307
|
-
| 退出条件 | 迭代直到完成或上限 | 任务失败可停止 |
|
|
308
|
-
| 错误处理 | 自动重试 | 提示用户修复 |
|
|
309
|
-
| 注意力刷新 | 每迭代刷新(含错误学习) | 每任务一次 |
|
|
310
|
-
| 适用场景 | 可无人值守 | 需要人工监督 |
|
|
311
|
-
| ERROR_LOG | 强制记录 | 可选记录 |
|
|
312
|
-
|
|
313
|
-
### Success Metrics (Target)
|
|
314
|
-
|
|
315
|
-
| 指标 | 目标 |
|
|
316
|
-
|------|------|
|
|
317
|
-
| 任务完成率 (无人工干预) | ≥85% |
|
|
318
|
-
| 测试失败后自动恢复率 | ≥70% |
|
|
319
|
-
| 上下文遗忘导致的返工 | ≤0.5 次/需求 |
|
|
320
|
-
| 错误重复发生率 | ≤10% |
|
|
321
|
-
|
|
322
|
-
---
|
|
323
|
-
|
|
324
|
-
**Last Updated**: 2026-02-06
|
|
325
|
-
**v2.3.0 Module**: Ralph × Manus Integration
|
|
326
|
-
|
|
327
|
-
---
|
|
328
|
-
|
|
329
|
-
## v3.0.0 Module: OpenSpec × Trellis Integration
|
|
330
|
-
|
|
331
|
-
### Purpose
|
|
332
|
-
|
|
333
|
-
Borrow design concepts from OpenSpec (Delta Specs + Archive) and Trellis (Context Injection + Ralph Loop) to solve 5 major pain points:
|
|
334
|
-
|
|
335
|
-
1. **Context Bloat** → Staged Context Injection (RM-015)
|
|
336
|
-
2. **Weak Quality Gates** → Programmatic Verification (RM-016)
|
|
337
|
-
3. **No Incremental Tracking** → Delta Specs Engine (RM-017)
|
|
338
|
-
4. **No Session Persistence** → Workspace System (RM-018)
|
|
339
|
-
5. **Scattered Guidelines** → Unified Spec Directory (RM-019)
|
|
340
|
-
6. **Workflow Redundancy** → Flow Simplification (RM-020)
|
|
341
|
-
|
|
342
|
-
### New Directory Structure
|
|
343
69
|
|
|
344
|
-
|
|
345
|
-
devflow/
|
|
346
|
-
├── specs/ # SSOT for specifications [NEW: RM-017]
|
|
347
|
-
│ └── modules/ # Module-level specs
|
|
348
|
-
├── workspace/ # Developer workspaces [NEW: RM-018]
|
|
349
|
-
│ └── {developer}/ # Per-developer journals
|
|
350
|
-
├── spec/ # Unified project specs [NEW: RM-019]
|
|
351
|
-
│ ├── frontend/ # Frontend specifications
|
|
352
|
-
│ ├── backend/ # Backend specifications
|
|
353
|
-
│ └── shared/ # Cross-cutting specs
|
|
354
|
-
├── QUICK_REFERENCE.md # v3.0 workflow quick reference [NEW]
|
|
355
|
-
└── MIGRATION_v3.0.md # Migration guide [NEW]
|
|
356
|
-
|
|
357
|
-
.claude/
|
|
358
|
-
├── config/
|
|
359
|
-
│ └── quality-gates.yml # Programmatic verification rules [NEW: RM-016]
|
|
360
|
-
├── hooks/
|
|
361
|
-
│ ├── inject-agent-context.ts # Context injection hook [NEW: RM-015]
|
|
362
|
-
│ ├── types/
|
|
363
|
-
│ │ └── context-injection.d.ts # TypeScript types [NEW]
|
|
364
|
-
│ └── utils/
|
|
365
|
-
│ └── jsonl-parser.ts # JSONL parsing utilities [NEW]
|
|
366
|
-
├── commands/
|
|
367
|
-
│ ├── flow-context.md # Context management [NEW: RM-015]
|
|
368
|
-
│ ├── flow-delta.md # Delta specs management [NEW: RM-017]
|
|
369
|
-
│ ├── flow-workspace.md # Workspace management [NEW: RM-018]
|
|
370
|
-
│ └── flow-quality.md # Combined quality verification [NEW: RM-020]
|
|
371
|
-
├── scripts/
|
|
372
|
-
│ ├── flow-context-*.sh # Context scripts [NEW]
|
|
373
|
-
│ ├── flow-delta-*.sh # Delta scripts [NEW]
|
|
374
|
-
│ ├── flow-workspace-*.sh # Workspace scripts [NEW]
|
|
375
|
-
│ ├── flow-quality-*.sh # Quality scripts [NEW]
|
|
376
|
-
│ ├── run-quality-gates.sh # Gate execution [NEW: RM-016]
|
|
377
|
-
│ └── record-quality-error.sh # Error recording [NEW]
|
|
378
|
-
└── docs/templates/
|
|
379
|
-
├── context/ # Context JSONL templates [NEW: RM-015]
|
|
380
|
-
│ ├── dev.jsonl.template
|
|
381
|
-
│ ├── epic.jsonl.template
|
|
382
|
-
│ └── ...
|
|
383
|
-
├── DELTA_SPEC_TEMPLATE.md # Delta spec format [NEW: RM-017]
|
|
384
|
-
└── JOURNAL_TEMPLATE.md # Journal format [NEW: RM-018]
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
### New Commands
|
|
388
|
-
|
|
389
|
-
| Command | Purpose | Module |
|
|
390
|
-
|---------|---------|--------|
|
|
391
|
-
| `/flow-context` | Manage staged context injection | RM-015 |
|
|
392
|
-
| `/flow-delta` | Manage delta specs | RM-017 |
|
|
393
|
-
| `/flow-workspace` | Manage developer workspace | RM-018 |
|
|
394
|
-
| `/flow-quality` | Combined quality verification | RM-020 |
|
|
70
|
+
## Deprecated Entry Points (Compatibility Kept)
|
|
395
71
|
|
|
396
|
-
|
|
72
|
+
| Deprecated | Migration |
|
|
73
|
+
|------------|-----------|
|
|
74
|
+
| `/flow:new` | use canonical 5-stage flow |
|
|
75
|
+
| `/flow:clarify` | merged into `/flow:spec` |
|
|
76
|
+
| `/flow:checklist` | merged into `/flow:verify --strict` |
|
|
77
|
+
| `/flow:quality` | merged into `/flow:verify` |
|
|
78
|
+
| `/flow-prd` + `/flow-tech` + `/flow-ui` + `/flow-epic` | unified as `/flow:spec` |
|
|
397
79
|
|
|
398
|
-
|
|
399
|
-
【精简流程】(5 步, 适合小需求)
|
|
400
|
-
/flow-init --quick → /flow-prd --quick → /flow-epic → /flow-dev → /flow-release
|
|
401
|
-
|
|
402
|
-
【标准流程】(6 步, 适合中等需求)
|
|
403
|
-
/flow-init → /flow-prd → /flow-epic → /flow-dev → /flow-quality → /flow-release
|
|
404
|
-
|
|
405
|
-
【完整流程】(8 步, 适合大需求)
|
|
406
|
-
/flow-init → /flow-clarify → /flow-prd → /flow-tech → /flow-ui
|
|
407
|
-
→ /flow-epic → /flow-dev → /flow-quality --full → /flow-release
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Deprecations
|
|
411
|
-
|
|
412
|
-
| Old Command | Replacement | Status |
|
|
413
|
-
|-------------|-------------|--------|
|
|
414
|
-
| `/flow-review` | `/flow-quality --full` | Deprecated (warning) |
|
|
415
|
-
| `/flow-qa` | `/flow-quality --full` | Deprecated (warning) |
|
|
416
|
-
|
|
417
|
-
### Expected Improvements
|
|
418
|
-
|
|
419
|
-
| Metric | Before | After | Improvement |
|
|
420
|
-
|--------|--------|-------|-------------|
|
|
421
|
-
| Agent context size | 10000+ tokens | 3000 tokens | -70% |
|
|
422
|
-
| Single command time | 2-3 min | 1-1.5 min | -50% |
|
|
423
|
-
| Full workflow time | 30-45 min | 15-20 min | -50% |
|
|
424
|
-
| Rework rate | ~30% | ~10% | -67% |
|
|
425
|
-
|
|
426
|
-
---
|
|
80
|
+
## Key Compatibility Modules
|
|
427
81
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
### Purpose
|
|
436
|
-
|
|
437
|
-
合并 flow-prd/flow-tech/flow-ui/flow-epic 为统一的 `/flow-spec` 命令,减少命令调用次数,利用 Agent 并行执行潜力。
|
|
438
|
-
|
|
439
|
-
### Key Changes
|
|
440
|
-
|
|
441
|
-
| Before (v4.0) | After (v4.1) | Improvement |
|
|
442
|
-
|---------------|--------------|-------------|
|
|
443
|
-
| 4 个独立命令 | 1 个统一命令 | -75% 命令数 |
|
|
444
|
-
| 串行执行 | Tech + UI 并行 | -35% 时间 |
|
|
445
|
-
| 重复 Entry/Exit Gate | 统一 Gate | -280 行代码 |
|
|
446
|
-
|
|
447
|
-
### New Command: /flow-spec
|
|
448
|
-
|
|
449
|
-
```bash
|
|
450
|
-
# Full Mode (默认)
|
|
451
|
-
/flow-spec "REQ-123"
|
|
452
|
-
|
|
453
|
-
# Quick Mode (小需求)
|
|
454
|
-
/flow-spec "REQ-123" --skip-tech --skip-ui
|
|
455
|
-
|
|
456
|
-
# Backend Only
|
|
457
|
-
/flow-spec "REQ-123" --skip-ui
|
|
458
|
-
|
|
459
|
-
# Frontend Only
|
|
460
|
-
/flow-spec "REQ-123" --skip-tech
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
### Execution Flow
|
|
464
|
-
|
|
465
|
-
```
|
|
466
|
-
PRD (sequential) → Tech + UI (parallel) → Epic (sequential)
|
|
467
|
-
|
|
468
|
-
Time ────────────────────────────────────────────►
|
|
469
|
-
|
|
470
|
-
T0 ┌─────────────┐
|
|
471
|
-
│ prd-writer │ (必须先完成)
|
|
472
|
-
└──────┬──────┘
|
|
473
|
-
│
|
|
474
|
-
T1 ├────────────────────┐
|
|
475
|
-
│ │
|
|
476
|
-
┌──────▼──────┐ ┌──────▼──────┐
|
|
477
|
-
│tech-architect│ │ ui-designer │ (并行)
|
|
478
|
-
└──────┬──────┘ └──────┬──────┘
|
|
479
|
-
│ │
|
|
480
|
-
T2 └─────────┬──────────┘
|
|
481
|
-
│
|
|
482
|
-
┌──────▼──────┐
|
|
483
|
-
│ planner │ (等待两者完成)
|
|
484
|
-
└─────────────┘
|
|
485
|
-
```
|
|
82
|
+
| Module | Status | Note |
|
|
83
|
+
|--------|--------|------|
|
|
84
|
+
| `/flow:delta` | active | incremental spec evolution |
|
|
85
|
+
| `/flow:archive` | active | archive + restore |
|
|
86
|
+
| `/flow:workspace` | active | developer workspace/journal |
|
|
87
|
+
| `flow-quality` skill directory | compatibility | historical quality path retained |
|
|
486
88
|
|
|
487
|
-
|
|
89
|
+
## Hooks and Scripts (Execution Spine)
|
|
488
90
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
| `.claude/skills/workflow/flow-spec/context.jsonl` | 上下文定义 |
|
|
493
|
-
| `.claude/skills/workflow/flow-spec/scripts/entry-gate.sh` | 统一入口检查 |
|
|
494
|
-
| `.claude/skills/workflow/flow-spec/scripts/parallel-orchestrator.sh` | 并行调度逻辑 |
|
|
495
|
-
| `.claude/skills/workflow/flow-spec/scripts/exit-gate.sh` | 统一出口检查 |
|
|
496
|
-
| `.claude/docs/templates/_shared/CONSTITUTION_CHECK.md` | 共享 Constitution 检查 |
|
|
497
|
-
| `.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md` | 共享验证清单 |
|
|
498
|
-
| `.claude/docs/templates/_shared/YAML_FRONTMATTER.md` | 共享 YAML 头部 |
|
|
91
|
+
- Hooks enforce lifecycle checks and context injection (`inject-*`, `ralph-loop`, teammate hooks).
|
|
92
|
+
- Scripts implement deterministic stage operations (`run-quality-gates.sh`, `recover-workflow.sh`, `verify-gate.sh`).
|
|
93
|
+
- `scripts/common.sh` is the shared contract for REQ detection and state helpers.
|
|
499
94
|
|
|
500
|
-
|
|
95
|
+
## Historical Modules (Archived Summary)
|
|
501
96
|
|
|
502
|
-
|
|
503
|
-
|-------------|-------------|--------|
|
|
504
|
-
| `/flow-prd` | `/flow-spec` | Deprecated (warning) |
|
|
505
|
-
| `/flow-tech` | `/flow-spec` | Deprecated (warning) |
|
|
506
|
-
| `/flow-ui` | `/flow-spec` | Deprecated (warning) |
|
|
507
|
-
| `/flow-epic` | `/flow-spec` | Deprecated (warning) |
|
|
97
|
+
以下内容是 v2.3 - v4.7 的历史演进摘要,仅用于理解设计来源,不作为当前执行标准。
|
|
508
98
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
【完整流程】(5 步, 适合大需求)
|
|
519
|
-
/flow-init → /flow-clarify → /flow-spec → /flow-dev → /flow-quality --full → /flow-release
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
### Expected Improvements
|
|
523
|
-
|
|
524
|
-
| Metric | Before (v4.0) | After (v4.1) | Improvement |
|
|
525
|
-
|--------|---------------|--------------|-------------|
|
|
526
|
-
| 命令调用次数 | 4 | 1 | -75% |
|
|
527
|
-
| 设计阶段时间 | 8-12 min | 5-8 min | -35% |
|
|
528
|
-
| Entry/Exit Gate 代码 | ~280 行 | ~100 行 | -64% |
|
|
529
|
-
|
|
530
|
-
---
|
|
531
|
-
|
|
532
|
-
**Last Updated**: 2026-02-07
|
|
533
|
-
**v4.1.0 Module**: Unified Specification Phase
|
|
534
|
-
|
|
535
|
-
---
|
|
536
|
-
|
|
537
|
-
## v4.3.0 Module: Git Worktree Integration
|
|
538
|
-
|
|
539
|
-
### Purpose
|
|
540
|
-
|
|
541
|
-
将所有 Git 分支操作改为 Git Worktree 方式,支持 3-5 个并行 Claude Code 会话,借鉴官方最佳实践。
|
|
542
|
-
|
|
543
|
-
### Key Changes
|
|
544
|
-
|
|
545
|
-
| Before (v4.2) | After (v4.3) | Improvement |
|
|
546
|
-
|---------------|--------------|-------------|
|
|
547
|
-
| 传统分支切换 | Worktree 隔离 | 并行开发 |
|
|
548
|
-
| stash/checkout | cd 切换 | 切换时间 -97% |
|
|
549
|
-
| 单一 Claude 会话 | 多会话并行 | 效率 +200% |
|
|
550
|
-
|
|
551
|
-
### Worktree Directory Layout
|
|
552
|
-
|
|
553
|
-
```
|
|
554
|
-
~/projects/
|
|
555
|
-
├── cc-devflow/ # 主仓库 (main 分支)
|
|
556
|
-
├── cc-devflow-REQ-001/ # REQ-001 worktree
|
|
557
|
-
├── cc-devflow-REQ-002/ # REQ-002 worktree
|
|
558
|
-
├── cc-devflow-analysis/ # 只读分析 worktree (可选)
|
|
559
|
-
└── cc-devflow-hotfix/ # 紧急修复 worktree (可选)
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
### New Skill: using-git-worktrees
|
|
563
|
-
|
|
564
|
-
```
|
|
565
|
-
.claude/skills/domain/using-git-worktrees/
|
|
566
|
-
├── SKILL.md # 核心指令 (~200 行)
|
|
567
|
-
├── context.jsonl # 上下文定义
|
|
568
|
-
├── scripts/
|
|
569
|
-
│ ├── worktree-create.sh # 创建 worktree
|
|
570
|
-
│ ├── worktree-list.sh # 列出 worktree
|
|
571
|
-
│ ├── worktree-switch.sh # 切换 worktree
|
|
572
|
-
│ ├── worktree-cleanup.sh # 清理 worktree
|
|
573
|
-
│ └── worktree-status.sh # 状态检查
|
|
574
|
-
└── assets/
|
|
575
|
-
└── SHELL_ALIASES.md # Shell 别名模板
|
|
576
|
-
```
|
|
577
|
-
|
|
578
|
-
### Modified Commands
|
|
579
|
-
|
|
580
|
-
| Command | Change |
|
|
581
|
-
|---------|--------|
|
|
582
|
-
| `/flow-init` | 默认使用 worktree 模式,`--branch-only` 兼容旧模式 |
|
|
583
|
-
| `/flow-release` | 自动清理 worktree |
|
|
584
|
-
|
|
585
|
-
### Shell Aliases (Recommended)
|
|
586
|
-
|
|
587
|
-
```bash
|
|
588
|
-
alias za='cd $(git rev-parse --show-toplevel 2>/dev/null || echo .)'
|
|
589
|
-
alias zl='git worktree list'
|
|
590
|
-
alias zm='cd ~/projects/cc-devflow'
|
|
591
|
-
|
|
592
|
-
zw() {
|
|
593
|
-
local req_id="${1:-}"
|
|
594
|
-
local repo_name=$(basename $(git rev-parse --show-toplevel 2>/dev/null))
|
|
595
|
-
cd ~/projects/${repo_name}-${req_id}
|
|
596
|
-
}
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
### New common.sh Functions
|
|
600
|
-
|
|
601
|
-
| Function | Purpose |
|
|
602
|
-
|----------|---------|
|
|
603
|
-
| `is_in_worktree()` | 检测是否在 worktree 中 |
|
|
604
|
-
| `get_main_repo_path()` | 获取主仓库路径 |
|
|
605
|
-
| `get_worktree_path()` | 获取当前 worktree 路径 |
|
|
606
|
-
| `get_worktree_dir_for_req()` | 获取指定 REQ 的 worktree 目录 |
|
|
607
|
-
| `worktree_exists_for_req()` | 检查 worktree 是否存在 |
|
|
608
|
-
| `get_req_id_from_worktree()` | 从 worktree 路径提取 REQ-ID |
|
|
609
|
-
| `list_worktrees_with_req()` | 列出所有 worktree 及其 REQ-ID |
|
|
610
|
-
|
|
611
|
-
### Expected Improvements
|
|
612
|
-
|
|
613
|
-
| Metric | Before | After | Improvement |
|
|
614
|
-
|--------|--------|-------|-------------|
|
|
615
|
-
| 并行需求数 | 1 | 3-5 | +400% |
|
|
616
|
-
| 上下文切换时间 | 30s | 1s | -97% |
|
|
617
|
-
| 紧急修复响应 | 需要 stash | 直接新建 | 即时 |
|
|
618
|
-
| Claude 会话隔离 | 无 | 完全隔离 | 100% |
|
|
619
|
-
|
|
620
|
-
---
|
|
99
|
+
| Version | Theme | Key Outcome | Current Status |
|
|
100
|
+
|---------|-------|-------------|----------------|
|
|
101
|
+
| v2.3.0 | Ralph × Manus | 引入自主迭代 + 外部记忆(ERROR_LOG / attempts) | 已并入 `/flow:dev` |
|
|
102
|
+
| v3.0.0 | OpenSpec × Trellis | Skills-first + JSONL 上下文注入 + workflow 图 | 已演进到 v6 harness 主线 |
|
|
103
|
+
| v4.1.0 | Unified Spec | PRD/Tech/UI/Epic 合并为统一 spec 阶段 | 保留为 `/flow:spec` 能力基础 |
|
|
104
|
+
| v4.4.0 | Programmatic Ralph Loop | Hook 级别迭代控制与可验证退出 | 已融入现有 hooks/runtime |
|
|
105
|
+
| v4.5.0 | Delta Specs | 需求增量变更与 apply 流程 | 兼容保留(`/flow:delta`) |
|
|
106
|
+
| v4.6.0 | Archive Enhancement | 归档元数据与可恢复能力 | 兼容保留(`/flow:archive`) |
|
|
107
|
+
| v4.7.0 | Claude Team | 多 Agent 并行调度与任务依赖管理 | 能力保留,非默认路径 |
|
|
621
108
|
|
|
622
|
-
|
|
623
|
-
**v4.3.0 Module**: Git Worktree Integration
|
|
109
|
+
## Design Invariants
|
|
624
110
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
### Purpose
|
|
630
|
-
|
|
631
|
-
实现 SubagentStop Hook 拦截验证机制,在子 Agent 尝试停止时执行程序化验证,确保代码质量。借鉴 Trellis 的 Ralph Loop 设计。
|
|
632
|
-
|
|
633
|
-
### Key Changes
|
|
634
|
-
|
|
635
|
-
| Before (v4.3) | After (v4.4) | Improvement |
|
|
636
|
-
|---------------|--------------|-------------|
|
|
637
|
-
| 无自动验证 | SubagentStop 拦截 | 质量保证 |
|
|
638
|
-
| 手动检查 | 程序化验证 | 自动化 |
|
|
639
|
-
| 无迭代控制 | 最大迭代限制 | 防止无限循环 |
|
|
640
|
-
|
|
641
|
-
### New Files
|
|
642
|
-
|
|
643
|
-
| File | Purpose |
|
|
644
|
-
|------|---------|
|
|
645
|
-
| `.claude/hooks/ralph-loop.ts` | SubagentStop Hook 主逻辑 (~350 行) |
|
|
646
|
-
| `.ralph-state.json` | 运行时状态文件 (自动生成) |
|
|
647
|
-
|
|
648
|
-
### Configuration
|
|
649
|
-
|
|
650
|
-
`quality-gates.yml` 新增配置:
|
|
651
|
-
|
|
652
|
-
```yaml
|
|
653
|
-
# 顶级 verify 命令 (SubagentStop 时执行)
|
|
654
|
-
verify:
|
|
655
|
-
- npm run lint --if-present
|
|
656
|
-
- npm run typecheck --if-present
|
|
657
|
-
- npm test -- --passWithNoTests
|
|
658
|
-
|
|
659
|
-
ralph_loop:
|
|
660
|
-
max_iterations: 5 # 最大迭代次数
|
|
661
|
-
timeout_minutes: 30 # 超时时间
|
|
662
|
-
```
|
|
663
|
-
|
|
664
|
-
### Hook Registration
|
|
665
|
-
|
|
666
|
-
`settings.json` 新增:
|
|
667
|
-
|
|
668
|
-
```json
|
|
669
|
-
{
|
|
670
|
-
"hooks": {
|
|
671
|
-
"SubagentStop": [
|
|
672
|
-
{
|
|
673
|
-
"hooks": [
|
|
674
|
-
{
|
|
675
|
-
"type": "command",
|
|
676
|
-
"command": "npx ts-node $CLAUDE_PROJECT_DIR/.claude/hooks/ralph-loop.ts"
|
|
677
|
-
}
|
|
678
|
-
]
|
|
679
|
-
}
|
|
680
|
-
]
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
```
|
|
684
|
-
|
|
685
|
-
### State File Format
|
|
686
|
-
|
|
687
|
-
`.ralph-state.json`:
|
|
688
|
-
|
|
689
|
-
```json
|
|
690
|
-
{
|
|
691
|
-
"agent_id": "session-xxx",
|
|
692
|
-
"iteration": 2,
|
|
693
|
-
"last_failures": [
|
|
694
|
-
{
|
|
695
|
-
"command": "npm run lint",
|
|
696
|
-
"output": "error: ...",
|
|
697
|
-
"timestamp": "2026-02-07T06:00:00Z"
|
|
698
|
-
}
|
|
699
|
-
],
|
|
700
|
-
"started_at": "2026-02-07T06:00:00Z"
|
|
701
|
-
}
|
|
702
|
-
```
|
|
703
|
-
|
|
704
|
-
### Execution Flow
|
|
705
|
-
|
|
706
|
-
```
|
|
707
|
-
SubagentStop Event
|
|
708
|
-
│
|
|
709
|
-
▼
|
|
710
|
-
┌──────────────────┐
|
|
711
|
-
│ Load State │
|
|
712
|
-
│ Check Timeout │
|
|
713
|
-
└────────┬─────────┘
|
|
714
|
-
│
|
|
715
|
-
▼
|
|
716
|
-
┌──────────────────┐
|
|
717
|
-
│ Check Max Iter │──── Reached ──▶ Allow Stop
|
|
718
|
-
└────────┬─────────┘
|
|
719
|
-
│
|
|
720
|
-
▼
|
|
721
|
-
┌──────────────────┐
|
|
722
|
-
│ Run Verify Cmds │
|
|
723
|
-
└────────┬─────────┘
|
|
724
|
-
│
|
|
725
|
-
┌────┴────┐
|
|
726
|
-
│ │
|
|
727
|
-
Pass Fail
|
|
728
|
-
│ │
|
|
729
|
-
▼ ▼
|
|
730
|
-
Allow Block
|
|
731
|
-
Stop Stop
|
|
732
|
-
(return errors)
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
### Expected Improvements
|
|
736
|
-
|
|
737
|
-
| Metric | Before | After | Improvement |
|
|
738
|
-
|--------|--------|-------|-------------|
|
|
739
|
-
| 代码质量保证 | 手动 | 自动 | 100% |
|
|
740
|
-
| 验证遗漏率 | ~20% | ~0% | -100% |
|
|
741
|
-
| 无限循环风险 | 存在 | 受控 | 安全 |
|
|
742
|
-
|
|
743
|
-
---
|
|
744
|
-
|
|
745
|
-
**Last Updated**: 2026-02-07
|
|
746
|
-
**v4.4.0 Module**: Ralph Loop Programmatic Verification
|
|
747
|
-
|
|
748
|
-
---
|
|
749
|
-
|
|
750
|
-
## v4.5.0 Module: Delta Specs Enhancement
|
|
751
|
-
|
|
752
|
-
### Purpose
|
|
753
|
-
|
|
754
|
-
增强 Delta Specs 机制,借鉴 OpenSpec 的设计,实现完整的增量规格管理。支持 ADDED/MODIFIED/REMOVED/RENAMED 四种操作,提供 TypeScript 解析器和完整的 CLI 工具链。
|
|
755
|
-
|
|
756
|
-
### Key Changes
|
|
757
|
-
|
|
758
|
-
| Before (v4.4) | After (v4.5) | Improvement |
|
|
759
|
-
|---------------|--------------|-------------|
|
|
760
|
-
| 简单复制 | 真正的 delta 应用 | 精确变更 |
|
|
761
|
-
| 3 个子命令 | 4 个子命令 | 完整功能 |
|
|
762
|
-
| Bash 解析 | TypeScript 解析器 | 可靠性 |
|
|
763
|
-
| 无状态管理 | 状态工作流 | 可追溯 |
|
|
764
|
-
|
|
765
|
-
### New Command: /flow:delta
|
|
766
|
-
|
|
767
|
-
```bash
|
|
768
|
-
# Create a new delta spec
|
|
769
|
-
/flow:delta create "REQ-123" "add-2fa"
|
|
770
|
-
|
|
771
|
-
# List all deltas for a requirement
|
|
772
|
-
/flow:delta list "REQ-123"
|
|
773
|
-
|
|
774
|
-
# Apply delta to main specs (PRD.md)
|
|
775
|
-
/flow:delta apply "REQ-123" "add-2fa"
|
|
776
|
-
|
|
777
|
-
# Check delta status
|
|
778
|
-
/flow:delta status "REQ-123" "add-2fa"
|
|
779
|
-
```
|
|
780
|
-
|
|
781
|
-
### Delta Spec Format (OpenSpec-style)
|
|
782
|
-
|
|
783
|
-
```markdown
|
|
784
|
-
---
|
|
785
|
-
delta_id: "2026-02-01-add-2fa"
|
|
786
|
-
req_id: "REQ-123"
|
|
787
|
-
title: "Add 2FA Support"
|
|
788
|
-
created_at: "2026-02-01T10:00:00Z"
|
|
789
|
-
status: "draft|review|approved|applied"
|
|
790
|
-
---
|
|
791
|
-
|
|
792
|
-
# Delta: Add 2FA Support
|
|
793
|
-
|
|
794
|
-
## ADDED Requirements
|
|
795
|
-
### Requirement: Two-Factor Authentication
|
|
796
|
-
#### Scenario: Enable 2FA
|
|
797
|
-
- GIVEN user is logged in
|
|
798
|
-
- WHEN user enables 2FA
|
|
799
|
-
- THEN system generates QR code
|
|
800
|
-
|
|
801
|
-
## MODIFIED Requirements
|
|
802
|
-
### Requirement: User Login
|
|
803
|
-
(Previously: old description)
|
|
804
|
-
|
|
805
|
-
## REMOVED Requirements
|
|
806
|
-
### Requirement: Legacy Session
|
|
807
|
-
**Reason**: Replaced by JWT
|
|
808
|
-
**Migration**: Run migration script
|
|
809
|
-
|
|
810
|
-
## RENAMED Requirements
|
|
811
|
-
- FROM: Old Name
|
|
812
|
-
- TO: New Name
|
|
813
|
-
```
|
|
814
|
-
|
|
815
|
-
### New Files
|
|
816
|
-
|
|
817
|
-
| File | Purpose |
|
|
818
|
-
|------|---------|
|
|
819
|
-
| `.claude/scripts/delta-parser.ts` | TypeScript Delta 解析器 (~400 行) |
|
|
820
|
-
| `.claude/scripts/flow-delta-create.sh` | 创建 delta 目录和文件 |
|
|
821
|
-
| `.claude/scripts/flow-delta-list.sh` | 列出所有 deltas |
|
|
822
|
-
| `.claude/scripts/flow-delta-apply.sh` | 应用 delta 到 PRD.md |
|
|
823
|
-
| `.claude/scripts/flow-delta-status.sh` | 检查 delta 状态 |
|
|
824
|
-
| `.claude/docs/templates/DELTA_SPEC_TEMPLATE.md` | Delta 模板 (OpenSpec 格式) |
|
|
825
|
-
|
|
826
|
-
### Directory Structure
|
|
827
|
-
|
|
828
|
-
```
|
|
829
|
-
devflow/requirements/REQ-123/
|
|
830
|
-
├── PRD.md # Main specification (SSOT)
|
|
831
|
-
├── deltas/ # Delta specs directory
|
|
832
|
-
│ ├── 2026-02-01-add-2fa/
|
|
833
|
-
│ │ ├── delta.md # Delta specification
|
|
834
|
-
│ │ └── tasks.md # Delta-specific tasks
|
|
835
|
-
│ └── 2026-02-05-fix-login/
|
|
836
|
-
│ ├── delta.md
|
|
837
|
-
│ └── tasks.md
|
|
838
|
-
└── ...
|
|
839
|
-
|
|
840
|
-
devflow/archive/
|
|
841
|
-
└── 2026-02/
|
|
842
|
-
└── REQ-123/
|
|
843
|
-
└── deltas/ # Archived deltas
|
|
844
|
-
```
|
|
845
|
-
|
|
846
|
-
### Status Workflow
|
|
847
|
-
|
|
848
|
-
```
|
|
849
|
-
draft → review → approved → applied
|
|
850
|
-
│ │ │
|
|
851
|
-
│ │ └── /flow:delta apply
|
|
852
|
-
│ │
|
|
853
|
-
│ └── Manual review approval
|
|
854
|
-
│
|
|
855
|
-
└── /flow:delta create
|
|
856
|
-
```
|
|
857
|
-
|
|
858
|
-
### TypeScript Parser API
|
|
859
|
-
|
|
860
|
-
```typescript
|
|
861
|
-
interface DeltaBlock {
|
|
862
|
-
type: 'ADDED' | 'MODIFIED' | 'REMOVED' | 'RENAMED';
|
|
863
|
-
name: string;
|
|
864
|
-
content: string;
|
|
865
|
-
previousContent?: string; // for MODIFIED
|
|
866
|
-
reason?: string; // for REMOVED
|
|
867
|
-
newName?: string; // for RENAMED
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
function parseDelta(content: string): DeltaBlock[];
|
|
871
|
-
function applyDelta(prdContent: string, delta: DeltaBlock[]): string;
|
|
872
|
-
```
|
|
873
|
-
|
|
874
|
-
### Integration Points
|
|
875
|
-
|
|
876
|
-
| Integration | Description |
|
|
877
|
-
|-------------|-------------|
|
|
878
|
-
| `/flow:spec` | 生成 delta 而非直接修改 PRD |
|
|
879
|
-
| `/flow:release` | 应用所有 approved deltas |
|
|
880
|
-
| `/flow:archive` | 归档 applied deltas |
|
|
881
|
-
|
|
882
|
-
### Expected Improvements
|
|
883
|
-
|
|
884
|
-
| Metric | Before | After | Improvement |
|
|
885
|
-
|--------|--------|-------|-------------|
|
|
886
|
-
| 变更追溯性 | 无 | 完整 | 100% |
|
|
887
|
-
| 冲突检测 | 无 | 自动 | 100% |
|
|
888
|
-
| 回滚能力 | 手动 | 自动 | 100% |
|
|
889
|
-
| 审核流程 | 无 | 状态驱动 | 100% |
|
|
890
|
-
|
|
891
|
-
---
|
|
892
|
-
|
|
893
|
-
**Last Updated**: 2026-02-07
|
|
894
|
-
**v4.5.0 Module**: Delta Specs Enhancement
|
|
895
|
-
|
|
896
|
-
---
|
|
897
|
-
|
|
898
|
-
## v4.6.0 Module: Archive System Enhancement
|
|
899
|
-
|
|
900
|
-
### Purpose
|
|
901
|
-
|
|
902
|
-
增强归档系统,集成 Delta Specs 支持,提供完整的需求生命周期管理。
|
|
903
|
-
|
|
904
|
-
### Key Changes
|
|
905
|
-
|
|
906
|
-
| Before (v4.5) | After (v4.6) | Improvement |
|
|
907
|
-
|---------------|--------------|-------------|
|
|
908
|
-
| 简单移动目录 | Delta Specs 检查 | 完整性保证 |
|
|
909
|
-
| 无警告机制 | 未应用 delta 警告 | 防止遗漏 |
|
|
910
|
-
| 基础状态记录 | deltaCount 字段 | 可追溯性 |
|
|
911
|
-
|
|
912
|
-
### New Features
|
|
913
|
-
|
|
914
|
-
#### 1. Delta Specs 检查
|
|
915
|
-
|
|
916
|
-
归档前自动检测:
|
|
917
|
-
- 检查 `deltas/` 目录是否存在
|
|
918
|
-
- 统计 Delta Specs 数量
|
|
919
|
-
- 警告未应用的 Delta Specs (status != "applied")
|
|
920
|
-
|
|
921
|
-
#### 2. 增强的状态记录
|
|
922
|
-
|
|
923
|
-
```json
|
|
924
|
-
{
|
|
925
|
-
"status": "archived",
|
|
926
|
-
"archivedReason": "completed",
|
|
927
|
-
"archivedAt": "2026-02-07T10:00:00+08:00",
|
|
928
|
-
"archiveLocation": "devflow/archive/2026-02/REQ-123",
|
|
929
|
-
"statusBeforeArchive": "release_complete",
|
|
930
|
-
"deltaCount": 3
|
|
931
|
-
}
|
|
932
|
-
```
|
|
933
|
-
|
|
934
|
-
#### 3. 新增 common.sh 函数
|
|
935
|
-
|
|
936
|
-
| Function | Purpose |
|
|
937
|
-
|----------|---------|
|
|
938
|
-
| `get_archive_summary()` | 获取归档需求的 JSON 摘要 |
|
|
939
|
-
| `has_deltas_to_archive()` | 检查是否有 deltas 需要归档 |
|
|
940
|
-
| `get_delta_count()` | 获取 delta 数量 |
|
|
941
|
-
|
|
942
|
-
### Archive Directory Structure
|
|
943
|
-
|
|
944
|
-
```
|
|
945
|
-
devflow/archive/
|
|
946
|
-
├── 2026-01/ # 按月组织
|
|
947
|
-
│ ├── REQ-001/
|
|
948
|
-
│ │ ├── PRD.md
|
|
949
|
-
│ │ ├── EPIC.md
|
|
950
|
-
│ │ ├── TASKS.md
|
|
951
|
-
│ │ ├── deltas/ # Delta Specs 完整保留
|
|
952
|
-
│ │ │ └── 2026-01-15-add-feature/
|
|
953
|
-
│ │ │ ├── delta.md
|
|
954
|
-
│ │ │ └── tasks.md
|
|
955
|
-
│ │ ├── orchestration_status.json
|
|
956
|
-
│ │ └── ...
|
|
957
|
-
│ └── REQ-002/
|
|
958
|
-
└── 2026-02/
|
|
959
|
-
└── REQ-003/
|
|
960
|
-
```
|
|
961
|
-
|
|
962
|
-
### Command Usage
|
|
963
|
-
|
|
964
|
-
```bash
|
|
965
|
-
# 归档需求 (自动检测 Delta Specs)
|
|
966
|
-
/flow:archive "REQ-123"
|
|
967
|
-
|
|
968
|
-
# 预览归档 (显示 Delta Specs 信息)
|
|
969
|
-
/flow:archive "REQ-123" --dry-run
|
|
970
|
-
|
|
971
|
-
# 列出所有归档
|
|
972
|
-
/flow:archive --list
|
|
973
|
-
|
|
974
|
-
# 恢复归档
|
|
975
|
-
/flow:archive "REQ-123" --restore
|
|
976
|
-
```
|
|
977
|
-
|
|
978
|
-
### Integration Points
|
|
979
|
-
|
|
980
|
-
| Integration | Description |
|
|
981
|
-
|-------------|-------------|
|
|
982
|
-
| `/flow:release` | 发布后自动触发归档 |
|
|
983
|
-
| `/flow:delta` | 归档前检查未应用的 deltas |
|
|
984
|
-
| `/flow:status` | 显示归档状态 |
|
|
985
|
-
|
|
986
|
-
### Expected Improvements
|
|
987
|
-
|
|
988
|
-
| Metric | Before | After | Improvement |
|
|
989
|
-
|--------|--------|-------|-------------|
|
|
990
|
-
| Delta 遗漏率 | ~15% | ~0% | -100% |
|
|
991
|
-
| 归档完整性 | 基础 | 完整 | 100% |
|
|
992
|
-
| 可追溯性 | 有限 | 完整 | 100% |
|
|
993
|
-
|
|
994
|
-
---
|
|
995
|
-
|
|
996
|
-
**Last Updated**: 2026-02-07
|
|
997
|
-
**v4.6.0 Module**: Archive System Enhancement
|
|
998
|
-
|
|
999
|
-
---
|
|
1000
|
-
|
|
1001
|
-
## v4.7.0 Module: Claude Team Integration
|
|
1002
|
-
|
|
1003
|
-
### Purpose
|
|
1004
|
-
|
|
1005
|
-
集成 Claude Team 功能,支持多 Agent 并行协作开发。实现 TeammateIdle 和 TaskCompleted Hook,扩展状态管理支持 Team 模式。
|
|
1006
|
-
|
|
1007
|
-
### Key Changes
|
|
1008
|
-
|
|
1009
|
-
| Before (v4.6) | After (v4.7) | Improvement |
|
|
1010
|
-
|---------------|--------------|-------------|
|
|
1011
|
-
| 单 Agent 执行 | 多 Agent 并行 | 效率 +200% |
|
|
1012
|
-
| 无 Team 状态 | 完整 Team 状态管理 | 可追溯 |
|
|
1013
|
-
| 单一 Ralph Loop | 多 Teammate Ralph Loop | 分布式验证 |
|
|
1014
|
-
|
|
1015
|
-
### New Hooks
|
|
1016
|
-
|
|
1017
|
-
| Hook | File | Trigger | Purpose |
|
|
1018
|
-
|------|------|---------|---------|
|
|
1019
|
-
| **TeammateIdle** | `teammate-idle-hook.ts` | Teammate 空闲时 | 任务分配和调度 |
|
|
1020
|
-
| **TaskCompleted** | `task-completed-hook.ts` | 任务完成时 | 质量验证和状态更新 |
|
|
1021
|
-
|
|
1022
|
-
### TeammateIdle Hook 工作流程
|
|
1023
|
-
|
|
1024
|
-
```
|
|
1025
|
-
TeammateIdle Event
|
|
1026
|
-
↓
|
|
1027
|
-
验证 last_task_id (如有)
|
|
1028
|
-
↓
|
|
1029
|
-
验证失败 → 返回 assign_task (继续修复)
|
|
1030
|
-
验证通过 → 标记任务完成
|
|
1031
|
-
↓
|
|
1032
|
-
查找下一个未分配任务
|
|
1033
|
-
↓
|
|
1034
|
-
有任务 → 返回 assign_task
|
|
1035
|
-
无任务 + 所有 Teammate 空闲 → 返回 shutdown
|
|
1036
|
-
无任务 + 有 Teammate 工作中 → 返回 wait
|
|
1037
|
-
```
|
|
1038
|
-
|
|
1039
|
-
### TaskCompleted Hook 工作流程
|
|
1040
|
-
|
|
1041
|
-
```
|
|
1042
|
-
TaskCompleted Event
|
|
1043
|
-
↓
|
|
1044
|
-
执行 task_completed.verify 命令
|
|
1045
|
-
↓
|
|
1046
|
-
├── 通过 → accept + 更新 Team 状态
|
|
1047
|
-
└── 失败 → block_on_failure?
|
|
1048
|
-
├── true → reject
|
|
1049
|
-
└── false → accept (with warning)
|
|
1050
|
-
↓
|
|
1051
|
-
记录失败到 ERROR_LOG.md
|
|
1052
|
-
↓
|
|
1053
|
-
检查阶段转换
|
|
1054
|
-
```
|
|
1055
|
-
|
|
1056
|
-
### orchestration_status.json 扩展
|
|
1057
|
-
|
|
1058
|
-
```json
|
|
1059
|
-
{
|
|
1060
|
-
"reqId": "REQ-007",
|
|
1061
|
-
"status": "in_progress",
|
|
1062
|
-
"phase": "development",
|
|
1063
|
-
|
|
1064
|
-
"team": {
|
|
1065
|
-
"mode": "parallel",
|
|
1066
|
-
"lead": "team-lead",
|
|
1067
|
-
"teammates": [
|
|
1068
|
-
{
|
|
1069
|
-
"id": "dev-analyst",
|
|
1070
|
-
"role": "developer",
|
|
1071
|
-
"status": "working",
|
|
1072
|
-
"currentTask": "T001",
|
|
1073
|
-
"completedTasks": ["T000"],
|
|
1074
|
-
"lastActiveAt": "2026-02-07T10:00:00Z"
|
|
1075
|
-
}
|
|
1076
|
-
],
|
|
1077
|
-
"taskAssignments": {
|
|
1078
|
-
"T001": "dev-analyst"
|
|
1079
|
-
}
|
|
1080
|
-
},
|
|
1081
|
-
|
|
1082
|
-
"ralphLoop": {
|
|
1083
|
-
"enabled": true,
|
|
1084
|
-
"teammates": {
|
|
1085
|
-
"dev-analyst": {
|
|
1086
|
-
"iteration": 2,
|
|
1087
|
-
"lastVerifyResult": "passed"
|
|
1088
|
-
}
|
|
1089
|
-
},
|
|
1090
|
-
"globalIteration": 3,
|
|
1091
|
-
"maxIterations": 10
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
```
|
|
1095
|
-
|
|
1096
|
-
### New Files
|
|
1097
|
-
|
|
1098
|
-
| File | Purpose |
|
|
1099
|
-
|------|---------|
|
|
1100
|
-
| `.claude/hooks/teammate-idle-hook.ts` | TeammateIdle Hook 实现 |
|
|
1101
|
-
| `.claude/hooks/task-completed-hook.ts` | TaskCompleted Hook 实现 |
|
|
1102
|
-
| `.claude/hooks/types/team-types.d.ts` | Team 状态 TypeScript 类型 |
|
|
1103
|
-
| `.claude/scripts/parse-task-dependencies.js` | TASKS.md 任务依赖解析器 |
|
|
1104
|
-
| `.claude/scripts/detect-file-conflicts.sh` | 并行任务文件冲突检测 |
|
|
1105
|
-
| `.claude/scripts/team-dev-init.sh` | flow-dev Team 模式初始化 |
|
|
1106
|
-
| `.claude/skills/workflow/flow-spec/scripts/team-init.sh` | flow-spec Team 模式初始化 |
|
|
1107
|
-
| `.claude/skills/workflow/flow-spec/scripts/team-communication.sh` | Teammate 通信协议 |
|
|
1108
|
-
| `.claude/skills/workflow/flow-spec/team-config.json` | spec-design-team 配置 |
|
|
1109
|
-
| `.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md` | 设计决策记录模板 |
|
|
1110
|
-
|
|
1111
|
-
### common.sh 新增函数
|
|
1112
|
-
|
|
1113
|
-
| Function | Purpose |
|
|
1114
|
-
|----------|---------|
|
|
1115
|
-
| `is_team_mode_enabled()` | 检查 Team 模式是否启用 |
|
|
1116
|
-
| `init_team_state()` | 初始化 Team 状态 |
|
|
1117
|
-
| `add_teammate()` | 添加 Teammate |
|
|
1118
|
-
| `update_teammate_status()` | 更新 Teammate 状态 |
|
|
1119
|
-
| `mark_teammate_task_complete()` | 标记任务完成 |
|
|
1120
|
-
| `assign_task_to_teammate()` | 分配任务 |
|
|
1121
|
-
| `get_unassigned_tasks()` | 获取未分配任务 |
|
|
1122
|
-
| `update_teammate_ralph_state()` | 更新 Ralph 状态 |
|
|
1123
|
-
| `all_teammates_idle()` | 检查所有 Teammate 空闲 |
|
|
1124
|
-
| `cleanup_team_state()` | 清理 Team 状态 |
|
|
1125
|
-
|
|
1126
|
-
### flow-dev Team 模式命令
|
|
1127
|
-
|
|
1128
|
-
```bash
|
|
1129
|
-
# 启用 Team 模式 (默认 3 个 Agent)
|
|
1130
|
-
/flow:dev "REQ-123" --team
|
|
1131
|
-
|
|
1132
|
-
# 指定 Agent 数量 (2-5)
|
|
1133
|
-
/flow:dev "REQ-123" --team --agents 5
|
|
1134
|
-
|
|
1135
|
-
# Team 模式执行流程
|
|
1136
|
-
# 1. 解析 TASKS.md 获取任务依赖
|
|
1137
|
-
# 2. 检测文件冲突,分配任务给 Agent
|
|
1138
|
-
# 3. 并行执行无冲突任务
|
|
1139
|
-
# 4. 冲突任务分配给同一 Agent 串行执行
|
|
1140
|
-
# 5. TeammateIdle Hook 自动分配下一任务
|
|
1141
|
-
# 6. 所有任务完成后 shutdown
|
|
1142
|
-
```
|
|
1143
|
-
|
|
1144
|
-
### Task Dependency Parser (parse-task-dependencies.js)
|
|
1145
|
-
|
|
1146
|
-
```bash
|
|
1147
|
-
# 解析 TASKS.md
|
|
1148
|
-
node .claude/scripts/parse-task-dependencies.js parse TASKS.md
|
|
1149
|
-
|
|
1150
|
-
# 获取并行分组
|
|
1151
|
-
node .claude/scripts/parse-task-dependencies.js groups TASKS.md
|
|
1152
|
-
|
|
1153
|
-
# 获取下一批可执行任务
|
|
1154
|
-
node .claude/scripts/parse-task-dependencies.js next TASKS.md
|
|
1155
|
-
|
|
1156
|
-
# 输出格式
|
|
1157
|
-
{
|
|
1158
|
-
"tasks": [
|
|
1159
|
-
{"id": "T001", "phase": 1, "parallel": true, "userStory": "US1", "filePath": "src/user.ts"}
|
|
1160
|
-
],
|
|
1161
|
-
"parallelGroups": [["T001", "T002"], ["T003"]],
|
|
1162
|
-
"stats": {"total": 10, "completed": 3, "pending": 7}
|
|
1163
|
-
}
|
|
1164
|
-
```
|
|
1165
|
-
|
|
1166
|
-
### File Conflict Detection (detect-file-conflicts.sh)
|
|
1167
|
-
|
|
1168
|
-
```bash
|
|
1169
|
-
# 检测文件冲突
|
|
1170
|
-
echo '{"tasks": [...]}' | .claude/scripts/detect-file-conflicts.sh
|
|
1171
|
-
|
|
1172
|
-
# 输出格式
|
|
1173
|
-
{
|
|
1174
|
-
"hasConflicts": true,
|
|
1175
|
-
"conflicts": [{"file": "src/user.ts", "tasks": ["T001", "T002"]}],
|
|
1176
|
-
"safeGroups": [{"tasks": ["T003", "T004"]}]
|
|
1177
|
-
}
|
|
1178
|
-
```
|
|
1179
|
-
|
|
1180
|
-
### quality-gates.yml 新增配置
|
|
1181
|
-
|
|
1182
|
-
```yaml
|
|
1183
|
-
# TeammateIdle Hook 配置
|
|
1184
|
-
teammate_idle:
|
|
1185
|
-
idle_checks:
|
|
1186
|
-
- npm run lint --if-present
|
|
1187
|
-
- npm run typecheck --if-present
|
|
1188
|
-
assignment_strategy: priority_first
|
|
1189
|
-
idle_timeout: 300
|
|
1190
|
-
|
|
1191
|
-
# TaskCompleted Hook 配置
|
|
1192
|
-
task_completed:
|
|
1193
|
-
verify:
|
|
1194
|
-
- npm run lint --if-present
|
|
1195
|
-
- npm run typecheck --if-present
|
|
1196
|
-
- npm test -- --passWithNoTests
|
|
1197
|
-
block_on_failure: true
|
|
1198
|
-
max_retries: 3
|
|
1199
|
-
|
|
1200
|
-
# Ralph Loop Team 模式配置
|
|
1201
|
-
ralph_loop:
|
|
1202
|
-
team_mode:
|
|
1203
|
-
enabled: true
|
|
1204
|
-
scope: teammate
|
|
1205
|
-
max_iterations_per_teammate: 3
|
|
1206
|
-
max_global_iterations: 10
|
|
1207
|
-
```
|
|
111
|
+
1. 阶段输出必须可审计(状态文件 + 产物 + 日志)。
|
|
112
|
+
2. 质量闸必须可重跑并可追踪证据。
|
|
113
|
+
3. 恢复策略优先从失败阶段继续,不做整链回滚。
|
|
114
|
+
4. 默认路径保持单一主链,兼容入口仅作迁移过渡。
|
|
1208
115
|
|
|
1209
|
-
|
|
116
|
+
## References
|
|
1210
117
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
| 需求完成时间 | 90 min | 50 min | -45% |
|
|
1215
|
-
| 任务调度 | 手动 | 自动 | 100% |
|
|
1216
|
-
| 质量验证 | 单点 | 分布式 | 100% |
|
|
118
|
+
- 命令索引:`docs/commands/README.md`、`docs/commands/README.zh-CN.md`
|
|
119
|
+
- 版本历史:`README.md`、`README.zh-CN.md`
|
|
120
|
+
- 运行时实现:`bin/harness.js`、`lib/harness/*`
|
|
1217
121
|
|
|
1218
122
|
---
|
|
1219
123
|
|
|
1220
|
-
**Last Updated**: 2026-02-
|
|
1221
|
-
**
|
|
124
|
+
**Last Updated**: 2026-02-18
|
|
125
|
+
**PR-6.3**: Rebuilt CLAUDE L1 doc into concise canonical map + archived history summary.
|