@boyingliu01/xp-gate 0.38.9 → 0.38.10

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 (48) hide show
  1. package/adapters/shell.sh +87 -2
  2. package/hooks/gate-entries/gate-0-entry.sh +48 -3
  3. package/hooks/gate-entries/gate-12-entry.sh +20 -1
  4. package/hooks/gate-entries/gate-5-entry.sh +56 -2
  5. package/hooks/pre-commit +40 -0
  6. package/lib/mattpocock-license-verdict.json +1 -1
  7. package/mock-policy/AGENTS.md +85 -83
  8. package/mutation/AGENTS.md +87 -61
  9. package/package.json +1 -1
  10. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  11. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  12. package/plugins/claude-code/skills/ralph-loop/SKILL.md +1 -1
  13. package/plugins/claude-code/skills/ralph-loop/references/components.md +1 -1
  14. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  15. package/plugins/claude-code/skills/sprint-flow/__tests__/sprint-flow.test.cjs +25 -7
  16. package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +3 -3
  17. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  18. package/plugins/dsh/package.json +1 -1
  19. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  20. package/plugins/dsh/skills/ralph-loop/SKILL.md +1 -1
  21. package/plugins/dsh/skills/ralph-loop/references/components.md +1 -1
  22. package/plugins/dsh/skills/sprint-flow/AGENTS.md +3 -3
  23. package/plugins/dsh/skills/sprint-flow/__tests__/sprint-flow.test.cjs +25 -7
  24. package/plugins/dsh/skills/sprint-flow/references/phase-overview.md +3 -3
  25. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  26. package/plugins/opencode/package.json +1 -1
  27. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  28. package/plugins/opencode/skills/ralph-loop/SKILL.md +1 -1
  29. package/plugins/opencode/skills/ralph-loop/references/components.md +1 -1
  30. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  31. package/plugins/opencode/skills/sprint-flow/__tests__/sprint-flow.test.cjs +25 -7
  32. package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +3 -3
  33. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  34. package/plugins/qoder/plugin.json +1 -1
  35. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  36. package/plugins/qoder/skills/ralph-loop/SKILL.md +1 -1
  37. package/plugins/qoder/skills/ralph-loop/references/components.md +1 -1
  38. package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
  39. package/plugins/qoder/skills/sprint-flow/__tests__/sprint-flow.test.cjs +25 -7
  40. package/plugins/qoder/skills/sprint-flow/references/phase-overview.md +3 -3
  41. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  42. package/principles/AGENTS.md +103 -97
  43. package/skills/delphi-review/AGENTS.md +1 -1
  44. package/skills/ralph-loop/SKILL.md +1 -1
  45. package/skills/ralph-loop/references/components.md +1 -1
  46. package/skills/sprint-flow/AGENTS.md +3 -3
  47. package/skills/sprint-flow/references/phase-overview.md +3 -3
  48. package/skills/test-specification-alignment/AGENTS.md +1 -1
@@ -1,73 +1,99 @@
1
1
  # SRC/MUTATION KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-11-04
4
- **Commit:** eb2097b0
5
- **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
3
+ Mutation testing for pre-push **Gate M** (plus Gate M2's test-layer helper,
4
+ consumed by `src/mock-policy/`). Multi-language: one runner per engine, driven
5
+ by the same incremental changed-files contract.
7
6
 
8
- ## OVERVIEW
9
- **Gate M** (incremental mutation testing) + **Gate M2** helpers (test-layer detection used by `src/mock-policy/`). Pre-push quality gate. TypeScript-only; uses Stryker.
7
+ ## WHY MUTATION TESTING, AND WHY IT IS THE HARDEST GATE
10
8
 
11
- ## STRUCTURE
12
- ```
13
- src/mutation/
14
- ├── gate-m.ts # Incremental mutation testing gate — driven by changed-files list
15
- ├── detect-ai-test.ts # AI-test heuristics + detectTestLayer() (reused by Gate M3)
16
- ├── init-baseline.ts # First-time full baseline initialization
17
- ├── update-baseline.ts # Baseline update after successful push
18
- ├── stryker-types.ts # Typed wrapper around Stryker JSON output
19
- ├── types.ts # Local type definitions
20
- └── __tests__/
21
- ├── gate-m.test.ts
22
- └── detect-ai-test.test.ts
23
- ```
9
+ Coverage says a line executed. It says nothing about whether any assertion would
10
+ notice if that line were wrong — a test suite can hit 95% coverage and still
11
+ assert almost nothing. Mutation testing answers the real question: it breaks the
12
+ code deliberately and checks whether the suite goes red.
24
13
 
25
- ## WHERE TO LOOK
26
- | Task | Location | Notes |
27
- |------|----------|-------|
28
- | Mutation gate runner | gate-m.ts | `npx tsx src/mutation/gate-m.ts --changed-files "..."` |
29
- | AI-test heuristics | detect-ai-test.ts | Used by both Gate M2 and Gate M3 |
30
- | Test layer detection | detect-ai-test.ts `detectTestLayer` | unit / integration / e2e / unknown |
31
- | Baseline init | init-baseline.ts | First-time full scan |
32
- | Baseline update | update-baseline.ts | Refresh after a clean push |
33
-
34
- ## CONVENTIONS
35
- - **Mutation targets**: `src/principles/**/*.ts` by default.
36
- - **Thresholds** (from `stryker.conf.json`): high=80%, low=60%, break=40%.
37
- - **Critical paths** configurable via `.mutation-critical-paths` (forces 80% on listed paths).
38
- - **Baseline** stored in `.mutation-baseline.json`.
39
- - **Pre-push slim config**: `stryker.prepush.conf.json` (faster; only mutates changed files).
40
- - **Coverage exclude**: `src/mutation/**` is excluded from vitest coverage to avoid mutating the mutator.
41
-
42
- ## ANTI-PATTERNS
43
- - Do NOT run mutation directly on `main` without worktree isolation.
44
- - Do NOT skip baseline initialization before the first incremental run.
45
- - Do NOT lower thresholds below 40% (the Stryker break threshold).
46
- - Do NOT couple `detect-ai-test.ts` to Gate M3 internals — it must remain a generic helper consumable by both Gate M2 and Gate M3.
47
-
48
- ## UNIQUE STYLES
49
- - **Incremental by default** — only mutates changed files in pre-push mode.
50
- - **Gate M2 is implemented inline in `githooks/pre-push`** (regex-counted mock keywords) — only the test-layer detection helper lives here.
51
- - **Main/master push**: Gate M still runs; only the Delphi code-walkthrough validator is skipped.
14
+ That property makes Gate M expensive in a way no other gate is: it needs a green
15
+ dry run, then one test run *per mutant*. Everything in this module exists to
16
+ make that cost survivable rather than to make it correct.
52
17
 
53
- ## COMMANDS
54
- ```bash
55
- # Full suite (CI / local manual)
56
- npm run test:mutation
18
+ ## THE DESIGN THAT KEEPS IT RUNNABLE
19
+
20
+ **Incremental by default.** Pre-push mutates only the changed files. A full run
21
+ is a deliberate, minutes-long act (`npm run test:mutation`), not something that
22
+ happens behind a push.
23
+
24
+ **A baseline converts "score" into "did this change make it worse".** Absolute
25
+ mutation score is a property of the whole codebase and moves when unrelated code
26
+ changes; it cannot gate a single push. `.mutation-baseline.json` records the
27
+ score per file, so a push is judged on *newly surviving mutants*, not on a number
28
+ that was never this contributor's to move. Initialize it before the first
29
+ incremental run — an empty baseline reports every survivor as new.
30
+
31
+ **Runners are adapter-shaped, one engine per language.** Go → go-mutant,
32
+ Python → mutmut **or** pytest-gremlins, Java/Kotlin → PIT, C#/.NET → Stryker,
33
+ TypeScript → Stryker. New engines plug in through `runners/index.ts`.
34
+
35
+ **Two Python engines exist for a platform reason, not a preference.** mutmut 3.x
36
+ is built on `fork()`, so on Windows it only runs under WSL — a native Windows
37
+ user got a structural deadlock (installed ⇒ `mutmut run` exits 1 ⇒ push blocked;
38
+ uninstalled ⇒ Gate M skips). pytest-gremlins uses mutation *switching*
39
+ (instrument once, flip an env var per mutant): no fork, no per-mutant file I/O,
40
+ natively cross-platform. Both are kept because WSL and native Windows are both
41
+ real setups here.
42
+
43
+ ## THRESHOLDS AND WHERE THEY LIVE
44
+
45
+ `stryker.conf.json` holds high/low/break = 80/60/40. The break threshold is the
46
+ floor: **do not lower it below 40**, because below that a "passing" mutation
47
+ score no longer implies the suite constrains behaviour at all. Critical paths can
48
+ be forced to 80% via `.mutation-critical-paths` — that list should be short and
49
+ justified; forcing it broadly makes the gate unpassable and therefore ignored.
57
50
 
58
- # Initialize baseline (one-time)
59
- npm run mutation:baseline:init
51
+ Mutation targets default to `src/principles/**` (excluding its own tests and
52
+ `adapters/`), and `src/mutation/**` is excluded from vitest coverage to avoid
53
+ paying to mutate the mutator.
60
54
 
61
- # Incremental run on specific files
62
- npm run mutation:incremental -- --changed-files "src/foo.ts,src/bar.ts"
55
+ ## TRAPS
63
56
 
64
- # Direct Gate M invocation (what pre-push calls)
65
- npx tsx src/mutation/gate-m.ts --changed-files "src/foo.ts"
57
+ **Gate M2 is not here.** It is implemented inline in `githooks/pre-push`
58
+ (regex-counted mock keywords). Only `detectTestLayer` lives in this module and is
59
+ shared with `src/mock-policy/gate-m3.ts` — keep that export stable, or the two
60
+ gates start disagreeing about what a file is.
61
+
62
+ **On main/master, Gate M still runs** — only the Delphi code-walkthrough
63
+ validator is skipped. Do not read "pushing to main" as "mutation did not happen".
64
+
65
+ **Do not run mutation directly on `main` without worktree isolation**: Stryker
66
+ writes reports and a temporary instrumented tree, and a run killed mid-way on the
67
+ checked-out branch leaves a confusing working tree.
68
+
69
+ **A skipped Gate M is not a pass.** Every "No changed <lang> source files" line
70
+ in pre-push output means that language was not mutation-tested on this push.
71
+
72
+ ## WHERE TO LOOK
73
+
74
+ | Task | File |
75
+ |---|---|
76
+ | Gate M orchestration, changed-files contract | `gate-m.ts` |
77
+ | Engine selection | `runners/index.ts` |
78
+ | Per-engine wrapper (one file each) | `runners/*-runner.ts` |
79
+ | Test-layer detection (shared with Gate M3) | `detect-ai-test.ts` |
80
+ | Stryker JSON typing | `stryker-types.ts` |
81
+ | Baseline lifecycle | `init-baseline.ts`, `update-baseline.ts` |
82
+
83
+ ## COMMANDS
84
+
85
+ ```bash
86
+ npm run test:mutation # full run (slow, deliberate)
87
+ npm run mutation:baseline:init # one-time baseline
88
+ npm run mutation:incremental -- --changed-files "src/foo.ts"
89
+ npx tsx src/mutation/gate-m.ts --changed-files "src/foo.ts" # what pre-push calls
66
90
  ```
67
91
 
68
- ## NOTES
69
- - Invoked by `githooks/pre-push` as Gate M.
70
- - CI workflow: `.github/workflows/mutation-test.yml` (45-min timeout).
71
- - Mock policy (`src/mock-policy/gate-m3.ts`) imports `detectTestLayer` from this module — keep that export stable.
72
- - Configs: `stryker.conf.json` (full), `stryker.prepush.conf.json` (slim).
92
+ ## WHEN YOU CHANGE SOMETHING
73
93
 
94
+ - Adding a language → add a runner and register it in `runners/index.ts`; the
95
+ gate learns the language from the runner set, not from a name list here.
96
+ - Changing thresholds → they live in `stryker.conf.json`; lowering `break`
97
+ below 40 is how this gate stops meaning anything.
98
+ - Changing `detectTestLayer` → it has two consumers (Gate M2's helpers and
99
+ Gate M3's layer matrix); check both.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.38.9",
3
+ "version": "0.38.10",
4
4
  "description": "AI-driven development workflow: 6 quality gates + Delphi review + Sprint Flow",
5
5
  "bin": {
6
6
  "xp-gate": "bin/xp-gate.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.38.9",
3
+ "version": "0.38.10",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -7,7 +7,7 @@ maturity: stable
7
7
 
8
8
  # Ralph Loop — Default REQ-Level Iterative Build
9
9
 
10
- Core principles: **isolated context per REQ**, **TDD-first**, **full regression every iteration**, **token efficiency** (40-67% savings vs parallel).
10
+ Core principles: **isolated context per REQ**, **TDD-first**, **full regression every iteration**, **no cross-REQ context accumulation** (each REQ starts clean instead of inheriting an ever-growing shared context).
11
11
 
12
12
  ## Triggers
13
13
 
@@ -5,7 +5,7 @@
5
5
  | # | 原则 | 说明 |
6
6
  |---|------|------|
7
7
  | 1 | 逐 REQ 迭代 | 一次处理一个 REQ/切片,干净上下文,避免上下文线性膨胀 |
8
- | 2 | Token 节约 | 比旧并行模式节约 40-67% token |
8
+ | 2 | 上下文不累积 | 比旧的并行模式少一层**线性累积**:并行模式下所有 REQ 共享同一条不断变长的上下文,逐 REQ 模式每个 REQ 从干净上下文开始 |
9
9
  | 3 | 全量回归 | 每个 REQ 完成后跑全量测试 |
10
10
  | 4 | 进度持久化 | progress.log 持久化 learnings/permanent/contextual |
11
11
  | 5 | 可中断续传 | 中断后可从最后完成 REQ 继续 |
@@ -3,10 +3,10 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
- **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
9
+ **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
10
10
 
11
11
  > **v2.0 Compact Redesign (Issue #290)**: Merged from 11 phases to 6. PREP = old ISOLATE + AUTO-ESTIMATE. DESIGN = old THINK + PLAN. BUILD = old BUILD. VERIFY = old REVIEW + FEEDBACK. SHIP = old SHIP + LAND. CLOSE = old USER ACCEPTANCE + CLEANUP.
12
12
 
@@ -63,7 +63,7 @@ skills/sprint-flow/
63
63
  | 6/6 | CLOSE | USER ACCEPT + CLEANUP | Manual UAT → emergent issues → cleanup | HARD-GATE: UAT mandatory manual |
64
64
 
65
65
  ## CONVENTIONS
66
- - **ralph-loop is Phase 3/6 BUILD default**. Each REQ runs in a clean context, saving 40-67% tokens.
66
+ - **ralph-loop is Phase 3/6 BUILD default**. Each REQ runs in a clean context, so context does not accumulate across REQs.
67
67
  - **delphi-review HARD-GATE in Phase 2/6 DESIGN**: all three expert roles must execute with three distinct requested model IDs, then aggregate ≥90% consensus within 5 rounds. Unapproved or unverifiable → BLOCK coding.
68
68
  - **`learn` is called twice**: once per REQ in Phase 3/6 (ralph-loop internal) and once in Phase 4/6 VERIFY (Sprint-level retro).
69
69
  - **Phase isolation**: each phase has explicit entry/exit criteria documented in its `references/phase-*.md` file.
@@ -260,12 +260,30 @@ function testUniqueValuePropositionExists() {
260
260
  console.log(' ✓ Unique Value Proposition section exists');
261
261
  }
262
262
 
263
- function testUvpMentionsTokenSavings() {
263
+ function testUvpMentionsContextIsolation() {
264
264
  const section = contentSplit('Unique Value Proposition');
265
- if (!section.includes('40') || !section.includes('67') || !section.includes('token')) {
266
- throw new Error('Unique Value Proposition must mention 40-67% token savings');
267
- }
268
- console.log(' ✓ UVP mentions 40-67% token savings');
265
+ // Guards the MECHANISM, not a number. This assertion used to require the
266
+ // literal '40' and '67' -- a figure with no measurement behind it anywhere in
267
+ // the repo, copied between docs and pinned here so it could never be corrected.
268
+ // What actually distinguishes ralph-loop is that a REQ starts from a clean
269
+ // context instead of inheriting one: that is checkable and does not rot.
270
+ const mentionsIsolation =
271
+ /clean context|context (?:does not|doesn't) accumulate|no cross-REQ context accumulation|Context Growth/i.test(
272
+ section
273
+ );
274
+ if (!mentionsIsolation) {
275
+ throw new Error(
276
+ 'Unique Value Proposition must explain the per-REQ clean-context mechanism'
277
+ );
278
+ }
279
+ // And it must not resurrect an unsourced percentage as if it were measured.
280
+ const unsourcedPercentage = /\b\d{1,3}\s*[-–]\s*\d{1,3}%\s*(?:token|Token)/.test(section);
281
+ if (unsourcedPercentage) {
282
+ throw new Error(
283
+ 'UVP states a token-savings percentage range; no measurement backs it, so do not reinstate one without data'
284
+ );
285
+ }
286
+ console.log(' ✓ UVP explains per-REQ clean context without an unsourced figure');
269
287
  }
270
288
 
271
289
  function testUvpMentionsHardGate() {
@@ -353,7 +371,7 @@ function runTests(opts = {}) {
353
371
  { name: 'force-levels.md exists with three levels', fn: testForceLevelsDocumentExists },
354
372
  { name: 'force-levels.md requires Delphi review', fn: testForceLevelsRequiresDelphi },
355
373
  { name: 'Unique Value Proposition exists', fn: testUniqueValuePropositionExists },
356
- { name: 'UVP mentions 40-67% token savings', fn: testUvpMentionsTokenSavings },
374
+ { name: 'UVP explains per-REQ clean context (no unsourced figure)', fn: testUvpMentionsContextIsolation },
357
375
  { name: 'UVP mentions HARD-GATE', fn: testUvpMentionsHardGate },
358
376
  { name: 'UVP mentions emergent requirements', fn: testUvpMentionsEmergentRequirements },
359
377
  { name: 'Timing & Stability section exists', fn: testTimingSectionExists },
@@ -436,7 +454,7 @@ describe('sprint-flow SKILL.md', () => {
436
454
  { name: 'force-levels.md exists with three levels', fn: testForceLevelsDocumentExists },
437
455
  { name: 'force-levels.md requires Delphi review', fn: testForceLevelsRequiresDelphi },
438
456
  { name: 'Unique Value Proposition exists', fn: testUniqueValuePropositionExists },
439
- { name: 'UVP mentions 40-67% token savings', fn: testUvpMentionsTokenSavings },
457
+ { name: 'UVP explains per-REQ clean context (no unsourced figure)', fn: testUvpMentionsContextIsolation },
440
458
  { name: 'UVP mentions HARD-GATE', fn: testUvpMentionsHardGate },
441
459
  { name: 'UVP mentions emergent requirements', fn: testUvpMentionsEmergentRequirements },
442
460
  { name: 'Timing & Stability section exists', fn: testTimingSectionExists },
@@ -27,14 +27,14 @@ Sprint Flow is NOT just a sequential launcher of existing skills. Here's what ma
27
27
  |-----------|-----------------|-------------|
28
28
  | **Context Continuity** | Each skill starts fresh; lost design decisions between phases | Phase summaries + sprint-state.json maintain full traceability across 6 phases |
29
29
  | **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) |
30
- | **Token Efficiency** | Linear context accumulation across phases — ~150K+ tokens | Ralph-loop default: 40-67% token savings via clean REQ-level contexts |
30
+ | **Context Growth** | Linear context accumulation across phases — one growing shared context | Ralph-loop default: each REQ starts from a clean context instead of inheriting everything before it |
31
31
  | **Emergent Requirements** | Discovered late, silently ignored or merged | Phase 6 CLOSE explicitly captures emergent issues via template; triggers Sprint 2 for critical issues |
32
32
  | **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 |
33
33
  | **Progress Tracking** | Ad-hoc, memory-based | `.sprint-state/` persistence with phase history, timing, and metrics — `--status` renders progress dashboard |
34
34
 
35
35
  ### Key Differentiators
36
36
 
37
- 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.
37
+ 1. **No Cross-REQ Context Accumulation via Ralph Loop**: Phase 3 BUILD default (`ralph-loop`) processes one REQ at a time with a clean context, instead of carrying every earlier REQ in one growing context as parallel mode does. The benefit is qualitative — earlier REQs stop competing for room with the current one — and no measured token figure is claimed here.
38
38
 
39
39
  2. **HARD-GATE Discipline**: Design must pass Delphi review with all three expert roles executed successfully, three distinct requested model IDs verified, and ≥90% aggregate consensus within five rounds before Phase 3 BUILD can start. This is enforced both in SKILL.md instructions and via the Claude Code plugin's PreToolUse hook.
40
40
 
@@ -190,7 +190,7 @@ Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
190
190
  2. **DELPHI-GATE**: 验证 `.sprint-state/delphi-reviewed.json` 存在且 `verdict = "APPROVED"` → 否则 BLOCK
191
191
  3. **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`。
192
192
  4. **输入**: `slices-manifest.json`(Phase 2/6 生成),按 `execution_order` 逐个执行
193
- 5. **模式**: 默认 `ralph-loop`(逐 REQ 迭代,token 节约 40-67%),可选 `--mode parallel`
193
+ 5. **模式**: 默认 `ralph-loop`(逐 REQ 迭代,每个 REQ 独立干净上下文,不与之前的 REQ 累积),可选 `--mode parallel`
194
194
  6. **Skill 步骤**: BUILD-ENTRY-CONTRACT → hooks-install → TDD-GATE → TDD (RED/GREEN/REFACTOR) → blind-review (read-only subagent, tools: [Read, Grep, Glob]) → verification-before-completion → 成本监控 → learnings.md 写入
195
195
  7. **Mock Minimization**: integration-first, mock 仅限 external services, 密度 > 30% 需 `@mock-justified`
196
196
 
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/dsh-plugin-xp-gate",
3
- "version": "0.38.9",
3
+ "version": "0.38.10",
4
4
  "description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -7,7 +7,7 @@ maturity: stable
7
7
 
8
8
  # Ralph Loop — Default REQ-Level Iterative Build
9
9
 
10
- Core principles: **isolated context per REQ**, **TDD-first**, **full regression every iteration**, **token efficiency** (40-67% savings vs parallel).
10
+ Core principles: **isolated context per REQ**, **TDD-first**, **full regression every iteration**, **no cross-REQ context accumulation** (each REQ starts clean instead of inheriting an ever-growing shared context).
11
11
 
12
12
  ## Triggers
13
13
 
@@ -5,7 +5,7 @@
5
5
  | # | 原则 | 说明 |
6
6
  |---|------|------|
7
7
  | 1 | 逐 REQ 迭代 | 一次处理一个 REQ/切片,干净上下文,避免上下文线性膨胀 |
8
- | 2 | Token 节约 | 比旧并行模式节约 40-67% token |
8
+ | 2 | 上下文不累积 | 比旧的并行模式少一层**线性累积**:并行模式下所有 REQ 共享同一条不断变长的上下文,逐 REQ 模式每个 REQ 从干净上下文开始 |
9
9
  | 3 | 全量回归 | 每个 REQ 完成后跑全量测试 |
10
10
  | 4 | 进度持久化 | progress.log 持久化 learnings/permanent/contextual |
11
11
  | 5 | 可中断续传 | 中断后可从最后完成 REQ 继续 |
@@ -3,10 +3,10 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
- **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
9
+ **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
10
10
 
11
11
  > **v2.0 Compact Redesign (Issue #290)**: Merged from 11 phases to 6. PREP = old ISOLATE + AUTO-ESTIMATE. DESIGN = old THINK + PLAN. BUILD = old BUILD. VERIFY = old REVIEW + FEEDBACK. SHIP = old SHIP + LAND. CLOSE = old USER ACCEPTANCE + CLEANUP.
12
12
 
@@ -63,7 +63,7 @@ skills/sprint-flow/
63
63
  | 6/6 | CLOSE | USER ACCEPT + CLEANUP | Manual UAT → emergent issues → cleanup | HARD-GATE: UAT mandatory manual |
64
64
 
65
65
  ## CONVENTIONS
66
- - **ralph-loop is Phase 3/6 BUILD default**. Each REQ runs in a clean context, saving 40-67% tokens.
66
+ - **ralph-loop is Phase 3/6 BUILD default**. Each REQ runs in a clean context, so context does not accumulate across REQs.
67
67
  - **delphi-review HARD-GATE in Phase 2/6 DESIGN**: all three expert roles must execute with three distinct requested model IDs, then aggregate ≥90% consensus within 5 rounds. Unapproved or unverifiable → BLOCK coding.
68
68
  - **`learn` is called twice**: once per REQ in Phase 3/6 (ralph-loop internal) and once in Phase 4/6 VERIFY (Sprint-level retro).
69
69
  - **Phase isolation**: each phase has explicit entry/exit criteria documented in its `references/phase-*.md` file.
@@ -260,12 +260,30 @@ function testUniqueValuePropositionExists() {
260
260
  console.log(' ✓ Unique Value Proposition section exists');
261
261
  }
262
262
 
263
- function testUvpMentionsTokenSavings() {
263
+ function testUvpMentionsContextIsolation() {
264
264
  const section = contentSplit('Unique Value Proposition');
265
- if (!section.includes('40') || !section.includes('67') || !section.includes('token')) {
266
- throw new Error('Unique Value Proposition must mention 40-67% token savings');
267
- }
268
- console.log(' ✓ UVP mentions 40-67% token savings');
265
+ // Guards the MECHANISM, not a number. This assertion used to require the
266
+ // literal '40' and '67' -- a figure with no measurement behind it anywhere in
267
+ // the repo, copied between docs and pinned here so it could never be corrected.
268
+ // What actually distinguishes ralph-loop is that a REQ starts from a clean
269
+ // context instead of inheriting one: that is checkable and does not rot.
270
+ const mentionsIsolation =
271
+ /clean context|context (?:does not|doesn't) accumulate|no cross-REQ context accumulation|Context Growth/i.test(
272
+ section
273
+ );
274
+ if (!mentionsIsolation) {
275
+ throw new Error(
276
+ 'Unique Value Proposition must explain the per-REQ clean-context mechanism'
277
+ );
278
+ }
279
+ // And it must not resurrect an unsourced percentage as if it were measured.
280
+ const unsourcedPercentage = /\b\d{1,3}\s*[-–]\s*\d{1,3}%\s*(?:token|Token)/.test(section);
281
+ if (unsourcedPercentage) {
282
+ throw new Error(
283
+ 'UVP states a token-savings percentage range; no measurement backs it, so do not reinstate one without data'
284
+ );
285
+ }
286
+ console.log(' ✓ UVP explains per-REQ clean context without an unsourced figure');
269
287
  }
270
288
 
271
289
  function testUvpMentionsHardGate() {
@@ -353,7 +371,7 @@ function runTests(opts = {}) {
353
371
  { name: 'force-levels.md exists with three levels', fn: testForceLevelsDocumentExists },
354
372
  { name: 'force-levels.md requires Delphi review', fn: testForceLevelsRequiresDelphi },
355
373
  { name: 'Unique Value Proposition exists', fn: testUniqueValuePropositionExists },
356
- { name: 'UVP mentions 40-67% token savings', fn: testUvpMentionsTokenSavings },
374
+ { name: 'UVP explains per-REQ clean context (no unsourced figure)', fn: testUvpMentionsContextIsolation },
357
375
  { name: 'UVP mentions HARD-GATE', fn: testUvpMentionsHardGate },
358
376
  { name: 'UVP mentions emergent requirements', fn: testUvpMentionsEmergentRequirements },
359
377
  { name: 'Timing & Stability section exists', fn: testTimingSectionExists },
@@ -436,7 +454,7 @@ describe('sprint-flow SKILL.md', () => {
436
454
  { name: 'force-levels.md exists with three levels', fn: testForceLevelsDocumentExists },
437
455
  { name: 'force-levels.md requires Delphi review', fn: testForceLevelsRequiresDelphi },
438
456
  { name: 'Unique Value Proposition exists', fn: testUniqueValuePropositionExists },
439
- { name: 'UVP mentions 40-67% token savings', fn: testUvpMentionsTokenSavings },
457
+ { name: 'UVP explains per-REQ clean context (no unsourced figure)', fn: testUvpMentionsContextIsolation },
440
458
  { name: 'UVP mentions HARD-GATE', fn: testUvpMentionsHardGate },
441
459
  { name: 'UVP mentions emergent requirements', fn: testUvpMentionsEmergentRequirements },
442
460
  { name: 'Timing & Stability section exists', fn: testTimingSectionExists },
@@ -27,14 +27,14 @@ Sprint Flow is NOT just a sequential launcher of existing skills. Here's what ma
27
27
  |-----------|-----------------|-------------|
28
28
  | **Context Continuity** | Each skill starts fresh; lost design decisions between phases | Phase summaries + sprint-state.json maintain full traceability across 6 phases |
29
29
  | **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) |
30
- | **Token Efficiency** | Linear context accumulation across phases — ~150K+ tokens | Ralph-loop default: 40-67% token savings via clean REQ-level contexts |
30
+ | **Context Growth** | Linear context accumulation across phases — one growing shared context | Ralph-loop default: each REQ starts from a clean context instead of inheriting everything before it |
31
31
  | **Emergent Requirements** | Discovered late, silently ignored or merged | Phase 6 CLOSE explicitly captures emergent issues via template; triggers Sprint 2 for critical issues |
32
32
  | **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 |
33
33
  | **Progress Tracking** | Ad-hoc, memory-based | `.sprint-state/` persistence with phase history, timing, and metrics — `--status` renders progress dashboard |
34
34
 
35
35
  ### Key Differentiators
36
36
 
37
- 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.
37
+ 1. **No Cross-REQ Context Accumulation via Ralph Loop**: Phase 3 BUILD default (`ralph-loop`) processes one REQ at a time with a clean context, instead of carrying every earlier REQ in one growing context as parallel mode does. The benefit is qualitative — earlier REQs stop competing for room with the current one — and no measured token figure is claimed here.
38
38
 
39
39
  2. **HARD-GATE Discipline**: Design must pass Delphi review with all three expert roles executed successfully, three distinct requested model IDs verified, and ≥90% aggregate consensus within five rounds before Phase 3 BUILD can start. This is enforced both in SKILL.md instructions and via the Claude Code plugin's PreToolUse hook.
40
40
 
@@ -190,7 +190,7 @@ Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
190
190
  2. **DELPHI-GATE**: 验证 `.sprint-state/delphi-reviewed.json` 存在且 `verdict = "APPROVED"` → 否则 BLOCK
191
191
  3. **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`。
192
192
  4. **输入**: `slices-manifest.json`(Phase 2/6 生成),按 `execution_order` 逐个执行
193
- 5. **模式**: 默认 `ralph-loop`(逐 REQ 迭代,token 节约 40-67%),可选 `--mode parallel`
193
+ 5. **模式**: 默认 `ralph-loop`(逐 REQ 迭代,每个 REQ 独立干净上下文,不与之前的 REQ 累积),可选 `--mode parallel`
194
194
  6. **Skill 步骤**: BUILD-ENTRY-CONTRACT → hooks-install → TDD-GATE → TDD (RED/GREEN/REFACTOR) → blind-review (read-only subagent, tools: [Read, Grep, Glob]) → verification-before-completion → 成本监控 → learnings.md 写入
195
195
  7. **Mock Minimization**: integration-first, mock 仅限 external services, 密度 > 30% 需 `@mock-justified`
196
196
 
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/opencode-plugin",
3
- "version": "0.38.9",
3
+ "version": "0.38.10",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "XP-Gate quality gates + AI workflow skills for OpenCode",
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -7,7 +7,7 @@ maturity: stable
7
7
 
8
8
  # Ralph Loop — Default REQ-Level Iterative Build
9
9
 
10
- Core principles: **isolated context per REQ**, **TDD-first**, **full regression every iteration**, **token efficiency** (40-67% savings vs parallel).
10
+ Core principles: **isolated context per REQ**, **TDD-first**, **full regression every iteration**, **no cross-REQ context accumulation** (each REQ starts clean instead of inheriting an ever-growing shared context).
11
11
 
12
12
  ## Triggers
13
13
 
@@ -5,7 +5,7 @@
5
5
  | # | 原则 | 说明 |
6
6
  |---|------|------|
7
7
  | 1 | 逐 REQ 迭代 | 一次处理一个 REQ/切片,干净上下文,避免上下文线性膨胀 |
8
- | 2 | Token 节约 | 比旧并行模式节约 40-67% token |
8
+ | 2 | 上下文不累积 | 比旧的并行模式少一层**线性累积**:并行模式下所有 REQ 共享同一条不断变长的上下文,逐 REQ 模式每个 REQ 从干净上下文开始 |
9
9
  | 3 | 全量回归 | 每个 REQ 完成后跑全量测试 |
10
10
  | 4 | 进度持久化 | progress.log 持久化 learnings/permanent/contextual |
11
11
  | 5 | 可中断续传 | 中断后可从最后完成 REQ 继续 |
@@ -3,10 +3,10 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.9.0
6
+ **Version:** 0.38.10.0
7
7
 
8
8
  ## OVERVIEW
9
- **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
9
+ **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
10
10
 
11
11
  > **v2.0 Compact Redesign (Issue #290)**: Merged from 11 phases to 6. PREP = old ISOLATE + AUTO-ESTIMATE. DESIGN = old THINK + PLAN. BUILD = old BUILD. VERIFY = old REVIEW + FEEDBACK. SHIP = old SHIP + LAND. CLOSE = old USER ACCEPTANCE + CLEANUP.
12
12
 
@@ -63,7 +63,7 @@ skills/sprint-flow/
63
63
  | 6/6 | CLOSE | USER ACCEPT + CLEANUP | Manual UAT → emergent issues → cleanup | HARD-GATE: UAT mandatory manual |
64
64
 
65
65
  ## CONVENTIONS
66
- - **ralph-loop is Phase 3/6 BUILD default**. Each REQ runs in a clean context, saving 40-67% tokens.
66
+ - **ralph-loop is Phase 3/6 BUILD default**. Each REQ runs in a clean context, so context does not accumulate across REQs.
67
67
  - **delphi-review HARD-GATE in Phase 2/6 DESIGN**: all three expert roles must execute with three distinct requested model IDs, then aggregate ≥90% consensus within 5 rounds. Unapproved or unverifiable → BLOCK coding.
68
68
  - **`learn` is called twice**: once per REQ in Phase 3/6 (ralph-loop internal) and once in Phase 4/6 VERIFY (Sprint-level retro).
69
69
  - **Phase isolation**: each phase has explicit entry/exit criteria documented in its `references/phase-*.md` file.
@@ -260,12 +260,30 @@ function testUniqueValuePropositionExists() {
260
260
  console.log(' ✓ Unique Value Proposition section exists');
261
261
  }
262
262
 
263
- function testUvpMentionsTokenSavings() {
263
+ function testUvpMentionsContextIsolation() {
264
264
  const section = contentSplit('Unique Value Proposition');
265
- if (!section.includes('40') || !section.includes('67') || !section.includes('token')) {
266
- throw new Error('Unique Value Proposition must mention 40-67% token savings');
267
- }
268
- console.log(' ✓ UVP mentions 40-67% token savings');
265
+ // Guards the MECHANISM, not a number. This assertion used to require the
266
+ // literal '40' and '67' -- a figure with no measurement behind it anywhere in
267
+ // the repo, copied between docs and pinned here so it could never be corrected.
268
+ // What actually distinguishes ralph-loop is that a REQ starts from a clean
269
+ // context instead of inheriting one: that is checkable and does not rot.
270
+ const mentionsIsolation =
271
+ /clean context|context (?:does not|doesn't) accumulate|no cross-REQ context accumulation|Context Growth/i.test(
272
+ section
273
+ );
274
+ if (!mentionsIsolation) {
275
+ throw new Error(
276
+ 'Unique Value Proposition must explain the per-REQ clean-context mechanism'
277
+ );
278
+ }
279
+ // And it must not resurrect an unsourced percentage as if it were measured.
280
+ const unsourcedPercentage = /\b\d{1,3}\s*[-–]\s*\d{1,3}%\s*(?:token|Token)/.test(section);
281
+ if (unsourcedPercentage) {
282
+ throw new Error(
283
+ 'UVP states a token-savings percentage range; no measurement backs it, so do not reinstate one without data'
284
+ );
285
+ }
286
+ console.log(' ✓ UVP explains per-REQ clean context without an unsourced figure');
269
287
  }
270
288
 
271
289
  function testUvpMentionsHardGate() {
@@ -353,7 +371,7 @@ function runTests(opts = {}) {
353
371
  { name: 'force-levels.md exists with three levels', fn: testForceLevelsDocumentExists },
354
372
  { name: 'force-levels.md requires Delphi review', fn: testForceLevelsRequiresDelphi },
355
373
  { name: 'Unique Value Proposition exists', fn: testUniqueValuePropositionExists },
356
- { name: 'UVP mentions 40-67% token savings', fn: testUvpMentionsTokenSavings },
374
+ { name: 'UVP explains per-REQ clean context (no unsourced figure)', fn: testUvpMentionsContextIsolation },
357
375
  { name: 'UVP mentions HARD-GATE', fn: testUvpMentionsHardGate },
358
376
  { name: 'UVP mentions emergent requirements', fn: testUvpMentionsEmergentRequirements },
359
377
  { name: 'Timing & Stability section exists', fn: testTimingSectionExists },
@@ -436,7 +454,7 @@ describe('sprint-flow SKILL.md', () => {
436
454
  { name: 'force-levels.md exists with three levels', fn: testForceLevelsDocumentExists },
437
455
  { name: 'force-levels.md requires Delphi review', fn: testForceLevelsRequiresDelphi },
438
456
  { name: 'Unique Value Proposition exists', fn: testUniqueValuePropositionExists },
439
- { name: 'UVP mentions 40-67% token savings', fn: testUvpMentionsTokenSavings },
457
+ { name: 'UVP explains per-REQ clean context (no unsourced figure)', fn: testUvpMentionsContextIsolation },
440
458
  { name: 'UVP mentions HARD-GATE', fn: testUvpMentionsHardGate },
441
459
  { name: 'UVP mentions emergent requirements', fn: testUvpMentionsEmergentRequirements },
442
460
  { name: 'Timing & Stability section exists', fn: testTimingSectionExists },