create-pmos 0.689.0 → 0.691.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 (34) hide show
  1. package/package.json +15 -3
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +14 -2
  7. package/workspace/guide/cli.md +7 -0
  8. package/workspace/guide/initiatives-and-next-steps.md +13 -1
  9. package/workspace/guide/settings-and-switches.md +1 -1
  10. package/workspace/lib/autonomy.js +41 -9
  11. package/workspace/lib/change-record.js +303 -0
  12. package/workspace/lib/default-decisions.js +2 -1
  13. package/workspace/lib/driver-decide.js +6 -3
  14. package/workspace/lib/factory-cli.js +58 -0
  15. package/workspace/lib/improve-runs.js +7 -4
  16. package/workspace/lib/initiative-premium.js +7 -4
  17. package/workspace/lib/kind-scope.js +73 -0
  18. package/workspace/lib/pmos-verbs.js +3 -0
  19. package/workspace/lib/proposals.js +5 -1
  20. package/workspace/lib/routes-intake.js +7 -3
  21. package/workspace/lib/routes-proposals.js +5 -2
  22. package/workspace/lib/settings-store.js +3 -0
  23. package/workspace/lib/source-guard.js +26 -1
  24. package/workspace/package-lock.json +2 -2
  25. package/workspace/package.json +1 -1
  26. package/workspace/public/pm/bd-asks.js +4 -3
  27. package/workspace/public/pm/bd-ini-panel.js +1 -1
  28. package/workspace/public/pm/cozy-settings.js +9 -0
  29. package/workspace/public/pm/home-app.js +1 -1
  30. package/workspace/public/pm/home-ini-model.js +1 -1
  31. package/workspace/public/pm/home-ini.js +6 -3
  32. package/workspace/public/pm/premium-initiative-head.js +17 -6
  33. package/workspace/test-lists/kind-scopes-lifecycle-stages.json +9 -0
  34. package/workspace/test-lists/one-change-record-no-source-no-auto.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.689.0",
3
+ "version": "0.691.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.689.0",
38
- "at": "2026-11-22T09:16:40.013Z",
37
+ "v": "0.691.0",
38
+ "at": "2026-11-22T09:21:12.074Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
@@ -49,6 +49,18 @@
49
49
  "t": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
50
50
  "s": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
51
51
  "k": "new"
52
+ },
53
+ {
54
+ "n": 1501,
55
+ "t": "Kind marks each lifecycle stage owned, watched or hidden",
56
+ "s": "Kind marks each lifecycle stage owned, watched or hidden",
57
+ "k": "new"
58
+ },
59
+ {
60
+ "n": 1503,
61
+ "t": "One record of every agent change, and no source, no auto (A443)",
62
+ "s": "One record of every agent change, and no source, no auto (A443)",
63
+ "k": "new"
52
64
  }
53
65
  ]
54
66
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@a41a0c46
1
+ kernel-source: pmos@b0fe23dc
2
2
  assembled: 2026-11-22
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-22T09:16:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:21:09Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-22T09:16:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:21:09Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-22T09:16:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:21:09Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
- "v": "0.689.0",
4
- "at": "2026-11-22T09:16:40.013Z",
3
+ "v": "0.691.0",
4
+ "at": "2026-11-22T09:21:12.074Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
@@ -15,6 +15,18 @@
15
15
  "t": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
16
16
  "s": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
17
17
  "k": "new"
18
+ },
19
+ {
20
+ "n": 1501,
21
+ "t": "Kind marks each lifecycle stage owned, watched or hidden",
22
+ "s": "Kind marks each lifecycle stage owned, watched or hidden",
23
+ "k": "new"
24
+ },
25
+ {
26
+ "n": 1503,
27
+ "t": "One record of every agent change, and no source, no auto (A443)",
28
+ "s": "One record of every agent change, and no source, no auto (A443)",
29
+ "k": "new"
18
30
  }
19
31
  ]
20
32
  },
@@ -205,6 +205,13 @@ Before you share a spec, a strategy, a roadmap or a report, PMOS reads it as a s
205
205
 
206
206
  [What PMOS does behind the scenes](agent-capabilities.md) lists the jobs and their queue names.
207
207
 
208
+ ### pmos factory: everything PMOS changed by itself
209
+
210
+ - `pmos factory today` shows one record of every change PMOS made: for each line (product, project, SDLC) and station, how many changes, how many PMOS applied by itself, how many were kept, undone or ignored, how many cite no source, and how many background runs it used.
211
+ - `pmos factory today --days 7` shows the last 7 days. `--json` prints the totals.
212
+ - `pmos factory today --unsourced` prints one number on its last line: the percent of changes PMOS applied by itself that cite no source.
213
+ - A change that cites no source never applies by itself. It waits for you, as a change others see does.
214
+
208
215
  ### pmos autonomy: what agents applied by themselves
209
216
 
210
217
  - `pmos autonomy status` lists what agents applied in the last 14 days (D106), each with its id, and the jobs that went back to propose.
@@ -148,7 +148,7 @@ The writer makes the record in `planning/initiatives/<id>.md` with its type, tit
148
148
  - **Full SDLC.** From idea to shipped. Where a factory runs in the repository, PMOS also builds it, as pull requests. The product's guardrail check merges the safe ones and leaves the rest for you. Elsewhere PMOS writes the done test and the pull request plan, and the team's agents build it. A factory runs where the repository has `planning/work-items.jsonl` and `scripts/verify-work.js`. A repository made with `create-pmos` has no factory yet.
149
149
  - **Project.** Project management. Others do the work. PMOS chases, syncs the dates and reports.
150
150
 
151
- PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is Product.
151
+ PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is the one set in **Settings › General › New work starts as** (Product if you did not set it).
152
152
 
153
153
  The kind is saved as `kind:` in the record (`product`, `sdlc` or `project`). An older record with no `kind:` line reads as Product. Use `pmos initiative new --kind <kind>` to set it from a terminal. The kind is not a lane, but it sets the workflow and the gate that the initiative starts on:
154
154
 
@@ -162,6 +162,18 @@ Project and Full SDLC are built in, beside Product feature, under **Settings ›
162
162
 
163
163
  When you change the kind, an initiative that runs its old kind's workflow moves to the new kind's. Its stage maps by meaning: Plan to Plan, Build to Execute, Deliver or Release to Close. A gate that it passed stays passed. One line in the initiative says what changed, for example "Kind changed to Project from Product: the Plan gate now needs milestone dates, owners and a go-live that matches the KR." An initiative on a workflow that you picked yourself stays on it.
164
164
 
165
+ **What each kind shows.** The kind decides how far your work reaches along the eight stages. For each stage, PMOS drives it with you (owned), reads it from where others do it (watched), or leaves it out of view (hidden):
166
+
167
+ | Stage | Project | Product | Full SDLC |
168
+ |---|---|---|---|
169
+ | Triage, Discover | Hidden | Owned | Owned |
170
+ | Plan, Prioritize | Owned | Owned | Owned |
171
+ | Build | Watched, from Jira | Watched, from Jira | Owned: PMOS builds it where a factory runs |
172
+ | Deliver, Monitor, Evaluate | Owned | Owned | Owned |
173
+ | Gate | Plan before start | PRD and done test before build | Done test and kill before build |
174
+
175
+ A Project initiative also hides the product documents: the problem statement, research notes, PRD, eval rubric and design. It shows no PRD gate; its gate is the Plan gate in **Project control**. Hidden is never removed. The stage ladder leaves Triage and Discover out (6 stages), but the stage the initiative is in always shows, and **Move to a stage** still lists every stage. In **Documents**, the hidden documents are in a closed **Product documents** section at the end. Open it to read or draft them.
176
+
165
177
  **Project control.** A Project initiative shows **Project control** at the top of the initiative:
166
178
 
167
179
  - **On track for <date>?** The answer comes from the task dates and the task links. The date is the KR's date, else the end, else the date in the title. On a No, it names the forecast, the slip and the task that causes it.
@@ -11,7 +11,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
11
11
 
12
12
  | Section | What it holds |
13
13
  |---|---|
14
- | General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
14
+ | General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, **New work starts as** (Product, Project or Full SDLC: the kind a new initiative starts as when its name gives no hint; see [what each kind shows](initiatives-and-next-steps.md)), when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
15
15
  | How PMOS decides | One suggestion from PMOS when it sees a pattern in what you kept, each kind of change PMOS makes by itself, the calls that are **Always yours**, and PMOS's **Lessons**. |
16
16
  | Checks | When PMOS grills an initiative by itself and the monthly credit for its checks. |
17
17
  | Prototype rules | What every prototype version is checked for before you see it. |
@@ -29,6 +29,12 @@
29
29
  *
30
30
  * CLASSES · DRIVER_CLASS · PROPOSAL_CLASS · DEMOTE_DAYS · UNDO_DAYS · RATE_LIMIT · RATE_MIN
31
31
  * classOfDriver(what) · classOfProposal(p) → 'A' | 'B' | 'C'
32
+ * classOfDriverProposal(p) → 'A' | 'B' | 'C' classOfDriver plus the source rule
33
+ *
34
+ * NO SOURCE, NO AUTO (initiative one-change-record-no-source-no-auto, idea A443). In every job kind, a change that cites nothing
35
+ * (lib/source-guard.js citedOf: no source, no item or claim source, a link guessed from the plan, "No reason found") is class C: it waits
36
+ * for the PM. decide() takes the change's `sources` and refuses an auto apply when they are given and empty; recordApplied keeps them as
37
+ * `src`, so lib/change-record.js counts unsourced changes without a join. Every refusal logs one [no-source-no-auto] line.
32
38
  * file(stateDir) · read(stateDir) → lines · fold(lines, { now }) → state the ledger
33
39
  * recordApplied(stateDir, { job, product, ref, title, cls, ini?, why?, run? }, { now, settingsDir }) writes the way the job acted with
34
40
  * (wayAt: quiet or show, the kept count, the PM's setting), so the line can say why it was quiet
@@ -117,9 +123,18 @@ function waysSet(settingsDir) {
117
123
  const autoWay = ({ kept = 0, demoted = false } = {}) => (demoted ? 'ask' : kept >= SHOW_UNTIL ? 'quiet' : 'show');
118
124
 
119
125
  const classOfDriver = (what) => DRIVER_CLASS[what] || 'C';
126
+ const SG = () => require('./source-guard.js');
127
+ /** A Driver proposal's class: its kind's class, and C when it cites no source (no source, no auto). */
128
+ function classOfDriverProposal(p) {
129
+ if (!isObj(p)) return 'C';
130
+ const c = classOfDriver(p.what);
131
+ return c !== 'C' && !SG().citedOf(p).length ? 'C' : c;
132
+ }
120
133
  function classOfProposal(p) {
121
134
  if (!isObj(p)) return 'C';
122
135
  const c = PROPOSAL_CLASS[p.group] || 'C';
136
+ // no source, no auto, in every group (A443): the plan groups' finer rule below (two kinds for a big change) still applies
137
+ if (c !== 'C' && p.group !== 'build' && !SG().citedOf(p).length) return 'C';
123
138
  // act-alone-only-with-a-source: a plan change with no source, or a close, rename or big date move on one kind of source, is the owner's
124
139
  // question (lib/source-guard.js); it joins the day's question list instead of applying by itself
125
140
  if (c !== 'C' && require('./source-guard.js').holdOf(p)) return 'C';
@@ -130,7 +145,7 @@ function classOfProposal(p) {
130
145
  // a live round's prototype (lib/live-round.js, data.live) is the PM's to keep: PMOS never keeps one by itself (2026-11-18: a test round it
131
146
  // kept became the initiative's design). The newest version is the prototype anyway (lib/proposals.js currentOf).
132
147
  if ((p.group === 'prototyped' || p.group === 'improved') && isObj(p.data) && isObj(p.data.live)) return 'C';
133
- if (p.group === 'build') return 'B'; // stopping or replacing an experiment is the PM's call (launch simulation W2)
148
+ if (p.group === 'build') return SG().citedOf(p).length ? 'B' : 'C'; // stopping or replacing an experiment is the PM's call (launch simulation W2)
134
149
  // a maybe, or a duplicate already in another initiative (type link, or an item with `other`), is a question for the PM, not a change
135
150
  // found type stage moves the initiative's stage: a stage move is C (as the Driver's `move`)
136
151
  if (p.group === 'found' && (p.type === 'stage' || p.type === 'maybe' || p.type === 'link' || (p.items || []).some((x) => x && x.other))) return 'C';
@@ -172,7 +187,7 @@ function fold(lines) {
172
187
  const j = get(l.job, l.product);
173
188
  if (l.ev === 'applied') {
174
189
  const a = { ref: l.ref || null, title: l.title || '', cls: l.cls || null, job: l.job, product: l.product || null, ini: l.ini || null, why: l.why || '', at: l.at, undone: false, undoneAt: null,
175
- run: l.run || null, rec: WAYS.includes(l.way) && Number.isInteger(l.kept) ? { way: l.way, kept: l.kept, set: l.set === true } : null, checked: null };
190
+ run: l.run || null, src: Array.isArray(l.src) ? l.src : null, rec: WAYS.includes(l.way) && Number.isInteger(l.kept) ? { way: l.way, kept: l.kept, set: l.set === true } : null, checked: null };
176
191
  j.applied.push(a);
177
192
  if (a.ref) applied.set(a.ref, a);
178
193
  } else if (l.ev === 'setback') {
@@ -221,11 +236,14 @@ function wayAt(stateDir, job, product, { settingsDir = null } = {}) {
221
236
  return own && own !== 'ask' ? { way: own, kept, set: true } : { way: autoWay({ kept }), kept, set: false };
222
237
  }
223
238
 
224
- function recordApplied(stateDir, { job, product, ref, title, cls, ini, why, run }, { now, settingsDir = null } = {}) {
239
+ /** src: what the change cited (labels, or { label, ref } sources); kept as up to 3 labels, [] when it cited nothing (lib/change-record.js). */
240
+ const srcOf = (src) => (Array.isArray(src) ? [...new Set(src.map((s) => (isObj(s) ? s.label || s.ref : s)).filter((s) => typeof s === 'string' && s.trim()).map((s) => one(s, 80)))].slice(0, 3) : null);
241
+ function recordApplied(stateDir, { job, product, ref, title, cls, ini, why, run, src }, { now, settingsDir = null } = {}) {
225
242
  if (!JOB_RE.test(String(job || ''))) return null;
226
243
  const w = wayAt(stateDir, job, product, { settingsDir });
244
+ const s = srcOf(src);
227
245
  return append(stateDir, { ev: 'applied', job, product: product || null, ref: ref ? one(ref, 120) : null, title: one(title, 200), cls: CLASSES.includes(cls) ? cls : null,
228
- ...(ini ? { ini: one(ini, 80) } : {}), ...(why ? { why: one(why, 200) } : {}), ...(run ? { run: one(run, 80) } : {}),
246
+ ...(ini ? { ini: one(ini, 80) } : {}), ...(why ? { why: one(why, 200) } : {}), ...(run ? { run: one(run, 80) } : {}), ...(s ? { src: s } : {}),
229
247
  way: w.way, kept: w.kept, ...(w.set ? { set: true } : {}) }, { now });
230
248
  }
231
249
 
@@ -252,11 +270,24 @@ function killed({ env = process.env, settingsDir = null } = {}) {
252
270
  return null;
253
271
  }
254
272
 
255
- function decide({ stateDir, job, product, cls, mode = 'auto', undoable = true, now, env = process.env, settingsDir = null } = {}) {
273
+ const NO_SOURCE_WHY = 'no source: the change cites nothing, so PMOS asks instead of applying it';
274
+ const logged = new Set();
275
+ /** One [no-source-no-auto] log line per held change per process (the health log of one-change-record-no-source-no-auto). */
276
+ function logHeld(job, product, ref, { log = console.error } = {}) {
277
+ const k = `${job}|${product || '*'}|${ref || ''}`;
278
+ if (logged.has(k)) return false;
279
+ if (logged.size > 5000) logged.clear();
280
+ logged.add(k);
281
+ try { log(`[no-source-no-auto] held ${job}${product ? ' on ' + product : ''}${ref ? ' ' + one(ref, 80) : ''}: it cites no source`); } catch { /* a log never stops the apply step */ }
282
+ return true;
283
+ }
284
+ /** sources: what the change cites (lib/source-guard.js citedOf). Given and empty: no source, no auto, whatever the class. */
285
+ function decide({ stateDir, job, product, cls, mode = 'auto', undoable = true, now, env = process.env, settingsDir = null, sources } = {}) {
256
286
  const k = killed({ env, settingsDir });
257
287
  if (k) return { apply: false, why: k };
258
288
  if (mode !== 'auto') return { apply: false, why: `the mode is ${mode}` };
259
- if (cls === 'C' || !CLASSES.includes(cls)) return { apply: false, why: 'class C: seen by others or not reversible, so it waits for the daily press' };
289
+ if (cls === 'C' || !CLASSES.includes(cls)) return { apply: false, why: 'class C: seen by others or not reversible, so it waits for the daily press', ...(Array.isArray(sources) && !sources.length ? { nosrc: true } : {}) };
290
+ if (Array.isArray(sources) && !sources.length) return { apply: false, why: NO_SOURCE_WHY, nosrc: true };
260
291
  if (!undoable) return { apply: false, why: 'no Undo for this change, so it waits' };
261
292
  const set = waysSet(settingsDir)[kindOf(job)];
262
293
  if (set === 'ask') return { apply: false, why: 'you set this kind to Ask first' };
@@ -270,9 +301,10 @@ function decide({ stateDir, job, product, cls, mode = 'auto', undoable = true, n
270
301
 
271
302
  /** For a caller with no mode of its own (a role agent, an AI job): does class `cls` apply by itself now? With `stateDir` and `job`
272
303
  * the demotion of that job counts too. Class C never does. */
273
- function autoFor(cls, { stateDir = null, job = null, product = null, undoable = true, now, env = process.env, settingsDir = null } = {}) {
304
+ function autoFor(cls, { stateDir = null, job = null, product = null, undoable = true, now, env = process.env, settingsDir = null, sources } = {}) {
305
+ if (Array.isArray(sources) && !sources.length) return false; // no source, no auto
274
306
  if (!stateDir || !job) return !killed({ env, settingsDir }) && (cls === 'A' || cls === 'B') && !!undoable;
275
- return decide({ stateDir, job, product, cls, mode: 'auto', undoable, now, env, settingsDir }).apply;
307
+ return decide({ stateDir, job, product, cls, mode: 'auto', undoable, now, env, settingsDir, sources }).apply;
276
308
  }
277
309
 
278
310
  function notices(stateDir, { now } = {}) {
@@ -414,5 +446,5 @@ function restore(stateDir, { job, product }, actor, { now } = {}) {
414
446
  module.exports = {
415
447
  wayAt, toCheck, recordCheck, fromRuns, VERDICTS, WAYS, SHOW_UNTIL, KIND_LIST, kindOf, waysSet, autoWay, kindsOf,
416
448
  LEDGER, CLASSES, DRIVER_CLASS, PROPOSAL_CLASS, DEMOTE_DAYS, UNDO_DAYS, RATE_LIMIT, RATE_MIN, KINDS,
417
- classOfDriver, classOfProposal, killed, autoFor, file, read, fold, recordApplied, reasonOf, recordSetback, decide, demotedNow, notices, markSeen, done, undoOpen, restore,
449
+ classOfDriver, classOfDriverProposal, classOfProposal, NO_SOURCE_WHY, logHeld, srcOf, killed, autoFor, file, read, fold, recordApplied, reasonOf, recordSetback, decide, demotedNow, notices, markSeen, done, undoOpen, restore,
418
450
  };
@@ -0,0 +1,303 @@
1
+ 'use strict';
2
+ /* change-record.js — one record of every agent change (initiative one-change-record-no-source-no-auto; idea A443; the factory grill
3
+ * W24NtYWFttw8DkqFVuoJCB, slice 1). READ-ONLY: this file never writes a line anywhere.
4
+ *
5
+ * PMOS changes a product by itself from six ledgers, each with its own writer: autonomy.jsonl (what an agent applied, lib/autonomy.js),
6
+ * proposals.jsonl (the ✦, lib/proposals.js), driver.jsonl (the Initiative Driver, lib/driver.js), bg-queue.jsonl (the background runs,
7
+ * lib/bg-queue.js), the outbox (drafts to people, lib/outbox-store.js) and each initiative's outcome check date (its record's
8
+ * outcome_horizon). This folds them into ONE ROW PER CHANGE, so a PM can see in one place what PMOS changed, why, and whether it held.
9
+ *
10
+ * rows(input, { now }) → { rows, runs } PURE. input: { autonomy, proposals, driver, bgQueue, outbox: raw ledger lines; checks: { ini: date } }
11
+ * read(root, { runtimeDir }) → input reads the ledgers of one repository (any layout lib/driver.js stateDirOf knows), no write
12
+ * summary(rows, runs, { now, days }) → { from, lines: [{ line, station, changes, applied, kept, undone, ignored, unsourced, runs }],
13
+ * total, placed, joined, unsourced_pct }
14
+ *
15
+ * A ROW: { at, line, station, job, product, ini, ref, title, cls, state, source: [label], sourced, joined, check }
16
+ * line pm (product decisions: problem, evidence, outcome, description, what was found, grill, the idle lab, role agents, goal loops)
17
+ * · project (the plan and its status: dates, done, names, links, stage moves, defaults, sends) · sdlc (the factory's builds)
18
+ * station the module that made it: Proposals, Driver, Defaults, Role agents, Goal loops, Lessons, Outbox, Factory
19
+ * state proposed · applied (by an agent, inside its 14-day Undo) · kept (by the PM, or applied and past its Undo) · undone · dropped
20
+ * · expired (a ✦ nobody answered) · sent (outbox)
21
+ * sourced true: it cites a source. false: it cites none ("No reason found", an empty reason). The applied line's own `src` decides when
22
+ * the ledger has it (lib/autonomy.js recordApplied, from this build on); else what its origin (✦ or Driver proposal) cites;
23
+ * else a reason that names a source kind (lib/source-guard.js kindOf). Nothing found counts as unsourced.
24
+ * joined the applied line was matched to its origin. Keys, in order: its ref is a ✦ keep batch, a kept ✦ id, or a Driver proposal id;
25
+ * else the ✦ keep (auto) or Driver keep (auto) of the same initiative and job within JOIN_MS of it (A443: on Scarlet only
26
+ * 10 of 57 refs joined by batch, so the ref alone is not enough). A row that joins nothing is still placed by its job.
27
+ * check the initiative's outcome check date, when its record names one
28
+ *
29
+ * A change PMOS applied by itself is one row even though it is in two ledgers (the applied line and its ✦ or Driver keep).
30
+ * The source rule the rows measure lives in lib/autonomy.js (no source, no auto). */
31
+ const fs = require('fs');
32
+ const path = require('path');
33
+
34
+ const DAY = 86400000;
35
+ const JOIN_MS = 3 * 60 * 1000;
36
+ const UNDO_DAYS = 14;
37
+ const IGNORED_MS = 3 * DAY; // a proposal nobody answered for 3 days is ignored (the grill's draft expiry is 72 hours)
38
+ const LINES = Object.freeze(['pm', 'project', 'sdlc']);
39
+ const LINE_NAMES = Object.freeze({ pm: 'Product', project: 'Project', sdlc: 'SDLC' });
40
+ const PROJECT_GROUPS = new Set(['dates', 'status', 'names', 'links', 'default', 'ask', 'tidy']);
41
+ const PROJECT_DRIVER = new Set(['move', 'follow-up']);
42
+ const NO_REASON = /^\s*(no reason( found)?|none|n\/a|-)?\s*\.?\s*$/i;
43
+ const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
44
+ const str = (v) => (typeof v === 'string' ? v : '');
45
+ const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
46
+ const ms = (iso) => { const t = Date.parse(iso || ''); return Number.isFinite(t) ? t : null; };
47
+
48
+ /** The line and station of a job (`propose:<group>`, `driver:<what>`, `ai:<role>`, `goal:<name>`). */
49
+ function placeOf(job) {
50
+ const [kind, name = ''] = String(job || '').split(':');
51
+ if (kind === 'propose') {
52
+ if (name === 'default') return { line: 'project', station: 'Defaults' };
53
+ if (name === 'build') return { line: 'sdlc', station: 'Factory' };
54
+ return { line: PROJECT_GROUPS.has(name) ? 'project' : 'pm', station: 'Proposals' };
55
+ }
56
+ if (kind === 'driver') return { line: PROJECT_DRIVER.has(name) ? 'project' : 'pm', station: 'Driver' };
57
+ if (kind === 'ai') {
58
+ if (name === 'improve') return { line: 'pm', station: 'Lessons' };
59
+ if (/factory|build|review/.test(name)) return { line: 'sdlc', station: 'Factory' };
60
+ return { line: 'pm', station: 'Role agents' };
61
+ }
62
+ if (kind === 'goal') return { line: 'pm', station: 'Goal loops' };
63
+ return { line: null, station: null };
64
+ }
65
+
66
+ /** The labels a list of { label, ref } sources (or strings) names. */
67
+ const labelsOf = (src) => (Array.isArray(src) ? src.map((s) => (isObj(s) ? str(s.label) || str(s.ref) : str(s))).map((s) => one(s, 80)).filter(Boolean) : []);
68
+ /** What a reason text names as its source, or [] (a reason is not a source unless it names one: Jira, a PRD, a meeting, a document…). */
69
+ function namedIn(why) {
70
+ const t = str(why);
71
+ if (!t || NO_REASON.test(t) || /no reason found/i.test(t)) return [];
72
+ const SG = require('./source-guard.js');
73
+ const k = SG.kindOf(t);
74
+ if (k !== 'other' && k !== 'plan') return [SG.KIND_NAMES[k] || k];
75
+ if (/^\s*(prd|from)\b/i.test(t)) return [one(t.replace(/^\s*from\s+/i, ''), 80)];
76
+ return [];
77
+ }
78
+ /** What one ✦ proposal (a propose line) cites. */
79
+ function citesOfProp(p) {
80
+ try { return labelsOf(require('./source-guard.js').citedOf(p)); } catch { return labelsOf(p && p.sources); }
81
+ }
82
+ /** What a ✦ keep's writes cite: each write's source, else a reason that names one. */
83
+ function citesOfWrote(wrote) {
84
+ const out = [];
85
+ for (const w of Array.isArray(wrote) ? wrote : []) {
86
+ if (!isObj(w)) continue;
87
+ if (str(w.source) && !/^(agent|plan|dates)$/i.test(w.source)) out.push(one(w.source, 80));
88
+ else out.push(...namedIn(w.why));
89
+ }
90
+ return [...new Set(out)];
91
+ }
92
+
93
+ /* ── the fold ── */
94
+ function rows(input = {}, { now = Date.now() } = {}) {
95
+ const out = [];
96
+ const A = Array.isArray(input.autonomy) ? input.autonomy : [];
97
+ const P = Array.isArray(input.proposals) ? input.proposals : [];
98
+ const Dr = Array.isArray(input.driver) ? input.driver : [];
99
+ const checks = isObj(input.checks) ? input.checks : {};
100
+ const checkOf = (ini) => (ini && checks[ini]) || null;
101
+
102
+ // ✦ ledger: propose lines (newest per id), keep lines (with auto and group), undo, expire, drop
103
+ const props = new Map(), keeps = [], undone = new Set(), expired = [], drops = [];
104
+ for (const l of P) {
105
+ if (!isObj(l)) continue;
106
+ if (l.kind === 'propose' && str(l.id)) props.set(l.id, l);
107
+ else if (l.kind === 'keep' && str(l.batch)) keeps.push({ ...l, _t: ms(l.at), _used: false });
108
+ else if (l.kind === 'undo' && str(l.batch)) undone.add(l.batch);
109
+ else if (l.kind === 'expire') expired.push(l);
110
+ else if (l.kind === 'drop' && !l.default) drops.push(l);
111
+ }
112
+ const keepByBatch = new Map(keeps.map((k) => [k.batch, k]));
113
+ const keepById = new Map();
114
+ for (const k of keeps) for (const id of Array.isArray(k.ids) ? k.ids : []) keepById.set(String(id).split(':')[0], k);
115
+
116
+ // Driver ledger: proposals and their decisions
117
+ const dprops = new Map();
118
+ for (const l of Dr) {
119
+ if (!isObj(l)) continue;
120
+ if (l.ev === 'proposal' && str(l.id) && !dprops.has(l.id)) dprops.set(l.id, { ...l, state: 'open', _used: false, auto: false, decided_at: null });
121
+ else if ((l.ev === 'keep' || l.ev === 'return' || l.ev === 'drop') && dprops.has(l.proposal)) {
122
+ const p = dprops.get(l.proposal);
123
+ if (p.state !== 'open') continue;
124
+ p.state = l.ev === 'keep' ? 'kept' : 'dropped'; p.auto = l.auto === true; p.decided_at = l.at || null;
125
+ } else if (l.ev === 'undo' && dprops.has(l.proposal)) dprops.get(l.proposal).state = 'undone';
126
+ }
127
+
128
+ // autonomy ledger: applied lines, their setbacks and checks
129
+ const setback = new Map(); // ref → kind
130
+ for (const l of A) if (isObj(l) && l.ev === 'setback' && l.ref && ['undo', 'revert', 'verifier-fail'].includes(l.kind)) setback.set(l.ref, l.kind);
131
+ for (const l of A) if (isObj(l) && l.ev === 'checked' && l.verdict === 'FAIL' && l.ref) setback.set(l.ref, setback.get(l.ref) || 'verifier-fail');
132
+
133
+ const near = (t, u) => t != null && u != null && Math.abs(t - u) <= JOIN_MS;
134
+ for (const l of A) {
135
+ if (!isObj(l) || l.ev !== 'applied' || typeof l.job !== 'string') continue;
136
+ const t = ms(l.at);
137
+ const [kind, name] = l.job.split(':');
138
+ let origin = null, cites = null;
139
+ if (kind === 'propose') {
140
+ let k = (l.ref && keepByBatch.get(l.ref)) || (l.ref && keepById.get(l.ref)) || null;
141
+ if (!k) k = keeps.find((x) => !x._used && x.auto === true && (!l.ini || x.ini === l.ini) && (!x.group || x.group === name) && near(x._t, t)) || null;
142
+ if (k) {
143
+ k._used = true; origin = k;
144
+ const ids = (Array.isArray(k.ids) ? k.ids : []).map((id) => String(id).split(':')[0]);
145
+ cites = [...new Set([...ids.flatMap((id) => (props.has(id) ? citesOfProp(props.get(id)) : [])), ...citesOfWrote(k.wrote)])];
146
+ }
147
+ } else if (kind === 'driver') {
148
+ let p = (l.ref && dprops.get(l.ref)) || null;
149
+ if (!p) p = [...dprops.values()].find((x) => !x._used && x.auto && x.what === name && (!l.ini || (x.target && x.target.id === l.ini)) && near(ms(x.decided_at), t)) || null;
150
+ if (p) { p._used = true; origin = p; cites = citesOfProp(p); }
151
+ }
152
+ const src = Array.isArray(l.src) ? labelsOf(l.src) : null;
153
+ const source = src || (cites && cites.length ? cites : null) || namedIn(l.why);
154
+ const sb = l.ref ? setback.get(l.ref) : null;
155
+ const age = t == null ? 0 : now - t;
156
+ const { line, station } = placeOf(l.job);
157
+ out.push({ at: l.at || null, line, station, job: l.job, product: l.product || null, ini: l.ini || (origin && (origin.ini || (origin.target && origin.target.id))) || null,
158
+ ref: l.ref || null, title: one(l.title, 200), cls: l.cls || null, by: 'agent', state: sb ? 'undone' : age > UNDO_DAYS * DAY ? 'kept' : 'applied',
159
+ source, sourced: source.length > 0, joined: !!origin || !!src, check: checkOf(l.ini) });
160
+ }
161
+
162
+ // ✦ proposals that were not applied by an agent: kept by the PM, still open, or expired
163
+ for (const k of keeps) {
164
+ if (k._used || k.auto === true) continue; // an auto keep with no applied line: the applied line is the record (a torn write is skipped)
165
+ const ids = (Array.isArray(k.ids) ? k.ids : []).map((id) => String(id).split(':')[0]);
166
+ const g = str(k.group) || (ids.map((id) => props.get(id)).find(Boolean) || {}).group || (/^lk:/.test(ids[0] || '') ? 'links' : 'dates');
167
+ const { line, station } = placeOf('propose:' + g);
168
+ const source = [...new Set([...ids.flatMap((id) => (props.has(id) ? citesOfProp(props.get(id)) : [])), ...citesOfWrote(k.wrote)])];
169
+ out.push({ at: k.at || null, line, station, job: 'propose:' + g, product: null, ini: k.ini || null, ref: k.batch, title: one((props.get(ids[0]) || {}).title || g, 200),
170
+ cls: null, by: 'pm', state: undone.has(k.batch) ? 'undone' : 'kept', source, sourced: source.length > 0, joined: true, check: checkOf(k.ini) });
171
+ }
172
+ const answered = new Set([...keepById.keys(), ...drops.map((d) => str(d.id)).filter(Boolean), ...expired.map((e) => str(e.id)).filter(Boolean)]);
173
+ for (const p of props.values()) {
174
+ if (answered.has(p.id)) continue;
175
+ const { line, station } = placeOf('propose:' + p.group);
176
+ const source = citesOfProp(p);
177
+ out.push({ at: p.at || null, line, station, job: 'propose:' + str(p.group), product: null, ini: p.ini || null, ref: p.id, title: one(p.title || p.why, 200), cls: null, by: 'agent',
178
+ state: 'proposed', source, sourced: source.length > 0, joined: true, check: checkOf(p.ini) });
179
+ }
180
+ for (const e of expired) {
181
+ const { line, station } = placeOf('propose:' + str(e.group));
182
+ out.push({ at: e.at || null, line, station, job: 'propose:' + str(e.group), product: null, ini: e.ini || null, ref: str(e.id) || null, title: one(e.title || e.why, 200), cls: null,
183
+ by: 'agent', state: 'expired', source: [], sourced: false, joined: true, check: checkOf(e.ini) });
184
+ }
185
+ // Driver proposals that were not applied by an agent
186
+ for (const p of dprops.values()) {
187
+ if (p._used || (p.auto && p.state !== 'open')) continue;
188
+ const { line, station } = placeOf('driver:' + p.what);
189
+ const ini = p.target && p.target.kind === 'initiative' ? p.target.id : null;
190
+ const source = citesOfProp(p);
191
+ out.push({ at: p.at || null, line, station, job: 'driver:' + str(p.what), product: (p.target && p.target.ws) || null, ini, ref: p.id, title: one(`${p.what}: ${p.why}`, 200),
192
+ cls: null, by: p.state === 'open' ? 'agent' : 'pm', state: p.state === 'open' ? 'proposed' : p.state, source, sourced: source.length > 0, joined: true, check: checkOf(ini) });
193
+ }
194
+ // the outbox: drafts to people (class C, never applied by an agent)
195
+ const ob = new Map();
196
+ for (const l of Array.isArray(input.outbox) ? input.outbox : []) {
197
+ if (!isObj(l) || !l.id) continue;
198
+ const cur = ob.get(l.id) || { id: l.id, at: l.at || null, state: 'proposed', title: '', ws: null, ini: null };
199
+ if (l.event === 'queued' || l.event === 'edited') { cur.title = one(l.text || l.title || l.subject || cur.title, 200); cur.ws = l.ws || cur.ws; cur.ini = l.initiative || l.ini || cur.ini; }
200
+ else if (l.event === 'sent') cur.state = 'sent';
201
+ else if (l.event === 'discarded') cur.state = 'dropped';
202
+ else if (l.event === 'restored') cur.state = 'proposed';
203
+ ob.set(l.id, cur);
204
+ }
205
+ for (const e of ob.values()) out.push({ at: e.at, line: 'project', station: 'Outbox', job: 'outbox', product: e.ws, ini: e.ini, ref: e.id, title: e.title, cls: 'C', by: 'agent',
206
+ state: e.state, source: [], sourced: null, joined: true, check: checkOf(e.ini) });
207
+
208
+ // the background runs: what each station spent (a run is one background agent session)
209
+ const runs = [];
210
+ for (const l of Array.isArray(input.bgQueue) ? input.bgQueue : []) if (isObj(l) && l.kind === 'done' && l.job) runs.push({ at: l.at || null, job: String(l.job), ini: l.ini || null, ws: l.ws || null });
211
+
212
+ out.sort((a, b) => String(b.at || '').localeCompare(String(a.at || '')));
213
+ return { rows: out, runs };
214
+ }
215
+
216
+ /** The station a background run's job spends for (lib/bg-queue.js JOBS ids). */
217
+ function stationOfRun(job) {
218
+ const j = String(job || '');
219
+ if (/driver/.test(j)) return { line: 'pm', station: 'Driver' };
220
+ if (/goal/.test(j)) return { line: 'pm', station: 'Goal loops' };
221
+ if (/team|role/.test(j)) return { line: 'pm', station: 'Role agents' };
222
+ if (/improve/.test(j)) return { line: 'pm', station: 'Lessons' };
223
+ if (/build|factory|verif/.test(j)) return { line: 'sdlc', station: 'Factory' };
224
+ if (/proposal|grill|lab|scan|outcome|doc|metric/.test(j)) return { line: 'pm', station: 'Proposals' };
225
+ return { line: 'project', station: 'Schedules' };
226
+ }
227
+
228
+ /** Per line and station over the last `days` days (today only when days is 1). */
229
+ function summary(R, runs = [], { now = Date.now(), days = 1 } = {}) {
230
+ const d = new Date(now);
231
+ const from = days <= 1 ? Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()) : now - days * DAY;
232
+ const inWin = (at) => { const t = ms(at); return t != null && t >= from && t <= now + 60000; };
233
+ const W = R.filter((r) => inWin(r.at));
234
+ const key = (line, station) => `${line}|${station}`;
235
+ const by = new Map();
236
+ const get = (line, station) => { const k = key(line, station); if (!by.has(k)) by.set(k, { line, station, changes: 0, applied: 0, kept: 0, undone: 0, ignored: 0, unsourced: 0, runs: 0 }); return by.get(k); };
237
+ for (const r of W) {
238
+ if (!r.line) continue;
239
+ const g = get(r.line, r.station);
240
+ g.changes++;
241
+ const self = r.by === 'agent' && (r.state === 'applied' || r.state === 'kept' || r.state === 'undone') && r.job !== 'outbox';
242
+ if (self) { g.applied++; if (!r.sourced) g.unsourced++; }
243
+ if (r.state === 'kept') g.kept++;
244
+ if (r.state === 'undone') g.undone++;
245
+ if (r.state === 'expired' || (r.state === 'proposed' && now - (ms(r.at) || now) > IGNORED_MS)) g.ignored++;
246
+ }
247
+ for (const u of runs) if (inWin(u.at)) { const s = stationOfRun(u.job); get(s.line, s.station).runs++; }
248
+ const lines = [...by.values()].sort((a, b) => LINES.indexOf(a.line) - LINES.indexOf(b.line) || b.changes - a.changes || a.station.localeCompare(b.station));
249
+ const self = W.filter((r) => r.by === 'agent' && ['applied', 'kept', 'undone'].includes(r.state) && r.job !== 'outbox');
250
+ const unsourced = self.filter((r) => !r.sourced).length;
251
+ return {
252
+ from: new Date(from).toISOString(), days,
253
+ lines,
254
+ total: W.length,
255
+ placed: W.filter((r) => r.line && r.station && r.state).length,
256
+ applied: self.length,
257
+ joined: self.filter((r) => r.joined).length,
258
+ unsourced,
259
+ unsourced_pct: self.length ? Math.round((unsourced / self.length) * 1000) / 10 : 0,
260
+ };
261
+ }
262
+
263
+ /* ── the read (no write) ── */
264
+ function linesOf(file) {
265
+ let text = '';
266
+ try { text = fs.readFileSync(file, 'utf8'); } catch { return []; }
267
+ const out = [];
268
+ for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { const l = JSON.parse(raw); if (isObj(l)) out.push(l); } catch { /* a torn line is skipped */ } }
269
+ return out;
270
+ }
271
+ /** Each initiative's outcome check date from its record (planning/initiatives or pmos/state/initiatives). */
272
+ function checksOf(root) {
273
+ const out = {};
274
+ for (const dir of [path.join(root, 'planning', 'initiatives'), path.join(root, 'pmos', 'state', 'initiatives')]) {
275
+ let names = [];
276
+ try { names = fs.readdirSync(dir).filter((n) => n.endsWith('.md')); } catch { continue; }
277
+ for (const n of names) {
278
+ let head = '';
279
+ try { head = fs.readFileSync(path.join(dir, n), 'utf8').slice(0, 6000); } catch { continue; }
280
+ const m = /^outcome_horizon:\s*["']?(\d{4}-\d{2}-\d{2})/m.exec(head);
281
+ const id = (/^id:\s*["']?([^"'\n]+)/m.exec(head) || [])[1] || n.slice(0, -3);
282
+ if (m && !out[id.trim()]) out[id.trim()] = m[1];
283
+ }
284
+ }
285
+ return out;
286
+ }
287
+ function read(root, { runtimeDir = null } = {}) {
288
+ const D = require('./driver.js');
289
+ const dir = D.stateDirOf(root);
290
+ const pick = (name) => [dir, runtimeDir].filter(Boolean).map((d) => path.join(d, name)).find((f) => fs.existsSync(f)) || null;
291
+ const ob = runtimeDir ? path.join(runtimeDir, 'outbox', 'outbox.jsonl') : null;
292
+ return {
293
+ stateDir: dir,
294
+ autonomy: dir ? linesOf(path.join(dir, 'autonomy.jsonl')) : [],
295
+ proposals: dir ? linesOf(path.join(dir, 'proposals.jsonl')) : [],
296
+ driver: dir ? linesOf(path.join(dir, 'driver.jsonl')) : [],
297
+ bgQueue: pick('bg-queue.jsonl') ? linesOf(pick('bg-queue.jsonl')) : [],
298
+ outbox: ob && fs.existsSync(ob) ? linesOf(ob) : [],
299
+ checks: checksOf(root),
300
+ };
301
+ }
302
+
303
+ module.exports = { rows, summary, read, placeOf, namedIn, checksOf, stationOfRun, LINES, LINE_NAMES, JOIN_MS, IGNORED_MS };
@@ -171,7 +171,8 @@ function take(dir, held, { dayLines = [], today = '', product = '', pm, now, env
171
171
  ...(facts.length ? { facts } : {}), why, default: true, batch });
172
172
  }
173
173
  const title = `Left the plan as it was on ${one(q.title, 80)}: ${plural(hs.length, 'change', 'changes')} nobody answered by ${md(dueDay)}`;
174
- A.recordApplied(dir, { job: JOB, product, ref: batch, title, cls: 'B', ini: q.ini, why }, { now, settingsDir });
174
+ // its source is the owner's own question, unanswered by its deadline (the record counts it as sourced)
175
+ A.recordApplied(dir, { job: JOB, product, ref: batch, title, cls: 'B', ini: q.ini, why, src: [`Unanswered question, due ${dueDay}`] }, { now, settingsDir });
175
176
  out.taken.push({ batch, ini: q.ini, board: q.board, ids: hs.map((h) => String(h.prop.id)), title });
176
177
  }
177
178
  return out;
@@ -140,8 +140,11 @@ async function autoApply({ file, proposal, actor, ctx = {}, now, stateDir, produ
140
140
  const p = state.proposals.get(proposal);
141
141
  if (!p || p.state !== 'open') return { applied: false, why: 'not open' };
142
142
  const m = mode || D.modeOf(state, p.target.kind === 'work' ? 'work' : null);
143
- const cls = A.classOfDriver(p.what);
144
- const d = A.decide({ stateDir, job: jobOf(p), product, cls, mode: m, undoable: UNDOABLE.has(p.what), now, settingsDir: ctx.settingsDir || null });
143
+ // no source, no auto (A443): a Driver change that cites nothing is class C and waits for the PM
144
+ const cls = A.classOfDriverProposal(p);
145
+ const src = require('./source-guard.js').citedOf(p);
146
+ const d = A.decide({ stateDir, job: jobOf(p), product, cls, mode: m, undoable: UNDOABLE.has(p.what), now, settingsDir: ctx.settingsDir || null, sources: src });
147
+ if (!d.apply && !src.length) A.logHeld(jobOf(p), product, p.id);
145
148
  if (!d.apply) return { applied: false, why: d.why, cls };
146
149
  // board AwI: Intent is the PM's; Claude's change to it is a ✦ proposal on the product page and never applies by itself
147
150
  if (p.what === 'artefact' && p.data && p.data.artefact === 'intent') return { applied: false, why: 'Intent is the PM\'s, so PMOS only proposes', cls };
@@ -155,7 +158,7 @@ async function autoApply({ file, proposal, actor, ctx = {}, now, stateDir, produ
155
158
  // batch 29 item 6: the line keeps what the change was read from (its sources) and the run that made it, so "PMOS did" can say why
156
159
  const from = (p.sources || []).map((x) => x && x.label).filter(Boolean).slice(0, 3);
157
160
  A.recordApplied(stateDir, { job: jobOf(p), product, ref: p.id, title: `${p.what}: ${p.why}`, cls, ini: p.target && p.target.kind === 'initiative' ? p.target.id : null,
158
- why: from.length ? 'From ' + from.join(', ') : '', run: p.run || null }, { now, settingsDir: ctx.settingsDir || null });
161
+ why: from.length ? 'From ' + from.join(', ') : '', run: p.run || null, src: p.sources || [] }, { now, settingsDir: ctx.settingsDir || null });
159
162
  return { applied: true, why: d.why, cls, wrote: r.wrote };
160
163
  } catch (e) { return { applied: false, why: 'the apply failed: ' + String((e && e.message) || e).slice(0, 160) }; }
161
164
  }