@boyingliu01/xp-gate 0.14.3 → 0.14.4

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 (25) hide show
  1. package/package.json +1 -1
  2. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  3. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  4. package/plugins/claude-code/skills/delphi-review/SKILL.md +193 -157
  5. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  6. package/plugins/claude-code/skills/sprint-flow/SKILL.md +138 -495
  7. package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +481 -0
  8. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  9. package/plugins/opencode/package.json +1 -1
  10. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  11. package/plugins/opencode/skills/delphi-review/SKILL.md +193 -157
  12. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  13. package/plugins/opencode/skills/sprint-flow/SKILL.md +138 -495
  14. package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +481 -0
  15. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  16. package/plugins/qoder/plugin.json +1 -1
  17. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  18. package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
  19. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  20. package/skills/delphi-review/AGENTS.md +3 -3
  21. package/skills/delphi-review/SKILL.md +193 -157
  22. package/skills/sprint-flow/AGENTS.md +3 -3
  23. package/skills/sprint-flow/SKILL.md +138 -495
  24. package/skills/sprint-flow/references/phase-overview.md +481 -0
  25. package/skills/test-specification-alignment/AGENTS.md +3 -3
@@ -1,42 +1,31 @@
1
1
  ---
2
2
  name: sprint-flow
3
- version: 2.0.0
3
+ version: 2.1.0
4
4
  description: >
5
- One-Shot Sprint 自动流水线。单一入口,自动串联 ThinkPlanBuild
6
- Review → Ship 流程。整合 brainstorming + autoplan + delphi-review + TDD +
7
- delphi-review --mode code-walkthrough + ship 等现有 Skills。关键节点暂停等待用户决策。
8
- 承认 Emergent Requirements 限制,设计用户验收环节。
9
-
10
- TRIGGER:
11
- - "开发新功能"
12
- - "实现 X"
13
- - "start sprint"
14
- - "一键开发"
15
- - "/sprint-flow"
16
- 触发后第一行输出: `Sprint Flow: PREP DESIGN BUILD VERIFY → SHIP → CLOSE`
17
- 用法: /sprint-flow "[需求描述]"
18
- 示例: /sprint-flow "开发访谈机器人,支持多轮对话"
19
- 可选参数:
20
- --no-isolate: 跳过自动 worktree 隔离(⚠️ 在保护分支上有污染风险)
21
- --branch-name <name>: 自定义分支名(默认自动生成 sprint/YYYY-MM-DD-NN)
22
- --force: 强制在当前分支继续(即使已是保护分支,⚠️ 输出警告)
23
- --stop-at <phase>: 执行到指定阶段后停止 (prep/design/build/verify/ship/close). Legacy names: isolate/think/plan/review/ship/land/cleanup
24
- --resume-from <phase>: 从指定阶段继续,跳过前面阶段 (prep/design/build/verify/ship/close)
25
- --phase <phase>: 只执行单个阶段 (prep-only/design-only/build-only/verify-only/ship-only/close-only). Legacy: isolate-only/think-only/plan-only/build-only/review-only/ship-only/land-only/cleanup-only
26
- --lang <language>: 指定项目语言 (springboot/django/golang)
27
- --type <project_type>: 指定项目类型 (web-nextjs/web-react/web-vue/mobile-flutter/mobile-react-native/backend-django/backend-go/backend-springboot)
28
- --spec <file>: 使用已有的 specification.yaml 文件
29
- --with-performance: 启用负载/压力测试(后端项目)
30
- --mode <build_mode>: 指定 Phase 3 BUILD 构建模式。默认 = ralph-loop(逐 REQ 迭代,token 节约)。parallel = 旧有并行模式(一次性 dispatch 所有需求)
31
- --status: 查看当前 Sprint 进度看板(不执行任何阶段,仅读取 sprint-state.json 并渲染进度)
32
- Use when asked to "开发新功能", "实现 X", "start sprint", "一键开发", or "/sprint-flow" for end-to-end feature development.
5
+ Orchestrates a 6-phase end-to-end feature development pipeline (PREP DESIGNBUILDVERIFY → SHIP → CLOSE).
6
+ Integrates brainstorming, autoplan, delphi-review, TDD, ralph-loop, code-walkthrough, ship, and other skills.
7
+ Pauses at key gates for user decisions. Acknowledges emergent requirements with mandatory manual UAT in CLOSE phase.
8
+
9
+ WHAT: Automates the full development lifecycle from worktree isolation to production deployment.
10
+ WHEN: User explicitly requests building a feature, developing new functionality, starting a sprint, or running /sprint-flow.
11
+ NOT WHEN: Asking HOW to implement something (educational), implementing a single function/algorithm, environment setup,
12
+ deployment-only requests, feature suggestions without execution intent, or casual "do it" requests without a feature scope.
13
+
14
+ TRIGGERS: "/sprint-flow", "start sprint", "开发新功能", "实现 X (where X is a feature/module)", "一键开发", "develop new feature",
15
+ "implement feature X", "one-shot development", "build X (where X is a feature)".
16
+ NEGATIVE TRIGGERS: "实现排序算法", "实现一下", "帮我实现这个函数", "怎么实现登录功能", "start spring boot", "开发环境配置",
17
+ "一键部署", "新功能建议", "implement a sort function", "how to implement auth".
18
+ On trigger, first line MUST output: `Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE`
33
19
  maturity: beta
20
+ auto_continue: false # Sprint-flow pauses at user decision gates (unlike delphi-review which auto-continues rounds)
34
21
  triggers:
35
22
  - "/sprint-flow"
36
23
  - "start sprint"
37
24
  - "开发新功能"
38
- - "实现 X"
39
25
  - "一键开发"
26
+ - "implement feature"
27
+ - "one-shot development"
28
+ - "build a feature"
40
29
  triggers_negative_examples:
41
30
  - "实现排序算法" # algorithm implementation, not feature development
42
31
  - "实现一下" # casual "do it", not a sprint request
@@ -48,6 +37,10 @@ triggers_negative_examples:
48
37
  - "新功能建议" # feature suggestion/request, not execution
49
38
  - "implement a sort function" # algorithm, not full feature
50
39
  - "how to implement auth" # educational question
40
+ - "实现一个util函数" # utility function, not feature
41
+ - "帮我写个脚本" # script writing, not feature development
42
+ - "代码review" # code review, not development
43
+ - "refactor this" # refactoring, not new feature
51
44
  triggers_negative_test_cases:
52
45
  - input: "实现排序算法"
53
46
  expect: "NOT triggered"
@@ -75,23 +68,60 @@ triggers_negative_test_cases:
75
68
  expect: "triggered"
76
69
  - input: "一键开发 REST API"
77
70
  expect: "triggered"
71
+ - input: "implement user authentication feature"
72
+ expect: "triggered"
73
+ - input: "start sprint for login module"
74
+ expect: "triggered"
75
+ - input: "帮我写个脚本"
76
+ expect: "NOT triggered"
77
+ - input: "代码review"
78
+ expect: "NOT triggered"
79
+ - input: "refactor this module"
80
+ expect: "NOT triggered"
78
81
  workflow_steps:
79
- - "Phase 1/6: PREP"
80
- - "Phase 2/6: DESIGN"
81
- - "Phase 3/6: BUILD"
82
- - "Phase 4/6: VERIFY"
83
- - "Phase 5/6: SHIP"
84
- - "Phase 6/6: CLOSE"
82
+ - "Phase 1/6: PREP → Output: ## Phase 1/6: PREP (准备工作)"
83
+ - "Phase 2/6: DESIGN → Output: ## Phase 2/6: DESIGN (设计)"
84
+ - "Phase 3/6: BUILD → Output: ## Phase 3/6: BUILD (构建)"
85
+ - "Phase 4/6: VERIFY → Output: ## Phase 4/6: VERIFY (验证)"
86
+ - "Phase 5/6: SHIP → Output: ## Phase 5/6: SHIP (发布)"
87
+ - "Phase 6/6: CLOSE → Output: ## Phase 6/6: CLOSE (收尾)"
88
+ hooks:
89
+ security:
90
+ - "/careful": "Safety guardrails for destructive commands — activate before any rm, force-push, or git reset"
91
+ - "/freeze": "Restrict edits to sprint worktree directory — prevent accidental changes outside scope"
92
+ - "/guard": "Full safety mode combining careful + freeze for maximum protection"
93
+ operational:
94
+ - "/context-save": "Save sprint context before pause or handoff"
95
+ - "/context-restore": "Restore sprint context on resume"
96
+ tools_allowed:
97
+ - "Bash(git, gh, npm, node)" # git worktree/branch/commit, gh PR/release, npm/node CLI
98
+ - "Read" # read project files, configs, docs
99
+ - "Write" # write sprint-state, specification.yaml, phase summaries
100
+ - "Edit" # edit sprint-state, CHANGELOG, VERSION
101
+ - "Glob" # find project files by pattern
102
+ - "Grep" # search file contents
103
+ - "Task" # delegate to subagents (quick, deep, unspecified-high)
104
+ - "Skill" # invoke integrated skills (brainstorming, autoplan, delphi-review, etc.)
105
+ - "TodoWrite" # track sprint progress
106
+ - "Question" # ask user at decision gates
107
+ tools_denied:
108
+ - "rm -rf (any recursive force remove)"
109
+ - "git push --force"
110
+ - "DROP TABLE or destructive DB operations"
111
+ - "Write(source code)" # NEVER write implementation code directly — delegate to subagents via Task
112
+ - "Edit(source code)" # NEVER edit implementation code — sprint-flow orchestrates, subagents implement
85
113
  ---
86
114
 
115
+ # Sprint Flow — 6-Phase Development Pipeline
116
+
87
117
  ## Triggers
88
118
 
89
119
  | Trigger Type | Phrases |
90
120
  |--------------|---------|
91
- | **中文** | "开发新功能", "实现 X", "start sprint", "一键开发", "/sprint-flow", "开发用户登录", "创建 XXX 模块" |
92
- | **English** | "implement feature", "build X", "start sprint", "one-shot development", "create XXX", "develop new functionality" |
121
+ | **中文** | "开发新功能", "一键开发", "/sprint-flow", "开发用户登录", "创建 XXX 模块" |
122
+ | **English** | "/sprint-flow", "start sprint", "implement feature", "one-shot development", "build a feature" |
93
123
 
94
- **Usage**: `/sprint-flow "[需求描述]"`
124
+ **Usage**: `/sprint-flow "[feature description]"`
95
125
 
96
126
  **Examples**:
97
127
  - `/sprint-flow "开发访谈机器人,支持多轮对话"`
@@ -102,25 +132,22 @@ workflow_steps:
102
132
  - `--no-isolate`: Skip auto worktree isolation (⚠️ risk of polluting protected branches)
103
133
  - `--branch-name <name>`: Custom branch name (default: `sprint/YYYY-MM-DD-NN`)
104
134
  - `--force`: Force continue on current branch even if protected (⚠️ requires explicit confirmation)
105
- - `--stop-at <phase>`: Stop after specified phase (prep/design/build/verify/ship/close). For backward compat, legacy names (isolate/think/plan/review/ship/land/cleanup) are accepted and mapped.
106
- - `--resume-from <phase>`: Resume from specified phase, skipping earlier phases (prep/design/build/verify/ship/close)
107
- - `--phase <phase>`: Execute only single phase (prep-only/design-only/build-only/verify-only/ship-only/close-only). Legacy: isolate-only/think-only/plan-only/build-only/review-only/ship-only/land-only/cleanup-only
135
+ - `--stop-at <phase>`: Stop after specified phase (prep/design/build/verify/ship/close)
136
+ - `--resume-from <phase>`: Resume from specified phase
137
+ - `--phase <phase>`: Execute only single phase (prep-only/design-only/build-only/verify-only/ship-only/close-only)
108
138
  - `--lang <language>`: Specify project language (springboot/django/golang)
109
- - `--type <project_type>`: Specify project type (web-nextjs/web-react/web-vue/mobile-flutter/mobile-react-native/backend-django/backend-go/backend-springboot)
139
+ - `--type <project_type>`: Specify project type (web-nextjs/web-react/web-vue/backend-go/backend-django/backend-springboot)
110
140
  - `--spec <file>`: Use existing specification.yaml file
111
141
  - `--with-performance`: Enable load/stress testing (backend projects)
112
- - `--mode <build_mode>`: Phase 3 BUILD build mode. Default = ralph-loop (REQ-level iteration, token-efficient). parallel = legacy all-at-once mode
113
-
114
- # Sprint Flow Skill
142
+ - `--mode <build_mode>`: Phase 3 BUILD build mode. Default = ralph-loop. parallel = legacy all-at-once mode
143
+ - `--status`: View Sprint progress dashboard (read-only, no execution)
115
144
 
116
145
  ## Security Notes
117
146
 
118
- - sprint-flow **不执行任何破坏性命令**(no `rm -rf`, `git push --force`, `DROP TABLE` 等)
119
- - `git worktree remove` 仅删除 sprint 创建的临时 worktree 目录,不影响主仓库
120
- - Phase 5 SHIP 仅创建 PR(`gh pr create`),不自动 merge(除非用户显式确认)
121
- - Phase 5 SHIP / LAND 使用 `gh pr merge --squash`(非 force push),merge 前等待 CI 通过
122
- - 文档中 `+ platform deploy` 等描述仅表示可选的部署步骤映射,**不是可执行命令**
123
- - sprint-flow 不下载、安装或执行任何外部二进制文件
147
+ - Sprint flow **does NOT execute destructive commands** (no `rm -rf`, `git push --force`, `DROP TABLE`, etc.)
148
+ - `git worktree remove` only deletes temporary worktree directories created by the sprint, never affects the main repo
149
+ - Phase 5 SHIP only creates PRs (`gh pr create`), never auto-merges without explicit user confirmation
150
+ - Sprint flow does not download, install, or execute external binaries
124
151
 
125
152
  ## Permissions
126
153
 
@@ -129,106 +156,33 @@ workflow_steps:
129
156
  - `filesystem`: read/write (project dir + `.worktrees/` only)
130
157
  - `network`: read-only (CI status, canary health)
131
158
 
132
- ## 核心原则
133
-
134
- | 原则 | 说明 |
135
- |------|------|
136
- | **单一入口** | 用户只需调用 `/sprint-flow`,自动串联全流程 |
137
- | **自动流水线** | 类似 autoplan,自动执行多个阶段 |
138
- | **关键节点暂停** | APPROVED 确认、DELPHI-GATE 通过、Ship 确认、⚠️ Phase 6 CLOSE 必须人工 |
139
- | **承认 Emergent** | 用户验收环节必须人工,无法自动化(78% 失败不可见) |
140
- | **复用现有 Skills** | 不重新发明,整合调用现有体系 |
141
-
142
159
  ---
143
160
 
144
- ## Unique Value Proposition
145
-
146
- Sprint Flow is NOT just a sequential launcher of existing skills. Here's what makes it different from manually running each skill:
147
-
148
- ### Why Sprint Flow vs Manual Skill Execution
149
-
150
- | Dimension | Manual Execution | Sprint Flow |
151
- |-----------|-----------------|-------------|
152
- | **Context Continuity** | Each skill starts fresh; lost design decisions between phases | Phase summaries + sprint-state.json maintain full traceability across 6 phases |
153
- | **Gate Enforcement** | No enforcement — easy to skip Delphi, skip TDD, skip UAT | HARD-GATE: design must be APPROVED (≥90% Delphi consensus) before coding; UAT is mandatory (no bypass) |
154
- | **Token Efficiency** | Linear context accumulation across phases — ~150K+ tokens | Ralph-loop default: 40-67% token savings via clean REQ-level contexts |
155
- | **Emergent Requirements** | Discovered late, silently ignored or merged | Phase 6 CLOSE explicitly captures emergent issues via template; triggers Sprint 2 for critical issues |
156
- | **Quality Ecosystem** | No integration with quality gates | Integrated with xp-gate's full quality ecosystem: Gate 5 (coverage), Gate M2 (mock density), Delphi code-walkthrough |
157
- | **Progress Tracking** | Ad-hoc, memory-based | `.sprint-state/` persistence with phase history, timing, and metrics — `--status` renders progress dashboard |
158
-
159
- ### Key Differentiators
160
-
161
- 1. **40-67% Token Savings via Ralph Loop**: Phase 3 BUILD default (`ralph-loop`) processes one REQ at a time with clean context, avoiding the linear context accumulation that costs 150K+ tokens in parallel mode.
162
-
163
- 2. **HARD-GATE Discipline**: Design must pass Delphi review (≥90% consensus, ≥2 model providers, domestic models only) before Phase 3 BUILD can start. This is enforced both in SKILL.md instructions and via the Claude Code plugin's PreToolUse hook.
164
-
165
- 3. **Emergent Requirements Acknowledgment**: Based on research showing 78% of failures are invisible to AI (arXiv study), Phase 6 CLOSE includes mandatory manual UAT verification — cannot be automated, skipped, or bypassed.
166
-
167
- 4. **XP-Gate Quality Ecosystem Integration**: Sprint Flow is part of the broader xp-gate ecosystem. Phase 3 BUILD integrates with Gate 5 (test coverage ≥80%), Gate M2 (mock density ≤30%), and Gate MW (code-walkthrough validation). Phase 4 VERIFY runs Delphi code-walkthrough that generates `.code-walkthrough-result.json` for pre-push enforcement.
168
-
169
- 5. **Full Lifecycle Coverage**: From worktree isolation (PREP) to cleanup (CLOSE), sprint-flow covers the entire development lifecycle — not just the "write code" part. PREP (Phase 1/6) prevents over-engineering by routing lightweight changes through simplified workflows.
170
-
171
- ---
172
-
173
- ## 完整流程(默认无参数)
174
-
175
- 调用 `/sprint-flow "[需求描述]"` 后,自动执行以下流程:
161
+ ## 6-Phase Pipeline
176
162
 
177
163
  ```
178
- Phase 1/6: PREPworktree隔离 + 规模评估 + 流程路由
179
- Phase 2/6: DESIGN → brainstorming → autoplan → delphi-review → specification.yaml
180
- Phase 3/6: BUILD → GITHOOKS-GATE → DELPHI-GATE → ralph-loop/TDD → freeze/盲评 → verification
181
- Phase 4/6: VERIFY → delphi-review --mode code-walkthrough → test-alignment → browse → learn + retro
182
- Phase 5/6: SHIP → finishing-a-development-branch → ship → land-and-deploy → canary
183
- Phase 6/6: CLOSE → USER ACCEPTANCE (⚠️ 人工) → emergent issues → cleanup
164
+ PREP DESIGNBUILD VERIFY SHIP → CLOSE
184
165
  ```
185
166
 
186
- **v2.0 Compact Redesign** (Issue #290): Merged from 11 phases to 6. PREP = old ISOLATE + AUTO-ESTIMATE. DESIGN = old THINK + PLAN. BUILD = old BUILD (unchanged). VERIFY = old REVIEW + FEEDBACK. SHIP = old SHIP + LAND. CLOSE = old USER ACCEPTANCE + CLEANUP.
187
-
188
- ---
189
-
190
- ## 暂停点设计(不是随时停,而是设计明确的暂停点)
191
-
192
- - **Phase 1/6 PREP**: 保护分支强制隔离 输出警告或自动创建 worktree 自动恢复;AUTO-ESTIMATE 结果展示用户确认按路由继续
193
- - **Phase 2/6 DESIGN**: brainstorming 设计未 APPROVED (HARD-GATE) → 用户修改APPROVED 后继续;autoplan taste_decisions用户确认;delphi-review APPROVED修复 APPROVED specification.yaml
194
- - **Phase 3/6 BUILD**: DELPHI-GATE 未通过 → BLOCK;验证失败 > max3 → 用户决策修复/放弃;成本超阈值 → 用户确认
195
- - **Phase 4/6 VERIFY**: delphi code-walkthrough REQUEST_CHANGES → 用户处理 → 重新评审;browse 发现问题 → 回退 Phase 3(不暂停)
196
- - **Phase 5/6 SHIP**: finishing-a-development-branch (4选项) → 确认;ship PR → 用户确认合并;land-and-deploy 完成/失败 → 用户确认;⚠️ SHIP must complete merge to main + release before Phase 6
197
- - **Phase 6/6 CLOSE**: SHIP→CLOSE GATE (校验 merge 已完成 + git status clean + 当前在 main) → Backup sprint-state → USER ACCEPTANCE ⚠️ 必须人工验收 → 用户确认后继续;cleanup 完成/失败 → 用户确认 → 结束流程
198
-
199
- ---
200
-
201
- ## Workflow Steps
202
-
203
- | Step | Phase | Name | Key Actions | Output |
204
- |------|-------|------|-------------|--------|
205
- | 1 | **1/6** | **PREP** | Detect protected branch → Create git worktree → AUTO-ESTIMATE sizing → Classify (lightweight/standard/complex) | Worktree path + impact assessment |
206
- | 2 | **2/6** | **DESIGN** | brainstorming → autoplan → delphi-review (HARD-GATE ≥90% consensus) → to-issues → specification.yaml | specification.yaml + slices-manifest.json |
207
- | 3 | **3/6** | **BUILD** | GITHOOKS-GATE → DELPHI-GATE → ralph-loop (default) or parallel → TDD → freeze → blind review → verification | MVP code |
208
- | 4 | **4/6** | **VERIFY** | delphi-review --mode code-walkthrough → test-specification-alignment → browse QA → benchmark (optional) → learn + retro | Review report + feedback-log.md |
209
- | 5 | **5/6** | **SHIP** | VERSION-GATE → finishing-a-development-branch → ship (create PR) → land-and-deploy → merge to main + CI + canary → release | PR URL + deploy status + merge confirmation |
210
- | 6 | **6/6** | **CLOSE** | SHIP→CLOSE GATE (merge + release verified) → Backup sprint-state → USER ACCEPTANCE (⚠️ mandatory manual) → Capture emergent issues → Cleanup worktree + branch → Sprint summary | Emergent issues list + cleanup report |
211
-
212
- **Phase Flow**:
213
- ```
214
- PREP → DESIGN → BUILD → VERIFY → SHIP (merge to main + release) → CLOSE
215
-
216
- SHIP→CLOSE GATE
217
- (merge verified + main clean)
218
- ```
167
+ | Phase | Name | Key Actions | Output |
168
+ |-------|------|-------------|--------|
169
+ | 1/6 | PREP | Detect protected branch → Create git worktree → AUTO-ESTIMATE sizing → Classify (lightweight/standard/complex) | Worktree path + impact assessment |
170
+ | 2/6 | DESIGN | brainstorming → autoplan → delphi-review (HARD-GATE ≥90% consensus) → to-issues → specification.yaml | specification.yaml + slices-manifest.json |
171
+ | 3/6 | BUILD | GITHOOKS-GATE → DELPHI-GATE → ralph-loop (default) or parallel → TDD → freeze → blind review → verification | MVP code |
172
+ | 4/6 | VERIFY | delphi-review --mode code-walkthrough → test-specification-alignment → browse QA → learn + retro | Review report + feedback-log.md |
173
+ | 5/6 | SHIP | VERSION-GATEfinishing-a-development-branch ship (create PR) land-and-deploymerge to main + CI + canary | PR URL + deploy status + merge confirmation |
174
+ | 6/6 | CLOSE | SHIP→CLOSE GATE (merge verified) → Backup sprint-state USER ACCEPTANCE (⚠️ mandatory manual) Capture emergent issuesCleanup worktree + branch | Emergent issues list + cleanup report |
219
175
 
220
176
  **Hard Gates**:
221
- - **Phase 2/6 → 3/6 (DESIGN → BUILD)**: Design must be APPROVED by delphi-review (≥90% consensus) + GITHOOKS-GATE (hooks installed) + DELPHI-GATE (spec APPROVED)
222
- - **Phase 4/6 → 5/6 (VERIFY → SHIP)**: feedback-log.md must exist (HARD-GATE)
223
- - **Phase 5/6 → 6/6 (SHIP → CLOSE)**: PR must be merged to main + release completed (HARD-GATE). See `references/phase-6-close.md#ship--close-gate`.
177
+ - **DESIGN → BUILD**: Design must be APPROVED by delphi-review (≥90% consensus) + GITHOOKS-GATE + DELPHI-GATE
178
+ - **VERIFY → SHIP**: feedback-log.md must exist (HARD-GATE)
179
+ - **SHIP → CLOSE**: PR must be merged to main + release completed (HARD-GATE)
224
180
 
225
181
  ---
226
182
 
227
- ## Phase 调用的 Skills
228
-
229
- ### ⚠️ 强制输出格式规范(Mandatory Output Format)
183
+ ## ⚠️ Required Output Format (MANDATORY for L3 Step Adherence)
230
184
 
231
- **执行每个 Phase 时,必须以以下固定格式输出阶段标题**,不可省略、不可合并、不可替换:
185
+ Every phase MUST output its header as the first line of that phase's output. Format MUST be exact:
232
186
 
233
187
  ```markdown
234
188
  ## Phase 1/6: PREP (准备工作)
@@ -239,272 +193,63 @@ PREP → DESIGN → BUILD → VERIFY → SHIP (merge to main + release) → CLOS
239
193
  ## Phase 6/6: CLOSE (收尾)
240
194
  ```
241
195
 
242
- **规则**:
243
- 1. 每个 Phase **开始执行时必须首先输出**对应的 `## Phase X/6: NAME` 标题行(作为该 Phase 输出的第一行)
244
- 2. **禁止省略** "Phase" 关键词(如不能只写 "PREP" "## 1/6"
245
- 3. **禁止合并**多个 Phase 的输出(每个 Phase 必须有独立标题)
246
- 4. **格式必须精确匹配**:`## Phase X/6:` + 大写英文名 + ` (中文名)`
247
- 5. 跳过某个 Phase(如 `--resume-from build` 跳过了 PREP, DESIGN)时,不输出被跳过 Phase 的标题
248
- 6. 触发 `/sprint-flow` 后,**第一行输出应包含工作流阶段概览**:
249
-
250
- ```
251
- Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
252
- ```
253
-
254
- ### Phase 1/6: PREP (准备工作 — worktree 隔离 + 规模评估)
255
-
256
- **执行时机**: `/sprint-flow` 启动后 → Phase 2/6 DESIGN 前。**自动执行**。
257
-
258
- **对应旧模型**: Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE
259
-
260
- **详细指令**: 参见 `references/phase-1-prep.md` — 包含步骤表、参数处理、错误回退、sprint-state 格式、AUTO-ESTIMATE 指标计算、路由决策。
261
-
262
- **快速参考**:
263
- 1. 检测保护分支 (main/master/develop) → 自动创建 worktree `.worktrees/sprint/sprint-YYYY-MM-DD-NN`
264
- 2. Sprint Lock 检测(Issue #144)— stale 锁自动覆盖,非 stale 阻断
265
- 3. 项目 setup (`npm install`/`go mod download`/`pip install`)
266
- 4. `.gitignore` 校验 + Sprint State 记录 + 基线测试
267
- 5. 识别需求类型 → 收集指标(引用计数、跨模块依赖、循环依赖)→ **轻量** / **标准** / **复杂**
268
- 6. 输出评估结果 → 用户确认后按路由继续
269
- 7. **参数**: `--no-isolate` (跳过), `--branch-name <name>`, `--force` (绕过保护分支)
270
-
271
- ### Phase 2/6: DESIGN (设计 — 需求探索 + 共识评审)
272
-
273
- **对应旧模型**: Phase 0 THINK + Phase 1 PLAN
274
-
275
- **执行者**: orchestrator 直接执行全部步骤(交互式 skill)。
276
-
277
- **详细指令**: 参见 `references/phase-2-design.md` — 完整流程、条件分支、HARD-GATE。
278
-
279
- **快速参考**:
280
- - **Step 0.5: DESIGN 路由分叉 (v0.14.0+)**: 根据 PREP 的 `change_type` 决定路径。`修改已存在代码` → SKIP autoplan, 直接 lightweight delphi-review (2 专家, 1 轮)。`新增功能` 或 undefined → 标准 autoplan 路径。详见 `references/phase-2-design.md#step-05-design-路由分叉`。
281
- - **Step 1: brainstorming** — `skill(name="brainstorming")` — 输出设计文档 + CONTEXT.md + ADR。**HARD-GATE**: 设计未批准 → 不可进入实现
282
- - **Step 2: autoplan** — `skill(name="autoplan")` — CEO/设计/工程自动评审 → 用户确认 taste_decisions(仅标准路径)
283
- - **Step 3: delphi-review** — `skill(name="delphi-review")` — 等待 APPROVED(非 APPROVED 暂停等待用户确认)
284
- - **Step 4: to-issues** — `skill(name="to-issues")` — 垂直切片 Issue 拆分 → slices-manifest.json
285
- - **Step 5: specification.yaml** — 从 APPROVED 设计文档自动提取
286
- - **Web 前端额外注入**: `design-shotgun`
287
- - **条件分支**: IF autoplan AUTO_APPROVED → lightweight delphi-review (2 专家、1 轮); ELSE → 标准 delphi-review (3 专家)
288
-
289
- ### Phase 2/6→3/6: GITHOOKS-GATE(质量门禁安装检查)
290
-
291
- **执行时机**: Phase 2/6 DESIGN 完全通过、准备进入 Phase 3/6 BUILD 之前。
292
-
293
- **必须执行**: 运行 `githooks/verify.sh` 检查当前项目的 hooks 是否安装。
294
-
295
- **检查结果处理**:
296
- - ✅ 全部存在 → 进入 Phase 3/6 BUILD 入口(仍必须先执行 DELPHI-GATE)
297
- - ❌ 部分/全部缺失 → 运行 `githooks/install.sh` 安装(包括 `.git/hooks/pre-commit`、`.git/hooks/pre-push`、`githooks/adapter-common.sh`、`githooks/adapters/`)
298
- - 如果 githooks/ 目录不存在于项目根目录(即当前项目不是 xp-gate) → 从 xp-gate 仓库拉取 `githooks/` 目录结构
299
- - 安装完成后再次 `verify.sh` 确认
300
-
301
- **核心原则**: 没有质量门禁的代码不可进入 BUILD 阶段。**GITHOOKS-GATE 失败 → 不可编码。**
302
-
303
- ### Phase 3/6: BUILD (构建 — ralph-loop 默认 + TDD + 盲评 + 验证)
196
+ **Rules**:
197
+ 1. First line of every phase output MUST be `## Phase X/6: NAME (中文名)`
198
+ 2. NEVER omit "Phase" keyword (not "## 1/6" or "PREP" alone)
199
+ 3. NEVER merge phase output — each phase gets its own header
200
+ 4. On `/sprint-flow` trigger, first line MUST output: `Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE`
201
+ 5. Each phase completion MUST write Phase Summary to `.sprint-state/phase-outputs/phase-{N}-summary.md`
202
+ 6. Each phase completion MUST update `.sprint-state/sprint-state.json`
304
203
 
305
- **对应旧模型**: Phase 2 BUILD(功能不变)
204
+ ### Phase Output Status Schema (MANDATORY per phase)
306
205
 
307
- **详细指令**: 参见 `references/phase-3-build.md`。
206
+ Each phase MUST close with structured status:
308
207
 
309
- **快速参考**:
310
- 1. **DELPHI-GATE**: 验证 `.sprint-state/delphi-reviewed.json` 存在且 `verdict = "APPROVED"` → 否则 BLOCK
311
- 2. **TDD-GATE (MANDATORY v0.14.0+)**: 在 delegation 前验证每个 REQ 存在 failing test。无 test → mark `[TDD-RED]`(ralph-loop 创建)。有 test 且 GREEN 且无实现 → BLOCK(TDD bypass)。详见 `references/phase-3-build.md#tdd-gate-pre-implementation-tdd-check-mandatory`。
312
- 3. **输入**: `slices-manifest.json`(Phase 2/6 生成),按 `execution_order` 逐个执行
313
- 4. **模式**: 默认 `ralph-loop`(逐 REQ 迭代,token 节约 40-67%),可选 `--mode parallel`
314
- 5. **Skill 步骤**: hooks-install → TDD-GATE → dispatching-parallel-agents → TDD (RED/GREEN/REFACTOR) → freeze → blind-review → unfreeze → verification-before-completion → 成本监控
315
- 6. **Mock Minimization**: integration-first, mock 仅限 external services, 密度 > 30% 需 `@mock-justified`
316
-
317
- ### Phase 4/6: VERIFY (验证 — 代码走查 + QA + 反馈获取)
318
-
319
- **对应旧模型**: Phase 3 REVIEW + Phase 4 FEEDBACK
320
-
321
- **详细指令**: 参见 `references/phase-4-verify.md`。
322
-
323
- **快速参考**:
324
- - **Orchestrator 直接执行**: delphi-review code-walkthrough 需要用户确认 verdict(Issue #249),**必须由 orchestrator 直接调用** `skill(name="delphi-review")`
325
- - **执行顺序**: `delphi-review --mode code-walkthrough` → 等待 APPROVED → `test-specification-alignment` → `browse` (gstack) → 可选 `qa`/`design-review`/`benchmark` (gstack)
326
- - **Feedback 子阶段**: `learn` (Sprint 级复盘) + `retro` (工程回顾) + 可选 `systematic-debugging` (根因调试)
327
- - **Subagent**: `task(category="quick", load_skills=["learn", "retro", "systematic-debugging"])`
328
- - 输出: 评审报告 + feedback-log.md
329
- - **HARD-GATE**: feedback-log.md must exist before Phase 5/6
330
-
331
- ### 负载/压力测试(可选)
332
-
333
- - **适用项目**:主要用于后端服务的压力测试 (k6/Locust/Gatling),Web 前端已有 `benchmark` 技能覆盖 Core Web Vitals、加载时间和资源大小等性能指标
334
- - **Phase 4/6 技能注入**:可根据项目类型自动选择合适的负载测试工具 (`k6` for Go-based services, `locust` for Python services, `gatling` for JVM-based services)
335
- - **集成方式**:可作为 Phase 4/6 的可选扩展,在 code-walkthrough 之后执行,与基准测试形成完整性能验证链条
336
- - **配置文件**:通过 `.sprint-load-test.yaml` 进行配置(待实现),包含并发用户数、持续时间、SLA 指标等参数
337
- - **触发条件**:后端项目可通过 `--type backend-*` 自动启用,或通过 `--with-performance` 标志手动启用
338
- - **Web 项目补充说明**:对于 Web 前端项目,现有的 `benchmark` 技能已处理页面加载性能、Core Web Vitals 等前端性能指标;负载/压力测试主要针对服务器端承载能力
339
-
340
- ### Phase 5/6: SHIP (发布 — 发布准备 + 合并部署)
341
-
342
- **对应旧模型**: Phase 5 SHIP + Phase 6 LAND
343
-
344
- **详细指令**: 参见 `references/phase-5-ship.md` — VERSION-GATE (MANDATORY) / finishing-a-development-branch / VERSION CHANGESET (Issue #142) / changeset schema。
345
-
346
- **快速参考**:
347
- - **Step 0: VERSION-GATE (MANDATORY — 必须在 finishing-a-development-branch 之前)**: bump VERSION → update CHANGELOG.md → run sync-version.sh → commit + push → verify PR updated。详见 `references/phase-5-ship.md#step-0-version-gate`
348
- - **Step 1: finishing-a-development-branch**: 4 选项菜单,选择 "Push and create a Pull Request"
349
- - **Orchestrator 直接执行**: `finishing-a-development-branch` 和 `ship` 均为交互式 skill,**必须由 orchestrator 直接调用** `skill(name="finishing-a-development-branch")` 和 `skill(name="ship")`
350
- - 输入: phase-4-summary.md + feedback-log.md → 输出: PR URL (含版本变更 commit)
351
- - **HARD-GATE**: Phase 4/6 未完成 → BLOCK。验证 `feedback-log.md` 存在。
352
- - **GITHOOKS-GATE**: 验证 hooks 完整性,缺失则 `githooks/install.sh`
353
- - **LAND**: `land-and-deploy` — merge PR → 等待 CI (10min) → 等待 Deploy (10min) → Canary Health Check (5min)
354
- - **回滚**: `git revert` 最后一次 merge commit
355
- - ⚠️ **SHIP COMPLETION**: Phase 5/6 结束前必须确认 PR 已 merge 到 main + release 已创建。未完成 merge 不得进入 Phase 6/6。详见 `references/phase-5-ship.md#ship-completion-gate`。
356
-
357
- **⚠️ VERSION-GATE 必须在 finishing-a-development-branch 之前执行。顺序反了会导致 PR 不含版本变更 → CI release workflow 不触发 → 无新版本发布。**
358
-
359
- ### Phase 6/6: CLOSE (收尾 — ⚠️ 人工验收 + 清理)
360
-
361
- **对应旧模型**: Phase 7 USER ACCEPTANCE + Phase 8 CLEANUP
362
-
363
- **详细指令**: 参见 `references/phase-6-close.md` — UAT checklist, emergent issues capture, cleanup procedure.
364
-
365
- **快速参考**:
366
- - **SHIP→CLOSE GATE (MANDATORY — v0.14.3+)**: 校验 PR 已 merge、当前在 main 分支、`git status --porcelain` 为空。详见 `references/phase-6-close.md#ship--close-gate`。
367
- - **Backup sprint-state**(MANDATORY): Phase 6 开始前将 `.sprint-state/` 备份到 repo 追踪路径,防止 worktree 清理后状态丢失。详见 `references/phase-6-close.md#backup-sprint-state`。
368
- - **USER ACCEPTANCE**: ⚠️ **MUST NOT be automated, skipped, or bypassed.** 即使用户说"赶时间"、"跳过验收"、"直接发布",也必须暂停等待用户确认。使用 `@templates/emergent-issues-template.md` 检查清单
369
- - **CLEANUP**: 保存分支信息 → `git worktree remove <worktree_path>`(精确路径,禁止通配符)→ 删除本地分支 + 远程分支 → 关闭遗留 OPEN PR → 更新 sprint-state.json → 释放 Sprint Lock
370
- - 输出 Cleanup Report + Sprint Summary
371
- - **IF emergent issues → Sprint 2**
208
+ ```
209
+ status: completed | blocked | user_decision_required
210
+ outputs: [list of files produced]
211
+ decisions: [list of decisions made]
212
+ next_phase_context: [key info for next phase]
213
+ ```
372
214
 
373
215
  ---
374
216
 
375
- ## 编排层规则(Orchestration Rules)
217
+ ## Detailed Phase Instructions
376
218
 
377
- 全部内容: 参见 `references/orchestration-rules.md`。包含:
378
- - Agent Dispatch (4 types), Phase Subagent Matrix, CONTEXT INHERITANCE
379
- - Phase Transition Rules, Phase Summary schema, Phase Transition Gate, RESUME GATE
380
- - WORKTREE ENFORCEMENT, Eval assertions
219
+ **All detailed phase instructions are in `references/phase-overview.md`**. The router file above provides the canonical structure; load the reference file for step-by-step execution guides, skill integration details, parameter documentation, output contracts, templates, and research evidence.
381
220
 
382
- ## 参数说明
221
+ > **Path convention**: `@references/` and `@templates/` resolve relative to the skill directory (`skills/sprint-flow/`). The per-phase reference files (`phase-*.md`) are the authoritative source for implementation details — this router file provides summary and dispatch logic only.
383
222
 
384
- | 参数 | 作用 | 示例 |
385
- |------|------|------|
386
- | (无参数) | 全流程 PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE | `/sprint-flow "开发访谈机器人"` |
387
- | `--stop-at <phase>` | 执行到指定 Phase 后停止 | `--stop-at design` |
388
- | `--resume-from <phase>` | 从指定 Phase 恢复(需先执行 RESUME GATE) | `--resume-from build --spec specification.yaml` |
389
- | `--phase <name>` | 只执行单个 Phase | `--phase build-only` |
390
- | `--status` | 查看 Sprint 进度(只读,不执行 Phase) | `--status` |
391
- | `--lang <lang>` | 指定项目语言 | `--lang springboot` / `django` / `golang` |
392
- | `--type <type>` | 指定项目类型 | `--type web-nextjs` / `backend-django` |
393
- | `--spec <file>` | 使用已有的 specification.yaml | `--spec path/to/spec.yaml` |
394
- | `--no-isolate` | 跳过 git worktree 隔离 | `--no-isolate` |
395
- | `--branch-name <name>` | 自定义分支名 | `--branch-name feat/my-feature` |
396
- | `--force` | 强制在当前分支继续 | `--force` |
397
- | `--with-performance` | 启用负载/压力测试 | `--with-performance` |
398
- | `--mode <mode>` | 构建模式(ralph-loop / parallel) | `--mode ralph-loop` |
399
-
400
- **Backward Compatible Parameter Mapping** (`--stop-at` / `--resume-from` / `--phase`):
401
-
402
- | Legacy Value | Maps To |
403
- |-------------|---------|
404
- | `isolate`, `isolate-only` | `prep`, `prep-only` |
405
- | `think`, `think-only` | `design`, `design-only` |
406
- | `plan`, `plan-only` | `design`, `design-only` |
407
- | `build`, `build-only` | `build`, `build-only` |
408
- | `review`, `review-only` | `verify`, `verify-only` |
409
- | `ship`, `ship-only` | `ship`, `ship-only` |
410
- | `land`, `land-only` | `ship`, `ship-only` |
411
- | `cleanup`, `cleanup-only` | `close`, `close-only` |
412
-
413
- **`--status` 行为规则**:
414
- - 执行 `node scripts/render-sprint-progress.cjs`,读取 `.sprint-state/sprint-state.json` 并渲染 ASCII 进度看板
415
- - 如果 `sprint-state.json` 不存在 → `[INFO] 未找到活跃的 Sprint`
416
- - 如果 `status == "completed"` → 输出完整看板 + `[INFO] Sprint 已完成。`
417
- - `--status` 可与其他参数组合:`--status --resume-from build` → 先展示状态,再提示 "将从 Phase 3/6 BUILD 继续"
418
-
419
- **`--resume-from` 限制**:校验为**尽力而为**(git commit 可被 GC 回收、文件 mtime 可被 `git checkout` 修改)。校验失败时输出完整诊断日志,建议启动新 Sprint。
420
-
421
- **项目类型自动检测**(按顺序检查):
422
-
423
- | 检测条件 | 类型 |
424
- |---------|------|
425
- | `package.json` + `next.config.js` | `web-nextjs` |
426
- | `package.json` + `vite.config.ts` + react 依赖 | `web-react` |
427
- | `package.json` + vue 依赖 | `web-vue` |
428
- | `pubspec.yaml` + `flutter:` | `mobile-flutter` |
429
- | `package.json` + react-native 依赖 or `ios/` + `android/` | `mobile-react-native` |
430
- | `go.mod` | `backend-go` (可选 k6) |
431
- | `pom.xml` | `backend-springboot` (可选 gatling) |
432
- | `manage.py` 或 `pyproject.toml` (django) | `backend-django` (可选 locust) |
433
- | 无匹配 | `backend-cli` |
434
-
435
- **项目类型 → Skill 注入映射**:
436
-
437
- | Phase | Backend (default) | Web Frontend | Mobile | Load Test |
438
- |-------|------------------|-------------|--------|-----------|
439
- | 2/6 DESIGN | `brainstorming` + `autoplan` + `delphi-review` | + `design-shotgun` | (同 web) | (通用) |
440
- | 3/6 BUILD | TDD + blind-review | (同 backend) | + `vercel-react-native-skills` / `flutter-review` | (同) |
441
- | 4/6 VERIFY | `delphi-review --mode code-walkthrough` + `test-specification-alignment` + k6/locust/gatling | + `qa` + `design-review` + `benchmark` | Flutter: `flutter-test` / RN: `detox E2E` | k6/locust/gatling |
442
- | 4/6 VERIFY (Feedback) | `learn` + `retro` | (同) | (同) | (同) |
443
- | 5/6 SHIP | `finishing-a-development-branch` + `ship` + `land-and-deploy` | (同) | + platform deploy | (同) |
444
- | 6/6 CLOSE | — 人工验收 → cleanup | (同) | (同) | (同) |
445
- | Browse | `localhost:3000` | 部署 URL + 表单/交互 | Flutter Web / RN Web | (专用) |
446
-
447
- **Mobile 工具链**: Flutter — `flutter analyze/test/build/pub publish`; RN — `metro/detox/jest/react-native run-ios/android`
223
+ **Key reference files:**
224
+ | File | Phase | Content |
225
+ |------|-------|---------|
226
+ | `@references/phase-overview.md` | ALL | Complete phase details, skill integration, params, output contract |
227
+ | `@references/phase-1-prep.md` | 1/6 | PREP worktree isolation + sizing |
228
+ | `@references/phase-2-design.md` | 2/6 | DESIGN brainstorming + delphi-review HARD-GATE |
229
+ | `@references/phase-3-build.md` | 3/6 | BUILD ralph-loop default + TDD |
230
+ | `@references/phase-4-verify.md` | 4/6 | VERIFY code-walkthrough + QA + feedback |
231
+ | `@references/phase-5-ship.md` | 5/6 | SHIP PR + merge + deploy + canary |
232
+ | `@references/phase-6-close.md` | 6/6 | CLOSE UAT + cleanup |
233
+ | `@references/orchestration-rules.md` | ALL | Agent dispatch, context inheritance, transition gates |
234
+ | `@references/force-levels.md` | ALL | Phase forcing rules |
235
+ | `@templates/` | ALL | Pain doc, emergent issues, sprint summary, progress templates |
448
236
 
449
237
  ---
450
238
 
451
- ## 状态管理
452
-
453
- **Sprint State**: 存储于 `<project-root>/.sprint-state/` — `sprint-state.yaml`/`.json` + `phase-outputs/` (pain-document.md / specification.yaml / mvp-v1 / review-report.md / emergent-issues.md / feedback-log.md / sprint-summary.md)
454
-
455
- **Sprint 2 自动触发**: Phase 6/6 CLOSE 完成时 — `emergent_issues_count == 0` → 结束; `> 0` → Critical 自动启动 Sprint 2, Major/Minor 询问用户
456
-
457
- ---
239
+ ## Anti-Patterns
458
240
 
459
- ### Phase State Persistence(阶段状态持久化 MANDATORY)
460
-
461
- **编排器必须在每个 Phase 完成后更新 `.sprint-state/sprint-state.json`**:
462
-
463
- 1. **Phase 完成后立即更新**(每个 Phase 结束前):
464
- - `phase`: 更新为当前 Phase 编号(如 `1`, `2`, `3`...)
465
- - `status`: 更新为 `"completed"`(已完成 Phase
466
- - `phase_history`: 追加新条目
467
-
468
- 2. **`phase_history` 数组条目 schema**:
469
- ```json
470
- {
471
- "phase": 1,
472
- "phase_name": "PREP",
473
- "status": "completed",
474
- "timestamp": "2026-07-08T10:30:00Z"
475
- }
476
- ```
477
-
478
- 3. **检查点**:
479
- - `--status` 参数读取 `sprint-state.json` 并渲染进度看板
480
- - TUI panel 显示当前 Phase 和历史
481
- - `--resume-from` 校验 `phase_history` 中的最后完成 Phase
482
-
483
- 4. **完整 sprint-state.json 示例**:
484
- ```json
485
- {
486
- "id": "sprint-2026-07-08-01",
487
- "phase": 3,
488
- "status": "in_progress",
489
- "phase_history": [
490
- {"phase": 1, "phase_name": "PREP", "status": "completed", "timestamp": "2026-07-08T10:00:00Z"},
491
- {"phase": 2, "phase_name": "DESIGN", "status": "completed", "timestamp": "2026-07-08T10:30:00Z"}
492
- ],
493
- "isolation": {
494
- "worktree_path": "/home/boyingliu01/projects/xp-gate/.worktrees/sprint/sprint-2026-07-08-01",
495
- "branch": "sprint/2026-07-08-01"
496
- },
497
- "outputs": {
498
- "pain_document": "phase-outputs/phase-2-summary.md",
499
- "specification": "phase-outputs/specification.yaml"
500
- },
501
- "metrics": {
502
- "coverage_pct": 85.5
503
- }
504
- }
505
- ```
506
-
507
- **Backward compat**: Old sprint-state.json files using negative/legacy phase numbers (`-1`, `-0.5`, `0`..`8`) remain readable. Dashboard renders them as-is. New sprints use phase numbers 1-6.
241
+ | Error | Correct |
242
+ |----------|-----------|
243
+ | Route Q&A, explanation, or code-search requests to sprint-flow | Only trigger for explicit feature development/implementation requests |
244
+ | Skip Phase 1/6 PREP isolation, edit directly on main/master/develop | Default: create worktree; only bypass with `--no-isolate` or `--force` + user confirmation |
245
+ | Skip AUTO-ESTIMATE and apply full heavy pipeline blindly | Evaluate lightweight/standard/complex first, follow recommended or user-confirmed flow |
246
+ | Skip Delphi review in DESIGN, go straight to BUILD | All requirement levels (lightweight/standard/complex) must pass autoplan + delphi-review; APPROVED before coding |
247
+ | Skip TDD, implement code directly | Phase 3/6 BUILD must follow RED → GREEN → REFACTOR; tests and implementation delivered together |
248
+ | Skip user acceptance, go straight to Ship | Phase 6/6 CLOSE USER ACCEPTANCE must be manual; never automate, skip, or fake |
249
+ | Enter CLOSE without SHIP completing merge to main | Phase 5/6 SHIP must complete merge to main + release before entering Phase 6/6 CLOSE; otherwise worktree cleanup leaves residue + UAT reviews unmerged code |
250
+ | Clean up CLOSE without backing up sprint-state first | `.sprint-state/` is inside worktree; it's lost on worktree removal. CLOSE step 1 MUST back up to repo-tracked path first |
251
+ | Keep adding random changes after verification failures | Max 3 fix cycles; if still failing, BLOCK and request user decision |
252
+ | Enter next phase without generating Phase Summary | Every phase MUST write `.sprint-state/phase-outputs/phase-{N}-summary.md` and pass transition gate |
508
253
 
509
254
  ---
510
255
 
@@ -519,105 +264,3 @@ Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
519
264
  ## 底层 Skills 保持独立
520
265
 
521
266
  所有被调用的 Skills 独立可用:`delphi-review` (单独评审), `test-driven-development` (TDD),sprint-flow 仅自动串联
522
-
523
- ---
524
-
525
- ## Anti-Patterns
526
-
527
- | 错误 | 正确 |
528
- |------|------|
529
- | 把普通问答、解释、代码检索请求路由到 sprint-flow | 仅在用户明确要求开发/实现/一键开发完整需求时触发 sprint-flow |
530
- | 跳过 Phase 1/6 PREP 隔离,直接在 main/master/develop 上改代码 | 默认创建 worktree;除非用户显式使用 `--no-isolate` 或 `--force` 并确认风险 |
531
- | 未完成 PREP AUTO-ESTIMATE 就套用完整重流程 | 先评估轻量/标准/复杂,再按推荐流程或用户确认后的流程执行 |
532
- | DESIGN 阶段跳过 Delphi 评审直接 BUILD | 所有需求级别(轻量/标准/复杂)必须经过 autoplan + delphi-review;未 APPROVED 禁止编码 |
533
- | 跳过 TDD 直接实现代码 | Phase 3/6 BUILD 必须遵循 RED → GREEN → REFACTOR,测试与实现一起交付 |
534
- | 跳过用户验收直接 Ship | Phase 6/6 CLOSE USER ACCEPTANCE 必须人工完成;不得自动化、跳过或伪造 |
535
- | SHIP 未完成 merge 即进入 CLOSE | Phase 5/6 SHIP 必须完成 merge to main + release 后才能进入 Phase 6/6 CLOSE,否则 worktree 清理残留 + UAT 验收的是未合并版本 |
536
- | CLOSE 清理前未备份 sprint-state | `.sprint-state/` 在 worktree 内,worktree 删除后丢失。CLOSE 第一步必须先备份到 repo 追踪路径 |
537
- | 验证失败后继续追加随机修改 | 最多 3 次修复循环;仍失败则 BLOCK 并请求用户决策 |
538
- | 未生成 Phase Summary 就进入下一阶段 | 每个 Phase 必须写入 `.sprint-state/phase-outputs/phase-{N}-summary.md` 并通过 transition gate |
539
-
540
- ## Output Format
541
-
542
- See [Output Contract](#output-contract) below for the canonical machine-readable output schema.
543
-
544
- ### Eval Assertions
545
- - `phase`, `phase_name`, `status`, `outputs`, `decisions`, `next_phase_context`
546
- - `id`, `isolation.worktree_path`, `isolation.branch`, `metrics.coverage_pct`
547
-
548
- ## Output Contract
549
-
550
- **Phase Summary** (每个 Phase 必须输出 YAML frontmatter): `phase/N`, `phase_name`, `status`, `outputs[]`, `decisions[]`, `next_phase_context` + markdown body (≤50 lines)
551
-
552
- **Sprint State JSON**: `{id, phase, status, phase_history[], isolation {worktree_path, branch}, outputs, metrics}` — 存储于 `.sprint-state/sprint-state.json`
553
-
554
- **Final User-Facing Output**: Phase/status, file paths, validation results, next user decision, PR URL or cleanup report
555
-
556
- ## References
557
-
558
- 详细指令文件位于 `@references/`:
559
-
560
- | File | Phase | Phase Name | Maps From (Old) |
561
- |------|-------|------------|-----------------|
562
- | `@references/phase-1-prep.md` | 1/6 | PREP | Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE |
563
- | `@references/phase-2-design.md` | 2/6 | DESIGN | Phase 0 THINK + Phase 1 PLAN |
564
- | `@references/phase-3-build.md` | 3/6 | BUILD | Phase 2 BUILD |
565
- | `@references/phase-4-verify.md` | 4/6 | VERIFY | Phase 3 REVIEW + Phase 4 FEEDBACK |
566
- | `@references/phase-5-ship.md` | 5/6 | SHIP | Phase 5 SHIP + Phase 6 LAND |
567
- | `@references/phase-6-close.md` | 6/6 | CLOSE | Phase 7 USER ACCEPTANCE + Phase 8 CLEANUP |
568
-
569
- Additional reference files:
570
- - `@references/force-levels.md` — Phase forcing rules
571
- - `@references/orchestration-rules.md` — Orchestration layer rules
572
- - `@references/components/` — Reusable phase building blocks
573
-
574
- ---
575
-
576
- ## Templates
577
-
578
- 模板文件位于 `@templates/`:
579
- - `@templates/pain-document-template.md` — Pain Document 模板 (Phase 2/6 DESIGN)
580
- - `@templates/emergent-issues-template.md` — Emergent Issues 检查清单 (Phase 6/6 CLOSE)
581
- - `@templates/sprint-summary-template.md` — Sprint Summary 模板 (Phase 6/6 CLOSE)
582
- - `@templates/sprint-progress-template.md` — Sprint 进度看板(每个 Phase 完成后 + `--status` 查询时渲染)
583
- - `@templates/auto-estimate-output-template.md` — AUTO-ESTIMATE 输出格式 (Phase 1/6 PREP)
584
-
585
- ---
586
-
587
- ## 研究证据
588
-
589
- | 证据 | 来源 | 应用 |
590
- |------|------|------|
591
- | One-shot = 单次迭代执行 | Boris Cherny interview | Phase 3/6 BUILD 设计 |
592
- | 80% session 从 Plan Mode 开始 | Boris skill | Phase 2/6 DESIGN 设计 |
593
- | Verification improves 2-3x | Boris #1 tip | Phase 4/6 VERIFY 设计 |
594
- | Emergent requirements 无法消除 | Mike Cohn, Rafael Santos | Phase 6/6 CLOSE 人工设计 |
595
- | 78% failures invisible | arXiv research | Phase 6/6 必要性证明 |
596
- | Think → Plan → Build → Ship | gstack ETHOS | 整体流程设计 |
597
-
598
- ---
599
-
600
- ## Phase Flow Consistency
601
-
602
- This section documents the canonical 6-phase order to ensure all future edits keep the phase sequence synchronized across all locations in this document and its reference files.
603
-
604
- **Canonical Phase Order** (Phase 1/6..6/6):
605
-
606
- | Phase # | Name | Phase # | Name |
607
- |---------|------|---------|------|
608
- | 1/6 | PREP | 4/6 | VERIFY |
609
- | 2/6 | DESIGN | 5/6 | SHIP |
610
- | 3/6 | BUILD | 6/6 | CLOSE |
611
-
612
- **Locations that MUST keep this order synchronized**:
613
- 1. **Frontmatter `workflow_steps`** — Phase list
614
- 2. **Frontmatter `description` trigger text** — Flow string
615
- 3. **Body "完整流程" section** — Phase descriptions in order
616
- 4. **Body "Phase Flow" diagram** — ASCII flow diagram
617
- 5. **Body "强制输出格式规范" section** — Output format
618
- 6. **Body "Workflow Steps" table** — Step/Phase table
619
- 7. **Body "References" section** — Reference file list
620
- 8. **`references/orchestration-rules.md` Phase Subagent Dispatch Matrix** — Phase/Name order
621
- 9. **`references/force-levels.md`** — Phase references
622
-
623
- **⚠️ Migration from old 11-phase model (v2.0)**: The 6-phase model was introduced in Issue #290 to reduce cognitive load. Old sprint-state.json files with negative/legacy phase numbers remain backward-compatible.