peaks-cli 1.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/.claude-plugin/marketplace.json +51 -0
  2. package/CHANGELOG.md +238 -0
  3. package/README-en.md +226 -0
  4. package/README.md +142 -165
  5. package/dist/src/cli/commands/agent-commands.d.ts +20 -0
  6. package/dist/src/cli/commands/agent-commands.js +48 -0
  7. package/dist/src/cli/commands/audit-commands.d.ts +18 -0
  8. package/dist/src/cli/commands/audit-commands.js +138 -0
  9. package/dist/src/cli/commands/classify-classify-commands.d.ts +19 -0
  10. package/dist/src/cli/commands/classify-classify-commands.js +151 -0
  11. package/dist/src/cli/commands/code-review-commands.d.ts +34 -0
  12. package/dist/src/cli/commands/code-review-commands.js +83 -0
  13. package/dist/src/cli/commands/config-commands.js +90 -0
  14. package/dist/src/cli/commands/context-commands.d.ts +21 -0
  15. package/dist/src/cli/commands/context-commands.js +167 -0
  16. package/dist/src/cli/commands/core-artifact-commands.js +81 -2
  17. package/dist/src/cli/commands/hook-handle.js +50 -0
  18. package/dist/src/cli/commands/loop-commands.d.ts +21 -0
  19. package/dist/src/cli/commands/loop-commands.js +128 -0
  20. package/dist/src/cli/commands/memory-commands.d.ts +13 -0
  21. package/dist/src/cli/commands/memory-commands.js +60 -0
  22. package/dist/src/cli/commands/openspec-commands.js +37 -0
  23. package/dist/src/cli/commands/preferences-commands.d.ts +2 -0
  24. package/dist/src/cli/commands/preferences-commands.js +147 -0
  25. package/dist/src/cli/commands/retrospective-commands.d.ts +9 -0
  26. package/dist/src/cli/commands/retrospective-commands.js +58 -0
  27. package/dist/src/cli/commands/skill-conformance-commands.d.ts +9 -0
  28. package/dist/src/cli/commands/skill-conformance-commands.js +39 -0
  29. package/dist/src/cli/commands/understand-commands.js +34 -0
  30. package/dist/src/cli/commands/upgrade-commands.d.ts +23 -0
  31. package/dist/src/cli/commands/upgrade-commands.js +57 -0
  32. package/dist/src/cli/commands/workflow-commands.js +70 -0
  33. package/dist/src/cli/commands/workspace-commands.js +86 -0
  34. package/dist/src/cli/program.js +46 -22
  35. package/dist/src/services/agent/ecc-agent-service.d.ts +47 -0
  36. package/dist/src/services/agent/ecc-agent-service.js +143 -0
  37. package/dist/src/services/artifacts/request-artifact-service.js +14 -0
  38. package/dist/src/services/audit/backing-detector.d.ts +24 -0
  39. package/dist/src/services/audit/backing-detector.js +59 -0
  40. package/dist/src/services/audit/classifier.d.ts +38 -0
  41. package/dist/src/services/audit/classifier.js +127 -0
  42. package/dist/src/services/audit/enforcers/active-skill-resolver.d.ts +29 -0
  43. package/dist/src/services/audit/enforcers/active-skill-resolver.js +71 -0
  44. package/dist/src/services/audit/enforcers/design-draft-confirm.d.ts +25 -0
  45. package/dist/src/services/audit/enforcers/design-draft-confirm.js +54 -0
  46. package/dist/src/services/audit/enforcers/lint-audit-regression.d.ts +21 -0
  47. package/dist/src/services/audit/enforcers/lint-audit-regression.js +86 -0
  48. package/dist/src/services/audit/enforcers/lint-catalog-governance.d.ts +27 -0
  49. package/dist/src/services/audit/enforcers/lint-catalog-governance.js +38 -0
  50. package/dist/src/services/audit/enforcers/lint-cli-back.d.ts +16 -0
  51. package/dist/src/services/audit/enforcers/lint-cli-back.js +35 -0
  52. package/dist/src/services/audit/enforcers/lint-output-style.d.ts +11 -0
  53. package/dist/src/services/audit/enforcers/lint-output-style.js +94 -0
  54. package/dist/src/services/audit/enforcers/lint-reference-integrity.d.ts +6 -0
  55. package/dist/src/services/audit/enforcers/lint-reference-integrity.js +83 -0
  56. package/dist/src/services/audit/enforcers/lint-reference-shape.d.ts +30 -0
  57. package/dist/src/services/audit/enforcers/lint-reference-shape.js +272 -0
  58. package/dist/src/services/audit/enforcers/lint-style.d.ts +49 -0
  59. package/dist/src/services/audit/enforcers/lint-style.js +173 -0
  60. package/dist/src/services/audit/enforcers/lint-workflow-shape.d.ts +5 -0
  61. package/dist/src/services/audit/enforcers/lint-workflow-shape.js +141 -0
  62. package/dist/src/services/audit/enforcers/login-gate.d.ts +23 -0
  63. package/dist/src/services/audit/enforcers/login-gate.js +40 -0
  64. package/dist/src/services/audit/enforcers/mock-placement.d.ts +25 -0
  65. package/dist/src/services/audit/enforcers/mock-placement.js +48 -0
  66. package/dist/src/services/audit/enforcers/no-root-pollution.d.ts +21 -0
  67. package/dist/src/services/audit/enforcers/no-root-pollution.js +56 -0
  68. package/dist/src/services/audit/enforcers/pre-rd-scan.d.ts +22 -0
  69. package/dist/src/services/audit/enforcers/pre-rd-scan.js +23 -0
  70. package/dist/src/services/audit/enforcers/prototype-fidelity.d.ts +25 -0
  71. package/dist/src/services/audit/enforcers/prototype-fidelity.js +75 -0
  72. package/dist/src/services/audit/enforcers/resume-detection.d.ts +21 -0
  73. package/dist/src/services/audit/enforcers/resume-detection.js +52 -0
  74. package/dist/src/services/audit/enforcers/solo-code-ban.d.ts +23 -0
  75. package/dist/src/services/audit/enforcers/solo-code-ban.js +27 -0
  76. package/dist/src/services/audit/enforcers/sub-agent-sid.d.ts +25 -0
  77. package/dist/src/services/audit/enforcers/sub-agent-sid.js +63 -0
  78. package/dist/src/services/audit/enforcers/tech-doc-presence.d.ts +28 -0
  79. package/dist/src/services/audit/enforcers/tech-doc-presence.js +35 -0
  80. package/dist/src/services/audit/red-line-catalog-p2-a.d.ts +21 -0
  81. package/dist/src/services/audit/red-line-catalog-p2-a.js +233 -0
  82. package/dist/src/services/audit/red-line-catalog-p2-b.d.ts +19 -0
  83. package/dist/src/services/audit/red-line-catalog-p2-b.js +225 -0
  84. package/dist/src/services/audit/red-line-catalog.d.ts +51 -0
  85. package/dist/src/services/audit/red-line-catalog.js +210 -0
  86. package/dist/src/services/audit/red-lines-service.d.ts +23 -0
  87. package/dist/src/services/audit/red-lines-service.js +486 -0
  88. package/dist/src/services/audit/scanners/openspec-scanner.d.ts +15 -0
  89. package/dist/src/services/audit/scanners/openspec-scanner.js +55 -0
  90. package/dist/src/services/audit/scanners/rules-tree-scanner.d.ts +16 -0
  91. package/dist/src/services/audit/scanners/rules-tree-scanner.js +56 -0
  92. package/dist/src/services/audit/scanners/skills-tree-scanner.d.ts +17 -0
  93. package/dist/src/services/audit/scanners/skills-tree-scanner.js +46 -0
  94. package/dist/src/services/audit/static-service.d.ts +57 -0
  95. package/dist/src/services/audit/static-service.js +125 -0
  96. package/dist/src/services/audit/types.d.ts +69 -0
  97. package/dist/src/services/audit/types.js +13 -0
  98. package/dist/src/services/classify/classify-service.d.ts +42 -0
  99. package/dist/src/services/classify/classify-service.js +122 -0
  100. package/dist/src/services/classify/classify-types.d.ts +79 -0
  101. package/dist/src/services/classify/classify-types.js +90 -0
  102. package/dist/src/services/code-review/ocr-service.d.ts +129 -0
  103. package/dist/src/services/code-review/ocr-service.js +362 -0
  104. package/dist/src/services/config/config-migration.d.ts +32 -0
  105. package/dist/src/services/config/config-migration.js +92 -0
  106. package/dist/src/services/config/config-restore.d.ts +10 -0
  107. package/dist/src/services/config/config-restore.js +47 -0
  108. package/dist/src/services/config/config-rollback.d.ts +13 -0
  109. package/dist/src/services/config/config-rollback.js +26 -0
  110. package/dist/src/services/config/config-service.d.ts +35 -2
  111. package/dist/src/services/config/config-service.js +81 -0
  112. package/dist/src/services/config/config-types.d.ts +58 -0
  113. package/dist/src/services/config/config-types.js +6 -0
  114. package/dist/src/services/doctor/doctor-service.js +96 -0
  115. package/dist/src/services/fuzzy-matching/fuzzy-match-service.d.ts +15 -0
  116. package/dist/src/services/fuzzy-matching/fuzzy-match-service.js +56 -0
  117. package/dist/src/services/fuzzy-matching/types.d.ts +20 -0
  118. package/dist/src/services/fuzzy-matching/types.js +1 -0
  119. package/dist/src/services/ide/adapters/hermes-adapter.d.ts +21 -0
  120. package/dist/src/services/ide/adapters/hermes-adapter.js +51 -0
  121. package/dist/src/services/ide/adapters/openclaw-adapter.d.ts +14 -0
  122. package/dist/src/services/ide/adapters/openclaw-adapter.js +42 -0
  123. package/dist/src/services/ide/ide-registry.js +7 -0
  124. package/dist/src/services/ide/ide-types.d.ts +1 -1
  125. package/dist/src/services/memory/memory-search-service.d.ts +61 -0
  126. package/dist/src/services/memory/memory-search-service.js +80 -0
  127. package/dist/src/services/openspec/openspec-propose-from-doctor-service.d.ts +31 -0
  128. package/dist/src/services/openspec/openspec-propose-from-doctor-service.js +95 -0
  129. package/dist/src/services/preferences/preferences-service.d.ts +6 -0
  130. package/dist/src/services/preferences/preferences-service.js +43 -0
  131. package/dist/src/services/preferences/preferences-types.d.ts +90 -0
  132. package/dist/src/services/preferences/preferences-types.js +38 -0
  133. package/dist/src/services/recommendations/capability-seed-items.js +0 -1
  134. package/dist/src/services/recommendations/capability-seed-mappings.js +0 -1
  135. package/dist/src/services/recommendations/capability-seed-sources.js +0 -1
  136. package/dist/src/services/retrospective/retrospective-search-service.d.ts +37 -0
  137. package/dist/src/services/retrospective/retrospective-search-service.js +75 -0
  138. package/dist/src/services/skills/skill-conformance-service.d.ts +40 -0
  139. package/dist/src/services/skills/skill-conformance-service.js +136 -0
  140. package/dist/src/services/skills/skill-runbook-service.js +44 -10
  141. package/dist/src/services/skills/sync-service.d.ts +43 -0
  142. package/dist/src/services/skills/sync-service.js +99 -0
  143. package/dist/src/services/slice/slice-check-service.js +166 -13
  144. package/dist/src/services/slice/slice-check-types.d.ts +1 -1
  145. package/dist/src/services/standards/migrate-claude-rules-service.d.ts +19 -0
  146. package/dist/src/services/standards/migrate-claude-rules-service.js +193 -0
  147. package/dist/src/services/standards/project-context.d.ts +1 -1
  148. package/dist/src/services/standards/project-context.js +0 -4
  149. package/dist/src/services/standards/project-standards-service.js +1 -3
  150. package/dist/src/services/understand/understand-scan-service.js +15 -2
  151. package/dist/src/services/understand/understand-types.d.ts +26 -0
  152. package/dist/src/services/upgrade/1x-detector-service.d.ts +7 -0
  153. package/dist/src/services/upgrade/1x-detector-service.js +94 -0
  154. package/dist/src/services/upgrade/gitignore-migrate-service.d.ts +56 -0
  155. package/dist/src/services/upgrade/gitignore-migrate-service.js +170 -0
  156. package/dist/src/services/upgrade/upgrade-service.d.ts +47 -0
  157. package/dist/src/services/upgrade/upgrade-service.js +381 -0
  158. package/dist/src/services/workspace/migrate-1-4-1-service.js +1 -1
  159. package/dist/src/services/workspace/sid-naming-guard.d.ts +14 -0
  160. package/dist/src/services/workspace/sid-naming-guard.js +31 -0
  161. package/dist/src/services/workspace/workspace-archive-service.d.ts +19 -0
  162. package/dist/src/services/workspace/workspace-archive-service.js +32 -0
  163. package/dist/src/services/workspace/workspace-clean-service.d.ts +41 -0
  164. package/dist/src/services/workspace/workspace-clean-service.js +86 -0
  165. package/dist/src/services/workspace/workspace-state-service.d.ts +7 -0
  166. package/dist/src/services/workspace/workspace-state-service.js +43 -0
  167. package/dist/src/shared/change-id.js +4 -1
  168. package/dist/src/shared/version.d.ts +1 -1
  169. package/dist/src/shared/version.js +1 -1
  170. package/package.json +10 -8
  171. package/schemas/doctor-report.schema.json +1 -1
  172. package/scripts/install-skills.mjs +296 -12
  173. package/skills/peaks-doctor/SKILL.md +59 -0
  174. package/skills/peaks-doctor/references/doctor-check-catalog.md +31 -0
  175. package/skills/peaks-doctor/references/from-doctor-flow.md +64 -0
  176. package/skills/peaks-doctor/test_prompts.json +17 -0
  177. package/skills/peaks-ide/SKILL.md +2 -0
  178. package/skills/peaks-qa/SKILL.md +9 -7
  179. package/skills/peaks-qa/references/artifact-per-request.md +19 -5
  180. package/skills/peaks-qa/references/qa-perf-test-plan.md +6 -6
  181. package/skills/peaks-qa/references/qa-runbook.md +1 -1
  182. package/skills/peaks-rd/SKILL.md +25 -10
  183. package/skills/peaks-rd/references/ocr-integration.md +214 -0
  184. package/skills/peaks-rd/references/rd-fanout-contracts.md +70 -0
  185. package/skills/peaks-rd/references/rd-runbook.md +1 -1
  186. package/skills/peaks-solo/SKILL.md +11 -5
  187. package/skills/peaks-solo/references/completion-handoff.md +3 -1
  188. package/skills/peaks-solo/references/step-0-55-1x-detection.md +82 -0
  189. package/skills/peaks-solo/references/workflow-gates-and-types.md +9 -0
  190. package/dist/src/cli/commands/shadcn-commands.d.ts +0 -3
  191. package/dist/src/cli/commands/shadcn-commands.js +0 -35
  192. package/dist/src/cli/commands/skill-context-stats-command.d.ts +0 -40
  193. package/dist/src/cli/commands/skill-context-stats-command.js +0 -96
  194. package/dist/src/cli/commands/skill-scope-commands.d.ts +0 -51
  195. package/dist/src/cli/commands/skill-scope-commands.js +0 -310
  196. package/dist/src/services/shadcn/shadcn-service.d.ts +0 -27
  197. package/dist/src/services/shadcn/shadcn-service.js +0 -128
  198. package/dist/src/services/skill-scope/adapters/_stub-helper.d.ts +0 -39
  199. package/dist/src/services/skill-scope/adapters/_stub-helper.js +0 -98
  200. package/dist/src/services/skill-scope/adapters/claude-code.d.ts +0 -59
  201. package/dist/src/services/skill-scope/adapters/claude-code.js +0 -304
  202. package/dist/src/services/skill-scope/adapters/codex.d.ts +0 -2
  203. package/dist/src/services/skill-scope/adapters/codex.js +0 -12
  204. package/dist/src/services/skill-scope/adapters/cursor.d.ts +0 -2
  205. package/dist/src/services/skill-scope/adapters/cursor.js +0 -13
  206. package/dist/src/services/skill-scope/adapters/qoder.d.ts +0 -2
  207. package/dist/src/services/skill-scope/adapters/qoder.js +0 -13
  208. package/dist/src/services/skill-scope/adapters/tongyi.d.ts +0 -2
  209. package/dist/src/services/skill-scope/adapters/tongyi.js +0 -13
  210. package/dist/src/services/skill-scope/adapters/trae.d.ts +0 -2
  211. package/dist/src/services/skill-scope/adapters/trae.js +0 -12
  212. package/dist/src/services/skill-scope/detect.d.ts +0 -81
  213. package/dist/src/services/skill-scope/detect.js +0 -513
  214. package/dist/src/services/skill-scope/registry.d.ts +0 -41
  215. package/dist/src/services/skill-scope/registry.js +0 -83
  216. package/dist/src/services/skill-scope/source-of-truth.d.ts +0 -44
  217. package/dist/src/services/skill-scope/source-of-truth.js +0 -118
  218. package/dist/src/services/skill-scope/types.d.ts +0 -195
  219. package/dist/src/services/skill-scope/types.js +0 -97
@@ -79,15 +79,15 @@ When this skill is running in the main Claude session (not as a sub-agent), befo
79
79
 
80
80
  ## Mandatory per-request artifact
81
81
 
82
- Every QA invocation — feature, bug, refactor, clarification — must write **three separate files** (test cases + test report + request artifact). Do not merge them into one. Each serves a different reader.
82
+ Every QA invocation — feature, bug, refactor, clarification — must write **three separate files** (test cases + test report + request artifact) under `.peaks/<session-id>/qa/` (canonical placeholder: `.peaks/<session-id>/qa/requests/<request-id>.md`; runtime path is `.peaks/_runtime/<session-id>/qa/...`). Do not merge them into one. Each serves a different reader.
83
83
 
84
- see `references/artifact-per-request.md` for the 3-file contract (test cases / test report / request artifact).
84
+ External-skill guard: when QA references external material (mattpocock/skills, gstack, superpowers, etc.) it is reference only do not execute upstream installer, do not persist sensitive upstream examples. Peaks-Cli artifacts and Peaks-Cli acceptance criteria remain authoritative.
85
85
 
86
- ## Default runbook
86
+ see `references/artifact-per-request.md` for the 3-file contract and the do-not-execute upstream guard.
87
87
 
88
- The default sequence the QA skill should execute. Do not skip the boundary check, the unit test gate, the validation report, or — when frontend is in scope — the Playwright MCP browser gate. The full 10-step runbook (steps #0–#9) with every CLI invocation, the rd-side pre-drafted test-cases optimization, the dev-server lifecycle requirement, the security/performance check discipline, and the 8 quality-gate CLI checks is in the references file.
88
+ ## Default runbook
89
89
 
90
- see `references/qa-runbook.md` for the full runbook.
90
+ See `references/qa-runbook.md` for the full 10-step runbook (steps #0–#9) with every CLI invocation, the rd-side pre-drafted test-cases optimization, the dev-server lifecycle requirement, the security/performance check discipline, and the 8 quality-gate CLI checks.
91
91
 
92
92
  ## Transition verification gates (MANDATORY — run the command, see the output)
93
93
 
@@ -125,6 +125,8 @@ Before QA passes or returns work to RD, it must independently recheck the implem
125
125
 
126
126
  QA must generate test cases, not merely inspect existing ones. Every QA invocation that validates code changes must produce a test-case artifact at `.peaks/_runtime/<sessionId>/qa/test-cases/<request-id>.md`. Minimum categories: Unit / Integration / UI regression. Each test case MUST have an `**Acceptance:**` field linking to PRD acceptance IDs (A1, A2, ...). The `peaks scan acceptance-coverage` command enforces coverage.
127
127
 
128
+ **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/<id>/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.
129
+
128
130
  → see `references/test-case-generation.md` for the full format + acceptance-linkage contract.
129
131
 
130
132
  ## Mandatory test-report output
@@ -137,7 +139,7 @@ Every QA invocation must produce a test-report artifact at `.peaks/_runtime/<ses
137
139
 
138
140
  QA cannot pass a change until the report contains evidence for every applicable gate. The 11 gates (0 test-case generation, 1 test-report, 2 unit tests, 3 API validation, 4 frontend browser validation, 5 browser-error feedback loop, 6 security check, 7 performance check, 8 library version regressions, 9 validation report, 10 acceptance coverage, 11 QA artifact lint) are mapped to Peaks-Cli Gates A/A2/A3/A4/B/C/D/E/F.
139
141
 
140
- If Playwright MCP is unavailable (not installed and the user has not authorized installation), mark 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.
142
+ 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.
141
143
 
142
144
  ## Local intermediate artifacts
143
145
 
@@ -159,7 +161,7 @@ When capability discovery exposes `mattpocock/skills`, use `tdd` / `triage` / `g
159
161
 
160
162
  ## Codegraph regression focus
161
163
 
162
- QA may use `peaks codegraph affected --project <path> <changed-files...> --json` as regression-surface evidence. External analysis cannot pass QA by itself — treat output as untrusted supporting evidence.
164
+ QA may use `peaks codegraph affected --project <path> <changed-files...> --json` as regression-surface evidence. External analysis cannot pass QA by itself — treat output as untrusted supporting evidence. External skill guidance cannot pass QA by itself — treat as supporting evidence, not a verdict. QA reads `.peaks/<session-id>/rd/codegraph-context.md` (or `qa/codegraph-context.md`) as input but never mutate agent settings, Claude settings, or hooks from it; QA does not commit `.codegraph/` artifacts or persist generated `.codegraph/` databases into git.
163
165
 
164
166
  → see `references/codegraph-regression-focus.md`.
165
167
 
@@ -1,11 +1,25 @@
1
1
  # QA per-request artifact contract
2
2
 
3
- > Body of `## Mandatory per-request artifact` (QA-flavored). Every QA invocation — feature, bug, refactor, clarification — must write **three separate files**. Do not merge them into one. Each serves a different reader:
3
+ > Body of `## Mandatory per-request artifact` (QA-flavored). Every QA invocation — feature, bug, refactor, clarification — must write **three separate files**. Do not merge them into one. Each serves a different reader.
4
+
5
+ ## Required path
6
+
7
+ The three files for any QA invocation land under the active session's `qa/` workspace, using the canonical placeholder `.peaks/<session-id>/qa/...` (e.g. `.peaks/<session-id>/qa/requests/<request-id>.md`).
4
8
 
5
9
  | # | File | Path | Reader | Content |
6
10
  |---|------|------|--------|---------|
7
- | 1 | Test cases | `.peaks/_runtime/<sessionId>/qa/test-cases/<request-id>.md` | RD (before impl), QA | Generated test scenarios with status |
8
- | 2 | Test report | `.peaks/_runtime/<sessionId>/qa/test-reports/<request-id>.md` | QA, SC, Solo | Summary, coverage%, security, perf, risks |
9
- | 3 | Request artifact | `.peaks/_runtime/<sessionId>/qa/requests/<request-id>.md` | Solo, RD↔QA loop | Verdict, boundary check, links to #1 and #2 |
11
+ | 1 | Test cases | `.peaks/_runtime/<session-id>/qa/test-cases/<request-id>.md` | RD (before impl), QA | Generated test scenarios with status |
12
+ | 2 | Test report | `.peaks/_runtime/<session-id>/qa/test-reports/<request-id>.md` | QA, SC, Solo | Summary, coverage%, security, perf, risks |
13
+ | 3 | Request artifact | `.peaks/_runtime/<session-id>/qa/requests/<request-id>.md` | Solo, RD↔QA loop | Verdict, boundary check, links to #1 and #2 |
14
+
15
+ ## Required content
16
+
17
+ The request artifact is the **verdict carrier** — it must include: QA verdict (`pass` / `return-to-rd` / `blocked`), the red-line audit outcome, links to the test-cases and test-report, the boundary check (acceptance items covered, gaps), and any cross-skill handoff notes for Solo. The test cases file enumerates every scenario with status; the test report summarises execution and links the security / performance / regression companion files.
18
+
19
+ ## Rules
20
+
21
+ The 3-file split is load-bearing. Do not merge. Use the `<request-id>` PRD assigned (`YYYY-MM-DD-<kebab-slug>`). QA may also produce companion artifacts (regression matrix, sanitized browser evidence, security findings, performance findings) under the same `qa/` workspace and link them from these files. Sanitize MCP / network / browser evidence before writing. Do not commit unless the user or active profile authorizes durable retention. Verdict `pass` is blocked while any of the three files is missing or the request artifact is in `draft` / `running` state.
22
+
23
+ ## External-skill invocation guard
10
24
 
11
- The 3-file split is load-bearing. Do not merge. Use the `<request-id>` PRD assigned (`YYYY-MM-DD-<kebab-slug>`). QA may also produce companion artifacts (regression matrix, sanitized browser evidence, security findings, performance findings) under the same `qa/` workspace and link them from these files. Sanitize MCP / network / browser evidence before writing. Do not commit unless the user or active profile authorizes durable retention. Verdict `pass` is blocked while any of the three files is missing or the request artifact is in `draft` / `running` state.
25
+ When QA references external material (mattpocock/skills, gstack, superpowers, etc.) treat it as reference only: do not execute upstream installer, do not run upstream installer commands, do not persist sensitive upstream examples to the working tree. Peaks-Cli artifacts, Peaks-Cli gates, and Peaks-Cli acceptance criteria remain authoritative.
@@ -7,14 +7,14 @@
7
7
  > `qa/performance-findings-<rid>.md` references this baseline by path +
8
8
  > hash.
9
9
 
10
- ## Location
10
+ ## File location
11
11
 
12
12
  `.peaks/_runtime/<sessionId>/qa/perf-baseline.md`. The CLI is
13
13
  `peaks workflow plan read perf --project <repo> --json` /
14
14
  `peaks workflow plan refresh perf --project <repo> --apply` /
15
15
  `peaks workflow plan detect-trigger --project <repo> --rid <rid> --json`.
16
16
 
17
- ## Generation workflow
17
+ ## Perf generation workflow
18
18
 
19
19
  1. `peaks workflow plan read perf --project <repo> --json` — return the
20
20
  existing baseline envelope. When missing, proceed to step 2.
@@ -30,7 +30,7 @@
30
30
  (lighthouse / k6 / autocannon output) — see peaks-rd's
31
31
  `mandatory-perf-baseline.md` for the RD-side measurement workflow.
32
32
 
33
- ## Content schema (deterministic — body is normalized before hashing)
33
+ ## Perf content schema (deterministic)
34
34
 
35
35
  - `## CLI Command Inventory` — auto-enumerated from
36
36
  `src/cli/commands/*-commands.ts`. Sorted alphabetically.
@@ -39,7 +39,7 @@
39
39
  actual numbers (CLI does not call measurement tools).
40
40
  - `## Thresholds` — placeholder; RD fills per-route thresholds.
41
41
 
42
- ## Refresh trigger table (shared with security plan)
42
+ ## Perf refresh trigger table (shared with security plan)
43
43
 
44
44
  | Signal | Reason string | Re-generates the baseline? |
45
45
  |---|---|---|
@@ -51,7 +51,7 @@
51
51
  | devDependencies change only | (none) | no — locked Q1 default |
52
52
  | Pure text edits to `rd/*` or `qa/test-cases/*` | (none) | no |
53
53
 
54
- ## Back-compat (1 minor release)
54
+ ## Perf back-compat (1 minor release)
55
55
 
56
56
  The pre-slice-025 non-suffixed `qa/performance-findings.md` is still
57
57
  accepted by `peaks workflow verify-pipeline` Gate C during the
@@ -59,7 +59,7 @@ accepted by `peaks workflow verify-pipeline` Gate C during the
59
59
  (`src/services/workflow/artifact-paths.ts`) handles the fallback and
60
60
  emits a `legacy-redirect` warning.
61
61
 
62
- ## CLI surface recap
62
+ ## Perf CLI surface recap
63
63
 
64
64
  | Command | Returns | JSON shape |
65
65
  |---|---|---|
@@ -1,4 +1,4 @@
1
- # Default runbook (QA)
1
+ ## Default runbook (QA)
2
2
 
3
3
  > Body of `## Default runbook` + numbered runbook steps #0–#9. The default sequence the QA skill should execute. Do not skip the boundary check, the unit test gate, the validation report, or — when frontend is in scope — the Playwright MCP browser gate.
4
4
 
@@ -15,9 +15,9 @@ Peaks-Cli RD owns engineering analysis, implementation planning, and refactor ex
15
15
 
16
16
  ## Hard contracts for browser self-test (BLOCKING — read before any browser_take_screenshot / login flow)
17
17
 
18
- For frontend or UI-affecting slices, RD's self-test uses the Playwright MCP headed browser. Two contracts (1) self-test screenshots land under `.peaks/_runtime/<sessionId>/qa/screenshots/`, (2) login / CAPTCHA / SSO / MFA is a hard block — surface with `AskUserQuestion` and pick one of three paths. The full contract is identical in spirit to `peaks-qa`'s; RD and QA share the headed-browser path.
18
+ For frontend / UI-affecting slices, RD's self-test uses the Playwright MCP headed browser. LLM checks its own tool list for the Playwright MCP entry; if absent, surface the install command (`claude mcp add playwright -- npx @playwright/mcp@latest`) and report the gate blocked. Do not silently downgrade to screenshots-only, manual steps, or chrome-devtools-mcp. Two contracts: (1) self-test screenshots land under `.peaks/_runtime/<sessionId>/qa/screenshots/`, (2) login / CAPTCHA / SSO / MFA is a hard block — surface with `AskUserQuestion`. Same in spirit as `peaks-qa`'s; RD and QA share the headed-browser path.
19
19
 
20
- → see `references/browser-self-test-contracts.md` for the full contract + AskUserQuestion options.
20
+ → see `references/browser-self-test-contracts.md`.
21
21
 
22
22
  ## Sub-agent dispatch (when launched by peaks-solo swarm)
23
23
 
@@ -44,15 +44,13 @@ When this skill is running in the main Claude session (not as a sub-agent — i.
44
44
 
45
45
  ## Mandatory per-request artifact
46
46
 
47
- Every RD invocation — feature, bug, refactor, clarification — must write a durable artifact at `.peaks/_runtime/<sessionId>/rd/requests/<request-id>.md`. This is the canonical engineering record for that request; handoff to QA/SC is blocked while the artifact is missing or its state is `draft` or `spec-locked` without implementation evidence.
47
+ Every RD invocation — feature, bug, refactor, clarification — must write a durable artifact at `.peaks/<session-id>/rd/requests/<request-id>.md` (the canonical placeholder form: `<session-id>` is the active session id at runtime, `<request-id>` follows the `YYYY-MM-DD-<kebab-slug>` format; the runtime path is `.peaks/_runtime/<session-id>/rd/requests/<request-id>.md`). This is the canonical engineering record for that request; handoff to QA/SC is blocked while the artifact is missing or its state is `draft` or `spec-locked` without implementation evidence. Codegraph context lives at `.peaks/<session-id>/rd/codegraph-context.md`.
48
48
 
49
49
  → see `references/artifact-per-request.md` for the template + the "two RD artifact files" rule (per-slice vs per-session scope).
50
50
 
51
51
  ## Default runbook
52
52
 
53
- The default sequence the RD skill should execute for a code-touching request. Skip steps that do not apply to the request type; do not skip the artifact, coverage gate, or red-line scope steps. The full 9-step runbook (steps #0–#8) with every CLI invocation, project-scan BLOCKING rule, component-library detection, CSS framework conflict check, and 6 transition gates is in the references file.
54
-
55
- → see `references/rd-runbook.md` for the full runbook.
53
+ See `references/rd-runbook.md` for the full 9-step runbook (steps #0–#8) with every CLI invocation, project-scan BLOCKING rule, component-library detection, CSS framework conflict check, and 6 transition gates.
56
54
 
57
55
  ## RD gate index
58
56
 
@@ -108,11 +106,22 @@ RD cannot mark a development slice complete until all of these are true. Each ga
108
106
 
109
107
  If any gate fails, return to development for fixes or hand off as blocked. Do not describe the work as done, shippable, or ready for QA.
110
108
 
111
- ## Parallel review fan-out (code-review + security-review + perf-baseline + qa-test-cases)
109
+ ## Parallel review fan-out (code-reviewer + security-reviewer + perf-baseline-reviewer + qa-test-cases-writer)
110
+
111
+ **When RD reaches the end of implementation, the four review activities run in parallel via `peaks sub-agent dispatch <role>`, not sequentially.** This is the same fan-out pattern peaks-solo uses for the post-PRD swarm. The four sub-agents are `code-reviewer` (code-review evidence), `security-reviewer` (security-review evidence), `perf-baseline-reviewer` (perf-baseline measurement), and `qa-test-cases-writer` (qa/test-cases/<rid>.md). Feature / refactor: all four. Bugfix: code-reviewer + security-reviewer + qa-test-cases-writer always; perf-baseline-reviewer only when perf-shaped. Config / docs / chore: no fan-out. B3 augmentation: ocr (user-owned LLM config at `peaksConfig.ocr.llm`, injected as env vars) → `peaks code-review run-ocr --json` → merge into `code-review.md`; → `references/ocr-integration.md`.
112
+
113
+ ### Peaks-Cli Gate C — type-specific RD evidence
114
+
115
+ The CLI gate at `rd:qa-handoff` is the authoritative check. Missing any required file → DO NOT attempt the qa-handoff transition; CLI will reject with `PREREQUISITES_MISSING`.
112
116
 
113
- **When RD reaches the end of implementation, the four review activities run in parallel via `peaks sub-agent dispatch <role>`, not sequentially.** This is the same fan-out pattern peaks-solo uses for the post-PRD swarm. Feature / refactor: all four. Bugfix: code-review + security-review + qa-test-cases always; perf-baseline only when perf-shaped. Config / docs / chore: no fan-out.
117
+ | Request type | Required RD evidence (under `.peaks/<id>/`) |
118
+ |---|---|
119
+ | feature / refactor | `rd/tech-doc.md` + `rd/code-review.md` + `rd/security-review.md` + `rd/perf-baseline.md` + `qa/test-cases/<rid>.md` |
120
+ | bugfix | `rd/bug-analysis.md` + `rd/code-review.md` + `rd/security-review.md` + `qa/test-cases/<rid>.md` (rd/perf-baseline.md only when perf-shaped) |
121
+ | config | `rd/security-review.md` |
122
+ | docs / chore | (no extra evidence required) |
114
123
 
115
- → see `references/parallel-review-fanout.md` for the dispatch template + the 4 sub-agents' contracts + aggregation + degradation.
124
+ → see `references/rd-fanout-contracts.md` for the 4 sub-agents' contracts + hard prohibitions + aggregation + degradation.
116
125
 
117
126
  ## Refactor hard gates
118
127
 
@@ -162,7 +171,13 @@ Before RD work stops, finishes, blocks, or hands off to another role, emit a sho
162
171
 
163
172
  ## External references
164
173
 
165
- Matt Pocock skills (diagnose / triage / tdd / improve-codebase-architecture / prototype): engineering references only. Inspect before applying; Peaks-Cli RD gates remain authoritative. Understand Anything: `peaks understand status/show --json`. Codegraph: local analysis only, never commit `.codegraph/` artifacts. Other external resources: `peaks capabilities --source access-repo/mcp-server --json` for capability discovery.
174
+ ## Codegraph project analysis
175
+
176
+ Codegraph is local project-analysis evidence, scoped to red-line scope boundaries (changed files / symbols) and read via `peaks codegraph affected --project <path> <changed-files...> --json`. Peaks-Cli RD gates remain authoritative; codegraph is untrusted supporting evidence. Do not let codegraph output drive scope, design, or QA verdict decisions, and never mutate agent settings, Claude settings, or hooks from codegraph. Do not commit `.codegraph/` artifacts or persist generated `.codegraph/` databases into git. Codegraph context is written to `.peaks/<session-id>/rd/codegraph-context.md` for handoff to QA / TXT.
177
+
178
+ ## Matt Pocock skills integration
179
+
180
+ Matt Pocock skills (`diagnose` / `triage` / `tdd` / `improve-codebase-architecture` / `prototype`): engineering references only. Inspect before applying; Peaks-Cli RD gates remain authoritative. Understand Anything: `peaks understand status/show --json`. Codegraph: local analysis only, never commit `.codegraph/` artifacts. Other external resources: `peaks capabilities --source access-repo/mcp-server --json` for capability discovery.
166
181
 
167
182
  → see `references/external-references.md` + `references/matt-pocock-integration.md` + `references/codegraph-project-analysis.md`.
168
183
 
@@ -0,0 +1,214 @@
1
+ # OCR (Open Code Review) integration
2
+
3
+ > Soft-optional second-opinion code review for peaks-rd Gate B3.
4
+ > Mirrors the ECC 64-agents pattern (spec §7.2): peaks-cli ships
5
+ > `@alibaba-group/open-code-review` as a **required dependency** and
6
+ > reads the LLM endpoint config from `peaksConfig.ocr.llm` in the
7
+ > user's `~/.peaks/config.json` (single source of truth, user-managed).
8
+ > When present + configured, the wrapper turns the output into
9
+ > structured `code-review.md` evidence.
10
+
11
+ ## What ocr is
12
+
13
+ [Open Code Review](https://github.com/alibaba/open-code-review) is
14
+ an AI-powered code review CLI from Alibaba. It reads git diffs,
15
+ sends the changed files to a **user-configured LLM endpoint**
16
+ (OpenAI- or Anthropic-compatible), and emits structured
17
+ line-precise review comments. It is NOT a hosted service —
18
+ all LLM traffic goes to the user's own configured endpoint.
19
+
20
+ Distribution: npm `@alibaba-group/open-code-review` (Go binary
21
+ inside; the npm postinstall downloads the platform-specific
22
+ binary from GitHub Releases).
23
+
24
+ ## Why peaks-rd uses it (soft-optional)
25
+
26
+ The default peaks-rd code-review evidence is produced by the
27
+ main RD LLM (or the `code-reviewer` sub-agent in the parallel
28
+ fan-out). That's one pair of eyes. When ocr is available, the
29
+ wrapper adds a **second pair** — an independent LLM tuned for
30
+ code review — and the two reviews are merged into the same
31
+ `code-review.md` file. Soft-optional: if ocr isn't installed or
32
+ configured, RD proceeds with the LLM-only review and the slice
33
+ ships without the second opinion.
34
+
35
+ ## Install
36
+
37
+ `@alibaba-group/open-code-review` is a **required `dependency`** of
38
+ peaks-cli 2.0.1+. `npm i -g peaks-cli` pulls it automatically and
39
+ downloads the platform binary in the postinstall step. Verify with:
40
+
41
+ ```bash
42
+ peaks code-review detect-ocr --json
43
+ ```
44
+
45
+ Five possible states:
46
+
47
+ | state | Meaning | Recovery |
48
+ |---|---|---|
49
+ | `ready` | Installed + binary downloaded + peaks-cli's `peaksConfig.ocr.llm` valid | Nothing — `run-ocr` will work. |
50
+ | `package-missing` | npm dep not installed (corrupt node_modules, or user removed it) | `npm i -g @alibaba-group/open-code-review` (peaks-cli 2.0.1+ does this automatically; this state is rare) |
51
+ | `binary-missing` | npm dep present but Go binary did not download | `pnpm approve-builds @alibaba-group/open-code-review`, OR run `node node_modules/@alibaba-group/open-code-review/scripts/install.js`, OR manually fetch from https://github.com/alibaba/open-code-review/releases and place the binary at the path shown in `nextActions[2]`. |
52
+ | `config-missing` | binary present but `peaksConfig.ocr.llm` is empty or partial | See "Configure" below. |
53
+ | `detection-failed` | Unexpected error during detection | Inspect stderr; re-run probe. |
54
+
55
+ ## Configure (one-time, per user) — peaks-cli does NOT auto-configure
56
+
57
+ The LLM endpoint config is **user-maintained inside peaks-cli's own
58
+ config** at `~/.peaks/config.json` under the `ocr.llm` key. The user
59
+ is the only party that touches their LLM token / URL / model. peaks-cli
60
+ never auto-writes the config and never writes `~/.opencodereview/config.json`.
61
+
62
+ ```bash
63
+ # 1) Print the JSON snippet to paste (read-only, no side effects):
64
+ peaks code-review config-template --json
65
+
66
+ # 2) Paste the snippet into ~/.peaks/config.json under "ocr.llm",
67
+ # replace <your-api-key> with your real key. Alternatively,
68
+ # set keys one at a time:
69
+ peaks config set --key ocr.llm.url --value 'https://api.example.com/v1/messages'
70
+ peaks config set --key ocr.llm.authToken --value '<your-key>'
71
+ peaks config set --key ocr.llm.model --value 'claude-3-5-sonnet-latest'
72
+ peaks config set --key ocr.llm.useAnthropic --value 'true'
73
+ peaks config set --key ocr.llm.authHeader --value 'x-api-key'
74
+
75
+ # 3) Verify readiness (peaks-rd also runs this automatically):
76
+ peaks code-review detect-ocr --json
77
+ ```
78
+
79
+ ### Field map: `peaksConfig.ocr.llm` ↔ ocr subprocess env vars
80
+
81
+ peaks-rd calls ocr with the `peaksConfig.ocr.llm` values **injected as
82
+ env vars** (ocr's highest-priority config path). The mapping is:
83
+
84
+ | `peaksConfig.ocr.llm.*` | Spawn env var | Notes |
85
+ |---|---|---|
86
+ | `url` | `OCR_LLM_URL` | HTTPS endpoint, no embedded credentials |
87
+ | `authToken` | `OCR_LLM_TOKEN` | Sensitive — stored only in the user-layer `~/.peaks/config.json`; `peaks config get` redacts this field |
88
+ | `model` | `OCR_LLM_MODEL` | e.g. `claude-3-5-sonnet-latest` |
89
+ | `useAnthropic` | `OCR_USE_ANTHROPIC` | Boolean; serialised as `"true"` / `"false"` |
90
+ | `authHeader` | `OCR_LLM_AUTH_HEADER` | One of `authorization` (default Bearer), `x-api-key` (for `sk-ant-*` keys), or `bearer` |
91
+
92
+ The `~/.opencodereview/config.json` file the user might have set up
93
+ for 2.0.0 is no longer consulted by peaks-cli. The user may delete it
94
+ at their discretion — the ocr subprocess ignores the file when peaks-
95
+ cli's env vars are present (and the env-var surface is highest priority).
96
+
97
+ ### Required vs optional fields
98
+
99
+ The minimum for `state == "ready"` is the **url + authToken + model**
100
+ triple. `useAnthropic` and `authHeader` are optional; `authHeader`
101
+ defaults to `authorization` (Bearer) inside the ocr subprocess, but
102
+ `sk-ant-*` keys require `authHeader: "x-api-key"`.
103
+
104
+ When the user has not yet populated the config, `detect-ocr` returns
105
+ `state: "config-missing"` with `missingKeys: ["ocr.llm.url",
106
+ "ocr.llm.authToken", "ocr.llm.model"]` and a templated
107
+ `nextActions[1]` payload that includes the JSON snippet to paste.
108
+
109
+ ## Use from peaks-rd (LLM workflow)
110
+
111
+ In Gate B3 (code review evidence), before writing
112
+ `.peaks/_runtime/<sid>/rd/code-review.md`, the code-reviewer
113
+ sub-agent runs:
114
+
115
+ ```bash
116
+ # 1. Detect
117
+ peaks code-review detect-ocr --json
118
+ # 2. If state == "ready", run the review
119
+ peaks code-review run-ocr --json --project . --from origin/main --to HEAD
120
+ ```
121
+
122
+ The `run-ocr` envelope is:
123
+
124
+ ```jsonc
125
+ {
126
+ "ok": true,
127
+ "command": "code-review.run-ocr",
128
+ "data": {
129
+ "spawned": true,
130
+ "state": "ready",
131
+ "exitCode": 0,
132
+ "stdout": "...",
133
+ "stderr": "",
134
+ "durationMs": 12345,
135
+ "parsed": {
136
+ "findings": [
137
+ { "file": "src/foo.ts", "line": 42, "severity": "minor", "message": "..." }
138
+ ]
139
+ },
140
+ "warnings": [],
141
+ "nextActions": []
142
+ },
143
+ ...
144
+ }
145
+ ```
146
+
147
+ Merge `data.parsed.findings` into `code-review.md` under
148
+ `## Second opinion (ocr)`. Cite each finding by file + line.
149
+ Reconcile disagreements with the LLM-only review explicitly
150
+ (don't silently drop one source).
151
+
152
+ ## Soft-fail policy
153
+
154
+ `peaks code-review run-ocr` **never** sets a non-zero exit code,
155
+ even when ocr is not ready or the subprocess fails. The envelope
156
+ `ok` field carries the success signal; the caller (peaks-rd) is
157
+ expected to pattern-match on `data.state` and proceed without the
158
+ second opinion if needed. This matches the ECC 64-agents
159
+ soft-fail policy and the peaks-cli "minimal user operation"
160
+ tenet — missing ocr should never block a slice.
161
+
162
+ ## Security
163
+
164
+ - ocr sends your changed files to whatever LLM endpoint you
165
+ configure. Treat this the same as any external code-review
166
+ tool you opt into: don't point it at a free public endpoint
167
+ for proprietary code; use a vendor / self-hosted endpoint with
168
+ appropriate data controls.
169
+ - peaks-cli does NOT auto-configure ocr. Your `ocr.llm.authToken`
170
+ is yours. Rotate as needed. The token is stored only in the
171
+ user-layer `~/.peaks/config.json` (project layer rejects writes
172
+ to any key matching `isSensitiveConfigPath`), and
173
+ `peaks config get` redacts it as `***`.
174
+ - peaks-cli's wrapper records ocr's `stdout` verbatim in the
175
+ envelope (and in `code-review.md` when peaks-rd merges
176
+ findings). Don't put secrets in your code being reviewed.
177
+ - The `peaks code-review config-template` snippet embeds the
178
+ placeholder string `<your-api-key>`; the user is expected to
179
+ replace it before pasting.
180
+
181
+ ## Failure modes (real)
182
+
183
+ These are the actual failure modes the wrapper has been
184
+ dogfooded against:
185
+
186
+ 1. **Network blocked from GitHub Releases** during postinstall →
187
+ `binary-missing`. peaks-cli still runs cleanly because ocr
188
+ is detected as not-ready; user manually fetches the binary
189
+ and places it at `nextActions[2]`'s path.
190
+ 2. **pnpm-installed peaks-cli** → ocr postinstall blocked by
191
+ pnpm's safe-by-default policy → `binary-missing`. Recover
192
+ with `pnpm approve-builds @alibaba-group/open-code-review`.
193
+ 3. **No / partial LLM config** → `config-missing` with
194
+ `missingKeys` listing the unpopulated fields. Recover by
195
+ pasting the `peaks code-review config-template` output into
196
+ `~/.peaks/config.json` (or by `peaks config set` per-key).
197
+ 4. **Wrong key / wrong endpoint** → ocr subprocess exits non-zero;
198
+ wrapper soft-fails (`ok: false`, `warnings[0]` includes the
199
+ exit code, `stderr` carries ocr's own error message).
200
+ 5. **User 2.0.0 → 2.0.1 migration** — they configured
201
+ `~/.opencodereview/config.json` for 2.0.0; peaks-cli 2.0.1
202
+ no longer reads that file. They paste the same values into
203
+ `~/.peaks/config.json` under `ocr.llm` (peaks-cli handles the
204
+ camelCase conversion in the template).
205
+
206
+ ## See also
207
+
208
+ - ocr upstream: https://github.com/alibaba/open-code-review
209
+ - peaks-cli source: `src/services/code-review/ocr-service.ts`,
210
+ `src/cli/commands/code-review-commands.ts`
211
+ - peaks-cli config schema: `src/services/config/config-types.ts`
212
+ (`OcrLlmConfig`, `OcrConfig`, `PeaksConfig.ocr?`)
213
+ - ECC 64-agents soft-optional pattern (mirrored):
214
+ `src/services/agent/ecc-agent-service.ts`
@@ -0,0 +1,70 @@
1
+ # peaks-rd 4-way parallel fan-out (slice 004)
2
+
3
+ The Parallel review fan-out is the canonical RD-side review pattern: at the
4
+ end of implementation, RD fires 4 sub-agents in parallel via
5
+ `peaks sub-agent dispatch <role>` instead of running them sequentially.
6
+
7
+ ## The 4 sub-agents
8
+
9
+ - **Sub-agent 1 — code-reviewer** runs `code-review` against the diff and
10
+ writes `rd/code-review.md`.
11
+ - **Sub-agent 2 — security-reviewer** runs `security-review` against the
12
+ changed surface and writes `rd/security-review.md`.
13
+ - **Sub-agent 3 — perf-baseline-reviewer** measures the perf surface
14
+ (slice 025) and writes `rd/perf-baseline.md`. Skipped when the slice
15
+ has no perf surface (e.g. config / docs / chore) or when the bugfix
16
+ is not perf-shaped.
17
+ - **Sub-agent 4 — qa-test-cases-writer** drafts the QA test plan and
18
+ writes `qa/test-cases/<rid>.md`. The test plan is the deliverable —
19
+ these test cases do NOT need to be executed by this sub-agent (the
20
+ QA reviewer executes them in Gate D). Do NOT write to `tests/`; the
21
+ writer's only write target is `qa/test-cases/<rid>.md`.
22
+
23
+ ## Hard prohibitions on all 4 sub-agents (single block)
24
+
25
+ - Sub-agents are spawned via `Skill(skill="...")` and run in their own
26
+ conversation context. They MUST NOT mutate parent settings
27
+ (`peaks skill presence:set`, hooks install, `.claude/settings.json`).
28
+ - Sub-agents MUST NOT call `peaks workflow verify-pipeline` — that is
29
+ Solo's responsibility.
30
+ - Sub-agents MUST NOT modify the request artifact body — they only
31
+ write their respective review artifact.
32
+ - Sub-agents MUST NOT install or persist external material (no
33
+ `npm install` of unapproved packages, no Playwright MCP install).
34
+ - Sub-agents return a compact JSON envelope
35
+ (`{ ok, artifact, blockers, notes }`) to the parent RD loop; the
36
+ parent aggregates into the final qa-handoff.
37
+
38
+ ## Aggregation
39
+
40
+ The parent RD loop receives the 4 envelopes, runs `peaks request lint`
41
+ on the produced artifacts, and only then attempts
42
+ `peaks request transition --state qa-handoff`. The aggregation step
43
+ runs 4 ls checks: Gate B3 (code-review file), Gate B4 (security-review
44
+ file), Gate B9 (perf-baseline file, when the slice has a perf
45
+ surface), and the `qa-test-cases` pre-draft (the 4th sub-agent's
46
+ deliverable). A failure in any of the 4 sub-agents → blocked, no
47
+ auto-downgrade.
48
+
49
+ ## Degradation
50
+
51
+ When the `qa-test-cases-writer` sub-agent fails, the parent RD loop
52
+ records the failure as `qa-test-cases-subagent-degraded-to-inline-qa-draft`
53
+ in the request artifact and proceeds; the QA main loop falls back to
54
+ drafting the test plan inline at Gate D. The other 3 sub-agents
55
+ (code-reviewer, security-reviewer, perf-baseline-reviewer) are NOT
56
+ degradeable — their failure blocks qa-handoff.
57
+
58
+ ## Gate C evidence (RD-side, type-specific)
59
+
60
+ | Request type | Required RD evidence (under `.peaks/<id>/`) |
61
+ |---|---|
62
+ | feature / refactor | `rd/tech-doc.md` + `rd/code-review.md` + `rd/security-review.md` + `rd/perf-baseline.md` + `qa/test-cases/<rid>.md` |
63
+ | bugfix | `rd/bug-analysis.md` + `rd/code-review.md` + `rd/security-review.md` + `qa/test-cases/<rid>.md` (rd/perf-baseline.md only when perf-shaped) |
64
+ | config | `rd/security-review.md` |
65
+ | docs / chore | (no extra evidence required) |
66
+
67
+ Always required (in addition to the type-specific row):
68
+ `ls .peaks/<id>/rd/requests/<rid>.md`. Missing any required file →
69
+ DO NOT attempt the qa-handoff transition; CLI will reject with
70
+ `PREREQUISITES_MISSING`.
@@ -1,4 +1,4 @@
1
- # Default runbook (RD)
1
+ ## Default runbook (RD)
2
2
 
3
3
  > Body of `## Default runbook` + numbered runbook steps #0–#8. The default sequence the RD skill should execute for a code-touching request. Skip steps that do not apply to the request type; do not skip the artifact, coverage gate, or red-line scope steps.
4
4
 
@@ -72,6 +72,12 @@ After Step 0 anchored the workspace, run the resume-detection probe (one `find`
72
72
 
73
73
  → see `references/resume-detection.md` for the full detection algorithm + classification table.
74
74
 
75
+ ### Peaks-Cli Step 0.55: 1.x → 2.0 detection (BLOCKING on first invocation per session, when the project is not on a 2.0 layout)
76
+
77
+ Per the "one-key completion" tenet (2026-06-11), peaks-cli 2.0 should detect a 1.x consumer project and prompt the user to upgrade. After Step 0.7 returns "fresh" (no in-flight slice), run the 1.x detection probe: `peaks upgrade --detect-1x --project <root> --json`. If the result is `isOneX: true`, surface an `AskUserQuestion` with the upgrade prompt. Persist the decision to `.peaks/preferences.json` (key: `autoUpgradePrompt` with values `opt-in` / `skip-this-session` / `skip-forever`) so subsequent runs in the same project don't re-ask.
78
+
79
+ → see `references/step-0-55-1x-detection.md` for the full detection algorithm + AskUserQuestion options + persistence contract.
80
+
75
81
  ### Peaks-Cli Step 1: Mode selection
76
82
 
77
83
  When the user did not name a profile (`full-auto` / `assisted` / `swarm` / `strict`), use `AskUserQuestion` with `Full auto (Recommended)` as the first option. Map the choice to `--mode` value.
@@ -185,21 +191,21 @@ Five CLI commands harden the workflow against silent skips: `peaks request lint`
185
191
 
186
192
  ## Peaks-Cli Completion handoff
187
193
 
188
- After final validation, refresh project-local standards via `peaks standards init/update` (never hand-write). Use Peaks-Cli TXT for the compact handoff capsule: mode, validated decisions, artifact paths, standards deltas, open questions, next action. Do NOT call `peaks skill presence:clear --project <repo>` at workflow end (presence remains active for follow-ups).
194
+ After final validation, refresh project-local standards via `peaks standards init/update` (never hand-write). Use Peaks-Cli TXT for the compact handoff capsule: mode, validated decisions, artifact paths, standards deltas, open questions, next action. **Presence management is delegated to the last downstream skill in the workflow** — peaks-solo does not call `peaks skill presence:clear` itself, and does not enforce a "no clear" rule. The downstream skills (peaks-rd, peaks-qa, peaks-txt) each manage their own presence per their respective SKILL.md.
189
195
 
190
196
  → see `references/completion-handoff.md` for the full handoff + "no auto-exit" rule.
191
197
 
192
198
  ## Peaks-Cli External references and lifecycle
193
199
 
194
- Inventory of 3rd-party integrations (codegraph, mattpocock/skills, shadcn/ui, MCPs, Context7). Three-stage pattern: capability discovery via `peaks capabilities` → references only → Peaks-Cli CLI for side effects.
200
+ Inventory of 3rd-party integrations (codegraph, mattpocock/skills, shadcn/ui, MCPs, Context7). Three-stage pattern: capability discovery via `peaks capabilities` → references only → Peaks-Cli CLI for side effects. Peaks-Cli artifacts and Peaks-Cli acceptance criteria remain authoritative; do not execute upstream installer scripts; MCP servers (Playwright MCP, Chrome DevTools MCP, Figma Context MCP) are not managed by peaks-cli — the LLM checks its own tool list for `mcp__<server>__*` entries; if absent, the user installs via the IDE-native install command (e.g. `claude mcp add playwright -- npx @playwright/mcp@latest` for Claude Code).
195
201
 
196
- → see `references/external-references.md` for the full inventory + lifecycle rules.
202
+ → see `references/external-references.md` for the full inventory + lifecycle rules, and `references/external-skill-invocation.md` for the three-stage (Discovery → Reference → Side effect through Peaks CLI only) contract + the do-not-execute / do-not-persist / tool-list self-check rules.
197
203
 
198
204
  ## Codegraph orchestration context
199
205
 
200
- Solo treats `peaks codegraph affected --project <path> <changed-files...> --json` as optional project-analysis enhancement. Output is untrusted supporting evidence — never treat as approval for scope, design, or QA verdict.
206
+ Solo treats `peaks codegraph affected --project <path> <changed-files...> --json` as optional project-analysis enhancement. Output is untrusted supporting evidence — never treat as approval for scope, design, or QA verdict. Solo must not treat codegraph output as approval; never mutate agent settings, Claude settings, or hooks from codegraph; do not commit `.codegraph/` artifacts or persist generated `.codegraph/` databases into git. Solo coordinates codegraph context across the role handoff between RD (writes `.peaks/<session-id>/rd/codegraph-context.md`) and QA / TXT (consume the same envelope).
201
207
 
202
- → see `references/codegraph-orchestration.md` for the full contract.
208
+ → see `references/codegraph-orchestration.md` for the full contract (including the agent-settings / settings-mutation prohibition, the no-`.codegraph/` commit rule, and the role-handoff envelope).
203
209
 
204
210
  ## Sub-agent context governance (G7 + G7.7 + G8 + G9 — slice #010)
205
211
 
@@ -8,7 +8,9 @@ Use Peaks-Cli TXT for the compact handoff capsule: mode, validated decisions, ar
8
8
 
9
9
  ## Workflow completion (no auto-exit)
10
10
 
11
- Do NOT call `peaks skill presence:clear --project <repo>` at workflow end. The presence file and header remain active so the user stays inside the workflow context. The user can continue with follow-up requirements naturally no need to re-invoke `/peaks-solo`. The header continues to display the active skill and current gate.
11
+ peaks-solo does NOT itself call `peaks skill presence:clear --project <repo>` at workflow end. Presence management is delegated to the last downstream skill in the workflow (peaks-rd, peaks-qa, peaks-txt); each of those skills owns its own presence:clear step per its SKILL.md. peaks-solo only sets presence: it does not unset it.
12
+
13
+ The user can continue with follow-up requirements naturally — no need to re-invoke `/peaks-solo` to do so. The header continues to display whatever skill is active; the user can `/peaks-solo` again to re-anchor.
12
14
 
13
15
  Before ending, extract durable memories from this session:
14
16
  ```bash