claude-code-session-manager 0.134.0 → 0.135.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 (41) hide show
  1. package/dist/assets/{AgentLibrary-C9KFGJQq.js → AgentLibrary-DRlcF1YD.js} +1 -1
  2. package/dist/assets/{AppSettings-CvVQ6ot5.js → AppSettings-CBhYHKGI.js} +1 -1
  3. package/dist/assets/{Button-BHvploNk.js → Button-DtBUGvGI.js} +1 -1
  4. package/dist/assets/{DocumentEditorPane-DaX4xag_.js → DocumentEditorPane-C82c7Qtl.js} +1 -1
  5. package/dist/assets/{Extensions-DbRY-KEz.js → Extensions-Kn-oUD2_.js} +2 -2
  6. package/dist/assets/{History-BE_mjM24.js → History-B4c3Uz9u.js} +1 -1
  7. package/dist/assets/{Library-I37dQ6pB.js → Library-1RpLT-aH.js} +1 -1
  8. package/dist/assets/{ListDetail-DJYMWYQd.js → ListDetail-xr0oxNkv.js} +1 -1
  9. package/dist/assets/{Panel-DP8eSKSs.js → Panel-O8XPrpJu.js} +1 -1
  10. package/dist/assets/{ProjectClaudeConfig-Cw8lc3Qi.js → ProjectClaudeConfig-DBGhhzg2.js} +1 -1
  11. package/dist/assets/{ProvenanceBadge-DUwhsmdA.js → ProvenanceBadge-DSaizfZL.js} +1 -1
  12. package/dist/assets/{Scheduler-B9D2gZqs.js → Scheduler-D2_5NyiR.js} +1 -1
  13. package/dist/assets/{Settings-DSk7bn-1.js → Settings-Clgqb3Lq.js} +1 -1
  14. package/dist/assets/{SkillReferenceGraph-DtJcJJHR.js → SkillReferenceGraph-D80RA7kR.js} +1 -1
  15. package/dist/assets/{Skills-BPZnSjsB.js → Skills-DNG7tHSf.js} +1 -1
  16. package/dist/assets/{SourceChip-DUxulNOp.js → SourceChip-D-Imzszd.js} +1 -1
  17. package/dist/assets/{SystemPrompt-BXAugVle.js → SystemPrompt-CGlOpUQA.js} +1 -1
  18. package/dist/assets/{TiptapBody-CDC1vrOo.js → TiptapBody-CJFGfBdz.js} +1 -1
  19. package/dist/assets/{Toggle-CrgM7OTR.js → Toggle-0Ff0bPa_.js} +1 -1
  20. package/dist/assets/{ViewTabs-DLwaU9RB.js → ViewTabs-BCMYQwo_.js} +1 -1
  21. package/dist/assets/{VoiceButton-C4hIBxIP.js → VoiceButton-JzyC6DAB.js} +1 -1
  22. package/dist/assets/{historyTotals-itA00dXm.js → historyTotals-B01WPBwh.js} +1 -1
  23. package/dist/assets/{index-Cjt8B7H9.css → index-CjQ_p5y7.css} +1 -1
  24. package/dist/assets/{index-Cznhnxhq.js → index-rt7pTODX.js} +362 -362
  25. package/dist/index.html +2 -2
  26. package/dist-web/app.css +1 -1
  27. package/dist-web/app.js +392 -392
  28. package/package.json +1 -1
  29. package/plugins/session-manager-dev/skills/develop/standards.md +1 -1
  30. package/src/main/build-info.json +4 -4
  31. package/src/main/lib/persona-macro/macroJobDispatch.cjs +3 -2
  32. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  33. package/src/main/lib/prd/prdFrontmatter.cjs +25 -1
  34. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  35. package/src/main/promptSessionEvents.cjs +7 -1
  36. package/src/main/runVerify.cjs +2 -2
  37. package/src/main/scheduler/prdParser.cjs +17 -1
  38. package/src/main/scheduler.cjs +137 -15
  39. package/src/main/templates/PRD_AUTHORING.md +2 -2
  40. package/src/preload/api.d.ts +8 -2
  41. package/src/seed/agents/project-home-builder.md +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-session-manager",
3
- "version": "0.134.0",
3
+ "version": "0.135.0",
4
4
  "description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
5
5
  "type": "module",
6
6
  "main": "src/main/index.cjs",
@@ -81,5 +81,5 @@ Long hangs, not bad code, cause most failed runs. The PRD body carries a one-lin
81
81
  - **Never `git stash`, `git reset`, `git checkout -- <path>`, or `git clean` against working-tree state you did not create.** There is no polite version of this. You are normally isolated in your own `git worktree` on branch `sm-job/<slug>` (`src/main/lib/git/gitWorktree.cjs`), and the scheduler salvages any uncommitted diff of yours on teardown — so you never need to touch shared state to protect your own work. Confirm isolation with `git rev-parse --git-common-dir` (a worktree's common-dir differs from its own `.git`) or by checking your cwd; `git diff`/`git status` are always safe. If you land in a SHARED tree with pre-existing dirty tracked files anyway, work around them — scope `git add`/commits to only the paths you touched — or end with `SCHEDULER_VERDICT: FAIL <reason>` (`SCHEDULER_VERDICT: BLOCKED_BY_FOREIGN_WIP` only when your gate failed on those files, as the finish protocol says); never discard, stash, or revert someone else's uncommitted changes to get a clean checkout. A shared tree may be feeding a running service that reads its config straight from the working tree, so reverting it is a production change, not a local inconvenience. The scheduler runs a shared-tree stash guard as a backstop (`scheduler.cjs`'s `checkSharedTreeGuard`/`evaluateSharedTreeGuard`), but that guard exists to catch a mistake, not to license one. (Incidents: PRD 477 stashed a sibling job's WIP to get its own checkout and never restored it. 2026-09-01: a headless executor in the trader repo ran a blanket `git stash` against an operator's uncommitted live trading-config edit and exited without restoring it — the third incident of this class.)
82
82
  - **`gh pr edit --body` can fail on repos with legacy GitHub Projects (classic) boards.** It queries the deprecated `repository.pullRequest.projectCards` field and errors with a `GraphQL: Projects (classic) is being deprecated` message even though the edit itself would otherwise succeed — a known `gh` CLI quirk, not a defect in your work. Prefer `gh api -X PATCH repos/<owner>/<repo>/pulls/<n> -f body="$(cat body.md)"` instead; it skips that field. If `gh pr edit` fails this way anyway retry immediately with the `gh api` form and note the fallback in your report.
83
83
  - **Never `sleep N && <cmd>` to poll remote CI/job status.** The harness hard-blocks a `sleep` chained to another command. Use the tool's own blocking watcher under a hard cap instead: `timeout 600 gh run watch <run-id> --repo <owner>/<repo> --exit-status`. `gh pr checks` exits 8 while checks are pending and 1 on failure — that is not a defect in your work.
84
- - **The verdict line is your authoritative "I passed" signal — emit it truthfully.** The scheduler's finish protocol ends by printing `SCHEDULER_VERDICT: PASS` once the AC gate is green and the commit has landed (or `SCHEDULER_VERDICT: FAIL <reason>` + `exit 1` otherwise). `PASS` plus a landed commit is authoritative: it overrides incidental transcript markers, so a deliberately reproduced red test or a grep result containing "Error" will not false-trip `needs_review`, as long as the run genuinely ends green and committed. Exiting 0 with uncommitted changes, or with no verdict line at all, is the #1 cause of needless `needs_review`. Never print `PASS` when the gate is red — that turns a safety net into a silent-failure machine.
84
+ - **The verdict line is your authoritative "I passed" signal — emit it truthfully.** The scheduler's finish protocol ends by printing `SCHEDULER_VERDICT: PASS` once the AC gate is green and the commit has landed (or `SCHEDULER_VERDICT: FAIL <reason>` + `exit 1` otherwise). `PASS` plus a landed commit is authoritative: it overrides incidental transcript markers, so a deliberately reproduced red test or a grep result containing "Error" will not false-trip `needs_review`, as long as the run genuinely ends green and committed. An artifact-only PRD (`deliverable: artifact` + `artifactPaths`) commits nothing by design: a green gate with a clean tree is a `PASS`, never a `FAIL` for the missing commit. Exiting 0 with uncommitted changes, or with no verdict line at all, is the #1 cause of needless `needs_review`. Never print `PASS` when the gate is red — that turns a safety net into a silent-failure machine.
85
85
  - **If your own AC gate failed on a SIBLING job's in-flight file, say so with the right verdict — don't print a lying FAIL.** If the prompt disclosed a `--- FOREIGN WORKING-TREE STATE ---` section and your gate failure is confined to paths that section named as not your work, print `SCHEDULER_VERDICT: BLOCKED_BY_FOREIGN_WIP` (and `exit 1`) plus a `FOREIGN_WIP_PATHS: <path1>, <path2>, ...` line naming exactly the failing paths. The scheduler validates every listed path against the manifest it disclosed to you — list a path it never named, or claim this verdict for your own regression, and it is rejected back to `FAIL`. This is not an escape hatch: it exists so a correctly-diagnosed "not my regression" gets auto-requeued once the sibling clears its WIP, instead of spawning a fix-plan investigation into someone else's unfinished work.
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.134.0",
3
- "gitSha": "62fc9a33d5e37168ff9dc09343d06a2f50555b87",
4
- "gitShortSha": "62fc9a33",
2
+ "version": "0.135.0",
3
+ "gitSha": "e4f59f3f49bc1a6db03044a33b8c56d52c44247f",
4
+ "gitShortSha": "e4f59f3f",
5
5
  "gitBranch": "HEAD",
6
- "builtAt": "2026-11-14T22:13:29.629Z",
6
+ "builtAt": "2026-11-15T01:31:55.800Z",
7
7
  "dirty": false
8
8
  }
@@ -112,11 +112,12 @@ async function dispatchMacroJob(
112
112
  goal,
113
113
  acceptanceCriteria: [
114
114
  `${artifactPaths[0]} is written during this run by the save tool your persona names, never by hand.`,
115
- 'Nothing in the repository is committed.',
115
+ 'Nothing in the repository is committed. No commit is the expected result: once the gate is green, end with SCHEDULER_VERDICT: PASS, never FAIL for the missing commit.',
116
116
  ],
117
117
  implementationNotes:
118
118
  `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. `
119
- + '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.',
119
+ + '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. '
120
+ + 'This build is artifact-only (deliverable: artifact) and lands no commit by design: a green gate with no commit means SCHEDULER_VERDICT: PASS.',
120
121
  gate: absPaths.map((p) => buildGate(p, t)),
121
122
  };
122
123
  if (typeof effort === 'string' && PRD_EFFORT_LEVELS.includes(effort)) input.effort = effort;
@@ -259,6 +259,17 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
259
259
  effort: "medium",
260
260
  },
261
261
  },
262
+ {
263
+ commit: "seed-v6-no-commit-pass",
264
+ bodySha256: "69890c9b83fb8f2f3a10ab2e0b6a932c3f86be9d7c1d40276113d08fc4d5ba28",
265
+ fm: {
266
+ 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.",
267
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_home_write, mcp__session-manager-scheduler__project_page_write",
268
+ title: "Project Home — Builder",
269
+ model: "sonnet",
270
+ effort: "medium",
271
+ },
272
+ },
262
273
  ],
263
274
  "validator": [
264
275
  {
@@ -125,6 +125,22 @@ function parseInlineList(raw) {
125
125
  .filter((s) => s.length > 0);
126
126
  }
127
127
 
128
+ /**
129
+ * The one definition of an artifact-only PRD: `deliverable: artifact` plus a
130
+ * non-empty `artifactPaths` list. Used by runVerify's artifact exemption,
131
+ * executeJob's finish-protocol variant and the scheduler's queue-row checks —
132
+ * keep every caller on this predicate so the copies cannot drift apart.
133
+ *
134
+ * @param {{ deliverable?: unknown, artifactPaths?: unknown } | null | undefined} decl
135
+ * @returns {boolean}
136
+ */
137
+ function isArtifactOnlyDeclaration(decl) {
138
+ if (decl == null || typeof decl !== 'object') return false;
139
+ return decl.deliverable === 'artifact'
140
+ && Array.isArray(decl.artifactPaths)
141
+ && decl.artifactPaths.length > 0;
142
+ }
143
+
128
144
  function arraysEqual(a, b) {
129
145
  if (!Array.isArray(a) || !Array.isArray(b)) return false;
130
146
  return a.length === b.length && a.every((v, i) => v === b[i]);
@@ -322,4 +338,12 @@ function serializePrdFile(fm, body) {
322
338
  return `---\n${fmText}\n---\n${body}`;
323
339
  }
324
340
 
325
- module.exports = { splitFrontmatter, parsePrdFile, serializePrdFile, RECOGNIZED_KEYS, PRD_EFFORT_LEVELS };
341
+ module.exports = {
342
+ splitFrontmatter,
343
+ parsePrdFile,
344
+ serializePrdFile,
345
+ parseInlineList,
346
+ isArtifactOnlyDeclaration,
347
+ RECOGNIZED_KEYS,
348
+ PRD_EFFORT_LEVELS,
349
+ };
@@ -95,6 +95,9 @@ const ScheduleJobSchema = z
95
95
  epicId: z.string().nullable().optional(),
96
96
  // Macro press this job's PRD came from (PRD frontmatter `macroId`).
97
97
  macroId: z.string().nullable().optional(),
98
+ // PRD frontmatter artifact-only declaration (`deliverable: artifact` + `artifactPaths`).
99
+ deliverable: z.literal('artifact').nullable().optional(),
100
+ artifactPaths: z.array(z.string()).nullable().optional(),
98
101
  // PRD frontmatter `effort` — a per-run level from a macro press (outranks the persona's).
99
102
  effort: z.string().nullable().optional(),
100
103
  statusHistory: z.array(ScheduleJobStatusHistoryEntrySchema).optional(),
@@ -71,7 +71,9 @@ function mintEventId() {
71
71
  * validation pass is what may later move it to 'verified'/'refuted'. `agentType`
72
72
  * (the job's agent) and `digestKey` (the settle digest's stable key) ride the
73
73
  * same meta arg and are copied the same way, as is `notice` (PRD 2950 — a
74
- * marker like 'job-not-queued' the renderer turns into a distinct notice). All
74
+ * marker like 'job-not-queued', or PRD 3116's 'build-done'/'build-failed', the
75
+ * renderer turns into a distinct notice) and `buildOutput` (PRD 3116 — `{ kind,
76
+ * id, title }` of a macro build's saved entry). All
75
77
  * keys are added to the event object only when present in `meta`, never as
76
78
  * `undefined`-valued keys, so events appended without them serialize
77
79
  * identically to before.
@@ -104,6 +106,10 @@ async function appendResponseEventWithReason(cwd, sourcePromptId, text, meta = {
104
106
  if (meta && meta.agentType) event.agentType = meta.agentType;
105
107
  if (meta && meta.digestKey) event.digestKey = meta.digestKey;
106
108
  if (meta && meta.notice) event.notice = meta.notice;
109
+ if (meta && meta.buildOutput && typeof meta.buildOutput === 'object') {
110
+ const { kind, id, title } = meta.buildOutput;
111
+ event.buildOutput = { kind, id, title };
112
+ }
107
113
  data.events[sourcePromptId] = [...events, event];
108
114
  await config.writeJson(path, data, { writer: 'scheduler' });
109
115
  broadcast(EVENT_APPENDED_CHANNEL, { cwd, promptSessionId: sourcePromptId, event });
@@ -44,7 +44,7 @@
44
44
  const fs = require('node:fs');
45
45
  const path = require('node:path');
46
46
  const { execFileSync } = require('node:child_process');
47
- const { parsePrdFile } = require('./lib/prd/prdFrontmatter.cjs');
47
+ const { parsePrdFile, isArtifactOnlyDeclaration } = require('./lib/prd/prdFrontmatter.cjs');
48
48
  const { isSatisfiedDepRow } = require('./lib/prd/depSlugResolve.cjs');
49
49
 
50
50
  const VERDICTS_SCHEMA_VERSION = 1;
@@ -907,7 +907,7 @@ async function verifyRun({
907
907
  if (!mergeMainVerified && !priorRunVerified) {
908
908
  let fm = null;
909
909
  try { fm = parsePrdFile(prdFullText).frontmatter; } catch { fm = null; }
910
- if (fm && fm.deliverable === 'artifact' && Array.isArray(fm.artifactPaths) && fm.artifactPaths.length > 0) {
910
+ if (isArtifactOnlyDeclaration(fm)) {
911
911
  const check = artifactsCheck({
912
912
  cwd: [queueEntry?.cwd, worktreeDir],
913
913
  paths: fm.artifactPaths,
@@ -17,7 +17,7 @@ const fs = require('node:fs');
17
17
  const fsp = require('node:fs/promises');
18
18
  const os = require('node:os');
19
19
  const path = require('node:path');
20
- const { splitFrontmatter, PRD_EFFORT_LEVELS } = require('../lib/prd/prdFrontmatter.cjs');
20
+ const { splitFrontmatter, parseInlineList, PRD_EFFORT_LEVELS } = require('../lib/prd/prdFrontmatter.cjs');
21
21
  const { deriveEpicIdFromPrdPath } = require('../lib/prd/prdLocations.cjs');
22
22
  const { parseFilesSection } = require('../lib/prd/prdGateFiles.cjs');
23
23
  const { reportDanglingAgentTypeOnce } = require('../lib/prd/prdAgentType.cjs');
@@ -45,6 +45,17 @@ let prdDirMtime = -1;
45
45
  let prdDirFiles = null; // sorted absolute paths
46
46
  const prdFileCache = new Map(); // path -> { mtimeMs, ino, parsed }
47
47
 
48
+ /**
49
+ * `artifactPaths: [a, b]` → ['a', 'b'] — the inline-list form only, same
50
+ * shape prdFrontmatter.cjs's parsePrdFile (runVerify's artifact exemption,
51
+ * executeJob's finish variant) recognizes. Empty / absent / malformed → null.
52
+ */
53
+ function parseArtifactPaths(raw) {
54
+ if (typeof raw !== 'string') return null;
55
+ const list = parseInlineList(raw);
56
+ return list && list.length > 0 ? list : null;
57
+ }
58
+
48
59
  /**
49
60
  * Parse a PRD file from disk without any caching. Reads bytes once, decodes
50
61
  * frontmatter, and folds in the parallel-group number from the filename when
@@ -133,6 +144,11 @@ async function parsePrdRaw(filePath) {
133
144
  planId: (typeof fm.planId === 'string' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(fm.planId)) ? fm.planId : null,
134
145
  // Macro press that minted this PRD (prdFrontmatter.cjs MACRO_ID_RE); malformed reads as absent.
135
146
  macroId: (typeof fm.macroId === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(fm.macroId.trim())) ? fm.macroId.trim() : null,
147
+ // Artifact-only declaration (PRD 3114): copied onto queue rows so the
148
+ // row-based artifact-only checks in scheduler.cjs see it. Exactly
149
+ // 'artifact' else null; artifactPaths = non-empty strings, else null.
150
+ deliverable: (typeof fm.deliverable === 'string' && fm.deliverable.trim() === 'artifact') ? 'artifact' : null,
151
+ artifactPaths: parseArtifactPaths(fm.artifactPaths),
136
152
  effort: (typeof fm.effort === 'string' && PRD_EFFORT_LEVELS.includes(fm.effort.trim())) ? fm.effort.trim() : null,
137
153
  // Opt-in exclusive-lease flag (PRD 1107, quietMachineLease.cjs +
138
154
  // schedulerBatch.cjs's pickNextBatch). Only a literal `true` opts in —
@@ -77,7 +77,8 @@ const {
77
77
  findLiveProcessForJob, logHasOutput, resolvePidlessGateOutcome, resolveCommitGuardOutcome,
78
78
  readSpawnedPidFromLog, readLogMtimeMs, isClaudeArgv,
79
79
  } = require('./lib/scheduler/reaperHelpers.cjs');
80
- const { resolveProjectRoot, ensureRuntimeIgnores, RUNTIME_NAMESPACES } = require('./lib/opsOwnership.cjs');
80
+ const { resolveProjectRoot, ensureRuntimeIgnores, RUNTIME_NAMESPACES, opsPath } = require('./lib/opsOwnership.cjs');
81
+ const { BUILTIN_MACROS } = require('./lib/persona-macro/builtinMacros.cjs');
81
82
  const { sweepStrandedJobBranches } = require('./lib/git/branchSweep.cjs');
82
83
  const { detectRateLimitInLog } = require('./lib/claude/rateLimitDetect.cjs');
83
84
  const { stripAppOwnedChurn } = require('./lib/scheduler/jobDirtFilter.cjs');
@@ -192,7 +193,7 @@ const { reconcileEpicWorktreesOnBoot } = require('./lib/epic/epicWorktreeBoot.cj
192
193
  const queueStore = require('./lib/scheduler/queueStore.cjs');
193
194
  const supervisorRecord = require('./lib/scheduler/jobSupervisorRecord.cjs');
194
195
  const adoptedRunSupervisor = require('./lib/scheduler/adoptedRunSupervisor.cjs');
195
- const { splitFrontmatter, parsePrdFile, serializePrdFile } = require('./lib/prd/prdFrontmatter.cjs');
196
+ const { splitFrontmatter, parsePrdFile, serializePrdFile, isArtifactOnlyDeclaration } = require('./lib/prd/prdFrontmatter.cjs');
196
197
  const { applyStructuredPrdPatch } = require('./lib/prd/prdBodyPatch.cjs');
197
198
  const { resolvePersonaDefaultEstimate, DEFAULT_PRD_AGENT_TYPE } = require('./lib/prd/prdAgentType.cjs');
198
199
  const { resolveDepSlug, findNearMatches } = require('./lib/prd/depSlugResolve.cjs');
@@ -305,7 +306,14 @@ const BASH_MAX_TIMEOUT_MS = 900_000; // 15 min — must stay below IDLE_OUTPUT_K
305
306
  // `git add <path>`, the SCHEDULER_VERDICT lines, `/code-review medium --fix`
306
307
  // and the "Never call /code-review with no level, or at xhigh, max or ultra"
307
308
  // ban — PRD 2887: a level-less call took the session's max effort and outlived
308
- // the job budget) — keep them exact. No line
309
+ // the job budget) — keep them exact.
310
+ //
311
+ // `isArtifactOnly: true` (PRD 3109) adds one VERDICT bullet and one COMMIT
312
+ // sentence for a PRD whose frontmatter declares deliverable: artifact +
313
+ // artifactPaths: it commits nothing by design, and runVerify already accepts
314
+ // its no-commit PASS (pass_no_commit_artifact_verified). Without the variant
315
+ // Self job 826-project-home-build saved its page, ran a green gate, and still
316
+ // printed a false FAIL for the missing commit (parked in needs_review). No line
309
317
  // of this text may START with SCHEDULER_VERDICT: or FOREIGN_WIP_PATHS: —
310
318
  // runVerify's scanners are line-anchored.
311
319
  function buildFinishHead(verifyStepNum) {
@@ -370,7 +378,20 @@ const FINISH_FIX_PLAN_VERDICT_LINE = `
370
378
  An auto fix plan whose steps changed no file has nothing to commit
371
379
  and prints PASS when the gate is green. Do not invent a commit to have one.`;
372
380
 
373
- function buildFinishTail({ verifyStepNum, commitStepNum, verdictStepNum, isFixPlan = false }) {
381
+ // Artifact-only VERDICT bullet + COMMIT sentence (PRD 3109): a PRD with
382
+ // deliverable: artifact + artifactPaths commits nothing by design, and
383
+ // runVerify's artifact exemption already accepts its no-commit PASS — so say
384
+ // so, or "PASS needs a landed commit" yields a false FAIL after a green gate.
385
+ const FINISH_ARTIFACT_ONLY_VERDICT_LINE = `
386
+ - This job is artifact-only: its PRD declares deliverable: artifact.
387
+ It commits nothing by design, so no commit is expected. When the
388
+ gate is green and the tree is clean, print PASS. Never print FAIL
389
+ for the missing commit, and do not invent a commit to have one.`;
390
+
391
+ const FINISH_ARTIFACT_ONLY_COMMIT_LINE = `
392
+ This job is artifact-only: its output is git-excluded, so there is nothing to stage. Skip the commit and go to the next step.`;
393
+
394
+ function buildFinishTail({ verifyStepNum, commitStepNum, verdictStepNum, isFixPlan = false, isArtifactOnly = false }) {
374
395
  return `${verifyStepNum}. VERIFY — run every command in the PRD's \`# Gate\` section, in order, in the
375
396
  foreground. Each must exit 0. If the PRD has no \`# Gate\` section, run the
376
397
  project's own typecheck, lint and test commands instead. The project's
@@ -390,13 +411,13 @@ ${commitStepNum}. COMMIT — stage only the exact paths you created or changed f
390
411
  Never commit any file under these folders, even when the PRD names it:
391
412
  ${FINISH_RUNTIME_FOLDERS}
392
413
  Why: those folders hold the app's live state. A commit of them breaks the
393
- running scheduler for every checkout that pulls it.
414
+ running scheduler for every checkout that pulls it.${isArtifactOnly ? FINISH_ARTIFACT_ONLY_COMMIT_LINE : ''}
394
415
  ${verdictStepNum}. VERDICT LINE — end your final report with exactly one of these lines.
395
416
  Put nothing after it, except the FOREIGN_WIP_PATHS line described below.
396
417
  SCHEDULER_VERDICT: PASS
397
418
  SCHEDULER_VERDICT: FAIL <one-line reason>
398
419
  SCHEDULER_VERDICT: BLOCKED_BY_FOREIGN_WIP
399
- - Print PASS only when the gate is green AND the commit from step ${commitStepNum} landed.${isFixPlan ? FINISH_FIX_PLAN_VERDICT_LINE : ''}
420
+ - Print PASS only when the gate is green AND the commit from step ${commitStepNum} landed.${isFixPlan ? FINISH_FIX_PLAN_VERDICT_LINE : ''}${isArtifactOnly ? FINISH_ARTIFACT_ONLY_VERDICT_LINE : ''}
400
421
  - Print FAIL when the gate is red or the commit could not land. Also print
401
422
  FAIL when a step needs something this run cannot reach (live runtime
402
423
  state, credentials, an account or dashboard action, a host install): do
@@ -439,14 +460,20 @@ in your final report.`;
439
460
  * `isFixPlan: true` (auto fix-plan jobs only) adds one VERDICT bullet: a fix
440
461
  * plan that changed no file has nothing to commit and prints PASS on a green
441
462
  * gate. Omitted/false leaves the text unchanged.
463
+ * `isArtifactOnly: true` (PRDs whose own frontmatter has deliverable:
464
+ * artifact + non-empty artifactPaths — PRD 3109) adds one VERDICT bullet
465
+ * (after the fix-plan bullet when both are set) and one COMMIT sentence: the
466
+ * job commits nothing by design and prints PASS on a green gate with a clean
467
+ * tree, never FAIL for the missing commit. Self job 826 printed exactly that
468
+ * false FAIL. Omitted/false leaves the text unchanged.
442
469
  */
443
- function buildFinishProtocol({ reviewInRun = true, isFixPlan = false } = {}) {
470
+ function buildFinishProtocol({ reviewInRun = true, isFixPlan = false, isArtifactOnly = false } = {}) {
444
471
  if (reviewInRun) {
445
472
  return buildFinishHead(3) + FINISH_REVIEW_STEPS_IN_RUN
446
- + buildFinishTail({ verifyStepNum: 3, commitStepNum: 4, verdictStepNum: 5, isFixPlan });
473
+ + buildFinishTail({ verifyStepNum: 3, commitStepNum: 4, verdictStepNum: 5, isFixPlan, isArtifactOnly });
447
474
  }
448
475
  return buildFinishHead(2) + FINISH_REVIEW_STEP_DEFERRED
449
- + buildFinishTail({ verifyStepNum: 2, commitStepNum: 3, verdictStepNum: 4, isFixPlan });
476
+ + buildFinishTail({ verifyStepNum: 2, commitStepNum: 3, verdictStepNum: 4, isFixPlan, isArtifactOnly });
450
477
  }
451
478
 
452
479
  const FINISH_PROTOCOL = buildFinishProtocol({ reviewInRun: true });
@@ -1851,6 +1878,8 @@ async function reconcilePass(state) {
1851
1878
  bodyPreview: p.body.split('\n').slice(0, 6).join('\n'),
1852
1879
  agentType: p.agentType ?? job.agentType ?? null,
1853
1880
  macroId: p.macroId ?? job.macroId ?? null,
1881
+ deliverable: p.deliverable ?? job.deliverable ?? null,
1882
+ artifactPaths: p.artifactPaths ?? job.artifactPaths ?? null,
1854
1883
  effort: p.effort ?? job.effort ?? null,
1855
1884
  };
1856
1885
  // Adopt path: a row parked 'quarantined' (no createdVia provenance when
@@ -1976,6 +2005,8 @@ async function reconcilePass(state) {
1976
2005
  bodyPreview: p.body.split('\n').slice(0, 6).join('\n'),
1977
2006
  agentType: p.agentType ?? inv.row?.agentType ?? null,
1978
2007
  macroId: p.macroId ?? inv.row?.macroId ?? null,
2008
+ deliverable: p.deliverable ?? inv.row?.deliverable ?? null,
2009
+ artifactPaths: p.artifactPaths ?? inv.row?.artifactPaths ?? null,
1979
2010
  effort: p.effort ?? inv.row?.effort ?? null,
1980
2011
  };
1981
2012
  const reason = `reconcile: repaired invalid status ${JSON.stringify(oldStatus)}`;
@@ -2129,6 +2160,8 @@ async function reconcilePass(state) {
2129
2160
  bodyPreview: p.body.split('\n').slice(0, 6).join('\n'),
2130
2161
  agentType: p.agentType ?? null,
2131
2162
  macroId: p.macroId ?? null,
2163
+ deliverable: p.deliverable ?? null,
2164
+ artifactPaths: p.artifactPaths ?? null,
2132
2165
  effort: p.effort ?? null,
2133
2166
  status: 'pending',
2134
2167
  // Enqueue time (PRD 1086/1087): the cross-project fairness tiebreak and
@@ -3193,9 +3226,9 @@ function applyOrphanOutcome(job, outcome, killNote = '', confirmedLandedCommit =
3193
3226
 
3194
3227
  function applyOrphanOutcomeInner(job, outcome, killNote, confirmedLandedCommit, snap, now) {
3195
3228
  // A reported 'success' completes only on landed-commit evidence, or for a
3196
- // DECLARED artifact-only PRD (`deliverable: artifact` + artifactPaths — same
3197
- // check as runVerify's artifact exemption) where no commit is legitimate.
3198
- const artifactOnly = job.deliverable === 'artifact' && Array.isArray(job.artifactPaths) && job.artifactPaths.length > 0;
3229
+ // DECLARED artifact-only PRD (`deliverable: artifact` + artifactPaths — the
3230
+ // shared isArtifactOnlyDeclaration predicate) where no commit is legitimate.
3231
+ const artifactOnly = isArtifactOnlyDeclaration(job);
3199
3232
  if (outcome === 'success' && (confirmedLandedCommit || artifactOnly)) {
3200
3233
  if (confirmedLandedCommit) {
3201
3234
  transitionJob(job, 'completed', { reason: `boot orphan reconciliation: run succeeded, landedCommit ${confirmedLandedCommit} resolves`, source: 'applyOrphanOutcome:landed' });
@@ -3450,6 +3483,77 @@ function armSettleAfterValidatorBudgetKill(job, { scheduleSettle = defaultSchedu
3450
3483
  }
3451
3484
  }
3452
3485
 
3486
+ // PRD 3116: a macro's background-build PRD (frontmatter `macroId`) ends with
3487
+ // a DONE/FAILED notice naming what was saved, not the generic "PRD finished"
3488
+ // line — the generic line read as "idle" and owners typed into the Epic to
3489
+ // "start" a build that had already finished.
3490
+ const MACRO_ARTIFACT_RE = /^session-manager-operations\/project-pages\/(videos|knowledge)\/([a-z0-9-]+)\/index\.html$/;
3491
+ const MACRO_META_MAX_BYTES = 256 * 1024;
3492
+
3493
+ function macroLabelFor(prd) {
3494
+ const builtin = BUILTIN_MACROS.find((m) => m && m.id === prd.macroId);
3495
+ if (builtin && typeof builtin.label === 'string' && builtin.label) return builtin.label;
3496
+ const title = typeof prd.title === 'string' ? prd.title.replace(/:\s*background build\s*$/i, '').trim() : '';
3497
+ return title || prd.macroId;
3498
+ }
3499
+
3500
+ /**
3501
+ * readMacroBuildOutput(cwd, prd) → { kind, id, title, meta } | null
3502
+ * Never throws. The entry id must match /^[a-z0-9-]+$/; the meta.json path is
3503
+ * built with opsPath, never from the raw frontmatter string.
3504
+ */
3505
+ function readMacroBuildOutput(cwd, prd) {
3506
+ try {
3507
+ if (!cwd) return null;
3508
+ const first = Array.isArray(prd.artifactPaths) ? prd.artifactPaths[0] : null;
3509
+ if (typeof first !== 'string') return null;
3510
+ const m = MACRO_ARTIFACT_RE.exec(first.trim());
3511
+ if (!m) return null;
3512
+ const dir = m[1];
3513
+ const id = m[2];
3514
+ const metaPath = opsPath(cwd, 'project-pages', dir, id, 'meta.json');
3515
+ const st = fs.statSync(metaPath);
3516
+ if (!st.isFile() || st.size > MACRO_META_MAX_BYTES) return null;
3517
+ const meta = JSON.parse(fs.readFileSync(metaPath, 'utf8'));
3518
+ if (!meta || typeof meta !== 'object' || typeof meta.title !== 'string' || !meta.title.trim()) return null;
3519
+ return { kind: dir === 'videos' ? 'video' : 'knowledge', id, title: meta.title.trim(), meta };
3520
+ } catch {
3521
+ return null;
3522
+ }
3523
+ }
3524
+
3525
+ /**
3526
+ * macroBuildNotice(job, prd) → { message, notice, buildOutput? } | null
3527
+ * null for any PRD without a `macroId`, or a status other than completed/failed.
3528
+ */
3529
+ function macroBuildNotice(job, prd) {
3530
+ if (!prd || typeof prd.macroId !== 'string' || !prd.macroId) return null;
3531
+ if (job.status !== 'completed' && job.status !== 'failed') return null;
3532
+ const label = macroLabelFor(prd);
3533
+ if (job.status === 'failed') {
3534
+ const reason = job.error || job.verifierVerdict || job.status;
3535
+ return {
3536
+ message: `FAILED — ${label}: the background build failed (${reason}). Press it again in Project Home to retry.`,
3537
+ notice: 'build-failed',
3538
+ };
3539
+ }
3540
+ const out = readMacroBuildOutput(job.cwd, prd);
3541
+ if (!out) return { message: `DONE — ${label} finished.`, notice: 'build-done' };
3542
+ const buildOutput = { kind: out.kind, id: out.id, title: out.title };
3543
+ if (out.kind === 'video') {
3544
+ return {
3545
+ message: `DONE — ${label}: “${out.title}” is saved (${out.meta.lengthS} s · ${out.meta.style}). Watch it in Project Home ▸ Videos.`,
3546
+ notice: 'build-done',
3547
+ buildOutput,
3548
+ };
3549
+ }
3550
+ return {
3551
+ message: `DONE — ${label}: “${out.title}” is saved. Read it in Project Home ▸ Pages.`,
3552
+ notice: 'build-done',
3553
+ buildOutput,
3554
+ };
3555
+ }
3556
+
3453
3557
  /**
3454
3558
  * notifyOriginatingTab(job) → void
3455
3559
  *
@@ -3508,6 +3612,8 @@ async function notifyOriginatingTab(job, {
3508
3612
  message = `PRD ${job.slug} was skipped: its PRD source could not be found on disk. Blocked dependents: ${shown}${more}.`
3509
3613
  + ' If the PRD file exists, run scheduler_reset_job with force:true; if it was intentionally removed, archive it with scheduler_archive_prd.';
3510
3614
  }
3615
+ const macroNotice = macroBuildNotice(job, prd);
3616
+ if (macroNotice) message = macroNotice.message;
3511
3617
 
3512
3618
  // The EPIC this check-in belongs to. Deliberately does NOT consider
3513
3619
  // `sourceTabId` — that is a Terminal tab id, not an Epic id, and
@@ -3609,6 +3715,8 @@ async function notifyOriginatingTab(job, {
3609
3715
  outcome: job.status,
3610
3716
  validation: 'unvalidated',
3611
3717
  ...(typeof job.agentType === 'string' ? { agentType: job.agentType } : {}),
3718
+ ...(macroNotice ? { notice: macroNotice.notice } : {}),
3719
+ ...(macroNotice && macroNotice.buildOutput ? { buildOutput: macroNotice.buildOutput } : {}),
3612
3720
  }).catch((e) => {
3613
3721
  console.error('[scheduler] notifyOriginatingTab appendResponseEvent error', job?.slug, e);
3614
3722
  return false;
@@ -4884,7 +4992,20 @@ async function executeJob(job, runDir, defaultCwd, onPid, execCwd, resumeTarget
4884
4992
  // Always route through composeExecutorPrompt (even with an empty digest)
4885
4993
  // so the finish protocol is appended in the prompt's tail exactly once,
4886
4994
  // after any digest fence rather than concatenated ahead of it.
4887
- prompt = composeExecutorPrompt({ prdBody: prompt, digestText, finishProtocol: buildFinishProtocol({ reviewInRun, isFixPlan: resolveIsFixPlan(job.slug, job.isFixPlan) }) });
4995
+ // Artifact-only finish variant (PRD 3109): read from the PRD FILE's own
4996
+ // frontmatter — queue rows and parsePrd()'s result carry no
4997
+ // deliverable/artifactPaths, so job.* would always be false. Uses the shared
4998
+ // isArtifactOnlyDeclaration predicate; any read/parse failure → false.
4999
+ let isArtifactOnly = false;
5000
+ if (prdPath) {
5001
+ try {
5002
+ const fm = parsePrdFile(await fsp.readFile(prdPath, 'utf8')).frontmatter;
5003
+ isArtifactOnly = isArtifactOnlyDeclaration(fm);
5004
+ } catch {
5005
+ isArtifactOnly = false;
5006
+ }
5007
+ }
5008
+ prompt = composeExecutorPrompt({ prdBody: prompt, digestText, finishProtocol: buildFinishProtocol({ reviewInRun, isFixPlan: resolveIsFixPlan(job.slug, job.isFixPlan), isArtifactOnly }) });
4888
5009
 
4889
5010
  // Foreign-WIP manifest (starry-night-ships PRD 148 postmortem): the
4890
5011
  // scheduler already knows, at spawn time, which dirty paths this job did
@@ -8959,7 +9080,6 @@ async function reapDeadRunningJobs() {
8959
9080
  // -1 commit count or a missing checkout (runMadeCommit null) or an
8960
9081
  // unreadable status (dirt null) keeps the pre-guard behaviour.
8961
9082
  if (runMadeCommit !== null && dirt !== null) {
8962
- const artifactPaths = row.artifactPaths;
8963
9083
  const guardVerdict = commitGuardVerdict({
8964
9084
  newlyDirty: dirt,
8965
9085
  siblingRunning: false,
@@ -8967,7 +9087,7 @@ async function reapDeadRunningJobs() {
8967
9087
  jobSelfCommitted: runMadeCommit,
8968
9088
  legitimateNoOp: false,
8969
9089
  isFixPlanJob: resolveIsFixPlan(d.slug, row.isFixPlan),
8970
- artifactVerified: row.deliverable === 'artifact' && Array.isArray(artifactPaths) && artifactPaths.length > 0,
9090
+ artifactVerified: isArtifactOnlyDeclaration(row),
8971
9091
  verifyResult: null,
8972
9092
  salvagePatch,
8973
9093
  });
@@ -11610,6 +11730,8 @@ async function listPrdsInternal({ cwd: rawCwd } = {}) {
11610
11730
  dependsOn: parsed.dependsOn ?? null,
11611
11731
  agentType: parsed.agentType ?? null,
11612
11732
  macroId: parsed.macroId ?? null,
11733
+ deliverable: parsed.deliverable ?? null,
11734
+ artifactPaths: parsed.artifactPaths ?? null,
11613
11735
  effort: parsed.effort ?? null,
11614
11736
  disposition: parsed.disposition ?? null,
11615
11737
  planId: parsed.planId ?? null,
@@ -1,4 +1,4 @@
1
- <!-- PRD_AUTHORING.md v19 -->
1
+ <!-- PRD_AUTHORING.md v20 -->
2
2
  # PRD Authoring Guide — Scheduler Safety Rules
3
3
 
4
4
  Rule: every PRD you queue follows the rules below.
@@ -189,7 +189,7 @@ timeout 120 python -m pytest tests/test_repro.py::test_bug 2>&1 | tail -3 || tru
189
189
  timeout 300 pytest -q # LAST thing the run does
190
190
  ```
191
191
 
192
- The scheduler appends a finish protocol after your PRD's own steps — you never write it: review, then the `# Gate` commands (§6), then commit only the exact paths you created or changed for this PRD, then the verdict line — `SCHEDULER_VERDICT: PASS` once the gate is green and the commit landed, else `SCHEDULER_VERDICT: FAIL <one-line reason>`. Never print `PASS` on a red gate.
192
+ The scheduler appends a finish protocol after your PRD's own steps — you never write it: review, then the `# Gate` commands (§6), then commit only the exact paths you created or changed for this PRD, then the verdict line — `SCHEDULER_VERDICT: PASS` once the gate is green and the commit landed (an artifact-only PRD, §5, lands no commit by design and prints `PASS` once the gate is green and the tree is clean), else `SCHEDULER_VERDICT: FAIL <one-line reason>`. Never print `PASS` on a red gate.
193
193
 
194
194
  ---
195
195
 
@@ -793,6 +793,9 @@ export interface ScheduleJobRuntime {
793
793
 
794
794
  export interface ScheduleJob {
795
795
  macroId?: string | null;
796
+ /** PRD frontmatter artifact-only declaration (PRD 3114). */
797
+ deliverable?: 'artifact' | null;
798
+ artifactPaths?: string[] | null;
796
799
  slug: string;
797
800
  title: string;
798
801
  cwd: string | null;
@@ -3008,8 +3011,11 @@ export interface PromptSessionEventAppendedPayload {
3008
3011
  at: string;
3009
3012
  prdSlug?: string;
3010
3013
  text?: string;
3011
- /** 'job-not-queued' = a macro's background build could not be queued for this Epic (macroJobIpc.cjs). */
3012
- notice?: 'job-not-queued';
3014
+ /** 'job-not-queued' = a macro's background build could not be queued for this Epic (macroJobIpc.cjs);
3015
+ * 'build-done' / 'build-failed' = a macro's background-build PRD finished (scheduler.cjs notifyOriginatingTab). */
3016
+ notice?: 'job-not-queued' | 'build-done' | 'build-failed';
3017
+ /** The saved Project Home entry a 'build-done' notice names, when its meta.json was readable. */
3018
+ buildOutput?: { kind: 'video' | 'knowledge'; id: string; title: string };
3013
3019
  };
3014
3020
  }
3015
3021
 
@@ -5,7 +5,7 @@ tools: Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__proj
5
5
  title: Project Home — Builder
6
6
  model: sonnet
7
7
  effort: medium
8
- seedVersion: 5
8
+ seedVersion: 6
9
9
  ---
10
10
 
11
11
  You are the project-home-builder. You write ONE Knowledge Page per run. The page you produce is often the first thing a person sees
@@ -77,7 +77,9 @@ Produce exactly one complete HTML document:
77
77
  5. Call `project_page_write` exactly once with `{ pageId: <Entry id>, title, topic, htmlPath or html }`
78
78
  (use `htmlPath`, an absolute path to a .html file you wrote, for a large document). It
79
79
  validates the document and writes it as that Knowledge Page.
80
- 6. Report back in one or two lines what the page covers.
80
+ 6. Report back in one or two lines what the page covers. When this runs as a scheduled build, its
81
+ PRD forbids committing, so no commit is the expected result: once `project_page_write` returned
82
+ ok and the PRD's gate exits 0, end with SCHEDULER_VERDICT: PASS, never FAIL for the missing commit.
81
83
  </process>
82
84
 
83
85
  <when_things_fail>