create-pmos 0.703.0 → 0.705.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.703.0",
3
+ "version": "0.705.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": {
@@ -33,6 +33,25 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.705.0",
38
+ "at": "2026-11-22T11:04:46.265Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1534,
43
+ "t": "A weekly what-moved list in Your move (A441)",
44
+ "s": "A weekly what-moved list in Your move (A441)",
45
+ "k": "new"
46
+ },
47
+ {
48
+ "n": 1532,
49
+ "t": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
50
+ "s": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
51
+ "k": "new"
52
+ }
53
+ ]
54
+ },
36
55
  {
37
56
  "v": "0.703.0",
38
57
  "at": "2026-11-22T10:51:01.624Z",
@@ -429,25 +448,6 @@
429
448
  "k": "new"
430
449
  }
431
450
  ]
432
- },
433
- {
434
- "v": "0.658.0",
435
- "at": "2026-11-22T03:38:17.292Z",
436
- "f": 4,
437
- "prs": [
438
- {
439
- "n": 1441,
440
- "t": "Goals is built from the design system's blocks",
441
- "s": "Goals is built from the design system's blocks",
442
- "k": "new"
443
- },
444
- {
445
- "n": 1443,
446
- "t": "Events is built from the design system's blocks",
447
- "s": "Events is built from the design system's blocks",
448
- "k": "new"
449
- }
450
- ]
451
451
  }
452
452
  ]
453
453
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@fe33d1a2
1
+ kernel-source: pmos@08ad453a
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-22T10:50:57Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T11:04:43Z"}
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-22T10:50:57Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T11:04:43Z"}
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-22T10:50:57Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T11:04:43Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,23 @@
1
1
  [
2
+ {
3
+ "v": "0.705.0",
4
+ "at": "2026-11-22T11:04:46.265Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1534,
9
+ "t": "A weekly what-moved list in Your move (A441)",
10
+ "s": "A weekly what-moved list in Your move (A441)",
11
+ "k": "new"
12
+ },
13
+ {
14
+ "n": 1532,
15
+ "t": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
16
+ "s": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
17
+ "k": "new"
18
+ }
19
+ ]
20
+ },
2
21
  {
3
22
  "v": "0.703.0",
4
23
  "at": "2026-11-22T10:51:01.624Z",
@@ -276,10 +276,11 @@ The idle lab run uses only the first three commands:
276
276
 
277
277
  Run them in the product's repository, or pass `--root <dir>`.
278
278
 
279
- - `pmos outcomes list` shows the checks that are due, the outcomes with no date and the initiatives with no outcome. It changes nothing.
279
+ - `pmos outcomes list` shows the checks that are due or blocked, the outcomes with no date and the initiatives with no outcome. It changes nothing.
280
280
  - `pmos outcomes propose [<id>]` shows PMOS's drafts, each with the lines it cites. Before the first draft of a repository it replays them on that repository's records, and shows nothing unless the replay passes.
281
281
  - `pmos outcomes declare <id> --metric "<text>" --horizon <YYYY-MM-DD>` writes the outcome and its check date, after you said yes.
282
282
  - `pmos outcomes record <id> <worked|didnt-work|cant-tell> --evidence "<text>"` records your verdict on a due check.
283
+ - `pmos outcomes live --where <place> --version <version>` records the version a place runs now, for example after a deploy. When a record says `shipped_in: "<version>"` and `measured_on: "<place>"`, and that place still runs an older version, its outcome check shows as blocked with the step to fix it. PMOS does not ask for a verdict until the place runs the change.
283
284
  - When you record `didnt-work`, the initiative shows **At risk** on every page, with the check as the reason. PMOS compares the evidence with the kill condition and files one next step under the initiative's ✦. If the evidence meets the kill condition, PMOS suggests that you stop the initiative. If this is the second check that did not work, it suggests a new experiment. Otherwise it suggests one more round with a new check date. The Board's Next column asks you the same question. Nothing happens until you press ✓. Undo reverses the step.
284
285
  - `pmos outcomes propose` also reads the experiment's hypothesis. When the hypothesis names a different KR from the initiative's anchor, the draft tells you.
285
286
 
@@ -49,6 +49,7 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
49
49
  - **One press per initiative.** An initiative's proposals are one row, for example "Checkout: 6 changes to keep" with "3 dates, 2 names, 1 link" under it. Press it to see them grouped as Dates, Names, Done and Links. ✓ keeps all of them, with one Undo for the batch. ✕ drops them, then offers three reasons and **Say why**. A proposal that needs your own check keeps its own ✓ and ✕. **See every change** opens the full list on the initiative.
50
50
  - **An ask expires after 14 days with no answer.** PMOS leaves it as it was and writes why in the initiative's History. Your move says it once: "2 asks expired after 14 days with no answer." Dates computed from your tasks never expire: PMOS reads them again each time.
51
51
  - **Done** lists what PMOS finished by itself in the last 14 days, one line each with Undo.
52
+ - **What moved last week.** Once a week, one row says how many dates and scope changes (tasks added, removed or put back) happened last week on all your products, and how many have no source, for example "Last week: 14 moves in dates and scope" with "3 with no source. See who to ask." under it. Press it to see one list, grouped by product, with the moves that have no source first. Each move shows its source (your own change, the tracker, or the Jira ticket, meeting note or document it names), or **No source** and the owner to ask. A move PMOS made with no reason is always **No source**. After you open the list, the row goes away until next week. In a week with no moves, there is no row. From a terminal: `node workspace/lib/week-moves.js list` in a product's repository.
52
53
  - An outbox draft opens with who it is for and the words. **Copy** puts the words on the clipboard, so you send them from your own tool. ✕ discards it, with Undo. Nothing leaves PMOS by itself.
53
54
 
54
55
  ## Mentions
@@ -6,6 +6,8 @@
6
6
  * aheadOf(root, ini, { today, schedules, now }) → { outcome: { date, metric, src } | null, jobs: [{ date, name, src }] }
7
7
  * outcome the record's outcome check (outcome_metric + outcome_horizon, lib/outcomes.js), only while it is still ahead and nobody
8
8
  * recorded a verdict. A check that is due is Your move on Home, so it is not repeated here.
9
+ * A blocked check (bet A451: the place it is measured runs an older version than the one that shipped the change) is shown
10
+ * whether or not its date passed, with blocked: { why, step }: nobody else says it, and it needs one step from someone.
9
11
  * jobs PMOS's scheduled jobs that name this initiative (its id or its title, in the schedule's name or its request), enabled,
10
12
  * each with its next run in the next 30 days (lib/schedule-logic.js nextRun: what is shown is what fires).
11
13
  * Nothing here writes.
@@ -19,6 +21,8 @@ function outcomeOf(root, ini, today) {
19
21
  try {
20
22
  const O = require('./outcomes.js');
21
23
  const S = O.scan(root, { today });
24
+ const b = (S.blocked || []).find((x) => x.id === ini);
25
+ if (b && b.horizon && b.metric) return { date: b.horizon < today ? today : b.horizon, metric: b.metric, src: b.record + ' · shipped_in', blocked: { why: b.blocked.why, step: b.blocked.step } };
22
26
  const it = (S.pending || []).find((x) => x.id === ini);
23
27
  if (!it || !it.horizon || !it.metric) return null;
24
28
  return { date: it.horizon, metric: it.metric, src: it.record + ' · outcome_horizon' };
@@ -10,7 +10,8 @@
10
10
  * - the initiative rows (lib/initiative-rows.js: live, accepted, stopped, last activity, the record) minus the ones the PM deleted;
11
11
  * - closing: the boards ledger's ini-end lines (a dated "won't do"), the acceptances ledger and the row's stopped date;
12
12
  * - Jira: the snapshot each linked initiative keeps (lib/jira-status.js), its ticket table line cited.
13
- * A source that cannot be read is named in notRead, never guessed. */
13
+ * Each task line also keeps who wrote it (by), its reason (why), the owner it names, tracker and what it cites, for the weekly what-moved
14
+ * list (lib/week-moves.js). A source that cannot be read is named in notRead, never guessed. */
14
15
  const fs = require('fs');
15
16
  const path = require('path');
16
17
 
@@ -32,6 +33,13 @@ function jsonLines(file) {
32
33
  }
33
34
  const atOf = (o) => { const t = Date.parse(o && o.at); return Number.isFinite(t) ? t : null; };
34
35
  const lineSrc = (root, file, l) => ({ ref: rel(root, file) + ':' + l.n, quote: cut(l.text) });
36
+ /** What a task line cites by itself: its `src`/`source`/`sources` (a string, a { label, ref } or a list of either). [] when none. */
37
+ function citesOf(o) {
38
+ const out = [];
39
+ const add = (s) => { if (typeof s === 'string' && s.trim()) out.push(s.trim().slice(0, 120)); else if (s && typeof s === 'object' && !Array.isArray(s)) { const t = [s.label, s.ref].filter((v) => typeof v === 'string' && v.trim()).join(' '); if (t) out.push(t.slice(0, 120)); } };
40
+ for (const k of ['src', 'source', 'sources']) { const v = o[k]; if (Array.isArray(v)) v.forEach(add); else add(v); }
41
+ return out;
42
+ }
35
43
 
36
44
  function tasksOf(root, boardFile, storeFile, notRead) {
37
45
  const board = boardFile ? jsonLines(boardFile) : [];
@@ -56,7 +64,10 @@ function tasksOf(root, boardFile, storeFile, notRead) {
56
64
  if (!t) continue;
57
65
  if (o.kind === 'task-update' && typeof o.initiative === 'string' && o.initiative) t.initiative = o.initiative;
58
66
  if (o.kind === 'task-update' && typeof o.title === 'string' && o.title.trim()) t.title = o.title.trim();
59
- t.lines.push({ at, kind: o.kind, state: typeof o.state === 'string' ? (o.state === 'In review' ? 'In progress' : o.state) : undefined, due: typeof o.due === 'string' ? o.due : undefined, src: lineSrc(root, file, l) });
67
+ t.lines.push({ at, kind: o.kind, state: typeof o.state === 'string' ? (o.state === 'In review' ? 'In progress' : o.state) : undefined, due: typeof o.due === 'string' ? o.due : undefined, src: lineSrc(root, file, l),
68
+ // who wrote it, why, the owner it names and what it cites: lib/week-moves.js reads them (initiative weekly-what-moved)
69
+ by: typeof o.by === 'string' ? o.by : '', why: typeof o.why === 'string' ? o.why : '', owner: typeof o.owner === 'string' ? o.owner : undefined,
70
+ tracker: o.tracker === true, cites: citesOf(o) });
60
71
  }
61
72
  for (const t of tasks.values()) { const m = milestone.get(t.id); t.milestone = !!(m && m.v); }
62
73
  return { tasks: [...tasks.values()], board: board || [] };
@@ -28,6 +28,10 @@
28
28
  * itself with Undo); a goal PMOS failed to read twice the same way files ONE ask (class C); else one short run per initiative and check date
29
29
  * reads the records (deps.startRun, <state>/outcome-runs.jsonl). What none of these can tell stays due, and Your move asks the PM once.
30
30
  *
31
+ * A BLOCKED CHECK (bet A451). A check whose place of measure runs an older version than the one that shipped the change (lib/outcomes.js
32
+ * scan `blocked`) is not due: it is never judged and starts no run. The pass logs one `[outcome-blocked]` line when a check becomes blocked
33
+ * (per check and version pair) and one when it clears, so the health number and its dates can be read from the server log.
34
+ *
31
35
  * deps: { workspaces() → [w], isLead(w), stateDirFor(w), boardOf(w, id) → board id | null, runtime() → the per-user state folder, open(now),
32
36
  * env, every (ms, its own timer), mayRun(), warn(what, err),
33
37
  * recordsDir(w)? → the goal records folder, startRun(w, { ini, board, it, why, now })? → { ok, run } | { ok: false, held?, error } }
@@ -79,6 +83,8 @@ function cases(S, list) {
79
83
 
80
84
  function create(deps) {
81
85
  const warn = deps.warn || (() => {});
86
+ const log = deps.log || ((s) => console.log(s));
87
+ const blockedSeen = new Map(); // ws id → Map ini → the logged `shipped|runs` pair
82
88
  const lastDay = new Map(); // ws id → the local day it ran
83
89
  let busy = false;
84
90
 
@@ -159,6 +165,7 @@ function create(deps) {
159
165
  const dir = deps.stateDirFor(w); if (!dir) return { ws: w.id, filed: 0, runs: 0 };
160
166
  const S = O.scan(w.root, { today: localDay(now) });
161
167
  const F = PR.read(dir), kept = PR.keptIds(F);
168
+ logBlocked(w, S);
162
169
  const dueBy = new Map(S.due.map((it) => [it.id, it]));
163
170
  // a verdict or ask whose check is no longer due on its date (the PM answered it, or moved the date) goes: zero is silence
164
171
  for (const p of F.props.values()) {
@@ -214,6 +221,18 @@ function create(deps) {
214
221
  return { ws: w.id, filed, held, runs };
215
222
  }
216
223
 
224
+ /** One log line when a check becomes blocked (or blocked on another version pair), and one when it clears. */
225
+ function logBlocked(w, S) {
226
+ const seen = blockedSeen.get(w.id) || new Map(), now = new Map();
227
+ for (const it of S.blocked || []) {
228
+ const pair = it.blocked.shipped + '|' + it.blocked.runs;
229
+ now.set(it.id, pair);
230
+ if (seen.get(it.id) !== pair) log(`${O.LIVE_TAG} ${w.id} ${it.id} blocked: ${it.blocked.why}. ${it.blocked.step}.`);
231
+ }
232
+ for (const id of seen.keys()) if (!now.has(id)) log(`${O.LIVE_TAG} ${w.id} ${id} cleared`);
233
+ blockedSeen.set(w.id, now);
234
+ }
235
+
217
236
  async function tick({ now = Date.now() } = {}) {
218
237
  if (off(deps.env) || busy) return { off: off(deps.env), running: busy };
219
238
  busy = true;
@@ -2,7 +2,9 @@
2
2
  /* outcomes-cli.js — `pmos outcomes`: no initiative without an expected outcome (initiative outcome-for-every-initiative; lib/outcomes.js, D57).
3
3
  *
4
4
  * pmos outcomes list [--json] every initiative's outcome state in this repository: checks due, outcomes with no
5
- * date, initiatives with no outcome, pending and checked. Reads only.
5
+ * date, initiatives with no outcome, blocked, pending and checked. Reads only.
6
+ * pmos outcomes live --where <place> --version <v> the version a place runs now (bet A451), appended to live_versions.jsonl. A check
7
+ * whose record says shipped_in a newer version and measured_on that place is blocked.
6
8
  * pmos outcomes propose [<id>] [--max <n>] [--json] Claude's ✦ drafts, each claim cited path:line, through the shared guard
7
9
  * (lib/ai-guard.js). Before the first draft of a repository it replays them on its real
8
10
  * records. Writes only the guard's audit, in the per-user folder.
@@ -20,13 +22,14 @@ const path = require('path');
20
22
  const { execFileSync } = require('child_process');
21
23
  const O = require('./outcomes.js');
22
24
 
23
- const COMMANDS = { outcomes: ['list', 'propose', 'declare', 'record'] };
25
+ const COMMANDS = { outcomes: ['list', 'propose', 'declare', 'record', 'live'] };
24
26
  const USAGE = [
25
- 'usage: pmos outcomes list|propose|declare|record — every initiative has an expected outcome and a date to check it',
27
+ 'usage: pmos outcomes list|propose|declare|record|live — every initiative has an expected outcome and a date to check it',
26
28
  ' pmos outcomes list [--json] checks due, outcomes with no date, initiatives with no outcome; reads only',
27
29
  ' pmos outcomes propose [<id>] [--max <n>] [--json] PMOS\'s ✦ drafts from the PRD and the KR, each one cited',
28
30
  ' pmos outcomes declare <id> --metric "<text>" --horizon <YYYY-MM-DD> the PM said yes: write the outcome and its check date',
29
31
  ' pmos outcomes record <id> <worked|didnt-work|cant-tell> --evidence "<text>" the PM\'s verdict on a due check',
32
+ ' pmos outcomes live --where <place> --version <v> the version a place runs now; a check measured there waits until it runs the shipped one',
30
33
  'Run it in the product\'s repository, or pass --root <dir>. Show each ✦ to the PM and write only after a yes.',
31
34
  ];
32
35
  const VERDICT = { worked: 'validated', validated: 'validated', 'didnt-work': 'refuted', "didn't-work": 'refuted', refuted: 'refuted', 'cant-tell': 'inconclusive', "can't-tell": 'inconclusive', inconclusive: 'inconclusive' };
@@ -57,7 +60,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
57
60
  if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
58
61
  if (!COMMANDS.outcomes.includes(sub)) { say(`unknown outcomes command "${sub}". Use one of: ${COMMANDS.outcomes.join(', ')}`); return 2; }
59
62
  const { pos, flags } = parse(args.slice(1));
60
- const allowed = { list: ['json', 'root'], propose: ['json', 'root', 'max'], declare: ['json', 'root', 'metric', 'horizon'], record: ['json', 'root', 'evidence'] }[sub];
63
+ const allowed = { list: ['json', 'root'], propose: ['json', 'root', 'max'], declare: ['json', 'root', 'metric', 'horizon'], record: ['json', 'root', 'evidence'], live: ['json', 'root', 'where', 'version'] }[sub];
61
64
  for (const k of Object.keys(flags)) if (!allowed.includes(k)) { say(`✗ --${k} is not an option of pmos outcomes ${sub}`); return 2; }
62
65
  const root = path.resolve(flags.root || repoRoot(cwd));
63
66
  const today = O.todayOf(now);
@@ -67,10 +70,12 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
67
70
  if (pos.length) return fail('pmos outcomes list takes no argument', 2);
68
71
  const S = O.scan(root, { today });
69
72
  const pick = (a) => a.map((it) => ({ id: it.id, title: it.title, lane: it.lane, metric: it.metric || null, horizon: it.horizon || null }));
70
- if (flags.json) { say(JSON.stringify({ ok: true, total: S.subjects.length, due: pick(S.due), undated: pick(S.undated), missing: pick(S.missing), recent: S.recent, pending: pick(S.pending), disposed: S.disposed.map((d) => ({ id: d.id, disposition: d.disposition })), shippedWithout: S.shippedWithout, notRead: S.notRead })); return 0; }
71
- const named = S.due.length + S.undated.length + S.pending.length + S.disposed.length;
73
+ const blocked = S.blocked.map((it) => ({ ...pick([it])[0], where: it.blocked.where, runs: it.blocked.runs, shipped: it.blocked.shipped, step: it.blocked.step }));
74
+ if (flags.json) { say(JSON.stringify({ ok: true, total: S.subjects.length, due: pick(S.due), undated: pick(S.undated), missing: pick(S.missing), recent: S.recent, pending: pick(S.pending), blocked, disposed: S.disposed.map((d) => ({ id: d.id, disposition: d.disposition })), shippedWithout: S.shippedWithout, notRead: S.notRead })); return 0; }
75
+ const named = S.due.length + S.undated.length + S.pending.length + S.blocked.length + S.disposed.length;
72
76
  say(`${S.subjects.length} initiatives · ${named} name an expected outcome · ${named - S.undated.length} of those have a check date · ${S.disposed.length} checked`);
73
77
  if (S.due.length) say(`\n${S.due.length} check${S.due.length === 1 ? '' : 's'} due:\n` + S.due.map((it) => ` ${it.id} — since ${O.short(it.horizon)} · ${it.metric}`).join('\n'));
78
+ if (S.blocked.length) say(`\n${S.blocked.length} check${S.blocked.length === 1 ? '' : 's'} blocked (no verdict until the place it is measured runs the change):\n` + S.blocked.map((it) => ` ${it.id} — ${it.blocked.why}. ${it.blocked.step}, then: pmos outcomes live --where ${JSON.stringify(it.blocked.where)} --version <version>`).join('\n'));
74
79
  if (S.undated.length) say(`\n${S.undated.length} with no check date:\n` + S.undated.map((it) => ` ${it.id} — ${it.metric}`).join('\n'));
75
80
  if (S.missing.length) say(`\n${S.missing.length} under way with no expected outcome${S.recent ? ` (${S.recent} edited in the last 30 days)` : ''}:\n` + S.missing.slice(0, 15).map((it) => ` ${it.id} — ${it.title}`).join('\n') + (S.missing.length > 15 ? `\n … and ${S.missing.length - 15} more (--json lists all)` : ''));
76
81
  if (S.shippedWithout) say(`\n${S.shippedWithout} accepted with no outcome: too late to declare, counted only.`);
@@ -113,6 +118,16 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
113
118
  return 0;
114
119
  }
115
120
 
121
+ if (sub === 'live') {
122
+ if (pos.length) return fail('usage: pmos outcomes live --where <place> --version <version>', 2);
123
+ const r = O.recordLive(root, { where: flags.where, version: flags.version, by: 'cli' }, { now });
124
+ if (!r.ok) return fail(r.error, 2);
125
+ if (flags.json) { say(JSON.stringify({ ok: true, file: r.file, line: r.line })); return 0; }
126
+ const still = O.scan(root, { today }).blocked.filter((it) => it.blocked.where.toLowerCase() === r.line.where.toLowerCase()).length;
127
+ say(`✓ ${r.line.where} runs ${r.line.version} (${r.file}).${still ? ` ${still} outcome check${still === 1 ? ' is' : 's are'} still blocked there.` : ''} Commit it to keep it.`);
128
+ return 0;
129
+ }
130
+
116
131
  const id = pos[0];
117
132
  const actor = require('./actor.js').fromCli({ isTTY: isTTY === undefined ? !!(process.stdin.isTTY && process.stdout.isTTY) : isTTY, env });
118
133
 
@@ -6,7 +6,11 @@
6
6
  * outcome ledger takes the PM's verdict. On real data almost nothing used it (2026-11-03: 10 of 62 product initiatives named an outcome,
7
7
  * 8 had a date, 0 were checked; 3 checks were overdue). The field was optional and nothing asked for it. This module makes Claude ask:
8
8
  *
9
- * scan(root, { today }) → { subjects, missing (newest first), recent (how many of them were edited in the last 30 days), undated, due, pending, disposed, shippedWithout, notRead }
9
+ * scan(root, { today }) → { subjects, missing (newest first), recent (how many of them were edited in the last 30 days), undated, due, pending, blocked, disposed, shippedWithout, notRead }
10
+ * blocked (bet A451) is an outcome check that cannot be read yet: the record names the version that ships the change (`shipped_in`) and
11
+ * the place its outcome is read (`measured_on`), and that place's newest line in live_versions.jsonl is an older version. It is in
12
+ * neither `due` nor `pending`, so nobody is asked for a verdict and no check run starts; it.blocked says why and the one step to fix it.
13
+ * recordLive(root, { where, version, by }) → { ok, file, line } the one writer of live_versions.jsonl (`pmos outcomes live`)
10
14
  * every WORK initiative of the repository (document lanes are files, D86) that is not stopped. `missing` is a live one (not accepted)
11
15
  * with no outcome_metric; `shippedWithout` counts the accepted ones with none (too late to declare, only counted).
12
16
  * drafts(root, S, { today, only? }) → [proposal] ranked: due checks, then undated outcomes, then missing outcomes
@@ -114,7 +118,8 @@ function scan(root, { today = todayOf() } = {}) {
114
118
  const disposedBy = new Map();
115
119
  for (const c of liveChecks(ledger(root, L, 'outcome_checks.jsonl'))) if (c && c.initiative_id && DISPOSITIONS.includes(c.disposition)) disposedBy.set(String(c.initiative_id), c);
116
120
 
117
- const subjects = [], missing = [], undated = [], due = [], pending = [], disposed = [];
121
+ const live = liveOf(root, L);
122
+ const subjects = [], missing = [], undated = [], due = [], pending = [], blocked = [], disposed = [];
118
123
  let shippedWithout = 0;
119
124
  for (const f of files) {
120
125
  const file = path.join(L.initiatives, f);
@@ -139,17 +144,75 @@ function scan(root, { today = todayOf() } = {}) {
139
144
  const checked = d && !reopened(it, d);
140
145
  if (checked) disposed.push({ ...it, disposition: d.disposition });
141
146
  else if (!it.horizon) undated.push(it);
147
+ else if ((it.blocked = blockedOf(root, it, live, today))) blocked.push(it);
142
148
  else if (it.horizon <= today) due.push(it);
143
149
  else pending.push(it);
144
150
  }
145
151
  due.sort((a, b) => (a.horizon < b.horizon ? -1 : 1));
152
+ blocked.sort((a, b) => (a.horizon < b.horizon ? -1 : 1));
146
153
  // newest first: the record's timestamp is its last edit. `recent` is what was touched in the last RECENT_DAYS days, where a backfill
147
154
  // starts (an old record with no acceptance line may well have shipped long ago: D94 merges need none).
148
155
  const stamp = (it) => String((it.fm.timestamp || {}).value || '').slice(0, 10);
149
156
  missing.sort((a, b) => stamp(b).localeCompare(stamp(a)) || a.id.localeCompare(b.id));
150
157
  const since = addDays(today, -RECENT_DAYS);
151
158
  const recent = missing.filter((it) => stamp(it) >= since).length;
152
- return { root, layout: L, today, subjects, recent, missing, undated, due, pending, disposed, shippedWithout, notRead };
159
+ return { root, layout: L, today, subjects, recent, missing, undated, due, pending, blocked, disposed, shippedWithout, notRead };
160
+ }
161
+
162
+ /* ── a check the place it is measured cannot answer yet (bet A451) ─────────────────────────────────────────────────── */
163
+
164
+ const LIVE = 'live_versions.jsonl';
165
+ const LIVE_TAG = '[outcome-blocked]';
166
+ const placeKey = (s) => String(s || '').replace(/\s+/g, ' ').trim().toLowerCase();
167
+ /** Dotted numbers compared (a leading v and a pre-release tail are ignored). → -1 | 0 | 1, or null when either does not compare. */
168
+ function cmpVersion(a, b) {
169
+ const parts = (v) => { const m = /^v?(\d+(?:\.\d+)*)(?:[-+].*)?$/i.exec(String(v || '').trim()); return m ? m[1].split('.').map(Number) : null; };
170
+ const x = parts(a), y = parts(b);
171
+ if (!x || !y) return null;
172
+ for (let i = 0; i < Math.max(x.length, y.length); i++) { const d = (x[i] || 0) - (y[i] || 0); if (d) return d < 0 ? -1 : 1; }
173
+ return 0;
174
+ }
175
+ /** The newest live version of each place, from every live_versions.jsonl of the repository. → Map placeKey → { where, version, at, ref, quote } */
176
+ function liveOf(root, L) {
177
+ const out = new Map();
178
+ const files = [...new Set([path.join(L.runsDir, LIVE), path.join(root, 'pmos', 'state', LIVE), path.join(root, 'planning', 'runs', LIVE)])];
179
+ for (const f of files) (linesOf(f) || []).forEach((l, i) => {
180
+ let o = null; try { o = JSON.parse(l); } catch { return; }
181
+ if (!o || typeof o.where !== 'string' || typeof o.version !== 'string' || !o.where.trim() || !o.version.trim()) return;
182
+ const k = placeKey(o.where), prev = out.get(k), at = String(o.at || '');
183
+ if (!prev || at >= prev.at) out.set(k, { where: o.where.trim(), version: o.version.trim(), at, ref: rel(root, f) + ':' + (i + 1), quote: cut(l) });
184
+ });
185
+ return out;
186
+ }
187
+ /** Why this outcome check cannot be read yet, or null. → { where, runs, shipped, due, step, sources } */
188
+ function blockedOf(root, it, live, today) {
189
+ const sh = it.fm.shipped_in, on = it.fm.measured_on;
190
+ if (!sh || !on || !sh.value || !on.value) return null;
191
+ const now = live.get(placeKey(on.value));
192
+ if (!now || cmpVersion(now.version, sh.value) !== -1) return null;
193
+ const where = now.where;
194
+ return {
195
+ where, runs: now.version, shipped: sh.value, due: it.horizon <= today,
196
+ why: `${where} runs ${now.version}, the change shipped in ${sh.value}`,
197
+ step: `Update ${where} to ${sh.value} or later`,
198
+ sources: [src(root, path.join(root, it.record), sh.n, sh.text, 'Shipped in'), { label: `What ${where} runs`, ref: now.ref, quote: now.quote }],
199
+ };
200
+ }
201
+ /** The one writer of live_versions.jsonl: the version a place runs now (`pmos outcomes live`, or a deploy script). → { ok, file, line } | { ok: false, error } */
202
+ function recordLive(root, { where, version, by }, { now = Date.now() } = {}) {
203
+ root = path.resolve(root);
204
+ const w = String(where == null ? '' : where).replace(/\s+/g, ' ').trim(), v = String(version == null ? '' : version).trim();
205
+ if (!w || w.length > 80) return { ok: false, error: 'name the place it runs (--where, up to 80 characters), for example production or test bed' };
206
+ if (!v || v.length > 40 || /\s/.test(v)) return { ok: false, error: 'give the version it runs now (--version), for example 2.4.0' };
207
+ const L = layoutOf(root), file = path.join(L.runsDir, LIVE);
208
+ try {
209
+ fs.mkdirSync(L.runsDir, { recursive: true });
210
+ const st = (() => { try { return fs.lstatSync(file); } catch { return null; } })();
211
+ if (st && !st.isFile()) return { ok: false, error: 'the live versions ledger is not a plain file — nothing was saved' };
212
+ const line = { where: w, version: v, at: new Date(now).toISOString(), by: by || 'cli' };
213
+ fs.appendFileSync(file, JSON.stringify(line) + '\n');
214
+ return { ok: true, file: rel(root, file), line };
215
+ } catch (e) { return { ok: false, error: 'the live versions ledger could not be written: ' + String((e && e.message) || e).slice(0, 160) }; }
153
216
  }
154
217
 
155
218
  /* ── sources ──────────────────────────────────────────────────────────────────────────────────────────────── */
@@ -511,4 +574,4 @@ function undoCheck(root, { initiative, at, by, via }, { now = Date.now() } = {})
511
574
  }
512
575
 
513
576
  module.exports = { VERSION, undoCheck, liveChecks, JOB, DAYS_AFTER, DEFAULT_DAYS, DISPOSITIONS, scan, drafts, prdMetric, anchorMetric, horizonFor, recordCheck, todayOf, short, frontOf,
514
- experimentField, krMismatch, killMet, anyRefuted, verdictsOf, rowOutcomes, outcomeOfRow, refutedDrafts, setLife, NEXT_WORDS };
577
+ experimentField, krMismatch, killMet, anyRefuted, verdictsOf, rowOutcomes, outcomeOfRow, refutedDrafts, setLife, NEXT_WORDS, cmpVersion, recordLive, LIVE, LIVE_TAG };
@@ -135,7 +135,7 @@ const VERBS = Object.freeze({
135
135
  help: 'pmos pages [show|check] — each page\'s fixes, reverts and restores in the last 14 days, and a feature change that adds to a page that keeps breaking (pmos pages help)' }),
136
136
  // Not a pm-os-absorb verb (run: null): initiative outcome-for-every-initiative added it through the same table.
137
137
  outcomes: Object.freeze({ module: 'outcomes-cli.js', run: null, guide: 'cli.md',
138
- help: 'pmos outcomes list|propose|declare|record — every initiative\'s expected outcome and check date: Claude\'s cited drafts, the PM\'s yes, and the verdict when a check is due (pmos outcomes help)' }),
138
+ help: 'pmos outcomes list|propose|declare|record|live — every initiative\'s expected outcome and check date: Claude\'s cited drafts, the PM\'s yes, the verdict when a check is due, and the version a place runs (pmos outcomes help)' }),
139
139
  // Not a pm-os-absorb verb (run: null): initiative decision-journal-outcome-checks added it through the same table.
140
140
  decisions: Object.freeze({ module: 'decisions-cli.js', run: null, guide: 'cli.md',
141
141
  help: 'pmos decisions add|list|show|check|record — a decision journal: what you decided, what you expect, a date to check, and how your calls turned out (pmos decisions help)' }),
@@ -8,6 +8,8 @@
8
8
  * POST /api/drift/drop { id } → { ok } ⋯ "Not right, drop it": it never comes back (PRD R5)
9
9
  * POST /api/drift/undo { id } → { ok } the drop taken back
10
10
  * POST /api/drift/looked { week } → { ok } the card was shown for that week
11
+ * GET /api/drift/moves?ws=<id>[&week=YYYY-MM-DD] → { ok, ws, name, week, notRead, moves, total, unsourced } the weekly what-moved list of
12
+ * one product (initiative weekly-what-moved, lib/week-moves.js): last week by default; read-only
11
13
  *
12
14
  * THE SWITCH. PMOS_DRIFT=off, or the shared guard's switch (lib/ai-guard.js off: PMOS_AI, the ai settings): every GET answers { ok, on: false }
13
15
  * and every POST 409. WHO WRITES: a POST that carries an agent session header is refused (403); pm-guard requirePagePress checks the page. */
@@ -34,6 +36,29 @@ async function handle(req, res, url, ctx) {
34
36
  const F = dir ? D.read(dir) : D.fold([]);
35
37
  return send({ status: 200, body: { ok: true, on: true, check: D.checkView(F, D.weekOf(nowMs(ctx))) } });
36
38
  }
39
+ if (what === 'moves') {
40
+ // the weekly what-moved list (initiative weekly-what-moved, lib/week-moves.js): read-only, no model, so the drift switch does not gate it
41
+ if (req.method !== 'GET') return send(bad(405, 'GET only'));
42
+ let w = null;
43
+ try { w = ctx.getWs(url.searchParams.get('ws') || null); } catch { w = null; }
44
+ if (!w || !w.root) return send(bad(404, 'no such workspace'));
45
+ const day = url.searchParams.get('week');
46
+ if (day && !/^\d{4}-\d{2}-\d{2}$/.test(day)) return send(bad(400, 'week is a day YYYY-MM-DD'));
47
+ const WM = require('./week-moves.js');
48
+ try {
49
+ const W = day ? WM.weekOfDay(day) : WM.lastWeek(nowMs(ctx));
50
+ const stateDir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
51
+ // the rows as already read (no synchronous derive on a request): while they are being read, titles fall back to the initiative id
52
+ let rows = [];
53
+ try { const IR = require('./initiative-rows.js').rowsFor(w.root); rows = IR && IR.ok ? IR.rows : []; } catch { rows = []; }
54
+ const f = require('./drift-facts.js').factsOf({ id: w.id, name: w.name || w.id, root: w.root }, { stateDir, rows });
55
+ const r = WM.movesOf(f, W);
56
+ return send({ status: 200, body: { ok: true, ws: w.id, name: w.name || w.id, week: W.week, notRead: f.notRead, moves: r.moves, total: r.total, unsourced: r.unsourced } });
57
+ } catch (e) {
58
+ console.warn(WM.TAG + ' could not read the moves of ' + w.id + ': ' + ((e && e.message) || e));
59
+ return send(bad(500, 'The moves could not be read.'));
60
+ }
61
+ }
37
62
  if (!['drop', 'undo', 'looked'].includes(what)) return send(bad(404, 'no such drift route'));
38
63
  if (req.method !== 'POST') return send(bad(405, 'POST only'));
39
64
  if (req.headers && req.headers['x-pmos-session']) return send(bad(403, 'Only you drop an item, from the page.'));
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* week-moves.js — the weekly what-moved list (initiative weekly-what-moved; bet A441). READ-ONLY: it writes nothing anywhere.
4
+ *
5
+ * Once a week the PM sees one short list of every date and scope change of the past week, on every product: each with its source, or a
6
+ * "No source" flag and the owner to ask. Products record about 5 to 20 such moves a week (proof T38), so one list stays readable.
7
+ *
8
+ * movesOf(facts, { from, to }) → { from, to, moves: [row], total, unsourced } PURE. facts: lib/drift-facts.js factsOf, one or a list
9
+ * lastWeek(now) → { week, from, to } the Monday (local) of the week before the week of now, and its bounds in ms
10
+ * weekOfDay(day) → { week, from, to } the week that holds YYYY-MM-DD
11
+ * forRepo(root, { week? , now? }) → movesOf of one checkout (its state folder found as `pmos drift` finds it)
12
+ *
13
+ * A ROW: { at, kind, product, name, ini, iniTitle, task, title, n, titles, was, now, say, by, source, sourced, owner, toPm, why, ref, quote }
14
+ * kind date (a due date that moved: was → now; a date set for the first time is not a move) · added · removed · restored (scope)
15
+ * n the scope rows of one initiative, one kind, one writer and one source fold into one row: n tasks, the first titles in `titles`
16
+ * by who made it: 'you' (the PM), 'the tracker', 'PMOS' (an agent), or the name a line carries
17
+ * source what it rests on: 'Your own change', the tracker, the kind of source its reason names (lib/source-guard.js kindOf), or what the
18
+ * line cites; null when it rests on nothing. An agent's move with no reason, "No reason found…", or only the plan itself (two
19
+ * dates that meet are a guess) is not sourced.
20
+ * owner who to ask: the task's owner, else the PM ('you', toPm) when the plan names nobody or names an agent
21
+ * ref path:line of the line it came from, and `quote` that line's text (lib/drift-facts.js)
22
+ *
23
+ * CLI: node lib/week-moves.js list|count [<root>] [--week YYYY-MM-DD] [--json]. `count` ends with the number of moves on its last line.
24
+ * Every log line carries [moves]. */
25
+ const path = require('path');
26
+ const D = require('./drift.js');
27
+ const SG = require('./source-guard.js');
28
+
29
+ const TAG = '[moves]';
30
+ const SCOPE = { task: 'added', 'task-remove': 'removed', 'task-restore': 'restored' };
31
+ const SCOPE_WORDS = { added: ['task added', 'tasks added'], removed: ['task removed', 'tasks removed'], restored: ['task put back', 'tasks put back'] };
32
+ const NO_REASON = /^\s*no reason\b/i;
33
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
34
+ const isDate = (s) => /^\d{4}-\d{2}-\d{2}/.test(String(s || ''));
35
+ const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
36
+ /** 5 Nov, or 5 Nov 2027 when the year is not `year`. */
37
+ function short(s, year) {
38
+ if (!isDate(s)) return 'none';
39
+ const [y, m, d] = String(s).slice(0, 10).split('-').map(Number);
40
+ return d + ' ' + MON[m - 1] + (year && y !== year ? ' ' + y : '');
41
+ }
42
+
43
+ /** The week before the week of `now` (the PM's Monday, local time). */
44
+ function lastWeek(now = Date.now()) { const week = D.prevWeek(D.weekOf(now)); return { week, from: D.weekStart(week), to: D.weekEnd(week) }; }
45
+ /** The week that holds the day YYYY-MM-DD. */
46
+ function weekOfDay(day) { const week = D.weekOf(D.weekStart(String(day).slice(0, 10)) + 12 * 3600000); return { week, from: D.weekStart(week), to: D.weekEnd(week) }; }
47
+
48
+ /** Who made a line, and what it rests on. PURE. */
49
+ function sourceOf(l) {
50
+ const by = String(l.by || '');
51
+ if (l.tracker || /^tracker:/.test(by)) { const t = by.replace(/^tracker:/, '') || 'jira'; const name = t === 'jira' ? 'Jira' : t; return { by: 'the tracker', source: name, sourced: true }; }
52
+ if (/^pm:/.test(by)) return { by: 'you', source: 'Your own change', sourced: true };
53
+ const agent = !by || /^(agent:|pmos:|claude\b)/i.test(by);
54
+ const cites = (l.cites || []).filter((c) => !NO_REASON.test(c) && !SG.noReason(c));
55
+ if (cites.length) return { by: agent ? 'PMOS' : by, source: clip(cites[0], 80), sourced: true };
56
+ const why = String(l.why || '');
57
+ if (!agent) return { by, source: by + "'s own change", sourced: true }; // a named person changed it: they are the source to ask
58
+ if (!why.trim() || SG.noReason(why) || NO_REASON.test(why)) return { by: 'PMOS', source: null, sourced: false };
59
+ const kind = SG.kindOf(why);
60
+ if (kind === 'other' || kind === 'plan') return { by: 'PMOS', source: null, sourced: false };
61
+ return { by: 'PMOS', source: SG.KIND_NAMES[kind] || kind, sourced: true };
62
+ }
63
+
64
+ /** Who to ask about a task: its owner, else the PM. */
65
+ function ownerOf(owner) {
66
+ const o = String(owner || '').trim();
67
+ if (!o || /^(pm:|agent:|claude\b|pmos\b)/i.test(o) || o === 'you') return { owner: 'you', toPm: true };
68
+ return { owner: clip(o, 60), toPm: false };
69
+ }
70
+
71
+ /** The date and scope moves of one product inside [from, to). PURE. */
72
+ function productMoves(f, from, to) {
73
+ const titles = new Map((f.initiatives || []).map((i) => [i.id, i.title || i.id]));
74
+ const rows = [], scope = new Map();
75
+ for (const t of f.tasks || []) {
76
+ const lines = (t.lines || []).filter((l) => Number.isFinite(l.at)).slice().sort((a, b) => a.at - b.at);
77
+ let due, owner;
78
+ for (const l of lines) {
79
+ if (typeof l.owner === 'string' && l.owner.trim()) owner = l.owner;
80
+ const inWeek = l.at >= from && l.at < to;
81
+ const base = () => ({ at: new Date(l.at).toISOString(), product: f.ws, name: f.name || f.ws, ini: t.initiative, iniTitle: titles.get(t.initiative) || t.initiative,
82
+ task: t.id, title: t.title, why: clip(l.why, 200), ref: (l.src && l.src.ref) || '', quote: (l.src && l.src.quote) || '', ...sourceOf(l), ...ownerOf(owner) });
83
+ if (inWeek && SCOPE[l.kind]) {
84
+ const b = base(), kind = SCOPE[l.kind];
85
+ const key = [t.initiative, kind, b.by, b.source || ''].join('|');
86
+ const g = scope.get(key);
87
+ if (g) { g.n++; if (g.titles.length < 3) g.titles.push(t.title); if (b.at > g.at) g.at = b.at; if (!b.toPm && g.toPm) { g.owner = b.owner; g.toPm = false; } }
88
+ else scope.set(key, { ...b, kind, n: 1, titles: [t.title], was: null, now: null });
89
+ }
90
+ if (l.due !== undefined) {
91
+ const next = isDate(l.due) ? String(l.due).slice(0, 10) : '';
92
+ if (inWeek && l.kind === 'task-update' && due !== undefined && next !== due) rows.push({ ...base(), kind: 'date', n: 1, titles: [t.title], was: due || null, now: next || null });
93
+ due = next;
94
+ }
95
+ }
96
+ }
97
+ return rows.concat([...scope.values()]);
98
+ }
99
+
100
+ function sayOf(r, year) {
101
+ if (r.kind === 'date') return r.now ? (r.was ? `Due ${short(r.was, year)} → ${short(r.now, year)}` : `Due set to ${short(r.now, year)}`) : `Due ${short(r.was, year)} taken off`;
102
+ const w = SCOPE_WORDS[r.kind];
103
+ return r.n === 1 ? w[0][0].toUpperCase() + w[0].slice(1) : `${r.n} ${w[1]}`;
104
+ }
105
+
106
+ /** facts: one lib/drift-facts.js factsOf result, or a list of them. → { from, to, moves, total, unsourced } PURE. */
107
+ function movesOf(facts, { from, to } = {}) {
108
+ const list = Array.isArray(facts) ? facts : [facts];
109
+ const year = new Date(Number.isFinite(from) ? from : Date.now()).getFullYear();
110
+ const moves = [];
111
+ for (const f of list) if (f) moves.push(...productMoves(f, from, to));
112
+ moves.sort((a, b) => (a.sourced === b.sourced ? 0 : a.sourced ? 1 : -1) || String(a.name).localeCompare(String(b.name)) || (a.at < b.at ? 1 : a.at > b.at ? -1 : 0));
113
+ for (const m of moves) m.say = sayOf(m, year);
114
+ const total = moves.reduce((s, m) => s + m.n, 0), unsourced = moves.filter((m) => !m.sourced).reduce((s, m) => s + m.n, 0);
115
+ return { from: new Date(from).toISOString(), to: new Date(to).toISOString(), moves, total, unsourced };
116
+ }
117
+
118
+ /** One checkout's list for a week (last week when none is named). Reads its ledgers; writes nothing. */
119
+ function forRepo(root, { week, now = Date.now(), name } = {}) {
120
+ const Dr = require('./driver.js');
121
+ const stateDir = Dr.stateDirOf(root);
122
+ const W = week ? weekOfDay(week) : lastWeek(now);
123
+ const f = require('./drift-facts.js').factsOf({ id: Dr.wsIdOf(root), name: name || path.basename(root), root }, { stateDir });
124
+ return { week: W.week, notRead: f.notRead, ...movesOf(f, W) };
125
+ }
126
+
127
+ function main(argv, { say = (s) => console.log(s), cwd = process.cwd(), now = Date.now() } = {}) {
128
+ const pos = [], flags = {};
129
+ for (let i = 0; i < argv.length; i++) { const a = argv[i]; if (a === '--json') flags.json = true; else if (a === '--week') flags.week = argv[++i]; else pos.push(a); }
130
+ const [sub = 'list', rootArg] = pos;
131
+ if (!['list', 'count'].includes(sub) || (flags.week !== undefined && !/^\d{4}-\d{2}-\d{2}$/.test(String(flags.week)))) {
132
+ say('usage: node lib/week-moves.js list|count [<root>] [--week YYYY-MM-DD] [--json] — last week\'s date and scope moves, each with its source or "No source"');
133
+ return 2;
134
+ }
135
+ const root = path.resolve(cwd, rootArg || '.');
136
+ let r;
137
+ try { r = forRepo(root, { week: flags.week, now }); } catch (e) { say(`${TAG} could not read ${root}: ${(e && e.message) || e}`); return 1; }
138
+ if (flags.json) { say(JSON.stringify(sub === 'count' ? { week: r.week, total: r.total, unsourced: r.unsourced, notRead: r.notRead } : r)); return 0; }
139
+ if (sub === 'list') for (const m of r.moves) say(`${m.sourced ? ' ' : '!'} ${m.name} · ${m.iniTitle} · ${m.say} · ${m.n === 1 ? m.title : m.titles.join(', ')} · ${m.sourced ? m.source : 'No source · ask ' + m.owner} [${m.ref}]`);
140
+ say(`${TAG} week of ${r.week}: ${r.total} ${r.total === 1 ? 'move' : 'moves'} in dates and scope, ${r.unsourced} with no source${r.notRead.length ? ' (not read: ' + r.notRead.join(', ') + ')' : ''}`);
141
+ if (sub === 'count') say(String(r.total));
142
+ return 0;
143
+ }
144
+
145
+ module.exports = { movesOf, lastWeek, weekOfDay, forRepo, sourceOf, ownerOf, main, TAG };
146
+
147
+ if (require.main === module) process.exitCode = main(process.argv.slice(2));
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.703.0",
3
+ "version": "0.705.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.703.0",
9
+ "version": "0.705.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.703.0",
3
+ "version": "0.705.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -438,6 +438,8 @@ function rankIn() {
438
438
  if (S.impact && S.impact.c && !S.impact.c.looked) extra.push({ key: 'impact', go: 'impact', title: 'Your impact: ' + S.impact.c.label + ' is ready to check', sub: 'A thank-you and what really moved, from your records.' });
439
439
  const lp = LPV.chipOf(); if (lp) extra.push({ key: 'loose', go: 'loose', title: lp.n + (lp.n === 1 ? ' loose row' : ' loose rows') + ' to place in an initiative', sub: 'PMOS proposes where each one belongs.' });
440
440
  for (const l of S.lab || []) extra.push({ key: 'lab:' + l.ws, go: 'lab', ws: l.ws, board: l.board, title: l.n + (l.n === 1 ? ' Lab finding' : ' Lab findings') + ' to keep or drop', sub: l.say || 'Keep one to start an initiative, or let it go.' });
441
+ // weekly-what-moved (A441): last week's date and scope moves of every product, one row until the PM opens the list (pm/moves-view.js)
442
+ if (S.movesRow) extra.push(S.movesRow);
441
443
  return { products, programs: S.D.programs || [], move: S.move || {}, mentions: MEN.mentionsOf(S.D).waiting, outbox: S.outbox || [], gaps: (S.wait && S.wait.gaps) || [], extra };
442
444
  }
443
445
  /** Each product's GET /api/your-move, read when Your day opens (never on Home's first draw: page speed). */
@@ -459,10 +461,15 @@ async function readMove() {
459
461
  // agent-run (AwA, R4): the runs that stopped, one amber line in Claude did
460
462
  next[ws] = { verdicts: r.verdicts || [], kr: r.kr || null, expired: r.expired || [], done, notices: A ? A.notices || [] : [], failed: A ? A.failed || [] : [] };
461
463
  });
464
+ // weekly-what-moved (A441): each product's last week of date and scope moves (GET /api/drift/moves), folded into one Your move row
465
+ const mv = await Promise.all(L.map((ws) => pmGet('/api/drift/moves' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
466
+ S.moves = mv.filter((r) => r && r.ok);
467
+ const prevMoves = JSON.stringify(S.movesRow || null);
468
+ try { const MV = await import('./moves-view.js'); S.movesRow = MV.rowOf(S.moves, { looked: MV.lookedWeek() }); } catch { S.movesRow = null; }
462
469
  const ob = await pmGet('/api/outbox').catch(() => null);
463
470
  const outbox = ob && ob.ok && Array.isArray(ob.entries) ? ob.entries.filter((e) => e && (e.state === 'queued' || e.state === 'blocked')) : [];
464
471
  const lab = labs.filter(Boolean);
465
- const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []);
472
+ const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []) && prevMoves === JSON.stringify(S.movesRow || null);
466
473
  S.move = next; S.outbox = outbox; S.lab = lab;
467
474
  if (!same) { redrawLater(); drawList(); }
468
475
  // a demotion notice is said once: drawn now, then marked seen so the next read leaves it out
@@ -499,6 +506,7 @@ async function movePress(b) {
499
506
  if (r.kind === 'extra') {
500
507
  if (r.go === 'impact') { S.day = false; S.sel = 'impact'; if (isPhone()) S.phoneChat = true; openTarget(homeTarget()); drawList(); return; }
501
508
  if (r.go === 'loose') { VW.drill(); LPV.open(lpHost); return; }
509
+ if (r.go === 'moves') { VW.drill(); import('./moves-view.js').then((MV) => { MV.openMoves(S.moves || [], { toast }); S.movesRow = null; drawList(); }); return; }
502
510
  if (r.go === 'lab') { VW.drill(); import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: r.ws, board: r.board }), iniHref: (id) => '/premium-initiative.html?' + (r.ws ? 'ws=' + encodeURIComponent(r.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })); return; }
503
511
  return;
504
512
  }
@@ -172,7 +172,9 @@ export function comingUp(v, M) {
172
172
  for (const g of (st && st.gates && st.gates.open) || []) if (!g.late && g.iso) add('due', g.iso, stop(g.name + ' is due'), 'From the milestone task' + (g.owner ? ', owner ' + g.owner : ''));
173
173
  if (st && st.endIso && st.dates && !st.dates.over) add('due', st.endIso, 'The plan ends.', 'From the initiative’s end date');
174
174
  const A = M && M.ahead;
175
- if (A && A.outcome && A.outcome.date) add('outcome', A.outcome.date, stop('Outcome check: ' + (A.outcome.metric || 'the outcome')), 'From the outcome check date on the record');
175
+ // bet A451: a check the place it is measured cannot answer yet says so, with the one step that fixes it
176
+ if (A && A.outcome && A.outcome.date && A.outcome.blocked) add('outcome', A.outcome.date < today ? today : A.outcome.date, stop('Outcome check blocked: ' + A.outcome.blocked.why) + ' ' + stop(A.outcome.blocked.step), 'From the version on the record and the version that place runs');
177
+ else if (A && A.outcome && A.outcome.date) add('outcome', A.outcome.date, stop('Outcome check: ' + (A.outcome.metric || 'the outcome')), 'From the outcome check date on the record');
176
178
  if (M && M.kill) {
177
179
  const k = dateIn(M.kill, today), b = k ? '' : dateIn(M.budget, today);
178
180
  if (k || b) add('kill', k || b, stop('Kill check: ' + M.kill), k ? 'From the experiment’s stop line' : 'From the end of the experiment’s budget');
@@ -0,0 +1,62 @@
1
+ /* pm/moves-view.js — the weekly what-moved list (initiative weekly-what-moved; bet A441). Pure apart from openMoves: Node imports it
2
+ * (drift.test.js, cases M8).
3
+ *
4
+ * rowOf(lists, { looked }) → the Your move row ({ key, go, title, sub }) or null: null in a quiet week (zero is silence) and once the
5
+ * PM opened this week's list. lists: each product's GET /api/drift/moves answer.
6
+ * listHtml(lists, { esc }) → the list, one section per product, the moves with no source first; each says its source, or
7
+ * "No source · ask <owner>"
8
+ * openMoves(lists, H) the list in the Viewer. H: { toast }
9
+ * lookedWeek() · markLooked(week) which week the PM opened (this browser only; a missing store reads as not looked)
10
+ * Nothing here writes a record or sends anything. */
11
+
12
+ const KEY = 'pmos.moves.looked';
13
+ const escDefault = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
14
+ const ICON = 'M3 12h4l3-8 4 16 3-8h4';
15
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
16
+ const ok = (l) => l && l.ok && Array.isArray(l.moves);
17
+
18
+ export function lookedWeek() { try { return localStorage.getItem(KEY) || ''; } catch { return ''; } }
19
+ export function markLooked(week) { try { if (week) localStorage.setItem(KEY, week); } catch { /* this browser keeps no store */ } }
20
+
21
+ /** The Your move row for last week's moves, or null. */
22
+ export function rowOf(lists, { looked = '' } = {}) {
23
+ const L = (lists || []).filter(ok);
24
+ const total = L.reduce((s, l) => s + (l.total || 0), 0);
25
+ if (!total) return null;
26
+ const week = (L.find((l) => l.week) || {}).week || '';
27
+ if (week && looked === week) return null;
28
+ const unsourced = L.reduce((s, l) => s + (l.unsourced || 0), 0);
29
+ return { key: 'moves:' + week, go: 'moves', week,
30
+ title: 'Last week: ' + plural(total, 'move', 'moves') + ' in dates and scope',
31
+ sub: unsourced ? unsourced + ' with no source. See who to ask.' : 'Each one has a source.' };
32
+ }
33
+
34
+ function moveHtml(m, esc) {
35
+ const what = m.n > 1 ? m.titles.join(', ') + (m.n > m.titles.length ? ', …' : '') : m.title;
36
+ const src = m.sourced ? esc(m.source) : `<strong>No source</strong> · ${m.toPm ? 'yours to check' : 'ask ' + esc(m.owner)}`;
37
+ return `<li class="mv-row${m.sourced ? '' : ' mv-flag'}"><span class="mv-say">${esc(m.say)}</span> · ${esc(what)}`
38
+ + `<br><span class="yd-exp">${esc(m.iniTitle)} · ${src}${m.by && m.by !== 'you' && m.sourced ? ' · by ' + esc(m.by) : ''}</span></li>`;
39
+ }
40
+
41
+ /** The list, one section per product. */
42
+ export function listHtml(lists, { esc = escDefault } = {}) {
43
+ const L = (lists || []).filter(ok).filter((l) => l.moves.length);
44
+ if (!L.length) return '<p class="yd-exp">Nothing moved in dates or scope last week.</p>';
45
+ const many = L.length > 1;
46
+ return L.map((l) => {
47
+ const rows = l.moves.slice().sort((a, b) => (a.sourced === b.sourced ? 0 : a.sourced ? 1 : -1));
48
+ const head = many ? `<h3>${esc(l.name || l.ws)}</h3>` : '';
49
+ const sum = `<p class="yd-exp">${esc(plural(l.total, 'move', 'moves'))}${l.unsourced ? ', ' + esc(String(l.unsourced)) + ' with no source' : ''}.</p>`;
50
+ return `<section class="mv-prod">${head}${sum}<ul class="mv-list">${rows.map((m) => moveHtml(m, esc)).join('')}</ul></section>`;
51
+ }).join('');
52
+ }
53
+
54
+ /** The list in the Viewer; opening it marks the week as looked. */
55
+ export function openMoves(lists, H = {}) {
56
+ const VW = window.czViewer;
57
+ const row = rowOf(lists);
58
+ if (row) markLooked(row.week);
59
+ if (!VW) { if (H.toast) H.toast('The list could not open here.'); return; }
60
+ VW.open({ id: 'moves:' + ((row && row.week) || ''), kind: 'What moved', title: 'What moved last week', icon: ICON, presses: [],
61
+ render: (b) => { b.innerHTML = listHtml(lists); } });
62
+ }