claude-code-session-manager 0.142.0 → 0.143.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 (95) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +20 -107
  3. package/dist/assets/{AppSettings-BcZgIvvY.js → AppSettings-BO4jDVGO.js} +1 -1
  4. package/dist/assets/{History-DpZuJXi1.js → History-DTttbvPb.js} +1 -1
  5. package/dist/assets/{HomeClaudeConfig-D32ZJtU-.js → HomeClaudeConfig-DADP5bfn.js} +2 -2
  6. package/dist/assets/{Panel-BjdJjhqt.js → Panel-B_D4Bg7L.js} +1 -1
  7. package/dist/assets/{ProjectClaudeConfig-BTClYV6i.js → ProjectClaudeConfig-DPnDJKcr.js} +1 -1
  8. package/dist/assets/{Scheduler-DPobKx1Z.js → Scheduler-CNLjn90m.js} +8 -8
  9. package/dist/assets/{SkillReferenceGraph-Cqyu4mef.js → SkillReferenceGraph-D1b2aiol.js} +1 -1
  10. package/dist/assets/{Skills-vv0noNVI.js → Skills-cfV7sgk6.js} +1 -1
  11. package/dist/assets/{TiptapBody-CXi8Pvut.js → TiptapBody-DVXtEIVy.js} +1 -1
  12. package/dist/assets/{Toggle-CiYCWLjh.js → Toggle-CYajnSdx.js} +1 -1
  13. package/dist/assets/{VoiceButton-4NKKd1sC.js → VoiceButton-DJ4gGRuE.js} +1 -1
  14. package/dist/assets/{historyTotals-DDunb8Ch.js → historyTotals-D3MoHY2U.js} +1 -1
  15. package/dist/assets/{index-Cn5E9958.js → index-CdTppjKR.js} +436 -436
  16. package/dist/index.html +1 -1
  17. package/dist-web/app.js +356 -356
  18. package/package.json +3 -3
  19. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  20. package/plugins/session-manager-dev/skills/builder/SKILL.md +5 -0
  21. package/plugins/session-manager-dev/skills/develop/SKILL.md +9 -3
  22. package/scripts/README.md +1 -0
  23. package/scripts/scheduler-mcp-server.cjs +304 -6
  24. package/src/main/adminRouteRegistry.cjs +10 -0
  25. package/src/main/build-info.json +4 -4
  26. package/src/main/chatRunner.cjs +105 -7
  27. package/src/main/config.cjs +5 -1
  28. package/src/main/health.cjs +38 -2
  29. package/src/main/index.cjs +12 -4
  30. package/src/main/ipcSchemas.cjs +11 -0
  31. package/src/main/lib/demo-video-kit/cast.md +10 -1
  32. package/src/main/lib/demo-video-kit/character.cjs +77 -21
  33. package/src/main/lib/demo-video-kit/kind-tiktok.md +5 -1
  34. package/src/main/lib/demo-video-kit/projectSounds.cjs +191 -0
  35. package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
  36. package/src/main/lib/demo-video-kit/sound.cjs +166 -9
  37. package/src/main/lib/demo-video-kit/standalone.cjs +231 -0
  38. package/src/main/lib/epic/activeIndexMerge.cjs +5 -0
  39. package/src/main/lib/epic/artifactRetention.cjs +55 -9
  40. package/src/main/lib/epic/artifactStore.cjs +78 -35
  41. package/src/main/lib/epic/delegationReadiness.cjs +10 -3
  42. package/src/main/lib/epic/epicEventLog.cjs +45 -1
  43. package/src/main/lib/epic/epicStateEmitter.cjs +248 -0
  44. package/src/main/lib/epic/epicValidationHook.cjs +13 -2
  45. package/src/main/lib/externalContract.cjs +12 -1
  46. package/src/main/lib/feedback-remote/autoStartedSession.cjs +1 -1
  47. package/src/main/lib/feedback-remote/crossProjectReply.cjs +96 -8
  48. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +30 -0
  49. package/src/main/lib/feedback-remote/pendingReplies.cjs +18 -0
  50. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +94 -4
  51. package/src/main/lib/feedback-remote/replyClaims.cjs +159 -0
  52. package/src/main/lib/git/gitWorktree.cjs +8 -0
  53. package/src/main/lib/git/runtimeStateUntrack.cjs +15 -1
  54. package/src/main/lib/git/worktreeDeps.cjs +113 -10
  55. package/src/main/lib/mcpToolCatalog.cjs +102 -8
  56. package/src/main/lib/opsOwnership.cjs +113 -28
  57. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +46 -0
  58. package/src/main/lib/prd/prdCreate.cjs +350 -227
  59. package/src/main/lib/prd/prdCriteria.cjs +7 -4
  60. package/src/main/lib/project-pages/videoPressLines.cjs +145 -0
  61. package/src/main/lib/project-pages/videoScriptPress.cjs +260 -0
  62. package/src/main/lib/project-pages/videoScriptRunRoute.cjs +351 -0
  63. package/src/main/lib/project-pages/videoScriptSwitchIpc.cjs +49 -0
  64. package/src/main/lib/project-pages/videoScriptSwitchRoute.cjs +173 -0
  65. package/src/main/lib/scheduler/criteriaChecks.cjs +164 -20
  66. package/src/main/lib/scheduler/heldSchedulerTurns.cjs +238 -0
  67. package/src/main/lib/scheduler/jobMemoryStats.cjs +13 -2
  68. package/src/main/lib/scheduler/planRecordHarvest.cjs +120 -52
  69. package/src/main/lib/scheduler/prdOutcomeRecord.cjs +60 -2
  70. package/src/main/lib/scheduler/queueStore.cjs +16 -0
  71. package/src/main/lib/scheduler/rcaReport.cjs +79 -15
  72. package/src/main/lib/scheduler/scheduleJobSchema.cjs +13 -0
  73. package/src/main/lib/scheduler/schedulerPaths.cjs +9 -0
  74. package/src/main/lib/scheduler/slotsRoute.cjs +101 -87
  75. package/src/main/lib/scheduler/usageHoldRoute.cjs +97 -0
  76. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +16 -5
  77. package/src/main/lib/tasks/memoryConsolidation.cjs +14 -2
  78. package/src/main/lib/tasks/mitigationReview.cjs +21 -1
  79. package/src/main/lib/tasks/taskAdminRoutes.cjs +78 -3
  80. package/src/main/lib/tasks/taskLedger.cjs +2 -2
  81. package/src/main/lib/telemetry/auditEvents.cjs +21 -24
  82. package/src/main/lib/telemetry/auditLog.cjs +6 -2
  83. package/src/main/lib/util/atomicFs.cjs +2 -2
  84. package/src/main/promptSessionEvents.cjs +16 -1
  85. package/src/main/pty.cjs +11 -2
  86. package/src/main/queueOps.cjs +1 -1
  87. package/src/main/runVerify.cjs +1 -1
  88. package/src/main/scheduler/utilizationHold.cjs +96 -6
  89. package/src/main/scheduler.cjs +533 -39
  90. package/src/main/templates/PRD_AUTHORING.md +7 -2
  91. package/src/preload/api.d.ts +47 -1
  92. package/src/preload/apiSurface.json +14 -0
  93. package/src/preload/index.cjs +2 -0
  94. package/src/seed/agents/demo-video-builder.md +15 -8
  95. package/src/seed/agents/validator.md +20 -19
@@ -21,6 +21,7 @@
21
21
 
22
22
  const { z } = require('zod');
23
23
  const { MISS_KINDS } = require('./scheduler/validatorVerdictSchema.cjs');
24
+ const { KINDS: ARTIFACT_KINDS } = require('./epic/artifactStore.cjs');
24
25
 
25
26
  const CatalogEntrySchema = z.object({
26
27
  name: z.string().min(1),
@@ -264,6 +265,22 @@ const MCP_TOOL_CATALOG = [
264
265
  exampleArgs: { slug: 'add-mcp-tool-catalog' },
265
266
  notes: null,
266
267
  },
268
+ {
269
+ name: 'scheduler_dismiss_cancelled',
270
+ group: 'scheduler',
271
+ purpose: "THE ONLY SUPPORTED WAY to dismiss a cancelled scheduler row via the session-manager app's admin API "
272
+ + '(POST /admin/scheduler/dismiss-cancelled). Removes the cancelled row from the live queue and files its PRD '
273
+ + 'under prds-cancelled/, which never satisfies a dependsOn (scheduler_archive_prd refuses cancelled rows, '
274
+ + 'because prds-archived/ does satisfy one). Refuses a row with no cancel marker. If the row has pending '
275
+ + 'dependents the dismiss is refused and lists them; call again with dependents: { action: "cascade" } '
276
+ + '(cancel them too), { action: "repoint", to: "<slug>" } (depend on another PRD instead) or '
277
+ + '{ action: "clear" } (drop the dependency).',
278
+ summary: 'Clear a cancelled job out of the queue.',
279
+ whenToUse: 'Use when a cancelled job still shows in the queue and scheduler_archive_prd refused it as cancelled.',
280
+ whenNotToUse: 'Do not use on a real failure that should run again (use scheduler_reset_job) or on finished work (use scheduler_archive_prd).',
281
+ exampleArgs: { slug: 'add-mcp-tool-catalog' },
282
+ notes: null,
283
+ },
267
284
  {
268
285
  name: 'scheduler_retag_prd',
269
286
  group: 'scheduler',
@@ -371,7 +388,18 @@ const MCP_TOOL_CATALOG = [
371
388
  + 'deliverWhen { appVersionAbove }: hold this reply until Session Manager runs a version above '
372
389
  + 'appVersionAbove (give the version running now); it then sends itself, even after this Epic closes; '
373
390
  + '`{version}` in the message becomes that version. A held reply returns delivery "scheduled" and '
374
- + 'counts toward the 3-reply cap at once.',
391
+ + 'counts toward the 3-reply cap at once. deliverWhen needs Session Manager v0.142.0 or later running; '
392
+ + 'an older app is refused before the call. '
393
+ + 'release { commits } (Session Manager repo only; 7-40 hex hashes of the work that shipped) makes a '
394
+ + 'Session Manager release claim checkable. Live (no deliverWhen): the running app must report a version, '
395
+ + 'tag v<running version> must contain every commit, and the message may name no other Session Manager '
396
+ + 'version, else it is refused; `{version}` is then filled with the running version. Held (with deliverWhen): '
397
+ + 'it is sent only once the running release tag contains every commit (it waits, no attempt spent), and it '
398
+ + 'needs an app newer than v0.142.0 running — 0.142.0 or older holds by version only, so the call is refused; '
399
+ + 'send it live with release.commits once that release runs. A message with an unfilled placeholder '
400
+ + '(`{{appVersion}}`, `<semver>`, `${release}`, ...) is refused; `{version}` is allowed only with deliverWhen '
401
+ + 'or release. A done reply that names a Session Manager version must carry release.commits (or it is '
402
+ + 'refused): write `{version}`, never hand-type a version.',
375
403
  },
376
404
  {
377
405
  name: 'project_home_write',
@@ -511,12 +539,18 @@ const MCP_TOOL_CATALOG = [
511
539
  + 'its approval, is refused by name) and an optional `personality` {who, speech, readingLevel, neverSay[]}; the look lives in character.js. '
512
540
  + 'An optional `cast` lists up to 8 supporting characters, each {name, voice?, note?}: names are unique and different from the host\'s, a voice uses '
513
541
  + 'the same two engines or a {voiceId} reference, and a member without a voice never speaks. '
542
+ + 'An optional `sounds` block declares the persona\'s own sound effects (`sfx`: [{name, note?}], up to 16) and music beds (`beds`: [{name, note?, command?}], up to 8): '
543
+ + 'lowercase names, unique, never a built-in sound or style. Every effect, and every bed without a `command`, is a WAV you pass in `soundPaths` '
544
+ + '({name: absolute .wav path}; an effect <= 1 MiB, a bed <= 12 MiB, 32 MiB in all), saved as videos/_character/sounds/<name>.wav; a bed `command` '
545
+ + 'is an argv with {lengthS} and {out} placeholders (optional {name} and {seed}) that renders the bed at mix time, run with no shell in the project root. '
546
+ + 'A cast member\'s optional `sfx` lists its signature sounds (built-in or the persona\'s own); a member without a voice is heard only through them. '
514
547
  + 'A saved persona hosts every Demo Video unless a press turns Character off. Each narration line is spoken in its own speaker\'s voice (the host\'s '
515
548
  + 'when the line names no speaker) with no fallback voice: a failing command (non-zero exit or no WAV written) fails the run. '
516
549
  + 'The exact field rules are validateCharacterJson in demo-video-kit/character.cjs.',
517
550
  summary: "Save the reusable character used in this project's videos.",
518
551
  whenToUse: 'Use once per project, before building character videos, to save the mascot you designed. Pass `json` (the descriptor object or its JSON text) '
519
- + 'and the module as `js` or — preferred for large modules — an absolute `jsPath` to a local .js file. Pass `replace: true` only to deliberately overwrite an existing character.',
552
+ + 'and the module as `js` or — preferred for large modules — an absolute `jsPath` to a local .js file. When the json declares file-backed sounds, pass their WAVs in `soundPaths`. '
553
+ + 'Pass `replace: true` only to deliberately overwrite an existing character.',
520
554
  whenNotToUse: 'Never fabricate content. Do not use to write a video — use project_video_write. The call is rejected (409) when a character already exists and `replace` is not set, '
521
555
  + 'and for invalid `json`, `js` over 300KB, or `js` with remote references or network-capable APIs.',
522
556
  exampleArgs: {
@@ -533,7 +567,8 @@ const MCP_TOOL_CATALOG = [
533
567
  },
534
568
  notes: "cwd is optional — defaults to the calling session's own project root (SM_PROJECT_ROOT or process.cwd()) when omitted. "
535
569
  + 'Give exactly one of `js` / `jsPath` (absolute .js file, <= 300KB). The saved character.json must fit in 16 KB. '
536
- + 'An existing character — even an unusable one — is refused (409) unless `replace: true` is set.',
570
+ + 'An existing character — even an unusable one — is refused (409) unless `replace: true` is set. '
571
+ + 'Every call that declares file-backed sounds sends all their WAVs in `soundPaths`; a replace drops WAVs no longer declared.',
537
572
  },
538
573
  {
539
574
  name: 'project_video_review_write',
@@ -961,6 +996,27 @@ const MCP_TOOL_CATALOG = [
961
996
  + 'human_request_unverified / quote_does_not_name_switch / quote_does_not_name_project, 409 '
962
997
  + 'request_older_than_switch) carries error and reason; show the reason to the human.',
963
998
  },
999
+ {
1000
+ name: 'video_script_switch_set',
1001
+ group: 'project-home',
1002
+ purpose: "Turn one project's 'Scripts may run Demo Video' switch on or off via the session-manager app's admin API "
1003
+ + '(POST /admin/project-home/videos/script-switch), on behalf of the human in this chat. Runs only in a Session '
1004
+ + 'Manager chat or terminal session; a scheduled job, a Task or any other internal headless run is refused before '
1005
+ + 'any request. The caller identity is taken from this session, never from arguments. `cwd` is optional and '
1006
+ + "defaults to this session's project.",
1007
+ summary: 'Turn Scripts may run Demo Video on or off when the human asks.',
1008
+ whenToUse: 'Use only when the human asked in this chat to turn the switch on or off, and pass their words '
1009
+ + 'verbatim as `humanRequestQuote` — the route checks the quote against this session\'s transcript and '
1010
+ + 'that it names the switch and the project.',
1011
+ whenNotToUse: 'Never on your own initiative, never from a job or script, and never to get past a 403 '
1012
+ + "scripts_not_allowed without the human's words. Do not use it to press Demo Video — a script does that with "
1013
+ + 'POST /admin/project-home/videos/run (recipe script-press-demo-video).',
1014
+ exampleArgs: { enabled: true, humanRequestQuote: "turn on 'Scripts may run Demo Video' for burrow" },
1015
+ notes: 'One instruction allows one change: do not reuse a quote to flip the switch again. Returns '
1016
+ + '{ ok: true, cwd, enabled, changedAt, by, previous }. A refusal (400 invalid_request, 403 '
1017
+ + 'human_request_unverified / quote_does_not_name_switch / quote_does_not_name_project, 409 '
1018
+ + 'request_older_than_switch) carries error and reason; show the reason to the human.',
1019
+ },
964
1020
  {
965
1021
  name: 'scheduler_slots_get',
966
1022
  group: 'scheduler',
@@ -974,6 +1030,23 @@ const MCP_TOOL_CATALOG = [
974
1030
  exampleArgs: {},
975
1031
  notes: 'Read-only. Returns { ok: true, cap, min, max, inUse, available }.',
976
1032
  },
1033
+ {
1034
+ name: 'usage_hold_get',
1035
+ group: 'scheduler',
1036
+ purpose: "Read the usage hold Session Manager is applying right now to automatic claude -p work ('pause above') "
1037
+ + "via the session-manager app's admin API (GET /admin/usage-hold): whether automatic runs are held, why, "
1038
+ + 'and until when, plus the saved pause-above threshold.',
1039
+ summary: 'See if automatic runs are on hold.',
1040
+ whenToUse: 'Use before starting or asking for automatic claude -p work (a Task, a queued PRD), or to explain '
1041
+ + 'why scheduled jobs or Tasks are not starting.',
1042
+ whenNotToUse: 'Do not use it to change the threshold or lift the hold — this tool only reads. Not needed '
1043
+ + 'before replying in a human chat.',
1044
+ exampleArgs: {},
1045
+ notes: 'Read-only, no arguments. Returns the route\'s answer unchanged: { ok: true, hold, threshold }. hold null = '
1046
+ + 'no hold; otherwise { reason, window, percent, threshold, resetsAt, detail }, with resetsAt the time the hold '
1047
+ + 'ends. The hold applies to every automatic claude -p start (scheduler ticks and Tasks), not to human chats. '
1048
+ + 'A failed read (503 usage_hold_error) comes back as an error.',
1049
+ },
977
1050
  {
978
1051
  name: 'scheduler_slots_set',
979
1052
  group: 'scheduler',
@@ -983,12 +1056,17 @@ const MCP_TOOL_CATALOG = [
983
1056
  + 'is taken from this session, never from arguments, and a scheduled job is refused.',
984
1057
  summary: 'Raise or lower the session limit when the human asks.',
985
1058
  whenToUse: "Use only when the human asked in this session for a new limit. It needs the human's own words "
986
- + 'naming the limit and the number, quoted verbatim from this session, as `quote` — e.g. "raise the limit to '
987
- + '14 parallel sessions" — and `cap` set to that number. The route checks the quote against what the human '
988
- + 'typed in this session.',
1059
+ + 'naming the limit and the number, quoted verbatim from this session, as `quote`, and `cap` set to that '
1060
+ + 'number. One sentence of the quote must be exactly this form: [please|ok|okay|so|now|then] '
1061
+ + 'set|raise|increase|bump|lower|reduce|change [the|our] [session|slot|parallel] limit|cap|slots to '
1062
+ + '<number in digits> [sessions|slots] — nothing else in the sentence, a comma only right after the '
1063
+ + 'lead-in word, no question mark; e.g. "raise the limit to 14". The whole sentence the human typed '
1064
+ + 'around the quote must be that form too, so "don\'t raise the limit to 14" or "raise the limit to 14?" '
1065
+ + 'is refused. Anything else is refused. The route checks the quote against what the human typed in this session; '
1066
+ + 'if the human said it another way, ask them to say it in that form.',
989
1067
  whenNotToUse: 'Never on your own initiative, never from a job or script, and never with words you wrote or '
990
1068
  + 'paraphrased. Do not use it just to read the limit — use scheduler_slots_get.',
991
- exampleArgs: { cap: 14, quote: 'raise the limit to 14 parallel sessions' },
1069
+ exampleArgs: { cap: 14, quote: 'raise the limit to 14' },
992
1070
  notes: 'One instruction allows one change. Returns { ok: true, from, to }. A refusal (400 invalid_request — '
993
1071
  + 'cap outside [min, max]; 403 called_from_headless_job / human_request_unverified / '
994
1072
  + 'quote_does_not_name_slots) carries error and reason; show the reason to the human.',
@@ -1024,7 +1102,8 @@ const MCP_TOOL_CATALOG = [
1024
1102
  summary: 'Publish a file for review.',
1025
1103
  whenToUse: 'Call it for every file a human should review: renders, audio takes, reports, contact sheets, screenshots, exports. '
1026
1104
  + 'Publish each file the moment it is done, then name the returned storedPath in your reply. `path` is absolute, or relative '
1027
- + 'to your Epic worktree; `title` is the human label; `kind` is an optional file kind hint.',
1105
+ + 'to your Epic worktree; `title` is the human label; `kind` is optional, one of ' + ARTIFACT_KINDS.join(', ')
1106
+ + ' (a report is doc), and is inferred from the file extension when omitted.',
1028
1107
  whenNotToUse: 'Do not use for scratch or intermediate files nobody needs to see, for Project Home pages or videos (use '
1029
1108
  + 'project_page_write / project_video_write), or to move source code — commit that instead. Refused inside a scheduled job '
1030
1109
  + 'with no Epic session: a job writes to SM_ARTIFACTS_DIR and is harvested for you.',
@@ -1101,6 +1180,21 @@ const MCP_RECIPES = [
1101
1180
  'A repoPaths run must land a commit under those paths (the saved video entry itself is never committed); without repoPaths the run is artifact-only. Only the human approves, asks for changes or retries — in Project Home ▸ Video; no tool can.',
1102
1181
  ],
1103
1182
  },
1183
+ {
1184
+ id: 'script-press-demo-video',
1185
+ title: "Let a project's own script press Demo Video and read the outcome",
1186
+ steps: [
1187
+ "A human turns on 'Scripts may run Demo Video' for the project — in Project Home > Video, or by asking in a chat session, where the agent calls video_script_switch_set with their words verbatim as humanRequestQuote. No script, job or Task can turn it on; while it is off the run route answers 403 scripts_not_allowed.",
1188
+ 'The script POSTs /admin/project-home/videos/run with the port and token from ~/.claude/session-manager/admin-api.json, e.g. for a blog post (target = the post URL, externalRef = the post slug): '
1189
+ + 'curl -s -X POST "http://127.0.0.1:$(jq -r .port ~/.claude/session-manager/admin-api.json)/admin/project-home/videos/run" '
1190
+ + '-H "Authorization: Bearer $(jq -r .token ~/.claude/session-manager/admin-api.json)" -H \'Content-Type: application/json\' '
1191
+ + '-d \'{"cwd":"/abs/project","kind":"Blog post","target":"https://example.com/blog/hello","externalRef":"hello"}\'. '
1192
+ + 'Optional keys: length, style, character, voiceId, focus, reviewFirst. Success is { ok, entryId, epicId, slug, stage }; the same externalRef again answers { ok, existing: true, entryId, epicId } instead of a second run.',
1193
+ 'Read the outcome with GET /admin/project-home/videos/status?cwd=<encoded>&id=<entryId> (same bearer token): state is queued, running, awaiting_review, saved (files.index/meta/mp4/poster, absolute paths), season-complete or failed (reason).',
1194
+ '409 already_building means a Demo Video job for this project is already pending or running — retry later; never loop tightly.',
1195
+ 'With Review first (reviewFirst: true) the run stops at awaiting_review: only the human approves or asks for changes in Project Home > Video, then the final video builds. A script just keeps reading the status.',
1196
+ ],
1197
+ },
1104
1198
  ];
1105
1199
 
1106
1200
  for (const entry of MCP_TOOL_CATALOG) {
@@ -112,16 +112,49 @@ const OWNERS = Object.freeze({
112
112
  });
113
113
 
114
114
  /**
115
- * Machine-local RUNTIME namespaces: regenerable/ephemeral state that must never
116
- * be committed. Mirrors this repo's root .gitignore. Everything else in OWNERS
117
- * (reviews, architecture, project-brief, project-pages, ...) is authored.
118
- * `feedback` has no OWNERS entry (nothing writes it through the gate) but is
119
- * runtime state all the same, so it lives only in this set.
115
+ * namespace -> its git class, one entry per namespace Session Manager defines.
116
+ * - 'runtime': machine-local state, never committed. Each dir self-ignores
117
+ * with its own `*` .gitignore (ensureRuntimeIgnores).
118
+ * - 'tracked': the project's own authored output (Project Home pages and
119
+ * videos, the Brief, docs), committed like docs. Session Manager never
120
+ * writes an ignore file there; a project that wants it out of git adds its
121
+ * own rule.
122
+ * A folder not listed here (feedback/, retired 2026-08-02, or any folder a
123
+ * project made itself) belongs to the project: a project's feedback/ is its
124
+ * own folder, and Session Manager never writes, ignores, bans from commits or
125
+ * untracks it.
120
126
  */
121
- const RUNTIME_NAMESPACES = Object.freeze([
122
- 'scheduler', 'prompt-sessions', 'feedback', 'logs', 'ui-prefs', 'memory-clusters', 'tasks',
123
- 'plan-records', 'events', 'agents', 'webhooks', 'feedback-inbox', 'artifacts',
124
- ]);
127
+ const GIT_CLASS = Object.freeze({
128
+ scheduler: 'runtime',
129
+ 'prompt-sessions': 'runtime',
130
+ logs: 'runtime',
131
+ 'ui-prefs': 'runtime',
132
+ 'memory-clusters': 'runtime',
133
+ tasks: 'runtime',
134
+ 'plan-records': 'runtime',
135
+ events: 'runtime',
136
+ agents: 'runtime',
137
+ webhooks: 'runtime',
138
+ 'feedback-inbox': 'runtime',
139
+ artifacts: 'runtime',
140
+ 'project-brief': 'tracked',
141
+ 'project-pages': 'tracked',
142
+ architecture: 'tracked',
143
+ 'design-mocks': 'tracked',
144
+ HUMAN_LEARN: 'tracked',
145
+ manual: 'tracked',
146
+ reviews: 'tracked',
147
+ });
148
+
149
+ /**
150
+ * Machine-local RUNTIME namespaces, derived from GIT_CLASS. Every consumer
151
+ * (self-ignore sweep, worktree carry, finish-protocol commit ban, health,
152
+ * runtime-state untrack) reads this list. This repo's root .gitignore lists
153
+ * each one too (plus its own retired feedback/ folder, which is not runtime).
154
+ */
155
+ const RUNTIME_NAMESPACES = Object.freeze(
156
+ Object.keys(GIT_CLASS).filter((ns) => GIT_CLASS[ns] === 'runtime'),
157
+ );
125
158
 
126
159
  /** Writer id for the per-namespace self-ignore file. */
127
160
  const RUNTIME_IGNORE_WRITER = 'runtime-ignore';
@@ -133,9 +166,10 @@ const RUNTIME_IGNORE_WRITER = 'runtime-ignore';
133
166
  * code review, not discovered later in a race.
134
167
  */
135
168
  const DELEGATIONS_BASE = {
136
- // Each runtime namespace carries its own `.gitignore` (content `*`) so the
137
- // project's root .gitignore needs no edit. Only that one file, only
138
- // ensureRuntimeIgnores writes it.
169
+ // Each runtime namespace (GIT_CLASS 'runtime', all owned) carries its own
170
+ // `.gitignore` (content `*`) so the project's root .gitignore needs no edit.
171
+ // Only that one file, only ensureRuntimeIgnores writes it. Tracked and
172
+ // project-owned folders get no delegation.
139
173
  ...Object.fromEntries(RUNTIME_NAMESPACES.map((ns) => [ns, []])),
140
174
  'prompt-sessions': Object.freeze([
141
175
  Object.freeze({
@@ -211,6 +245,8 @@ function checkOpsWrite(absPath, writer) {
211
245
 
212
246
  const owner = OWNERS[namespace];
213
247
  if (!owner) {
248
+ // Fail closed: an owner-less folder (a project's own feedback/, say) is
249
+ // the project's, never Session Manager's — no writer, no delegation.
214
250
  return {
215
251
  ok: false,
216
252
  error:
@@ -371,34 +407,83 @@ function opsPath(cwd, ...segments) {
371
407
  }
372
408
 
373
409
  /**
374
- * ensureRuntimeIgnores(projectRoot) → string[] of `.gitignore` paths written.
375
- * For each runtime namespace dir that already exists under the project's ops
376
- * root and has no `.gitignore`, write one containing `*` (which also ignores
377
- * itself). Never creates a namespace dir, never runs git. Idempotent.
410
+ * ensureRuntimeIgnore(projectRoot, ns) → the `.gitignore` path written, or null.
411
+ * When `<projectRoot>/session-manager-operations/<ns>/` is a directory with no
412
+ * `.gitignore` file, write one containing `*` (which also ignores itself).
413
+ * Null when the file already exists or the namespace dir is absent. Throws on
414
+ * a non-runtime `ns`, an ownership refusal, or an IO error (including a
415
+ * non-file sitting at the `.gitignore` path). Never creates the namespace dir.
378
416
  * `projectRoot` must already be resolved (resolveProjectRoot/projectRootOf).
379
417
  */
380
- function ensureRuntimeIgnores(projectRoot) {
418
+ function ensureRuntimeIgnore(projectRoot, ns) {
419
+ if (!RUNTIME_NAMESPACES.includes(ns)) {
420
+ throw new Error(`'${ns}' is not a runtime namespace (RUNTIME_NAMESPACES in lib/opsOwnership.cjs)`);
421
+ }
422
+ const dir = path.join(projectRoot, OPS_ROOT_DIR, ns);
423
+ let isDir = false;
424
+ try { isDir = fs.statSync(dir).isDirectory(); } catch { /* absent */ }
425
+ if (!isDir) return null;
426
+ const file = path.join(dir, '.gitignore');
427
+ let st = null;
428
+ try { st = fs.statSync(file); } catch { /* absent */ }
429
+ if (st && st.isFile()) return null;
430
+ const verdict = checkOpsWrite(file, RUNTIME_IGNORE_WRITER);
431
+ if (!verdict.ok) throw new Error(verdict.error);
381
432
  const { writeTextAtomicSync } = require('./util/atomicFs.cjs');
382
- const opsRoot = path.join(projectRoot, OPS_ROOT_DIR);
433
+ writeTextAtomicSync(file, '*\n');
434
+ return file;
435
+ }
436
+
437
+ /**
438
+ * ensureRuntimeIgnoreForPath(absPath) → the `.gitignore` path written, or null.
439
+ * For a path inside a RUNTIME namespace of an ops root (innermost
440
+ * session-manager-operations segment, same rule as parseOpsPath), create the
441
+ * namespace dir if missing and self-ignore it. Null for a path outside any ops
442
+ * root, in an authored namespace, or that IS the namespace `.gitignore`.
443
+ * Throws on refusal or IO error.
444
+ */
445
+ function ensureRuntimeIgnoreForPath(absPath) {
446
+ if (!absPath || typeof absPath !== 'string') return null;
447
+ const resolved = path.resolve(absPath);
448
+ const segs = resolved.split(path.sep);
449
+ const idx = segs.lastIndexOf(OPS_ROOT_DIR);
450
+ if (idx === -1) return null;
451
+ const ns = segs[idx + 1];
452
+ if (!ns || !RUNTIME_NAMESPACES.includes(ns)) return null;
453
+ const rest = segs.slice(idx + 2).filter(Boolean);
454
+ if (rest.length === 1 && rest[0] === '.gitignore') return null;
455
+ const projectRoot = segs.slice(0, idx).join(path.sep) || path.sep;
456
+ fs.mkdirSync(path.join(projectRoot, OPS_ROOT_DIR, ns), { recursive: true });
457
+ return ensureRuntimeIgnore(projectRoot, ns);
458
+ }
459
+
460
+ /**
461
+ * ensureRuntimeIgnores(projectRoot) → string[] of `.gitignore` paths written.
462
+ * ensureRuntimeIgnore for every runtime namespace, each isolated: one
463
+ * namespace's failure never stops the others. After the loop, throws one
464
+ * Error naming every failed namespace and its reason. Idempotent.
465
+ */
466
+ function ensureRuntimeIgnores(projectRoot) {
383
467
  const written = [];
468
+ const failures = [];
384
469
  for (const ns of RUNTIME_NAMESPACES) {
385
- const dir = path.join(opsRoot, ns);
386
- let isDir = false;
387
- try { isDir = fs.statSync(dir).isDirectory(); } catch { /* absent */ }
388
- if (!isDir) continue;
389
- const file = path.join(dir, '.gitignore');
390
- if (fs.existsSync(file)) continue;
391
- const verdict = checkOpsWrite(file, RUNTIME_IGNORE_WRITER);
392
- if (!verdict.ok) throw new Error(verdict.error);
393
- writeTextAtomicSync(file, '*\n');
394
- written.push(file);
470
+ try {
471
+ const file = ensureRuntimeIgnore(projectRoot, ns);
472
+ if (file) written.push(file);
473
+ } catch (e) {
474
+ failures.push(`${ns}: ${(e && e.message) || String(e)}`);
475
+ }
395
476
  }
477
+ if (failures.length) throw new Error(`runtime self-ignore failed: ${failures.join('; ')}`);
396
478
  return written;
397
479
  }
398
480
 
399
481
  module.exports = {
482
+ GIT_CLASS,
400
483
  RUNTIME_NAMESPACES,
401
484
  RUNTIME_IGNORE_WRITER,
485
+ ensureRuntimeIgnore,
486
+ ensureRuntimeIgnoreForPath,
402
487
  ensureRuntimeIgnores,
403
488
  OPS_ROOT_DIR,
404
489
  OWNERS,
@@ -492,6 +492,28 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
492
492
  tools: "Read, Grep, Glob, Bash",
493
493
  },
494
494
  },
495
+ {
496
+ commit: "validator-persona-live-checks",
497
+ bodySha256: "c8d07138f40690af0ae8ce54bdb69c5377f99d016c345d19c1f9f54403ecffab",
498
+ fm: {
499
+ description: "Validates a finished PLAN (the PRDs its validate PRD lists) once, after its last PRD lands — re-runs each PRD's gate, checks every acceptance criterion against the real tree, reviews the plan's combined diff, and reports one VERIFIED/REFUTED verdict per PRD as checked JSON (the CLI enforces the schema). Runs headless as a scheduled PRD (agentType: validator); never edits product code and never queues work.",
500
+ executorOnly: "true",
501
+ model: "sonnet",
502
+ title: "Engineering — Plan Validator",
503
+ tools: "Read, Grep, Glob, Bash",
504
+ },
505
+ },
506
+ {
507
+ commit: "validator-persona-under-6000",
508
+ bodySha256: "596a7d674b2e71ee698f51cc98096909de3ddee1f17f0600e54891d1ac794266",
509
+ fm: {
510
+ description: "Validates a finished PLAN (the PRDs its validate PRD lists) once, after its last PRD lands — re-runs each PRD's gate, checks every acceptance criterion against the real tree, reviews the plan's combined diff, and reports one VERIFIED/REFUTED verdict per PRD as checked JSON (the CLI enforces the schema). Runs headless as a scheduled PRD (agentType: validator); never edits product code and never queues work.",
511
+ executorOnly: "true",
512
+ model: "sonnet",
513
+ title: "Engineering — Plan Validator",
514
+ tools: "Read, Grep, Glob, Bash",
515
+ },
516
+ },
495
517
  ],
496
518
  "demo-video-builder": [
497
519
  {
@@ -787,6 +809,30 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
787
809
  effort: "max",
788
810
  },
789
811
  },
812
+ {
813
+ commit: "seed-v24",
814
+ bodySha256: "0478a7018d9e6bc5b9b4820dd4942518ca997928da10c9ae8558ba40144cf99d",
815
+ fm: {
816
+ description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
817
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write, mcp__session-manager-scheduler__project_video_write, mcp__session-manager-scheduler__project_character_write, mcp__session-manager-scheduler__project_video_review_write, mcp__session-manager-scheduler__project_video_outcome_write",
818
+ mcpServers: "session-manager-scheduler",
819
+ title: "Project Home — Demo Video",
820
+ model: "opus",
821
+ effort: "max",
822
+ },
823
+ },
824
+ {
825
+ commit: "seed-v25",
826
+ bodySha256: "c43fa11636e42f7e4c973557b9052523508cb68109cc34fe78b5a70432bf8318",
827
+ fm: {
828
+ description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
829
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write, mcp__session-manager-scheduler__project_video_write, mcp__session-manager-scheduler__project_character_write, mcp__session-manager-scheduler__project_video_review_write, mcp__session-manager-scheduler__project_video_outcome_write",
830
+ mcpServers: "session-manager-scheduler",
831
+ title: "Project Home — Demo Video",
832
+ model: "opus",
833
+ effort: "max",
834
+ },
835
+ },
790
836
  ],
791
837
  "blender-artist": [
792
838
  {