claude-code-session-manager 0.111.0 → 0.113.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 (290) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/dist/assets/{AgentLibrary-rBO1daqM.js → AgentLibrary-wvrcLGGS.js} +2 -2
  3. package/dist/assets/{Button-DsEYRZg0.js → Button-B6h0F0XT.js} +1 -1
  4. package/dist/assets/{DataModel-D8sbvvBC.js → DataModel-C5pW9E3u.js} +1 -1
  5. package/dist/assets/{History-BEHLtxia.js → History-BV4e8YOM.js} +2 -2
  6. package/dist/assets/{Hooks-CKpvlXrg.js → Hooks-CrFSv4x1.js} +3 -3
  7. package/dist/assets/{Library-CeF4qh9d.js → Library-D-GIt3EY.js} +5 -5
  8. package/dist/assets/{ListDetail-DcfmxPFk.js → ListDetail-Bco_wfs6.js} +1 -1
  9. package/dist/assets/{MarkdownEditor-CvK1pyto.js → MarkdownEditor-C-yHSXNV.js} +1 -1
  10. package/dist/assets/{McpServers-D-h2ihzJ.js → McpServers-CfDekadG.js} +2 -2
  11. package/dist/assets/{Memory-BnF89x8v.js → Memory-CGGLexkR.js} +4 -4
  12. package/dist/assets/{Panel-CQY5zano.js → Panel-DGMEuYYG.js} +1 -1
  13. package/dist/assets/{Permissions-DLukmmsz.js → Permissions-Cx2zjtYZ.js} +3 -3
  14. package/dist/assets/{Plugins-0Pf0OZ4l.js → Plugins-Bc_W3IyR.js} +2 -2
  15. package/dist/assets/ProvenanceBadge-DiKAUR1u.js +1 -0
  16. package/dist/assets/RemoteMachines-8_77-WPD.js +3 -0
  17. package/dist/assets/{SaveBar-DjijiUb0.js → SaveBar-Blpzdq1R.js} +1 -1
  18. package/dist/assets/{Scheduler-Cm3EXZvE.js → Scheduler-Bd70AM4X.js} +9 -9
  19. package/dist/assets/{ScopeSwitcher-B-P-kSfq.js → ScopeSwitcher-wxN0h4YW.js} +1 -1
  20. package/dist/assets/Settings-CQ7DA3zW.js +4 -0
  21. package/dist/assets/{SkillReferenceGraph-Epv2GJmj.js → SkillReferenceGraph-DH1NLOiS.js} +1 -1
  22. package/dist/assets/Skills-CmyRyu4_.js +2 -0
  23. package/dist/assets/SystemPrompt-KAc3UMCd.js +1 -0
  24. package/dist/assets/TagLibrary-C8EvHnpg.js +1 -0
  25. package/dist/assets/{TiptapBody-DAMO3DhO.js → TiptapBody-d423mH6D.js} +1 -1
  26. package/dist/assets/{Toggle-Ba_f7q_m.js → Toggle-D1wsGE9S.js} +1 -1
  27. package/dist/assets/{ViewTabs-CGX6MAhc.js → ViewTabs-CjHw3kGY.js} +1 -1
  28. package/dist/assets/{historyTotals-vgfk8EOL.js → historyTotals-DFHzqLt7.js} +1 -1
  29. package/dist/assets/{index-CPieAFsl.js → index-Ci1u018F.js} +266 -266
  30. package/dist/assets/{settingsSchema-D0FxNrTy.js → settingsSchema-Ctf3pZVI.js} +1 -1
  31. package/dist/assets/{useAgentsDirWatch-DCu6BNYN.js → useAgentsDirWatch-B1NBmOAe.js} +1 -1
  32. package/dist/assets/{useRemotePeers-D4cdJDyh.js → useRemotePeers-BHjSJs9D.js} +1 -1
  33. package/dist/index.html +1 -1
  34. package/package.json +3 -2
  35. package/plugins/CLAUDE.md +5 -8
  36. package/plugins/session-manager-dev/.claude-plugin/plugin.json +3 -6
  37. package/plugins/session-manager-dev/skills/builder/1-classify-and-bump/SKILL.md +2 -2
  38. package/plugins/session-manager-dev/skills/builder/SKILL.md +2 -3
  39. package/plugins/session-manager-dev/skills/develop/SKILL.md +1 -1
  40. package/plugins/session-manager-dev/skills/develop/standards.md +3 -3
  41. package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +13 -0
  42. package/scripts/README.md +3 -3
  43. package/scripts/audit-ops-hygiene.cjs +4 -4
  44. package/scripts/hooks/guard-destructive-git.cjs +4 -4
  45. package/scripts/hooks/guard-inline-implementation.cjs +1 -1
  46. package/scripts/hooks/guard-prd-writes.cjs +2 -2
  47. package/scripts/hooks/lib/guard-destructive-git-policy.cjs +1 -1
  48. package/scripts/mint-epic.cjs +2 -2
  49. package/scripts/scheduler-mcp-server.cjs +27 -9
  50. package/src/main/agentLibrary.cjs +5 -5
  51. package/src/main/agentsIpc.cjs +76 -0
  52. package/src/main/build-info.json +4 -4
  53. package/src/main/chatRunner.cjs +30 -13
  54. package/src/main/config.cjs +20 -3
  55. package/src/main/crashDiagnostics.cjs +2 -2
  56. package/src/main/docEdit.cjs +5 -5
  57. package/src/main/files.cjs +2 -2
  58. package/src/main/git.cjs +1 -1
  59. package/src/main/health.cjs +20 -18
  60. package/src/main/heapSnapshot.cjs +1 -1
  61. package/src/main/historyAggregator.cjs +2 -2
  62. package/src/main/index.cjs +50 -132
  63. package/src/main/ipcSchemas.cjs +13 -10
  64. package/src/main/lib/CLAUDE.md +48 -0
  65. package/src/main/lib/activeSessions.cjs +14 -1
  66. package/src/main/lib/classifyPromptTicket.cjs +2 -2
  67. package/src/main/lib/{agentModelResolve.cjs → claude/agentModelResolve.cjs} +7 -7
  68. package/src/main/lib/{claudeBin.cjs → claude/claudeBin.cjs} +4 -4
  69. package/src/main/lib/{effectiveModelInfo.cjs → claude/effectiveModelInfo.cjs} +9 -9
  70. package/src/main/lib/{modelCatalog.cjs → claude/modelCatalog.cjs} +3 -3
  71. package/src/main/lib/claude/rateLimitDetect.cjs +54 -0
  72. package/src/main/lib/{rateLimitWindow.cjs → claude/rateLimitWindow.cjs} +24 -12
  73. package/src/main/lib/{runClaudeP.cjs → claude/runClaudeP.cjs} +1 -1
  74. package/src/main/lib/credentials.cjs +18 -92
  75. package/src/main/lib/cwdClassify.cjs +1 -1
  76. package/src/main/lib/{activeIndexMerge.cjs → epic/activeIndexMerge.cjs} +3 -3
  77. package/src/main/lib/{activeIndexRebuild.cjs → epic/activeIndexRebuild.cjs} +1 -1
  78. package/src/main/lib/{delegationReadiness.cjs → epic/delegationReadiness.cjs} +21 -29
  79. package/src/main/lib/{epicContextDigest.cjs → epic/epicContextDigest.cjs} +1 -1
  80. package/src/main/lib/{epicDelegationStats.cjs → epic/epicDelegationStats.cjs} +2 -2
  81. package/src/main/lib/{epicMint.cjs → epic/epicMint.cjs} +11 -11
  82. package/src/main/lib/{epicSpawnPlan.cjs → epic/epicSpawnPlan.cjs} +3 -3
  83. package/src/main/lib/{epicStatusMirror.cjs → epic/epicStatusMirror.cjs} +2 -2
  84. package/src/main/lib/{epicTranscriptDiagnostic.cjs → epic/epicTranscriptDiagnostic.cjs} +2 -2
  85. package/src/main/lib/{epicTranscriptPath.cjs → epic/epicTranscriptPath.cjs} +2 -2
  86. package/src/main/lib/{epicValidationHook.cjs → epic/epicValidationHook.cjs} +3 -3
  87. package/src/main/lib/{epicWorktreeBoot.cjs → epic/epicWorktreeBoot.cjs} +1 -1
  88. package/src/main/lib/{epicWorktreeMerge.cjs → epic/epicWorktreeMerge.cjs} +3 -3
  89. package/src/main/lib/{epicWorktreeMint.cjs → epic/epicWorktreeMint.cjs} +3 -3
  90. package/src/main/lib/{epicWorktreeProjectConfig.cjs → epic/epicWorktreeProjectConfig.cjs} +4 -4
  91. package/src/main/lib/{promptSessionsCreateEpic.cjs → epic/promptSessionsCreateEpic.cjs} +4 -4
  92. package/src/main/lib/{crossProjectFeedback.cjs → feedback-remote/crossProjectFeedback.cjs} +114 -16
  93. package/src/main/lib/{customerFeedbackClient.cjs → feedback-remote/customerFeedbackClient.cjs} +3 -3
  94. package/src/main/lib/{customerFeedbackInbox.cjs → feedback-remote/customerFeedbackInbox.cjs} +2 -2
  95. package/src/main/lib/{customerFeedbackIpc.cjs → feedback-remote/customerFeedbackIpc.cjs} +1 -1
  96. package/src/main/lib/feedback-remote/humanPromptLedger.cjs +93 -0
  97. package/src/main/lib/{localAdminHttp.cjs → feedback-remote/localAdminHttp.cjs} +2 -2
  98. package/src/main/lib/{macroAdminRoutes.cjs → feedback-remote/macroAdminRoutes.cjs} +1 -1
  99. package/src/main/lib/{projectHomeAdminRoutes.cjs → feedback-remote/projectHomeAdminRoutes.cjs} +4 -4
  100. package/src/main/lib/{relayClientAuth.cjs → feedback-remote/relayClientAuth.cjs} +2 -2
  101. package/src/main/lib/{remoteClientSessions.cjs → feedback-remote/remoteClientSessions.cjs} +1 -1
  102. package/src/main/lib/{gitWorktree.cjs → git/gitWorktree.cjs} +7 -7
  103. package/src/main/lib/historyRollup.cjs +1 -1
  104. package/src/main/lib/importReferences.cjs +1 -1
  105. package/src/main/lib/machineProfile.cjs +1 -1
  106. package/src/main/lib/mcpToolCatalog.cjs +9 -3
  107. package/src/main/lib/openExternalApp.cjs +1 -1
  108. package/src/main/lib/opsOwnership.cjs +3 -3
  109. package/src/main/lib/{agentPersonaSchema.cjs → persona-macro/agentPersonaSchema.cjs} +2 -2
  110. package/src/main/lib/{macroLibrary.cjs → persona-macro/macroLibrary.cjs} +5 -5
  111. package/src/main/lib/{personaMerge.cjs → persona-macro/personaMerge.cjs} +4 -4
  112. package/src/main/lib/{depSlugResolve.cjs → prd/depSlugResolve.cjs} +16 -1
  113. package/src/main/lib/{prdAdminRoutes.cjs → prd/prdAdminRoutes.cjs} +7 -7
  114. package/src/main/lib/{prdAgentType.cjs → prd/prdAgentType.cjs} +3 -3
  115. package/src/main/lib/{prdCreate.cjs → prd/prdCreate.cjs} +12 -12
  116. package/src/main/lib/{prdDeclaredPaths.cjs → prd/prdDeclaredPaths.cjs} +1 -1
  117. package/src/main/lib/{prdGateFiles.cjs → prd/prdGateFiles.cjs} +1 -1
  118. package/src/main/lib/{prdLocations.cjs → prd/prdLocations.cjs} +2 -2
  119. package/src/main/lib/{prdMigration.cjs → prd/prdMigration.cjs} +3 -3
  120. package/src/main/lib/prereqs.cjs +2 -2
  121. package/src/main/lib/{instanceLock.cjs → process/instanceLock.cjs} +4 -11
  122. package/src/main/lib/{pidAlive.cjs → process/pidAlive.cjs} +1 -1
  123. package/src/main/lib/{procName.cjs → process/procName.cjs} +2 -2
  124. package/src/main/lib/{timeoutShim.cjs → process/timeoutShim.cjs} +1 -1
  125. package/src/main/lib/projectRootResolve.cjs +1 -1
  126. package/src/main/lib/promptSessionSchema.cjs +1 -1
  127. package/src/main/lib/{definitionOfDone.cjs → scheduler/definitionOfDone.cjs} +6 -12
  128. package/src/main/lib/scheduler/finalizeReason.cjs +30 -0
  129. package/src/main/lib/{fixChainDepth.cjs → scheduler/fixChainDepth.cjs} +1 -1
  130. package/src/main/lib/scheduler/flatSweepThrottle.cjs +17 -0
  131. package/src/main/lib/{jobDirtFilter.cjs → scheduler/jobDirtFilter.cjs} +1 -1
  132. package/src/main/lib/{jobSupervisorRecord.cjs → scheduler/jobSupervisorRecord.cjs} +1 -1
  133. package/src/main/lib/{launchFailure.cjs → scheduler/launchFailure.cjs} +2 -2
  134. package/src/main/lib/{queueStore.cjs → scheduler/queueStore.cjs} +6 -6
  135. package/src/main/lib/{quietMachineLease.cjs → scheduler/quietMachineLease.cjs} +1 -1
  136. package/src/main/lib/{rcaReport.cjs → scheduler/rcaReport.cjs} +4 -4
  137. package/src/main/lib/{reaperHelpers.cjs → scheduler/reaperHelpers.cjs} +3 -3
  138. package/src/main/lib/{reservationExpiry.cjs → scheduler/reservationExpiry.cjs} +4 -11
  139. package/src/main/lib/{reviewNotice.cjs → scheduler/reviewNotice.cjs} +1 -1
  140. package/src/main/lib/{runLogRetention.cjs → scheduler/runLogRetention.cjs} +34 -13
  141. package/src/main/lib/{scheduleJobTransitions.cjs → scheduler/scheduleJobTransitions.cjs} +3 -3
  142. package/src/main/lib/{schedulerBatch.cjs → scheduler/schedulerBatch.cjs} +9 -13
  143. package/src/main/lib/{schedulerConfig.cjs → scheduler/schedulerConfig.cjs} +1 -1
  144. package/src/main/lib/{schedulerRuntimeState.cjs → scheduler/schedulerRuntimeState.cjs} +1 -1
  145. package/src/main/lib/{sessionSlots.cjs → scheduler/sessionSlots.cjs} +2 -2
  146. package/src/main/lib/{upgradeDrain.cjs → scheduler/upgradeDrain.cjs} +8 -11
  147. package/src/main/lib/{watchdogHelpers.cjs → scheduler/watchdogHelpers.cjs} +5 -19
  148. package/src/main/lib/{auditLog.cjs → telemetry/auditLog.cjs} +1 -1
  149. package/src/main/lib/{opsErrorLog.cjs → telemetry/opsErrorLog.cjs} +4 -4
  150. package/src/main/lib/{telemetryBacklog.cjs → telemetry/telemetryBacklog.cjs} +4 -4
  151. package/src/main/lib/{telemetryBoot.cjs → telemetry/telemetryBoot.cjs} +1 -1
  152. package/src/main/lib/{telemetryClient.cjs → telemetry/telemetryClient.cjs} +12 -8
  153. package/src/main/lib/{telemetrySettings.cjs → telemetry/telemetrySettings.cjs} +1 -1
  154. package/src/main/lib/{atomicFs.cjs → util/atomicFs.cjs} +42 -0
  155. package/src/main/lib/{loopDelay.cjs → util/loopDelay.cjs} +1 -1
  156. package/src/main/logs.cjs +1 -1
  157. package/src/main/mcpStatus.cjs +2 -2
  158. package/src/main/memoryAggregate.cjs +3 -3
  159. package/src/main/memoryTool.cjs +1 -1
  160. package/src/main/otel.cjs +2 -2
  161. package/src/main/pluginInstall.cjs +29 -3
  162. package/src/main/projectBrief.cjs +6 -6
  163. package/src/main/projectPages.cjs +1 -1
  164. package/src/main/promptSessionEvents.cjs +2 -2
  165. package/src/main/pty.cjs +7 -7
  166. package/src/main/queueOps.cjs +6 -6
  167. package/src/main/remoteClient.cjs +4 -4
  168. package/src/main/remoteClientIpc.cjs +1 -1
  169. package/src/main/runVerify.cjs +6 -3
  170. package/src/main/scheduler/CLAUDE.md +26 -0
  171. package/src/main/scheduler/budget.cjs +576 -0
  172. package/src/main/scheduler/gitTreeGuard.cjs +672 -0
  173. package/src/main/scheduler/prdParser.cjs +4 -4
  174. package/src/main/scheduler/prdPaths.cjs +487 -0
  175. package/src/main/scheduler/reviewLadder.cjs +1011 -0
  176. package/src/main/scheduler/starvation.cjs +390 -0
  177. package/src/main/scheduler.cjs +331 -3320
  178. package/src/main/seedAgentPersonas.cjs +5 -5
  179. package/src/main/seedDevPlugin.cjs +70 -3
  180. package/src/main/seedSchedulerMcp.cjs +2 -2
  181. package/src/main/supervisor.cjs +50 -27
  182. package/src/main/telemetryIpc.cjs +51 -0
  183. package/src/main/transcripts.cjs +3 -3
  184. package/src/main/updaterIpc.cjs +1 -1
  185. package/src/main/usage.cjs +1 -1
  186. package/src/main/watchers.cjs +1 -1
  187. package/src/main/webRemote.cjs +22 -7
  188. package/src/preload/api.d.ts +14 -8
  189. package/src/preload/index.cjs +9 -3
  190. package/dist/assets/ProvenanceBadge-vC7Tj-JP.js +0 -1
  191. package/dist/assets/RemoteMachines-CWnKbFHc.js +0 -3
  192. package/dist/assets/Settings-DYDlp2m_.js +0 -4
  193. package/dist/assets/Skills-DHO0N0C2.js +0 -2
  194. package/dist/assets/SystemPrompt-DxeNofL9.js +0 -1
  195. package/dist/assets/TagLibrary-QOAs7ISO.js +0 -1
  196. package/plugins/session-manager-dev/skills/blog-for-project-feature/0-select/SKILL.md +0 -39
  197. package/plugins/session-manager-dev/skills/blog-for-project-feature/1-research/SKILL.md +0 -37
  198. package/plugins/session-manager-dev/skills/blog-for-project-feature/2-storyboard/SKILL.md +0 -64
  199. package/plugins/session-manager-dev/skills/blog-for-project-feature/3-capture/SKILL.md +0 -52
  200. package/plugins/session-manager-dev/skills/blog-for-project-feature/4-draft-copy/SKILL.md +0 -37
  201. package/plugins/session-manager-dev/skills/blog-for-project-feature/5-illustrate/SKILL.md +0 -50
  202. package/plugins/session-manager-dev/skills/blog-for-project-feature/6-compose/SKILL.md +0 -51
  203. package/plugins/session-manager-dev/skills/blog-for-project-feature/7-review/SKILL.md +0 -54
  204. package/plugins/session-manager-dev/skills/blog-for-project-feature/SKILL.md +0 -144
  205. package/plugins/session-manager-dev/skills/blog-for-project-feature/feature.config.yaml +0 -90
  206. package/plugins/session-manager-dev/skills/discover-features/SKILL.md +0 -95
  207. package/plugins/session-manager-dev/skills/explain-to-me/SKILL.md +0 -205
  208. package/plugins/session-manager-dev/skills/explain-to-me/assets/style-reference.html +0 -163
  209. package/plugins/session-manager-dev/skills/find-opportunity/SKILL.md +0 -83
  210. package/plugins/session-manager-dev/skills/issue-address/0-select/0-fetch-pool/SKILL.md +0 -38
  211. package/plugins/session-manager-dev/skills/issue-address/0-select/1-reject-fixed/SKILL.md +0 -64
  212. package/plugins/session-manager-dev/skills/issue-address/0-select/2-reject-claimed/SKILL.md +0 -71
  213. package/plugins/session-manager-dev/skills/issue-address/0-select/3-rank-impact/SKILL.md +0 -39
  214. package/plugins/session-manager-dev/skills/issue-address/0-select/SKILL.md +0 -75
  215. package/plugins/session-manager-dev/skills/issue-address/1-confirm-open/SKILL.md +0 -39
  216. package/plugins/session-manager-dev/skills/issue-address/2-claim/SKILL.md +0 -57
  217. package/plugins/session-manager-dev/skills/issue-address/3-reproduce/SKILL.md +0 -40
  218. package/plugins/session-manager-dev/skills/issue-address/4-fix/SKILL.md +0 -33
  219. package/plugins/session-manager-dev/skills/issue-address/5-verify/SKILL.md +0 -40
  220. package/plugins/session-manager-dev/skills/issue-address/SKILL.md +0 -120
  221. package/plugins/session-manager-dev/skills/local-project-health/SKILL.md +0 -58
  222. package/plugins/session-manager-dev/skills/memory-sanitation/SKILL.md +0 -147
  223. package/plugins/session-manager-dev/skills/ops-sweep/SKILL.md +0 -137
  224. package/plugins/session-manager-dev/skills/pr-review-sweep/0-fetch/SKILL.md +0 -41
  225. package/plugins/session-manager-dev/skills/pr-review-sweep/1-classify/SKILL.md +0 -56
  226. package/plugins/session-manager-dev/skills/pr-review-sweep/2-check-fixed/SKILL.md +0 -49
  227. package/plugins/session-manager-dev/skills/pr-review-sweep/3-queue/SKILL.md +0 -57
  228. package/plugins/session-manager-dev/skills/pr-review-sweep/4-land-and-resolve/SKILL.md +0 -60
  229. package/plugins/session-manager-dev/skills/pr-review-sweep/SKILL.md +0 -124
  230. package/plugins/session-manager-dev/skills/pr-signal/SKILL.md +0 -67
  231. package/plugins/session-manager-dev/skills/project-status/SKILL.md +0 -243
  232. package/plugins/session-manager-dev/skills/requesting-code-review/SKILL.md +0 -98
  233. package/plugins/session-manager-dev/skills/requesting-code-review/code-reviewer.md +0 -146
  234. package/src/main/lib/rateLimitDetect.cjs +0 -35
  235. /package/src/main/lib/{agentEffortResolve.cjs → claude/agentEffortResolve.cjs} +0 -0
  236. /package/src/main/lib/{claudeCliCaps.cjs → claude/claudeCliCaps.cjs} +0 -0
  237. /package/src/main/lib/{usageCircuit.cjs → claude/usageCircuit.cjs} +0 -0
  238. /package/src/main/lib/{epicSpawnCwd.cjs → epic/epicSpawnCwd.cjs} +0 -0
  239. /package/src/main/lib/{customerFeedbackAdminRoutes.cjs → feedback-remote/customerFeedbackAdminRoutes.cjs} +0 -0
  240. /package/src/main/lib/{remoteE2eCrypto.cjs → feedback-remote/remoteE2eCrypto.cjs} +0 -0
  241. /package/src/main/lib/{branchSweep.cjs → git/branchSweep.cjs} +0 -0
  242. /package/src/main/lib/{gitExec.cjs → git/gitExec.cjs} +0 -0
  243. /package/src/main/lib/{jobWorktree.cjs → git/jobWorktree.cjs} +0 -0
  244. /package/src/main/lib/{jobWorktreeBootLive.cjs → git/jobWorktreeBootLive.cjs} +0 -0
  245. /package/src/main/lib/{jobWorktreeTerminalOrphanLive.cjs → git/jobWorktreeTerminalOrphanLive.cjs} +0 -0
  246. /package/src/main/lib/{builtinMacros.cjs → persona-macro/builtinMacros.cjs} +0 -0
  247. /package/src/main/lib/{personaImportHealth.cjs → persona-macro/personaImportHealth.cjs} +0 -0
  248. /package/src/main/lib/{shippedPersonaSeeds.cjs → persona-macro/shippedPersonaSeeds.cjs} +0 -0
  249. /package/src/main/lib/{planValidator.cjs → prd/planValidator.cjs} +0 -0
  250. /package/src/main/lib/{prdAuthoringSeed.cjs → prd/prdAuthoringSeed.cjs} +0 -0
  251. /package/src/main/lib/{prdDisposition.cjs → prd/prdDisposition.cjs} +0 -0
  252. /package/src/main/lib/{prdFrontmatter.cjs → prd/prdFrontmatter.cjs} +0 -0
  253. /package/src/main/lib/{prdSizing.cjs → prd/prdSizing.cjs} +0 -0
  254. /package/src/main/lib/{workTypeLibrary.cjs → prd/workTypeLibrary.cjs} +0 -0
  255. /package/src/main/lib/{childWithLog.cjs → process/childWithLog.cjs} +0 -0
  256. /package/src/main/lib/{cleanEnv.cjs → process/cleanEnv.cjs} +0 -0
  257. /package/src/main/lib/{defaultShell.cjs → process/defaultShell.cjs} +0 -0
  258. /package/src/main/lib/{killTree.cjs → process/killTree.cjs} +0 -0
  259. /package/src/main/lib/{loginShellPath.cjs → process/loginShellPath.cjs} +0 -0
  260. /package/src/main/lib/{procIdentity.cjs → process/procIdentity.cjs} +0 -0
  261. /package/src/main/lib/{singleInstanceGuard.cjs → process/singleInstanceGuard.cjs} +0 -0
  262. /package/src/main/lib/{smProcNames.cjs → process/smProcNames.cjs} +0 -0
  263. /package/src/main/lib/{timeoutShimScript.cjs → process/timeoutShimScript.cjs} +0 -0
  264. /package/src/main/lib/{winSpawn.cjs → process/winSpawn.cjs} +0 -0
  265. /package/src/main/lib/{adoptedRunSupervisor.cjs → scheduler/adoptedRunSupervisor.cjs} +0 -0
  266. /package/src/main/lib/{dispatchLoop.cjs → scheduler/dispatchLoop.cjs} +0 -0
  267. /package/src/main/lib/{dodDrainHook.cjs → scheduler/dodDrainHook.cjs} +0 -0
  268. /package/src/main/lib/{fixPlanSlug.cjs → scheduler/fixPlanSlug.cjs} +0 -0
  269. /package/src/main/lib/{gateAuthority.cjs → scheduler/gateAuthority.cjs} +0 -0
  270. /package/src/main/lib/{landedSinceRun.cjs → scheduler/landedSinceRun.cjs} +0 -0
  271. /package/src/main/lib/{loadGate.cjs → scheduler/loadGate.cjs} +0 -0
  272. /package/src/main/lib/{needsReviewLedger.cjs → scheduler/needsReviewLedger.cjs} +0 -0
  273. /package/src/main/lib/{queueHealth.cjs → scheduler/queueHealth.cjs} +0 -0
  274. /package/src/main/lib/{queueHistory.cjs → scheduler/queueHistory.cjs} +0 -0
  275. /package/src/main/lib/{scheduleJobSchema.cjs → scheduler/scheduleJobSchema.cjs} +0 -0
  276. /package/src/main/lib/{schedulerPaths.cjs → scheduler/schedulerPaths.cjs} +0 -0
  277. /package/src/main/lib/{terminalRunOutcome.cjs → scheduler/terminalRunOutcome.cjs} +0 -0
  278. /package/src/main/lib/{validationSentinels.cjs → scheduler/validationSentinels.cjs} +0 -0
  279. /package/src/main/lib/{crashTelemetry.cjs → telemetry/crashTelemetry.cjs} +0 -0
  280. /package/src/main/lib/{otlpTraceExporter.cjs → telemetry/otlpTraceExporter.cjs} +0 -0
  281. /package/src/main/lib/{telemetryConsent.cjs → telemetry/telemetryConsent.cjs} +0 -0
  282. /package/src/main/lib/{telemetryCounters.cjs → telemetry/telemetryCounters.cjs} +0 -0
  283. /package/src/main/lib/{encodeCwd.cjs → util/encodeCwd.cjs} +0 -0
  284. /package/src/main/lib/{expandHome.cjs → util/expandHome.cjs} +0 -0
  285. /package/src/main/lib/{extractJson.cjs → util/extractJson.cjs} +0 -0
  286. /package/src/main/lib/{fileTail.cjs → util/fileTail.cjs} +0 -0
  287. /package/src/main/lib/{headTailBuffer.cjs → util/headTailBuffer.cjs} +0 -0
  288. /package/src/main/lib/{kebabCase.cjs → util/kebabCase.cjs} +0 -0
  289. /package/src/main/lib/{lruCache.cjs → util/lruCache.cjs} +0 -0
  290. /package/src/main/lib/{withTimeout.cjs → util/withTimeout.cjs} +0 -0
@@ -105,7 +105,49 @@ function readJsonOrSync(file, fallback) {
105
105
  }
106
106
  }
107
107
 
108
+ function defaultIsPidAlive(pid) {
109
+ try {
110
+ process.kill(pid, 0);
111
+ return true;
112
+ } catch (e) {
113
+ return e?.code === 'EPERM'; // exists but owned by someone else
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Remove orphaned `<file>.tmp-<pid>-<ts>-<rand>` files left by crashed
119
+ * writers. Direct children of `dir` only (no recursion); a file goes only when
120
+ * its mtime is older than `olderThanMs` AND its embedded pid is not alive.
121
+ * `.corrupt-*` / `.bak*` forensics never match. Never throws.
122
+ */
123
+ function sweepStaleTmpFiles(dir, { olderThanMs = 3600000, isPidAlive = defaultIsPidAlive } = {}) {
124
+ const removed = [];
125
+ let names;
126
+ try {
127
+ names = fs.readdirSync(dir);
128
+ } catch {
129
+ return { removed };
130
+ }
131
+ const now = Date.now();
132
+ for (const name of names) {
133
+ try {
134
+ const m = /\.tmp-(\d+)-/.exec(name);
135
+ if (!m) continue;
136
+ if (/\.(corrupt|bak)/.test(name)) continue;
137
+ const full = path.join(dir, name);
138
+ const st = fs.lstatSync(full);
139
+ if (!st.isFile()) continue;
140
+ if (now - st.mtimeMs <= olderThanMs) continue;
141
+ if (isPidAlive(Number(m[1]))) continue;
142
+ fs.unlinkSync(full);
143
+ removed.push(full);
144
+ } catch { /* per-file errors are skipped */ }
145
+ }
146
+ return { removed };
147
+ }
148
+
108
149
  module.exports = {
150
+ sweepStaleTmpFiles,
109
151
  tmpPathFor,
110
152
  writeTextAtomic,
111
153
  writeTextAtomicSync,
@@ -11,7 +11,7 @@ const { monitorEventLoopDelay } = require('node:perf_hooks');
11
11
 
12
12
  const LOOP_DELAY_RESOLUTION_MS = 20;
13
13
  // A single beat whose worst loop delay exceeds this is a visible main-thread stall.
14
- const LOOP_STALL_WARN_MS = 250;
14
+ const LOOP_STALL_WARN_MS = 1000;
15
15
 
16
16
  const NS_PER_MS = 1e6;
17
17
  const toMs = (ns) => Math.round(ns / NS_PER_MS * 10) / 10;
package/src/main/logs.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const { app, ipcMain } = require('electron');
2
2
  const fs = require('node:fs');
3
3
  const path = require('node:path');
4
- const opsErrorLog = require('./lib/opsErrorLog.cjs');
4
+ const opsErrorLog = require('./lib/telemetry/opsErrorLog.cjs');
5
5
 
6
6
  // Rolling daily files under <userData>/logs/. Anything mtime'd older than
7
7
  // RETENTION_MS is pruned at boot; we never compact mid-session, since the
@@ -10,8 +10,8 @@
10
10
  */
11
11
 
12
12
  const { spawn } = require('node:child_process');
13
- const { resolveClaudeBin, claudeSpawnTarget } = require('./lib/claudeBin.cjs');
14
- const { withProcRole } = require('./lib/cleanEnv.cjs');
13
+ const { resolveClaudeBin, claudeSpawnTarget } = require('./lib/claude/claudeBin.cjs');
14
+ const { withProcRole } = require('./lib/process/cleanEnv.cjs');
15
15
 
16
16
  const PROBE_TIMEOUT_MS = 30_000;
17
17
 
@@ -22,9 +22,9 @@
22
22
  const { ipcMain } = require('electron');
23
23
  const path = require('node:path');
24
24
  const os = require('node:os');
25
- const { encodeCwd } = require('./lib/encodeCwd.cjs');
26
- const { extractJson } = require('./lib/extractJson.cjs');
27
- const { runClaudeP } = require('./lib/runClaudeP.cjs');
25
+ const { encodeCwd } = require('./lib/util/encodeCwd.cjs');
26
+ const { extractJson } = require('./lib/util/extractJson.cjs');
27
+ const { runClaudeP } = require('./lib/claude/runClaudeP.cjs');
28
28
  const { writeJson } = require('./config.cjs');
29
29
  const config = require('./config.cjs');
30
30
  const { opsPath } = require('./lib/opsOwnership.cjs');
@@ -36,7 +36,7 @@ const { scoreMemories } = require('./lib/memoryStale.cjs');
36
36
  const MAX_FILE_BYTES = 1024 * 1024; // 1 MiB
37
37
  const MAX_ENTRIES = 1000;
38
38
 
39
- const { encodeCwd: encodeWorkspace } = require('./lib/encodeCwd.cjs');
39
+ const { encodeCwd: encodeWorkspace } = require('./lib/util/encodeCwd.cjs');
40
40
 
41
41
  function memoryRoot() {
42
42
  return path.join(os.homedir(), '.claude', 'projects');
package/src/main/otel.cjs CHANGED
@@ -8,14 +8,14 @@
8
8
  * plan text, and agent prompts are excluded unless `includeContent` is on
9
9
  * (matches upstream OTEL_LOG_USER_PROMPTS opt-in).
10
10
  *
11
- * Spans are POSTed as OTLP/HTTP JSON by lib/otlpTraceExporter.cjs (zero
11
+ * Spans are POSTed as OTLP/HTTP JSON by lib/telemetry/otlpTraceExporter.cjs (zero
12
12
  * dependencies). recordSpan() only queues; the exporter batches/sends on its
13
13
  * own unref()'d timer, so we never block the transcript flush. The app must
14
14
  * keep working without telemetry: a failed export is surfaced, never thrown.
15
15
  */
16
16
 
17
17
  const otelSettings = require('./otelSettings.cjs');
18
- const { createOtlpTraceExporter } = require('./lib/otlpTraceExporter.cjs');
18
+ const { createOtlpTraceExporter } = require('./lib/telemetry/otlpTraceExporter.cjs');
19
19
 
20
20
  let exporter = null;
21
21
  let enabled = false;
@@ -30,8 +30,8 @@ try {
30
30
  const path = require('node:path');
31
31
  const os = require('node:os');
32
32
  const fs = require('node:fs');
33
- const { cleanChildEnv, pathWithUserBins } = require('./lib/cleanEnv.cjs');
34
- const { resolveClaudeBin, claudeSpawnTarget } = require('./lib/claudeBin.cjs');
33
+ const { cleanChildEnv, pathWithUserBins } = require('./lib/process/cleanEnv.cjs');
34
+ const { resolveClaudeBin, claudeSpawnTarget } = require('./lib/claude/claudeBin.cjs');
35
35
  const { sendIfAlive } = require('./lib/sendToRenderer.cjs');
36
36
  const { schemas } = require('./ipcSchemas.cjs');
37
37
 
@@ -229,6 +229,32 @@ async function install({ slug, marketplace }) {
229
229
  }
230
230
  }
231
231
 
232
+ /**
233
+ * Refresh an already-installed plugin to the marketplace's current version.
234
+ * Subcommands confirmed from `claude plugin marketplace --help` / `claude plugin --help`:
235
+ * `claude plugin marketplace update <name>` then `claude plugin update <slug>@<name>`.
236
+ * Same pty spawn path as install(); no shell.
237
+ */
238
+ async function update({ slug, marketplaceName }) {
239
+ if (typeof slug !== 'string' || !SLUG_RE.test(slug) || slug.length > 128 ||
240
+ typeof marketplaceName !== 'string' || !MKT_NAME_RE.test(marketplaceName) || marketplaceName.length > 128) {
241
+ return { ok: false, exitCode: -1, error: 'invalid slug or marketplace' };
242
+ }
243
+ if (inFlight.has(slug)) {
244
+ return { ok: false, exitCode: -1, error: 'install already in progress' };
245
+ }
246
+ inFlight.set(slug, null);
247
+ const register = (proc) => inFlight.set(slug, proc);
248
+ const unregister = () => inFlight.set(slug, null);
249
+ try {
250
+ const refreshed = await runStep({ slug, args: ['plugin', 'marketplace', 'update', marketplaceName], register, unregister });
251
+ if (!refreshed.ok) return refreshed;
252
+ return await runStep({ slug, args: ['plugin', 'update', `${slug}@${marketplaceName}`], register, unregister });
253
+ } finally {
254
+ inFlight.delete(slug);
255
+ }
256
+ }
257
+
232
258
  function registerPluginInstallHandlers() {
233
259
  ipcMain.handle('plugins:install', async (_e, payload) => {
234
260
  // safeParse to preserve the existing `{ ok:false, exitCode:-1, error }`
@@ -257,4 +283,4 @@ function registerPluginInstallHandlers() {
257
283
  });
258
284
  }
259
285
 
260
- module.exports = { registerPluginInstallHandlers, attachWindow, install, bundledMarketplaceDir };
286
+ module.exports = { registerPluginInstallHandlers, attachWindow, install, update, bundledMarketplaceDir };
@@ -9,12 +9,12 @@
9
9
  * surfaces (PRDs 838/840) read it via `projectBrief:get` and trigger
10
10
  * synthesis via `projectBrief:refresh`; this file is backend + preload only.
11
11
  *
12
- * Spawn pattern mirrors memoryAggregate.cjs (via the shared lib/runClaudeP.cjs
12
+ * Spawn pattern mirrors memoryAggregate.cjs (via the shared lib/claude/runClaudeP.cjs
13
13
  * helper it was extracted from): cost-gated (only fires on explicit
14
14
  * `refresh`), stdin closed, model pinned, hard timeout, SM_KG_INTERNAL=1 so
15
15
  * the prompt-logging hook skips it, brace-matching JSON extraction. Slot
16
16
  * pool: every refresh acquires a machine session slot from
17
- * lib/sessionSlots.cjs first (the same ≤3 `claude -p` pool scheduler jobs
17
+ * lib/scheduler/sessionSlots.cjs first (the same ≤3 `claude -p` pool scheduler jobs
18
18
  * and chat runs already share) and releases it in a finally.
19
19
  */
20
20
 
@@ -24,10 +24,10 @@ const { spawn } = require('node:child_process');
24
24
  const path = require('node:path');
25
25
  const os = require('node:os');
26
26
  const config = require('./config.cjs');
27
- const { encodeCwd } = require('./lib/encodeCwd.cjs');
28
- const { extractJson } = require('./lib/extractJson.cjs');
29
- const { runClaudeP } = require('./lib/runClaudeP.cjs');
30
- const sessionSlots = require('./lib/sessionSlots.cjs');
27
+ const { encodeCwd } = require('./lib/util/encodeCwd.cjs');
28
+ const { extractJson } = require('./lib/util/extractJson.cjs');
29
+ const { runClaudeP } = require('./lib/claude/runClaudeP.cjs');
30
+ const sessionSlots = require('./lib/scheduler/sessionSlots.cjs');
31
31
  const core = require('./lib/projectBriefCore.cjs');
32
32
 
33
33
  // Pinned explicitly per the automation model-pinning rule — same alias style
@@ -6,7 +6,7 @@
6
6
  * `session-manager-operations/project-pages/`: `home.html` (written by the
7
7
  * `project_home_write` admin route) and `demo-video/index.html` (written by
8
8
  * the `project_demo_video_write` admin route) — both in
9
- * lib/projectHomeAdminRoutes.cjs. This module only reads them: get() returns
9
+ * lib/feedback-remote/projectHomeAdminRoutes.cjs. This module only reads them: get() returns
10
10
  * home.html's content plus the demo video's { path, mtimeMs }, and a
11
11
  * refcounted per-cwd watcher pushes `project-pages:changed` for either. It
12
12
  * never writes content (watch()'s mkdir creates an empty directory only).
@@ -16,10 +16,10 @@ const config = require('./config.cjs');
16
16
  // activeIndexPath/withPathLock come from epicMint.cjs so this module's
17
17
  // read-modify-write of active-index.json (appendResponseEventIfKnown, below)
18
18
  // serializes through the EXACT SAME lock instance as ensureEpic/
19
- // appendPrdCreatedEvent and lib/activeIndexMerge.cjs's mergeActiveIndex — one
19
+ // appendPrdCreatedEvent and lib/epic/activeIndexMerge.cjs's mergeActiveIndex — one
20
20
  // lock across all three writers of this file, not three independent maps
21
21
  // that could still interleave a stale read-modify-write past each other.
22
- const { activeIndexPath: promptSessionActiveIndexPath, withPathLock } = require('./lib/epicMint.cjs');
22
+ const { activeIndexPath: promptSessionActiveIndexPath, withPathLock } = require('./lib/epic/epicMint.cjs');
23
23
 
24
24
  // IPC channel broadcast whenever an event is appended to a PromptSession's
25
25
  // chain from the main process (currently only the scheduler's response-event
package/src/main/pty.cjs CHANGED
@@ -17,15 +17,15 @@ const path = require('node:path');
17
17
  const os = require('node:os');
18
18
  const fs = require('node:fs');
19
19
  const { addAllowedRoot } = require('./config.cjs');
20
- const { aliasedShellBin } = require('./lib/smProcNames.cjs');
21
- const { cleanChildEnv, pathWithUserBins } = require('./lib/cleanEnv.cjs');
20
+ const { aliasedShellBin } = require('./lib/process/smProcNames.cjs');
21
+ const { cleanChildEnv, pathWithUserBins } = require('./lib/process/cleanEnv.cjs');
22
22
  const { checkInsideHome } = require('./lib/insideHome.cjs');
23
- const { defaultShell } = require('./lib/defaultShell.cjs');
23
+ const { defaultShell } = require('./lib/process/defaultShell.cjs');
24
24
  const { sendIfAlive } = require('./lib/sendToRenderer.cjs');
25
- const opsErrorLog = require('./lib/opsErrorLog.cjs');
26
- const { planEpicSpawn } = require('./lib/epicSpawnPlan.cjs');
27
- const { resolveEpicSpawnCwd } = require('./lib/epicSpawnCwd.cjs');
28
- const telemetryCounters = require('./lib/telemetryCounters.cjs');
25
+ const opsErrorLog = require('./lib/telemetry/opsErrorLog.cjs');
26
+ const { planEpicSpawn } = require('./lib/epic/epicSpawnPlan.cjs');
27
+ const { resolveEpicSpawnCwd } = require('./lib/epic/epicSpawnCwd.cjs');
28
+ const telemetryCounters = require('./lib/telemetry/telemetryCounters.cjs');
29
29
 
30
30
  // Absolute path to the installed package root (src/main/ -> ../../), shown in
31
31
  // the remediation message so the user can cd there and rebuild.
@@ -36,11 +36,11 @@ const { ipcMain } = require('electron');
36
36
  const { SCHEDULE_SLUG_RE: SLUG_RE, schemas } = require('./ipcSchemas.cjs');
37
37
  const logs = require('./logs.cjs');
38
38
  const config = require('./config.cjs');
39
- const { expandHome } = require('./lib/expandHome.cjs');
40
- const { HISTORY_RETENTION_MS } = require('./lib/schedulerConfig.cjs');
41
- const schedulerPaths = require('./lib/schedulerPaths.cjs');
39
+ const { expandHome } = require('./lib/util/expandHome.cjs');
40
+ const { HISTORY_RETENTION_MS } = require('./lib/scheduler/schedulerConfig.cjs');
41
+ const schedulerPaths = require('./lib/scheduler/schedulerPaths.cjs');
42
42
 
43
- // Lazy: resolved via lib/schedulerPaths.cjs at each use (SM_SCHEDULER_HOME).
43
+ // Lazy: resolved via lib/scheduler/schedulerPaths.cjs at each use (SM_SCHEDULER_HOME).
44
44
  const prdsArchiveDir = () => path.join(schedulerPaths.scheduledPlansRoot(), 'prds-archived');
45
45
 
46
46
  // ────────────────────────────────────────────── lint rules
@@ -125,8 +125,8 @@ const INTERACTIVE_AC_PATTERNS = [
125
125
  },
126
126
  ];
127
127
 
128
- const { splitFrontmatter } = require('./lib/prdFrontmatter.cjs');
129
- const { resolvePrdsDirs, resolvePrdWriteDir, listEpicPrdDirs } = require('./lib/prdLocations.cjs');
128
+ const { splitFrontmatter } = require('./lib/prd/prdFrontmatter.cjs');
129
+ const { resolvePrdsDirs, resolvePrdWriteDir, listEpicPrdDirs } = require('./lib/prd/prdLocations.cjs');
130
130
 
131
131
  // PRD 808: PRDS_DIR is now the LEGACY global dir — kept as a migration
132
132
  // source and search fallback for not-yet-migrated files. Live PRDs resolve
@@ -7,11 +7,11 @@
7
7
 
8
8
  const crypto = require('node:crypto');
9
9
  const path = require('node:path');
10
- const { claudeHome } = require('./lib/schedulerPaths.cjs');
11
- const { writeJsonAtomicSync, readJsonOrSync } = require('./lib/atomicFs.cjs');
12
- const { generateE2EKeyPair, deriveSessionKey, deriveSas, encryptBox, decryptBox } = require('./lib/remoteE2eCrypto.cjs');
10
+ const { claudeHome } = require('./lib/scheduler/schedulerPaths.cjs');
11
+ const { writeJsonAtomicSync, readJsonOrSync } = require('./lib/util/atomicFs.cjs');
12
+ const { generateE2EKeyPair, deriveSessionKey, deriveSas, encryptBox, decryptBox } = require('./lib/feedback-remote/remoteE2eCrypto.cjs');
13
13
  const { ALLOWED_COMMANDS } = require('./ipcSchemas.cjs');
14
- const { relayClientAuth } = require('./lib/relayClientAuth.cjs');
14
+ const { relayClientAuth } = require('./lib/feedback-remote/relayClientAuth.cjs');
15
15
 
16
16
  // Hard-coded wss:// — same relay URL as webRemote.cjs, no plaintext downgrade.
17
17
  const RELAY_WSS_URL = 'wss://bilko.run/projects/session-manager/relay';
@@ -11,7 +11,7 @@ const os = require('node:os');
11
11
  const { ipcMain } = require('electron');
12
12
  const { z } = require('zod');
13
13
  const { remoteClient } = require('./remoteClient.cjs');
14
- const { relayClientAuth } = require('./lib/relayClientAuth.cjs');
14
+ const { relayClientAuth } = require('./lib/feedback-remote/relayClientAuth.cjs');
15
15
  const { ALLOWED_COMMANDS } = require('./ipcSchemas.cjs');
16
16
  const { sendIfAlive } = require('./lib/sendToRenderer.cjs');
17
17
 
@@ -40,7 +40,8 @@
40
40
  const fs = require('node:fs');
41
41
  const path = require('node:path');
42
42
  const { execFileSync } = require('node:child_process');
43
- const { parsePrdFile } = require('./lib/prdFrontmatter.cjs');
43
+ const { parsePrdFile } = require('./lib/prd/prdFrontmatter.cjs');
44
+ const { isSatisfiedDepRow } = require('./lib/prd/depSlugResolve.cjs');
44
45
 
45
46
  const VERDICTS_SCHEMA_VERSION = 1;
46
47
 
@@ -468,7 +469,9 @@ function checkDeps(queueEntry, allJobs, prdBody) {
468
469
  // bare dep name that never matched any row, and ended up on disk with no
469
470
  // queue row at all.
470
471
  if (deps.length === 0) continue;
471
- const unfinished = deps.find((d) => d.status !== 'completed');
472
+ // Same predicate as findBlockingDep — an auto-resolve skip the picker
473
+ // dispatched past must not be re-judged unmet here (same infinite re-run).
474
+ const unfinished = deps.find((d) => !isSatisfiedDepRow(d));
472
475
  if (unfinished) {
473
476
  return { ok: false, reason: `dependsOn: "${depSlug}" is ${unfinished.status} (need completed)` };
474
477
  }
@@ -488,7 +491,7 @@ function checkDeps(queueEntry, allJobs, prdBody) {
488
491
  if (matches.length === 0) continue; // unresolvable fragment — skip
489
492
 
490
493
  for (const dep of matches) {
491
- if (dep.status !== 'completed') {
494
+ if (!isSatisfiedDepRow(dep)) {
492
495
  return {
493
496
  ok: false,
494
497
  reason: `PRD body dep "${frag}" → "${dep.slug}" is ${dep.status} (need completed)`,
@@ -0,0 +1,26 @@
1
+ # src/main/scheduler/ — scoped context
2
+
3
+ Pure, extracted pieces of `../scheduler.cjs` (the most-edited file). Scheduler-family helpers
4
+ (dispatch loop, slots, gates, supervisors, queue store) live in [`../lib/scheduler/`](../lib/CLAUDE.md).
5
+ Runtime diagnosis (stuck queue, `needs_review`, reap gate) is NOT here — see
6
+ [`scheduler-operations.md`](../../../session-manager-operations/architecture/scheduler-operations.md).
7
+
8
+ ## Rules
9
+
10
+ - **Spy seam:** call module functions through the module object (`mod.fn()`), never destructure them, so `vi.spyOn` works.
11
+ - **New pure scheduler logic goes in a module here, not in `scheduler.cjs`** (which keeps state, IO and timers).
12
+
13
+ ## If you are changing X, edit Y
14
+
15
+ | Changing | Edit |
16
+ | --- | --- |
17
+ | PRD file parsing, frontmatter, dir/file mtime cache | `prdParser.cjs` |
18
+ | Per-project PRD dirs, slug containment, archive-on-complete, boot migration, queue-backup sweep | `prdPaths.cjs` |
19
+ | `needs_review` / auto-fix / auto-reset eligibility, verdict sets, thresholds | `reviewLadder.cjs` |
20
+ | Git status/stash/HEAD helpers, shared-tree guard, commit-guard, finalize-drop predicates | `gitTreeGuard.cjs` |
21
+ | Starvation / blocked-chain classifiers, dispatch-idle clock | `starvation.cjs` |
22
+ | Stall / stranded-row / overrun / wall-clock budget selectors, failure backoff, `dependsOn` history lookup | `budget.cjs` |
23
+ | `spawnJob` / execution, `tickQueue`, dead-process reaper, poll loop, IPC handlers, admin routes, queue-mutating ladder rungs and watchdogs | `../scheduler.cjs` (by section banner) |
24
+
25
+ Before adding to `scheduler.cjs`, check the table: a predicate or selector belongs above, the
26
+ mutation that acts on it stays in `scheduler.cjs`.