claude-code-session-manager 0.138.0 → 0.140.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 (194) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +352 -79
  3. package/dist/assets/AppSettings-CMFEM68R.js +2 -0
  4. package/dist/assets/History--JwsFnbn.js +2 -0
  5. package/dist/assets/HomeClaudeConfig-ijEXs--3.js +3 -0
  6. package/dist/assets/{Panel-CeDiyuNn.js → Panel-CALyU0pe.js} +1 -1
  7. package/dist/assets/ProjectClaudeConfig-sdlA-fUb.js +26 -0
  8. package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-CFMK8NJh.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
  10. package/dist/assets/Skills-DtRzghn5.js +67 -0
  11. package/dist/assets/{TiptapBody-D1kTj-tn.js → TiptapBody-DApeu7x8.js} +60 -54
  12. package/dist/assets/ViewTabs-B7qLXRAH.js +1 -0
  13. package/dist/assets/{VoiceButton-CZeyPM31.js → VoiceButton-DtStfv1H.js} +1 -1
  14. package/dist/assets/{historyTotals-B00l64Jw.js → historyTotals-ydfnwepc.js} +1 -1
  15. package/dist/assets/index-CtxruO1L.js +3121 -0
  16. package/dist/assets/{index-62tyjEQB.css → index-DKXdXfka.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +467 -451
  20. package/package.json +17 -6
  21. package/plugins/AGENTS.md +60 -0
  22. package/plugins/CLAUDE.md +1 -60
  23. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  24. package/plugins/session-manager-dev/skills/builder/SKILL.md +12 -4
  25. package/plugins/session-manager-dev/skills/builder/scripts/publish-preflight.cjs +255 -0
  26. package/plugins/session-manager-dev/skills/develop/SKILL.md +36 -22
  27. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
  28. package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
  29. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
  30. package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
  31. package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
  32. package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
  33. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
  34. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
  35. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
  36. package/scripts/README.md +2 -0
  37. package/scripts/hooks/guard-tool-risk.cjs +91 -0
  38. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
  39. package/scripts/ops-sweep.cjs +53 -23
  40. package/scripts/scheduler-mcp-server.cjs +360 -35
  41. package/src/main/build-info.json +4 -4
  42. package/src/main/chatRunner.cjs +2 -2
  43. package/src/main/config.cjs +112 -8
  44. package/src/main/docEdit.cjs +6 -1
  45. package/src/main/exchanges.cjs +70 -5
  46. package/src/main/files.cjs +7 -27
  47. package/src/main/health.cjs +48 -15
  48. package/src/main/historyAggregator.cjs +172 -63
  49. package/src/main/historyDashboard.cjs +87 -17
  50. package/src/main/index.cjs +78 -4
  51. package/src/main/ipcSchemas.cjs +233 -20
  52. package/src/main/lib/AGENTS.md +54 -0
  53. package/src/main/lib/CLAUDE.md +1 -54
  54. package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
  55. package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
  56. package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
  57. package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
  58. package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
  59. package/src/main/lib/claude/effectiveModelInfo.cjs +92 -22
  60. package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
  61. package/src/main/lib/claude/modelPricing.cjs +148 -0
  62. package/src/main/lib/claude/personaToolScope.cjs +12 -6
  63. package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
  64. package/src/main/lib/claude/runClaudeP.cjs +6 -1
  65. package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
  66. package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
  67. package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
  68. package/src/main/lib/ephemeralCwd.cjs +37 -2
  69. package/src/main/lib/epic/delegationReadiness.cjs +42 -9
  70. package/src/main/lib/epic/epicAdminRoutes.cjs +121 -0
  71. package/src/main/lib/epic/epicJobReceipt.cjs +87 -0
  72. package/src/main/lib/epic/epicOutsideRead.cjs +423 -0
  73. package/src/main/lib/epic/epicOutsideState.cjs +233 -0
  74. package/src/main/lib/epic/epicSettle.cjs +1 -1
  75. package/src/main/lib/epic/epicStateWatcher.cjs +157 -0
  76. package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
  77. package/src/main/lib/epic/epicValidationHook.cjs +24 -4
  78. package/src/main/lib/epic/externalRef.cjs +37 -0
  79. package/src/main/lib/epic/externalRefIndex.cjs +136 -0
  80. package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
  81. package/src/main/lib/epic/restorableSessions.cjs +151 -17
  82. package/src/main/lib/epic/transcriptUsage.cjs +197 -0
  83. package/src/main/lib/externalContract.cjs +137 -0
  84. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +176 -5
  85. package/src/main/lib/feedback-remote/crossProjectReply.cjs +186 -9
  86. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -6
  87. package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +50 -8
  88. package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +218 -4
  89. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +19 -3
  90. package/src/main/lib/feedback-remote/feedbackImages.cjs +171 -0
  91. package/src/main/lib/feedback-remote/localAdminHttp.cjs +11 -10
  92. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +167 -21
  93. package/src/main/lib/feedback-remote/needsYouAdminRoutes.cjs +133 -0
  94. package/src/main/lib/feedback-remote/needsYouIpc.cjs +50 -0
  95. package/src/main/lib/feedback-remote/needsYouStore.cjs +285 -0
  96. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
  97. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
  98. package/src/main/lib/git/branchSweep.cjs +209 -4
  99. package/src/main/lib/git/gitWorktree.cjs +41 -5
  100. package/src/main/lib/guardShims.cjs +1 -1
  101. package/src/main/lib/historyRollup.cjs +58 -5
  102. package/src/main/lib/insideHome.cjs +27 -1
  103. package/src/main/lib/mcpToolCatalog.cjs +232 -25
  104. package/src/main/lib/mdDocCensus.cjs +59 -78
  105. package/src/main/lib/mdDocRefs.cjs +71 -93
  106. package/src/main/lib/mdNetworkScan.cjs +245 -250
  107. package/src/main/lib/mdReviewRecord.cjs +22 -9
  108. package/src/main/lib/memoryMdNetwork.cjs +5 -12
  109. package/src/main/lib/opsOwnership.cjs +18 -2
  110. package/src/main/lib/opsRetentionSettings.cjs +28 -4
  111. package/src/main/lib/persona-macro/agentAdminRoutes.cjs +121 -0
  112. package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
  113. package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
  114. package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
  115. package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
  116. package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
  117. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
  118. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  119. package/src/main/lib/prd/depSlugResolve.cjs +104 -4
  120. package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
  121. package/src/main/lib/prd/prdCreate.cjs +351 -23
  122. package/src/main/lib/prd/prdDisposition.cjs +11 -2
  123. package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
  124. package/src/main/lib/process/loginItem.cjs +171 -0
  125. package/src/main/lib/process/loginItemPlan.cjs +193 -0
  126. package/src/main/lib/project-pages/playerBridge.cjs +4 -0
  127. package/src/main/lib/project-pages/videoReview.cjs +268 -0
  128. package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
  129. package/src/main/lib/promptSessionSchema.cjs +4 -0
  130. package/src/main/lib/remoteTranscriptTail.cjs +32 -1
  131. package/src/main/lib/scheduler/cpuSample.cjs +131 -4
  132. package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
  133. package/src/main/lib/scheduler/loadGate.cjs +24 -6
  134. package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
  135. package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
  136. package/src/main/lib/scheduler/queueStore.cjs +7 -0
  137. package/src/main/lib/scheduler/rcaReport.cjs +21 -1
  138. package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
  139. package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
  140. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  141. package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
  142. package/src/main/lib/scheduler/schedulerPaths.cjs +12 -0
  143. package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
  144. package/src/main/lib/scheduler/validationQuality.cjs +282 -0
  145. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
  146. package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
  147. package/src/main/lib/tasks/taskIpc.cjs +80 -0
  148. package/src/main/lib/tasks/taskLedger.cjs +502 -0
  149. package/src/main/lib/tasks/taskRun.cjs +313 -0
  150. package/src/main/lib/tasks/taskSwitch.cjs +120 -0
  151. package/src/main/lib/telemetry/auditEvents.cjs +176 -0
  152. package/src/main/lib/telemetry/eventsAdminRoutes.cjs +45 -0
  153. package/src/main/loginItemIpc.cjs +35 -0
  154. package/src/main/loopEfficiencyHandlers.cjs +11 -2
  155. package/src/main/projectPages.cjs +6 -15
  156. package/src/main/promptSessionEvents.cjs +9 -1
  157. package/src/main/queueOps.cjs +260 -3
  158. package/src/main/runVerify.cjs +53 -25
  159. package/src/main/scheduler/AGENTS.md +26 -0
  160. package/src/main/scheduler/CLAUDE.md +1 -26
  161. package/src/main/scheduler/budget.cjs +239 -9
  162. package/src/main/scheduler/cancelDependents.cjs +154 -0
  163. package/src/main/scheduler/prdParser.cjs +4 -1
  164. package/src/main/scheduler/starvation.cjs +20 -18
  165. package/src/main/scheduler.cjs +774 -64
  166. package/src/main/supervisor.cjs +5 -1
  167. package/src/main/templates/PRD_AUTHORING.md +7 -1
  168. package/src/main/transcripts.cjs +62 -7
  169. package/src/main/validationQualityHandlers.cjs +199 -0
  170. package/src/main/webRemote.cjs +132 -20
  171. package/src/preload/api.d.ts +434 -28
  172. package/src/preload/apiSurface.cjs +7 -0
  173. package/src/preload/apiSurface.json +485 -81
  174. package/src/preload/index.cjs +38 -5
  175. package/src/seed/agents/validator.md +19 -8
  176. package/dist/assets/AgentLibrary-C1d_D7uQ.js +0 -2
  177. package/dist/assets/AppSettings-CgDhqrsU.js +0 -2
  178. package/dist/assets/Button-Bk23rEnZ.js +0 -1
  179. package/dist/assets/DocumentEditorPane-BqY5Nq6W.js +0 -1
  180. package/dist/assets/Extensions-CXem-uwI.js +0 -2
  181. package/dist/assets/History-BwO3coo4.js +0 -2
  182. package/dist/assets/Library-BDV69fSe.js +0 -32
  183. package/dist/assets/ListDetail-CD-Fm6mh.js +0 -1
  184. package/dist/assets/ProjectClaudeConfig-NjdKdwe8.js +0 -25
  185. package/dist/assets/ProvenanceBadge-Bu8NmI_R.js +0 -1
  186. package/dist/assets/Scheduler-CkhTvG7C.js +0 -16
  187. package/dist/assets/Settings-COT34hBF.js +0 -2
  188. package/dist/assets/Skills-BgexoUkQ.js +0 -29
  189. package/dist/assets/SourceChip-BXjcdeb1.js +0 -1
  190. package/dist/assets/SystemPrompt-CeeH3EeW.js +0 -1
  191. package/dist/assets/Toggle-CENi19iK.js +0 -1
  192. package/dist/assets/ViewTabs-DDBb0x96.js +0 -1
  193. package/dist/assets/claude-settings-schema-COigsajx.js +0 -3
  194. package/dist/assets/index-CgCxpunJ.js +0 -3116
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "claude-code-session-manager",
3
- "version": "0.138.0",
4
- "description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
3
+ "version": "0.140.0",
4
+ "description": "Free desktop app for Claude Code: run many sessions, each in its own git worktree; queue work that runs headless within your usage limits; agents drive it through an MCP server and skills.",
5
5
  "type": "module",
6
6
  "main": "src/main/index.cjs",
7
7
  "bin": {
@@ -19,10 +19,12 @@
19
19
  "scripts/hooks/guard-destructive-git.cjs",
20
20
  "scripts/hooks/guard-inline-implementation.cjs",
21
21
  "scripts/hooks/guard-self-schedule.cjs",
22
+ "scripts/hooks/guard-tool-risk.cjs",
22
23
  "scripts/hooks/lib/guard-destructive-git-policy.cjs",
23
24
  "scripts/hooks/lib/guard-self-schedule-policy.cjs",
24
25
  "scripts/hooks/lib/guard-prd-writes-policy.cjs",
25
26
  "scripts/hooks/lib/guard-inline-implementation-policy.cjs",
27
+ "scripts/hooks/lib/guard-tool-risk-policy.cjs",
26
28
  "src/main/",
27
29
  "src/preload/",
28
30
  "src/seed/",
@@ -47,10 +49,11 @@
47
49
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.main.json",
48
50
  "start": "electron .",
49
51
  "prepack": "node scripts/write-build-info.cjs",
50
- "prepublishOnly": "node scripts/write-build-info.cjs && npm run build",
52
+ "prepublishOnly": "node scripts/write-build-info.cjs && npm run build && npm run lint:readme",
51
53
  "test:unit": "vitest run",
52
54
  "test:unit:stability": "bash scripts/test-unit-stability.sh",
53
55
  "bench": "node scripts/bench/main-bench.cjs",
56
+ "probe:job-sandbox": "node scripts/job-sandbox-probe.cjs",
54
57
  "bench:renderer": "vitest run --config vitest.bench.config.ts",
55
58
  "preview:memory": "node scripts/memory-explorer-shots.mjs",
56
59
  "test:e2e": "xvfb-run -a playwright test",
@@ -67,6 +70,8 @@
67
70
  "identity:scan": "bash scripts/identity-guard.sh tree",
68
71
  "lint:hooks": "node scripts/check-conditional-hooks.cjs",
69
72
  "lint:docs": "node scripts/check-doc-hierarchy.cjs",
73
+ "lint:readme": "node scripts/check-readme.cjs",
74
+ "readme:build": "node scripts/check-readme.cjs --write",
70
75
  "lint:paths": "node scripts/check-ops-path-literals.cjs",
71
76
  "lint:any": "node scripts/check-explicit-any.cjs",
72
77
  "lint:main-ts-check": "node scripts/check-main-ts-check.cjs",
@@ -77,7 +82,7 @@
77
82
  "lint:e2e-budget": "node scripts/check-e2e-budget.cjs",
78
83
  "lint:scroll": "node scripts/check-scroll-into-view.cjs",
79
84
  "check:frame": "node scripts/frame-integrity.mjs",
80
- "lint": "npm run lint:selectors && npm run lint:hooks && npm run lint:docs && npm run lint:paths && npm run lint:any && npm run lint:main-ts-check && npm run lint:filenames && npm run lint:renderer-storage && npm run lint:test-smells && npm run lint:page-stewards && npm run lint:e2e-budget && npm run lint:scroll",
85
+ "lint": "npm run lint:selectors && npm run lint:hooks && npm run lint:docs && npm run lint:paths && npm run lint:any && npm run lint:main-ts-check && npm run lint:filenames && npm run lint:renderer-storage && npm run lint:test-smells && npm run lint:page-stewards && npm run lint:e2e-budget && npm run lint:scroll && npm run lint:readme",
81
86
  "sync:settings-schema": "node scripts/sync-settings-schema.cjs"
82
87
  },
83
88
  "keywords": [
@@ -90,12 +95,18 @@
90
95
  "cli",
91
96
  "cockpit",
92
97
  "mcp",
98
+ "mcp-server",
93
99
  "agents",
94
100
  "hooks",
95
101
  "scheduler",
96
102
  "voice",
97
103
  "speech-to-text",
98
- "prd"
104
+ "prd",
105
+ "claude-code-plugin",
106
+ "skills",
107
+ "git-worktree",
108
+ "headless",
109
+ "desktop-app"
99
110
  ],
100
111
  "author": "bilkobibitkov",
101
112
  "license": "MIT",
@@ -142,6 +153,7 @@
142
153
  "chokidar": "^4.0.1",
143
154
  "electron": "42.11.18",
144
155
  "electron-updater": "^6.8.9",
156
+ "marked": "^14.0.0",
145
157
  "node-pty": "^1.2.0-beta.12",
146
158
  "ws": "^8.18.0",
147
159
  "zod": "^4.6.7"
@@ -169,7 +181,6 @@
169
181
  "electron-builder": "^26.15.3",
170
182
  "esbuild": "^0.25.12",
171
183
  "jsdom": "^29.1.1",
172
- "marked": "^14.0.0",
173
184
  "monaco-editor": "0.55.1",
174
185
  "onnxruntime-web": "^1.24.3",
175
186
  "postcss": "^8.4.49",
@@ -0,0 +1,60 @@
1
+ # plugins/ — scoped context
2
+
3
+ Part of the **AGENT LAYER** partition — see
4
+ [`project-partition.md`](../session-manager-operations/architecture/project-partition.md).
5
+
6
+ ## What's here
7
+
8
+ `session-manager-dev/skills/` — 4 skills (`builder`, `develop`, `maintaining-md-network`, `send-feedback`); keep in sync with `project-partition.md` and
9
+ `seedDevPlugin.cjs`'s header count.
10
+
11
+ `packs/<id>/` — context packs (plugin + `sm-pack.json` + optional `laws.md`), loaded per session by `--plugin-dir`, not the marketplace; read by `src/main/lib/packs/packCatalog.cjs`.
12
+
13
+ Two manifests: root [`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)
14
+ declares the one plugin (`source: "./plugins/session-manager-dev"`); the plugin's own
15
+ [`session-manager-dev/.claude-plugin/plugin.json`](session-manager-dev/.claude-plugin/plugin.json)
16
+ carries the `description` shown in the marketplace UI — list only shipped skills.
17
+ Bumping a plugin's `plugin.json` version requires bumping its entry in `.claude-plugin/marketplace.json` in the same PRD.
18
+
19
+ `src/main/seedDevPlugin.cjs` is the first-boot offline installer — installs this plugin from its
20
+ bundled marketplace (no network) on a fresh machine, then marks
21
+ `~/.claude/session-manager/.dev-plugin-seeded`.
22
+ Claude Code loads it in place from the registered marketplace's source folder (the app's package root), never the `~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/` snapshots: skill edits ship with app updates; a `plugin.json` bump only refreshes the shown version.
23
+
24
+ **`skills/develop/standards.md` is a frozen absolute-path contract.** Every scheduler PRD in
25
+ every consuming repo points its headless executor at it by resolved absolute path, baked
26
+ in at authoring time — including PRDs already archived in OTHER repos. Renaming or moving it
27
+ breaks them all, undetectably from here.
28
+
29
+ **Path literals inside shipped skills.** A skill runs in OTHER repos, so a
30
+ session-manager-internal path (`src/main/...`, `src/renderer/...`, bare `scripts/...`) inside one
31
+ is a portability defect unless `$SM_ROOT`-qualified (`$SM_ROOT` = installed
32
+ package root, e.g. `node "$SM_ROOT/scripts/<x>.cjs"`) or removed. `builder/manual.md` is session-manager-specific on
33
+ purpose and runs only when `session-manager-operations/manual/manual.json` exists.
34
+
35
+ ## Who consumes this
36
+
37
+ **Other repos**, not (only) this one. A project installs `claude-code-session-manager` from npm,
38
+ or references its skills/hooks directly.
39
+ Editing a skill here changes every consuming repo. See
40
+ [`../session-manager-operations/reviews/2026-09-12-agent-layer-consumers.md`](../session-manager-operations/reviews/2026-09-12-agent-layer-consumers.md)
41
+ for live consumers.
42
+
43
+ ## What must NOT be assumed
44
+
45
+ - Treat every skill edit here as a cross-repo API change.
46
+ - Do not vendor `scripts/hooks/guard-*.cjs` into a skill/repo — adopt **by reference** via the
47
+ stable shim (`src/main/lib/guardShims.cjs`) at `~/.claude/session-manager/hooks/guard-*.cjs`,
48
+ never this repo's own absolute path or a copy.
49
+ - Do not confuse this with `.claude/` at the repo root — this repo's own unshipped local dev
50
+ config. `.claude/agents/*.md` are per-project OVERLAYS that win over
51
+ `~/.claude/agents/*.md` (Claude Code's own precedence, per `src/main/agentLibrary.cjs`);
52
+ `src/seed/agents/` is the shipped source for the personas
53
+ `src/main/seedAgentPersonas.cjs` copies into `~/.claude/agents/` (its `PERSONAS` list);
54
+ `builder` has no seed source — the generic `~/.claude/agents/builder.md` is machine-local
55
+ and this repo's `.claude/agents/builder.md` overlays it. Tracked under `.claude/`:
56
+ `settings.json` (guard hooks), `agents/builder.md`, and the `agents/page-*.md` stewards.
57
+ - The scheduler MCP server (`session-manager-scheduler`) is registered at USER scope in
58
+ `~/.claude.json`, not in this repo.
59
+ - A skill may run headless via a scheduled PRD in another project — don't rely on
60
+ interactive-session-only features; check `/develop`'s scheduler flow first.
package/plugins/CLAUDE.md CHANGED
@@ -1,60 +1 @@
1
- # plugins/ — scoped context
2
-
3
- Part of the **AGENT LAYER** partition — see
4
- [`project-partition.md`](../session-manager-operations/architecture/project-partition.md).
5
-
6
- ## What's here
7
-
8
- `session-manager-dev/skills/` — 4 skills (`builder`, `develop`, `maintaining-md-network`, `send-feedback`) — verified against `ls
9
- plugins/session-manager-dev/skills` 2026-11-06; keep in sync with `project-partition.md` and
10
- `seedDevPlugin.cjs`'s header count.
11
-
12
- `packs/<id>/` — context packs (plugin + `sm-pack.json` + optional `laws.md`), loaded per session by `--plugin-dir`, not the marketplace; read by `src/main/lib/packs/packCatalog.cjs`.
13
-
14
- Two manifests: root [`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)
15
- declares the one plugin (`source: "./plugins/session-manager-dev"`); the plugin's own
16
- [`session-manager-dev/.claude-plugin/plugin.json`](session-manager-dev/.claude-plugin/plugin.json)
17
- carries the `description` shown in the marketplace UI — list only shipped skills.
18
- Bumping a plugin's `plugin.json` version requires bumping its entry in `.claude-plugin/marketplace.json` in the same PRD (PRD 3140 was refuted for missing it).
19
-
20
- `src/main/seedDevPlugin.cjs` is the first-boot offline installer — installs this plugin from its
21
- bundled marketplace (no GitHub/registry call) as a default on a fresh machine, then marks
22
- `~/.claude/session-manager/.dev-plugin-seeded`.
23
-
24
- **`skills/develop/standards.md` is a frozen absolute-path contract.** Every scheduler PRD, in
25
- every consuming repo, points its headless executor at it by resolved absolute path, baked
26
- in at authoring time — including PRDs already archived in OTHER repos. Renaming or moving it
27
- breaks them all, undetectably from here.
28
-
29
- **Path literals inside shipped skills.** A skill runs in OTHER repos, so a
30
- session-manager-internal path (`src/main/...`, `src/renderer/...`, bare `scripts/...`) inside one
31
- is a portability defect unless `$SM_ROOT`-qualified (e.g. `node "$SM_ROOT/scripts/<x>.cjs"`, with `$SM_ROOT` resolved
32
- to the installed package root) or removed. `builder/manual.md` is session-manager-specific on
33
- purpose and runs only when `session-manager-operations/manual/manual.json` exists.
34
-
35
- ## Who consumes this
36
-
37
- **Other repos**, not (only) this one. A project installs `claude-code-session-manager` from npm,
38
- or references its skills/hooks directly, for the same dev workflow session-manager uses on itself.
39
- Editing a skill here changes behavior in every consuming repo. See
40
- [`../session-manager-operations/reviews/2026-09-12-agent-layer-consumers.md`](../session-manager-operations/reviews/2026-09-12-agent-layer-consumers.md)
41
- for live sibling consumers.
42
-
43
- ## What must NOT be assumed
44
-
45
- - Treat every skill edit here as a cross-repo API change, not a local-only one.
46
- - Do not vendor `scripts/hooks/guard-*.cjs` into a skill/repo — adopt **by reference** via the
47
- stable shim (`src/main/lib/guardShims.cjs`) at `~/.claude/session-manager/hooks/guard-*.cjs`,
48
- never this repo's own absolute path or a copy.
49
- - Do not confuse this with `.claude/` at the repo root — this repo's own unshipped local dev
50
- config. `.claude/agents/*.md` are per-project OVERLAYS that win over
51
- `~/.claude/agents/*.md` (Claude Code's own precedence, per `src/main/agentLibrary.cjs`);
52
- `src/seed/agents/` is the shipped source for the personas
53
- `src/main/seedAgentPersonas.cjs` copies into `~/.claude/agents/` (its `PERSONAS` list);
54
- `builder` has no seed source — the generic `~/.claude/agents/builder.md` is machine-local
55
- and this repo's `.claude/agents/builder.md` overlays it. Tracked under `.claude/`:
56
- `settings.json` (guard hooks), `agents/builder.md`, and the `agents/page-*.md` stewards.
57
- - The scheduler MCP server (`session-manager-scheduler`) is registered at USER scope in
58
- `~/.claude.json`, not in this repo.
59
- - A skill may run headless via a scheduled PRD in another project — don't rely on
60
- interactive-session-only features; check `/develop`'s scheduler flow first.
1
+ @AGENTS.md
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "session-manager-dev",
3
3
  "description": "The default end-to-end development skillset for the Claude Code Session Manager: decompose work into scheduler PRDs and track them to a validated finish (/develop), publish releases to npm (/builder), hand a finding to another project on this machine (/send-feedback), and review or drift-check a project's CLAUDE.md/markdown network (/maintaining-md-network). Together with the session-manager scheduler these form a develop → queue → validate → release loop.",
4
- "version": "0.4.3",
4
+ "version": "0.4.4",
5
5
  "author": {
6
6
  "name": "Bilko Bibitkov",
7
7
  "email": "BilkoBibitkov2000@gmail.com",
@@ -37,7 +37,7 @@ If a meaningful share of commits has no `type:` prefix at all (a bare "wip", "up
37
37
  guess: list the unclassifiable commits and ask which bump to apply. A wrong semver bump is hard
38
38
  to walk back once published.
39
39
 
40
- ## 3. Gate
40
+ ## 3. Gate and publish preflight
41
41
 
42
42
  Run each name in `build-target.json`'s `gates` as `timeout 300 npm run <gate>`, in order,
43
43
  against `HEAD`, with no `--skip` flags. With no `gates` entry, run the pre-commit checks the
@@ -45,6 +45,12 @@ project's `CLAUDE.md` or README requires; with none documented, say so in the re
45
45
  failure → stop: report the command and its real output, and that no bump, tag or publish
46
46
  happened.
47
47
 
48
+ **Publish preflight.** After every gate passed, run once
49
+ `node <skill base dir>/scripts/publish-preflight.cjs --cwd <repo root>`; it picks the CI or
50
+ local path itself. Exit 1 / a `NPM_PUBLISH_PREFLIGHT: BLOCKED — ...` line → stop before step 4
51
+ (no `npm version`, commit, tag, push or publish) and report the line verbatim; don't retry
52
+ `npm login`, `npm publish` or the preflight. An OK line, any `WARN:` included, goes in the report.
53
+
48
54
  ## 4. Publish from an isolated worktree
49
55
 
50
56
  A dirty main working tree does not block this: the build and publish run in a clean worktree
@@ -93,9 +99,10 @@ have no `release.yml`) always use steps 5-11:
93
99
  A cold `test:unit` in a fresh publish worktree can time out under load; rerun the failed files, then the full suite, before calling the gate red — never publish on the partial rerun.
94
100
  7. `npm publish` from inside the worktree, so `prepublishOnly` builds there too.
95
101
  A 403 saying two-factor authentication or a bypass-2FA granular token is required is not a
96
- login problem (`npm whoami` can succeed). Don't retry `npm login` or `npm publish`: run
97
- `npm profile get` and `npm token list`, stop, and report the exact 403 and both results so a
98
- human can supply an OTP or a token (the CLI cannot mint a granular token). An E409 "staged"
102
+ login problem (`npm whoami` can succeed). The step 3 preflight normally catches a token
103
+ without 'Bypass two-factor authentication' before the bump. Don't retry `npm login` or
104
+ `npm publish`: run `npm token list --json` (its `bypass_2fa` field; `npm profile get` errors
105
+ with granular tokens), stop, and report the exact 403 and that result so a human can supply an OTP or a token (the CLI cannot mint a granular token). An E409 "staged"
99
106
  response means the publish waits for a human to approve it on npmjs.com — report that.
100
107
  8. Back in the main repo: `git push origin main` and `git push origin v<version>`.
101
108
  9. `git worktree remove "$HOME/.cache/sm-publish/v<version>" --force`
@@ -130,6 +137,7 @@ undoes it.
130
137
 
131
138
  One plain-text report, whether the pipeline finished or stopped:
132
139
 
140
+ - **Preflight**: the NPM_PUBLISH_PREFLIGHT line, verbatim.
133
141
  - **Version** previous → new, and the bump kind.
134
142
  - **Commits covered**, grouped by the rule that classified each.
135
143
  - **Gates** and their results.
@@ -0,0 +1,255 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /**
4
+ * publish-preflight.cjs — dependency-free check, run BEFORE any version bump or tag, that a
5
+ * release can actually reach npm. `npm whoami` alone is not enough: it passes for a token that
6
+ * cannot publish (e.g. 'Bypass two-factor authentication' off → every `npm publish` gets E403).
7
+ *
8
+ * node publish-preflight.cjs [--cwd <dir>] (default: process.cwd())
9
+ *
10
+ * Prints exactly one line to stdout:
11
+ * NPM_PUBLISH_PREFLIGHT: OK — <detail>[; WARN: <warn>] exit 0
12
+ * NPM_PUBLISH_PREFLIGHT: BLOCKED — <detail naming the credential> exit 1
13
+ *
14
+ * Mode: `ci` when <cwd>/.github/workflows/release.yml has a top-level `npm-publish:` job, else
15
+ * `local`. CI mode blocks only when the newest completed v*-tag run's npm-publish job failed AND
16
+ * the local check blocks.
17
+ *
18
+ * The npm auth token is read only to compare it against the redacted `token` field of
19
+ * `npm token list --json`; it is never printed, logged or returned.
20
+ */
21
+
22
+ const fs = require('fs');
23
+ const path = require('path');
24
+ const { spawnSync } = require('child_process');
25
+
26
+ const PREFIX = 'NPM_PUBLISH_PREFLIGHT:';
27
+ const TIMEOUT_MS = 30000;
28
+ const WARN_DAYS = 14;
29
+ const DAY_MS = 86400000;
30
+ const MAX_LINE = 400;
31
+
32
+ function defaultRun(cmd, args, { timeoutMs, cwd }) {
33
+ const r = spawnSync(cmd, args, { cwd, timeout: timeoutMs, encoding: 'utf8', shell: false });
34
+ return {
35
+ status: r.error ? null : r.status,
36
+ stdout: r.stdout || '',
37
+ stderr: r.stderr || (r.error ? String(r.error.message) : ''),
38
+ };
39
+ }
40
+
41
+ function defaultReadFile(p) {
42
+ try {
43
+ return fs.readFileSync(p, 'utf8');
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+
49
+ const firstLine = (s) => String(s || '').split(/\r?\n/).map((l) => l.trim()).find(Boolean) || 'no output';
50
+ const day = (ms) => new Date(ms).toISOString().slice(0, 10);
51
+ const clean = (s) => String(s).replace(/[\r\n]+/g, ' ');
52
+
53
+ function formatLine(ok, detail, warn) {
54
+ let line = `${PREFIX} ${ok ? 'OK' : 'BLOCKED'} — ${clean(detail)}`;
55
+ if (ok && warn) line += `; WARN: ${clean(warn)}`;
56
+ return line.length > MAX_LINE ? line.slice(0, MAX_LINE) : line;
57
+ }
58
+
59
+ function parseJson(text) {
60
+ try {
61
+ return JSON.parse(text);
62
+ } catch {
63
+ return undefined;
64
+ }
65
+ }
66
+
67
+ function packageName(cwd, readFile) {
68
+ const bt = parseJson(readFile(path.join(cwd, 'session-manager-operations', 'architecture', 'build-target.json')) || '');
69
+ if (bt && typeof bt.packageName === 'string' && bt.packageName) return bt.packageName;
70
+ const pj = parseJson(readFile(path.join(cwd, 'package.json')) || '');
71
+ if (pj && typeof pj.name === 'string' && pj.name) return pj.name;
72
+ return null;
73
+ }
74
+
75
+ function detectMode(cwd, readFile) {
76
+ const yml = readFile(path.join(cwd, '.github', 'workflows', 'release.yml'));
77
+ return yml && /^ {2}npm-publish:\s*$/m.test(yml) ? 'ci' : 'local';
78
+ }
79
+
80
+ /** The `_authToken` value in the npm userconfig for the registry's host, or null. */
81
+ function readInUseToken(ctx, registry) {
82
+ const uc = ctx.exec('npm', ['config', 'get', 'userconfig']);
83
+ if (uc.status !== 0) return null;
84
+ const file = ctx.readFile(firstLine(uc.stdout));
85
+ if (!file) return null;
86
+ let host;
87
+ try {
88
+ host = new URL(registry).host;
89
+ } catch {
90
+ return null;
91
+ }
92
+ for (const raw of file.split(/\r?\n/)) {
93
+ const m = /^\s*(\/\/[^:\s]+\/?):_authToken\s*=\s*(.+?)\s*$/.exec(raw);
94
+ if (!m) continue;
95
+ const keyHost = m[1].slice(2).split('/')[0];
96
+ if (keyHost !== host) continue;
97
+ const value = m[2].replace(/^["']|["']$/g, '').replace(/\$\{([^}]+)\}/g, (_, v) => ctx.env[v] || '');
98
+ return value || null;
99
+ }
100
+ return null;
101
+ }
102
+
103
+ function pickEntry(entries, inUse) {
104
+ if (inUse) {
105
+ const hits = entries.filter((e) => {
106
+ if (!e || typeof e.token !== 'string') return false;
107
+ const parts = e.token.split('...');
108
+ if (parts.length !== 2) return false;
109
+ return inUse.startsWith(parts[0]) && inUse.endsWith(parts[1]);
110
+ });
111
+ if (hits.length === 1) return hits[0];
112
+ return null;
113
+ }
114
+ const live = entries.filter((e) => e && !e.revoked);
115
+ return live.length === 1 ? live[0] : null;
116
+ }
117
+
118
+ function scopeCovers(entry, pkg) {
119
+ const pkgScopes = (Array.isArray(entry.scopes) ? entry.scopes : []).filter((s) => s && s.type === 'package');
120
+ if (pkgScopes.length === 0) return true;
121
+ const atScope = pkg.startsWith('@') ? pkg.split('/')[0] : null;
122
+ return pkgScopes.some((s) => s.name == null || s.name === pkg || (atScope && s.name === atScope));
123
+ }
124
+
125
+ function checkLocal(ctx, pkg) {
126
+ const reg = ctx.registry;
127
+ const who = ctx.exec('npm', ['whoami', '--registry', reg]);
128
+ if (who.status !== 0) {
129
+ return { ok: false, detail: `npm whoami failed (${firstLine(who.stderr)}): no working npm login on this machine` };
130
+ }
131
+ const user = firstLine(who.stdout);
132
+
133
+ let entry = null;
134
+ let warn = null;
135
+ const list = ctx.exec('npm', ['token', 'list', '--json', '--registry', reg]);
136
+ const entries = list.status === 0 ? parseJson(list.stdout) : undefined;
137
+ if (!Array.isArray(entries)) {
138
+ const why = list.status !== 0 ? firstLine(list.stderr || list.stdout) : firstLine(list.stdout);
139
+ warn = `token metadata unreadable (${why}); bypass-2FA not verified`;
140
+ } else {
141
+ entry = pickEntry(entries, readInUseToken(ctx, reg));
142
+ if (!entry) warn = 'could not tell which npm token is in use; bypass-2FA not verified';
143
+ }
144
+
145
+ let expiryMs = NaN;
146
+ if (entry) {
147
+ const name = entry.name || entry.key || 'unnamed';
148
+ expiryMs = entry.expiry ? Date.parse(entry.expiry) : NaN;
149
+ if (entry.revoked) return { ok: false, detail: `npm token '${name}' is revoked` };
150
+ if (Number.isFinite(expiryMs) && expiryMs < ctx.now()) {
151
+ return { ok: false, detail: `npm token '${name}' expired on ${day(expiryMs)}` };
152
+ }
153
+ if (entry.bypass_2fa !== true) {
154
+ return {
155
+ ok: false,
156
+ detail: `npm token '${name}' has 'Bypass two-factor authentication' off, so npm publish fails E403; regenerate it on npmjs.com with that box ticked`,
157
+ };
158
+ }
159
+ if (!scopeCovers(entry, pkg)) return { ok: false, detail: `npm token '${name}' cannot write ${pkg}` };
160
+ }
161
+
162
+ const owners = ctx.exec('npm', ['owner', 'ls', pkg, '--registry', reg]);
163
+ if (owners.status === 0) {
164
+ const names = owners.stdout.split(/\r?\n/).map((l) => l.trim().split(/\s+/)[0]).filter(Boolean);
165
+ if (!names.includes(user)) return { ok: false, detail: `npm user ${user} is not a maintainer of ${pkg}` };
166
+ }
167
+
168
+ if (!entry) return { ok: true, detail: `local npm login as ${user} can reach ${pkg}`, warn };
169
+ const name = entry.name || entry.key || 'unnamed';
170
+ if (Number.isFinite(expiryMs)) {
171
+ const days = Math.ceil((expiryMs - ctx.now()) / DAY_MS);
172
+ if (days <= WARN_DAYS) warn = `token '${name}' expires ${day(expiryMs)} (${days} days); renew it before then`;
173
+ }
174
+ return { ok: true, detail: `local npm token '${name}' can publish ${pkg} as ${user}`, warn };
175
+ }
176
+
177
+ /** → { state: 'ok'|'dead'|'unknown', tag?, runId? } */
178
+ function checkCi(ctx) {
179
+ const list = ctx.exec('gh', ['run', 'list', '--workflow', 'release.yml', '--limit', '20', '--json', 'databaseId,headBranch,status,conclusion']);
180
+ if (list.status !== 0) return { state: 'unknown' };
181
+ const runs = parseJson(list.stdout);
182
+ if (!Array.isArray(runs)) return { state: 'unknown' };
183
+ const run = runs.find((r) => r && r.status === 'completed' && /^v\d/.test(String(r.headBranch || '')));
184
+ if (!run) return { state: 'unknown' };
185
+ const view = ctx.exec('gh', ['run', 'view', String(run.databaseId), '--json', 'jobs']);
186
+ if (view.status !== 0) return { state: 'unknown' };
187
+ const data = parseJson(view.stdout);
188
+ const job = data && Array.isArray(data.jobs) ? data.jobs.find((j) => j && j.name === 'npm-publish') : null;
189
+ if (!job) return { state: 'unknown' };
190
+ const base = { tag: run.headBranch, runId: run.databaseId };
191
+ if (job.conclusion === 'success' || job.conclusion === 'skipped') return { state: 'ok', ...base };
192
+ if (job.conclusion === 'failure') return { state: 'dead', ...base };
193
+ return { state: 'unknown' };
194
+ }
195
+
196
+ async function preflight(opts = {}) {
197
+ const cwd = opts.cwd || process.cwd();
198
+ const run = opts.run || defaultRun;
199
+ const readFile = opts.readFile || defaultReadFile;
200
+ const env = opts.env || process.env;
201
+ const now = opts.now || Date.now;
202
+ const ctx = {
203
+ readFile,
204
+ env,
205
+ now,
206
+ exec: (cmd, args) => run(cmd, args, { timeoutMs: TIMEOUT_MS, cwd }),
207
+ };
208
+ const done = (ok, detail, warn) => ({ ok, line: formatLine(ok, detail, warn) });
209
+
210
+ const pkg = packageName(cwd, readFile);
211
+ if (!pkg) return done(false, 'no package name in build-target.json or package.json');
212
+
213
+ const regOut = ctx.exec('npm', ['config', 'get', 'registry']);
214
+ const regLine = regOut.status === 0 ? firstLine(regOut.stdout) : '';
215
+ ctx.registry = /^https?:\/\//.test(regLine) ? regLine : 'https://registry.npmjs.org/';
216
+
217
+ if (detectMode(cwd, readFile) === 'local') {
218
+ const local = checkLocal(ctx, pkg);
219
+ return done(local.ok, local.detail, local.warn);
220
+ }
221
+
222
+ const ci = checkCi(ctx);
223
+ if (ci.state === 'ok') return done(true, `CI npm-publish succeeded on ${ci.tag} (run ${ci.runId})`);
224
+ const local = checkLocal(ctx, pkg);
225
+ const ciState = ci.state === 'dead'
226
+ ? `CI npm-publish failed on ${ci.tag} (run ${ci.runId})`
227
+ : 'CI npm-publish has no earlier tag run to judge';
228
+ if (local.ok) return done(true, `${ciState}; local publish ready: ${local.detail}`, local.warn);
229
+ if (ci.state === 'dead') return done(false, `${ciState} and ${local.detail}`);
230
+ return done(true, `${ciState}; local check: ${local.detail}`);
231
+ }
232
+
233
+ function parseArgs(argv) {
234
+ const out = { cwd: process.cwd() };
235
+ for (let i = 0; i < argv.length; i++) {
236
+ if (argv[i] === '--cwd' && argv[i + 1]) out.cwd = path.resolve(argv[++i]);
237
+ }
238
+ return out;
239
+ }
240
+
241
+ async function main() {
242
+ const { cwd } = parseArgs(process.argv.slice(2));
243
+ let result;
244
+ try {
245
+ result = await preflight({ cwd });
246
+ } catch (e) {
247
+ result = { ok: false, line: formatLine(false, `preflight crashed (${firstLine(e && e.message)})`) };
248
+ }
249
+ process.stdout.write(result.line + '\n');
250
+ process.exitCode = result.ok ? 0 : 1;
251
+ }
252
+
253
+ if (require.main === module) main();
254
+
255
+ module.exports = { preflight };
@@ -141,17 +141,15 @@ three failure modes have different fixes:
141
141
  | `gate`, `files` | **REQUIRED.** Rules below. The tool refuses a call without them. |
142
142
  | `estimateMinutes` | Omit (a persona's `defaultEstimateMinutes` applies). Pass one only for a run needing more than the 45-minute floor. |
143
143
  | `sourcePromptId` | Always `<epic-id>`. Never rely on the server's fallback. |
144
- | `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. |
144
+ | `cwd` | The Epic's project root; see PRD_AUTHORING.md §5. |
145
145
  | `dependsOn` | Slugs that must finish first. The only ordering tool. |
146
146
  | `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. |
147
147
  | `slug` | Optional kebab-case without an `NN-` prefix. The API picks the number. |
148
148
  | `tag`, `agentType` | Omit (`dev-lead` default), except on the validate PRD. |
149
149
  | `quietMachine` | Only for timing measurements. |
150
150
 
151
- Never pass `parallelGroup`; it is ignored. The API writes the frontmatter, the `# Files` and
152
- `# Gate` sections and the standards pointer. Do not write them yourself. Do not put a gate
153
- fence (three backticks + `gate`), a `# Gate` heading or a `# Files` heading in any text field —
154
- the API rejects that.
151
+ Never pass `parallelGroup`; it is ignored. The API writes the frontmatter, `# Files` and
152
+ `# Gate` (PRD_AUTHORING.md §6, What the API writes).
155
153
 
156
154
  ### gate and files rules
157
155
 
@@ -165,9 +163,7 @@ can apply, because they depend on the repo at authoring time:
165
163
  on the base parks the job as `sentinel_fail` whatever the executor does.
166
164
  2. Never put a step only a human or the passage of time can complete (host cron install,
167
165
  waiting for a live post, a live payment, an account dashboard action) in a gate or
168
- criterion; keep them out of PRDs at authoring time. An executor that meets one ends
169
- `SCHEDULER_VERDICT: FAIL` naming what is missing. Why: no executor can pass such a gate,
170
- and queued work runs with no questions asked.
166
+ criterion; keep them out of PRDs at authoring time (PRD_AUTHORING.md §14, No human-only gates).
171
167
  Live-run steps that need gitignored state follow PRD_AUTHORING.md §7 (absolute main-checkout
172
168
  paths, artifact-only).
173
169
 
@@ -197,16 +193,23 @@ End every plan with exactly one validate PRD:
197
193
  4. Criteria: one per PRD, citing it by slug
198
194
  (under `$SM_PROJECT_ROOT/session-manager-operations/scheduler/epics/<epic-id>/`; find it by
199
195
  slug under prds/ or prds-archived/, possibly a timestamped subfolder. Why: runtime namespaces such as `session-manager-operations/scheduler/` carry their own `.gitignore`
200
- (runtime-ops-namespaces-self-ignore), so they are never in the validator's job worktree. The last: write and commit
201
- `session-manager-operations/reviews/validation/<epic-id>/<validate-slug>.md`, relative to the repository root
202
- (`git rev-parse --show-toplevel`), not to any subdirectory you `cd`'d into to run a gate.
196
+ (runtime-ops-namespaces-self-ignore), so they are never in the validator's job worktree. The last: write
197
+ `session-manager-operations/plan-records/<epic-id>/<validate-slug>.md`, relative to the repository root
198
+ (`git rev-parse --show-toplevel`), not to any subdirectory you `cd`'d into to run a gate. Never
199
+ commit it; the scheduler copies it to the main checkout.
203
200
  5. Notes: "Work as the validator persona — the procedure is your system prompt." and a line
204
201
  `Base: <sha>`, the SHA from step 11.
205
- 6. `gate: ["none"]`; `files`: the record path. Why: the validator re-runs each PRD's gate
202
+ 6. `gate: ["none"]`; `files`: the record path
203
+ `session-manager-operations/plan-records/<epic-id>/<validate-slug>.md`. It is never committed:
204
+ the API declares the PRD artifact-only. Why: the validator re-runs each PRD's gate
206
205
  itself, and a REFUTED PRD is still a successful validation.
207
206
 
208
- The validator prints `VALIDATION: <slug> VERIFIED` or `VALIDATION: <slug> REFUTED — <reason>`
209
- per PRD. Queue the validate PRD in the same `scheduler_create_prds` call as the plan (its `dependsOn` may name that call's entries); with single creates it goes last: in a single `scheduler_create_prd`, `dependsOn` accepts only slugs that already exist. The
207
+ A per-run record from any other PRD (ship, deploy, audit) also goes under
208
+ `session-manager-operations/plan-records/<epic-id>/`; never name a git-ignored ops path in `files` to get it force-added.
209
+
210
+ The validator returns a checked JSON verdict (`VERIFIED` or `REFUTED` with a reason, per PRD). The
211
+ scheduler saves it as `session-manager-operations/plan-records/<epic-id>/<validate-slug>.verdicts.json`, and
212
+ `GET /admin/epic` serves it as `verdicts`. Queue the validate PRD in the same `scheduler_create_prds` call as the plan (its `dependsOn` may name that call's entries); with single creates it goes last: in a single `scheduler_create_prd`, `dependsOn` accepts only slugs that already exist. The
210
213
  scheduler sends no per-PRD validation prompt. When the Epic has no pending or running PRD for
211
214
  `SM_EPIC_SETTLE_SECONDS` (default 120), it queues one `validate-sweep-*` validator for completed
212
215
  PRDs no validator checked (a large sweep becomes several sweeps in turn), then sends one PLAN SETTLED digest. Several validators in one Epic
@@ -221,8 +224,8 @@ here. Never write the record yourself.
221
224
  The scheduler heals most parks itself:
222
225
 
223
226
  1. Verdict-line parks (verdicts no_verdict_sentinel,
224
- abandoned_background_task) complete when the gate re-run is green, the landed commit is on
225
- HEAD and the tracked tree is clean.
227
+ abandoned_background_task) complete on their own once the conditions in PRD_AUTHORING.md
228
+ §13 hold.
226
229
  2. Stray-checkout parks (the main checkout was on another branch) are re-landed onto the base
227
230
  branch ref without touching the checkout.
228
231
  3. needs_review notices are held and grouped per Epic and cause. One notice is sent only when
@@ -252,16 +255,27 @@ Rules:
252
255
  safest reasonable choice, and report it. Why: queued work runs with no questions asked.
253
256
  2. **A PLAN SETTLED digest.** Read the validator records it names. A `REFUTED` PRD, or a
254
257
  Critical or Important finding, means a fix wave: one `behavior` or `wire` PRD per finding
255
- plus a new validate PRD. Never fix inline. A Not validated list means validate exactly
256
- those PRDs here. All `VERIFIED` with nothing open means Done: write the final report.
257
- 4. **Done** = the latest validator marked every PRD `VERIFIED`, no Critical or Important
258
- finding is open, and its record is committed. Never "done with caveats": a REFUTED PRD gets
259
- a fix wave or an explicit human decision to stop.
258
+ plus a new validate PRD. Never fix inline. Every fix PRD sets `fixes: [{ prd, missKind, reason }]`,
259
+ one entry per PRD it repairs, including a PRD a validator `VERIFIED` whose bug was found later
260
+ (an escape). Why: escapes are counted from `fixes`. The new validate PRD has one criterion per fix
261
+ PRD and one per PRD the earlier validator marked `REFUTED`, each cited by slug. Why: a
262
+ refuted PRD keeps its Epic blocked until a validator verifies that same PRD. A PRD marked
263
+ `REFUTED` again after its fix wave, on the same criterion, gets no third fix wave: list it
264
+ as open in the final report with the validator's reason and what was tried, for the human
265
+ to decide. Why: a second miss on the same criterion means the plan is wrong, and another
266
+ wave would repeat it. A Not validated list means validate exactly those PRDs here. All
267
+ `VERIFIED` with nothing open means Done: write the final report.
268
+ 4. **Done** = the latest validator marked every PRD `VERIFIED`, including each PRD an earlier
269
+ validator refuted, no Critical or Important finding is open, and its record exists in the main checkout's
270
+ `session-manager-operations/plan-records/<epic-id>/`.
271
+ Never "done with caveats": a REFUTED PRD gets a fix wave, or after its second refutation an
272
+ open entry in the final report for the human to decide.
260
273
 
261
274
  ### Final report
262
275
 
263
276
  1. What landed: each PRD slug and its commit.
264
- 2. The validation record path.
277
+ 2. The validation record path; the record exists in the main checkout's
278
+ `session-manager-operations/plan-records/<epic-id>/`.
265
279
  3. Minor findings deferred.
266
280
  4. Anything still open.
267
281
  5. Any warning kept or validator skipped.