@boyingliu01/xp-gate 0.18.5 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter-common.sh +27 -0
- package/adapters/gate-3.sh +0 -0
- package/adapters/gate-4.sh +0 -0
- package/adapters/gate-7.sh +0 -0
- package/adapters/gate-8.sh +0 -0
- package/adapters/gate-9.sh +0 -0
- package/adapters/powershell.sh +85 -33
- package/adapters/typescript.sh +8 -8
- package/build-integrity/__tests__/import-resolver.test.ts +22 -0
- package/build-integrity/__tests__/orchestrator.test.ts +1 -2
- package/build-integrity/gate-10.ts +7 -0
- package/gate-12-file-hygiene.sh +230 -0
- package/hooks/adapter-common.sh +27 -0
- package/hooks/gate-10.sh +105 -0
- package/hooks/gate-12-file-hygiene.sh +0 -0
- package/hooks/lib/validate-code-walkthrough.cjs +125 -0
- package/hooks/pre-commit +130 -33
- package/hooks/pre-push +15 -91
- package/lib/__tests__/check-version.test.js +67 -46
- package/lib/__tests__/doctor.test.js +7 -6
- package/lib/__tests__/gate-runner.test.js +267 -0
- package/lib/__tests__/init.test.js +32 -0
- package/lib/__tests__/npm-package.test.js +13 -0
- package/lib/__tests__/phase-transition.test.js +604 -12
- package/lib/__tests__/sprint-discovery.test.ts +0 -1
- package/lib/__tests__/sprint-status-rework.test.js +100 -1
- package/lib/__tests__/update-hooks.test.js +143 -10
- package/lib/__tests__/upgrade-exec.test.js +73 -45
- package/lib/__tests__/upgrade-skill-sync.test.js +1 -1
- package/lib/__tests__/upgrade.test.js +12 -11
- package/lib/doctor.js +2 -1
- package/lib/gate-runner.js +68 -23
- package/lib/init.js +34 -5
- package/lib/install-skill.js +1 -0
- package/lib/mattpocock-license-verdict.json +1 -1
- package/lib/phase-transition.js +203 -23
- package/lib/shared-paths.js +2 -0
- package/lib/sprint-status.js +15 -4
- package/lib/test-alignment.ts +3 -13
- package/lib/update-hooks.js +129 -15
- package/mock-policy/AGENTS.md +5 -5
- package/mock-policy/__tests__/gate-m3.test.ts +0 -5
- package/mock-policy/__tests__/scope-scanner.test.ts +8 -2
- package/mutation/AGENTS.md +4 -4
- package/mutation/__tests__/mutmut-runner.test.ts +443 -2
- package/mutation/__tests__/update-baseline.test.ts +0 -2
- package/mutation/runners/mutmut-runner.ts +67 -17
- package/package.json +9 -3
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +24 -27
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +13 -12
- package/plugins/claude-code/skills/delphi-review/INSTALL.md +15 -17
- package/plugins/claude-code/skills/delphi-review/SKILL.md +30 -29
- package/plugins/claude-code/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/claude-code/skills/delphi-review/references/requirements.md +66 -54
- package/plugins/claude-code/skills/delphi-review/references/round-templates.md +7 -7
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +5 -5
- package/plugins/claude-code/skills/sprint-flow/SKILL.md +4 -4
- package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +37 -35
- package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
- package/plugins/dsh/README.md +25 -0
- package/plugins/dsh/cordis.patch.yml +7 -0
- package/plugins/dsh/package.json +70 -0
- package/plugins/dsh/scripts/prepack.cjs +82 -0
- package/plugins/dsh/skills/admin-template-guidelines/SKILL.md +113 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-1.md +91 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-2.md +155 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-3.md +70 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-4.md +154 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-5.md +126 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-6.md +180 -0
- package/plugins/dsh/skills/batch-grill-me/SKILL.md +15 -0
- package/plugins/dsh/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/dsh/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/dsh/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +70 -0
- package/plugins/dsh/skills/delphi-review/AGENTS.md +67 -0
- package/plugins/dsh/skills/delphi-review/INSTALL.md +150 -0
- package/plugins/dsh/skills/delphi-review/SKILL.md +559 -0
- package/plugins/dsh/skills/delphi-review/hooks.md +19 -0
- package/plugins/dsh/skills/delphi-review/opencode.json.delphi.example +52 -0
- package/plugins/dsh/skills/delphi-review/references/code-walkthrough.md +470 -0
- package/plugins/dsh/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
- package/plugins/dsh/skills/delphi-review/references/requirements.md +402 -0
- package/plugins/dsh/skills/delphi-review/references/round-templates.md +134 -0
- package/plugins/dsh/skills/delphi-review/scripts/verify-consensus.sh +43 -0
- package/plugins/dsh/skills/delphi-review/tools.md +29 -0
- package/plugins/dsh/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/plugins/dsh/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/plugins/dsh/skills/domain-modeling/SKILL.md +74 -0
- package/plugins/dsh/skills/grill-with-docs/SKILL.md +7 -0
- package/plugins/dsh/skills/grilling/SKILL.md +12 -0
- package/plugins/dsh/skills/improve-codebase-architecture/SKILL.md +156 -0
- package/plugins/dsh/skills/ralph-loop/SKILL.md +198 -0
- package/plugins/dsh/skills/ralph-loop/references/components.md +113 -0
- package/plugins/dsh/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
- package/plugins/dsh/skills/ralph-loop/references/workflow-details.md +99 -0
- package/plugins/dsh/skills/ralph-loop/templates/progress-log.md +36 -0
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +103 -0
- package/plugins/dsh/skills/sprint-flow/SKILL.md +411 -0
- package/plugins/dsh/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
- package/plugins/dsh/skills/sprint-flow/hooks.md +18 -0
- package/plugins/dsh/skills/sprint-flow/references/components/memory.md +87 -0
- package/plugins/dsh/skills/sprint-flow/references/components/middleware.md +75 -0
- package/plugins/dsh/skills/sprint-flow/references/components/skill-invocations.md +105 -0
- package/plugins/dsh/skills/sprint-flow/references/components/system-prompt.md +27 -0
- package/plugins/dsh/skills/sprint-flow/references/components/tool-descriptions.md +95 -0
- package/plugins/dsh/skills/sprint-flow/references/force-levels.md +204 -0
- package/plugins/dsh/skills/sprint-flow/references/orchestration-rules.md +236 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +273 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +348 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +225 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-5-ship.md +222 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +266 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-overview.md +486 -0
- package/plugins/dsh/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
- package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
- package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-output-template.md +110 -0
- package/plugins/dsh/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
- package/plugins/dsh/skills/sprint-flow/templates/pain-document-template.md +115 -0
- package/plugins/dsh/skills/sprint-flow/templates/sprint-progress-template.md +140 -0
- package/plugins/dsh/skills/sprint-flow/templates/sprint-summary-template.md +121 -0
- package/plugins/dsh/skills/sprint-flow/tools.md +29 -0
- package/plugins/dsh/skills/test-driven-development/SKILL.md +371 -0
- package/plugins/dsh/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +56 -0
- package/plugins/dsh/skills/test-specification-alignment/SKILL.md +205 -0
- package/plugins/dsh/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
- package/plugins/dsh/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
- package/plugins/dsh/skills/test-specification-alignment/references/specification-format.md +348 -0
- package/plugins/dsh/skills/to-issues/SKILL.md +277 -0
- package/plugins/dsh/src/command.test.ts +102 -0
- package/plugins/dsh/src/command.ts +75 -0
- package/plugins/dsh/src/contract.test.ts +62 -0
- package/plugins/dsh/src/gate-runner.test.ts +100 -0
- package/plugins/dsh/src/gate-runner.ts +58 -0
- package/plugins/dsh/src/index.test.ts +97 -0
- package/plugins/dsh/src/index.ts +94 -0
- package/plugins/dsh/src/skills.test.ts +58 -0
- package/plugins/dsh/tsconfig.build.json +13 -0
- package/plugins/dsh/tsconfig.json +19 -0
- package/plugins/dsh/vitest.config.ts +8 -0
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/scripts/prepack.cjs +1 -0
- package/plugins/opencode/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/opencode/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/opencode/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +24 -27
- package/plugins/opencode/skills/delphi-review/AGENTS.md +13 -12
- package/plugins/opencode/skills/delphi-review/INSTALL.md +15 -17
- package/plugins/opencode/skills/delphi-review/SKILL.md +30 -29
- package/plugins/opencode/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/opencode/skills/delphi-review/references/requirements.md +66 -54
- package/plugins/opencode/skills/delphi-review/references/round-templates.md +7 -7
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +5 -5
- package/plugins/opencode/skills/sprint-flow/SKILL.md +4 -4
- package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/plugins/opencode/skills/sprint-flow/references/force-levels.md +37 -35
- package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/SKILL.md +47 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +3 -11
- package/plugins/qoder/skills/delphi-review/AGENTS.md +15 -17
- package/plugins/qoder/skills/delphi-review/INSTALL.md +12 -12
- package/plugins/qoder/skills/delphi-review/SKILL.md +58 -25
- package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +1 -1
- package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +5 -5
- package/plugins/qoder/skills/sprint-flow/SKILL.md +2 -2
- package/plugins/qoder/skills/sprint-flow/references/force-levels.md +38 -35
- package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +48 -6
- package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +5 -6
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
- package/principles/AGENTS.md +4 -4
- package/scripts/__tests__/sync-package-content.test.js +30 -0
- package/scripts/delphi-external-review.cjs +194 -63
- package/scripts/sync-package-content.js +9 -2
- package/skills/clipboard-vision/SKILL.md +47 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/skills/delphi-review/.delphi-config.json.example +24 -27
- package/skills/delphi-review/AGENTS.md +13 -12
- package/skills/delphi-review/INSTALL.md +15 -17
- package/skills/delphi-review/SKILL.md +30 -29
- package/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/skills/delphi-review/references/requirements.md +66 -54
- package/skills/delphi-review/references/round-templates.md +7 -7
- package/skills/sprint-flow/AGENTS.md +5 -5
- package/skills/sprint-flow/SKILL.md +4 -4
- package/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/skills/sprint-flow/references/force-levels.md +37 -35
- package/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/skills/sprint-flow/references/phase-overview.md +2 -2
- package/skills/test-specification-alignment/AGENTS.md +4 -4
- package/sprint-gate.sh +291 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# skill-invocations.md — Phase→Skill 调用链与参数路由(AHE 组件分解)
|
|
2
|
+
|
|
3
|
+
> **本文是 `skills/sprint-flow/SKILL.md` 中各 Phase 调用 Skills (L88-103, L155-167) 的 AHE 对齐展开。**
|
|
4
|
+
> 用于 ablation 实验:验证 phase→skill 映射完整性对 Sprint 成功率的影响。
|
|
5
|
+
|
|
6
|
+
## 组件职责
|
|
7
|
+
|
|
8
|
+
提供完整的 Phase→Skill 映射表,包括技能来源、参数路由规则、条件分支逻辑。确保每次 Skill 调用具有足够的上下文信息。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 完整 Phase→Skill 映射矩阵
|
|
13
|
+
|
|
14
|
+
### Phase 0: THINK
|
|
15
|
+
|
|
16
|
+
| Skill | 来源 | 触发条件 | 输出 |
|
|
17
|
+
|-------|------|---------|------|
|
|
18
|
+
| `grill-with-docs` | Matt Pocock (内置) | CONTEXT.md 不存在时(首个 Skill) | 访谈记录 + CONTEXT.md + ADR |
|
|
19
|
+
| `delphi-review --mode requirements` | xp-gate | R1 三专家独立评审,验证 distinct model IDs 后聚合 ≥90% | requirements-reviewed.json |
|
|
20
|
+
| 原生设计文档生成 | sprint-flow 编排层 | R1 APPROVED 后 | docs/plans/YYYY-MM-DD-<topic>-design.md |
|
|
21
|
+
| **硬闸门** | — | 设计未批准 → 停止 | 禁止进入 Plan |
|
|
22
|
+
|
|
23
|
+
### Phase 1: PLAN
|
|
24
|
+
|
|
25
|
+
| Skill | 来源 | 触发条件 | 条件分支 |
|
|
26
|
+
|-------|------|---------|---------|
|
|
27
|
+
| `batch-grill-me` | Matt Pocock (内置) | 标准路径(change_type != "修改已存在代码") | 批量前置决策 |
|
|
28
|
+
| `delphi-review` | xp-gate | R2 三专家独立评审,最多 5 轮 | 必须产生 `.sprint-state/delphi-reviewed.json` 且 verdict=APPROVED |
|
|
29
|
+
| `to-issues` | xp-gate | delphi-review APPROVED 后 | 拆解为垂直切片 → slices-manifest.json |
|
|
30
|
+
|
|
31
|
+
### Phase 2: BUILD
|
|
32
|
+
|
|
33
|
+
| 步骤 | Skill | 来源 | 参数注入 |
|
|
34
|
+
|------|-------|------|---------|
|
|
35
|
+
| -1 | `hooks-install` | githooks | 无 |
|
|
36
|
+
| 0 | BUILD-ENTRY-CONTRACT | xp-gate CLI | slices-manifest.json schema + slice↔REQ 校验 |
|
|
37
|
+
| 1 | `test-driven-development` | xp-gate (内置) | `--lang` 注入对应 TDD skill |
|
|
38
|
+
| 2 | ralph-loop / parallel dispatch | sprint-flow 编排层 | 隔离 session,review checkpoint |
|
|
39
|
+
| 3 | blind-review (read-only subagent) | sprint-flow 编排层 | tools: [Read, Grep, Glob] |
|
|
40
|
+
| 4 | verification-before-completion | sprint-flow 编排层 | 运行测试 + lint |
|
|
41
|
+
| 5 | 成本监控 | sprint-flow 编排层 | token 阈值 |
|
|
42
|
+
| 6 | learnings.md 写入 | sprint-flow 编排层 | 原生文件写入 |
|
|
43
|
+
|
|
44
|
+
### Phase 3: REVIEW
|
|
45
|
+
|
|
46
|
+
| Skill | 模式 | 触发条件 |
|
|
47
|
+
|-------|------|---------|
|
|
48
|
+
| `delphi-review` | `--mode code-walkthrough` | 强制调用 |
|
|
49
|
+
| `test-specification-alignment` | 默认 | 强制调用(#367 程序化 HARD-GATE) |
|
|
50
|
+
| `xp-gate check --all` | 全量门禁 | 强制调用 |
|
|
51
|
+
| 浏览器验证 | Layer 4 可选链 | gstack browse > browser-use MCP > SKIP |
|
|
52
|
+
| `k6`/`locust`/`gatling` | 性能测试 | `--with-performance` 或 `--type backend-*` |
|
|
53
|
+
|
|
54
|
+
### Phase 4: USER ACCEPTANCE
|
|
55
|
+
|
|
56
|
+
| Skill | 说明 |
|
|
57
|
+
|-------|------|
|
|
58
|
+
| **无 Skill** | 必须人工验收 |
|
|
59
|
+
|
|
60
|
+
### Phase 5: FEEDBACK
|
|
61
|
+
|
|
62
|
+
| Skill | 来源 | 说明 |
|
|
63
|
+
|-------|------|------|
|
|
64
|
+
| learnings.md 写入 | 原生 | 模式记录(替代原 gstack learn) |
|
|
65
|
+
| `xp-gate retro` | 原生 CLI | 工程回顾(含 #369 返工率区块) |
|
|
66
|
+
| systematic-debugging | Layer 4 可选 | 根因调试(如已安装;否则"无根因不修复"文本纪律) |
|
|
67
|
+
|
|
68
|
+
### Phase 6: SHIP
|
|
69
|
+
|
|
70
|
+
| Skill | 说明 |
|
|
71
|
+
|-------|------|
|
|
72
|
+
| 分支完成决策(原生 4 选项) | merge / PR / keep / discard |
|
|
73
|
+
| native ship 步骤 | test → VERSION-GATE → commit → push → gh pr create |
|
|
74
|
+
| native land 步骤 | merge 确认 → wait CI → canary → fail git revert |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 参数路由规则
|
|
79
|
+
|
|
80
|
+
### `--lang` 路由
|
|
81
|
+
|
|
82
|
+
| 值 | Phase 2 注入 | Phase 3 注入 |
|
|
83
|
+
|---|-------------|-------------|
|
|
84
|
+
| `springboot` | `springboot-tdd` | springboot-verification |
|
|
85
|
+
| `django` | `django-tdd` | django-verification |
|
|
86
|
+
| `golang` | `golang-testing` | golang-verification |
|
|
87
|
+
|
|
88
|
+
### `--type` 路由
|
|
89
|
+
|
|
90
|
+
| 值 | 检测依据 | 额外 Skill |
|
|
91
|
+
|---|---------|-----------|
|
|
92
|
+
| `web-nextjs` | `next.config.js` / `app/` | `design-shotgun` |
|
|
93
|
+
| `backend-go` | `go.mod` | `k6` |
|
|
94
|
+
| `backend-springboot` | `pom.xml` | `gatling` |
|
|
95
|
+
| `backend-django` | `manage.py` | `locust` |
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## AHE 分类
|
|
100
|
+
|
|
101
|
+
| 字段 | 值 |
|
|
102
|
+
|------|---|
|
|
103
|
+
| 组件类型 | Skill Invocation Chain |
|
|
104
|
+
| 修改频率预期 | 中(新 skill 注册时更新) |
|
|
105
|
+
| 消融实验假设 | 调用链中断 → Sprint 执行失败率 ↑ |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# system-prompt.md — Sprint Flow 行为定义(AHE 组件分解)
|
|
2
|
+
|
|
3
|
+
> **本文是 `skills/sprint-flow/SKILL.md` 核心原则部分 (L34-43) 的 AHE 对齐展开。**
|
|
4
|
+
> 用于 ablation 实验:单独修改本文件可观察核心原则对 Sprint pass rate 的影响。
|
|
5
|
+
|
|
6
|
+
## 核心职责
|
|
7
|
+
|
|
8
|
+
定义 Sprint Flow 的行为边界和全局约束。相当于 AHE 的 System Prompt 组件(虽 AHE 论文显示单独修改 System Prompt 不改善性能,但作为行为基准仍然必要)。
|
|
9
|
+
|
|
10
|
+
## 核心原则 (AHE 对齐)
|
|
11
|
+
|
|
12
|
+
| # | AHE 概念 | 原则 | 说明 | 硬闸门 |
|
|
13
|
+
|---|---------|------|------|--------|
|
|
14
|
+
| 1 | 单一入口 | `/sprint-flow` | 用户只需一个命令,自动串联全流程 | Phase 0 HARD-GATE |
|
|
15
|
+
| 2 | 自动流水线 | Think → Ship | 类似 autoplan,自动执行多个阶段 | 无需用户手动调用中间技能 |
|
|
16
|
+
| 3 | 关键节点暂停 | APPROVED / Gate 1 / Phase 4 / Ship | 明确暂停点,不是随时停 | Phase 0 设计未 APPROVED → 禁止编码 |
|
|
17
|
+
| 4 | 承认 Emergent Requirements | 用户验收环节必须人工 | 78% 失败不可见,无法自动化 | Phase 4 MUST NOT 自动化 |
|
|
18
|
+
| 5 | 复用现有 Skills | 不重新发明 | 整合 brainstorming + autoplan + delphi-review + TDD 等 | 不创建新 skill,复用现有体系 |
|
|
19
|
+
|
|
20
|
+
## AHE 分类
|
|
21
|
+
|
|
22
|
+
| 字段 | 值 |
|
|
23
|
+
|------|---|
|
|
24
|
+
| 组件类型 | System Prompt |
|
|
25
|
+
| 修改频率预期 | 低(行为基线稳定后极少改变) |
|
|
26
|
+
| 消融实验假设 | 修改核心原则 → Sprint pass rate 不变或下降(AHE 发现单独修改系统提示下降 2.3%) |
|
|
27
|
+
| 关键约束 | 不得删除 Phase 4 人工验收硬闸 |
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# tool-descriptions.md — Sprint Flow 各 Phase 调用的 Skill 完整描述(AHE 组件分解)
|
|
2
|
+
|
|
3
|
+
> **本文是 `skills/sprint-flow/SKILL.md` 中 Phase 2-6 Skill 调用 (L120-298) 的 AHE 对齐展开。**
|
|
4
|
+
> 用于 ablation 实验:AHE 论文显示 Tool 组件贡献占 48%,单独修改可显著影响性能。
|
|
5
|
+
|
|
6
|
+
## 组件职责
|
|
7
|
+
|
|
8
|
+
完整描述 sprint-flow 在每个 Phase 中调用的 Skill,包括参数路由、`--lang`/`--type` 注入、条件分支逻辑。是 ablation 实验中**最可能产生显著增益**的组件。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Phase 2: BUILD 工具链(核心贡献区 — 48%)
|
|
13
|
+
|
|
14
|
+
### 默认模式: ralph-loop
|
|
15
|
+
|
|
16
|
+
| 步骤 | Skill | 来源 | 说明 |
|
|
17
|
+
|------|-------|------|------|
|
|
18
|
+
| -1 | `hooks-install` | githooks | `githooks/verify.sh` → 缺失则 `githooks/install.sh` |
|
|
19
|
+
| 0 | BUILD-ENTRY-CONTRACT | xp-gate CLI | slices-manifest.json schema + slice↔REQ 校验 |
|
|
20
|
+
| 1 | `test-driven-development` | xp-gate (内置) | RED → GREEN → REFACTOR |
|
|
21
|
+
| 2 | ralph-loop / parallel dispatch | sprint-flow 编排层 | 隔离 session,review checkpoint |
|
|
22
|
+
| 3 | blind-review (read-only subagent) | sprint-flow 编排层 | tools: [Read, Grep, Glob],只读盲评 |
|
|
23
|
+
| 4 | verification-before-completion | sprint-flow 编排层 | 测试 + lint |
|
|
24
|
+
| 5 | 成本监控 | sprint-flow 编排层 | 超阈值 BLOCK |
|
|
25
|
+
| 6 | learnings.md 写入 | sprint-flow 编排层 | 原生模式记录 |
|
|
26
|
+
|
|
27
|
+
### GITHOOKS-GATE (Phase 1→2 闸门)
|
|
28
|
+
|
|
29
|
+
- 执行时机: Phase 1 完全通过、准备进入 Phase 2 BUILD 前
|
|
30
|
+
- `githooks/verify.sh` 全部存在 → 进入 BUILD 入口(仍必须先执行 DELPHI-GATE)
|
|
31
|
+
- 缺失 → `githooks/install.sh` 安装(hooks + adapter 基础设施)
|
|
32
|
+
- **核心原则**: 没有质量门禁的代码不可进入 BUILD。**失败 → 不可编码。**
|
|
33
|
+
|
|
34
|
+
### 语言特定 TDD
|
|
35
|
+
|
|
36
|
+
通过 `--lang` 参数注入:
|
|
37
|
+
- `springboot-tdd` → springboot-verification
|
|
38
|
+
- `django-tdd` → django-verification
|
|
39
|
+
- `golang-testing` → golang-verification
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Phase 3: REVIEW + TEST 工具链
|
|
44
|
+
|
|
45
|
+
| Skill | 模式 | 说明 |
|
|
46
|
+
|-------|------|------|
|
|
47
|
+
| `delphi-review` | `--mode code-walkthrough` | 多专家匿名代码走查 |
|
|
48
|
+
| `test-specification-alignment` | 默认 | 测试与 Spec 对齐验证(#367 程序化 HARD-GATE) |
|
|
49
|
+
| `xp-gate check --all` | 全量门禁 | Gate 0–9 含安全审计 |
|
|
50
|
+
| 浏览器验证 | Layer 4 可选链 | gstack browse > browser-use MCP > SKIP |
|
|
51
|
+
| `k6` / `locust` / `gatling` | 可选 | 后端负载测试 |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Phase 5: FEEDBACK 工具链
|
|
56
|
+
|
|
57
|
+
| Skill | 说明 |
|
|
58
|
+
|-------|------|
|
|
59
|
+
| learnings.md 写入 | 原生模式记录(替代原 gstack learn) |
|
|
60
|
+
| `xp-gate retro` | 原生工程回顾(含 #369 返工率区块) |
|
|
61
|
+
| systematic-debugging | Layer 4 可选,根因调试(如已安装) |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Phase 6: SHIP 工具链
|
|
66
|
+
|
|
67
|
+
| Skill | 说明 |
|
|
68
|
+
|-------|------|
|
|
69
|
+
| 分支完成决策(原生 4 选项) | merge / PR / keep / discard |
|
|
70
|
+
| native ship 步骤 | test → VERSION-GATE → commit → push → gh pr create |
|
|
71
|
+
| native land 步骤 | merge 确认 → wait CI → canary → fail git revert |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 项目类型 → Skill 注入映射
|
|
76
|
+
|
|
77
|
+
| Phase | Backend (default) | Web Frontend | Mobile |
|
|
78
|
+
|-------|------------------|-------------|--------|
|
|
79
|
+
| Phase 0 (THINK) | `grill-with-docs` + R1 `delphi-review --mode requirements` | (同) | (同) |
|
|
80
|
+
| Phase 1 (PLAN) | `batch-grill-me` + R2 `delphi-review` | + OPTIONAL `design-shotgun` | (同 web) |
|
|
81
|
+
| Phase 2 (BUILD) | TDD + blind-review (read-only subagent) | (同 backend) | + `vercel-react-native-skills` / `flutter-review` |
|
|
82
|
+
| Phase 3 (REVIEW) | `delphi-review --mode code-walkthrough` + `xp-gate check --all` | + `xp-gate ui-review` + OPTIONAL qa/design-review/benchmark | `flutter-test` / `detox E2E` |
|
|
83
|
+
| Phase 5 (FEEDBACK) | learnings.md + `xp-gate retro` | (同) | (同) |
|
|
84
|
+
| Phase 6 (SHIP) | 原生 4 选项 + native ship + native land | (同) | + platform deploy |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## AHE 分类
|
|
89
|
+
|
|
90
|
+
| 字段 | 值 |
|
|
91
|
+
|------|---|
|
|
92
|
+
| 组件类型 | Tool Description |
|
|
93
|
+
| 修改频率预期 | 高(Phase 2 BUILD 工具链频繁调整) |
|
|
94
|
+
| 消融实验假设 | 增删 phase→skill 映射 → Sprint pass rate 变化 ±20%+ |
|
|
95
|
+
| 参考证据 | AHE 论文: Tool 组件单独修改带来 +3.3% 总增益 |
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Sprint Flow 执行级别定义
|
|
2
|
+
|
|
3
|
+
**执行时机**: Phase 2/6 DESIGN 之前,PREP AUTO-ESTIMATE 完成后。
|
|
4
|
+
|
|
5
|
+
**目的**: 根据需求规模调整上下文深度与迭代预算,平衡质量保障与效率。Force level 永远不改变专家数量或批准语义。
|
|
6
|
+
|
|
7
|
+
**核心原则**:
|
|
8
|
+
- 所有级别**必须经过 Delphi 评审**,不可跳过
|
|
9
|
+
- 所有级别都采用 architecture、technical、feasibility 三专家 Delphi;Round 1 独立执行并验证三份成功结果
|
|
10
|
+
- 模型 ID、provider、vendor、gateway 和国籍不受限制;`requested_model` trimmed 后必须 distinct
|
|
11
|
+
- 评审达到 ≥90% 共识,最多 5 轮;失败或无法验证时阻断
|
|
12
|
+
- 自动升级机制:当出现风险信号时强制升级级别
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 级别定义
|
|
17
|
+
|
|
18
|
+
| 级别 | 适用场景 | 专家数 | 最多轮数 | 通过条件 | 预计耗时 |
|
|
19
|
+
|------|---------|--------|---------|----------|---------|
|
|
20
|
+
| **轻量** | 小改动、局部修改、删除代码 | 3 | 1-5 | ≥90% 聚合共识 | 10-20 分钟 |
|
|
21
|
+
| **标准** | 常规功能开发、模块重构 | 3 | 1-5 | ≥90% 聚合共识 | 30-60 分钟 |
|
|
22
|
+
| **复杂** | 核心模块、跨模块变更、新增架构 | 3 | 1-5 | ≥90% 聚合共识 | 1-2 小时 |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Token 成本预算
|
|
27
|
+
|
|
28
|
+
| 级别 | delphi-review 调用 | 预计 Token 消耗 | 成本说明 |
|
|
29
|
+
|------|-------------------|--------------|---------|
|
|
30
|
+
| **轻量** | 1 次(3 专家、最多 5 轮) | ~8,000 | 简化上下文,仍需完整执行 |
|
|
31
|
+
| **标准** | 1-2 次(3 专家、最多 5 轮) | ~15,000-25,000 | 可能需要反馈轮次 |
|
|
32
|
+
| **复杂** | 1-3 次(3 专家、最多 5 轮) | ~30,000-60,000 | 多轮深度评审 |
|
|
33
|
+
|
|
34
|
+
> **成本计算依据**: 基于实际 Sprint 历史数据,假设每次 delphi-review 调用平均消耗 8,000-10,000 Token(含 3 位专家的输入输出)。
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 测试与验证要求
|
|
39
|
+
|
|
40
|
+
| 级别 | 单元测试 | 测试覆盖率 | 验证方式 |
|
|
41
|
+
|------|---------|-----------|---------|
|
|
42
|
+
| **轻量** | 修改处必须有测试 | ≥75% | 自动运行 + 人工抽查 |
|
|
43
|
+
| **标准** | 新增功能必须有测试 | ≥80% | 自动运行 + 人工复核 |
|
|
44
|
+
| **复杂** | 全链路测试 + 边界用例 | ≥85% | 自动运行 + Delphi 验证 |
|
|
45
|
+
|
|
46
|
+
**强制规则**:
|
|
47
|
+
- 轻量级修改**不可跳过测试**,至少添加回归测试
|
|
48
|
+
- 所有级别必须通过 `test-specification-alignment` 验证
|
|
49
|
+
- 未添加测试 → 自动升级至标准级别
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 自动升级机制
|
|
54
|
+
|
|
55
|
+
当出现以下任一情况时,**强制升级**至更高级别:
|
|
56
|
+
|
|
57
|
+
| 触发条件 | 原级别 | 升级至 | 说明 |
|
|
58
|
+
|---------|--------|--------|------|
|
|
59
|
+
| Delphi 评审出现 REQUEST_CHANGES | 轻量 | 标准 | 需要第二轮评审 |
|
|
60
|
+
| 专家意见分歧 | 轻量/标准 | 复杂 | 增加上下文深度与后续轮次预算,不增加或替换专家 |
|
|
61
|
+
| 涉及公共 API 变更 | 轻量 | 标准 | 影响外部调用方 |
|
|
62
|
+
| 修改文件数 > 5 或 LOC > 200 | 轻量 | 标准 | 改动规模超出轻量范围 |
|
|
63
|
+
| 存在循环依赖 | 轻量/标准 | 复杂 | 架构风险高 |
|
|
64
|
+
| 测试覆盖率 < 75% | 轻量 | 标准 | 质量不达标 |
|
|
65
|
+
| 修改核心模块(core/handlers) | 轻量/标准 | 复杂 | 关键路径 |
|
|
66
|
+
|
|
67
|
+
**升级流程**:
|
|
68
|
+
1. 自动检测触发条件
|
|
69
|
+
2. 输出升级警告:`[LEVEL_UPGRADE] 从 {原级别} 升级至 {新级别},原因:{触发条件}`
|
|
70
|
+
3. 保存升级记录到 `.sprint-state/level-upgrade-log.json`
|
|
71
|
+
4. 重新执行对应级别的评审流程
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 与 AUTO-ESTIMATE 的关系
|
|
76
|
+
|
|
77
|
+
AUTO-ESTIMATE 提供**初始级别建议**(Phase 1/6 PREP),Force Levels 定义**具体执行规则**:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
AUTO-ESTIMATE 输出 → Force Levels 执行 → 自动升级机制(如触发)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
| AUTO-ESTIMATE 指标 | 建议级别 | Force Levels 执行 |
|
|
84
|
+
|-------------------|---------|------------------|
|
|
85
|
+
| 引用计数 ≤ 3 + 跨模块 ≤ 1 | 轻量 | 3 专家、最多 5 轮 Delphi |
|
|
86
|
+
| 引用计数 4-10 或 跨模块 2 | 标准 | 3 专家、最多 5 轮 Delphi |
|
|
87
|
+
| 引用计数 > 10 或 跨模块 ≥ 3 | 复杂 | 3 专家、最多 5 轮 Delphi |
|
|
88
|
+
| 存在循环依赖 | 强制复杂 | 3 专家、最多 5 轮 + 架构评审 |
|
|
89
|
+
|
|
90
|
+
**关键区别**:
|
|
91
|
+
- AUTO-ESTIMATE: **客观指标分析**(代码结构、引用计数)
|
|
92
|
+
- Force Levels: **执行规则定义**(评审流程、升级机制)
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 与 DELPHI-GATE 的关系
|
|
97
|
+
|
|
98
|
+
**DELPHI-GATE** 是 Phase 3/6 BUILD 的**强制门禁**,检查 `.sprint-state/delphi-reviewed.json` 的 `verdict=APPROVED`。Force Levels 定义**产生该门禁文件的评审强度**:
|
|
99
|
+
|
|
100
|
+
| 场景 | DELPHI-GATE | Force Levels |
|
|
101
|
+
|------|------------|-------------|
|
|
102
|
+
| Phase 2/6 DESIGN 设计评审 | 3 专家、≥90% 共识、生成 specification.yaml | 不适用(设计阶段) |
|
|
103
|
+
| Phase 3/6 BUILD 入口 | **必须检查** `.sprint-state/delphi-reviewed.json` 中 `verdict=APPROVED` | 轻量/标准/复杂:通过对应强度的 delphi-review 生成该门禁文件 |
|
|
104
|
+
| 轻量级评审 | 生成 `delphi-reviewed.json`(3 专家、最多 5 轮、≥90% 聚合共识) | 3 专家、最多 5 轮、写入门禁文件 |
|
|
105
|
+
| 标准级评审 | 生成 `delphi-reviewed.json`(3 专家、最多 5 轮、≥90% 聚合共识) | 3 专家、最多 5 轮、写入门禁文件 |
|
|
106
|
+
| 复杂级评审 | 生成 `delphi-reviewed.json`(3 专家、最多 5 轮、≥90% 聚合共识) | 3 专家、最多 5 轮、写入门禁文件 |
|
|
107
|
+
| Phase 4/6 VERIFY 代码走查 | 再次检查 `delphi-reviewed.json` 或重新评审 | 复用 Force Levels 规则 |
|
|
108
|
+
|
|
109
|
+
**关键规则**:
|
|
110
|
+
- **DELPHI-GATE 永不跳过**:Phase 3/6 BUILD 入口必须检查 `.sprint-state/delphi-reviewed.json` 中 `verdict=APPROVED`
|
|
111
|
+
- **Force Levels 定义上下文强度**:所有级别都用三专家、distinct model IDs 和最多 5 轮来**产生**门禁文件
|
|
112
|
+
- **轻量级不是跳过评审**:只缩短上下文,不减少专家或共识验证
|
|
113
|
+
- **LIGHTWEIGHT ≠ ONE-EXPERT**: 1 专家违反 Delphi 核心原则,禁止
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 轻量级详细规则
|
|
118
|
+
|
|
119
|
+
**适用场景**:
|
|
120
|
+
- 删除已存在代码(如移除废弃模块)
|
|
121
|
+
- 小规模修改(≤ 5 个文件、≤ 200 行改动)
|
|
122
|
+
- 不涉及公共 API
|
|
123
|
+
- 无循环依赖
|
|
124
|
+
|
|
125
|
+
**执行流程**:
|
|
126
|
+
1. 三位专家独立评审并验证 distinct requested_model
|
|
127
|
+
2. 最多 5 轮迭代,直到达到 ≥90% 聚合共识
|
|
128
|
+
3. 三份成功结果且 APPROVED 才通过
|
|
129
|
+
4. 评审通过后写入 `.sprint-state/delphi-reviewed.json`
|
|
130
|
+
|
|
131
|
+
**输出文件** (`.sprint-state/delphi-reviewed.json`):
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"sprint_id": "sprint-2026-06-05-01",
|
|
135
|
+
"level": "轻量",
|
|
136
|
+
"delphi_review": {
|
|
137
|
+
"experts": ["architecture-model", "technical-model", "feasibility-model"],
|
|
138
|
+
"rounds": 1,
|
|
139
|
+
"votes": {
|
|
140
|
+
"expert_a": "APPROVED",
|
|
141
|
+
"expert_b": "APPROVED",
|
|
142
|
+
"expert_c": "APPROVED"
|
|
143
|
+
},
|
|
144
|
+
"consensus": ">=90% APPROVED",
|
|
145
|
+
"timestamp": "2026-06-05T10:30:00Z"
|
|
146
|
+
},
|
|
147
|
+
"status": "passed"
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**强制升级条件**(轻量级触发):
|
|
152
|
+
- 任一专家 REQUEST_CHANGES → 升级至标准级
|
|
153
|
+
- 涉及公共 API → 升级至标准级
|
|
154
|
+
- 修改文件 > 5 或 LOC > 200 → 升级至标准级
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 标准级详细规则
|
|
159
|
+
|
|
160
|
+
**适用场景**:
|
|
161
|
+
- 常规功能开发
|
|
162
|
+
- 模块重构(不涉及架构变更)
|
|
163
|
+
- 中等规模改动(5-15 个文件、200-500 行改动)
|
|
164
|
+
|
|
165
|
+
**执行流程**:
|
|
166
|
+
1. 三位专家独立评审(Round 1)
|
|
167
|
+
2. 如有 REQUEST_CHANGES,继续后续轮次(最多 5 轮)
|
|
168
|
+
3. 三份成功结果聚合达到 ≥90% 才通过
|
|
169
|
+
4. 评审通过后写入 `.sprint-state/delphi-reviewed.json`
|
|
170
|
+
|
|
171
|
+
**升级至复杂级条件**:
|
|
172
|
+
- Round 5 仍未达到共识 → BLOCK,不能以仲裁或多数票绕过
|
|
173
|
+
- 涉及核心模块(core/handlers)→ 升级至复杂级
|
|
174
|
+
- 存在循环依赖 → 升级至复杂级
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 复杂级详细规则
|
|
179
|
+
|
|
180
|
+
**适用场景**:
|
|
181
|
+
- 核心模块开发
|
|
182
|
+
- 跨模块变更(≥ 3 个目录)
|
|
183
|
+
- 架构调整
|
|
184
|
+
- 公共 API 重大变更
|
|
185
|
+
|
|
186
|
+
**执行流程**:
|
|
187
|
+
1. architecture、technical、feasibility 三位专家使用用户配置的任意可执行模型独立评审
|
|
188
|
+
2. 最多 5 轮评审
|
|
189
|
+
3. 三份成功结果聚合达到 ≥90% 且全部 APPROVED 才通过
|
|
190
|
+
4. 评审通过后写入 `.sprint-state/delphi-reviewed.json`
|
|
191
|
+
|
|
192
|
+
**分歧处理**:
|
|
193
|
+
- 每轮都保持同一组 architecture、technical、feasibility 三个角色,不新增仲裁者,也不减少执行
|
|
194
|
+
- Round 5 仍未达到批准共识时 BLOCK 进入 Phase 3/6 BUILD
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 参见
|
|
199
|
+
|
|
200
|
+
- [Phase 1/6: PREP](../references/phase-1-prep.md) — worktree 隔离 + 规模评估
|
|
201
|
+
- [Phase 2/6: DESIGN](../references/phase-2-design.md) — 需求探索 + 共识评审
|
|
202
|
+
- [Phase 3/6: BUILD](../references/phase-3-build.md) — TDD + raph-loop 构建
|
|
203
|
+
- [Phase 4/6: VERIFY](../references/phase-4-verify.md) — 代码走查 + 反馈
|
|
204
|
+
- [Delphi Review Skill](../../delphi-review/SKILL.md) — 多专家共识评审规范
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
## 编排层规则(Orchestration Rules)
|
|
2
|
+
|
|
3
|
+
### Agent Dispatch Rules
|
|
4
|
+
|
|
5
|
+
| Agent Type | 适用场景 | 不适用场景 | 超时处理 |
|
|
6
|
+
|-----------|---------|-----------|---------|
|
|
7
|
+
| `explore` (bare) | **窄搜索**:单个关键词/pattern,已知文件位置 | 多角度宽泛搜索,读取大文件,3+ search angles | >5min → cancel + 用 `deep` 重试 |
|
|
8
|
+
| `librarian` (bare) | **外部参考**:API 文档、OSS 示例 | 内部代码库宽泛探索 | >5min → cancel + 用 `deep` 重试 |
|
|
9
|
+
| `task(category="deep")` | **复杂研究**:多模块分析,架构决策 | 单文件 trivial fix | 无限制 |
|
|
10
|
+
| `task(category="unspecified-high")` | **高 effort 实现**:新模块、重构 | 单行修改 | 无限制 |
|
|
11
|
+
|
|
12
|
+
**关键规则**:
|
|
13
|
+
|
|
14
|
+
1. Bare `explore` agent 本质是 contextual grep,**不是研究 agent**。如果任务涉及:
|
|
15
|
+
- 3+ 个独立搜索角度
|
|
16
|
+
- 读取多个大文件(>200 行)
|
|
17
|
+
- 需要跨层分析(如"查 ralph-loop + .sprint-state/ + token 阈值 + phase transition")
|
|
18
|
+
|
|
19
|
+
→ **必须用 `task(category="deep", load_skills=[...])` 替代**
|
|
20
|
+
|
|
21
|
+
2. 如果 `explore` agent >5 分钟未返回 → cancel 并立即用 `task(category="deep")` 重试。不要等待。
|
|
22
|
+
|
|
23
|
+
3. **并行 explore 仍然是正确模式**。2-4 个窄搜索 explore agent 并行执行是高效且推荐的。问题在于给单一 explore agent 分配宽泛任务。
|
|
24
|
+
|
|
25
|
+
**issue #83 根因**:`bg_1abf2ed9` 被分配了 4 个独立搜索角度的宽泛任务(ralph-loop context + .sprint-state/ + token threshold + phase transition),bare explore agent 超时丢失 session。同批的 `bg_5ecf590d`(窄搜索 OpenCode compaction API)3m35s 正常完成。
|
|
26
|
+
|
|
27
|
+
### Phase Subagent Dispatch Matrix
|
|
28
|
+
|
|
29
|
+
| Phase | 名称 | Subagent? | Category | load_skills | 执行者 |
|
|
30
|
+
|-------|------|:---------:|----------|-------------|--------|
|
|
31
|
+
| 1/6 | PREP | ❌ | Bash(直接执行) | 无 | orchestrator |
|
|
32
|
+
| 2/6 | DESIGN | ❌ | orchestrator(直接执行) | `["grill-with-docs", "batch-grill-me", "delphi-review", "to-issues"]` | orchestrator |
|
|
33
|
+
| 3/6 | BUILD | ✅ | ralph-loop | `["test-driven-development"]` | subagent |
|
|
34
|
+
| 4/6 | VERIFY | ❌ | orchestrator(直接执行) | `["delphi-review", "test-specification-alignment"]` | orchestrator |
|
|
35
|
+
| 5/6 | SHIP | ❌ | orchestrator(直接执行) | 无(原生步骤) | orchestrator |
|
|
36
|
+
| 6/6 | CLOSE | ❌ | **强制人工 (UAT)** + Bash (CLEANUP) | 无 | 用户 + orchestrator |
|
|
37
|
+
|
|
38
|
+
**⚠️ 交互式 skill 必须由 orchestrator 直接执行(不可 dispatch 到 subagent)**:
|
|
39
|
+
|
|
40
|
+
| Phase | Skill | 为什么不能在 subagent 中执行 |
|
|
41
|
+
|-------|-------|---------------------------|
|
|
42
|
+
| 2/6 | `grill-with-docs` | 需要与用户对话确认需求、提出澄清问题。Subagent 是 fire-and-forget 模式,无法暂停等待用户输入(Issue #217) |
|
|
43
|
+
| 2/6 | `batch-grill-me` | 批量决策节点暂停等待用户确认。必须由 orchestrator 直接执行 |
|
|
44
|
+
| 2/6 | `delphi-review` | design 模式需等待 verdict APPROVED;非 APPROVED 时需用户确认是否接受分歧方案(Issue #249) |
|
|
45
|
+
| 2/6 | `to-issues` | Step 6 "向用户确认" — 展示拆分结果,等待用户批准后才生成 slices-manifest.json |
|
|
46
|
+
| 4/6 | `delphi-review --mode code-walkthrough` | Code walkthrough 非 APPROVED 时需暂停等待用户处理 Critical Issues(Issue #249) |
|
|
47
|
+
| 5/6 | 分支完成决策 | 4 选项菜单 (merge/PR/keep/discard) 需要用户选择;Option 4 (discard) 要求 typed confirmation |
|
|
48
|
+
| 5/6 | native ship | PR 创建前需要用户确认 |
|
|
49
|
+
| 5/6 | native land | Merge 确认、rollback 决策 — 均为用户交互点 |
|
|
50
|
+
|
|
51
|
+
**Phase 2/6 DESIGN 执行模式(全部 orchestrator 直接执行)**:
|
|
52
|
+
1. **Orchestrator 直接执行 grill-with-docs**:`skill(name="grill-with-docs")` → 访谈 + CONTEXT.md/ADR
|
|
53
|
+
2. **Orchestrator 调用 R1 Agent skill**:`/delphi-review --mode requirements`,分别执行 architecture、technical、feasibility 三个 per-expert runner → requirements-reviewed.json
|
|
54
|
+
3. **Orchestrator 生成设计文档** → 等待用户 APPROVED
|
|
55
|
+
4. **Orchestrator 直接执行 batch-grill-me**:`skill(name="batch-grill-me")` → 批量决策确认
|
|
56
|
+
5. **Orchestrator 直接执行 R2 delphi-review**:`skill(name="delphi-review")` → 等待 APPROVED
|
|
57
|
+
6. **Orchestrator 直接执行 to-issues**:`skill(name="to-issues")` → 等待用户确认 Issue 拆分
|
|
58
|
+
|
|
59
|
+
**上下文隔离原则**:
|
|
60
|
+
- 每个 Subagent 在**独立 session** 中启动,不继承 orchestrator 的对话历史
|
|
61
|
+
- orchestrator session 仅接收 subagent 的最终结果摘要(~13,000 tokens/sprint)
|
|
62
|
+
- 现代模型百万 token 上下文 + 缓存命中 → 单 sprint 不会触发 overflow
|
|
63
|
+
|
|
64
|
+
### CONTEXT INHERITANCE
|
|
65
|
+
|
|
66
|
+
每个 Phase subagent 启动时,上下文仅通过以下路径继承:
|
|
67
|
+
|
|
68
|
+
| Phase | 加载来源 | 内容 |
|
|
69
|
+
|-------|---------|------|
|
|
70
|
+
| 1/6 PREP | 无前置(Bash 操作) | 用户原始需求 + 当前分支状态 |
|
|
71
|
+
| 2/6 DESIGN | phase-1-summary(仅路径) | 隔离环境信息(worktree 路径) |
|
|
72
|
+
| 3/6 BUILD | phase-2-summary.md + specification.yaml + slices-manifest.json | 设计决策 + REQ 列表 |
|
|
73
|
+
| 4/6 VERIFY | phase-3-summary.md + MVP 代码 | 构建结果(orchestrator 直接执行) |
|
|
74
|
+
| 5/6 SHIP | phase-4-summary.md + feedback-log.md | 评审结论 + 复盘结论 |
|
|
75
|
+
| 6/6 CLOSE | phase-5-summary.md + PR URL | 发布准备 + 部署结果 |
|
|
76
|
+
|
|
77
|
+
**隔离原则**:每个 Phase subagent 在干净上下文中启动。
|
|
78
|
+
输入仅限上表对应的摘要文件和一级产出物。
|
|
79
|
+
不包含前一 Phase 的完整对话、中间文件、失败尝试。
|
|
80
|
+
|
|
81
|
+
**特殊场景**:
|
|
82
|
+
- `--resume-from <phase>`:跳过前置 Phase,直接从指定 Phase 启动。**MUST 先执行 RESUME GATE(Issue #148)** 校验 sprint 状态、git 可达性和文件时效性,再执行 Phase Transition Gate 校验摘要文件格式。例如 `--resume-from build` 要求 `phase-2-summary.md` 和 `specification.yaml` 已存在且非 stale。
|
|
83
|
+
- `--no-isolate`:跳过 Phase 1/6 PREP 的 worktree 隔离,直接在当前分支执行。Phase 2/6 DESIGN 无 `phase-1-summary` 可用,上下文继承来源为用户原始需求 + 当前 git 状态。所有后续 Phase 的 worktree enforcement 不适用(无 worktree),但仍需保持代码隔离。
|
|
84
|
+
- `next_phase_context` 中的 `{path}` 等变量占位符在实际写入时被替换为具体值。
|
|
85
|
+
|
|
86
|
+
### PHASE TRANSITION RULES
|
|
87
|
+
|
|
88
|
+
每个 Phase subagent 完成后,必须按顺序执行以下步骤:
|
|
89
|
+
|
|
90
|
+
1. **写入 Phase 摘要**:创建 `.sprint-state/phase-outputs/phase-{N}-summary.md`
|
|
91
|
+
- 格式:YAML frontmatter + Markdown body(body ≤ 50 行)
|
|
92
|
+
- 大小限制:≤ 40,000 字符(≈ 10,000 tokens)
|
|
93
|
+
|
|
94
|
+
2. **调用 phase-transition CLI**(替代手动更新 sprint-state.json + 手动渲染看板):
|
|
95
|
+
```
|
|
96
|
+
npx xp-gate phase-transition <phase> <status> --render [--outputs '<json>']
|
|
97
|
+
```
|
|
98
|
+
- Phase 开始时:`npx xp-gate phase-transition <N> in_progress --render`
|
|
99
|
+
- Phase 完成时:`npx xp-gate phase-transition <N> completed --render --outputs '{"key":"value"}'`
|
|
100
|
+
- Phase 跳过时:`npx xp-gate phase-transition <N> skipped --render`
|
|
101
|
+
- CLI 自动完成:更新 `sprint-state.json`(phase, phase_history, outputs)+ 渲染 ASCII 看板
|
|
102
|
+
- 看板规则:已完成 ✅ + 耗时,当前 🔄,待做 ⬜,跳过 ⏭️,失败 ❌
|
|
103
|
+
- 进度条:`[████▓░░░░░░] {pct}%`
|
|
104
|
+
- **禁止**手动写入 `sprint-state.json` 或手动调用 `render-sprint-progress.cjs`(已废弃)
|
|
105
|
+
|
|
106
|
+
3. **等待用户确认 checkpoint**(如适用)
|
|
107
|
+
|
|
108
|
+
4. **Phase 6 CLOSE 完成后运行 sprint-audit**(自动提醒,Layer 1.5 触发):
|
|
109
|
+
```
|
|
110
|
+
npx xp-gate sprint-audit
|
|
111
|
+
```
|
|
112
|
+
- 检查 phase 覆盖度、时间记录、输出物记录、状态一致性
|
|
113
|
+
- 输出人类可读报告或 JSON(`--json`)
|
|
114
|
+
- 报告写入 `.sprint-state/audit-report.json`(最新覆盖)
|
|
115
|
+
- Verdict: PASS / PASS_WITH_WARNINGS / FAIL / SKIP
|
|
116
|
+
- `phase-transition` CLI 在 Phase 6 completed 时自动输出提醒,无需额外指令
|
|
117
|
+
|
|
118
|
+
### Background Task Resume Protocol (MANDATORY — Issue #248)
|
|
119
|
+
|
|
120
|
+
After dispatching background agents with `run_in_background=true`:
|
|
121
|
+
|
|
122
|
+
1. **END YOUR RESPONSE** — do NOT poll `background_output()` before receiving `<system-reminder>`
|
|
123
|
+
2. **On `<system-reminder>` notification**: collect ALL completed results via `background_output(task_id="bg_...")`
|
|
124
|
+
3. **When ALL tasks complete**: immediately resume by:
|
|
125
|
+
a. Synthesizing results into the current phase assessment
|
|
126
|
+
b. Executing the phase transition gate
|
|
127
|
+
c. Continuing to the next phase **WITHOUT waiting for human input**
|
|
128
|
+
4. **If any task failed**: collect partial results, log the failure, continue with available data (do NOT block the pipeline)
|
|
129
|
+
|
|
130
|
+
**The orchestrator MUST treat task completion notifications as an implicit "continue" signal.** This protocol prevents the "human-in-loop stall" (Issue #235, #248).
|
|
131
|
+
|
|
132
|
+
### Phase Summary 格式(YAML Frontmatter Schema)
|
|
133
|
+
|
|
134
|
+
每个 `phase-N-summary.md` 必须包含以下 YAML frontmatter:
|
|
135
|
+
|
|
136
|
+
```markdown
|
|
137
|
+
---
|
|
138
|
+
phase: 1
|
|
139
|
+
phase_name: PREP
|
|
140
|
+
status: completed
|
|
141
|
+
outputs:
|
|
142
|
+
- path: ".worktrees/sprint/sprint-YYYY-MM-DD-NN"
|
|
143
|
+
type: directory
|
|
144
|
+
decisions:
|
|
145
|
+
- title: "Worktree isolation enabled"
|
|
146
|
+
rationale: "Prevent main branch pollution"
|
|
147
|
+
unresolved_issues: []
|
|
148
|
+
next_phase_context: "Worktree created at {path}. All subsequent edits MUST use this workdir."
|
|
149
|
+
---
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**必填字段**: `phase`, `phase_name`, `status`, `outputs`, `decisions`, `next_phase_context`
|
|
153
|
+
|
|
154
|
+
### Phase Transition Gate
|
|
155
|
+
|
|
156
|
+
Orchestrator dispatch 下一 Phase 前必须执行验证(与旧模型相同,但 phase number 使用 1-6):
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
SUMMARY=".sprint-state/phase-outputs/phase-${N}-summary.md"
|
|
160
|
+
[ -f "$SUMMARY" ] || { echo "[BLOCK] phase-${N}-summary 不存在"; exit 1; }
|
|
161
|
+
# ... (完整校验见原规则,phase 编号范围为 1-6)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### RESUME GATE / --resume-from 断点校验(Issue #148)
|
|
165
|
+
|
|
166
|
+
当使用 `--resume-from <phase>` 时,在执行 Phase Transition Gate 之前,
|
|
167
|
+
orchestrator MUST 先执行断点校验。与新 6-phase 模型一致,phase 编号使用 1-6。
|
|
168
|
+
|
|
169
|
+
### WORKTREE ENFORCEMENT(Issue #84)
|
|
170
|
+
|
|
171
|
+
Phase 1/6 PREP 执行完毕后,**所有后续操作(Phase 2/6 到 Phase 6/6)的文件编辑、命令执行 MUST 在 worktree 目录下执行**:
|
|
172
|
+
- **工作目录**:所有 Bash 命令必须通过 `workdir` 参数在 worktree 路径下执行
|
|
173
|
+
- **文件写入**:所有 `write`、`edit` 工具的 `filePath` 必须位于 `isolation.worktree_path` 下
|
|
174
|
+
- **例外**:`.gitignore` 校验和 `git worktree remove`(Phase 6/6 CLOSE 清理)在仓库根目录执行
|
|
175
|
+
|
|
176
|
+
Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"id": "sprint-2026-07-08-01",
|
|
180
|
+
"task_description": "开发访谈机器人,支持多轮对话",
|
|
181
|
+
"phase": 1,
|
|
182
|
+
"status": "running|paused|completed",
|
|
183
|
+
"started_at": "2026-07-08T10:00:00Z",
|
|
184
|
+
"isolation": {
|
|
185
|
+
"worktree_path": ".worktrees/sprint/sprint-2026-07-08-01",
|
|
186
|
+
"branch": "sprint/2026-07-08-01",
|
|
187
|
+
"created_from": "main",
|
|
188
|
+
"created_from_commit": "abc123def..."
|
|
189
|
+
},
|
|
190
|
+
"auto_estimate": {
|
|
191
|
+
"change_type": "删除已存在代码|修改已存在代码|新增功能|Bug修复",
|
|
192
|
+
"metrics": {
|
|
193
|
+
"ref_count": 12,
|
|
194
|
+
"cross_module_count": 3,
|
|
195
|
+
"modules": ["auth", "user", "admin"],
|
|
196
|
+
"circular_dep": true,
|
|
197
|
+
"public_api_count": 5,
|
|
198
|
+
"test_file_count": 4
|
|
199
|
+
},
|
|
200
|
+
"estimated_level": "轻量|标准|复杂",
|
|
201
|
+
"recommended_flow": "轻量流程|标准流程|完整 Sprint Flow (6 phases)",
|
|
202
|
+
"risk_warnings": ["循环依赖: user ↔ plane"],
|
|
203
|
+
"user_decision": "accepted|overridden|cancelled",
|
|
204
|
+
"override_reason": null
|
|
205
|
+
},
|
|
206
|
+
"phase_history": [
|
|
207
|
+
{
|
|
208
|
+
"phase": 1,
|
|
209
|
+
"phase_name": "PREP",
|
|
210
|
+
"status": "completed",
|
|
211
|
+
"started_at": "2026-07-08T10:00:00Z",
|
|
212
|
+
"completed_at": "2026-07-08T10:05:00Z",
|
|
213
|
+
"duration_seconds": 300
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"outputs": {
|
|
217
|
+
"pain_document": "docs/pain-document.md",
|
|
218
|
+
"specification": "specification.yaml",
|
|
219
|
+
"mvp": "mvp-v1/",
|
|
220
|
+
"review_report": "review-report.md"
|
|
221
|
+
},
|
|
222
|
+
"metrics": {
|
|
223
|
+
"tests_passed": 15,
|
|
224
|
+
"tests_failed": 0,
|
|
225
|
+
"coverage_pct": 85
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**新增字段说明**:
|
|
231
|
+
- `task_description`: Sprint 需求描述(Phase 1/6 PREP 启动时写入)
|
|
232
|
+
- `started_at`: Sprint 启动时间戳(Phase 1/6 PREP 启动时写入,ISO 8601 格式)
|
|
233
|
+
- `phase_history`: 阶段历史数组,每个元素记录阶段的执行信息(phase 编号 1-6)
|
|
234
|
+
- **Backward compat**: Legacy phase numbers (-1, -0.5, 0..8) in old sprint-state.json files remain readable
|
|
235
|
+
|
|
236
|
+
**Eval assertions check for:** `phase`, `status`, `isolation.branch`, `outputs.specification`, `metrics.coverage_pct`, `phase_history`, `task_description`.
|