peaks-loop 4.0.50 → 4.0.52

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 (127) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README-en.md +1 -1
  3. package/README.md +1 -1
  4. package/dist/cli/commands/baseline-commands.js +11 -1
  5. package/dist/cli/commands/codegraph-command-runtime.d.ts +28 -0
  6. package/dist/cli/commands/codegraph-command-runtime.js +72 -0
  7. package/dist/cli/commands/codegraph-commands.d.ts +2 -11
  8. package/dist/cli/commands/codegraph-commands.js +173 -228
  9. package/dist/cli/commands/codegraph-status-command.d.ts +22 -0
  10. package/dist/cli/commands/codegraph-status-command.js +299 -0
  11. package/dist/cli/commands/core/memory-command.js +6 -2
  12. package/dist/cli/commands/job-commands.js +121 -30
  13. package/dist/cli/commands/project-commands.js +13 -3
  14. package/dist/cli/commands/request-commands.js +19 -8
  15. package/dist/cli/commands/share-commands.js +85 -18
  16. package/dist/cli/commands/slice-commands.js +2 -2
  17. package/dist/services/artifacts/artifact-prerequisites.js +23 -1
  18. package/dist/services/codegraph/codegraph-autorefresh.d.ts +16 -0
  19. package/dist/services/codegraph/codegraph-autorefresh.js +51 -5
  20. package/dist/services/codegraph/codegraph-config-repair-writer.d.ts +88 -0
  21. package/dist/services/codegraph/codegraph-config-repair-writer.js +322 -0
  22. package/dist/services/codegraph/codegraph-exclude-integrity.d.ts +20 -2
  23. package/dist/services/codegraph/codegraph-exclude-integrity.js +24 -3
  24. package/dist/services/codegraph/codegraph-exclude-reconciler.d.ts +23 -2
  25. package/dist/services/codegraph/codegraph-exclude-reconciler.js +123 -12
  26. package/dist/services/codegraph/codegraph-exclude-repair.d.ts +109 -55
  27. package/dist/services/codegraph/codegraph-exclude-repair.js +249 -195
  28. package/dist/services/codegraph/codegraph-include-reconciler.d.ts +10 -0
  29. package/dist/services/codegraph/codegraph-include-reconciler.js +160 -0
  30. package/dist/services/codegraph/codegraph-index-integrity.d.ts +268 -0
  31. package/dist/services/codegraph/codegraph-index-integrity.js +471 -0
  32. package/dist/services/codegraph/codegraph-service.d.ts +54 -0
  33. package/dist/services/codegraph/codegraph-service.js +84 -1
  34. package/dist/services/dispatch/sub-agent-dispatcher.d.ts +11 -30
  35. package/dist/services/dispatch/sub-agent-dispatcher.js +5 -48
  36. package/dist/services/doctor/doctor-service/checks/codegraph-exclude-integrity.js +19 -4
  37. package/dist/services/doctor/doctor-service/checks/codegraph-index-integrity.d.ts +54 -0
  38. package/dist/services/doctor/doctor-service/checks/codegraph-index-integrity.js +151 -0
  39. package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.js +10 -10
  40. package/dist/services/doctor/doctor-service/plugin-registry.js +2 -0
  41. package/dist/services/doctor/doctor-service/types.d.ts +25 -0
  42. package/dist/services/ide/adapters/claude-code-adapter.js +0 -1
  43. package/dist/services/ide/adapters/codex-adapter.js +1 -2
  44. package/dist/services/ide/adapters/cursor-adapter.js +1 -2
  45. package/dist/services/ide/adapters/hermes-adapter.js +1 -2
  46. package/dist/services/ide/adapters/openclaw-adapter.js +1 -2
  47. package/dist/services/ide/adapters/qoder-adapter.js +1 -2
  48. package/dist/services/ide/adapters/tongyi-lingma-adapter.js +1 -2
  49. package/dist/services/ide/adapters/trae-adapter.js +1 -2
  50. package/dist/services/ide/adapters/zcode-adapter.js +0 -1
  51. package/dist/services/ide/ide-types.d.ts +0 -2
  52. package/dist/services/memory/project-memory-service/index/kind-dispatch.js +48 -13
  53. package/dist/services/memory/project-memory-service/index.d.ts +5 -3
  54. package/dist/services/memory/project-memory-service/index.js +2 -2
  55. package/dist/services/memory/project-memory-service/parsers/frontmatter.d.ts +15 -1
  56. package/dist/services/memory/project-memory-service/parsers/frontmatter.js +34 -6
  57. package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +27 -1
  58. package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +92 -7
  59. package/dist/services/memory/project-memory-service/types.d.ts +86 -0
  60. package/dist/services/slice/slice-check-types.d.ts +1 -1
  61. package/dist/services/workspace/runtime-layout.d.ts +91 -0
  62. package/dist/services/workspace/runtime-layout.js +148 -0
  63. package/dist/services/workspace/workspace-claude-settings-materializer.js +14 -0
  64. package/package.json +6 -6
  65. package/scripts/clean-dist.mjs +15 -3
  66. package/scripts/sync-version.mjs +26 -4
  67. package/skills/bee/peaks-perf-audit/SKILL.md +2 -2
  68. package/skills/bee/peaks-perf-audit/references/audit-protocol.md +1 -1
  69. package/skills/bee/peaks-prd/SKILL.md +4 -4
  70. package/skills/bee/peaks-prd/references/prd-for-multi-pass.md +1 -1
  71. package/skills/bee/peaks-prd/references/workflow.md +1 -1
  72. package/skills/bee/peaks-qa/SKILL.md +6 -6
  73. package/skills/bee/peaks-qa/references/external-capability-guidance.md +1 -1
  74. package/skills/bee/peaks-qa/references/qa-fanout-contract.md +1 -1
  75. package/skills/bee/peaks-qa/references/qa-skill-presence.md +1 -1
  76. package/skills/bee/peaks-qa/references/reading-handoff-frontmatter.md +2 -2
  77. package/skills/bee/peaks-rd/SKILL.md +2 -2
  78. package/skills/bee/peaks-rd/references/code-reviewer-4dim-hint.md +1 -1
  79. package/skills/bee/peaks-rd/references/external-references.md +1 -1
  80. package/skills/bee/peaks-rd/references/mandatory-perf-baseline.md +1 -1
  81. package/skills/bee/peaks-rd/references/ocr-multilang-1.8.md +2 -2
  82. package/skills/bee/peaks-rd/references/parallel-review-fanout.md +2 -2
  83. package/skills/bee/peaks-rd/references/rd-fanout-contracts.md +11 -8
  84. package/skills/bee/peaks-rd/references/rd-runbook.md +1 -1
  85. package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +7 -7
  86. package/skills/bee/peaks-rd/references/rd-transition-gates.md +1 -1
  87. package/skills/bee/peaks-rd/references/reading-v2-slice-results.md +1 -1
  88. package/skills/bee/peaks-rd/references/skill-presence-and-title.md +1 -1
  89. package/skills/bee/peaks-rd/references/v2-12-fanout-collapse.md +7 -5
  90. package/skills/bee/peaks-rd/references/writing-handoff-frontmatter.md +3 -3
  91. package/skills/bee/peaks-reviewer/SKILL.md +1 -1
  92. package/skills/bee/peaks-sc/SKILL.md +1 -1
  93. package/skills/bee/peaks-security-audit/SKILL.md +3 -3
  94. package/skills/bee/peaks-security-audit/references/audit-protocol.md +1 -1
  95. package/skills/bee/peaks-txt/SKILL.md +3 -3
  96. package/skills/bee/peaks-txt/references/context-capsule.md +1 -1
  97. package/skills/bee/peaks-ui/SKILL.md +1 -1
  98. package/skills/peaks-audit/SKILL.md +1 -1
  99. package/skills/peaks-code/SKILL.md +9 -9
  100. package/skills/peaks-code/references/context-governance.md +1 -1
  101. package/skills/peaks-code/references/dag-orchestrator.md +3 -4
  102. package/skills/peaks-code/references/external-references.md +1 -1
  103. package/skills/peaks-code/references/external-skill-invocation.md +2 -2
  104. package/skills/peaks-code/references/fanout-mandatory.md +3 -3
  105. package/skills/peaks-code/references/frontend-only-mode.md +2 -2
  106. package/skills/peaks-code/references/gstack-integration.md +1 -1
  107. package/skills/peaks-code/references/micro-cycle.md +1 -1
  108. package/skills/peaks-code/references/periodic-checkpoint.md +2 -2
  109. package/skills/peaks-code/references/project-memory-loading.md +19 -1
  110. package/skills/peaks-code/references/project-scan-checklist.md +1 -1
  111. package/skills/peaks-code/references/resume-detection.md +1 -1
  112. package/skills/peaks-code/references/runbook.md +3 -3
  113. package/skills/peaks-code/references/session-overload-signal-index.md +2 -2
  114. package/skills/peaks-code/references/startup-sequence.md +16 -16
  115. package/skills/peaks-code/references/step-11-memory-sediment.md +3 -3
  116. package/skills/peaks-code/references/sub-agent-dispatch.md +7 -6
  117. package/skills/peaks-code/references/swarm-dispatch-contract.md +1 -1
  118. package/skills/peaks-code/references/workflow-gates-and-types.md +3 -3
  119. package/skills/peaks-code/references/worktree-governance.md +1 -1
  120. package/skills/peaks-final-review/SKILL.md +3 -3
  121. package/skills/peaks-ide/references/audit-log-helper.md +5 -4
  122. package/skills/peaks-resume/SKILL.md +1 -1
  123. package/skills/peaks-slice-decompose/SKILL.md +4 -4
  124. package/skills/peaks-slice-decompose/references/cross-pass-edge-interpretation.md +1 -1
  125. package/skills/peaks-slice-decompose/references/granularity-decision.md +1 -1
  126. package/skills/peaks-slice-decompose/references/v2-schema.md +2 -2
  127. package/skills/peaks-solo/SKILL.md +1 -2
@@ -0,0 +1,148 @@
1
+ /**
2
+ * The canonical top-level layout of `.peaks/_runtime/`.
3
+ *
4
+ * WHY THIS MODULE EXISTS
5
+ *
6
+ * `.peaks/_runtime/` holds two populations whose names look identical:
7
+ *
8
+ * 1. SESSION DIRS — `<YYYY-MM-DD>-session-<hex>`, one per peaks session.
9
+ * Anything else that *looks* like a session id but is not one is a
10
+ * defect (a test that passed `--session-id x`, a typo, an old
11
+ * `unknown-sid` bucket).
12
+ * 2. SYSTEM ENTRIES — dirs and files the code itself writes there on
13
+ * purpose: `callers/`, `change/`, `benchmarks/`, `session.json`, …
14
+ *
15
+ * The doctor check `L3:l3-orphan-sessions` must flag (1) and tolerate (2),
16
+ * and the only thing that can tell them apart is a list of the system
17
+ * entries. That list used to live inside the check as a hand-maintained
18
+ * `new Set(['change'])` — and it had already drifted: `callers/` is a
19
+ * designed location (`caller-binding-service.ts` stores
20
+ * `.peaks/_runtime/callers/<callerId>.json`), was never added, and made
21
+ * `peaks doctor` exit non-zero on a clean workspace *permanently*
22
+ * (`4 orphan session(s) …: callers, cli, unknown-sid, x`). The check's own
23
+ * doc comment asked future maintainers to keep a *second* list — the prose
24
+ * `RUNTIME_SYSTEM_SUBDIRS_DOC` — in sync by hand. Prose cannot enforce
25
+ * itself, so the two lists diverged exactly as you would expect.
26
+ *
27
+ * WHY DERIVATION WAS REJECTED AND A REGISTRY IS THE SOURCE OF TRUTH
28
+ *
29
+ * A derivation would have to classify a bare name as "system" or "bogus"
30
+ * without a list. There is no signal to derive from: `callers` (system) and
31
+ * `x` (bogus) are the same shape — a lowercase word. The session-id regex
32
+ * separates them from `2026-09-16-session-5bcf09`, not from each other. So
33
+ * the alternatives were (a) keep a literal in the check, or (b) put the
34
+ * literal *and its consumers* in one place. This module is (b): the check
35
+ * imports the set instead of re-declaring it, and
36
+ * `tests/unit/workspace/runtime-layout-drift-guard.test.ts` parses `src/**`
37
+ * and fails when the code writes a `_runtime` child that is not registered
38
+ * here. The registry can no longer drift silently — it can only drift loudly,
39
+ * as a red test.
40
+ *
41
+ * The guard parses ASTs rather than grepping, because this repository
42
+ * documents the layout in prose constantly: `migrate-1-4-1-service.ts` has an
43
+ * array whose two adjacent string literals are `'_runtime', '_sub_agents'`
44
+ * (they are two *separate* SKIP entries), and `evidence-generator.ts`
45
+ * describes a past escape as `` `.peaks/_runtime/pwned.md` `` inside a
46
+ * comment. Both are false positives for a text scan and invisible to an AST
47
+ * walk. See `tests/unit/runtime/no-runtime-input-guard.test.ts` for the same
48
+ * decision made the same way.
49
+ */
50
+ /**
51
+ * Reserved top-level dir for session-less command output.
52
+ *
53
+ * `peaks baseline audit` runs with no bound session (it is the only scorer
54
+ * that can run inside the secretless OIDC publish gate), so it has no
55
+ * `<sid>` to write under. It used to pass the literal `'cli'` as its
56
+ * sessionId, which made `.peaks/_runtime/cli/capability-audit/*.json` look
57
+ * exactly like a session dir that failed validation — `peaks doctor` has
58
+ * been red on this repository ever since. The name is underscore-prefixed to
59
+ * match the tree's existing convention for "machinery, not a session"
60
+ * (`_runtime`, `_sub_agents`) and to make it impossible to mistake for a
61
+ * session id.
62
+ */
63
+ export const RUNTIME_SESSIONLESS_SCOPE = '_audit';
64
+ /**
65
+ * Every legitimate top-level entry under `.peaks/_runtime/`.
66
+ *
67
+ * This is the list `L3:l3-orphan-sessions` tolerates. Adding an entry that
68
+ * nothing writes is a red test (the drift guard's reverse direction); writing
69
+ * an entry that is not here is also a red test. Both directions are pinned in
70
+ * `tests/unit/workspace/runtime-layout-drift-guard.test.ts`.
71
+ */
72
+ export const RUNTIME_SYSTEM_ENTRIES = [
73
+ {
74
+ name: 'change',
75
+ kind: 'dir',
76
+ purpose: 'change-id routing root for reviewable artifacts (workflow/artifact-paths.ts, prd/prd-blocks-checker.ts, workspace/reconcile-service.ts)'
77
+ },
78
+ {
79
+ name: 'callers',
80
+ kind: 'dir',
81
+ purpose: 'per-caller binding files `.peaks/_runtime/callers/<callerId>.json` (session/caller-binding-service.ts)'
82
+ },
83
+ {
84
+ name: 'benchmarks',
85
+ kind: 'dir',
86
+ purpose: '`peaks slice benchmark` artifacts `<rid>.benchmark.json` (cli/commands/slice-commands.ts)'
87
+ },
88
+ {
89
+ name: 'prd',
90
+ kind: 'dir',
91
+ purpose: 'read-only PRD artifact root `.peaks/_runtime/prd/requests/<rid>.md` (prd/prd-blocks-checker.ts); the writer lives outside this repo, the check tolerates it'
92
+ },
93
+ {
94
+ name: 'playwright-userdata',
95
+ kind: 'dir',
96
+ purpose: 'per-terminal browser profile dirs (cli/commands/playwright-commands.ts)'
97
+ },
98
+ {
99
+ name: 'playwright-sessions',
100
+ kind: 'dir',
101
+ purpose: 'playwright session records `<terminalId>.json` (cli/commands/playwright-commands.ts)'
102
+ },
103
+ {
104
+ name: 'test-cache',
105
+ kind: 'dir',
106
+ purpose: 'per-test fingerprint cache (cli/commands/test-commands.ts)'
107
+ },
108
+ {
109
+ name: 'sop-state',
110
+ kind: 'dir',
111
+ purpose: 'SOP state migrated from `.peaks/sop-state/` (cli/commands/workspace/reconcile-command.ts)'
112
+ },
113
+ {
114
+ name: RUNTIME_SESSIONLESS_SCOPE,
115
+ kind: 'dir',
116
+ purpose: 'capability-audit output for session-less runs `.peaks/_runtime/_audit/capability-audit/*.json` (cli/commands/baseline-commands.ts)'
117
+ },
118
+ {
119
+ name: 'session.json',
120
+ kind: 'file',
121
+ purpose: 'project-global session binding (session/session-binding-service.ts)'
122
+ },
123
+ {
124
+ name: 'active-skill.json',
125
+ kind: 'file',
126
+ purpose: 'active-skill presence marker (skills/skill-presence-service.ts)'
127
+ },
128
+ {
129
+ name: 'generated-artifacts.json',
130
+ kind: 'file',
131
+ purpose: 'stamp describing which generated artifacts exist on this machine, so a refresh can tell "stale" from "never generated" (services/workspace/generated-artifacts-stamp.ts)'
132
+ },
133
+ {
134
+ name: '.outer-session-cache.json',
135
+ kind: 'file',
136
+ purpose: 'outer (IDE) session cache for CLI sub-processes (cli/commands/outer-cache-commands.ts, session/session-binding-bridge.ts)'
137
+ },
138
+ {
139
+ name: '.rebuild-binding.lock',
140
+ kind: 'file',
141
+ purpose: 'binding-store rebuild lock (session/binding-store.ts)'
142
+ }
143
+ ];
144
+ /**
145
+ * The set `L3:l3-orphan-sessions` filters with. Derived from the registry
146
+ * above so the check and the census cannot disagree about the same name.
147
+ */
148
+ export const RUNTIME_SYSTEM_SUBDIRS = new Set(RUNTIME_SYSTEM_ENTRIES.filter((entry) => entry.kind === 'dir').map((entry) => entry.name));
@@ -163,6 +163,20 @@ const PEAKS_GITIGNORE_SNIPPET = [
163
163
  '# Both patterns below are PROJECT-ROOT-relative, so this snippet must land',
164
164
  '# in the root .gitignore — see `upsertPeaksGitignoreSnippet`.',
165
165
  '.peaks/.claude-settings-template.json',
166
+ '# Codegraph rollback copy (A3, 2026-09-17). Every `peaks codegraph init` /',
167
+ '# `repair-exclude` / `repair-index` / pre-dispatch preflight / post-slice',
168
+ '# auto-refresh copies `.codegraph/config.json` here before rewriting it, so',
169
+ '# this file is LOCAL CHURN: a committed one is silently replaced by the next',
170
+ '# repair. Upstream\'s own `.codegraph/.gitignore` does not cover it (it names',
171
+ '# *.db / *.db-wal / *.db-shm, cache/, *.log and .dirty only) and `.codegraph/`',
172
+ '# is NOT ignored wholesale downstream, so without this line a consumer project',
173
+ '# commits a file peaks-loop rewrites under it.',
174
+ '#',
175
+ '# ONLY the backup, never `config.json` itself: upstream deliberately keeps',
176
+ '# that config committable (it is a project\'s include/exclude policy, and',
177
+ '# committing it is how a team shares it), so ignoring it would hide a file',
178
+ '# people mean to commit. A rollback copy is the opposite kind of file.',
179
+ '.codegraph/config.json.bak',
166
180
  PEAKS_GITIGNORE_FOOTER,
167
181
  ''
168
182
  ].join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peaks-loop",
3
- "version": "4.0.50",
3
+ "version": "4.0.52",
4
4
  "description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
5
5
  "author": "SquabbyZ",
6
6
  "keywords": [
@@ -102,10 +102,10 @@
102
102
  "picomatch": "4.0.4",
103
103
  "yaml": "^2.9.0",
104
104
  "zod": "^4.4.3",
105
- "peaks-loop-mut": "0.1.48",
106
- "peaks-loop-internal-runtime": "0.0.35",
107
- "peaks-loop-shared-channel": "0.0.52",
108
- "peaks-loop-shared": "0.0.84"
105
+ "peaks-loop-internal-runtime": "0.0.37",
106
+ "peaks-loop-mut": "0.1.50",
107
+ "peaks-loop-shared": "0.0.86",
108
+ "peaks-loop-shared-channel": "0.0.54"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@changesets/cli": "2.31.1",
@@ -128,7 +128,7 @@
128
128
  "vitest": "^4.1.10"
129
129
  },
130
130
  "scripts": {
131
- "build": "node ./scripts/sync-version.mjs && node ./scripts/clean-dist.mjs && pnpm -r --filter \"./packages/*\" run build && tsc -p tsconfig.build.json && node ./scripts/copy-templates.mjs && node ./scripts/check-build-integrity.mjs",
131
+ "build": "node ./scripts/sync-version.mjs && node ./scripts/clean-dist.mjs && pnpm -r --filter \"./packages/*\" run build && tsc -p tsconfig.build.json && node ./scripts/copy-templates.mjs && node ./scripts/check-build-integrity.mjs && node ./scripts/write-dist-stamp.mjs",
132
132
  "prepublish": "node ./scripts/sync-version.mjs",
133
133
  "postinstall": "node ./scripts/install-skills.mjs",
134
134
  "predev": "node ./scripts/sync-version.mjs",
@@ -10,9 +10,21 @@ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
10
10
  // packages/*/dist. Rationale: tsc's incremental-build cache
11
11
  // compares files by mtime + size, and a stale dist that
12
12
  // survived from a previous build can cause tsc to skip the
13
- // emission of newly-added src/*.ts (Bug-04 lineage — see
14
- // tests/unit/scripts/sync-version-invalidation.test.ts for
15
- // the regression pin on version.ts specifically).
13
+ // emission of newly-added src/*.ts (Bug-04 lineage).
14
+ //
15
+ // E2 (rid 2026-09-17-cli-output-and-stale-refs) — the citation that
16
+ // stood here named a regression pin on version.ts that was deleted
17
+ // in `f17aa377` ("delete 559 legacy unit tests"), and, like the one
18
+ // in `sync-version.mjs`, it was written without backticks so the
19
+ // citation-integrity guard could not see it. Corrected: the pin on
20
+ // the version.ts OUTPUT now lives in the lockstep tests (see
21
+ // `sync-version.mjs` for both names and for what they read).
22
+ //
23
+ // Recorded, not hidden: this wipe itself has no direct pin — no
24
+ // test executes this script, so nothing asserts that a stale
25
+ // packages/*/dist is gone before tsc runs. The `dist-freshness.mjs`
26
+ // module reasons FROM this wipe (it is why a dist mtime can be read
27
+ // as the build time) but does not test it.
16
28
  //
17
29
  // The wider wipe is safe because:
18
30
  // - watch.mjs only watches src/, schemas/, skills/ — it
@@ -76,8 +76,30 @@ for (const ext of ['js', 'd.ts', 'd.ts.map']) {
76
76
  // regression-test pin for Bug-04; the load-bearing dist
77
77
  // invalidation moved up to `clean-dist.mjs`, which wipes every
78
78
  // packages/*/dist wholesale before any subpackage build runs.
79
- // This narrow unlink stays because it is unit-tested by
80
- // tests/unit/scripts/sync-version-invalidation.test.ts and
81
- // catching the Bug-04 lineage on its own is cheap insurance
82
- // against future pipeline reorderings.
79
+ // This narrow unlink stays because catching the Bug-04 lineage
80
+ // on its own is cheap insurance against future pipeline
81
+ // reorderings.
82
+ //
83
+ // E2 (rid 2026-09-17-cli-output-and-stale-refs) — the sentence
84
+ // that stood here named a unit test as covering this unlink. That
85
+ // test (file name only, deliberately not spelled as a path: it was
86
+ // deleted in `f17aa377`, "delete 559 legacy unit tests", and a
87
+ // path-shaped token would read as a live citation to the guard
88
+ // that now checks these comments) is `sync-version-invalidation.test.ts`
89
+ // — so the coverage this paragraph claimed has not existed since.
90
+ //
91
+ // What DOES cover this script today, verified rather than
92
+ // assumed: the version lockstep tests pin its two outputs to the
93
+ // root package.json#version — `CLI_VERSION` in
94
+ // packages/peaks-loop-shared/src/version.ts, and the
95
+ // `RUNTIME_VERSION` emit added in slice 2026-09-11 plus the built
96
+ // shared dist/version.js. Both read the artifacts, so they catch a
97
+ // silent no-op in either writer. They are indirect pins, and they
98
+ // are the reason a broken emit cannot ship.
99
+ //
100
+ // NOT COVERED, recorded rather than hidden: the unlink itself has
101
+ // no direct pin. No test executes this script, so nothing asserts
102
+ // that a stale packages/peaks-loop-shared/dist/version.js is
103
+ // actually removed. If you need the unlink pinned, that test has
104
+ // to be written — the one named here no longer exists.
83
105
 
@@ -184,8 +184,8 @@ required fixes deduped by `(file, line, hint)`).
184
184
  - Schema: `.peaks/project-scan/audit-output-schema.md`
185
185
  - Service: `src/services/audit-independent/perf-audit-service.ts`
186
186
  - CLI: `src/cli/commands/perf-audit-commands.ts`
187
- - Tests: `tests/unit/services/audit-independent/perf-audit-service.test.ts`
188
- - Companion: `skills/peaks-security-audit/SKILL.md` (symmetric structure)
187
+ - Tests: none — the unit suite for the service was deleted in `f17aa377`.
188
+ - Companion: `skills/bee/peaks-security-audit/SKILL.md` (symmetric structure)
189
189
 
190
190
  ## Karpathy alignment
191
191
 
@@ -170,4 +170,4 @@ section is the source of new sediment rows; the format is:
170
170
  - Service: `src/services/audit-independent/perf-audit-service.ts`
171
171
  - Template: `.peaks/project-scan/perf-template.md`
172
172
  - Schema: `.peaks/project-scan/audit-output-schema.md`
173
- - Companion: `skills/peaks-security-audit/references/audit-protocol.md`
173
+ - Companion: `skills/bee/peaks-security-audit/references/audit-protocol.md`
@@ -107,7 +107,7 @@ Read persistent project memory via CLI (durable, LLM-authored memories):
107
107
  peaks project memories --project <repo> --json
108
108
  ```
109
109
 
110
- This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <decision|convention|module|rule|reference|project>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
110
+ This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <project|decision|convention|rule|reference|feedback|module|lesson|bug|investigation|technical-pattern|project-rule|design|handoff|session-handoff|project-todo|publish-closure|project-closure|slice-closure|slice-pilot-findings|sediment>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
111
111
  Then display: `Peaks-Loop Skill: peaks-prd | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-prd --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
112
112
 
113
113
  ## Responsibilities
@@ -147,7 +147,7 @@ PRD 模板在原 7 段基础上,增加 4 个**质量前置必填块**(user 写,A
147
147
  3. **UI 装配意图**(页面模式 / 关键交互 / 信息密度;**不画 ASCII 视觉**,视觉由选定的开源组件库自动决定)
148
148
  4. **上游基线**(fork 场景必填:当前 fork 基于哪个 tag / 偏离度 / 业务 patch 集)
149
149
 
150
- **反伪选择原则:** user 不参与技术决策(库/框架/语言/性能/安全/架构),只写业务/产品意图。AI 据业务场景块选库选架构。详见 `.peaks/memory/peaks-loop-prd-template-design.md`。
150
+ **反伪选择原则:** user 不参与技术决策(库/框架/语言/性能/安全/架构),只写业务/产品意图。AI 据业务场景块选库选架构。详见 `.peaks/memory/peaks-cli-prd-template-design.md`。
151
151
 
152
152
  ## Project-scan gate (v2.11.0 D3 — read before brainstorm)
153
153
 
@@ -264,7 +264,7 @@ Use gstack as a concrete workflow reference for the product-facing parts of `Thi
264
264
 
265
265
  ## Authenticated product document workflow
266
266
 
267
- When the source PRD is an authenticated web document such as Feishu/Lark, use the Playwright MCP headed-browser surface rather than unauthenticated fetch tools. Chrome DevTools MCP is a secondary surface that only connects to an already-running Chrome (`--remote-debugging-port=9222`); it does not launch a browser on its own. The canonical browser workflow lives in `peaks-code/references/browser-workflow.md`; the rules below are the PRD-specific application.
267
+ When the source PRD is an authenticated web document such as Feishu/Lark, use the Playwright MCP headed-browser surface rather than unauthenticated fetch tools. Chrome DevTools MCP is a secondary surface that only connects to an already-running Chrome (`--remote-debugging-port=9222`); it does not launch a browser on its own. The canonical browser workflow lives in `../../peaks-code/references/browser-workflow.md`; the rules below are the PRD-specific application.
268
268
 
269
269
  1. Confirm Playwright MCP is installed: check the LLM tool list for any Playwright MCP entry in the LLM tool list. If absent, the user installs via `claude mcp add playwright -- npx @playwright/mcp@latest` (Claude Code) or the IDE-native install command. Do not hand-edit `.claude/settings.json`.
270
270
  2. Before navigation, verify the user-provided document URL uses `https:` and belongs to an approved Feishu/Lark tenant domain such as `*.feishu.cn`, `*.larksuite.com`, `*.larksuite.com.cn`, or a project-configured tenant. Reject `file:`, `data:`, `javascript:`, `http:`, localhost, loopback, link-local, private IP, and raw IP hosts unless the user explicitly approves a controlled local test target.
@@ -294,7 +294,7 @@ Summarize business context only when it changes implementation priority, scope,
294
294
 
295
295
  When the user explicitly says the target is a frontend project, transform the product document into frontend implementation inputs before RD starts:
296
296
 
297
- > **v2.15.0+ 校准:** UI 视觉 = 开源组件库装配(shadcn / Radix / antd / mui),不是原创设计。prd 不画 ASCII 视觉,只描述"页面模式 + 关键交互 + 信息密度"。AI 据此选组件库 + 装配。详见 `.peaks/memory/peaks-loop-prd-template-design.md`。
297
+ > **v2.15.0+ 校准:** UI 视觉 = 开源组件库装配(shadcn / Radix / antd / mui),不是原创设计。prd 不画 ASCII 视觉,只描述"页面模式 + 关键交互 + 信息密度"。AI 据此选组件库 + 装配。详见 `.peaks/memory/peaks-cli-prd-template-design.md`。
298
298
 
299
299
  1. identify target pages, routes, components, forms, tables, modals, empty/loading/error states, permissions, data dependencies, edge cases, and affected user flows;
300
300
  2. separate frontend-only work from API/backend联调 assumptions;
@@ -46,4 +46,4 @@ Single-service feature → single-pass PRD. Do not force a Pass 2 layer if the w
46
46
  - Pass 2 ACs each name a file path under one of the Pass 1 services.
47
47
  - A `peaks slice audit-prd --rid <rid>` (when present) returns zero cross-cutting flags.
48
48
 
49
- See `../peaks-slice-decompose/SKILL.md` for the envelope contract and `../peaks-rd/references/reading-v2-slice-results.md` for the RD-side read.
49
+ See `../../../peaks-slice-decompose/SKILL.md` for the envelope contract and `../../peaks-rd/references/reading-v2-slice-results.md` for the RD-side read.
@@ -15,7 +15,7 @@ When the product source is an authenticated Feishu/Lark/wiki document:
15
15
  7. Do not persist login URLs, redirect URLs, cookies, request or response headers, session tokens, tokens, storage state, QR payloads, raw browser state, raw network logs, browser traces, or screenshots/logs containing PII or SSO/MFA material into artifacts; redact sensitive evidence before writing `.peaks` outputs.
16
16
  8. If access remains blocked, record only a redacted document identifier, a sanitized state category such as `login-required`, `mfa-required`, or `access-denied`, and the exact user action needed.
17
17
 
18
- Canonical browser workflow: `../../peaks-code/references/browser-workflow.md`.
18
+ Canonical browser workflow: `../../../peaks-code/references/browser-workflow.md`.
19
19
 
20
20
  ## Implementation-oriented analysis
21
21
 
@@ -47,7 +47,7 @@ denied again after a long pause. That is the gate resetting, not you regressing.
47
47
 
48
48
  > **Read once at the top of this file; the rest of the skill is written against it.**
49
49
 
50
- The `.peaks/` workspace is partitioned by a **single scope axis** (session-id, at `.peaks/_runtime/<sessionId>/...`) with a nested **sub-agent axis** under `.peaks/_sub_agents/<sessionId>/...`. Use `<sessionId>` placeholders (NEVER bare `<sid>`). The peaks-loop change-id axis was removed in slice `2026-06-29-change-id-root-removal`; reviewable artifacts now live under `.peaks/_runtime/<sessionId>/<role>/...` only. OpenSpec's independent `openspec/changes/<change-id>/` vocabulary (L4) is preserved untouched. CLI mapping: session-id → `peaks session *`; sub-agent → `peaks sub-agent *`. Regression test `tests/unit/skills/skills-skill-md-naming.test.ts` enforces (a) zero bare `<sid>`, (b) every `.peaks/_runtime/<X>/` has an axis label, (c) this callout is present.
50
+ The `.peaks/` workspace is partitioned by a **single scope axis** (session-id, at `.peaks/_runtime/<sessionId>/...`) with a nested **sub-agent axis** under `.peaks/_sub_agents/<sessionId>/...`. Use `<sessionId>` placeholders (NEVER bare `<sid>`). The peaks-loop change-id axis was removed in slice `2026-06-29-change-id-root-removal`; reviewable artifacts now live under `.peaks/_runtime/<sessionId>/<role>/...` only. OpenSpec's independent `openspec/changes/<change-id>/` vocabulary (L4) is preserved untouched. CLI mapping: session-id → `peaks session *`; sub-agent → `peaks sub-agent *`. Normative by documentation only — the guard that once asserted (a) zero bare `<sid>`, (b) an axis label on every runtime path, and (c) this callout's presence was deleted in `457b9a87`. Comply by convention.
51
51
 
52
52
  ## peaks-context auto-build (v3.0)
53
53
 
@@ -92,7 +92,7 @@ The canonical scope dir for this request is provided as `envelope.data.scopeDir`
92
92
 
93
93
  When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` (then the LLM executes the returned toolCall) from `peaks-code`, the following sections of THIS skill are **suspended** for the sub-agent run: Session id, Skill presence, Workspace initialization, Mode selection, Statusline install. The sub-agent must NOT call `peaks request init` (Code already initialised the slot), and must write `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` with test cases that link to PRD acceptance items. Return only a compact JSON envelope.
94
94
 
95
- > **v2.15.0+ 校准:** 每个 slice 完成,user 必介入做**业务审阅**(4-5 项业务/产品清单:业务流程 / 需求覆盖 / 边界 case / UI 装配 / 能合入下版吗),**不是技术审阅**。业务审过 → 进 final;业务不通过 → 返工。详见 `.peaks/memory/peaks-loop-slice-review-and-qa-perspective.md`。
95
+ > **v2.15.0+ 校准:** 每个 slice 完成,user 必介入做**业务审阅**(4-5 项业务/产品清单:业务流程 / 需求覆盖 / 边界 case / UI 装配 / 能合入下版吗),**不是技术审阅**。业务审过 → 进 final;业务不通过 → 返工。详见 `.peaks/memory/peaks-cli-slice-review-and-qa-perspective.md`。
96
96
 
97
97
  → see `references/qa-sub-agent-dispatch.md` for the full contract + hard prohibitions.
98
98
 
@@ -106,7 +106,7 @@ Project-level security + perf plans live at `.peaks/_runtime/<sessionId>/qa/secu
106
106
 
107
107
  When peaks-qa is the **main loop** (i.e. it is the active skill and is about to run its own sub-agent dispatch, rather than being a sub-agent itself), it fans out only the **business verification** sub-agent: `qa-business`. Security and performance review are **NOT** peaks-qa's responsibility in v2.11.0 — they are owned by peaks-rd's 4-way audit fan-out (code-review + security-review + perf-baseline + karpathy-review) and the rd-side evidence files (`audit/security-<rid>.md`, `audit/perf-<rid>.md`). peaks-qa reads those files by reference; it does NOT re-do them.
108
108
 
109
- > **v2.15.0+ 校准:** `qa-business` 只跑业务/产品视角的 6 项验收清单(业务流程 / 需求覆盖 / 边界 case / UI 装配 / 异常态语调 / 能上线吗),**不跑技术指标**(覆盖率 / 性能 / 安全)。技术指标由 RD 4-way fan-out 自决,QA 只读 `audit/security-<rid>.md` + `audit/perf-<rid>.md`。详见 `.peaks/memory/peaks-loop-slice-review-and-qa-perspective.md`。
109
+ > **v2.15.0+ 校准:** `qa-business` 只跑业务/产品视角的 6 项验收清单(业务流程 / 需求覆盖 / 边界 case / UI 装配 / 异常态语调 / 能上线吗),**不跑技术指标**(覆盖率 / 性能 / 安全)。技术指标由 RD 4-way fan-out 自决,QA 只读 `audit/security-<rid>.md` + `audit/perf-<rid>.md`。详见 `.peaks/memory/peaks-cli-slice-review-and-qa-perspective.md`。
110
110
 
111
111
  If the PRD or project warrants it, subdivide `qa-business` further into roles like `qa-business-api` / `qa-business-frontend` / `qa-business-regression`. Subdivision must stay ≤ 2 levels deep (RL-4).
112
112
 
@@ -182,7 +182,7 @@ QA must generate test cases, not merely inspect existing ones. Every QA invocati
182
182
 
183
183
  **Pre-drafted test cases (slice 004 optimization):** when peaks-rd's 4-way parallel fan-out ran a `qa-test-cases-writer` sub-agent, the test plan is pre-drafted at `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` and shipped through the rd:qa-handoff gate. QA main loop is aware of this and treats the pre-drafted file as the canonical starting point. **Missing** the pre-drafted file (sub-agent failed, or the slice was a config/docs/chore that did not fan out) → QA drafts it inline as before, falling back to the standard generation flow.
184
184
 
185
- > **v2.15.0+ 校准:** 业务验证层(user 必审) = 4-5 项业务/产品清单。技术验证层(AI 自决) = 覆盖率 / P99 / 安全扫描 / 自动化。两层解耦:技术不过 → AI 内部重跑;业务不过 → user 反馈修。user **不看**技术指标。详见 `.peaks/memory/peaks-loop-slice-review-and-qa-perspective.md` G5。
185
+ > **v2.15.0+ 校准:** 业务验证层(user 必审) = 4-5 项业务/产品清单。技术验证层(AI 自决) = 覆盖率 / P99 / 安全扫描 / 自动化。两层解耦:技术不过 → AI 内部重跑;业务不过 → user 反馈修。user **不看**技术指标。详见 `.peaks/memory/peaks-cli-slice-review-and-qa-perspective.md` G5。
186
186
 
187
187
  → see `references/test-case-generation.md` for the full format + acceptance-linkage contract.
188
188
 
@@ -198,7 +198,7 @@ QA cannot pass a change until the report contains evidence for every applicable
198
198
 
199
199
  If Playwright MCP is unavailable, the LLM checks its own tool list for the Playwright MCP server entry; if absent, the LLM tells the user the install command (`claude mcp add playwright -- npx @playwright/mcp@latest` for Claude Code) and marks the gate blocked with the missing capability. Screenshots, logs, manual steps, or other tools must not substitute for the mandatory frontend browser gate. Do not silently downgrade frontend validation to API-only testing.
200
200
 
201
- > **v2.15.0+ 校准:** 存量项目无 UT 兜底,QA 验证必须有"轻量回归"(G14):5-10 分钟跑 10 条关键路径(关键路径来源:prd 业务场景块 / 老板强调的流程 / 历史事故 / G13 影响面扫描),**不跑完整 E2E 1-2 小时**。上线后必须走"观察期"(G15):灰度 → 监控 → 反馈聚合 → 紧急修复 → 修复回灌关键路径(防下次再犯)。详见 `.peaks/memory/peaks-loop-fast-iteration-quality-loop.md`。
201
+ > **v2.15.0+ 校准:** 存量项目无 UT 兜底,QA 验证必须有"轻量回归"(G14):5-10 分钟跑 10 条关键路径(关键路径来源:prd 业务场景块 / 老板强调的流程 / 历史事故 / G13 影响面扫描),**不跑完整 E2E 1-2 小时**。上线后必须走"观察期"(G15):灰度 → 监控 → 反馈聚合 → 紧急修复 → 修复回灌关键路径(防下次再犯)。详见 `.peaks/memory/peaks-cli-fast-iteration-quality-loop.md`。
202
202
 
203
203
  ## Local intermediate artifacts
204
204
 
@@ -297,4 +297,4 @@ QA contracts to assert on the L2 surface (a minimal acceptance test set):
297
297
 
298
298
  ## Sub-role detached mode (Phase C, slice 2026-08-10)
299
299
 
300
- QA sub-roles (`qa-business`, `qa-perf`, `qa-security`, `qa-business-api`, `qa-business-frontend`, `qa-business-regression`) accept `--mode detached --vendor <vendor>` for parallel test-case execution. Detached mode spawns a real OS process via `peaks sub-agent dispatch --mode detached`, isolated from the orchestrator session. Use detached mode when the test-case writer's expected runtime exceeds 60s OR it processes ≥ 20 source files. The default remains `in-process` (backward compat; existing 106+ dispatch tests untouched). When `--mode detached` is used, the child QA agent receives the `<peaks-auto-compact>` marker (corrected 2026-09-13, rid `2026-09-13-defects-e`): it asks the child to persist durable state to `.peaks/_runtime/<sid>/detached/<rid>/compact/<n>.json` before its own harness compacts the session — the child cannot compact itself, and nothing is spliced back into its prompt. See `peaks-code/references/sub-agent-dispatch.md` §"Detached Mode" for the full contract.
300
+ QA sub-roles (`qa-business`, `qa-perf`, `qa-security`, `qa-business-api`, `qa-business-frontend`, `qa-business-regression`) accept `--mode detached --vendor <vendor>` for parallel test-case execution. Detached mode spawns a real OS process via `peaks sub-agent dispatch --mode detached`, isolated from the orchestrator session. Use detached mode when the test-case writer's expected runtime exceeds 60s OR it processes ≥ 20 source files. The default remains `in-process` (backward compat; existing 106+ dispatch tests untouched). When `--mode detached` is used, the child QA agent receives the `<peaks-auto-compact>` marker (corrected 2026-09-13, rid `2026-09-13-defects-e`): it asks the child to persist durable state to `.peaks/_runtime/<sid>/detached/<rid>/compact/<n>.json` before its own harness compacts the session — the child cannot compact itself, and nothing is spliced back into its prompt. See `skills/peaks-code/references/sub-agent-dispatch.md` §"Detached Mode" for the full contract.
@@ -5,5 +5,5 @@
5
5
  - Playwright MCP is the required path for controlled headed browser and E2E validation (it launches a headed browser on demand). The LLM runtime exposes the Playwright tools under its own server-and-tool namespace (the Playwright MCP); QA invokes them by name from the LLM's tool list. (peaks-loop no longer auto-installs MCPs as of slice #016; the user runs `claude mcp add playwright -- npx @playwright/mcp@latest` themselves when the tool list is empty.)
6
6
  - Chrome DevTools MCP is an optional secondary surface for CDP inspection (console, network, performance) of an already-running Chrome started with `--remote-debugging-port=9222`; it does NOT launch a browser on its own. The LLM invokes Chrome DevTools MCP tools directly when present in the tool list.
7
7
  - Agent Browser can support browser walkthroughs, but never submit forms, purchase, delete, or mutate authenticated state without explicit confirmation.
8
- - Canonical browser workflow (URL allow-list, login handoff, sanitization rules, tool mapping): `peaks-code/references/browser-workflow.md`.
8
+ - Canonical browser workflow (URL allow-list, login handoff, sanitization rules, tool mapping): `skills/peaks-code/references/browser-workflow.md`.
9
9
  - If Playwright MCP is not installed and the user does not authorize installation, mark frontend browser validation blocked; screenshots, logs, manual steps, or other tools must not substitute for the mandatory headed browser gate.
@@ -155,4 +155,4 @@ envelope and into the slice's `reducerReport`.
155
155
 
156
156
  > Body of `## 业务测试细分 (optional)`. If the PRD or project warrants it, subdivide `qa-business` further into roles like `qa-business-api` / `qa-business-frontend` / `qa-business-regression`; each gets its own `peaks sub-agent dispatch` call. Names are convention not contract — the dispatcher accepts any non-empty string. **Subdivision must stay ≤ 2 levels deep** (RL-4): `qa-business-api` is fine, `qa-business-api-user` is not. Two levels of depth is the empirical sweet spot — past that, the reducer cannot audit the boundaries between sub-agents, and prompts start overlapping.
157
157
 
158
- For the full contract (heartbeat instructions for each sub-agent, batch-id discipline, 30s cadence, 100-truncation, 5min stale) see `skills/peaks-qa/references/qa-fanout-contract.md` and `skills/peaks-code/references/sub-agent-dispatch.md` §G6.
158
+ For the full contract (heartbeat instructions for each sub-agent, batch-id discipline, 30s cadence, 100-truncation, 5min stale) see `skills/bee/peaks-qa/references/qa-fanout-contract.md` and `skills/peaks-code/references/sub-agent-dispatch.md` §G6.
@@ -18,5 +18,5 @@ Read persistent project memory via CLI (durable, LLM-authored memories):
18
18
  peaks project memories --project <repo> --json
19
19
  ```
20
20
 
21
- This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <decision|convention|module|rule|reference|project>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
21
+ This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <project|decision|convention|rule|reference|feedback|module|lesson|bug|investigation|technical-pattern|project-rule|design|handoff|session-handoff|project-todo|publish-closure|project-closure|slice-closure|slice-pilot-findings|sediment>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
22
22
  Then display: `Peaks-Loop Skill: peaks-qa | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-qa --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
@@ -4,7 +4,7 @@ QA reads the RD handoff's YAML frontmatter **before** reading the body prose. Th
4
4
 
5
5
  ## Required frontmatter fields (mirror RD writer)
6
6
 
7
- `requestId`, `scope`, `files`, `decisions[]`, `risks[]`, `nextActions[]`, `gateEvidence`, `schemaVersion: '1.0'`. Field schema: `../peaks-rd/references/writing-handoff-frontmatter.md`.
7
+ `requestId`, `scope`, `files`, `decisions[]`, `risks[]`, `nextActions[]`, `gateEvidence`, `schemaVersion: '1.0'`. Field schema: `../../peaks-rd/references/writing-handoff-frontmatter.md`.
8
8
 
9
9
  ## Mechanical cross-checks (run before body read)
10
10
 
@@ -27,4 +27,4 @@ After the frontmatter passes, read the body prose to derive the test plan:
27
27
 
28
28
  - All 5 mechanical cross-checks above pass (or are explicitly waived via `--allow-incomplete --confirm`).
29
29
  - Test plan covers every new code path mentioned in body prose.
30
- - Frontmatter YAML parses cleanly (vitest guard: `tests/unit/artifacts/handoff-frontmatter-shape.test.ts`).
30
+ - Frontmatter YAML parses cleanly. No vitest guard covers this; see `../../peaks-rd/references/writing-handoff-frontmatter.md` §Validation for the consumers that read the file.
@@ -65,7 +65,7 @@ Every RD action MUST align with the 4 Karpathy guidelines (full text at `andrej-
65
65
  3. **Surgical Changes** — touch only what the user's request requires. Remove imports / variables / functions that *your* changes made unused. Do not refactor adjacent code. Every changed line must trace to the user's request.
66
66
  4. **Goal-Driven Execution** — define verifiable success criteria (`peaks request show --role rd` carries ACs from PRD). For multi-step work, state plan + verify checkpoints before acting.
67
67
 
68
- Cross-references: Slice 1 PRD §AC-1 / `tests/unit/skills/karpathy-prompt-injection.test.ts` (4-point assertion guard). The canonical skill id is `andrej-karpathy-skills:karpathy-guidelines`.
68
+ Cross-references: Slice 1 PRD §AC-1. The 4-point assertion guard that PRD named was deleted in `f17aa377`; the block below is held by documentation only. The canonical skill id is `andrej-karpathy-skills:karpathy-guidelines`.
69
69
 
70
70
  ## Scope directory (slice 10 — read scopeDir from envelope)
71
71
 
@@ -189,7 +189,7 @@ Full dispatch contract (when-to-fan-out rules, dispatch template, prereq gates)
189
189
 
190
190
  ## Reviewer fan-out detached mode (Phase C, slice 2026-08-10)
191
191
 
192
- Reviewer fan-out may run in detached mode for any of the 3-way fan-out roles (`code-reviewer`, `qa-test-cases-writer`, `karpathy-reviewer`). Detached mode spawns a real OS process via `peaks sub-agent dispatch --mode detached --vendor <vendor>`, isolated from the orchestrator session. Use detached mode when the reviewer's expected runtime exceeds 60s OR processes ≥ 20 source files. Pass `--mode detached` explicitly per reviewer role; the default remains `in-process` (backward compat). The karpathy-reviewer's `<peaks-auto-compact>` marker is honored automatically when `--mode detached` is used. Note what that marker does and does not do (corrected 2026-09-13, rid `2026-09-13-defects-e`): it asks the child to persist durable state to `.peaks/_runtime/<sid>/detached/<rid>/compact/<n>.json` before its own harness compacts the session — the child cannot compact itself, and nothing is spliced back into its prompt. See `peaks-code/references/sub-agent-dispatch.md` §"Detached Mode" for the full contract.
192
+ Reviewer fan-out may run in detached mode for any of the 3-way fan-out roles (`code-reviewer`, `qa-test-cases-writer`, `karpathy-reviewer`). Detached mode spawns a real OS process via `peaks sub-agent dispatch --mode detached --vendor <vendor>`, isolated from the orchestrator session. Use detached mode when the reviewer's expected runtime exceeds 60s OR processes ≥ 20 source files. Pass `--mode detached` explicitly per reviewer role; the default remains `in-process` (backward compat). The karpathy-reviewer's `<peaks-auto-compact>` marker is honored automatically when `--mode detached` is used. Note what that marker does and does not do (corrected 2026-09-13, rid `2026-09-13-defects-e`): it asks the child to persist durable state to `.peaks/_runtime/<sid>/detached/<rid>/compact/<n>.json` before its own harness compacts the session — the child cannot compact itself, and nothing is spliced back into its prompt. See `../../peaks-code/references/sub-agent-dispatch.md` §"Detached Mode" for the full contract.
193
193
 
194
194
  ## Refactor hard gates
195
195
 
@@ -3,7 +3,7 @@
3
3
  > Hint block appended to the code-reviewer sub-agent prompt at dispatch
4
4
  > time. The RD main loop injects the verbatim block below after the
5
5
  > Karpathy-guidelines context block (see
6
- > `references/rd-sub-agent-dispatch.md` §"Karpathy-guidelines context").
6
+ > `rd-sub-agent-dispatch.md` §"Karpathy-guidelines context").
7
7
  > The block is the canonical promotion surface for the convention at
8
8
  > `.peaks/standards/typescript/testing.md`.
9
9
 
@@ -6,4 +6,4 @@
6
6
 
7
7
  **Other external resources** (Context7, SearchCode, everything-claude-code, GitNexus, etc.): Use `peaks capabilities --source access-repo/mcp-server --json` for capability discovery before recommending. References only — do not execute upstream installers, do not install upstream resources, do not persist sensitive examples. Peaks-Loop RD gates remain authoritative.
8
8
 
9
- **OpenSpec CLI**: Route through Peaks-Loop CLI (`peaks openspec show/to-rd/render`). Do not hand-edit `openspec/changes/**`. Recipes: `references/openspec-cli.md`.
9
+ **OpenSpec CLI**: Route through Peaks-Loop CLI (`peaks openspec show/to-rd/render`). Do not hand-edit `openspec/changes/**`. Recipes: `openspec-cli.md`.
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Body of `## Mandatory perf-baseline output` + numbered perf-baseline steps. **BLOCKING — Do not hand off to QA without a perf-baseline file when the slice has a user-visible performance surface.** The QA stage's Gate A4 (performance check) needs a stable reference to diff against; without an RD-side baseline, the first time Gate A4 runs it has nothing to compare against and any regression it finds is a blind-side surprise. The user-facing pain of leaving perf to QA only has historically been a 3-cycle repair loop. The RD-side baseline closes that loop.
4
4
 
5
- > **Slice 025 — stable across slices within a session; refreshed on trigger.** The perf baseline is a **project-level** artifact (`.peaks/_runtime/<sessionId>/qa/perf-baseline.md`) and is **stable across slices within a session**. It is regenerated only when the slice diff matches the refresh trigger table (see `peaks-qa/references/qa-perf-test-plan.md`). Slices that do not trigger a refresh reference the existing baseline by hash from the per-slice `qa/performance-findings-<rid>.md` (not by regenerating the baseline). The CLI is `peaks workflow plan read|refresh|detect-trigger perf --project <repo>`; the RD-side `peaks perf baseline --apply` workflow below still scaffolds the initial file but the canonical refresh path post-slice-025 is the new `peaks workflow plan refresh` primitive.
5
+ > **Slice 025 — stable across slices within a session; refreshed on trigger.** The perf baseline is a **project-level** artifact (`.peaks/_runtime/<sessionId>/qa/perf-baseline.md`) and is **stable across slices within a session**. It is regenerated only when the slice diff matches the refresh trigger table (see `skills/bee/peaks-qa/references/qa-perf-test-plan.md`). Slices that do not trigger a refresh reference the existing baseline by hash from the per-slice `qa/performance-findings-<rid>.md` (not by regenerating the baseline). The CLI is `peaks workflow plan read|refresh|detect-trigger perf --project <repo>`; the RD-side `peaks perf baseline --apply` workflow below still scaffolds the initial file but the canonical refresh path post-slice-025 is the new `peaks workflow plan refresh` primitive.
6
6
 
7
7
  **When this applies:**
8
8
  - feature / refactor slices that touch a route, hook, API, or any user-perceivable surface
@@ -12,8 +12,8 @@ status: shipped-4.0.16
12
12
  `@alibaba-group/open-code-review@1.8.9` replaces the 2.0.3-era
13
13
  GitHub Releases HTTPS download with per-platform `optionalDependencies`
14
14
  (`@alibaba-group/ocr-{darwin,linux,win32}-{arm64,x64}`). `npm install`
15
- hits the registry only; postinstall runs the embedded Node installer
16
- (`scripts/install.js`) and resolves the platform binary locally.
15
+ hits the registry only; postinstall runs the Node installer the package
16
+ itself ships and resolves the platform binary locally.
17
17
 
18
18
  Sandbox evidence (2026-08-06, `npm@10.9.4`):
19
19
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  The rid is part of the filename (slice `2026-09-14-audit-artifact-rid-scoping`): every slice in a session shares `.peaks/_runtime/<sessionId>/audit/`, so a ridless name means the second slice's audit silently replaces the first slice's. The ridless locations are still read as fallbacks.
11
11
 
12
- Both audit skills consume the immutable peaks-prd handoff (`prd/handoff.md`) and the project-scoped audit templates under `.peaks/project-scan/{security-template, perf-template, audit-output-schema}.md`. The handoff presence is enforced by the `AUDIT_REQUIRES_HANDOFF` prereq. The 1-minor-release back-compat window (`v2.12.0`) keeps the old `rd/{security-review,perf-baseline}.md` paths readable via `mustContainAny` — see `tests/unit/rd/deprecated-reviewer-back-compat.test.ts` (8 cases) and `tests/unit/artifact-prerequisites-typed.test.ts`.
12
+ Both audit skills consume the immutable peaks-prd handoff (`prd/handoff.md`) and the project-scoped audit templates under `.peaks/project-scan/{security-template, perf-template, audit-output-schema}.md`. The handoff presence is enforced by the `AUDIT_REQUIRES_HANDOFF` prereq. The 1-minor-release back-compat window (`v2.12.0`) keeps the old `rd/{security-review,perf-baseline}.md` paths readable via `mustContainAny` — see `RD_DEPRECATED_REVIEWERS` in `src/services/rd/reviewer-dispatch-policy.ts`. The unit tests that once pinned this were deleted in `f17aa377` and have not been replaced.
13
13
 
14
14
  The current fan-out is therefore **3 sub-agents**:
15
15
 
@@ -67,7 +67,7 @@ Note: sub-agent 1 (code-reviewer) and sub-agent 3 (karpathy-reviewer) write to `
67
67
  - Read `.peaks/_runtime/<sessionId>/prd/handoff.md` (v2.11.0: architecture summary — the immutable peaks-prd handoff replaces `rd/tech-doc.md`).
68
68
  - Output: `.peaks/_runtime/<sessionId>/rd/karpathy-review-<rid>.md` containing a `## Karpathy-Gate` header and the 4 guideline section markers (Think Before Coding / Simplicity First / Surgical Changes / Goal-Driven Execution). (Rid in the filename, same reason as the code review; the ridless `rd/karpathy-review.md` is still read as a fallback.)
69
69
  - Required for the `KARPATHY_REVIEW` prereq. The transition CLI gate reads those markers and refuses `rd:qa-handoff` when the file is missing or the markers are absent.
70
- - See `references/rd-fanout-contracts.md` §"karpathy-reviewer contract" for the JSON envelope shape + file format.
70
+ - See `rd-fanout-contracts.md` §"karpathy-reviewer contract" for the JSON envelope shape + file format.
71
71
 
72
72
  **Hard prohibitions on all 3 sub-agents:**
73
73
  - Do NOT call `Skill(skill="...")` — would re-enter RD or another skill and break the fan-out.
@@ -21,12 +21,13 @@ end of implementation, RD fires 3 sub-agents in parallel via
21
21
  > The handoff presence is enforced by the `AUDIT_REQUIRES_HANDOFF` prereq.
22
22
  > The 1-minor-release back-compat window (`v2.12.0`) keeps the old
23
23
  > `rd/{security-review,perf-baseline}.md` paths readable via `mustContainAny` —
24
- > see `tests/unit/rd/deprecated-reviewer-back-compat.test.ts` (8 cases) and
25
- > `tests/unit/artifact-prerequisites-typed.test.ts`.
24
+ > see `RD_DEPRECATED_REVIEWERS` in
25
+ > `src/services/rd/reviewer-dispatch-policy.ts`. The two unit tests that
26
+ > once pinned this were deleted in `f17aa377` and have not been replaced.
26
27
 
27
28
  ## The 3 sub-agents
28
29
 
29
- > **Karpathy pointer (Slice 1/6):** Each of the 3 sub-agents below operates under the 4 Karpathy guidelines. The canonical reference is `andrej-karpathy-skills:karpathy-guidelines` (full text) and `peaks-rd/SKILL.md` §"Karpathy enforcement". The dispatch primitive also injects the verbatim context block from `rd-sub-agent-dispatch.md` §"Karpathy-guidelines context" into every sub-agent prompt. Sub-agents MUST NOT silently drop the block.
30
+ > **Karpathy pointer (Slice 1/6):** Each of the 3 sub-agents below operates under the 4 Karpathy guidelines. The canonical reference is `andrej-karpathy-skills:karpathy-guidelines` (full text) and `../SKILL.md` §"Karpathy enforcement". The dispatch primitive also injects the verbatim context block from `rd-sub-agent-dispatch.md` §"Karpathy-guidelines context" into every sub-agent prompt. Sub-agents MUST NOT silently drop the block.
30
31
 
31
32
  - **Sub-agent 1 — code-reviewer** runs `code-review` against the diff and
32
33
  writes `rd/code-review-<rid>.md`. **v2.11.0 Tier 7 (Group D) + 2026-09-09-ecc-dynamic:**
@@ -77,9 +78,9 @@ end of implementation, RD fires 3 sub-agents in parallel via
77
78
  > `.peaks/_runtime/<sessionId>/rd/perf-baseline.md` remains readable
78
79
  > via `mustContainAny` for the v2.12.0 1-minor-release window.
79
80
  >
80
- > See `tests/unit/rd/deprecated-reviewer-back-compat.test.ts` (8 cases)
81
- > and `RD_DEPRECATED_REVIEWERS` in
82
- > `src/services/rd/reviewer-dispatch-policy.ts`.
81
+ > See `RD_DEPRECATED_REVIEWERS` in
82
+ > `src/services/rd/reviewer-dispatch-policy.ts`. The unit test that once
83
+ > pinned this was deleted in `f17aa377` and has not been replaced.
83
84
 
84
85
  ## Hard prohibitions on all 3 sub-agents (single block)
85
86
 
@@ -201,8 +202,10 @@ failing the gate.
201
202
  `mustContainAny: [...]` on the `AUDIT_SECURITY` / `AUDIT_PERF` prereqs
202
203
  during the back-compat window. v2.13.0 hard-deletes the legacy paths.
203
204
 
204
- **Pinning:** `tests/unit/rd/deprecated-reviewer-back-compat.test.ts`
205
- (8 cases) pins the dispatch routing + the legacy-path acceptance.
205
+ **Pinning:** none. The routing + legacy-path acceptance live in
206
+ `RD_DEPRECATED_REVIEWERS` / `isDeprecatedReviewer` in
207
+ `src/services/rd/reviewer-dispatch-policy.ts`; the unit test that pinned
208
+ them (8 cases) was deleted in `f17aa377` and has not been replaced.
206
209
 
207
210
  ## Gate C evidence (RD-side, type-specific)
208
211
 
@@ -155,7 +155,7 @@ peaks codegraph affected --project <repo> <changed-files...> --json
155
155
  # --rid <rid> --project <repo> --json
156
156
  # The sub-agent reads `~/.claude/agents/karpathy-reviewer.md` (user-installed)
157
157
  # which is the project-internal draft at
158
- # `skills/peaks-rd/references/karpathy-reviewer-prompt.md` plus a
158
+ # `skills/bee/peaks-rd/references/karpathy-reviewer-prompt.md` plus a
159
159
  # `rd/karpathy-reviewer-agent-handoff.md` install guide.
160
160
  # Hard gate: missing karpathy-reviewer sub-agent OR missing rd/karpathy-review-<rid>.md
161
161
  # → `peaks request transition --state qa-handoff` returns `code: PREREQUISITES_MISSING`.