peaks-loop 4.0.0-beta.9 → 4.0.1

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 (552) hide show
  1. package/CHANGELOG.md +910 -141
  2. package/README-en.md +26 -7
  3. package/README.md +75 -6
  4. package/agents/karpathy-reviewer.md +33 -0
  5. package/bin/peaks.js +0 -0
  6. package/dist/cli/cli-helpers.d.ts +31 -6
  7. package/dist/cli/cli-helpers.js +48 -25
  8. package/dist/cli/commands/_register.d.ts +3 -0
  9. package/dist/cli/commands/_register.js +139 -0
  10. package/dist/cli/commands/_super.d.ts +10 -0
  11. package/dist/cli/commands/_super.js +97 -0
  12. package/dist/cli/commands/adapter-commands-s2a.js +1 -1
  13. package/dist/cli/commands/asset-commands.js +33 -16
  14. package/dist/cli/commands/audit-commands.js +2 -2
  15. package/dist/cli/commands/autonomous-swarm-commands.d.ts +12 -0
  16. package/dist/cli/commands/autonomous-swarm-commands.js +120 -0
  17. package/dist/cli/commands/bee-commands.js +1 -1
  18. package/dist/cli/commands/capability-commands.js +1 -1
  19. package/dist/cli/commands/capability-worker-config-sc-commands.js +0 -2
  20. package/dist/cli/commands/changeset-commands.d.ts +13 -0
  21. package/dist/cli/commands/changeset-commands.js +46 -0
  22. package/dist/cli/commands/code-commands.d.ts +11 -1
  23. package/dist/cli/commands/code-commands.js +19 -699
  24. package/dist/cli/commands/code-job-shape-commands.d.ts +9 -0
  25. package/dist/cli/commands/code-job-shape-commands.js +164 -0
  26. package/dist/cli/commands/code-mode-gate-commands.d.ts +9 -0
  27. package/dist/cli/commands/code-mode-gate-commands.js +223 -0
  28. package/dist/cli/commands/code-review-commands.js +2 -2
  29. package/dist/cli/commands/code-run-command.d.ts +12 -0
  30. package/dist/cli/commands/code-run-command.js +68 -0
  31. package/dist/cli/commands/code-runtime-commands.d.ts +11 -0
  32. package/dist/cli/commands/code-runtime-commands.js +391 -0
  33. package/dist/cli/commands/codegraph-commands.js +1 -1
  34. package/dist/cli/commands/compact-command.js +53 -1
  35. package/dist/cli/commands/complexity-commands.js +1 -1
  36. package/dist/cli/commands/config-commands.js +4 -75
  37. package/dist/cli/commands/container-commands.d.ts +28 -0
  38. package/dist/cli/commands/container-commands.js +221 -0
  39. package/dist/cli/commands/context-commands.js +3 -2
  40. package/dist/cli/commands/core/artifacts-command.js +1 -1
  41. package/dist/cli/commands/core/binding-commands.js +1 -1
  42. package/dist/cli/commands/core/doctor-command.js +63 -3
  43. package/dist/cli/commands/core/memory-command.js +1 -1
  44. package/dist/cli/commands/core/profile-command.js +1 -1
  45. package/dist/cli/commands/core/proxy-command.js +1 -1
  46. package/dist/cli/commands/core/session-command.js +9 -7
  47. package/dist/cli/commands/core/skill-command.js +7 -4
  48. package/dist/cli/commands/core/standards-command.js +1 -1
  49. package/dist/cli/commands/cron-commands.d.ts +57 -0
  50. package/dist/cli/commands/cron-commands.js +257 -0
  51. package/dist/cli/commands/cron-scheduler-commands.d.ts +47 -0
  52. package/dist/cli/commands/cron-scheduler-commands.js +284 -0
  53. package/dist/cli/commands/dashboard-commands.d.ts +4 -0
  54. package/dist/cli/commands/dashboard-commands.js +10 -0
  55. package/dist/cli/commands/dashboard-long-run.d.ts +25 -0
  56. package/dist/cli/commands/dashboard-long-run.js +122 -0
  57. package/dist/cli/commands/dashboard-summary.d.ts +12 -0
  58. package/dist/cli/commands/dashboard-summary.js +58 -0
  59. package/dist/cli/commands/dispatch-commands.d.ts +0 -7
  60. package/dist/cli/commands/dispatch-commands.js +372 -8
  61. package/dist/cli/commands/dispatch-from-dag.js +4 -1
  62. package/dist/cli/commands/doc-commands.js +1 -1
  63. package/dist/cli/commands/ecc-commands.d.ts +30 -0
  64. package/dist/cli/commands/ecc-commands.js +119 -0
  65. package/dist/cli/commands/evolution-commands.js +1 -1
  66. package/dist/cli/commands/feedback-commands.js +1 -1
  67. package/dist/cli/commands/final-review-commands.js +1 -1
  68. package/dist/cli/commands/fixture-commands.js +1 -1
  69. package/dist/cli/commands/fork-commands.js +1 -1
  70. package/dist/cli/commands/gate-commands.js +128 -6
  71. package/dist/cli/commands/governance-classify-contract-commands.d.ts +21 -0
  72. package/dist/cli/commands/governance-classify-contract-commands.js +273 -0
  73. package/dist/cli/commands/heartbeat-commands.js +76 -5
  74. package/dist/cli/commands/heartbeat-watch-command.d.ts +31 -0
  75. package/dist/cli/commands/heartbeat-watch-command.js +146 -0
  76. package/dist/cli/commands/hook-handle.js +1 -1
  77. package/dist/cli/commands/hooks-commands.js +126 -10
  78. package/dist/cli/commands/ide-commands.js +1 -1
  79. package/dist/cli/commands/impact-commands.js +1 -1
  80. package/dist/cli/commands/job-commands.js +34 -1
  81. package/dist/cli/commands/lease-metrics-commands.d.ts +67 -0
  82. package/dist/cli/commands/lease-metrics-commands.js +231 -0
  83. package/dist/cli/commands/lease-stats-commands.d.ts +65 -0
  84. package/dist/cli/commands/lease-stats-commands.js +107 -0
  85. package/dist/cli/commands/legacy-commands.js +1 -1
  86. package/dist/cli/commands/log-commands.js +1 -1
  87. package/dist/cli/commands/loop-commands.js +1 -1
  88. package/dist/cli/commands/loop-eval-commands.js +1 -1
  89. package/dist/cli/commands/memory-commands.js +1 -1
  90. package/dist/cli/commands/migrate-1-4-1-command.js +1 -1
  91. package/dist/cli/commands/migrate-v2-10-to-v2-11-command.js +1 -1
  92. package/dist/cli/commands/mut-commands.d.ts +1 -1
  93. package/dist/cli/commands/mut-commands.js +1 -5
  94. package/dist/cli/commands/observability-commands.js +1 -1
  95. package/dist/cli/commands/openspec-commands.js +65 -4
  96. package/dist/cli/commands/perf-audit-commands.js +3 -3
  97. package/dist/cli/commands/perf-commands.js +1 -1
  98. package/dist/cli/commands/polyrepo-commands.js +1 -1
  99. package/dist/cli/commands/prd-blocks-commands.js +1 -1
  100. package/dist/cli/commands/prd-commands.js +4 -2
  101. package/dist/cli/commands/preferences-commands.js +23 -3
  102. package/dist/cli/commands/project-commands.js +1 -1
  103. package/dist/cli/commands/qa-business-review-commands.js +1 -1
  104. package/dist/cli/commands/qa-commands.d.ts +1 -1
  105. package/dist/cli/commands/qa-commands.js +39 -3
  106. package/dist/cli/commands/release-commands.d.ts +15 -0
  107. package/dist/cli/commands/release-commands.js +113 -21
  108. package/dist/cli/commands/request-commands.js +1 -1
  109. package/dist/cli/commands/retrospective-commands.js +1 -1
  110. package/dist/cli/commands/reviewer-commands.js +1 -1
  111. package/dist/cli/commands/role-commands.js +1 -1
  112. package/dist/cli/commands/runtime-commands-helpers.d.ts +7 -0
  113. package/dist/cli/commands/runtime-commands-helpers.js +24 -0
  114. package/dist/cli/commands/runtime-commands.js +1 -2
  115. package/dist/cli/commands/sc-commands.js +4 -2
  116. package/dist/cli/commands/scan-commands.js +1 -1
  117. package/dist/cli/commands/security-audit-commands.js +3 -3
  118. package/dist/cli/commands/sediment-commands.js +10 -1
  119. package/dist/cli/commands/session-24h-mode.d.ts +26 -0
  120. package/dist/cli/commands/session-24h-mode.js +196 -0
  121. package/dist/cli/commands/share-commands.d.ts +19 -0
  122. package/dist/cli/commands/share-commands.js +121 -2
  123. package/dist/cli/commands/skill-conformance-commands.js +1 -1
  124. package/dist/cli/commands/skill-loop-engineering-readiness-commands.js +1 -1
  125. package/dist/cli/commands/skill-search-commands.js +4 -1
  126. package/dist/cli/commands/slice-commands.js +1 -1
  127. package/dist/cli/commands/slice-integrate-commands.js +1 -1
  128. package/dist/cli/commands/slice-review-commands.js +1 -1
  129. package/dist/cli/commands/smoke-commands.js +1 -1
  130. package/dist/cli/commands/sop-commands.js +1 -1
  131. package/dist/cli/commands/spill-demo-command.d.ts +7 -0
  132. package/dist/cli/commands/spill-demo-command.js +29 -0
  133. package/dist/cli/commands/statusline-commands.d.ts +12 -0
  134. package/dist/cli/commands/statusline-commands.js +79 -17
  135. package/dist/cli/commands/sub-agent-commands.js +2 -1
  136. package/dist/cli/commands/sub-agent-shared.d.ts +10 -0
  137. package/dist/cli/commands/sub-agent-shared.js +24 -1
  138. package/dist/cli/commands/swarm-commands.d.ts +13 -0
  139. package/dist/cli/commands/swarm-commands.js +77 -0
  140. package/dist/cli/commands/tech-commands.d.ts +64 -0
  141. package/dist/cli/commands/tech-commands.js +195 -0
  142. package/dist/cli/commands/understand-commands.js +1 -1
  143. package/dist/cli/commands/upgrade-commands.d.ts +2 -0
  144. package/dist/cli/commands/upgrade-commands.js +40 -5
  145. package/dist/cli/commands/user-touchpoint-commands.js +1 -1
  146. package/dist/cli/commands/verdict-aggregate-command.js +1 -1
  147. package/dist/cli/commands/vm-commands.d.ts +31 -0
  148. package/dist/cli/commands/vm-commands.js +274 -0
  149. package/dist/cli/commands/workflow-commands.js +24 -1
  150. package/dist/cli/commands/workflow-plan-commands.js +1 -1
  151. package/dist/cli/commands/workspace/init-command.js +1 -1
  152. package/dist/cli/commands/workspace/migrate-command.js +1 -1
  153. package/dist/cli/commands/workspace/reconcile-command.js +1 -1
  154. package/dist/cli/commands/worktree-auth-commands.d.ts +29 -0
  155. package/dist/cli/commands/worktree-auth-commands.js +652 -0
  156. package/dist/cli/index.js +58 -13
  157. package/dist/cli/program.d.ts +2 -2
  158. package/dist/cli/program.js +86 -281
  159. package/dist/services/24h-mode/decider.d.ts +103 -0
  160. package/dist/services/24h-mode/decider.js +144 -0
  161. package/dist/services/24h-mode/index.d.ts +12 -0
  162. package/dist/services/24h-mode/index.js +12 -0
  163. package/dist/services/24h-mode/state.d.ts +48 -0
  164. package/dist/services/24h-mode/state.js +51 -0
  165. package/dist/services/24h-mode/store.d.ts +27 -0
  166. package/dist/services/24h-mode/store.js +119 -0
  167. package/dist/services/artifacts/artifact-prerequisites.js +1 -1
  168. package/dist/services/artifacts/request-artifact-service.js +1 -1
  169. package/dist/services/artifacts/workspace-service.js +1 -1
  170. package/dist/services/audit/enforcers/lint-bee-runtime-contract.d.ts +25 -0
  171. package/dist/services/audit/enforcers/lint-bee-runtime-contract.js +91 -0
  172. package/dist/services/audit/enforcers/lint-peaks-code-runtime.d.ts +16 -0
  173. package/dist/services/audit/enforcers/lint-peaks-code-runtime.js +31 -0
  174. package/dist/services/audit/enforcers/lint-peaks-skill-runtime.d.ts +23 -0
  175. package/dist/services/audit/enforcers/lint-peaks-skill-runtime.js +59 -0
  176. package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.d.ts +28 -0
  177. package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.js +86 -0
  178. package/dist/services/audit/enforcers/lint-prd-artifact-handoff.d.ts +16 -0
  179. package/dist/services/audit/enforcers/lint-prd-artifact-handoff.js +41 -0
  180. package/dist/services/audit/enforcers/lint-prd-source-snapshot.d.ts +27 -0
  181. package/dist/services/audit/enforcers/lint-prd-source-snapshot.js +47 -0
  182. package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.d.ts +19 -0
  183. package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.js +47 -0
  184. package/dist/services/audit/enforcers/lint-rd-handoff-coverage.d.ts +18 -0
  185. package/dist/services/audit/enforcers/lint-rd-handoff-coverage.js +70 -0
  186. package/dist/services/audit/enforcers/lint-skill-presence-mandatory.d.ts +25 -0
  187. package/dist/services/audit/enforcers/lint-skill-presence-mandatory.js +53 -0
  188. package/dist/services/audit/red-line-catalog-p2-a.d.ts +0 -6
  189. package/dist/services/audit/red-line-catalog-p2-a.js +230 -1
  190. package/dist/services/audit/static-service.d.ts +32 -25
  191. package/dist/services/audit/static-service.js +30 -109
  192. package/dist/services/audit-independent/index.d.ts +2 -0
  193. package/dist/services/audit-independent/index.js +2 -0
  194. package/dist/services/autonomous-swarm/autonomous-swarm-service.d.ts +127 -0
  195. package/dist/services/autonomous-swarm/autonomous-swarm-service.js +446 -0
  196. package/dist/services/changeset/changeset-check-service.d.ts +22 -0
  197. package/dist/services/changeset/changeset-check-service.js +47 -0
  198. package/dist/services/code/auto-compact-modes.d.ts +30 -0
  199. package/dist/services/code/auto-compact-modes.js +38 -0
  200. package/dist/services/code/auto-compact-orchestrator.d.ts +43 -5
  201. package/dist/services/code/auto-compact-orchestrator.js +101 -21
  202. package/dist/services/code/dag-orchestrator.d.ts +30 -1
  203. package/dist/services/code/dag-orchestrator.js +106 -1
  204. package/dist/services/code/status-line-renderer.d.ts +2 -0
  205. package/dist/services/code/status-line-renderer.js +21 -3
  206. package/dist/services/code-review/ocr-service.d.ts +1 -1
  207. package/dist/services/code-review/ocr-service.js +6 -3
  208. package/dist/services/compact-history/compact-history-service.d.ts +41 -0
  209. package/dist/services/compact-history/compact-history-service.js +62 -0
  210. package/dist/services/compact-statusline/compact-statusline-service.d.ts +16 -0
  211. package/dist/services/compact-statusline/compact-statusline-service.js +83 -0
  212. package/dist/services/config/config-service.d.ts +1 -12
  213. package/dist/services/config/config-service.js +3 -72
  214. package/dist/services/config/config-types.d.ts +2 -4
  215. package/dist/services/config/config-types.js +1 -1
  216. package/dist/services/container/container-lease.d.ts +67 -0
  217. package/dist/services/container/container-lease.js +135 -0
  218. package/dist/services/context/auto-compact-dispatcher.d.ts +40 -5
  219. package/dist/services/context/auto-compact-dispatcher.js +32 -102
  220. package/dist/services/context/auto-compact-reader.js +1 -1
  221. package/dist/services/context/auto-compact-types.d.ts +27 -2
  222. package/dist/services/context/auto-compact-types.js +8 -1
  223. package/dist/services/context/build-dispatch-system-prompt.d.ts +75 -0
  224. package/dist/services/context/build-dispatch-system-prompt.js +117 -0
  225. package/dist/services/context/collector.d.ts +2 -2
  226. package/dist/services/context/context-builder.d.ts +4 -4
  227. package/dist/services/context/context-schema.d.ts +48 -48
  228. package/dist/services/context/ide-detect.d.ts +4 -0
  229. package/dist/services/context/ide-detect.js +24 -0
  230. package/dist/services/context/main-session-monitor.d.ts +1 -4
  231. package/dist/services/context/main-session-monitor.js +1 -24
  232. package/dist/services/context/memory-index-reader.d.ts +8 -0
  233. package/dist/services/context/memory-index-reader.js +57 -0
  234. package/dist/services/context/memory-lru-cache.d.ts +12 -0
  235. package/dist/services/context/memory-lru-cache.js +60 -0
  236. package/dist/services/context/memory-preflight-config.d.ts +19 -0
  237. package/dist/services/context/memory-preflight-config.js +25 -0
  238. package/dist/services/context/memory-preflight-service.d.ts +19 -0
  239. package/dist/services/context/memory-preflight-service.js +120 -0
  240. package/dist/services/context/spillover-store.d.ts +23 -0
  241. package/dist/services/context/spillover-store.js +155 -0
  242. package/dist/services/context/spillover-types.d.ts +18 -0
  243. package/dist/services/context/spillover-types.js +1 -0
  244. package/dist/services/crystallization/crystallization-service.d.ts +22 -5
  245. package/dist/services/crystallization/crystallization-service.js +8 -14
  246. package/dist/services/crystallization/crystallization-types.d.ts +6 -6
  247. package/dist/services/crystallization/evidence-brief-builder.d.ts +1 -1
  248. package/dist/services/crystallization/index.d.ts +13 -0
  249. package/dist/services/crystallization/index.js +13 -0
  250. package/dist/services/dashboard/project-dashboard-service.js +2 -2
  251. package/dist/services/dispatch/await-batch.d.ts +70 -0
  252. package/dist/services/dispatch/await-batch.js +272 -0
  253. package/dist/services/dispatch/batch-counter.js +1 -1
  254. package/dist/services/dispatch/dispatch-record-writer.d.ts +126 -4
  255. package/dist/services/dispatch/dispatch-record-writer.js +239 -9
  256. package/dist/services/dispatch/slice-dag.d.ts +46 -0
  257. package/dist/services/dispatch/slice-dag.js +6 -0
  258. package/dist/services/dispatch/stage-enum.d.ts +27 -0
  259. package/dist/services/dispatch/stage-enum.js +48 -0
  260. package/dist/services/dispatch/startup-timeout.d.ts +86 -0
  261. package/dist/services/dispatch/startup-timeout.js +97 -0
  262. package/dist/services/dispatch/sub-agent-dispatcher.js +40 -89
  263. package/dist/services/dispatch/test-tool-detection.d.ts +25 -1
  264. package/dist/services/dispatch/test-tool-detection.js +80 -0
  265. package/dist/services/doctor/doctor-service/checks/check-id-schema.d.ts +18 -0
  266. package/dist/services/doctor/doctor-service/checks/check-id-schema.js +64 -0
  267. package/dist/services/doctor/doctor-service/checks/codegraph-capability.d.ts +14 -0
  268. package/dist/services/doctor/doctor-service/checks/codegraph-capability.js +69 -0
  269. package/dist/services/doctor/doctor-service/checks/dist-source-version.d.ts +32 -0
  270. package/dist/services/doctor/doctor-service/checks/dist-source-version.js +110 -0
  271. package/dist/services/doctor/doctor-service/checks/gateguard-conflict.d.ts +24 -0
  272. package/dist/services/doctor/doctor-service/checks/gateguard-conflict.js +164 -0
  273. package/dist/services/doctor/doctor-service/checks/l3-memory-health.d.ts +16 -0
  274. package/dist/services/doctor/doctor-service/checks/l3-memory-health.js +57 -0
  275. package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.d.ts +19 -0
  276. package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.js +66 -0
  277. package/dist/services/doctor/doctor-service/checks/schema-validity.d.ts +10 -0
  278. package/dist/services/doctor/doctor-service/checks/schema-validity.js +33 -0
  279. package/dist/services/doctor/doctor-service/checks/skill-apply-note.d.ts +20 -0
  280. package/dist/services/doctor/doctor-service/checks/skill-apply-note.js +85 -0
  281. package/dist/services/doctor/doctor-service/checks/skill-existence.d.ts +13 -0
  282. package/dist/services/doctor/doctor-service/checks/skill-existence.js +30 -0
  283. package/dist/services/doctor/doctor-service/checks/skill-name-match.d.ts +10 -0
  284. package/dist/services/doctor/doctor-service/checks/skill-name-match.js +25 -0
  285. package/dist/services/doctor/doctor-service/checks/skill-parse.d.ts +10 -0
  286. package/dist/services/doctor/doctor-service/checks/skill-parse.js +19 -0
  287. package/dist/services/doctor/doctor-service/checks/skill-presence.d.ts +21 -0
  288. package/dist/services/doctor/doctor-service/checks/skill-presence.js +75 -0
  289. package/dist/services/doctor/doctor-service/checks/skill-runbook.d.ts +14 -0
  290. package/dist/services/doctor/doctor-service/checks/skill-runbook.js +47 -0
  291. package/dist/services/doctor/doctor-service/checks/statusline-install.d.ts +14 -0
  292. package/dist/services/doctor/doctor-service/checks/statusline-install.js +32 -0
  293. package/dist/services/doctor/doctor-service/checks/statusline-runtime.d.ts +13 -0
  294. package/dist/services/doctor/doctor-service/checks/statusline-runtime.js +30 -0
  295. package/dist/services/doctor/doctor-service/checks/user-config.d.ts +11 -0
  296. package/dist/services/doctor/doctor-service/checks/user-config.js +27 -0
  297. package/dist/services/doctor/doctor-service/checks/workspace-init.d.ts +16 -0
  298. package/dist/services/doctor/doctor-service/checks/workspace-init.js +34 -0
  299. package/dist/services/doctor/doctor-service/checks/workspace-layout.d.ts +33 -0
  300. package/dist/services/doctor/doctor-service/checks/workspace-layout.js +180 -0
  301. package/dist/services/doctor/doctor-service/index.d.ts +48 -0
  302. package/dist/services/doctor/doctor-service/index.js +254 -0
  303. package/dist/services/doctor/doctor-service/plugin-registry.d.ts +41 -0
  304. package/dist/services/doctor/doctor-service/plugin-registry.js +77 -0
  305. package/dist/services/doctor/doctor-service/report/final-summary.d.ts +20 -0
  306. package/dist/services/doctor/doctor-service/report/final-summary.js +29 -0
  307. package/dist/services/doctor/doctor-service/types.d.ts +245 -0
  308. package/dist/services/doctor/doctor-service/types.js +15 -0
  309. package/dist/services/doctor/doctor-service.d.ts +15 -146
  310. package/dist/services/doctor/doctor-service.js +22 -926
  311. package/dist/services/doctor/index.d.ts +22 -0
  312. package/dist/services/doctor/index.js +22 -0
  313. package/dist/services/env/shell-probe.d.ts +71 -0
  314. package/dist/services/env/shell-probe.js +161 -0
  315. package/dist/services/evolution/evolution-types.d.ts +39 -39
  316. package/dist/services/final-review/final-review-service.d.ts +11 -1
  317. package/dist/services/final-review/index.d.ts +2 -0
  318. package/dist/services/final-review/index.js +1 -0
  319. package/dist/services/hooks/auto-compact-hook-install.d.ts +4 -5
  320. package/dist/services/hooks/auto-compact-hook-install.js +4 -5
  321. package/dist/services/hooks/worktree-authorization-gate.d.ts +205 -0
  322. package/dist/services/hooks/worktree-authorization-gate.js +492 -0
  323. package/dist/services/ide/adapters/claude-code-adapter.js +2 -2
  324. package/dist/services/ide/adapters/qoder-adapter.d.ts +25 -0
  325. package/dist/services/ide/adapters/qoder-adapter.js +57 -0
  326. package/dist/services/ide/adapters/tongyi-lingma-adapter.d.ts +16 -0
  327. package/dist/services/ide/adapters/tongyi-lingma-adapter.js +45 -0
  328. package/dist/services/ide/ide-registry.js +6 -0
  329. package/dist/services/ide/ide-types.d.ts +1 -1
  330. package/dist/services/job/job-types.d.ts +56 -56
  331. package/dist/services/job-snapshot/index.d.ts +8 -0
  332. package/dist/services/job-snapshot/index.js +7 -0
  333. package/dist/services/{job/job-resource-snapshot.d.ts → job-snapshot/snapshot.d.ts} +1 -1
  334. package/dist/services/job-snapshot/types.d.ts +7 -0
  335. package/dist/services/job-snapshot/types.js +1 -0
  336. package/dist/services/karpathy-cost/karpathy-cost-check-service.d.ts +67 -0
  337. package/dist/services/karpathy-cost/karpathy-cost-check-service.js +108 -0
  338. package/dist/services/log/retention.d.ts +16 -0
  339. package/dist/services/log/retention.js +17 -0
  340. package/dist/services/loop/loop-bee-relation-types.d.ts +6 -6
  341. package/dist/services/loop/loop-release-types.d.ts +24 -24
  342. package/dist/services/loop/monotonic-runner.d.ts +17 -11
  343. package/dist/services/loop/monotonic-runner.js +118 -79
  344. package/dist/services/memory/project-memory-service/index/kind-dispatch.d.ts +8 -0
  345. package/dist/services/memory/project-memory-service/index/kind-dispatch.js +253 -0
  346. package/dist/services/memory/project-memory-service/index/ranking.d.ts +6 -0
  347. package/dist/services/memory/project-memory-service/index/ranking.js +171 -0
  348. package/dist/services/memory/project-memory-service/index/search.d.ts +34 -0
  349. package/dist/services/memory/project-memory-service/index/search.js +194 -0
  350. package/dist/services/memory/project-memory-service/index.d.ts +9 -0
  351. package/dist/services/memory/project-memory-service/index.js +24 -0
  352. package/dist/services/memory/project-memory-service/parsers/frontmatter.d.ts +9 -0
  353. package/dist/services/memory/project-memory-service/parsers/frontmatter.js +106 -0
  354. package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +7 -0
  355. package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +96 -0
  356. package/dist/services/memory/project-memory-service/store/atomic-write.d.ts +5 -0
  357. package/dist/services/memory/project-memory-service/store/atomic-write.js +56 -0
  358. package/dist/services/memory/project-memory-service/store/paths.d.ts +8 -0
  359. package/dist/services/memory/project-memory-service/store/paths.js +116 -0
  360. package/dist/services/memory/project-memory-service/types.d.ts +128 -0
  361. package/dist/services/memory/project-memory-service/types.js +9 -0
  362. package/dist/services/memory/project-memory-service.d.ts +1 -167
  363. package/dist/services/memory/project-memory-service.js +19 -816
  364. package/dist/services/migrate-skill-name/schema.d.ts +2 -2
  365. package/dist/services/observability/aggregation.d.ts +27 -0
  366. package/dist/services/observability/aggregation.js +72 -0
  367. package/dist/services/observability/observability-service.d.ts +73 -7
  368. package/dist/services/observability/observability-service.js +87 -1
  369. package/dist/services/openspec/artifact-boundary.d.ts +138 -0
  370. package/dist/services/openspec/artifact-boundary.js +150 -0
  371. package/dist/services/openspec/coverage-evidence-reader.d.ts +191 -0
  372. package/dist/services/openspec/coverage-evidence-reader.js +386 -0
  373. package/dist/services/openspec/openspec-archive-service.d.ts +70 -0
  374. package/dist/services/openspec/openspec-archive-service.js +320 -8
  375. package/dist/services/openspec/openspec-bridge-service.js +1 -1
  376. package/dist/services/openspec/openspec-init-service.js +1 -1
  377. package/dist/services/openspec/openspec-propose-from-doctor-service.js +1 -1
  378. package/dist/services/openspec/openspec-render-service.js +7 -4
  379. package/dist/services/openspec/openspec-scan-service.js +1 -1
  380. package/dist/services/openspec/openspec-validate-service.js +5 -4
  381. package/dist/services/preferences/preferences-service.js +10 -0
  382. package/dist/services/preferences/preferences-types.d.ts +13 -0
  383. package/dist/services/preferences/preferences-types.js +11 -0
  384. package/dist/services/qa/screenshot-archive-service.d.ts +51 -0
  385. package/dist/services/qa/screenshot-archive-service.js +134 -0
  386. package/dist/services/rd/rd-service.js +10 -11
  387. package/dist/services/rd/types.d.ts +32 -32
  388. package/dist/services/rd-swarm/rd-swarm-service.d.ts +60 -0
  389. package/dist/services/rd-swarm/rd-swarm-service.js +93 -0
  390. package/dist/services/recommendations/capability-seed-items.js +0 -1
  391. package/dist/services/recommendations/capability-seed-mappings.js +0 -1
  392. package/dist/services/recommendations/capability-seed-sources.js +0 -1
  393. package/dist/services/release/version-precheck-service.d.ts +51 -0
  394. package/dist/services/release/version-precheck-service.js +257 -0
  395. package/dist/services/scan/acceptance-coverage-service.js +1 -1
  396. package/dist/services/scan/archetype-service.js +1 -1
  397. package/dist/services/scan/existing-system-service.js +1 -1
  398. package/dist/services/scan/libraries-service.js +1 -1
  399. package/dist/services/sediment/json-schema.d.ts +40 -40
  400. package/dist/services/share/bundle-types.d.ts +12 -12
  401. package/dist/services/share/run-state-contract.d.ts +2 -2
  402. package/dist/services/skill/skill-search-service.d.ts +12 -7
  403. package/dist/services/skill/skill-search-service.js +8 -4
  404. package/dist/services/skillhub/migrations/001-initial.sql +71 -0
  405. package/dist/services/skillhub/migrations/002-loop-release.sql +32 -0
  406. package/dist/services/skillhub/migrations/003-loop-bee-relation.sql +35 -0
  407. package/dist/services/skillhub/migrations/004-loop-bee-extension.sql +65 -0
  408. package/dist/services/skillhub/migrations/005-evolution-evaluation.sql +81 -0
  409. package/dist/services/skillhub/migrations/006-crystallization-event.sql +92 -0
  410. package/dist/services/skills/hooks-settings-service.d.ts +75 -0
  411. package/dist/services/skills/hooks-settings-service.js +230 -2
  412. package/dist/services/skills/skill-registry.d.ts +1 -0
  413. package/dist/services/skills/skill-registry.js +6 -4
  414. package/dist/services/skills/skill-runbook-service.js +1 -1
  415. package/dist/services/slice/slice-check-service.js +1 -1
  416. package/dist/services/standards/main-session-monitor-ban-hook.d.ts +14 -0
  417. package/dist/services/standards/main-session-monitor-ban-hook.js +19 -0
  418. package/dist/services/standards/missing-standards-detector.d.ts +25 -0
  419. package/dist/services/standards/missing-standards-detector.js +43 -12
  420. package/dist/services/tech/tech-change-id-service.d.ts +82 -0
  421. package/dist/services/tech/tech-change-id-service.js +117 -0
  422. package/dist/services/understand/understand-hybrid-service.js +1 -1
  423. package/dist/services/understand/understand-scan-service.js +2 -2
  424. package/dist/services/upgrade/upgrade-service.js +4 -3
  425. package/dist/services/verdict/envelopes.d.ts +2 -2
  426. package/dist/services/verdict/envelopes.js +2 -2
  427. package/dist/services/verdict/verdict-aggregator.d.ts +3 -3
  428. package/dist/services/vm/vm-lease.d.ts +40 -0
  429. package/dist/services/vm/vm-lease.js +137 -0
  430. package/dist/services/workflow/autonomous-resume-writer.js +1 -1
  431. package/dist/services/workflow/pipeline-verify-gate-support.d.ts +47 -0
  432. package/dist/services/workflow/pipeline-verify-gate-support.js +194 -0
  433. package/dist/services/workflow/pipeline-verify-service.d.ts +17 -81
  434. package/dist/services/workflow/pipeline-verify-service.js +42 -218
  435. package/dist/services/workflow/pipeline-verify-types.d.ts +90 -0
  436. package/dist/services/workflow/pipeline-verify-types.js +10 -0
  437. package/dist/services/workflow/plan-reader.d.ts +1 -1
  438. package/dist/services/workflow/plan-reader.js +1 -1
  439. package/dist/services/workflow/plan-refresher.d.ts +1 -1
  440. package/dist/services/workflow/plan-refresher.js +1 -1
  441. package/dist/services/workflow/plan-trigger-detector.d.ts +1 -1
  442. package/dist/services/workflow/plan-trigger-detector.js +1 -1
  443. package/dist/services/workflow/workflow-autonomous-resume-helpers.d.ts +1 -1
  444. package/dist/services/workflow/workflow-autonomous-service.d.ts +2 -98
  445. package/dist/services/workflow/workflow-autonomous-types.d.ts +114 -0
  446. package/dist/services/workflow/workflow-autonomous-types.js +21 -0
  447. package/dist/services/workflow/workflow-router-service.js +18 -16
  448. package/dist/services/workflow/workflow-spec-lint.d.ts +13 -0
  449. package/dist/services/workflow/workflow-spec-lint.js +75 -0
  450. package/dist/services/workflow/workflow-spec-types.d.ts +100 -0
  451. package/dist/services/workflow/workflow-spec-types.js +13 -0
  452. package/dist/services/workflow/workflow-spec-yaml.d.ts +17 -0
  453. package/dist/services/workflow/workflow-spec-yaml.js +88 -0
  454. package/dist/services/workflow/workflow-spec.d.ts +11 -91
  455. package/dist/services/workflow/workflow-spec.js +16 -145
  456. package/dist/services/workspace/migrate-service.js +1 -1
  457. package/dist/services/workspace/workspace-service.js +1 -1
  458. package/dist/services/worktree/worktree-lease.d.ts +170 -0
  459. package/dist/services/worktree/worktree-lease.js +242 -0
  460. package/package.json +47 -51
  461. package/scripts/clean-dist.mjs +31 -1
  462. package/scripts/copy-templates.mjs +16 -0
  463. package/scripts/sync-version.mjs +53 -2
  464. package/skills/bee/peaks-perf-audit/SKILL.md +17 -0
  465. package/skills/bee/peaks-prd/SKILL.md +16 -0
  466. package/skills/bee/peaks-prd/test-prompts.json +12 -0
  467. package/skills/bee/peaks-qa/SKILL.md +16 -1
  468. package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +22 -0
  469. package/skills/bee/peaks-qa/test-prompts.json +12 -0
  470. package/skills/bee/peaks-rd/SKILL.md +29 -20
  471. package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +39 -0
  472. package/skills/bee/peaks-rd/test-prompts.json +12 -0
  473. package/skills/bee/peaks-reviewer/SKILL.md +17 -0
  474. package/skills/bee/peaks-sc/SKILL.md +16 -0
  475. package/skills/bee/peaks-security-audit/SKILL.md +17 -0
  476. package/skills/bee/peaks-txt/SKILL.md +16 -0
  477. package/skills/bee/peaks-txt/test-prompts.json +12 -0
  478. package/skills/bee/peaks-ui/SKILL.md +49 -43
  479. package/skills/bee/peaks-ui/test-prompts.json +12 -0
  480. package/skills/peaks-code/SKILL.md +54 -109
  481. package/skills/peaks-code/references/boundaries.md +15 -1
  482. package/skills/peaks-code/references/cron-scheduler-deployment.md +313 -0
  483. package/skills/peaks-code/references/external-skill-invocation.md +27 -0
  484. package/skills/peaks-code/references/lease-dashboard.html +224 -0
  485. package/skills/peaks-code/references/lease-stats.sample.json +26 -0
  486. package/skills/peaks-code/references/peaks-worktree-l2-enforcers.md +208 -0
  487. package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
  488. package/skills/peaks-code/references/runbook.md +63 -1
  489. package/skills/peaks-code/references/startup-sequence.md +110 -0
  490. package/skills/peaks-code/references/step-0-8-gate.md +1 -1
  491. package/skills/peaks-code/references/sub-agent-dispatch.md +92 -1
  492. package/skills/peaks-code/references/worktree-governance.md +123 -0
  493. package/skills/peaks-code/test-prompts.json +12 -0
  494. package/skills/peaks-doctor/SKILL.md +1 -1
  495. package/skills/peaks-ide/SKILL.md +1 -1
  496. package/skills/peaks-solo/SKILL.md +21 -0
  497. package/skills/peaks-solo/references/triage-decision-table.md +6 -0
  498. package/skills/peaks-sop/test-prompts.json +17 -0
  499. package/dist/cli/commands/agent-commands.d.ts +0 -20
  500. package/dist/cli/commands/agent-commands.js +0 -48
  501. package/dist/cli/commands/classify-classify-commands.d.ts +0 -19
  502. package/dist/cli/commands/classify-classify-commands.js +0 -151
  503. package/dist/cli/commands/contract-commands.d.ts +0 -26
  504. package/dist/cli/commands/contract-commands.js +0 -114
  505. package/dist/cli/commands/session-auto-compact-hook-command.d.ts +0 -37
  506. package/dist/cli/commands/session-auto-compact-hook-command.js +0 -127
  507. package/dist/cli/commands/worker-commands.d.ts +0 -3
  508. package/dist/cli/commands/worker-commands.js +0 -52
  509. package/dist/services/agent/ecc-agent-service.d.ts +0 -47
  510. package/dist/services/agent/ecc-agent-service.js +0 -143
  511. package/dist/services/config/provider-service.d.ts +0 -48
  512. package/dist/services/config/provider-service.js +0 -143
  513. package/dist/services/context/dispatch-context-guard.d.ts +0 -27
  514. package/dist/services/context/dispatch-context-guard.js +0 -192
  515. package/dist/services/context/shared-channel.d.ts +0 -93
  516. package/dist/services/context/shared-channel.js +0 -308
  517. package/dist/services/filesystem/file-lock.d.ts +0 -11
  518. package/dist/services/filesystem/file-lock.js +0 -152
  519. package/dist/services/mut/assert-scanner.d.ts +0 -6
  520. package/dist/services/mut/assert-scanner.js +0 -116
  521. package/dist/services/mut/index.d.ts +0 -8
  522. package/dist/services/mut/index.js +0 -7
  523. package/dist/services/mut/mut-runner.d.ts +0 -39
  524. package/dist/services/mut/mut-runner.js +0 -29
  525. package/dist/services/mut/production-stryker.d.ts +0 -2
  526. package/dist/services/mut/production-stryker.js +0 -75
  527. package/dist/services/mut/report-builder.d.ts +0 -11
  528. package/dist/services/mut/report-builder.js +0 -110
  529. package/dist/services/mut/report-loader.d.ts +0 -31
  530. package/dist/services/mut/report-loader.js +0 -78
  531. package/dist/services/mut/thresholds.d.ts +0 -21
  532. package/dist/services/mut/thresholds.js +0 -22
  533. package/dist/services/mut/types.d.ts +0 -336
  534. package/dist/services/mut/types.js +0 -59
  535. package/dist/services/providers/minimax-provider-service.d.ts +0 -24
  536. package/dist/services/providers/minimax-provider-service.js +0 -143
  537. package/dist/services/providers/minimax-worker-service.d.ts +0 -21
  538. package/dist/services/providers/minimax-worker-service.js +0 -83
  539. package/dist/shared/fs.d.ts +0 -4
  540. package/dist/shared/fs.js +0 -26
  541. package/dist/shared/paths.d.ts +0 -6
  542. package/dist/shared/paths.js +0 -50
  543. package/dist/shared/result.d.ts +0 -22
  544. package/dist/shared/result.js +0 -46
  545. package/dist/shared/version.d.ts +0 -1
  546. package/dist/shared/version.js +0 -1
  547. package/examples/video-demo/README.md +0 -142
  548. package/examples/video-demo/out/en-closing-960.png +0 -0
  549. package/examples/video-demo/out/zh-closing-960.png +0 -0
  550. package/examples/video-demo/preview/peaks-loop-demo-en.mp4 +0 -0
  551. package/examples/video-demo/preview/peaks-loop-demo.mp4 +0 -0
  552. /package/dist/services/{job/job-resource-snapshot.js → job-snapshot/snapshot.js} +0 -0
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "peaks-loop",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.1",
4
4
  "description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
5
5
  "author": "SquabbyZ",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
- "packageManager": "pnpm@10.11.0",
9
8
  "publishConfig": {
10
9
  "access": "public"
11
10
  },
@@ -26,6 +25,7 @@
26
25
  "dist/**/*.js",
27
26
  "dist/**/*.d.ts",
28
27
  "dist/**/*.md",
28
+ "dist/**/*.sql",
29
29
  "scripts/clean-dist.mjs",
30
30
  "scripts/copy-templates.mjs",
31
31
  "scripts/sync-version.mjs",
@@ -41,56 +41,11 @@
41
41
  "README.md",
42
42
  "README-en.md",
43
43
  "CHANGELOG.md",
44
- "LICENSE",
45
- "examples/video-demo/preview/peaks-loop-demo.mp4",
46
- "examples/video-demo/preview/peaks-loop-demo-en.mp4",
47
- "examples/video-demo/out/zh-closing-960.png",
48
- "examples/video-demo/out/en-closing-960.png"
44
+ "LICENSE"
49
45
  ],
50
- "scripts": {
51
- "build": "node ./scripts/sync-version.mjs && node ./scripts/clean-dist.mjs && tsc -p tsconfig.build.json && node ./scripts/copy-templates.mjs",
52
- "prepack": "npm run build",
53
- "prepublishOnly": "node scripts/prepublish-build.mjs",
54
- "prepublish": "node ./scripts/sync-version.mjs",
55
- "postinstall": "node ./scripts/install-skills.mjs",
56
- "predev": "node ./scripts/sync-version.mjs",
57
- "dev": "tsx src/cli/index.ts",
58
- "dev:watch": "node ./scripts/watch.mjs",
59
- "pretest": "node ./scripts/sync-version.mjs",
60
- "test": "vitest run tests/unit/cli-program.core.test.ts tests/unit/cli-program.stateful.test.ts tests/unit/cli-program.workflow.test.ts tests/unit/cli-program.workflow-cli.test.ts tests/unit/cli-program.workspace.test.ts tests/unit/cli",
61
- "test:full": "vitest run",
62
- "test:fast": "vitest run --maxWorkers=8 -t \"^((?!@slow|@integration|@replay).)*$\" tests/unit",
63
- "test:dev": "vitest run tests/unit",
64
- "test:dev:cli": "vitest run tests/unit/cli-program.core.test.ts tests/unit/cli-program.stateful.test.ts tests/unit/cli-program.workflow.test.ts tests/unit/cli-program.workflow-cli.test.ts tests/unit/cli-program.workspace.test.ts tests/unit/cli",
65
- "test:unit": "vitest run tests/unit",
66
- "test:integration": "vitest run tests/integration",
67
- "test:cli": "vitest run tests/unit/cli-program.core.test.ts tests/unit/cli-program.stateful.test.ts tests/unit/cli-program.workflow.test.ts tests/unit/cli-program.workflow-cli.test.ts tests/unit/cli-program.workspace.test.ts tests/unit/cli",
68
- "test:workflow": "vitest run tests/unit/cli-program.workflow.test.ts tests/unit/cli-program.workflow-cli.test.ts tests/unit/workflow-autonomous-resume-validation.test.ts tests/unit/workflow-autonomous-service.test.ts tests/unit/workflow-router-service.test.ts tests/unit/skill-browser-workflow.test.ts tests/unit/services/workflow",
69
- "test:audit:silent-warning": "node ./scripts/lint/silent-warning-detector.mjs",
70
- "test:ci": "node ./scripts/sync-version.mjs && node ./scripts/lint/silent-warning-detector.mjs && vitest run --coverage",
71
- "test:changed": "node scripts/test-changed.mjs",
72
- "lint:silent-warning": "node ./scripts/lint/silent-warning-detector.mjs",
73
- "test:race": "vitest run --no-file-parallelism tests/unit/g8-shared-channel.test.ts tests/unit/dispatch-record-writer.test.ts tests/unit/services/retrospective/heartbeat.test.ts tests/unit/cli/commands/share-commands.test.ts",
74
- "test:replay": "node scripts/fixture-capture-setup.mjs && vitest run tests/unit/replay tests/unit/fixture",
75
- "fixture:capture-setup": "node scripts/fixture-capture-setup.mjs",
76
- "test:coverage": "vitest run --coverage",
77
- "test:coverage:workflow": "vitest run --coverage --coverage.include='src/services/workflow/plan-*.ts' tests/unit/services/workflow/",
78
- "pretest:coverage": "node ./scripts/pretest-coverage.mjs",
79
- "schema:generate": "node scripts/generate-context-schema.mjs",
80
- "typecheck": "tsc -p tsconfig.json --noEmit && vitest run --coverage --coverage.include='src/services/workflow/plan-*.ts' tests/unit/services/workflow/",
81
- "mut:run": "peaks mut run --project . --out mut-report.json",
82
- "mut:scan": "peaks mut asserts --in mut-report.json",
83
- "audit:prose-ratio": "peaks audit prose-ratio --project .",
84
- "dogfood:sediment": "bash scripts/dogfood-sediment-cycle.sh"
85
- },
86
46
  "engines": {
87
47
  "node": ">=20.0.0"
88
48
  },
89
- "pnpm": {
90
- "onlyBuiltDependencies": [
91
- "better-sqlite3"
92
- ]
93
- },
94
49
  "dependencies": {
95
50
  "@colbymchenry/codegraph": "0.7.10",
96
51
  "better-sqlite3": "^12.11.1",
@@ -98,7 +53,10 @@
98
53
  "fzf": "^0.5.2",
99
54
  "headroom-ai": "0.22.4",
100
55
  "yaml": "^2.9.0",
101
- "zod": "^3.25.76"
56
+ "zod": "^3.25.76",
57
+ "peaks-loop-mut": "0.1.3",
58
+ "peaks-loop-shared": "0.0.29",
59
+ "peaks-loop-shared-channel": "0.0.8"
102
60
  },
103
61
  "peerDependencies": {
104
62
  "@alibaba-group/open-code-review": "1.3.1"
@@ -109,17 +67,55 @@
109
67
  }
110
68
  },
111
69
  "devDependencies": {
70
+ "@changesets/cli": "2.31.1",
112
71
  "@jridgewell/trace-mapping": "^0.3.31",
113
72
  "@stryker-mutator/core": "^8.7.1",
114
73
  "@stryker-mutator/typescript-checker": "^8.7.1",
115
74
  "@stryker-mutator/vitest-runner": "^9.6.1",
116
75
  "@types/better-sqlite3": "^7.6.13",
117
76
  "@types/node": "^22.10.2",
77
+ "@vitest/coverage-istanbul": "^4.1.10",
118
78
  "@vitest/coverage-v8": "^4.1.10",
79
+ "c8": "^10.1.3",
119
80
  "tsx": "^4.19.2",
120
81
  "typescript": "^5.7.2",
121
82
  "vite": "^6.0.0",
122
- "vitest": "^4.1.0",
83
+ "vitest": "^4.1.10",
123
84
  "zod-to-json-schema": "^3.25.2"
85
+ },
86
+ "scripts": {
87
+ "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",
88
+ "prepublish": "node ./scripts/sync-version.mjs",
89
+ "postinstall": "node ./scripts/install-skills.mjs",
90
+ "predev": "node ./scripts/sync-version.mjs",
91
+ "dev": "tsx src/cli/index.ts",
92
+ "dev:watch": "node ./scripts/watch.mjs",
93
+ "pretest": "node ./scripts/sync-version.mjs && pnpm --filter peaks-loop-shared build && node ./scripts/check-build-integrity.mjs",
94
+ "test": "vitest run",
95
+ "test:full": "pnpm -r --include-workspace-root --workspace-concurrency=2 run test",
96
+ "test:fast": "vitest run --maxWorkers=8 -t \"^((?!@slow|@integration|@replay).)*$\" tests/unit",
97
+ "test:dev": "vitest run tests/unit",
98
+ "test:dev:cli": "vitest run tests/unit",
99
+ "test:unit": "vitest run tests/unit",
100
+ "test:integration": "vitest run tests/integration",
101
+ "test:cli": "vitest run tests/unit",
102
+ "test:workflow": "vitest run tests/unit",
103
+ "test:audit:silent-warning": "node ./scripts/lint/silent-warning-detector.mjs",
104
+ "test:ci": "node ./scripts/sync-version.mjs && node ./scripts/lint/silent-warning-detector.mjs && vitest run --coverage",
105
+ "test:changed": "node scripts/test-changed.mjs",
106
+ "lint:silent-warning": "node ./scripts/lint/silent-warning-detector.mjs",
107
+ "test:race": "vitest run --no-file-parallelism packages/peaks-loop-shared-channel/tests/shared-channel.test.ts tests/unit/dispatch-record-writer.test.ts tests/unit/services/retrospective/heartbeat.test.ts tests/unit/cli/commands/share-commands.test.ts",
108
+ "test:replay": "node scripts/fixture-capture-setup.mjs && vitest run tests/unit/replay tests/unit/fixture",
109
+ "fixture:capture-setup": "node scripts/fixture-capture-setup.mjs",
110
+ "test:coverage": "node ./scripts/coverage-c8.mjs",
111
+ "test:coverage:c8": "node ./scripts/coverage-c8.mjs",
112
+ "test:coverage:vitest": "vitest run --coverage",
113
+ "test:coverage:workflow": "vitest run --coverage --coverage.include='src/services/workflow/plan-*.ts' tests/unit/services/workflow/",
114
+ "schema:generate": "node scripts/generate-context-schema.mjs",
115
+ "typecheck": "tsc -p tsconfig.json --noEmit && vitest run --coverage --coverage.include='src/services/workflow/plan-*.ts' tests/unit/services/workflow/",
116
+ "mut:run": "peaks mut run --project . --out mut-report.json",
117
+ "mut:scan": "peaks mut asserts --in mut-report.json",
118
+ "audit:prose-ratio": "peaks audit prose-ratio --project .",
119
+ "dogfood:sediment": "bash scripts/dogfood-sediment-cycle.sh"
124
120
  }
125
- }
121
+ }
@@ -1,8 +1,38 @@
1
1
  #!/usr/bin/env node
2
- import { rmSync } from 'node:fs';
2
+ import { readdirSync, rmSync } from 'node:fs';
3
3
  import { join, resolve } from 'node:path';
4
4
  import { dirname } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
7
7
  const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
8
+
9
+ // Slice 2026-07-30 — extend clean-dist to also wipe every
10
+ // packages/*/dist. Rationale: tsc's incremental-build cache
11
+ // compares files by mtime + size, and a stale dist that
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).
16
+ //
17
+ // The wider wipe is safe because:
18
+ // - watch.mjs only watches src/, schemas/, skills/ — it
19
+ // never reads packages/*/dist during dev iteration
20
+ // - sync-version.mjs's later unlink step on
21
+ // packages/peaks-loop-shared/dist/version.* is now a
22
+ // narrower no-op safety net, not the load-bearing invalidator
23
+ //
24
+ // We deliberately use { recursive: true, force: true } for
25
+ // every dist — missing dirs are tolerated so a fresh clone
26
+ // without prior builds does not crash.
27
+
8
28
  rmSync(join(packageRoot, 'dist'), { recursive: true, force: true });
29
+
30
+ const packagesRoot = join(packageRoot, 'packages');
31
+ for (const entry of readdirSync(packagesRoot, { withFileTypes: true })) {
32
+ if (!entry.isDirectory()) continue;
33
+ rmSync(join(packagesRoot, entry.name, 'dist'), {
34
+ recursive: true,
35
+ force: true,
36
+ });
37
+ }
38
+
@@ -9,6 +9,15 @@
9
9
  * therefore only get the dynamically-generated `project-scan.md` and
10
10
  * the 4 audit/business templates would silently be missing.
11
11
  *
12
+ * D-019 (2026-07-16): also copy the SkillHub SQLite migrations
13
+ * (`src/services/skillhub/migrations/*.sql`) into dist/. Without this,
14
+ * the published `peaks-loop` tarball ships an empty
15
+ * `dist/services/skillhub/migrations/` and `openStateDb()` opens a
16
+ * schema-less database, breaking any `peaks skill sediment <verb>`
17
+ * on a fresh consumer install. Vitest tests still pass because they
18
+ * use tsx + the source tree directly, but downstream npm consumers
19
+ * see `no such table: bee_release` on the very first command.
20
+ *
12
21
  * Idempotent: safe to run multiple times. Run after `tsc` in `build`.
13
22
  */
14
23
  import { copyFileSync, mkdirSync, readdirSync, statSync } from 'node:fs';
@@ -44,6 +53,13 @@ const targets = [
44
53
  src: join(packageRoot, 'src/services/workspace/templates/project-scan'),
45
54
  dest: join(packageRoot, 'dist/services/workspace/templates/project-scan'),
46
55
  extensions: ['.md']
56
+ },
57
+ {
58
+ // D-019: SkillHub SQLite migrations must reach the published tarball
59
+ // so `openStateDb()` can apply the schema on first run.
60
+ src: join(packageRoot, 'src/services/skillhub/migrations'),
61
+ dest: join(packageRoot, 'dist/services/skillhub/migrations'),
62
+ extensions: ['.sql']
47
63
  }
48
64
  ];
49
65
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync, writeFileSync } from 'node:fs';
2
+ import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
4
 
5
5
  const packageJson = JSON.parse(readFileSync(resolve('package.json'), 'utf8'));
@@ -9,4 +9,55 @@ if (typeof version !== 'string' || version.length === 0) {
9
9
  throw new Error('package.json version must be a non-empty string');
10
10
  }
11
11
 
12
- writeFileSync(resolve('src/shared/version.ts'), `export const CLI_VERSION = ${JSON.stringify(version)};\n`);
12
+ // Slice 3a — version.ts lives in the peaks-loop-shared workspace package.
13
+ // The shared package is `private: true` and is consumed via workspace:*,
14
+ // so its own package.json `version` field is irrelevant for downstream
15
+ // consumers; we always emit the main peaks-loop version.
16
+ writeFileSync(
17
+ resolve('packages/peaks-loop-shared/src/version.ts'),
18
+ `export const CLI_VERSION = ${JSON.stringify(version)};\n`,
19
+ );
20
+
21
+ // 2026-07-23 follow-up (peaks-publish-stale fix, AC6): the shared
22
+ // bump used to live here, gated on `PEAKS_AUTO_BUMP_SHARED === '1'`.
23
+ // That gate was the Layer 2 root cause: publish.yml set the env on
24
+ // the CI Build step, but local dev runs (and any path that didn't
25
+ // re-export the env) produced stale shared tarballs. The bump now
26
+ // lives in `scripts/bump-version.mjs` (which always runs when root
27
+ // version changes) and `bump-version.mjs` is the single owner of
28
+ // the shared/package.json#version bump.
29
+ //
30
+ // This script keeps a fallback shared bump when explicitly invoked
31
+ // from another path with `PEAKS_AUTO_BUMP_SHARED === '1'` — that
32
+ // preserves the contract for any out-of-band build invocation that
33
+ // still sets the env var. The bump-version.mjs path is primary and
34
+ // always-on; the gate here is just a back-stop.
35
+
36
+ // 2026-07-22 follow-up (Bug-04 root-cause fix): the previous version of
37
+ // this script wrote `version.ts` only, then handed off to `tsc`. Tsc's
38
+ // incremental-build cache compares `version.ts` only by mtime + size —
39
+ // and the freshly-written version.ts has the SAME size as before, so tsc
40
+ // reported "no changes" and skipped emitting `dist/version.js`. The
41
+ // pre-existing `dist/version.js` (from a prior build with an OLD CLI_VERSION)
42
+ // was then re-packed by `release-pack.mjs` into the npm tarball, causing
43
+ // downstream `peaks -v` to print the wrong version.
44
+ //
45
+ // Fix: invalidate the shared `dist/version.js` (and its .d.ts / .map) so a
46
+ // subsequent `tsc -p tsconfig.json` on the shared subpackage has to regen it.
47
+ // This is idempotent: if no dist yet exists, noop; if it exists, unlink.
48
+ for (const ext of ['js', 'd.ts', 'd.ts.map']) {
49
+ const sharedDist = resolve('packages/peaks-loop-shared/dist/version.' + ext);
50
+ if (existsSync(sharedDist)) {
51
+ unlinkSync(sharedDist);
52
+ }
53
+ }
54
+
55
+ // Slice 2026-07-30 — the targeted unlink above is now a
56
+ // regression-test pin for Bug-04; the load-bearing dist
57
+ // invalidation moved up to `clean-dist.mjs`, which wipes every
58
+ // packages/*/dist wholesale before any subpackage build runs.
59
+ // This narrow unlink stays because it is unit-tested by
60
+ // tests/unit/scripts/sync-version-invalidation.test.ts and
61
+ // catching the Bug-04 lineage on its own is cheap insurance
62
+ // against future pipeline reorderings.
63
+
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  name: peaks-perf-audit
3
+ visibility: internal
3
4
  description: Independent performance audit skill. Reads the immutable peaks-prd handoff + the project-level perf-template.md, performs a 6-dimension perf audit, and writes a structured envelope to `.peaks/_runtime/<sessionId>/audit/perf-<rid>.md`. Decoupled from peaks-rd 5-way fan-out per slice v2.12.0 (Group A, Tier 3). Use when the slice introduces CPU-bound hot loops, I/O throughput changes, memory allocation patterns, concurrency model changes, bundle size deltas, or cold-start costs.
4
5
  metadata:
5
6
  appliesTo: peaks-loop v2.12.0+
@@ -164,3 +165,19 @@ required fixes deduped by `(file, line, hint)`).
164
165
  template, or the diff under audit. It only writes a new audit artifact.
165
166
  - **#4 Goal-Driven Execution** — every audit output references a
166
167
  verifiable handoff goal via the `handoffHash` field.
168
+
169
+ ## L2 surface reference (post rid-l2-extended)
170
+
171
+ For slices that touch the L2 surface, the canonical CLIs are:
172
+ - `peaks worktree {spawn,renew,list,gc,lease-status,release}` — lease lifecycle (Part 1-2)
173
+ - `peaks sub-agent dispatch --isolation worktree|container` — auto-spawns a lease (Part 2.C + Part 8 contract)
174
+ - `peaks container {spawn,release}` — L4 container runtime (Part 12, docker)
175
+ - `peaks lease-metrics [--rate] [--all-sessions]` — per-kind counts + leak rate (Part 4-5)
176
+ - `peaks lease-stats` — project-wide summary (Part 6)
177
+ - `peaks cron {init,list,run}` + `peaks cron-scheduler start` — periodic lease gc (Part 14-15)
178
+ - `peaks audit red-lines --project .` — 119 catalog red-lines / 86+ cli-backed enforcers / 0 prose-only (Part 13)
179
+
180
+ Verify the surface (no need to re-derive):
181
+ 1. `peaks audit red-lines --project .` reports `proseOnly: 0` for any shipped L2 surface.
182
+ 2. `peaks lease-metrics --rate` after a clean run reports `estimatedLeaked: 0`.
183
+ 3. `peaks worktree list` returns 0 active leases after a clean run.
@@ -323,3 +323,19 @@ Use `peaks capabilities --source mcp-server --json` before recommending product
323
323
  Do not implement code, run tests, install hooks, or modify runtime configuration. Use Peaks-Loop CLI reports and downstream artifacts instead.
324
324
 
325
325
  Reference: `references/workflow.md`.
326
+
327
+ ## L2 surface reference (post rid-l2-extended)
328
+
329
+ For slices that touch the L2 surface, the canonical CLIs are:
330
+ - `peaks worktree {spawn,renew,list,gc,lease-status,release}` — lease lifecycle (Part 1-2)
331
+ - `peaks sub-agent dispatch --isolation worktree|container` — auto-spawns a lease (Part 2.C + Part 8 contract)
332
+ - `peaks container {spawn,release}` — L4 container runtime (Part 12, docker)
333
+ - `peaks lease-metrics [--rate] [--all-sessions]` — per-kind counts + leak rate (Part 4-5)
334
+ - `peaks lease-stats` — project-wide summary (Part 6)
335
+ - `peaks cron {init,list,run}` + `peaks cron-scheduler start` — periodic lease gc (Part 14-15)
336
+ - `peaks audit red-lines --project .` — 119 catalog red-lines / 86 cli-backed enforcers / 51 discovered (Part 13)
337
+
338
+ Verify the surface (no need to re-derive):
339
+ 1. `peaks audit red-lines --project .` reports `proseOnly: 0` for any shipped L2 surface.
340
+ 2. `peaks lease-metrics --rate` after a clean run reports `estimatedLeaked: 0`.
341
+ 3. `peaks worktree list` returns 0 active leases after a clean run.
@@ -0,0 +1,12 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "prompt": "Feishu 文档 https://example.feishu.cn/wiki/PRODUCT_DOC_ID 是产品文档,需要登录。目标是 /Users/yuanyuan/Desktop/work/platform-rag-web 前端项目,请从文档提取可以交给 RD 实现、QA 复测的前端改动点。",
5
+ "expected": "先校验文档 URL 使用 https 且属于批准的 Feishu/Lark tenant 域名,再使用 headed gstack/browse/dist/browse 打开有头浏览器访问,遇到登录时等待用户完成并回复确认后再继续;登录后只提取产品实现逻辑、页面/路由/组件/状态/API contract/mock 假设/验收标准/联调问题,输出 .peaks/_runtime/<session-id>/prd/ 下的脱敏实现型 PRD handoff;不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、raw browser/network state 或 PII/SSO/MFA 截图/日志。"
6
+ },
7
+ {
8
+ "id": 2,
9
+ "prompt": "产品文档业务背景很多,但用户明确只要落实到前端开发和 QA 验收,不要长篇业务叙述。当前没有 swagger.json,需要先 mock。",
10
+ "expected": "压缩业务背景,只输出待联调态 frontend delta、mock/API contract、后续 swagger 替换清单、QA 浏览器验收路径和阻塞问题。"
11
+ }
12
+ ]
@@ -243,4 +243,19 @@ Index of every `references/` file in this skill. Read on demand.
243
243
  | `references/regression-gates.md` | Regression gates (preserved). |
244
244
  | `references/requirement-boundary-recheck.md` | 5-step requirement boundary recheck. |
245
245
  | `references/test-case-generation.md` | Test case categories + format + acceptance linkage. |
246
- | `references/test-report-output.md` | Test report minimum 8 sections. |
246
+ | `references/test-report-output.md` | Test report minimum 8 sections. |
247
+ ## L2 surface reference (post rid-l2-extended)
248
+
249
+ For QA slices that verify lease / dispatch / observability behavior, the L2 ecosystem (shipped 2026-07-29) provides these read-mostly surfaces:
250
+
251
+ - `peaks lease-metrics [--rate] [--all-sessions]` — per-kind event counts (spawn/renew/release/gc/autoRelease/autoRelease-failed). QA can assert that an L2 test scenario emits the expected sequence.
252
+ - `peaks lease-stats` — project-wide summary; verify per-rid / per-role / per-isolation breakdown matches the test plan
253
+ - `peaks worktree list` — canonical "alive" set of leases (FS state). `lease-metrics` is a historical view; `peaks worktree list` is the source of truth for "is this lease still alive right now?"
254
+ - `peaks audit red-lines` — 119 red lines / 66 cli-backed / 0 partial. QA can gate a release on `proseOnly === 0` + `cliBacked >= partial threshold`
255
+ - `peaks container list` — L4 container leases (Part 12). Use to verify container-isolation scenarios when `--isolation container` is exercised
256
+
257
+ QA contracts to assert on the L2 surface (a minimal acceptance test set):
258
+ 1. After `dispatch --isolation worktree` + `heartbeat --status done`, the lease file is `released` AND the worktree dir is gone.
259
+ 2. `peaks worktree list` reports 0 active leases after a clean run.
260
+ 3. `peaks lease-metrics --rate` after a 1-spawn / 0-release test reports `estimatedLeaked: 1, completedLifetimes: 0`.
261
+ 4. `peaks audit red-lines` reports `proseOnly: 0` and `partial: 0` for any shipped L2 surface.
@@ -2,6 +2,28 @@
2
2
 
3
3
  > Body of `## Sub-agent dispatch`. 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:
4
4
 
5
+ ## Superpowers chain refusal (L1 worktree governance — locked 2026-07-29)
6
+
7
+ You MUST NOT follow the superpowers chain for worktree decisions:
8
+
9
+ - superpowers:brainstorming → superpowers:writing-plans →
10
+ superpowers:subagent-driven-development → superpowers:using-git-worktrees
11
+
12
+ This chain ends with `git worktree add` (superpowers:using-git-worktrees SKILL.md line 96). It bypasses peaks-loop's L2 hook gate and L3 IDE `permissions.deny`. Even when L3 denies the terminal Skill, the chain has already taught you to use raw `git worktree add`, so L3 is not sufficient.
13
+
14
+ For worktree operations, use ONLY:
15
+
16
+ - `peaks worktree spawn --rid <rid> --ttl <duration> --purpose <text>` (after rid-L2-extended ships)
17
+ - until then: `peaks worktree auth grant --rid <id> --reason <text> --ttl <5m>`
18
+
19
+ The superpowers skills remain available as REFERENCE material for brainstorming / planning techniques, but MUST NOT be used as a workflow. peaks-qa's own QA artifacts (`.peaks/_runtime/<sessionId>/qa/<artifact>.md`) are authoritative.
20
+
21
+ If the upstream superpowers chain suggests raw `git worktree add`:
22
+
23
+ 1. STOP
24
+ 2. Re-author the QA plan as a peaks-qa artifact
25
+ 3. Continue with `peaks worktree spawn` (or the auth-grant fallback)
26
+
5
27
  - **Session id** — use the parent's sid (read `.peaks/_runtime/session.json` or pass `--session-id <parent-sid>` to any session-creating CLI). Do NOT spawn your own session. The new `peaks session info --active` reads the canonical binding for you.
6
28
  - **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-qa`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main Code loop owns that file. If you need to mark your own state, write a marker file at `.peaks/_runtime/<sessionId>/system/sub-agent-qa.json` and only that.
7
29
  - **Workspace initialization** — Code has already run `peaks workspace init` before fan-out. Do not re-run it.
@@ -0,0 +1,12 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "prompt": "验证 /Users/yuanyuan/Desktop/work/platform-rag-web 的前端需求实现。后端 swagger.json 不存在,当前实现使用 mock/API contract。",
5
+ "expected": "QA 运行相关测试/API 或 mock contract 验证,启动前端应用,用 headed gstack/browse/dist/browse 有头浏览器做强制 E2E,遇到登录时等待用户完成并回复确认后再继续,记录脱敏 route/actions、脱敏 console/network 失败、脱敏截图或观察;不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、PII/SSO/MFA 材料;生成 .peaks/_runtime/<session-id>/qa/validation-report.md,并包含安全和性能检查结果。"
6
+ },
7
+ {
8
+ "id": 2,
9
+ "prompt": "浏览器 E2E 中如果页面白屏、console 报错、网络 mock 失败、UI 有明显回归怎么办?",
10
+ "expected": "QA 必须带证据退回 RD 修复,不能通过 QA;修复后重新浏览器验证。"
11
+ }
12
+ ]
@@ -136,30 +136,20 @@ If any gate fails, return to development for fixes or hand off as blocked. Do no
136
136
 
137
137
  ## Parallel review fan-out (v2.12.0 3-way fanout — code-reviewer + qa-test-cases-writer + karpathy-reviewer)
138
138
 
139
- The THREE review activities run in parallel via `peaks sub-agent dispatch <role>`, not sequentially. Sub-agents: `code-reviewer`, `qa-test-cases-writer` (writes `qa/test-cases/<rid>.md`), `karpathy-reviewer` (the **hard Karpathy-Gate**). This is the v2.12.0 3-way fanout. Feature / refactor / bugfix: all three. Config / docs / chore: no fan-out — no `karpathy-reviewer` dispatched. OCR augmentation (B3): `peaksConfig.ocr.llm` → `peaks code-review run-ocr --json` → merge into `code-review.md`; → `references/ocr-integration.md`.
139
+ **v2.12.0 collapse (Group A — Tier 1+2+3):** the previous 5-way fan-out (slice 004 4-way + slice 5/6 `karpathy-reviewer` addition) totalled **5 sub-agents**. The `security-reviewer` and `perf-baseline-reviewer` slots moved out of the RD 3-way fan-out into two new standalone audit skills:
140
140
 
141
- > **v2.12.0 collapse (Group A):** the 5-way fan-out moved `security-reviewer` + `perf-baseline-reviewer` into standalone audit skills (`peaks-security-audit` + `peaks-perf-audit`). → `references/v2-12-fanout-collapse.md`.
141
+ - `peaks-security-audit` — CLI: `peaks security-audit run`. Writes `audit/security.md` (under `.peaks/_runtime/<sessionId>/audit/security.md`). Required RD-side prereq `AUDIT_SECURITY`.
142
+ - `peaks-perf-audit` — CLI: `peaks perf-audit run`. Writes `audit/perf.md` (under `.peaks/_runtime/<sessionId>/audit/perf.md`). Required RD-side prereq `AUDIT_PERF`.
142
143
 
143
- > **v2.15.0+:** 技术决策 AI 据 prd 业务场景块自决,user 不参与;存量项目无 UT,改 A 前跑 `peaks impact scan`(G13);fork 场景 tech-doc 列上游基线+业务 patch 集(G11)。详见 `.peaks/memory/peaks-loop-user-role-and-tech-decision.md`。
144
+ 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.md` and `rd/perf-baseline.md` paths readable via `mustContainAny` — see `references/rd-fanout-contracts.md` §"Deprecated reviewer back-compat".
144
145
 
145
- > **Slice 2026-06-24-efficiency-4p-bundle / G4 (P1.3) — karpathy-skip policy authoritative.** Decision table at `src/services/rd/reviewer-dispatch-policy.ts` (`shouldDispatchKarpathy`, `reviewerListFor`). Pinned by `tests/unit/rd/karpathy-skip-on-config-docs-chore.test.ts`.
146
+ **Current 3-way fan-out** (always runs for feature / refactor / bugfix; no fan-out for config / docs / chore):
146
147
 
147
- ### Hard Karpathy-Gate (Slice 5/6)
148
+ 1. `code-reviewer` — writes `rd/code-review.md` (Gate B3).
149
+ 2. `qa-test-cases-writer` — writes `qa/test-cases/<rid>.md` (Gate C2).
150
+ 3. `karpathy-reviewer` — writes `rd/karpathy-review.md` (the **hard Karpathy-Gate**, KARPATHY_REVIEW prereq).
148
151
 
149
- The `karpathy-reviewer` sub-agent is a **hard gate** for `rd:qa-handoff`. Per `andrej-karpathy-skills:karpathy-guidelines` §1 Think Before Coding ("state your assumptions") + §3 Surgical Changes ("touch only what the user asked"), `peaks request transition --state qa-handoff` is BLOCKED by the CLI gate until `.peaks/_runtime/<sessionId>/rd/karpathy-review.md` exists with the `## Karpathy-Gate` header and at least one of the 4 guideline section markers. The file is enforced by the `KARPATHY_REVIEW` prerequisite in `src/services/artifacts/artifact-prerequisites.ts` (added in Slice 5). The escape hatch is `peaks request transition --allow-incomplete --confirm` (assisted mode). The companion `peaks scan karpathy` CLI is a structural scanner for the same file (`src/services/scan/karpathy-service.ts`); the semantic review is the sub-agent's job.
150
-
151
- ### Peaks-Loop Gate C — type-specific RD evidence
152
-
153
- 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`.
154
-
155
- | Request type | Required RD evidence |
156
- |---|---|
157
- | feature / refactor | `audit/security.md` + `audit/perf.md` + `rd/code-review.md` + `rd/karpathy-review.md` + `qa/test-cases/<rid>.md` + `prd/handoff.md` |
158
- | bugfix | `audit/security.md` + `audit/perf.md` (perf-shaped only) + `rd/code-review.md` + `rd/karpathy-review.md` + `qa/test-cases/<rid>.md` + `prd/handoff.md` |
159
- | config | `audit/security.md` |
160
- | docs / chore | (no extra evidence required) |
161
-
162
- → see `references/rd-fanout-contracts.md` for the **3** sub-agents' contracts + hard prohibitions + aggregation + degradation. Pre-v2.12.0 `rd/{security-review,perf-baseline}.md` paths remain readable for the 1-minor-release back-compat window.
152
+ Full dispatch contract (when-to-fan-out rules, dispatch template, prereq gates) lives in **`references/parallel-review-fanout.md`**. Read that file before issuing any 3-way fan-out.
163
153
 
164
154
  ## Refactor hard gates
165
155
 
@@ -229,6 +219,12 @@ Do not bypass the parallel review fan-out when the slice has a code-review / qa-
229
219
 
230
220
  **Security / perf audit boundary (v2.12.0):** security and perf audit run as standalone audit skills (`peaks-security-audit`, `peaks-perf-audit`) whose outputs land at `audit/security.md` / `audit/perf.md`. RD does **not** dispatch `security-reviewer` or `perf-baseline-reviewer` sub-agents. See `references/rd-fanout-contracts.md` §"Deprecated reviewer back-compat".
231
221
 
222
+ ## Karpathy cost self-review (slice 2026-07-30-karpathy-cost-self-review)
223
+
224
+ The `karpathy-reviewer` sub-agent now reports its own runtime cost in the JSON envelope at `rd/karpathy-review.md` (fields `evaluationCost` + `costRatio`; see `agents/karpathy-reviewer.md` §4). The **orchestrator-side** command `peaks job karpathy-cost-check --review-file <path>` reads that envelope and decides whether to downgrade a `'block'` gateAction to `'warn'` when `costRatio > 10`. **24h-mode is the override** — the check is entirely skipped when `peaks session 24h-mode state` reports `24H_ACTIVE`.
225
+
226
+ The main RD loop MUST call `peaks job karpathy-cost-check` after every `peaks request transition --state qa-handoff` and before the next-slice work begins. If the decision kind is `downgraded`, the LLM MUST honor the downgraded `warn` and proceed to the next slice; the `'block'` was an artifact of the reviewer's own cost, not the slice's quality. If the decision kind is `reported` (costRatio > 50, gate not `'block'`), the LLM MAY continue; the sediment will be appended by `peaks memory extract` at handoff time. The full design lives in `.peaks/memory/2026-07-30-karpathy-evaluation-cost-self-review-design.md` (sediment locked 2026-07-30).
227
+
232
228
  ## Sub-agent context governance (G7 + G7.7 + G8 + G9 — slice #010)
233
229
 
234
230
  RD sub-agent prompt template MUST include the G7 path convention + G8.6 share protocol. Detailed protocol: `skills/peaks-code/references/context-governance.md` + `skills/peaks-code/references/headroom-integration.md`.
@@ -283,4 +279,17 @@ Index of every `references/` file in this skill. Read on demand.
283
279
  | `references/rd-transition-gates.md` | Per-gate A-A3-B-B9 contract. |
284
280
  | `references/refactor-workflow.md` | Refactor hard gates + required artifacts. |
285
281
  | `references/skill-presence-and-title.md` | RD skill presence (main loop only). |
286
- | `references/v2-12-fanout-collapse.md` | v2.12.0 fan-out collapse. |
282
+ | `references/v2-12-fanout-collapse.md` | v2.12.0 fan-out collapse. |
283
+ ## L2 surface reference (post rid-l2-extended)
284
+
285
+ For RD slices that touch the lease / dispatch / observability stack, the canonical L2 surface is the L2 ecosystem shipped 2026-07-29 (commits `33aad895` through `075321af`). The high-leverage CLIs RD slices will encounter:
286
+
287
+ - `peaks worktree spawn / renew / list / gc / lease-status / release` — lease lifecycle (source of truth for L2 hook gate)
288
+ - `peaks sub-agent dispatch --isolation worktree|container` — auto-spawns a lease; `PEAKS_WORKTREE_LEASE_ID` env var is the gate's lookup key
289
+ - `peaks container spawn / release` — L4 container runtime (Part 12); pairs with `--isolation container` on dispatch
290
+ - `peaks lease-metrics [--rate] [--all-sessions]` — per-kind event counts + leak-rate + lifetime stats
291
+ - `peaks lease-stats` — project-wide summary (per-rid / per-role / per-isolation breakdown)
292
+ - `peaks cron init / list / run` — scheduled tasks (lease-gc-daily built-in); `peaks cron-scheduler start` for daemon mode
293
+ - `peaks audit red-lines` — 119 catalog red-lines; 66 cli-backed enforcers (sweep 003) + 53 catalog
294
+
295
+ The pre-existing SKILL.md reference set (this section is additive — not a replacement) covers the LLM-flow contracts. The CLIs above are operator / dashboard surfaces.
@@ -2,6 +2,28 @@
2
2
 
3
3
  > Body of `## Sub-agent dispatch`. 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:
4
4
 
5
+ ## Superpowers chain refusal (L1 worktree governance — locked 2026-07-29)
6
+
7
+ You MUST NOT follow the superpowers chain for worktree decisions:
8
+
9
+ - superpowers:brainstorming → superpowers:writing-plans →
10
+ superpowers:subagent-driven-development → superpowers:using-git-worktrees
11
+
12
+ This chain ends with `git worktree add` (superpowers:using-git-worktrees SKILL.md line 96). It bypasses peaks-loop's L2 hook gate and L3 IDE `permissions.deny`. Even when L3 denies the terminal Skill, the chain has already taught you to use raw `git worktree add`, so L3 is not sufficient.
13
+
14
+ For worktree operations, use ONLY:
15
+
16
+ - `peaks worktree spawn --rid <rid> --ttl <duration> --purpose <text>` (after rid-L2-extended ships)
17
+ - until then: `peaks worktree auth grant --rid <id> --reason <text> --ttl <5m>`
18
+
19
+ The superpowers skills remain available as REFERENCE material for brainstorming / planning techniques, but MUST NOT be used as a workflow. peaks-rd's own PRD/RD artifacts (`.peaks/_runtime/<sessionId>/rd/requests/<rid>.md`) are authoritative.
20
+
21
+ If the upstream superpowers chain suggests raw `git worktree add`:
22
+
23
+ 1. STOP
24
+ 2. Re-author the plan as a peaks-rd artifact
25
+ 3. Continue with `peaks worktree spawn` (or the auth-grant fallback)
26
+
5
27
  ## Default `--from-dag` is mandatory (slice 2026-06-24-efficiency-4p-bundle / G2 / P0.3)
6
28
 
7
29
  > **Hard constraint**: when the swarm plan DAG has ≥ 2 leaves at the
@@ -74,6 +96,23 @@ What the sub-agent **MUST** still do, from this skill's contract:
74
96
 
75
97
  After returning, Code re-checks Gate B (`ls .peaks/_runtime/<sessionId>/rd/requests/<rid>.md` etc.) and proceeds to RD implementation, which is a different sub-agent or inline run.
76
98
 
99
+ ## G11.5 visibility contract (mandatory, slice 2026-07-28-sub-agent-visibility)
100
+
101
+ Any RD/QA/SC sub-agent dispatched by `peaks sub-agent dispatch --from-dag` (or by the single-shot `dispatch <role> --prompt ...` path) MUST register an artifact path via `--write-artifact <path>` BEFORE spawning, and the orchestrator MUST surface a 1-line `⏳ Spawning sub-agent via Task tool: <description>` prose to the user BEFORE each `Agent` tool call.
102
+
103
+ **Hard rules (text-locked, no skip):**
104
+
105
+ 1. **Artifact registration is mandatory for non-trivial RD/QA/SC sub-agents.** The dispatch CLI now exposes two new envelope fields — `artifactsPublicPaths: string[]` and `orchestratorVisibleHint: string` — that the orchestrator reads back to the user. The RD/QA/SC sub-agent MUST register the artifact path it intends to write via `--write-artifact <absolute-path>` so the envelope surfaces the path to the user before the agent actually starts. Skipping `--write-artifact` is a visibility regression: the user cannot tell what file the sub-agent will create.
106
+ 2. **Orchestrator surfaces the prose BEFORE spawning.** For every `Agent` tool call that materializes a `peaks sub-agent dispatch` envelope, the orchestrator MUST emit one visible line of prose to the user of the form `⏳ Spawning sub-agent via Task tool: <description>` where `<description>` is ≥ 6 chars and includes the rid. The line lives in the orchestrator's reply text, not in the tool result.
107
+ 3. **Fan-out keeps the line singular.** When the envelope returns `dispatchCount > 1` (i.e. `--from-dag` with N ≥ 2 leaves), the orchestrator emits the prose once for the whole batch, not N times. Per-leaf prose defeats the wall-time benefit of fan-out.
108
+ 4. **No auto-commit disclaimer survives this contract.** The same prompt template that today forbids `git commit / git push / install hooks / apply settings.json mutations` (slice 2026-06-28 incident) is unchanged. G11.5 layers ABOVE that — visibility first, hard prohibitions second.
109
+
110
+ **Where the orchestrator reads the values from**: `data.orchestratorVisibleHint` (one line, copy verbatim) and `data.artifactsPublicPaths` (the public list of artifact paths the sub-agent will own). The CLI fills these in; the orchestrator just transcribes.
111
+
112
+ **Regression guard**: `tests/unit/dispatch/dispatch-fanout-mandatory.test.ts` parses `rd-sub-agent-dispatch.md` and asserts the G11.5 heading is present. Do not delete the heading without updating the guard.
113
+
114
+ ---
115
+
77
116
  ## Test Tool Detection (mandatory)
78
117
 
79
118
  The dispatch CLI (`peaks sub-agent dispatch`) automatically prepends a Test Tool Detection block to every sub-agent prompt — telling the sub-agent to read `package.json#scripts.test` first and use the project-local runner (`./node_modules/.bin/<runner>` or `pnpm test -- <file>`). NEVER use `npx <runner>`. This rule is machine-injected, not a prompt ritual — every sub-agent gets it including rd/qa/ui/txt/sc.
@@ -0,0 +1,12 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "prompt": "根据 peaks-prd 产出的前端待联调 delta,在 /Users/yuanyuan/Desktop/work/platform-rag-web 中实现 UI/交互/API mock。项目没有后端 swagger.json,需要先用 mock/API contract 开发。",
5
+ "expected": "RD 先做 standards init/update dry-run 和项目扫描;非平凡变更检查 OpenSpec;按最小 slice 实现;新增/变更代码有单测或合理 focused coverage;前端/UI slice 自测必须用 headed gstack/browse/dist/browse 有头浏览器端到端验证并记录脱敏 route/actions、脱敏 console/network 观察和验收结果;完成 code review、安全 review、post-check dry-run 后才交给 QA;所有进入 .peaks/_runtime/<session-id>/rd/ 的浏览器证据必须脱敏,不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、raw browser/network state 或 PII/SSO/MFA 截图/日志。"
6
+ },
7
+ {
8
+ "id": 2,
9
+ "prompt": "目标项目是存量前端项目,整体 UT 覆盖率可能不达标,但本次只要求新增和改动部分覆盖。",
10
+ "expected": "不能因历史低覆盖直接失败;必须要求新增/改动代码的 focused test/coverage 证据,缺失则阻塞 RD completion。"
11
+ }
12
+ ]
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  name: peaks-reviewer
3
+ visibility: internal
3
4
  description: Third-party independent code-review skill for Peaks. Use as a parallel reviewer to karpathy-reviewer when a workflow needs an out-of-band (non-RD-model) review pass to mitigate single-LLM self-dogfood blind spots. Emits a schema-validated ReviewerEnvelope (no free-form LLM JSON). v2.14.0 G4.
4
5
  ---
5
6
 
@@ -74,3 +75,19 @@ Missing section: reviewer is skipped (transition still passes; envelope records
74
75
  ## Sub-agent dispatch (when launched by peaks-code swarm)
75
76
 
76
77
  When this skill runs as a sub-agent dispatched by peaks-code, the sub-agent receives the parent session id and change-id via envelope. It MUST write its output to `.peaks/_runtime/<sessionId>/rd/third-party-review.json` + `.md` and return a compact JSON envelope.
78
+
79
+ ## L2 surface reference (post rid-l2-extended)
80
+
81
+ For slices that touch the L2 surface, the canonical CLIs are:
82
+ - `peaks worktree {spawn,renew,list,gc,lease-status,release}` — lease lifecycle (Part 1-2)
83
+ - `peaks sub-agent dispatch --isolation worktree|container` — auto-spawns a lease (Part 2.C + Part 8 contract)
84
+ - `peaks container {spawn,release}` — L4 container runtime (Part 12, docker)
85
+ - `peaks lease-metrics [--rate] [--all-sessions]` — per-kind counts + leak rate (Part 4-5)
86
+ - `peaks lease-stats` — project-wide summary (Part 6)
87
+ - `peaks cron {init,list,run}` + `peaks cron-scheduler start` — periodic lease gc (Part 14-15)
88
+ - `peaks audit red-lines --project .` — 119 catalog red-lines / 86+ cli-backed enforcers / 0 prose-only (Part 13)
89
+
90
+ Verify the surface (no need to re-derive):
91
+ 1. `peaks audit red-lines --project .` reports `proseOnly: 0` for any shipped L2 surface.
92
+ 2. `peaks lease-metrics --rate` after a clean run reports `estimatedLeaked: 0`.
93
+ 3. `peaks worktree list` returns 0 active leases after a clean run.
@@ -170,3 +170,19 @@ git log --oneline -5
170
170
  Do not implement code or test logic. Do not create GitHub repositories directly from the skill body. Use the Peaks-Loop CLI artifact commands.
171
171
 
172
172
  Reference: `references/artifact-retention.md`.
173
+
174
+ ## L2 surface reference (post rid-l2-extended)
175
+
176
+ For slices that touch the L2 surface, the canonical CLIs are:
177
+ - `peaks worktree {spawn,renew,list,gc,lease-status,release}` — lease lifecycle (Part 1-2)
178
+ - `peaks sub-agent dispatch --isolation worktree|container` — auto-spawns a lease (Part 2.C + Part 8 contract)
179
+ - `peaks container {spawn,release}` — L4 container runtime (Part 12, docker)
180
+ - `peaks lease-metrics [--rate] [--all-sessions]` — per-kind counts + leak rate (Part 4-5)
181
+ - `peaks lease-stats` — project-wide summary (Part 6)
182
+ - `peaks cron {init,list,run}` + `peaks cron-scheduler start` — periodic lease gc (Part 14-15)
183
+ - `peaks audit red-lines --project .` — 119 catalog red-lines / 86 cli-backed enforcers / 51 discovered (Part 13)
184
+
185
+ Verify the surface (no need to re-derive):
186
+ 1. `peaks audit red-lines --project .` reports `proseOnly: 0` for any shipped L2 surface.
187
+ 2. `peaks lease-metrics --rate` after a clean run reports `estimatedLeaked: 0`.
188
+ 3. `peaks worktree list` returns 0 active leases after a clean run.