claude-code-session-manager 0.127.0 → 0.129.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 (91) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +2 -0
  3. package/dist/assets/{AgentLibrary-DKQznr7o.js → AgentLibrary-Cp250YHF.js} +1 -1
  4. package/dist/assets/{Button-CZXqmIiM.js → Button-DU5UF-6L.js} +1 -1
  5. package/dist/assets/{DataModel-piyV33To.js → DataModel-CPf6f17e.js} +1 -1
  6. package/dist/assets/{History-BxwtrKF2.js → History-B2x-LMlT.js} +1 -1
  7. package/dist/assets/{Hooks-DogeSPII.js → Hooks-BWr33C4Q.js} +1 -1
  8. package/dist/assets/{Library-BDt6EeQQ.js → Library-DBNLTAa8.js} +1 -1
  9. package/dist/assets/{ListDetail-CwS-LKar.js → ListDetail-BGBw6egp.js} +1 -1
  10. package/dist/assets/{McpServers-D2HVljgS.js → McpServers-DywZ50Ec.js} +1 -1
  11. package/dist/assets/{Memory-hNzuOGn8.js → Memory-CnalwnFf.js} +1 -1
  12. package/dist/assets/{Panel-BLDrsUeq.js → Panel-BzIklgKf.js} +1 -1
  13. package/dist/assets/{Permissions-DzZ5vaJW.js → Permissions-mgRifwQc.js} +1 -1
  14. package/dist/assets/{Plugins-Cz9yaxzG.js → Plugins-CV42zfid.js} +2 -2
  15. package/dist/assets/{ProvenanceBadge-CCgLO4m9.js → ProvenanceBadge-DYmX4xgB.js} +1 -1
  16. package/dist/assets/{SaveBar-Shmn699J.js → SaveBar-DxrAfnlC.js} +1 -1
  17. package/dist/assets/{Scheduler-Bqr0WHNd.js → Scheduler-iyUl1NDl.js} +1 -1
  18. package/dist/assets/{ScopeSwitcher-CBx1fB5g.js → ScopeSwitcher-CC8BDPgf.js} +1 -1
  19. package/dist/assets/{Settings-Ci8in-yF.js → Settings-CWBnQghD.js} +1 -1
  20. package/dist/assets/{SkillReferenceGraph-BWwljba8.js → SkillReferenceGraph-DOhiCxuL.js} +1 -1
  21. package/dist/assets/{Skills-BON6o-c4.js → Skills-3Er-9YA9.js} +1 -1
  22. package/dist/assets/{SystemPrompt-D5epIYYs.js → SystemPrompt-BLxdvZ9K.js} +1 -1
  23. package/dist/assets/{TagLibrary-C2qDZROJ.js → TagLibrary-BZ6QHYMQ.js} +1 -1
  24. package/dist/assets/{TiptapBody-SZhI3-bW.js → TiptapBody-Du6jRBoW.js} +1 -1
  25. package/dist/assets/{Toggle-C_qFDG0g.js → Toggle-Qdi2Z7VD.js} +1 -1
  26. package/dist/assets/{ViewTabs-C9q5WCEd.js → ViewTabs-BKfFsziD.js} +1 -1
  27. package/dist/assets/{historyTotals-BCl7IOhY.js → historyTotals-8ecP_6wF.js} +1 -1
  28. package/dist/assets/{index-BnKaYERU.css → index-DtdWBGrI.css} +1 -1
  29. package/dist/assets/index-GI6F_j41.js +3083 -0
  30. package/dist/assets/{settingsSchema-BBrRBrBr.js → settingsSchema-lHTHAabD.js} +1 -1
  31. package/dist/assets/{skillFrontmatter-B01qJk6N.js → skillFrontmatter-8X1Uc282.js} +1 -1
  32. package/dist/assets/{useAgentsDirWatch-CuR3GSjS.js → useAgentsDirWatch-CcsoD1bp.js} +1 -1
  33. package/dist/index.html +2 -2
  34. package/dist-web/app.css +1 -1
  35. package/dist-web/app.js +373 -369
  36. package/package.json +1 -1
  37. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  38. package/plugins/session-manager-dev/skills/develop/SKILL.md +4 -2
  39. package/scripts/hooks/lib/guard-inline-implementation-policy.cjs +10 -0
  40. package/scripts/scheduler-mcp-server.cjs +170 -6
  41. package/src/main/build-info.json +4 -4
  42. package/src/main/chatRunner.cjs +8 -0
  43. package/src/main/index.cjs +27 -0
  44. package/src/main/ipcSchemas.cjs +110 -1
  45. package/src/main/lib/claude/agentModelResolve.cjs +31 -10
  46. package/src/main/lib/claude/effectiveModelInfo.cjs +14 -4
  47. package/src/main/lib/claude/modelCatalog.cjs +28 -1
  48. package/src/main/lib/claude/personaToolScope.cjs +40 -2
  49. package/src/main/lib/demo-video-kit/capture.cjs +113 -0
  50. package/src/main/lib/demo-video-kit/character.cjs +97 -0
  51. package/src/main/lib/demo-video-kit/checks.cjs +150 -0
  52. package/src/main/lib/demo-video-kit/frames.cjs +200 -0
  53. package/src/main/lib/demo-video-kit/seedKit.cjs +52 -0
  54. package/src/main/lib/demo-video-kit/sound.cjs +312 -0
  55. package/src/main/lib/epic/developLoopSpawn.cjs +18 -0
  56. package/src/main/lib/epic/epicMint.cjs +4 -2
  57. package/src/main/lib/epic/epicValidationHook.cjs +17 -1
  58. package/src/main/lib/epic/promptSessionsCreateEpic.cjs +4 -3
  59. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +21 -21
  60. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +185 -34
  61. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +15 -0
  62. package/src/main/lib/mcpToolCatalog.cjs +71 -11
  63. package/src/main/lib/opsOwnership.cjs +9 -5
  64. package/src/main/lib/persona-macro/builtinMacros.cjs +19 -5
  65. package/src/main/lib/persona-macro/macroJobDispatch.cjs +116 -0
  66. package/src/main/lib/persona-macro/macroJobIpc.cjs +50 -0
  67. package/src/main/lib/persona-macro/macroJobStatus.cjs +112 -0
  68. package/src/main/lib/persona-macro/macroLibrary.cjs +16 -0
  69. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +113 -0
  70. package/src/main/lib/prd/prdCreate.cjs +27 -1
  71. package/src/main/lib/prd/prdFrontmatter.cjs +7 -2
  72. package/src/main/lib/project-pages/pagesLibrary.cjs +171 -0
  73. package/src/main/lib/project-pages/playerBridge.cjs +129 -0
  74. package/src/main/lib/promptSessionSchema.cjs +8 -0
  75. package/src/main/lib/scheduler/scheduleJobSchema.cjs +2 -0
  76. package/src/main/lib/smfileHeaders.cjs +11 -3
  77. package/src/main/projectPages.cjs +107 -30
  78. package/src/main/promptSessionsIpc.cjs +131 -0
  79. package/src/main/scheduler/prdParser.cjs +2 -0
  80. package/src/main/scheduler.cjs +26 -9
  81. package/src/main/seedSchedulerMcp.cjs +10 -1
  82. package/src/main/transcripts.cjs +8 -0
  83. package/src/main/webRemote.cjs +3 -1
  84. package/src/preload/api.d.ts +107 -6
  85. package/src/preload/apiSurface.json +77 -0
  86. package/src/preload/index.cjs +18 -0
  87. package/src/seed/agents/architect.md +8 -8
  88. package/src/seed/agents/demo-video-builder.md +86 -36
  89. package/src/seed/agents/project-home-builder.md +26 -13
  90. package/dist/assets/index-CMIYLbPb.js +0 -3079
  91. package/src/main/lib/epic/epicStandingInstructions.cjs +0 -73
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * macroJobDispatch.cjs — turn a built-in macro press into ONE artifact-only
5
+ * scheduler PRD inside an existing Epic, so the build runs headless as the
6
+ * macro's persona under the scheduler's budget instead of a chat turn.
7
+ * Never mints an Epic (single-creator law): the caller supplies epicId.
8
+ *
9
+ * Plain Node, no Electron imports; all I/O is injected.
10
+ */
11
+
12
+ const path = require('node:path');
13
+ const { BUILTIN_MACROS } = require('./builtinMacros.cjs');
14
+ const { kebabCase } = require('../util/kebabCase.cjs');
15
+
16
+ const ACTIVE = new Set(['pending', 'held', 'running']);
17
+ const RETRYABLE = new Set(['needs_review', 'failed']);
18
+
19
+ function buildGate(absPath, nowMs) {
20
+ // No shell: everything with shell characters sits inside single quotes, so
21
+ // the script itself uses double quotes only (JSON.stringify).
22
+ const script = `const s=require("fs").statSync(${JSON.stringify(absPath)});process.exit(s.size>0&&s.mtimeMs>${nowMs}?0:1)`;
23
+ return `timeout 60 node -e '${script}'`;
24
+ }
25
+
26
+ const PAGE_IDS = { 'how it works': 'how-it-works', faq: 'faq', overview: 'overview' };
27
+
28
+ // Entry id: videos get a fresh one per press; knowledge pages are named by a
29
+ // 'Page: <name>' line in the extra instructions (default 'overview').
30
+ function entryIdFor(kind, extra, t) {
31
+ if (kind === 'video') return `vid-${t.toString(36)}${Math.random().toString(36).slice(2, 5).padEnd(3, '0')}`;
32
+ const m = /^\s*Page:\s*(.+?)\s*$/im.exec(extra || '');
33
+ if (!m) return 'overview';
34
+ const name = m[1];
35
+ const known = PAGE_IDS[name.toLowerCase()];
36
+ if (known) return known;
37
+ const custom = /^custom topic:\s*(.+)$/i.exec(name);
38
+ return kebabCase(custom ? custom[1] : name, { maxLen: 40, fallback: 'overview' });
39
+ }
40
+
41
+ async function dispatchMacroJob(
42
+ { cwd, macroId, epicId, extraInstructions } = {},
43
+ { createPrd, listRows, archivePrd, builtins = BUILTIN_MACROS, now = Date.now } = {},
44
+ ) {
45
+ const macro = (builtins || []).find((m) => m && m.id === macroId);
46
+ if (!macro || !macro.job) return { ok: false, error: `macro ${macroId} has no background job declaration` };
47
+ if (typeof epicId !== 'string' || !epicId.trim()) return { ok: false, error: 'epicId is required — a background build joins an existing Epic' };
48
+ if (typeof cwd !== 'string' || !cwd) return { ok: false, error: 'cwd is required' };
49
+ if (typeof createPrd !== 'function') return { ok: false, error: 'createPrd is not available' };
50
+
51
+ const t = now();
52
+ const extra = typeof extraInstructions === 'string' ? extraInstructions.trim() : '';
53
+ const entryKind = macro.job.entryKind;
54
+ const entryId = entryKind ? entryIdFor(entryKind, extra, t) : null;
55
+ const artifactPaths = macro.job.artifactPaths.map((p) => (entryId ? p.split('{id}').join(entryId) : p));
56
+ const absPaths = artifactPaths.map((p) => path.join(cwd, p));
57
+ for (const s of [cwd, ...absPaths]) {
58
+ if (s.includes("'") || /[\r\n]/.test(s)) return { ok: false, error: "cwd or artifact path contains a character the gate cannot quote (single quote or newline)" };
59
+ }
60
+
61
+ let rows = [];
62
+ try {
63
+ rows = (typeof listRows === 'function' ? await listRows({ cwd }) : []) || [];
64
+ } catch (e) {
65
+ return { ok: false, error: `could not read queue: ${e?.message ?? e}` };
66
+ }
67
+ const mine = rows.filter((r) => r && r.macroId === macroId && (!r.cwd || r.cwd === cwd));
68
+ const active = mine.find((r) => ACTIVE.has(r.status));
69
+ if (active) return { ok: false, error: `${macro.label} is already building`, activeSlug: active.slug };
70
+
71
+ // Newest row decides: a stale needs_review/failed attempt is archived so the
72
+ // retry is not blocked by (or confused with) it.
73
+ const newest = mine.reduce((a, r) => (!a || (Number(r.lastRunAt ?? r.finishedAt ?? 0) >= Number(a.lastRunAt ?? a.finishedAt ?? 0)) ? r : a), null);
74
+ if (newest && RETRYABLE.has(newest.status) && typeof archivePrd === 'function') {
75
+ try { await archivePrd(newest.slug, cwd); } catch { /* best effort */ }
76
+ }
77
+
78
+ const slug = `${kebabCase(macro.label, { maxLen: 30, fallback: 'macro' })}-build-${t.toString(36)}${Math.random().toString(36).slice(2, 5)}`;
79
+ let goal = extra ? `${macro.prompt}\n\nAdditional instructions: ${extra}` : macro.prompt;
80
+ if (entryId) goal += `\n\nEntry id: ${entryId}. Save with ${entryKind === 'video' ? 'videoId' : 'pageId'} = ${entryId}.`;
81
+
82
+ const input = {
83
+ title: `${macro.label}: background build`,
84
+ slug,
85
+ cwd,
86
+ agentType: macro.agentName,
87
+ tag: macro.tag,
88
+ deliverable: 'artifact',
89
+ artifactPaths,
90
+ files: artifactPaths,
91
+ estimateMinutes: macro.job.estimateMinutes,
92
+ macroId,
93
+ sourcePromptId: epicId,
94
+ disposition: 'new-head',
95
+ goal,
96
+ acceptanceCriteria: [
97
+ `${artifactPaths[0]} is written during this run by the save tool your persona names, never by hand.`,
98
+ 'Nothing in the repository is committed.',
99
+ ],
100
+ implementationNotes:
101
+ `Work as the ${macro.agentName} persona (your system prompt) end to end. This build was started from Project Home and no one is watching: never stop to ask. `
102
+ + 'Build outside the repository (mktemp -d under ~/.cache). SM_PROJECT_ROOT is the project main checkout; the save tool writes there, so omit its cwd.',
103
+ gate: absPaths.map((p) => buildGate(p, t)),
104
+ };
105
+
106
+ let res;
107
+ try {
108
+ res = await createPrd(input);
109
+ } catch (e) {
110
+ return { ok: false, error: `createPrd failed: ${e?.message ?? e}` };
111
+ }
112
+ if (!res || res.ok === false) return { ok: false, error: res?.error || 'createPrd failed' };
113
+ return { ok: true, slug, epicId };
114
+ }
115
+
116
+ module.exports = { dispatchMacroJob };
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * macroJobIpc.cjs — IPC handlers `macros:dispatch-job` and `macros:job-status`.
5
+ * Thin wiring over dispatchMacroJob / macroJobStatuses; every dependency is
6
+ * injected (index.cjs passes the real scheduler, createPrd and archive).
7
+ *
8
+ * deps: { schemas, validatePath, readActiveIndex, createPrd, loadJobs,
9
+ * archivePrd, dispatchMacroJob?, macroJobStatuses?, readHistoryTail? }
10
+ * `createPrd` is called as `chat:create-prd` calls it, so its own
11
+ * remote.requestReconcile() queues the row at once — no second rescan here.
12
+ */
13
+
14
+ const { dispatchMacroJob: realDispatch } = require('./macroJobDispatch.cjs');
15
+ const { macroJobStatuses: realStatuses } = require('./macroJobStatus.cjs');
16
+
17
+ function registerMacroJobIpc(ipcMain, deps = {}) {
18
+ const dispatch = deps.dispatchMacroJob || realDispatch;
19
+ const statuses = deps.macroJobStatuses || realStatuses;
20
+
21
+ ipcMain.handle('macros:dispatch-job', async (_event, rawPayload) => {
22
+ const payload = deps.schemas.macrosDispatchJob.parse(rawPayload);
23
+ const cwd = deps.validatePath(payload.cwd);
24
+ const index = deps.readActiveIndex(cwd);
25
+ const sessions = index && index.sessions ? index.sessions : {};
26
+ const entry = Object.prototype.hasOwnProperty.call(sessions, payload.epicId) ? sessions[payload.epicId] : null;
27
+ if (!entry || entry.status !== 'active') {
28
+ return { ok: false, error: `epic ${payload.epicId} is not an active session in this project` };
29
+ }
30
+ return dispatch(
31
+ { cwd, macroId: payload.macroId, epicId: payload.epicId, extraInstructions: payload.extraInstructions },
32
+ {
33
+ createPrd: deps.createPrd,
34
+ listRows: async () => deps.loadJobs(),
35
+ archivePrd: (slug, rowCwd) => deps.archivePrd(slug, rowCwd),
36
+ },
37
+ );
38
+ });
39
+
40
+ ipcMain.handle('macros:job-status', async (_event, rawPayload) => {
41
+ const payload = deps.schemas.macrosJobStatus.parse(rawPayload);
42
+ const cwd = deps.validatePath(payload.cwd);
43
+ return statuses({ cwd }, {
44
+ loadJobs: deps.loadJobs,
45
+ ...(deps.readHistoryTail ? { readHistoryTail: deps.readHistoryTail } : {}),
46
+ });
47
+ });
48
+ }
49
+
50
+ module.exports = { registerMacroJobIpc };
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * macroJobStatus.cjs — per built-in macro with a `job` declaration, the state of
5
+ * its newest background job for one project: newest live queue row, else newest
6
+ * entry in a bounded tail of the project's scheduler history. Read-only.
7
+ *
8
+ * Plain Node, no Electron imports; all I/O is injected.
9
+ */
10
+
11
+ const { BUILTIN_MACROS } = require('./builtinMacros.cjs');
12
+ const { readTail } = require('../util/fileTail.cjs');
13
+
14
+ const HISTORY_TAIL_BYTES = 524288;
15
+ const RUNNING = new Set(['running', 'investigating']);
16
+ const FAILED = new Set(['failed', 'needs_review', 'skipped', 'cancelled']);
17
+
18
+ function stateOf(status) {
19
+ if (RUNNING.has(status)) return 'running';
20
+ if (status === 'completed') return 'done';
21
+ if (FAILED.has(status)) return 'failed';
22
+ return 'queued'; // pending/held/blocked/deferred/null/unknown
23
+ }
24
+
25
+ function reasonOf(row, status) {
26
+ if (row.verifierVerdict === 'budget_exceeded') {
27
+ const n = row.budgetMinutes;
28
+ return Number.isFinite(n) && n > 0 ? `Timed out at the ${n}-minute job budget` : 'Timed out at the job budget';
29
+ }
30
+ for (const v of [row.error, row.finalizeReason, row.terminalReason]) {
31
+ if (typeof v === 'string' && v.trim()) return v;
32
+ }
33
+ return `Ended as ${status}`;
34
+ }
35
+
36
+ function toStatus(macroId, row) {
37
+ const status = row.status == null ? null : row.status;
38
+ const state = stateOf(status);
39
+ return {
40
+ macroId,
41
+ epicId: row.epicId ?? row.sourcePromptId ?? null,
42
+ slug: row.slug ?? null,
43
+ state,
44
+ status,
45
+ reason: state === 'failed' ? reasonOf(row, status) : null,
46
+ startedAt: row.startedAt ?? null,
47
+ finishedAt: row.finishedAt ?? null,
48
+ };
49
+ }
50
+
51
+ function stamp(row) {
52
+ const t = Date.parse(row.finishedAt || row.startedAt || row.createdAt || row.queuedAt || '');
53
+ return Number.isFinite(t) ? t : 0;
54
+ }
55
+
56
+ /** Newest row of `rows` (ties: later in the list wins). */
57
+ function newest(rows) {
58
+ let best = null;
59
+ let bestT = -Infinity;
60
+ for (const r of rows) {
61
+ const t = stamp(r);
62
+ if (t >= bestT) { best = r; bestT = t; }
63
+ }
64
+ return best;
65
+ }
66
+
67
+ function parseHistory(text) {
68
+ const out = [];
69
+ if (typeof text !== 'string' || !text) return out;
70
+ for (const line of text.split('\n')) {
71
+ if (!line.trim()) continue;
72
+ try {
73
+ const o = JSON.parse(line);
74
+ if (o && typeof o === 'object' && !o.kind) out.push(o);
75
+ } catch { /* torn line (tail cut mid-line, partial write) */ }
76
+ }
77
+ return out;
78
+ }
79
+
80
+ function defaultReadHistoryTail(cwd) {
81
+ const { projectHistoryPath } = require('../scheduler/queueStore.cjs');
82
+ return readTail(projectHistoryPath(cwd), HISTORY_TAIL_BYTES);
83
+ }
84
+
85
+ async function macroJobStatuses({ cwd } = {}, { loadJobs, readHistoryTail = defaultReadHistoryTail, builtins = BUILTIN_MACROS } = {}) {
86
+ const macros = (builtins || []).filter((m) => m && m.job && m.id);
87
+ if (!macros.length) return [];
88
+ let live = [];
89
+ try {
90
+ const rows = typeof loadJobs === 'function' ? await loadJobs() : [];
91
+ live = Array.isArray(rows) ? rows.filter((r) => r && r.cwd === cwd && r.macroId) : [];
92
+ } catch { live = []; }
93
+
94
+ let history = null; // lazily read once, only if some macro has no live row
95
+ const loadHistory = async () => {
96
+ if (history) return history;
97
+ try {
98
+ history = parseHistory(await readHistoryTail(cwd)).filter((r) => r.macroId && (!r.cwd || r.cwd === cwd));
99
+ } catch { history = []; }
100
+ return history;
101
+ };
102
+
103
+ const out = [];
104
+ for (const m of macros) {
105
+ let row = newest(live.filter((r) => r.macroId === m.id));
106
+ if (!row) row = newest((await loadHistory()).filter((r) => r.macroId === m.id));
107
+ if (row) out.push(toStatus(m.id, row));
108
+ }
109
+ return out;
110
+ }
111
+
112
+ module.exports = { macroJobStatuses, HISTORY_TAIL_BYTES };
@@ -481,8 +481,24 @@ async function loadStore(filePath, opts) {
481
481
 
482
482
  // --- public API -------------------------------------------------------------
483
483
 
484
+ /**
485
+ * Decorate built-in entries with their live `job` declaration from BUILTIN_MACROS.
486
+ * Never persisted: `job` is read at list time so a stored copy cannot freeze it.
487
+ */
488
+ function withBuiltinJobs(macros) {
489
+ return macros.map((m) => {
490
+ const { job: _stale, ...rest } = m;
491
+ const b = BUILTIN_MACROS.find((x) => x.id === m.id);
492
+ return b && b.job ? { ...rest, job: b.job } : rest;
493
+ });
494
+ }
495
+
484
496
  /** @returns {Promise<Macro[]>} */
485
497
  async function listMacros(opts = {}) {
498
+ return withBuiltinJobs(await listMacrosRaw(opts));
499
+ }
500
+
501
+ async function listMacrosRaw(opts) {
486
502
  const filePath = resolvePath(opts);
487
503
  const first = await readStore(filePath);
488
504
  if (first.state === 'ok') {
@@ -63,6 +63,30 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
63
63
  tools: "Read, Grep, Glob, Bash, Edit, Write",
64
64
  },
65
65
  },
66
+ {
67
+ commit: "f91d78eb",
68
+ bodySha256: "f0b9bf01ddb9dc4c52a2c446dd20759070347ccc5b125ddbe812bb82cfec17c6",
69
+ fm: {
70
+ description: "The primary Actor for an Epic's whole interactive conversation — owns overall plan and decomposition, clarifies scope, searches before building, decomposes work into scheduled PRDs via /develop, tracks them to completion, and verifies before calling anything done. Never implements a PRD itself — that's dev-lead's job, one PRD at a time, headless. Task-type framing is the Epic's Mission tag's job, not this persona's.",
71
+ model: "opus",
72
+ effort: "medium",
73
+ tags: "feature, bug, discussion, art",
74
+ title: "Engineering — Architect",
75
+ tools: "Read, Grep, Glob, Bash, Edit, Write",
76
+ },
77
+ },
78
+ {
79
+ commit: "2651bc05",
80
+ bodySha256: "522f0bd3b4119a4fe7a01571907657de2cc2c01129171cf5b60aa16eecaf4375",
81
+ fm: {
82
+ description: "The primary Actor for an Epic's whole interactive conversation — owns overall plan and decomposition, clarifies scope, searches before building, decomposes work into scheduled PRDs via /develop, tracks them to completion, and verifies before calling anything done. Never implements a PRD itself — that's dev-lead's job, one PRD at a time, headless. Task-type framing is the Epic's Mission tag's job, not this persona's.",
83
+ model: "opus",
84
+ effort: "medium",
85
+ tags: "feature, bug, discussion, art",
86
+ title: "Engineering — Architect",
87
+ tools: "Read, Grep, Glob, Bash, Edit, Write",
88
+ },
89
+ },
66
90
  ],
67
91
  "dev-lead": [
68
92
  {
@@ -161,6 +185,18 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
161
185
  },
162
186
  ],
163
187
  "project-home-builder": [
188
+ // Not from src/seed git history: this body was written to ~/.claude/agents by this repo's own
189
+ // agent on 2026-08-02, before the seed file existed, so no seed commit ever contained it.
190
+ {
191
+ commit: "pre-seed-2026-08-02",
192
+ bodySha256: "ad9f77d1279b7e8b0856285c361f45d8b339369a63675307817d781e82588662",
193
+ fm: {
194
+ description: "Generates a project's static Project Home/Project Pages from that project's own saved component library and a computed project summary, if that pipeline exists there.",
195
+ tools: "Read, Grep, Glob, Bash, Write, Edit",
196
+ tags: "project-home-builder",
197
+ title: "Platform — Docs Engineer",
198
+ },
199
+ },
164
200
  {
165
201
  commit: "e9f2f540",
166
202
  bodySha256: "e1c80f465179f814f1e9ea95529434309e5238facdc8c6664cb8f44f8302e148",
@@ -190,6 +226,39 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
190
226
  effort: "medium",
191
227
  },
192
228
  },
229
+ {
230
+ commit: "seed-v3",
231
+ bodySha256: "8cef2256f31d1d166a305923388d1d0d2f4f099275df24d869decc35a6cb11bb",
232
+ fm: {
233
+ description: "Reads a project and writes ONE self-contained overview page (home.html) for its Project Home tab, then saves it with a single project_home_write call.",
234
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_home_write",
235
+ title: "Project Home — Builder",
236
+ model: "sonnet",
237
+ effort: "medium",
238
+ },
239
+ },
240
+ {
241
+ commit: "seed-v4",
242
+ bodySha256: "525ba0b41d540bea5804b9c34765e05566555fb8447659a3b3c6579814c4a563",
243
+ fm: {
244
+ description: "Reads a project and writes ONE Knowledge Page (Overview by default, or How it works, FAQ, or a custom topic) for its Project Home tab, then saves it with a single project_page_write call.",
245
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_home_write, mcp__session-manager-scheduler__project_page_write",
246
+ title: "Project Home — Builder",
247
+ model: "sonnet",
248
+ effort: "medium",
249
+ },
250
+ },
251
+ {
252
+ commit: "persona-no-reach-around",
253
+ bodySha256: "3453b38989b713e6671efdb1417a003dc6fc40fa82e506faf24239c598947c26",
254
+ fm: {
255
+ description: "Reads a project and writes ONE Knowledge Page (Overview by default, or How it works, FAQ, or a custom topic) for its Project Home tab, then saves it with a single project_page_write call.",
256
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_home_write, mcp__session-manager-scheduler__project_page_write",
257
+ title: "Project Home — Builder",
258
+ model: "sonnet",
259
+ effort: "medium",
260
+ },
261
+ },
193
262
  ],
194
263
  "validator": [
195
264
  {
@@ -353,6 +422,50 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
353
422
  effort: "max",
354
423
  },
355
424
  },
425
+ {
426
+ commit: "seed-v6",
427
+ bodySha256: "503ab8eed370d546f0435ac56a1470a1af31c6c665a2660af8c94b4d9ed6361a",
428
+ fm: {
429
+ description: "30-second self-contained HTML/JS demo video for Project Home, saved via project_demo_video_write.",
430
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write",
431
+ title: "Project Home — Demo Video",
432
+ model: "opus",
433
+ effort: "max",
434
+ },
435
+ },
436
+ {
437
+ commit: "seed-v7",
438
+ bodySha256: "7d2040de1734c23148c3870b6ce3a3e5ce2aa319637dc7fc0cc2af63ec1b3036",
439
+ fm: {
440
+ description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_demo_video_write.",
441
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write",
442
+ title: "Project Home — Demo Video",
443
+ model: "opus",
444
+ effort: "max",
445
+ },
446
+ },
447
+ {
448
+ commit: "seed-v8",
449
+ bodySha256: "cf1bff8a70042f93fa18d2102ca71b969825377b9460834f3d2ae15f915d206b",
450
+ fm: {
451
+ description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
452
+ 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",
453
+ title: "Project Home — Demo Video",
454
+ model: "opus",
455
+ effort: "max",
456
+ },
457
+ },
458
+ {
459
+ commit: "persona-no-reach-around",
460
+ bodySha256: "259ae44d41f10990d55d1444d3bbf97012a9330d5bfb2ac5a7229113bb125e36",
461
+ fm: {
462
+ description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
463
+ 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",
464
+ title: "Project Home — Demo Video",
465
+ model: "opus",
466
+ effort: "max",
467
+ },
468
+ },
356
469
  ],
357
470
  "blender-artist": [
358
471
  {
@@ -81,10 +81,15 @@ function deriveSlugFromTitle(title) {
81
81
  * criteria / Files / Implementation notes / Out of scope / Gate /
82
82
  * Engineering standards, in order.
83
83
  */
84
+ const MACRO_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
85
+ function isValidMacroId(id) {
86
+ return typeof id === 'string' && MACRO_ID_RE.test(id);
87
+ }
88
+
84
89
  function buildPrdBody(input) {
85
90
  const {
86
91
  title, cwd, estimateMinutes, goal, acceptanceCriteria,
87
- implementationNotes, outOfScope, sourcePromptId, sourceTabId, tag, agentType, dependsOn, quietMachine, disposition, deliverable, artifactPaths, planId,
92
+ implementationNotes, outOfScope, sourcePromptId, sourceTabId, tag, agentType, dependsOn, quietMachine, disposition, deliverable, artifactPaths, planId, macroId,
88
93
  gate, files, budgetExempt,
89
94
  } = input;
90
95
 
@@ -137,6 +142,7 @@ function buildPrdBody(input) {
137
142
  // criteria are wall-clock/timing measurements that CPU contention from
138
143
  // sibling jobs would otherwise invalidate. Only emitted when true — see
139
144
  // prdFrontmatter.cjs's applyKey for the matching "only true opts in" parse.
145
+ if (isValidMacroId(macroId)) fmLines.push(`macroId: ${macroId}`);
140
146
  if (quietMachine === true) fmLines.push('quietMachine: true');
141
147
  // Budget exemption is for a sweep validator that cannot be split further;
142
148
  // every other caller's budgetExempt is ignored.
@@ -307,6 +313,21 @@ async function createPrdInner(input, remote, ctl, opts = {}) {
307
313
  if (fallback) input = { ...input, sourcePromptId: fallback };
308
314
  }
309
315
 
316
+ // Develop-loop-off Epics never receive PRDs (so no check-ins, digests or
317
+ // validation sweeps either). Safety refusal — deliberately no bypass.
318
+ if (input.sourcePromptId) {
319
+ const { sessions } = readActiveIndex(cwd);
320
+ const row = Object.prototype.hasOwnProperty.call(sessions, input.sourcePromptId)
321
+ ? sessions[input.sourcePromptId] : null;
322
+ if (row && row.developLoop === false) {
323
+ return {
324
+ ok: false, applied: false, status: 409,
325
+ error: `Epic ${input.sourcePromptId} was started with the develop loop off, so it cannot queue PRDs. `
326
+ + 'Start a new session with the develop loop on to queue this work.',
327
+ };
328
+ }
329
+ }
330
+
310
331
  // Wave-disposition decision point (scheduler wave-disposition PRD): only
311
332
  // matters for a PRD that would become a ROOT of its own wave — one the
312
333
  // caller didn't already give an explicit dependsOn (that already fixes
@@ -404,6 +425,11 @@ async function createPrdInner(input, remote, ctl, opts = {}) {
404
425
  }
405
426
  }
406
427
 
428
+ // macroId (in-process callers only): refused before NN allocation.
429
+ if (input.macroId != null && !isValidMacroId(input.macroId)) {
430
+ return { ok: false, applied: false, status: 400, error: 'macroId must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/ when given' };
431
+ }
432
+
407
433
  // Fake-heading guard (gate-and-files-in-PRD-body unit): a caller-supplied
408
434
  // free-text field that itself contains a "# Gate" or "# Files" heading line
409
435
  // would, after buildPrdBody splices in the real section below, read as TWO
@@ -77,8 +77,9 @@ function splitFrontmatter(raw) {
77
77
  * never emitted, which is how `scheduler_update_prd` clears a dependency.
78
78
  */
79
79
 
80
- const RECOGNIZED_KEYS = new Set(['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths']);
81
- const EMIT_ORDER = ['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths'];
80
+ const RECOGNIZED_KEYS = new Set(['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths', 'macroId']);
81
+ const EMIT_ORDER = ['title', 'cwd', 'estimateMinutes', 'parallelGroup', 'sourcePromptId', 'sourceTabId', 'tag', 'agentType', 'createdVia', 'issuedAt', 'dependsOn', 'quietMachine', 'disposition', 'planId', 'deliverable', 'artifactPaths', 'macroId'];
82
+ const MACRO_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
82
83
  const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
83
84
 
84
85
  function indentOf(line) {
@@ -194,6 +195,10 @@ function applyKey(fm, key, after) {
194
195
  // recognized; anything else is dropped so a typo can never opt in.
195
196
  if (v === 'artifact') fm.deliverable = v;
196
197
  return;
198
+ case 'macroId':
199
+ // Id of the macro whose press dispatched this PRD; anything off-pattern is dropped.
200
+ if (typeof v === 'string' && MACRO_ID_RE.test(v.trim())) fm.macroId = v.trim();
201
+ return;
197
202
  case 'artifactPaths': {
198
203
  // Inline `[a, b]` list, same shape as dependsOn.
199
204
  const list = parseInlineList(after);