claude-code-session-manager 0.97.0 → 0.100.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 (430) hide show
  1. package/README.md +3 -3
  2. package/bin/cli.cjs +16 -4
  3. package/bin/node-floor.cjs +41 -0
  4. package/dist/assets/{DataModel-D93FoaOm.js → DataModel-HdR0AxFq.js} +1 -1
  5. package/dist/assets/{History-CXxxqNP1.js → History-Dr4Jr_5z.js} +2 -2
  6. package/dist/assets/{Hooks-CzeYFQjq.js → Hooks-NhrvH3JP.js} +3 -3
  7. package/dist/assets/{Library-D2zPkwOC.js → Library-Dv_EtIMr.js} +1 -1
  8. package/dist/assets/{MarkdownEditor-DbinP78A.js → MarkdownEditor-DTKDWV_n.js} +1 -1
  9. package/dist/assets/{McpServers-Bu_sVGLr.js → McpServers-M034G9B3.js} +2 -2
  10. package/dist/assets/{Memory-BgiI6LZ_.js → Memory-DzF1B4gx.js} +6 -6
  11. package/dist/assets/{Permissions-C1MMzZRm.js → Permissions-DrgbSGWl.js} +3 -3
  12. package/dist/assets/{Plugins-Dhu6wAZi.js → Plugins-Bd3ef35w.js} +2 -2
  13. package/dist/assets/{ProvenanceBadge-C3AcWKMG.js → ProvenanceBadge-DcBHT1Iy.js} +1 -1
  14. package/dist/assets/{SaveBar-plwYm0iO.js → SaveBar-rimJem-Y.js} +1 -1
  15. package/dist/assets/Scheduler-DjgFJl2w.js +16 -0
  16. package/dist/assets/{ScopeSwitcher-DFy0vv_o.js → ScopeSwitcher-CnAzTBrl.js} +1 -1
  17. package/dist/assets/Settings-Dc1F_sSg.js +3 -0
  18. package/dist/assets/{SkillReferenceGraph-DsI7hRPB.js → SkillReferenceGraph-B9aZDecM.js} +1 -1
  19. package/dist/assets/{Skills-3E748UfB.js → Skills-DRXd18gu.js} +2 -2
  20. package/dist/assets/{SystemPrompt-BqmfUJOd.js → SystemPrompt-ahy5-Fwe.js} +1 -1
  21. package/dist/assets/{TagLibrary-CPz6fO8Q.js → TagLibrary-C_tToDeL.js} +1 -1
  22. package/dist/assets/{TiptapBody-D9EoBQ1P.js → TiptapBody-DvdefS6K.js} +1 -1
  23. package/dist/assets/{Toggle-BHAmZNDn.js → Toggle-6Jl5Njc6.js} +1 -1
  24. package/dist/assets/{index-CKH5Uxik.css → index-Bta-hwud.css} +1 -1
  25. package/dist/assets/{index-tn5JIVPj.js → index-vx8O73l8.js} +497 -502
  26. package/dist/assets/{settingsSchema-Crqy_aNz.js → settingsSchema-D6iRguNV.js} +1 -1
  27. package/dist/index.html +2 -2
  28. package/package.json +26 -29
  29. package/plugins/CLAUDE.md +6 -6
  30. package/plugins/session-manager-dev/skills/builder/4-manual/SKILL.md +23 -19
  31. package/plugins/session-manager-dev/skills/builder/SKILL.md +3 -3
  32. package/plugins/session-manager-dev/skills/develop/SKILL.md +254 -510
  33. package/plugins/session-manager-dev/skills/develop/standards.md +17 -22
  34. package/scripts/README.md +3 -11
  35. package/scripts/audit-ops-hygiene.cjs +3 -3
  36. package/scripts/hooks/lib/guard-prd-writes-policy.cjs +1 -1
  37. package/scripts/hooks/lib/guard-self-schedule-policy.cjs +1 -1
  38. package/scripts/mint-epic.cjs +2 -3
  39. package/scripts/scheduler-mcp-server.cjs +36 -7
  40. package/src/main/agentLibrary.cjs +22 -2
  41. package/src/main/build-info.json +4 -4
  42. package/src/main/config.cjs +41 -38
  43. package/src/main/docEdit.cjs +4 -1
  44. package/src/main/files.cjs +2 -5
  45. package/src/main/health.cjs +1 -1
  46. package/src/main/index.cjs +23 -10
  47. package/src/main/ipcSchemas.cjs +28 -35
  48. package/src/main/lib/agentPersonaSchema.cjs +13 -2
  49. package/src/main/lib/atomicFs.cjs +116 -0
  50. package/src/main/lib/branchSweep.cjs +13 -12
  51. package/src/main/lib/buildTarget.cjs +3 -3
  52. package/src/main/lib/claudeCliCaps.cjs +129 -0
  53. package/src/main/lib/credentials.cjs +2 -4
  54. package/src/main/lib/crossProjectFeedback.cjs +3 -3
  55. package/src/main/lib/cwdClassify.cjs +15 -3
  56. package/src/main/lib/definitionOfDone.cjs +207 -125
  57. package/src/main/lib/dodDrainHook.cjs +11 -5
  58. package/src/main/lib/epicMint.cjs +2 -4
  59. package/src/main/lib/epicStatusMirror.cjs +8 -10
  60. package/src/main/lib/epicWorktreeProjectConfig.cjs +2 -4
  61. package/src/main/lib/gateAuthority.cjs +96 -0
  62. package/src/main/lib/gitExec.cjs +69 -0
  63. package/src/main/lib/gitWorktree.cjs +656 -92
  64. package/src/main/lib/instanceLock.cjs +5 -8
  65. package/src/main/lib/launchFailure.cjs +2 -3
  66. package/src/main/lib/macroLibrary.cjs +386 -0
  67. package/src/main/lib/mcpToolCatalog.cjs +26 -17
  68. package/src/main/lib/needsReviewLedger.cjs +1 -1
  69. package/src/main/lib/opsErrorLog.cjs +11 -1
  70. package/src/main/lib/opsOwnership.cjs +0 -5
  71. package/src/main/lib/pidAlive.cjs +32 -0
  72. package/src/main/lib/prdCreate.cjs +153 -19
  73. package/src/main/lib/prdDisposition.cjs +2 -2
  74. package/src/main/lib/prdGateFiles.cjs +284 -0
  75. package/src/main/lib/prdLocations.cjs +61 -0
  76. package/src/main/lib/prdMigration.cjs +2 -3
  77. package/src/main/lib/prdSizing.cjs +2 -1
  78. package/src/main/lib/promptSessionSchema.cjs +10 -2
  79. package/src/main/lib/rcaReport.cjs +4 -6
  80. package/src/main/lib/reaperHelpers.cjs +8 -1
  81. package/src/main/lib/reservationExpiry.cjs +6 -1
  82. package/src/main/lib/reviewNotice.cjs +263 -0
  83. package/src/main/lib/runClaudeP.cjs +4 -1
  84. package/src/main/lib/schedulerPaths.cjs +22 -2
  85. package/src/main/lib/sessionSlots.cjs +2 -4
  86. package/src/main/lib/shippedPersonaSeeds.cjs +179 -0
  87. package/src/main/lib/timeoutShim.cjs +123 -0
  88. package/src/main/lib/timeoutShimScript.cjs +275 -0
  89. package/src/main/lib/upgradeDrain.cjs +4 -10
  90. package/src/main/lib/watchdogHelpers.cjs +33 -30
  91. package/src/main/lib/workTypeLibrary.cjs +7 -1
  92. package/src/main/promptSessionEvents.cjs +37 -13
  93. package/src/main/queueOps.cjs +17 -6
  94. package/src/main/scheduler.cjs +975 -203
  95. package/src/main/seedAgentPersonas.cjs +278 -23
  96. package/src/main/supervisor.cjs +4 -1
  97. package/src/main/templates/PRD_AUTHORING.md +126 -406
  98. package/src/preload/__tests__/preload-surface.test.cjs +68 -0
  99. package/src/preload/api.d.ts +41 -94
  100. package/src/preload/index.cjs +14 -9
  101. package/src/seed/agents/architect.md +1 -0
  102. package/src/seed/agents/dev-lead.md +17 -18
  103. package/src/seed/agents/project-home-builder.md +1 -0
  104. package/src/seed/agents/validator.md +10 -4
  105. package/dist/assets/HostBilko-nESrTRIg.js +0 -1
  106. package/dist/assets/Scheduler-BVYTeh39.js +0 -16
  107. package/dist/assets/Settings-DIhGgdfs.js +0 -3
  108. package/src/main/__tests__/activeIndexMerge.test.cjs +0 -235
  109. package/src/main/__tests__/agentEffortResolve.test.cjs +0 -117
  110. package/src/main/__tests__/agentLibrary.test.cjs +0 -276
  111. package/src/main/__tests__/agentModelResolve.test.cjs +0 -311
  112. package/src/main/__tests__/agentOverlayWrite.test.cjs +0 -95
  113. package/src/main/__tests__/bilkoHost-deriveSlug.test.cjs +0 -26
  114. package/src/main/__tests__/bilkoHost-integration.test.cjs +0 -118
  115. package/src/main/__tests__/bilkoHostCore.test.cjs +0 -72
  116. package/src/main/__tests__/broadcastCoalescer.test.cjs +0 -122
  117. package/src/main/__tests__/chat-cancel-terminal.test.cjs +0 -120
  118. package/src/main/__tests__/chat-dead-channels.test.cjs +0 -63
  119. package/src/main/__tests__/chat-exit-close-race.test.cjs +0 -146
  120. package/src/main/__tests__/chat-mcp-consent-notice.test.cjs +0 -139
  121. package/src/main/__tests__/chat-preamble-anchors.test.cjs +0 -100
  122. package/src/main/__tests__/chat-queue.test.cjs +0 -97
  123. package/src/main/__tests__/chat-stop-signal.test.cjs +0 -89
  124. package/src/main/__tests__/chatRunner-epic-worktree-execcwd.test.cjs +0 -125
  125. package/src/main/__tests__/chatRunner-session-flag-retry.test.cjs +0 -252
  126. package/src/main/__tests__/classifyPromptTicket.test.cjs +0 -101
  127. package/src/main/__tests__/classifyTranscriptLine.test.cjs +0 -201
  128. package/src/main/__tests__/computeDepHistorySatisfaction.test.cjs +0 -66
  129. package/src/main/__tests__/config-readText-bounded.test.cjs +0 -84
  130. package/src/main/__tests__/configWriteBoundaryOwners.test.cjs +0 -59
  131. package/src/main/__tests__/crossProjectFeedback.test.cjs +0 -334
  132. package/src/main/__tests__/crossProjectFeedbackRoutes.test.cjs +0 -161
  133. package/src/main/__tests__/dep-orphan-archive-health.test.cjs +0 -77
  134. package/src/main/__tests__/develop-skill-failure-modes.test.cjs +0 -70
  135. package/src/main/__tests__/docEdit.test.cjs +0 -244
  136. package/src/main/__tests__/dod-batchkey.test.cjs +0 -183
  137. package/src/main/__tests__/dod-drain-hook.test.cjs +0 -302
  138. package/src/main/__tests__/dod-report.test.cjs +0 -304
  139. package/src/main/__tests__/dod-reverify.test.cjs +0 -285
  140. package/src/main/__tests__/epicContextDigest.test.cjs +0 -174
  141. package/src/main/__tests__/epicMint.test.cjs +0 -332
  142. package/src/main/__tests__/epicMintTelemetryTap.test.cjs +0 -64
  143. package/src/main/__tests__/epicStatusMirror.test.cjs +0 -110
  144. package/src/main/__tests__/epicValidationHook.test.cjs +0 -291
  145. package/src/main/__tests__/exchanges.test.cjs +0 -122
  146. package/src/main/__tests__/exchangesPromptId.test.cjs +0 -61
  147. package/src/main/__tests__/extractJson.test.cjs +0 -51
  148. package/src/main/__tests__/files-reject-credentials.test.cjs +0 -40
  149. package/src/main/__tests__/fixtures/1218-fo-01-move-scripts-lib-into-src-main-lib.log +0 -556
  150. package/src/main/__tests__/flatPrdTickSweep.test.cjs +0 -110
  151. package/src/main/__tests__/health-build-freshness.test.cjs +0 -39
  152. package/src/main/__tests__/health-claude-md-budget.test.cjs +0 -57
  153. package/src/main/__tests__/health-credentials.test.cjs +0 -81
  154. package/src/main/__tests__/health-delegation-chain.test.cjs +0 -124
  155. package/src/main/__tests__/health-per-project-stall.test.cjs +0 -84
  156. package/src/main/__tests__/health-prd-migration.test.cjs +0 -37
  157. package/src/main/__tests__/health-queue-dispatch.test.cjs +0 -135
  158. package/src/main/__tests__/health-starve-escalation.test.cjs +0 -94
  159. package/src/main/__tests__/health-tick-liveness.test.cjs +0 -179
  160. package/src/main/__tests__/health-usage-poller.test.cjs +0 -144
  161. package/src/main/__tests__/health-worktree-cap-blocked.test.cjs +0 -65
  162. package/src/main/__tests__/heapSnapshot.test.cjs +0 -121
  163. package/src/main/__tests__/historyAggregatorIntraday.test.cjs +0 -313
  164. package/src/main/__tests__/historyDashboard.test.cjs +0 -163
  165. package/src/main/__tests__/historyRollup.test.cjs +0 -333
  166. package/src/main/__tests__/intradayRefresh.test.cjs +0 -39
  167. package/src/main/__tests__/ipcSchemas-dependsOn.test.cjs +0 -39
  168. package/src/main/__tests__/kg-augment.test.cjs +0 -195
  169. package/src/main/__tests__/loadGateDetailTick.test.cjs +0 -31
  170. package/src/main/__tests__/machineProfile.test.cjs +0 -152
  171. package/src/main/__tests__/mcpStatus.test.cjs +0 -61
  172. package/src/main/__tests__/memoryAggregate.test.cjs +0 -109
  173. package/src/main/__tests__/memoryStale.test.cjs +0 -88
  174. package/src/main/__tests__/needsReviewLedger.test.cjs +0 -162
  175. package/src/main/__tests__/openExternalApp-spawn-error.test.cjs +0 -25
  176. package/src/main/__tests__/opsErrorLog.test.cjs +0 -109
  177. package/src/main/__tests__/opsErrorLogTelemetryTap.test.cjs +0 -173
  178. package/src/main/__tests__/personaMerge.test.cjs +0 -169
  179. package/src/main/__tests__/planValidator.test.cjs +0 -125
  180. package/src/main/__tests__/pollLoop-dispatch-on-failure.test.cjs +0 -176
  181. package/src/main/__tests__/prd-group-allocator.test.cjs +0 -119
  182. package/src/main/__tests__/prdAdminRouteParity.test.cjs +0 -70
  183. package/src/main/__tests__/prdAdminRoutes.test.cjs +0 -718
  184. package/src/main/__tests__/prdAgentType.test.cjs +0 -103
  185. package/src/main/__tests__/prdAuthoringSeed.test.cjs +0 -39
  186. package/src/main/__tests__/prdCreate.test.cjs +0 -979
  187. package/src/main/__tests__/prdCreateDisposition.test.cjs +0 -201
  188. package/src/main/__tests__/prdCreatePlanId.test.cjs +0 -132
  189. package/src/main/__tests__/prdFrontmatterAgentType.test.cjs +0 -117
  190. package/src/main/__tests__/prdFrontmatterDependsOn.test.cjs +0 -136
  191. package/src/main/__tests__/prdFrontmatterDisposition.test.cjs +0 -125
  192. package/src/main/__tests__/prdFrontmatterQuietMachine.test.cjs +0 -108
  193. package/src/main/__tests__/prdLocations.test.cjs +0 -195
  194. package/src/main/__tests__/prdLocationsArchived.test.cjs +0 -201
  195. package/src/main/__tests__/prdMigration.test.cjs +0 -349
  196. package/src/main/__tests__/prdMigrationLegacyAdopt.test.cjs +0 -91
  197. package/src/main/__tests__/prdParserHighWater.test.cjs +0 -74
  198. package/src/main/__tests__/prdParserSourcePromptId.test.cjs +0 -65
  199. package/src/main/__tests__/prdSetDisposition.test.cjs +0 -222
  200. package/src/main/__tests__/prdSizing.test.cjs +0 -106
  201. package/src/main/__tests__/prdSourcePromptIdBackfill.test.cjs +0 -118
  202. package/src/main/__tests__/prdUpdateDependsOn.test.cjs +0 -160
  203. package/src/main/__tests__/proc-role-env.test.cjs +0 -125
  204. package/src/main/__tests__/procname-claude-spawn-sites.test.cjs +0 -304
  205. package/src/main/__tests__/procname-sm-processes.test.cjs +0 -127
  206. package/src/main/__tests__/projectHomeAdminRoutes.test.cjs +0 -177
  207. package/src/main/__tests__/projectPages.test.cjs +0 -137
  208. package/src/main/__tests__/promptSessionEvents.test.cjs +0 -234
  209. package/src/main/__tests__/promptSessionSchema.test.cjs +0 -101
  210. package/src/main/__tests__/promptSessionTranscript.test.cjs +0 -0
  211. package/src/main/__tests__/promptSessionsCreateEpicHandler.test.cjs +0 -159
  212. package/src/main/__tests__/pty-epic-worktree-spawn-cwd.test.cjs +0 -282
  213. package/src/main/__tests__/pty-session-open-telemetry.test.cjs +0 -96
  214. package/src/main/__tests__/pty-write-result.test.cjs +0 -46
  215. package/src/main/__tests__/queue-health-verdict.test.cjs +0 -170
  216. package/src/main/__tests__/queue-starvation-dispatch-driver.test.cjs +0 -286
  217. package/src/main/__tests__/queue-starvation-per-project.test.cjs +0 -147
  218. package/src/main/__tests__/queueHistory.test.cjs +0 -355
  219. package/src/main/__tests__/queueOps-interactive-ac-lint.test.cjs +0 -65
  220. package/src/main/__tests__/queueOpsArchiveDestination.test.cjs +0 -65
  221. package/src/main/__tests__/queueOpsAutoArchive.test.cjs +0 -154
  222. package/src/main/__tests__/rateLimitPollerStreak.test.cjs +0 -128
  223. package/src/main/__tests__/rcaReport.test.cjs +0 -266
  224. package/src/main/__tests__/reconcileFlatPrdSweep.test.cjs +0 -119
  225. package/src/main/__tests__/reconcileTiming.test.cjs +0 -135
  226. package/src/main/__tests__/runLogRetention.test.cjs +0 -489
  227. package/src/main/__tests__/runVerify-atomic-verdicts.test.cjs +0 -26
  228. package/src/main/__tests__/runVerify-blocked-by-foreign-wip.test.cjs +0 -58
  229. package/src/main/__tests__/runVerify-landed-commit-outranks.test.cjs +0 -191
  230. package/src/main/__tests__/runVerify-policy-denial.test.cjs +0 -89
  231. package/src/main/__tests__/runVerify-transcript-commit-evidence.test.cjs +0 -225
  232. package/src/main/__tests__/runVerify.test.cjs +0 -1784
  233. package/src/main/__tests__/scheduleJobSchema.test.cjs +0 -127
  234. package/src/main/__tests__/scheduleJobStatusDrift.test.cjs +0 -65
  235. package/src/main/__tests__/scheduleJobTransitions.test.cjs +0 -277
  236. package/src/main/__tests__/scheduleJobTransitionsGrep.test.cjs +0 -59
  237. package/src/main/__tests__/scheduleJobTransitionsTelemetryTap.test.cjs +0 -72
  238. package/src/main/__tests__/scheduler-admin-routes.test.cjs +0 -199
  239. package/src/main/__tests__/scheduler-adopted-run-supervision.test.cjs +0 -143
  240. package/src/main/__tests__/scheduler-already-satisfied-on-main.test.cjs +0 -105
  241. package/src/main/__tests__/scheduler-archive-completed-prd.test.cjs +0 -102
  242. package/src/main/__tests__/scheduler-archived-twin-guard.test.cjs +0 -155
  243. package/src/main/__tests__/scheduler-autofix-outcome.test.cjs +0 -188
  244. package/src/main/__tests__/scheduler-autofix-select.test.cjs +0 -439
  245. package/src/main/__tests__/scheduler-autopromote.test.cjs +0 -51
  246. package/src/main/__tests__/scheduler-bash-timeout-env.test.cjs +0 -101
  247. package/src/main/__tests__/scheduler-blocked-by-foreign-wip.test.cjs +0 -107
  248. package/src/main/__tests__/scheduler-boot-orphans.test.cjs +0 -153
  249. package/src/main/__tests__/scheduler-broadcast-reconcile.test.cjs +0 -121
  250. package/src/main/__tests__/scheduler-clear-queue-history.test.cjs +0 -134
  251. package/src/main/__tests__/scheduler-commit-guard-noop.test.cjs +0 -244
  252. package/src/main/__tests__/scheduler-committed-in-window.test.cjs +0 -182
  253. package/src/main/__tests__/scheduler-cross-project-batch.test.cjs +0 -43
  254. package/src/main/__tests__/scheduler-default-eligible-heal.test.cjs +0 -168
  255. package/src/main/__tests__/scheduler-dispatch-loop.test.cjs +0 -58
  256. package/src/main/__tests__/scheduler-effective-concurrency.test.cjs +0 -81
  257. package/src/main/__tests__/scheduler-epic-digest.test.cjs +0 -227
  258. package/src/main/__tests__/scheduler-failed-autoreset.test.cjs +0 -121
  259. package/src/main/__tests__/scheduler-finalize-dispatch-guards.test.cjs +0 -229
  260. package/src/main/__tests__/scheduler-find-prd-dir.test.cjs +0 -75
  261. package/src/main/__tests__/scheduler-fix-plan-path.test.cjs +0 -119
  262. package/src/main/__tests__/scheduler-force-tick-outcome.test.cjs +0 -46
  263. package/src/main/__tests__/scheduler-foreign-wip-manifest.test.cjs +0 -78
  264. package/src/main/__tests__/scheduler-gate-shadow.test.cjs +0 -119
  265. package/src/main/__tests__/scheduler-guard-verdict-autoresolve.test.cjs +0 -390
  266. package/src/main/__tests__/scheduler-heal-refusal.test.cjs +0 -61
  267. package/src/main/__tests__/scheduler-heartbeat-payload.test.cjs +0 -80
  268. package/src/main/__tests__/scheduler-inplace-salvage.test.cjs +0 -323
  269. package/src/main/__tests__/scheduler-integration-failure-stamp.test.cjs +0 -41
  270. package/src/main/__tests__/scheduler-investigation-clean-skip.test.cjs +0 -63
  271. package/src/main/__tests__/scheduler-investigation-prompt.test.cjs +0 -123
  272. package/src/main/__tests__/scheduler-job-budget.test.cjs +0 -172
  273. package/src/main/__tests__/scheduler-job-overrun.test.cjs +0 -175
  274. package/src/main/__tests__/scheduler-launch-failure.test.cjs +0 -199
  275. package/src/main/__tests__/scheduler-leftover-fields.test.cjs +0 -52
  276. package/src/main/__tests__/scheduler-leftover-quarantine.test.cjs +0 -199
  277. package/src/main/__tests__/scheduler-looks-done.test.cjs +0 -537
  278. package/src/main/__tests__/scheduler-manual-pause.test.cjs +0 -118
  279. package/src/main/__tests__/scheduler-mechanical-recovery.test.cjs +0 -245
  280. package/src/main/__tests__/scheduler-meta-code-sha.test.cjs +0 -46
  281. package/src/main/__tests__/scheduler-needs-review-autoresolve.test.cjs +0 -197
  282. package/src/main/__tests__/scheduler-never-stop.test.cjs +0 -157
  283. package/src/main/__tests__/scheduler-no-dead-end-status.test.cjs +0 -152
  284. package/src/main/__tests__/scheduler-no-orphan-run-dir.test.cjs +0 -81
  285. package/src/main/__tests__/scheduler-notify-originating-tab-transcript.test.cjs +0 -87
  286. package/src/main/__tests__/scheduler-notify-originating-tab.test.cjs +0 -343
  287. package/src/main/__tests__/scheduler-periodic-reverify-guard.test.cjs +0 -217
  288. package/src/main/__tests__/scheduler-porcelain-rename.test.cjs +0 -164
  289. package/src/main/__tests__/scheduler-prd-missing-skip.test.cjs +0 -161
  290. package/src/main/__tests__/scheduler-prd-persona-spawn.test.cjs +0 -178
  291. package/src/main/__tests__/scheduler-quarantine-autoresolve.test.cjs +0 -165
  292. package/src/main/__tests__/scheduler-quiet-machine-lease.test.cjs +0 -257
  293. package/src/main/__tests__/scheduler-rate-limit-cooldown-freshness.test.cjs +0 -123
  294. package/src/main/__tests__/scheduler-rate-limit-pause.test.cjs +0 -152
  295. package/src/main/__tests__/scheduler-rate-limit-spin-guard.test.cjs +0 -156
  296. package/src/main/__tests__/scheduler-reap-dead-running-jobs.test.cjs +0 -754
  297. package/src/main/__tests__/scheduler-reaper-helpers-basics.test.cjs +0 -87
  298. package/src/main/__tests__/scheduler-reconcile-cwd-preserve.test.cjs +0 -100
  299. package/src/main/__tests__/scheduler-reconcile-history-backfill.test.cjs +0 -105
  300. package/src/main/__tests__/scheduler-reconcile-invalid-repair.test.cjs +0 -203
  301. package/src/main/__tests__/scheduler-reconcile-quarantine.test.cjs +0 -247
  302. package/src/main/__tests__/scheduler-reset-job-fields-guard.test.cjs +0 -77
  303. package/src/main/__tests__/scheduler-resume-recovery.test.cjs +0 -254
  304. package/src/main/__tests__/scheduler-shard-quarantine.test.cjs +0 -115
  305. package/src/main/__tests__/scheduler-shared-tree-guard.test.cjs +0 -380
  306. package/src/main/__tests__/scheduler-sigterm-commit.test.cjs +0 -43
  307. package/src/main/__tests__/scheduler-stall-per-project.test.cjs +0 -126
  308. package/src/main/__tests__/scheduler-starve-escalation.test.cjs +0 -154
  309. package/src/main/__tests__/scheduler-stranded-autofix-park.test.cjs +0 -252
  310. package/src/main/__tests__/scheduler-stranded-investigation.test.cjs +0 -185
  311. package/src/main/__tests__/scheduler-stuck-failed-escalation.test.cjs +0 -136
  312. package/src/main/__tests__/scheduler-supervisor-record.test.cjs +0 -81
  313. package/src/main/__tests__/scheduler-tick-cancel-token.test.cjs +0 -54
  314. package/src/main/__tests__/scheduler-tick-wedge.test.cjs +0 -172
  315. package/src/main/__tests__/scheduler-transient-failure.test.cjs +0 -141
  316. package/src/main/__tests__/scheduler-unreadable-queue-guard.test.cjs +0 -62
  317. package/src/main/__tests__/scheduler-utilization-hold.test.cjs +0 -89
  318. package/src/main/__tests__/scheduler-verify-prd-path.test.cjs +0 -109
  319. package/src/main/__tests__/scheduler-worktree-cap-defer.test.cjs +0 -234
  320. package/src/main/__tests__/scheduler-worktree-exec-cwd.test.cjs +0 -120
  321. package/src/main/__tests__/scheduler-writeprd-epic-rollback.test.cjs +0 -105
  322. package/src/main/__tests__/schedulerBatchRootBlocker.test.cjs +0 -117
  323. package/src/main/__tests__/schedulerStateSidecarRestore.test.cjs +0 -110
  324. package/src/main/__tests__/seedAgentPersonas.test.cjs +0 -184
  325. package/src/main/__tests__/seedSchedulerMcp.test.cjs +0 -211
  326. package/src/main/__tests__/seedStatus.test.cjs +0 -100
  327. package/src/main/__tests__/seedValidatorPersona.test.cjs +0 -116
  328. package/src/main/__tests__/stop-signal-anchor.test.cjs +0 -75
  329. package/src/main/__tests__/telemetryClient.test.cjs +0 -1055
  330. package/src/main/__tests__/telemetryContract.test.cjs +0 -930
  331. package/src/main/__tests__/telemetrySettings.test.cjs +0 -210
  332. package/src/main/__tests__/transcripts-batch-flush.test.cjs +0 -249
  333. package/src/main/__tests__/transcripts-doFlush-array.test.cjs +0 -124
  334. package/src/main/__tests__/transcripts-paged-reads.test.cjs +0 -241
  335. package/src/main/__tests__/transcripts-worktree-epic-path.test.cjs +0 -154
  336. package/src/main/__tests__/transcriptsUsageFor.test.cjs +0 -206
  337. package/src/main/__tests__/uniquePrdNumbers.test.cjs +0 -153
  338. package/src/main/__tests__/usageSingleFlight.test.cjs +0 -169
  339. package/src/main/__tests__/validationSentinels.test.cjs +0 -84
  340. package/src/main/__tests__/workTypeLibrary.test.cjs +0 -89
  341. package/src/main/bilkoHost.cjs +0 -314
  342. package/src/main/bilkoHostCore.cjs +0 -89
  343. package/src/main/lib/__tests__/active-sessions.test.cjs +0 -251
  344. package/src/main/lib/__tests__/activeIndexRebuild.test.cjs +0 -179
  345. package/src/main/lib/__tests__/agentPersonaSchema.test.cjs +0 -67
  346. package/src/main/lib/__tests__/auditLog.test.cjs +0 -38
  347. package/src/main/lib/__tests__/bootSelfHeal.test.cjs +0 -107
  348. package/src/main/lib/__tests__/branchSweep.test.cjs +0 -164
  349. package/src/main/lib/__tests__/buildIdentity.test.cjs +0 -121
  350. package/src/main/lib/__tests__/buildTarget.test.cjs +0 -52
  351. package/src/main/lib/__tests__/childWithLog.test.cjs +0 -321
  352. package/src/main/lib/__tests__/coldBootPromptSessionsWrite.test.cjs +0 -87
  353. package/src/main/lib/__tests__/crashTelemetry.test.cjs +0 -103
  354. package/src/main/lib/__tests__/credentials-futile-refresh.test.cjs +0 -115
  355. package/src/main/lib/__tests__/cwdClassify.test.cjs +0 -111
  356. package/src/main/lib/__tests__/definitionOfDoneSequence.test.cjs +0 -95
  357. package/src/main/lib/__tests__/delegationReadiness.test.cjs +0 -1175
  358. package/src/main/lib/__tests__/dispatchLoop.test.cjs +0 -63
  359. package/src/main/lib/__tests__/effectiveModelInfo.test.cjs +0 -244
  360. package/src/main/lib/__tests__/ephemeralCwd.test.cjs +0 -91
  361. package/src/main/lib/__tests__/epicDelegationStats.test.cjs +0 -137
  362. package/src/main/lib/__tests__/epicSpawnCwd.test.cjs +0 -283
  363. package/src/main/lib/__tests__/epicSpawnPlan.test.cjs +0 -196
  364. package/src/main/lib/__tests__/epicTranscriptPath.test.cjs +0 -163
  365. package/src/main/lib/__tests__/epicWorktreeBoot.test.cjs +0 -136
  366. package/src/main/lib/__tests__/epicWorktreeMerge.test.cjs +0 -130
  367. package/src/main/lib/__tests__/epicWorktreeMint.test.cjs +0 -117
  368. package/src/main/lib/__tests__/epicWorktreeProjectConfig.test.cjs +0 -137
  369. package/src/main/lib/__tests__/fixChainDepth.test.cjs +0 -40
  370. package/src/main/lib/__tests__/fixtures/204-mercury-steam-horse.log.txt +0 -13
  371. package/src/main/lib/__tests__/fixtures/scheduler-machine.json.corrupt-1789147548 +0 -34
  372. package/src/main/lib/__tests__/gateFixtures.json +0 -20
  373. package/src/main/lib/__tests__/gitCacheBound.test.cjs +0 -69
  374. package/src/main/lib/__tests__/gitWorktree.test.cjs +0 -1478
  375. package/src/main/lib/__tests__/gitWorktreeSalvage.test.cjs +0 -107
  376. package/src/main/lib/__tests__/gitWorktreeSalvageDelta.test.cjs +0 -153
  377. package/src/main/lib/__tests__/guardShims.test.cjs +0 -158
  378. package/src/main/lib/__tests__/importReferences.spec.cjs +0 -56
  379. package/src/main/lib/__tests__/instanceLock.test.cjs +0 -173
  380. package/src/main/lib/__tests__/jobSupervisorRecord.test.cjs +0 -78
  381. package/src/main/lib/__tests__/jobWorktree.test.cjs +0 -199
  382. package/src/main/lib/__tests__/jobWorktreeBootLive.test.cjs +0 -82
  383. package/src/main/lib/__tests__/landedSinceRun.test.cjs +0 -133
  384. package/src/main/lib/__tests__/launchFailure.test.cjs +0 -220
  385. package/src/main/lib/__tests__/loadGate.test.cjs +0 -303
  386. package/src/main/lib/__tests__/localAdminHttp.test.cjs +0 -214
  387. package/src/main/lib/__tests__/loopDelay.test.cjs +0 -68
  388. package/src/main/lib/__tests__/mcpToolCatalog.test.cjs +0 -107
  389. package/src/main/lib/__tests__/modelCatalog.test.cjs +0 -202
  390. package/src/main/lib/__tests__/opsOwnership.test.cjs +0 -113
  391. package/src/main/lib/__tests__/opsRootAbsoluteCwd.test.cjs +0 -328
  392. package/src/main/lib/__tests__/opsRootNestedWrite.test.cjs +0 -51
  393. package/src/main/lib/__tests__/opsRootResolve.test.cjs +0 -149
  394. package/src/main/lib/__tests__/prdDeclaredPaths.test.cjs +0 -82
  395. package/src/main/lib/__tests__/prdDisposition.test.cjs +0 -224
  396. package/src/main/lib/__tests__/procIdentity.test.cjs +0 -119
  397. package/src/main/lib/__tests__/procName.test.cjs +0 -92
  398. package/src/main/lib/__tests__/projectBriefCore.test.cjs +0 -216
  399. package/src/main/lib/__tests__/projectRootResolve.test.cjs +0 -148
  400. package/src/main/lib/__tests__/queueHealth.test.cjs +0 -58
  401. package/src/main/lib/__tests__/queueStoreAtomicWrite.test.cjs +0 -88
  402. package/src/main/lib/__tests__/queueStoreMachineStateRecovery.test.cjs +0 -190
  403. package/src/main/lib/__tests__/quietMachineLease.test.cjs +0 -39
  404. package/src/main/lib/__tests__/rateLimitWindow.test.cjs +0 -88
  405. package/src/main/lib/__tests__/reaperHelpers.test.cjs +0 -577
  406. package/src/main/lib/__tests__/schedulerBatchDepends.test.cjs +0 -312
  407. package/src/main/lib/__tests__/schedulerBatchFairness.test.cjs +0 -213
  408. package/src/main/lib/__tests__/schedulerBatchLaunchHold.test.cjs +0 -125
  409. package/src/main/lib/__tests__/schedulerBatchProjectCap.test.cjs +0 -127
  410. package/src/main/lib/__tests__/schedulerBatchQuietMachine.test.cjs +0 -109
  411. package/src/main/lib/__tests__/schedulerMcpServerHeadlessRefusal.test.cjs +0 -71
  412. package/src/main/lib/__tests__/schedulerMcpServerHelp.test.cjs +0 -216
  413. package/src/main/lib/__tests__/schedulerMcpServerProjectHome.test.cjs +0 -183
  414. package/src/main/lib/__tests__/schedulerPaths.test.cjs +0 -226
  415. package/src/main/lib/__tests__/schedulerPathsWorktree.test.cjs +0 -133
  416. package/src/main/lib/__tests__/schedulerRuntimeState.test.cjs +0 -56
  417. package/src/main/lib/__tests__/sessionSlots.test.cjs +0 -144
  418. package/src/main/lib/__tests__/telemetryBacklog.test.cjs +0 -626
  419. package/src/main/lib/__tests__/telemetryBoot.test.cjs +0 -134
  420. package/src/main/lib/__tests__/telemetryConsent.test.cjs +0 -136
  421. package/src/main/lib/__tests__/telemetryCounters.test.cjs +0 -57
  422. package/src/main/lib/__tests__/telemetryCountersMetadataColumn.test.cjs +0 -98
  423. package/src/main/lib/__tests__/terminalRunOutcome.test.cjs +0 -200
  424. package/src/main/lib/__tests__/toolUseClassify.test.cjs +0 -53
  425. package/src/main/lib/__tests__/updateCheck.test.cjs +0 -63
  426. package/src/main/lib/__tests__/upgradeDrain.test.cjs +0 -130
  427. package/src/main/lib/__tests__/usageCircuit.test.cjs +0 -354
  428. package/src/main/lib/__tests__/watchdog-helpers.test.cjs +0 -375
  429. package/src/main/lib/__tests__/watchdog-relaunch.test.cjs +0 -266
  430. package/src/main/lib/kgExchangePairing.cjs +0 -75
@@ -1,516 +1,260 @@
1
1
  ---
2
2
  name: develop
3
3
  description: >-
4
- Lead a software-development task by analyzing it from multiple angles (positive path, edge
5
- cases, interaction effects, integration, UI validation) and decomposing it into a series of
6
- self-contained PRDs, sized as <10-minute Sonnet-executable work-items — either a handful of
7
- independent small PRDs, or a 3-5 PRD evolving chain
8
- with sub-tasked acceptance criteria for larger asks — queued for the session-manager
9
- scheduler, each pointing the headless executor at the engineering standards file to read at
10
- runtime — then track those PRDs to completion, verify them against their acceptance criteria,
11
- and report back. Use whenever the user says "/develop", "develop X", "build me X", "implement
12
- X", "let's code X", or otherwise starts dev work that should run as scheduled PRDs rather than
13
- inline now. This skill is the home for the developer-only guidance (performance, debugging,
14
- API-reuse, TDD) that was removed from the always-on global CLAUDE.md. Keywords: develop,
15
- build, implement, code, feature, refactor, bugfix, queue dev work, PRDs, PRD chain, multi-angle
16
- analysis.
4
+ Lead a software-development task: analyze it from five angles, split it into small
5
+ self-contained PRDs (an independent set, or a 3-5 PRD chain), queue them for the
6
+ session-manager scheduler with the required gate and files, each pointing the headless
7
+ executor at the engineering standards file, then track them to a validated finish and report
8
+ back. Use whenever the user says "/develop", "develop X", "build me X", "implement X", "let's
9
+ code X", or otherwise starts dev work that should run as scheduled PRDs rather than inline
10
+ now. Home of the developer-only guidance (performance, debugging, API reuse, TDD). Keywords:
11
+ develop, build, implement, code, feature, refactor, bugfix, queue dev work, PRDs, PRD chain,
12
+ multi-angle analysis.
17
13
  ---
18
14
 
19
- # /develop — prompt → scheduled PRDs → tracked to done
20
-
21
- **Role:** `/develop` owns the *pipeline*: it turns a development request into one or more
22
- self-contained PRDs, queues them, and tracks them to completion. It is the convergence point
23
- for both entry paths — an interactive human prompt inside an Epic's own conversation comes
24
- straight here; so does an agent that concluded work is needed while running inside that same
25
- Epic. There is no separate proposal channel any more: an Epic exists because a human opened
26
- one, and `/develop` authors PRDs into it. Everything from here on is identical regardless of
27
- who asked.
28
-
29
- **Epic-gated — non-negotiable.** `/develop` may only run inside an already-existing,
30
- already-human-approved Epic's own conversation (Chat or Terminal — the two views over one Epic
31
- session, per the domain model). It never creates an Epic itself and never writes a PRD against
32
- one it had to guess at. Before doing anything else:
33
- 1. Resolve `<epic-id>`: this conversation's own claudeSessionId must already match an Epic's
34
- `claudeSessionId` in `<cwd>/session-manager-operations/prompt-sessions/active-index.json` —
35
- that Epic's `id` is `<epic-id>` for every PRD authored in this pass.
36
- 2. If it doesn't match any Epic — this was invoked as a bare standalone command outside any
37
- Epic context — **stop and say so**. Tell the human to create the Epic first (the New Epic
38
- card in the app — the only place an Epic can be created), then re-run `/develop` from
39
- inside that Epic. Do not mint one yourself (`ensureEpic` will refuse), do not fall back to
40
- writing an epicless PRD, and do not proceed with authoring.
41
-
42
- **Tag-aware default (2026-08-01).** The Epic's own intent tag (`feature` / `bug` /
43
- `discussion` — CLAUDE.md's domain model) sets how eagerly this skill should fire, not just
44
- what to write once it does:
45
- - **`feature` / `bug`** — decomposition into PRDs is the expected default path for these once
46
- scope is reasonably clear. Reach for `/develop` proactively; don't wait to be re-asked.
47
- - **`discussion`** — whether development is even warranted is often still the open question.
48
- `/develop` stays fully available inside a Discussion Epic (a discussion can conclude "yes,
49
- build this"), but never assume it's the next step — don't jump straight to decomposing PRDs
50
- just because the conversation is active. Keep exploring/deciding until that's actually settled.
51
-
52
- **Never** hand-implement the work inline in chat, and never restate rules that live elsewhere:
53
- the engineering rules belong to `standards.md`. Reference it; don't fork it.
54
-
55
- This applies even when the plan is already fully scoped and confirmed in conversation — that
56
- makes the PRD queue clean, it isn't a reason to skip queuing. The reason to route through the
57
- scheduler isn't decomposition need, it's model economics: keep the interactive main-loop session
58
- (an expensive planner-tier model) focused on discussion and decisions, and let a cheaper executor
59
- model do the implementing as a headless `claude -p` job.
60
-
61
- **Only execution is delegated — authoring never is.** Do the thinking — decomposition, scope,
62
- title, goal, and acceptance criteria — yourself, in the main loop; that's what "authoring" means
63
- here, and it's non-negotiable regardless of which mechanism ends up putting bytes on disk. Do
64
- not spawn a subagent to draft a PRD or otherwise hand off the writing/thinking — that defeats the
65
- point of keeping planning on the expensive model. Once you've composed the PRD yourself, submit
66
- it through `scheduler_create_prd` (the MCP tool — see step 4's "PRD structure and location"
67
- below): that tool call is the sanctioned path from your own composed content to a file on disk,
68
- not a second author. The scheduled `claude -p` job remains the only step that runs on the
69
- cheaper executor.
70
-
71
- ## Standards (single source of truth)
72
-
73
- The engineering standards (Performance, Debugging, API reuse / single source of truth, TDD,
74
- and the executor-facing Execution discipline) live in **`standards.md`** beside this file, in
75
- the same skill directory (`.../skills/develop/standards.md` — NOT `~/.claude/skills/develop/`,
76
- which is a different, non-existent path; resolve it relative to wherever this SKILL.md itself
77
- was loaded from).
78
-
79
- **Reference it, don't embed it.** The headless executor (`claude -p`) runs on the same
80
- filesystem this authoring session does, with full tool access — so a PRD only needs to name
81
- `standards.md`'s absolute path (resolved once, at authoring time, the same way this file already
82
- resolves it) and instruct the executor to `Read` it before starting. There is now exactly one
83
- copy of this text on disk, ever — no pasted snapshot to go stale, and nothing to re-read fresh
84
- before writing (an earlier version of this skill pasted the full contents into every PRD and had
85
- to warn authors to re-read it fresh each time to avoid shipping a stale in-context copy — PRDs
86
- 467/468 did exactly that and repeated an anti-pattern a guard added earlier the same session was
87
- meant to prevent. Referencing by path removes the failure mode instead of warning against it).
88
- Never restate or fork its content — one concept, one implementation, one location.
89
-
90
- For interactive dev work, also apply the `test-driven-development` and `systematic-debugging`
91
- skills; the headless PRDs get the distilled core from `standards.md` instead, since they
92
- can't load skills.
93
-
94
- ## Phase 1 — Author + queue the PRDs
95
-
96
- 1. **Clarify scope first.** If the prompt has genuine ambiguity (acceptance criteria, target
97
- repo, framework, edge cases), ask 2–4 focused questions as plain text and wait. Don't use
98
- the AskUserQuestion tool. Don't guess on decisions that would cost real rework. (When the
99
- caller is an approved Epic proposal, scope is already established by its objective — don't
100
- re-ask; build from the brief it hands you.)
101
-
102
- 2. **Explore the target repo — broadly, not just the obvious file.** Identify the absolute
103
- `cwd`, existing patterns/utilities to reuse (per the API-reuse standard — search before
104
- writing new code), the test command, and any constraints. Capture exact file paths and
105
- signatures; they go straight into the PRDs. Don't stop at the first component that looks
106
- relevant — check its siblings too (does the same pattern appear in 2-3 similar components?
107
- do they actually share the same shape, or only look similar — confirm by reading, don't
108
- assume: a wrong assumption here means an inaccurate PRD, discovered only after the executor
109
- runs it), check existing tests for the area, and check whether a prior PRD already touched
110
- this subsystem (`ls <cwd>/session-manager-operations/scheduler/epics/*/prds/` for related slugs, in
111
- the target repo) — duplicating or contradicting a still-queued PRD is a real failure mode,
112
- not a hypothetical one.
113
-
114
- 3. **Analyze the request through five named lenses, draft a candidate decomposition, then run
115
- a completeness pass before finalizing it.** This step exists because small, bounded individual
116
- PRDs (step 4) are correct and non-negotiable — but a *set* of small PRDs can still be
117
- incomplete if the upfront decomposition missed something. Keeping PRDs small is not a
118
- substitute for getting the decomposition right; it's a separate concern, and this step is
119
- where decomposition depth and breadth get checked.
120
-
121
- **The five lenses.** Before drafting the PRD list, look at the request through each of these
122
- explicitly — not as a vague "think it through" gesture, but as five concrete questions you can
123
- answer in a sentence each. Skipping a lens silently is how a decomposition ships narrow:
124
- - **Positive path.** What does the request look like when everything goes right? Name the
125
- concrete user-visible or system-visible outcome — this anchors the core PRD(s).
126
- - **Edge cases.** What inputs/states break the happy-path assumption? Empty/zero/max states,
127
- concurrent access, malformed input, permission boundaries, network/process failure.
128
- - **Interaction effects.** Does this change anything that another feature, panel, store, or
129
- in-flight state already depends on? A layout change can break a responsive breakpoint; a
130
- new field can desync two stores that used to agree; a UI merge can silently drop a
131
- conditional-render gate another feature relied on. Naming this explicitly is what catches
132
- the "it works in isolation but breaks its neighbor" class of bug.
133
- - **Integration.** Does this correctly compose with the existing architecture at its
134
- boundaries — the IPC schema, the shared store, an existing API contract, an established
135
- design-primitive file — rather than reimplementing a parallel path? This is the API-reuse
136
- standard (`standards.md`) applied at the planning stage, before code exists to duplicate.
137
- - **Validation (UI/visual, planned up front — not just checked at the end).** For any ask
138
- that touches UI or visual output, decide *now*, while drafting, exactly how it will be
139
- confirmed working before it's called done: what screenshot/state to capture, light AND dark
140
- mode if the project has both, and which specific acceptance line will prove it (not "looks
141
- right" — a concrete, checkable claim). Bake that plan into the PRD's own Acceptance
142
- Criteria (see step 4's sub-tasked AC) rather than leaving visual confirmation as an
143
- afterthought bolted on at the step 8 gate — deciding the validation method during design
144
- surfaces gaps (e.g. "there's no existing screenshot tooling for this surface") while there's
145
- still time to plan around them, instead of discovering it mid-execution.
146
-
147
- - For a **genuinely trivial ask** (one obvious PRD, no cross-file consequences, all five
148
- lenses come back empty) — skip straight to step 4, no ceremony needed.
149
- - For anything **larger than one or two obvious PRDs, or touching more than one
150
- component/subsystem** — before finalizing, dispatch a second, independent agent (the Agent
151
- tool, `subagent_type: "Explore"` or `"general-purpose"` — this is a single extra dispatch,
152
- not the full multi-agent Workflow tool, and needs no special opt-in) with: the original ask
153
- verbatim, your draft PRD list (titles + one-line goals), and the five lenses above by name,
154
- instructing it to find what's missing under each one — uncovered edge cases, error-handling
155
- paths, tests, cross-feature/cross-state interaction effects, integration points that would
156
- be reimplemented instead of reused, components that share the same pattern but weren't
157
- included, anything the draft assumed without verifying. Treat its findings as a second
158
- opinion to weigh, not an automatic addition — fold real, concrete gaps into the PRD set (add,
159
- split, or adjust a PRD); dismiss vague or speculative ones. For a large, multi-subsystem ask,
160
- it's fine to repeat this once more after folding in the first round's findings (a second
161
- completeness pass on the revised set) — stop once a pass turns up nothing new, don't loop
162
- indefinitely.
163
- - **Check each drafted PRD against explicit concern dimensions, not just "does the feature
164
- work"**: missing features/edge cases beyond the happy path, interaction effects, integration,
165
- tests, security, and quality (perf, error handling). This is where depth actually comes
166
- from — a decomposition that only ever asks "what file does this touch" produces exactly the
167
- narrow, single-concern PRDs this step exists to catch.
168
- - **Tests and security are NOT separate follow-up PRDs — they are mandatory AC lines inside
169
- the SAME PRD as the feature they belong to.** This is non-negotiable: `standards.md`'s TDD
170
- rule requires the test before/with the implementation, not after, and a security concern
171
- (input validation at a boundary, auth checks, no string-built queries) is a decision made
172
- while writing the code — a later "security review PRD" would just end up re-touching the
173
- same lines, doubling work and leaving the shipped code insecure in the meantime. Every
174
- feature PRD's own Acceptance Criteria must include its test command AND, when it touches
175
- input/auth/data, the relevant security checks — don't spin these out.
176
- - **Genuinely separable work MAY become its own sibling PRD**: deeper edge-case coverage
177
- beyond what the core AC needs to prove correctness, performance/observability hardening,
178
- docs. Splitting these out is exactly the "more isolated, narrower PRDs" instinct — apply
179
- it here, where a dedicated PRD adds real value, not to tests/security where it subtracts
180
- from correctness.
181
- - This is a planning-quality step, not an execution step — it happens entirely in the
182
- interactive main-loop session, before anything gets written to disk or queued.
183
-
184
- 4. **Decompose into a series of SMALL, bounded PRDs.** Split the (now completeness-checked)
185
- decomposition into individually small PRDs and sequence them.
186
-
187
- **Two shapes — pick per request, don't default to one:**
188
- - **Independent set.** Most requests: a handful of small PRDs that can mostly run in
189
- parallel, each a self-contained unit (this is what "genuinely separable work" in step 3
190
- produces).
191
- - **Evolving chain (3-5 PRDs).** Use this shape when the request is naturally a sequence of
192
- stages that build on each other rather than independent units — e.g. scaffold → core
193
- behavior → edge-case/interaction hardening → integration wiring → UI validation pass. Each
194
- PRD in the chain: gets its own unique `NN` (numbers are strictly unique per project —
195
- PRD 832, user decision 2026-07-31) plus a `dependsOn: [<previous-link-slug>]`
196
- frontmatter line expressing the chain edge explicitly, and its
197
- `# Implementation notes` states in one line what the *previous* link actually delivered
198
- (file paths/functions it added, referencing its real landed state — not the plan for it,
199
- since PRDs 1..k-1 may have adjusted scope during execution) and what this link is expected
200
- to build on top of. Do not chain more than 5 deep — beyond that, re-run step 3's
201
- completeness pass instead of extending the chain further; a chain that long is a sign the
202
- original decomposition was wrong, not that it needs one more link. A chain does not relax
203
- the ~15-min/30-min-ceiling sizing below — each link is still individually small.
204
-
205
- **Every plan ends with one `validate` PRD.** After the work-item PRDs are written, author
206
- exactly one more through `scheduler_create_prd`: `agentType: "validator"`, `tag: "build"`,
207
- `estimateMinutes: 10`, `dependsOn` = every other slug in this plan (`dependsOn` is capped at
208
- 100 entries; for a plan bigger than that, list only the plan's sink PRDs — those nothing else
209
- in the plan depends on — since `hasDownstreamValidator` walks `dependsOn` transitively, so a
210
- validator anchored on the sinks alone still covers every upstream PRD), slug
211
- `validate-<short-plan-name>`. Its Goal lists the plan's PRD slugs and titles; its Acceptance
212
- criteria give, per PRD, where its file lives
213
- (`<cwd>/session-manager-operations/scheduler/epics/<epic-id>/prds/<NN>-<slug>.md` while queued,
214
- the sibling `prds-archived/` once terminal — locate by slug in either) and end with the
215
- review-record path to write and commit:
15
+ # /develop — plan, queue, track to done
16
+
17
+ Terms: **plan** = the PRDs one pass queues, ending in a validate PRD. **gate** = commands that
18
+ prove a PRD done. **files** = paths a PRD may change. **verdict line** = a run's last line
19
+ (`SCHEDULER_VERDICT: PASS`). **needs_review** = a parked PRD: a question for this Epic, never
20
+ new work. **report** = your final message to the human.
21
+
22
+ ## Rules that always apply
23
+
24
+ 1. **Epic gate. Run it first.**
25
+ 1. Your session id is `$SM_CHAT_SESSION_ID`.
26
+ 2. Read `session-manager-operations/prompt-sessions/active-index.json` in the main checkout
27
+ (`$SM_PROJECT_ROOT`, or the first `git worktree list` path). Why: a worktree copy is
28
+ frozen at branch time and often lacks this Epic.
29
+ 3. The `sessions` entry whose `claudeSessionId` matches is this Epic: its `id` is
30
+ `<epic-id>`, its `tag` drives rule 2.
31
+ 4. No match: stop and say so. Tell the human to open an Epic with the New Epic card and run
32
+ /develop there. Never mint an Epic or write a PRD without one. Why: only a human creates
33
+ an Epic.
34
+ 2. **Tag-aware default.** On a `feature` or `bug` Epic, PRDs are the expected path once scope
35
+ is clear; start unasked. On a `discussion` Epic it stays available, but wait until the
36
+ human settles that code is wanted.
37
+ 3. **Never hand-implement in this session**, even when the plan is agreed. Why: this session
38
+ runs an expensive planner model; a cheaper executor runs each PRD as a headless `claude -p`
39
+ job.
40
+ 4. **Never delegate PRD authoring.** You write scope, title, goal, criteria and notes. Calling
41
+ `scheduler_create_prd` with your own text is not delegation.
42
+ 5. **Never restate the engineering rules.** They live in `standards.md` beside this file, with
43
+ the reasons behind the run rules. Interactive work uses the `test-driven-development`,
44
+ `systematic-debugging` and `requesting-code-review` skills. Why: one copy never goes stale.
45
+
46
+ ## Phase 1 — plan and queue
47
+
48
+ Read `~/.claude/session-manager/scheduled-plans/PRD_AUTHORING.md` before writing PRDs.
49
+
50
+ ### Preflight — confirm the tool is even in your tool list
51
+
52
+ Before drafting, check that `mcp__session-manager-scheduler__scheduler_create_prd` is in your
53
+ tools. Why: drafts made first are wasted. It is the only sanctioned way to write a PRD. Its two
54
+ failure modes have different fixes:
55
+
56
+ - **(a) Tool PRESENT but ERRORS** because the session-manager app is not running. A validation
57
+ error is not this case: fix the input and retry. **STOP. Do not write any PRD file.** Tell the
58
+ human to start the app, then retry the same call. Why: a PRD file the API did not write is
59
+ quarantined and never runs.
60
+ - **(b) Tool ABSENT from your tool list.** The `session-manager-scheduler` MCP server is not
61
+ registered: a **misconfiguration**, not an offline app.
62
+ **STOP. Do not write any PRD file.** Tell the human. The app registers the server at user
63
+ scope the first time it starts. If it is still missing, the human deletes
64
+ `~/.claude/session-manager/.scheduler-mcp-seeded`, restarts the app, and opens a new session.
65
+ Never add a project `.mcp.json` entry yourself. Why: it brings back per-repo drift.
66
+
67
+ ### Steps
68
+
69
+ 1. **Clarify only what a wrong guess would cost rework on.** Ask 2–4 plain-text questions in
70
+ one message, once, and wait. Never use AskUserQuestion. Why: Chat view turns run headless.
71
+ 2. **Explore broadly.** Find the absolute path, helpers and patterns to reuse, the test
72
+ command, constraints, and exact paths and signatures. Read look-alike siblings to confirm
73
+ the shape. Check existing tests, and `scheduler_list_prds` for an open PRD on the same
74
+ area. Why: a duplicate or contradicting PRD is a real failure.
75
+ 3. **Use five lenses**, a sentence each, none skipped silently: positive path; edge cases
76
+ (empty, max, concurrent, malformed, permission, failure); interaction effects (what depends
77
+ on your change); integration (reuse the existing schema, store, API, primitives);
78
+ validation (for UI: which screenshot, light and dark, proves which criterion).
79
+ 4. **Run a completeness pass** if the ask exceeds one or two PRDs or spans subsystems: give one
80
+ Explore or general-purpose sub-agent the ask verbatim, your draft list and the lenses; ask
81
+ what is missing. Fold in real gaps, drop vague ones. Repeat at most once. It reviews; you
82
+ author.
83
+ 5. **Tests and security go inside the feature's own PRD** as criteria (security when it
84
+ touches input, auth or data), never as follow-ups. Why: TDD needs the test with the code;
85
+ security is decided while writing it. Also check quality (performance, error handling).
86
+ Deeper edge cases, hardening and docs may be sibling PRDs.
87
+ 6. **Pick a shape.** Most asks are an independent set. Chain 3–5 PRDs only for truly
88
+ sequential work: each link `dependsOn` the previous one; its notes name what that link
89
+ delivers and say to read the landed code first. Never chain past 5; redo the completeness
90
+ pass. Each goal's first sentence names its type, in chain order: `primitive` (new helper
91
+ and its test), `wire` (adopt it at named call sites), `behavior` (one function's logic and
92
+ its test), `migration` (mechanical change), `doc`, `validate`.
93
+ 7. **Keep each PRD small**: at most 3 edited files, 1 new file, 6 criteria. The validate PRD is
94
+ exempt: it has one criterion per PRD, plus the record. A new helper and its first caller are
95
+ two PRDs. Most PRDs take 5–10 executor minutes; past estimates were 3–5×
96
+ too high. Never estimate over 15; split. Why: the kill budget floors at 45 minutes, so a low
97
+ estimate never starves a run.
98
+ 8. **Make each PRD self-contained.** The executor sees only the PRD and the project. Notes are
99
+ a recipe: `Read first:` (at most 4 files, with line ranges), `Steps:` (numbered, each naming
100
+ file and function), `Do not touch:` (files a sibling owns). Quote signatures. Say when a PRD
101
+ needs another PRD's output.
102
+ 9. **Write plain, checkable criteria.** Each names a file, a symbol and the result; one names
103
+ the test file and tests. Commands go in `gate`. No open-ended "grep X and update" lines.
104
+ 10. **Show the plan once**, as a table (#, PRD, files, gate, dependsOn, estimate), not PRD
105
+ drafts. Queue at once when the Epic is `feature` or `bug` and scope is clear; otherwise ask
106
+ one approval question, once.
107
+ 11. Before the first `scheduler_create_prd` call, run `git -C "$SM_PROJECT_ROOT" rev-parse HEAD`
108
+ and keep the SHA. **Walk the pre-queue checklist** (last section of PRD_AUTHORING.md), then
109
+ queue each PRD with `scheduler_create_prd`, the validate PRD last.
110
+ 12. **Read the warnings each call returns before the next call.** Warnings do not block. If a
111
+ gate or files warning shows a real mistake, archive that PRD with `scheduler_archive_prd` and
112
+ queue it again under a new slug, before you queue the PRDs that depend on it. Why: a new
113
+ call checks the gate and files again; `scheduler_update_prd` does not check them. Never
114
+ change a PRD only to silence a warning. The validate PRD's none-gate warning and its size
115
+ warning (8 or more criteria) are expected. Then post one short message: each PRD's number and slug, the validate slug, the
116
+ warnings you kept, and that no per-PRD check will come from this session.
117
+ 13. **Never stop for review after queueing.** Why: the validator is the review.
118
+
119
+ ### PRD fields
120
+
121
+ | Field | Rule |
122
+ | --- | --- |
123
+ | `title`, `goal`, `acceptanceCriteria`, `implementationNotes`, `outOfScope` | Steps 6–9. Goal: 2–4 sentences. |
124
+ | `gate`, `files` | **REQUIRED.** Rules below. The tool refuses a call without them. |
125
+ | `estimateMinutes` | Honest: 5–10, never over 15. |
126
+ | `sourcePromptId` | Always `<epic-id>`. Never rely on the server's fallback. |
127
+ | `cwd` | The Epic's project root, as an absolute path or `~/…`. The API always uses the Epic's project, whatever you pass. To work in another project, open an Epic there. |
128
+ | `dependsOn` | Slugs that must finish first. The only ordering tool. |
129
+ | `disposition` | Only when the API asks. `append` waits behind the Epic's unfinished PRDs; `new-head` may run now, so only when no files are shared. |
130
+ | `slug` | Optional kebab-case without an `NN-` prefix. The API picks the number. |
131
+ | `tag`, `agentType` | Omit (`dev-lead` default), except on the validate PRD. |
132
+ | `quietMachine` | Only for timing measurements. |
133
+
134
+ Never pass `parallelGroup`; it is ignored. The API writes the frontmatter, the `# Files` and
135
+ `# Gate` sections and the standards pointer. Do not write them yourself. Do not put a gate
136
+ fence (three backticks + `gate`), a `# Gate` heading or a `# Files` heading in any text field —
137
+ the API rejects that.
138
+
139
+ ### gate rules
140
+
141
+ 1. 1–10 commands. The scheduler re-runs them, in order. Each must exit 0.
142
+ 2. Start each `&&` step with `timeout <seconds>`, for example `timeout 300 npm test &&
143
+ timeout 120 npm run lint`. Why: a command without a timeout can hang the run.
144
+ 3. Join steps inside one entry with `&&`.
145
+ 4. The scheduler runs gate commands without a shell, so shell syntax is refused. Outside single
146
+ quotes, do not use `|` `<` `>` `;` `&` (only `&&` between steps), backticks, `$`, `\`, `*`,
147
+ `?`, `[`, `]`, `(`, `)`, `{`, `}` or `!`. Inside double quotes, `$`, backticks and `\` are
148
+ refused too.
149
+ 5. Do not start a word with `#` or `~`, and do not put `~` right after `=` or `:`. `HEAD~1` is
150
+ fine.
151
+ 6. Put text with these characters inside single quotes, for example `rg -n 'a|b' src/`. A check
152
+ that needs a shell belongs in a test file that the gate runs.
153
+ 7. Keep each entry on one line, at most 500 chars, with plain spaces between words.
154
+ 8. Use `["none"]` only for docs or config with no runnable check. Write exactly `none`. Never
155
+ mix `none` with commands.
156
+ 9. Put `NAME=value` words before `timeout`, never after it, for example
157
+ `CI=1 timeout 300 npm test`. A leading `TMPDIR=$(mktemp -d) ` is allowed but not needed: the
158
+ scheduler gives each gate its own TMPDIR.
159
+
160
+ ### files rules
161
+
162
+ 1. 1–50 repo-relative paths. A folder ends with `/`.
163
+ 2. No absolute paths, no `~` at the start, no `..` or `.` segments, no `*` or `?`, no `\` or
164
+ backticks, no leading `-`. Use `/` between folders.
165
+ 3. PRDs that can run at the same time must not share a file. If two PRDs touch the same file,
166
+ chain them with `dependsOn`.
167
+
168
+ ### What a headless run cannot do
169
+
170
+ The scheduler blocks ScheduleWakeup, Cron tools, Monitor, AskUserQuestion, plan mode, worktree
171
+ tools and background tasks. A `timeout` command is always on PATH (a shim on macOS). The run
172
+ never stops to ask; it makes the safest reasonable choice and reports it. So write PRDs that
173
+ need none of this and leave no decision open.
174
+
175
+ ### How a PRD runs
176
+
177
+ The dev-lead persona runs orient (read `# Files`) → red (a failing test) → build → finish
178
+ protocol, which the scheduler appends: review → verify the `# Gate` commands → commit exact
179
+ paths → verdict line.
180
+
181
+ ### The validate PRD
182
+
183
+ End every plan with exactly one validate PRD:
184
+
185
+ 1. `agentType: "validator"`, `tag: "build"`, `estimateMinutes: 10`, slug
186
+ `validate-<short-plan-name>`.
187
+ 2. `dependsOn`: every other slug in the plan. Past the cap of 100, only the sinks (PRDs nothing
188
+ depends on). Why: `dependsOn` is walked transitively.
189
+ 3. Goal: the plan's slugs and titles.
190
+ 4. Criteria: one per PRD, naming its file
191
+ (`session-manager-operations/scheduler/epics/<epic-id>/prds/<NN>-<slug>.md` while queued,
192
+ `prds-archived/` beside it once done; find it by slug). The last: write and commit
216
193
  `session-manager-operations/reviews/validation/<epic-id>/<validate-slug>.md`.
217
- Implementation notes: "Work as the validator persona — the procedure is your system prompt."
218
- While a plan has a pending validator, the scheduler suppresses both the per-PRD validation
219
- prompt into this session and the in-run `/code-review` steps for its work-items — one review,
220
- once, at the end. If `scheduler_create_prd` rejects `agentType: "validator"` (persona not
221
- installed on this machine yet — the usual cause is a running app older than 0.96.0, since the
222
- validator persona is only seeded to `~/.claude/agents` on app boot), say so and fall back to
223
- today's per-PRD validation; do not hand-write the file. Note the stale-app cause in your report
224
- so the human knows to restart onto >=0.96.0.
225
-
226
- - **Sub-tasked Acceptance Criteria** (either shape, when a single PRD legitimately spans more
227
- than one concern dimension from step 3 — e.g. it has both core-functionality and
228
- edge-case/interaction-effect checks): group the `# Acceptance criteria` checklist under
229
- sub-headings instead of one flat list, e.g. `## Core functionality`, `## Edge cases`,
230
- `## Interaction / integration`, `## Tests`. This is additive structure only — it does not
231
- change what step 4's "Required body sections" template requires (still exactly one
232
- `# Acceptance criteria` section overall), and it does not license combining what should be
233
- separate PRDs into one oversized one; if the sub-task groups would each take real time on
234
- their own, that's a signal to split into a chain link instead of one bloated PRD.
235
-
236
- **Preflight — confirm the tool is even in your tool list before you start composing PRDs.**
237
- Check for `mcp__session-manager-scheduler__scheduler_create_prd` in your available tools as
238
- the very first thing you do in this step, before any drafting — catching a missing tool here
239
- costs nothing; catching it after you've already composed and written PRD bodies means
240
- discarding that work. If it's absent, see "Two failure modes" immediately below — case (b),
241
- not the reachable-but-erroring fallback.
242
-
243
- **`scheduler_create_prd` is the ONLY sanctioned way to author a PRD — not a preference, a
244
- rule.** Every PRD reaches disk through the MCP tool
245
- (`mcp__session-manager-scheduler__scheduler_create_prd`). Hand-writing the file directly is a
246
- degraded, LAST-RESORT fallback (below) reserved for the single case where the tool is present
247
- but errors as unreachable — never a co-equal alternative to reach for out of habit or
248
- convenience, and never applicable when the tool isn't in your list at all (see "Two failure
249
- modes" below). Its input
250
- (`title`, `cwd`, `estimateMinutes`, `goal`, `acceptanceCriteria[]`, `implementationNotes`,
251
- `outOfScope[]`) maps directly onto the sections below — pass them straight through. **Always
252
- pass `sourcePromptId` explicitly, set to the `<epic-id>` resolved in the Epic-gated step
253
- above** — never omit it and rely on the server-side session-id fallback; that fallback exists
254
- only to cover a model that forgot, not as this skill's normal path, and the server refuses to
255
- write the PRD at all if no existing Epic resolves. It
256
- allocates a strictly-unique `NN` atomically (no read-then-write race against another
257
- concurrent `/develop` invocation, never reused across the project — PRD
258
- 832), derives and collision-checks the slug, and embeds the standards pointer for you.
259
- `parallelGroup` is DEPRECATED and ignored — express ordering with the `dependsOn` input
260
- (slugs that must complete first); independent PRDs simply omit it and may run in parallel.
261
-
262
- **Two failure modes — do not conflate them. They have opposite correct responses.**
263
-
264
- - **(a) Tool PRESENT but ERRORS as "app not running" / admin API unreachable.** The tool
265
- shows up in your tool list (`mcp__session-manager-scheduler__scheduler_create_prd` is
266
- callable), but calling it fails because the session-manager Electron app that hosts the
267
- admin API isn't running right now. This is the ONLY case the manual-write fallback below
268
- covers. Do not use this path when the tool is reachable but merely returned a validation
269
- error (bad frontmatter, unresolvable Epic, etc.) — fix the input and retry the tool; a
270
- validation error is not "the app is not running."
271
- - **(b) Tool ABSENT from your tool list entirely.** You never see
272
- `mcp__session-manager-scheduler__scheduler_create_prd` offered at all — there is no error to
273
- catch, because the tool call is never attempted. This means the `session-manager-scheduler`
274
- MCP server is not registered for the project you're running against — a **misconfiguration**,
275
- not "the app is offline." **STOP. Do not write any PRD file, hand-authored or otherwise.**
276
- Report to the human, by name: "the `session-manager-scheduler` MCP tool is not available in
277
- this session — the server isn't registered for this project." Point them at the fix: it
278
- should be registered once at USER scope (`claude mcp add session-manager-scheduler --scope
279
- user -- node <path-to-session-manager-repo>/scripts/scheduler-mcp-server.cjs`, or run
280
- `scripts/install-scheduler-mcp-user-scope.sh` from the session-manager repo) so every
281
- project gets the tool without a per-repo `.mcp.json` edit — do not work around a missing
282
- tool by hand-writing the file, and do not add a project-local `.mcp.json` entry yourself as
283
- a substitute; that's the human's call and re-introduces the per-repo drift this fix removes.
284
-
285
- **Fallback for case (a) only.** This is a deliberate bypass of the service boundary, not a
286
- shortcut: using it means the frontmatter validation, atomic `NN` allocation, standards-pointer
287
- insertion, and Epic-existence check that `scheduler_create_prd` normally performs did not
288
- run. **You MUST call this out, visibly, in your report** — state plainly that the app wasn't
289
- running, that you hand-authored the PRD file directly instead of using the tool, name the
290
- exact file, and flag it for human verification (this bypass is also what
291
- `scripts/audit-ops-hygiene.cjs` and the `ops-sweep` skill look for and report as a hygiene
292
- finding, independent of your own report).
293
- When you do use it: compute the highest in-use number deterministically yourself — never
294
- eyeball or narrow-grep the `ls` (a narrowed pattern like `'^10[0-9]'` silently misses `110+`
295
- and collides). PRDs are stored per-project, so `NN` allocation for a given PRD only needs
296
- *that project's own* prds directory scanned — not every project's:
297
- ```bash
298
- ls <cwd>/session-manager-operations/scheduler/epics/*/prds/ <cwd>/session-manager-operations/scheduler/prds-archived/ 2>/dev/null | grep -oE '^[0-9]+' | sort -n | uniq | tail -5
299
- ```
300
- (`<cwd>` is the target repo's absolute path — the same one this PRD's `cwd` field will use.)
301
- The last line is the current max within that project. Then: **always next free `NN` =
302
- max+1** — never reuse a sibling's number (unique-per-project rule, PRD 832); express
303
- ordering with `dependsOn: [<slug>]` frontmatter instead. This manual path has a
304
- small, accepted race (two concurrent authors could compute the same "next free" `NN`) —
305
- cosmetic (two unrelated groups end up sharing a number) rather than destructive, and only
306
- reachable when the atomic tool path above isn't available. Record each cross-PRD dependency
307
- in the dependent PRD's notes either way.
308
-
309
- ### PRD structure and location
310
-
311
- Each individual PRD must follow this structure — this is `/develop`'s single authority on
312
- one PRD's structure, location, and scope sizing (the engineering rules stay separate, in
313
- `standards.md`).
314
-
315
- You are writing a PRD that will be executed by the user's session-manager scheduler — a
316
- system that runs `claude -p <prd-body> --dangerously-skip-permissions` jobs around 5-hour
317
- token-window resets, with auto-pause on rate-limit and auto-resume.
318
-
319
- **Canonical location — non-negotiable.** Every PRD belongs to an **Epic** (the TAB → EPIC →
320
- PRD domain model in the project CLAUDE.md) — specifically the `<epic-id>` resolved in the
321
- Epic-gated step above. PRDs MUST be written to, inside the target repo:
322
- ```
323
- <cwd>/session-manager-operations/scheduler/epics/<epic-id>/prds/<NN>-<kebab-slug>.md
324
- ```
325
- Always pass that `<epic-id>` as `sourcePromptId` when creating each PRD — via the MCP
326
- `scheduler_create_prd` tool's `sourcePromptId` input, or, for the manual-write fallback, by
327
- resolving the directory with:
328
- ```bash
329
- node <session-manager-repo>/scripts/mint-epic.cjs <cwd> <epic-id>
330
- ```
331
- This only JOINS an existing Epic and prints its prds/ directory on the last stdout line — it
332
- never creates one. If `<epic-id>` doesn't exist yet, that means the Epic-gated step above
333
- wasn't satisfied; go back and get a human to create/approve the Epic first, don't work around
334
- this by minting one.
335
-
336
- **Anywhere else doesn't get scheduled or gets retired.** `data/prds/`, `docs/prds/`, and the
337
- old global `prds/` dir under `~/.claude/session-manager/scheduled-plans/` are invisible to
338
- the scheduler; the legacy flat `session-manager-operations/scheduler/prds/` dir is RETIRED —
339
- anything written there is auto-consolidated into `prds-archived/` and never executed. This
340
- consolidation runs at the top of every `reconcile()` call (`consolidateAllFlatPrds`, called
341
- from inside `reconcile()` itself in `src/main/scheduler.cjs`, before `reconcile` scans that
342
- dir for PRD sources) — not only at app boot, and not just from the tick-queue poll:
343
- `reconcile()` also runs from job completion, the `schedule:state`/`schedule:rescan` IPC
344
- handlers, and `rescheduleTimer()`, so the sweep is guaranteed regardless of which of those
345
- triggers the next pass. A file landing in the flat dir while the app is already running is
346
- swept out before it could ever be turned into a job, closing the window a boot-only pass left
347
- open. PRD *source* files are per-project and per-Epic, resolved at runtime via
348
- `src/main/lib/prdLocations.cjs`.
349
-
350
- **Filename rules.** `NN` is the PRD's unique per-project number (always next free =
351
- max+1 per the `ls` command above; ordering via `dependsOn` frontmatter, never via shared
352
- numbers). `<kebab-slug>` is a short, descriptive kebab-case identifier
353
- (e.g. `voice-commands-send-cancel`, `ticker-velocity-mcp`), kept under 60 chars. Verify your
354
- chosen filename doesn't already exist before writing.
355
-
356
- **Required frontmatter:**
357
- ```yaml
358
- ---
359
- title: <one-line human-readable title>
360
- cwd: <path to target project — where claude -p will run>
361
- estimateMinutes: <integer wall-clock estimate>
362
- ---
363
- ```
364
- `cwd` is critical — without it the job runs in the scheduler's default cwd (session-manager).
365
- Always set it to the path of the project the work targets, written as `~/Projects/<repo>`
366
- (the parser expands `~` to `os.homedir()` at ingest, so the same PRD works on any machine).
367
- Avoid hardcoding an absolute home path (`/home/<you>/Projects/<repo>`); it breaks on any
368
- machine with a different home directory.
369
-
370
- **Required body sections, in this order:**
371
- ```markdown
372
- # Goal
373
-
374
- <2-4 sentences. What the executor will build and why it matters. NO "as a user I want to"
375
- framing. Concrete: name the function, the file, the user-visible change.>
376
-
377
- # Acceptance criteria
378
-
379
- - [ ] <each line is a verifiable check the executor can run after building>
380
- - [ ] <include explicit file paths, function names, expected behavior>
381
- - [ ] exactly one gate line — a bounded command or an `&&` chain of at most two, e.g.
382
- `timeout 300 npm run typecheck && timeout 300 npx vitest run <file>` (the run-before-done
383
- rule lives in standards.md; the AC just names the command).
384
-
385
- # Implementation notes
386
-
387
- <file paths the executor will need to read first; the architectural pattern to follow; any
388
- non-obvious constraints. Be specific. Quote function signatures if it saves the executor a
389
- Read call.>
390
-
391
- # Out of scope
392
-
393
- <short bulleted list of what NOT to build, to prevent scope creep>
394
- ```
395
- (When a PRD spans multiple step-3 concern dimensions, replace the flat `# Acceptance criteria`
396
- list above with sub-headings — `## Core functionality`, `## Edge cases`,
397
- `## Interaction / integration`, `## Tests` — each still a checklist of verifiable lines. See
398
- step 4's "Sub-tasked Acceptance Criteria" note. This is the only body section that may gain
399
- sub-headings; Goal, Implementation notes, and Out of scope stay flat.)
400
-
401
- **Self-containment is load-bearing.** The executor (`claude -p`) starts with NO conversation
402
- context — only the PRD body and the project files. So: include exact file paths (e.g.
403
- `src/main/index.cjs:142`); quote function signatures or relevant code blocks if the executor
404
- would have to grep for them; name the libraries/patterns to use (e.g. "use the existing
405
- `validatePath` helper in `config.cjs`"); don't reference "the conversation we just had" or
406
- "the design we discussed"; if a PRD depends on another PRD's output, say so in
407
- `# Implementation notes` AND give it a higher `NN` so it queues after.
408
-
409
- **Work-item shape — every PRD must be executable by a Sonnet-class executor in under 10
410
- minutes (2026-09 calibration: wall p50 7.8 min, 60% of runs ≤ 10 min; authored estimates ran
411
- 4× high).**
412
- - **One change-set per PRD**: ≤ 3 files edited, ≤ 1 new file, exactly ONE gate line (a
413
- bounded command or an `&&` chain of at most two). If a PRD needs a new shared helper AND
414
- its first consumer, that is two PRDs (`primitive` → `wire`).
415
- - **≤ 6 AC lines**: each behavior line names file + symbol + the observable result; exactly
416
- one tests line naming the test file and the test names; exactly one gate line. No
417
- open-ended lines ("grep X and update whatever depends on it") — resolve the list yourself
418
- while authoring and name the files.
419
- - **Implementation notes are a recipe, not prose**: `Read first:` (≤ 4 files, with line
420
- ranges), `Steps:` (numbered, each naming the file and the function/signature), `Do not
421
- touch:` (files a sibling PRD owns). Quote a signature rather than describing it.
422
- - **`estimateMinutes` ≤ 10 target, 15 ceiling** — project more, split. (The scheduler's kill
423
- budget floors at 45 min regardless, so a low estimate never starves a run.)
424
- - **Decomposition types** — name one per PRD in its first Goal sentence, and chain in this
425
- order when several apply:
426
- - `primitive` — one new helper/module + its unit test, no call sites.
427
- - `wire` — adopt an existing primitive at named call sites, no logic change.
428
- - `behavior` — one function's logic change + the test that pins it.
429
- - `migration` — mechanical rename/move/config change, no logic; gate is typecheck/lint.
430
- - `doc` — text only; gate is `lint:docs` or the doc's own test.
431
- - `validate` — the plan's trailing validation PRD (see Phase 2).
432
- - `scheduler_create_prd` returns `warnings[]` when a PRD exceeds these limits — fix the PRD
433
- before confirming it to the user; never queue a warned PRD silently.
434
-
435
- 5. **Emit each PRD.** If you used `scheduler_create_prd`, this step is already done — the tool
436
- wrote the file to the canonical path with the standards pointer included; skip to step 5.
437
- **Fallback path only:** write to the canonical path and structure above, then **append `##
438
- Engineering standards` with a one-line pointer**, not the file's contents:
439
- ```markdown
440
- ## Engineering standards
441
-
442
- Before writing any code, read `<absolute path to standards.md, resolved above>` — it has the
443
- Performance, Debugging, API-reuse, TDD, and Execution-discipline rules that apply to this PRD.
444
- Every rule in it is mandatory, especially Execution discipline (bounded commands, verify
445
- before done, the finish-protocol sentinel).
446
- ```
447
- This is the load-bearing step — it's the only way the standards (incl. Execution discipline)
448
- reach the headless run, and it now stays current automatically since the executor reads the
449
- live file rather than a snapshot taken at authoring time. Honor the `PRD_AUTHORING.md` §10
450
- pre-queue checklist.
451
-
452
- 6. **Confirm to the user**, per emitted PRD: filename, chosen `NN` + rationale
453
- (parallel-with-X / serial-after-Y), `cwd`, and an ETA + token-cost ballpark. Note they can
454
- "Run now" in the SchedulePanel or wait for `when-available` polling. Name the plan's validate
455
- PRD and state that no per-PRD validation will be requested from this session.
456
-
457
- ## Phase 2 — Validation runs as its own job; this session only decides
458
-
459
- Every plan queued in Phase 1 ends with a `validate` PRD (agentType `validator`) whose
460
- `dependsOn` lists every other slug in the plan — or, for a plan over the 100-entry cap, just the
461
- plan's sink PRDs, since `hasDownstreamValidator` walks `dependsOn` transitively and still credits
462
- every upstream PRD — so the scheduler runs it exactly once, after the last work-item lands.
463
- That job — not this session — re-runs each PRD's gate, checks every
464
- acceptance criterion against the tree, reviews the plan's combined diff (`/code-review`,
465
- `/security-review`), commits a review record, and ends with `VALIDATION: <slug>
466
- VERIFIED|REFUTED` per PRD. The scheduler appends one verdict event per PRD to this Epic (the
467
- traffic light reads them) plus one check-in for the validator itself.
468
-
469
- 7. **Do not poll and do not re-verify per PRD.** Completed work-items arrive here as check-in
470
- events only; leave them alone. There is no 30-minute loop to start and no `ScheduleWakeup` to
471
- arm. Act on exactly three signals:
472
- - **A work-item parks `needs_review` / `failed`** — read the scheduler's auto-filed RCA
473
- (`<date>-rca-<slug>-<runId>.md` in the project's feedback inbox) and decide: fix the PRD
474
- (`scheduler_update_prd`) and `scheduler_reset_job`, or `scheduler_archive_prd` it. The
475
- plan's validator waits behind it. A `rateLimited` exit is the scheduler's benign auto-pause
476
- — not a signal.
477
- - **The validator's check-in arrives** — read its review record. Every PRD VERIFIED and no
478
- Critical/Important finding → the plan is done; report what landed (slugs, commits, record
479
- path). Any REFUTED PRD or Critical/Important finding → queue a fix wave: one `behavior`/
480
- `wire` PRD per finding (recipe format, ≤ 10 min each), no `dependsOn`, plus a new trailing
481
- `validate` PRD for the wave. Do not fix inline.
482
- - **The validator itself parks** — treat it like any parked job; its RCA says why the
483
- procedure could not run.
484
-
485
- 8. **Definition of done** = the plan's latest validator reported every PRD VERIFIED with no open
486
- Critical/Important finding, and its review record is committed. Report: what landed (PRD
487
- slugs, commits), the record path, findings deferred as Minor, anything left open. A plan with
488
- a REFUTED PRD is never "done with caveats" — it gets a fix wave or an explicit human decision
489
- to stop.
490
-
491
- ## References (reuse, don't duplicate)
492
-
493
- - `~/.claude/session-manager/scheduled-plans/PRD_AUTHORING.md` — the §1–§10 safety rules.
494
- - `standards.md` beside this file — the engineering + execution-discipline rules. Every PRD points the executor at its absolute path (see "Standards" above) rather than embedding a copy.
495
- - `test-driven-development`, `systematic-debugging` — interactive dev sessions.
496
- - `validator` persona (src/seed/agents/validator.md) — the plan-level review point for scheduled
497
- work; `requesting-code-review` — interactive sessions reviewing their own inline work only.
498
-
499
- ## Notes
500
-
501
- - Submit each PRD through `scheduler_create_prd`, then confirm — don't draft them inline in chat
502
- for review first. Only hand-write the file when the tool is PRESENT but ERRORS as unreachable
503
- (app not running) — see the "Two failure modes" note above, including its mandatory bypass
504
- warning. If the tool is ABSENT from your tool list, that's a misconfiguration, not an offline
505
- app: stop and tell the human, never hand-write the file.
506
- - Don't combine unrelated features into one PRD. One focused, completable unit each.
507
- - Don't add a `parallelGroup` frontmatter key — the filename `NN-` prefix drives grouping.
508
- - Don't write a PRD to `data/prds/`, `docs/prds/`, the project's own folder, or anywhere outside
509
- the canonical path — and don't reach for a hand-written file at the canonical path either, when
510
- `scheduler_create_prd` is reachable. The user has explicitly flagged this as a recurring
511
- problem.
512
- - Don't leave `cwd` unset hoping for the default. Be explicit.
513
- - Don't skip a step-3 lens silently and don't force every request into a chain — most asks are
514
- still an independent set of small PRDs; reach for the 3-5-PRD evolving chain only when the
515
- work is genuinely sequential (each link depends on the previous one's landed state), and never
516
- chain past 5 links.
194
+ 5. Notes: "Work as the validator persona — the procedure is your system prompt." and a line
195
+ `Base: <sha>`, the SHA from step 11.
196
+ 6. `gate: ["none"]`; `files`: the record path. Why: the validator re-runs each PRD's gate
197
+ itself, and a REFUTED PRD is still a successful validation.
198
+
199
+ The validator prints `VALIDATION: <slug> VERIFIED` or `VALIDATION: <slug> REFUTED — <reason>`
200
+ per PRD. While it is pending, the scheduler skips per-PRD validation prompts and in-run review.
201
+
202
+ If the API rejects `agentType: "validator"`, the persona is not installed: keep the plan
203
+ queued, say so, ask the human to restart the app, and answer each VALIDATION REQUEST the
204
+ scheduler sends here. Never write the record yourself.
205
+
206
+ ## Phase 2 — track to done
207
+
208
+ The scheduler heals most parks itself:
209
+
210
+ 1. Transcript-noise parks (verdicts transcript_errors, no_verdict_sentinel,
211
+ abandoned_background_task) complete when the gate re-run is green, the landed commit is on
212
+ HEAD and the tracked tree is clean.
213
+ 2. Stray-checkout parks (the main checkout was on another branch) are re-landed onto the base
214
+ branch ref without touching the checkout.
215
+ 3. needs_review notices are held and grouped per Epic and cause. One notice is sent only when
216
+ the ladder gives up or the hold time ends (default 4 hours, `SM_REVIEW_NOTICE_HOLD_MINUTES`).
217
+
218
+ Rules:
219
+
220
+ 1. Do not poll, re-verify each PRD, or arm ScheduleWakeup or a loop. Finished PRDs arrive as
221
+ check-in events; leave them alone.
222
+ 2. Do not re-queue or reset on a single park or a rate-limit pause. Why: the scheduler may
223
+ still heal it; a duplicate races the healed run.
224
+ 3. Act only on these signals:
225
+ 1. **A grouped scheduler notice** (needs_review). Read each file on its `Reports:` line. For
226
+ each PRD on its `PRDs:` line, take the first case that fits:
227
+ 1. It is skipped and the plan's validate PRD has not run yet: do nothing. The validator
228
+ reports it, and the fix wave covers it.
229
+ 2. Its spec is wrong: fix it with `scheduler_update_prd`, then call `scheduler_reset_job`
230
+ (add `force: true` if it is skipped). Always edit first. Why: a reset job can start on
231
+ the next tick. The tool does not check the new body, so copy the `# Gate` and
232
+ `# Files` sections unchanged unless they are what is wrong.
233
+ 3. Its spec is right: call `scheduler_reset_job` (add `force: true` if it is skipped).
234
+ 4. Another PRD or a human already did the work: confirm it in the tree, then call
235
+ `scheduler_archive_prd`. Archiving marks it completed and frees the PRDs that depend on
236
+ it.
237
+ A parked validator arrives this way too.
238
+ 2. **A validator verdict.** Read its record. A `REFUTED` PRD, or a Critical or Important
239
+ finding, means a fix wave: one `behavior` or `wire` PRD per finding plus a new validate
240
+ PRD. Never fix inline.
241
+ 3. **A VALIDATION REQUEST**, only when the plan has no validate PRD. Follow the steps in the
242
+ request.
243
+ 4. **Done** = the latest validator marked every PRD `VERIFIED`, no Critical or Important
244
+ finding is open, and its record is committed. Never "done with caveats": a REFUTED PRD gets
245
+ a fix wave or an explicit human decision to stop.
246
+
247
+ ### Final report
248
+
249
+ 1. What landed: each PRD slug and its commit.
250
+ 2. The validation record path.
251
+ 3. Minor findings deferred.
252
+ 4. Anything still open.
253
+ 5. Any warning kept or validator skipped.
254
+
255
+ ## Never
256
+
257
+ - Write a PRD by hand, or anywhere the API does not. `data/prds/`, `docs/prds/`,
258
+ `~/.claude/session-manager/scheduled-plans/prds/` and the retired flat
259
+ `session-manager-operations/scheduler/prds/` never run.
260
+ - Combine unrelated features in one PRD.