create-pmos 0.845.0 → 0.847.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.845.0",
3
+ "version": "0.847.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,52 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.847.0",
38
+ "at": "2026-11-25T18:22:14.213Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1883,
43
+ "t": "The chat runs pmos pick when you say how long you have",
44
+ "s": "The chat runs pmos pick when you say how long you have",
45
+ "k": "fix"
46
+ },
47
+ {
48
+ "n": 2031,
49
+ "t": "One RAID list per initiative, read from its own records (A101)",
50
+ "s": "One RAID list per initiative, read from its own records (A101)",
51
+ "k": "new",
52
+ "h": "One RAID list per initiative, read from its own records (A101)",
53
+ "try": {
54
+ "steps": [
55
+ "Open Work and open an initiative that has a late task or a risk nobody touched for two weeks",
56
+ "Read the RAID line in its Overview",
57
+ "Ask PMOS to show the whole RAID list of that initiative"
58
+ ],
59
+ "see": "The Overview has one RAID line, for example '2 of 5 have not moved in 14 days: Late: Ship the copy (due 12 Nov)'. An initiative where everything moved has no RAID line. The chat shows each risk,…",
60
+ "open": "/premium-board.html"
61
+ },
62
+ "i": "raid-fold"
63
+ },
64
+ {
65
+ "n": 2044,
66
+ "t": "Work checks for new rows instead of re-reading the board every 2 s",
67
+ "s": "Work checks for new rows instead of re-reading the board every 2 s",
68
+ "k": "imp",
69
+ "i": "page-open-200ms",
70
+ "try": {
71
+ "steps": [
72
+ "Open Today, then Work, then an initiative from Work.",
73
+ "Change something on the initiative (a task title), wait a second, then open Work again.",
74
+ "Open the same initiative again."
75
+ ],
76
+ "see": "each page shows its rows at once, in about the blink of an eye; the change you made shows on Work and on the initiative.",
77
+ "open": "/premium-board.html"
78
+ }
79
+ }
80
+ ]
81
+ },
36
82
  {
37
83
  "v": "0.845.0",
38
84
  "at": "2026-11-25T18:02:38.683Z",
@@ -1060,20 +1106,6 @@
1060
1106
  }
1061
1107
  }
1062
1108
  ]
1063
- },
1064
- {
1065
- "v": "0.823.0",
1066
- "at": "2026-11-25T09:34:55.769Z",
1067
- "f": 4,
1068
- "prs": [
1069
- {
1070
- "n": 1888,
1071
- "t": "Pmos report variants, one report for executives, engineers and customers (A406)",
1072
- "s": "Pmos report variants, one report for executives, engineers and customers (A406)",
1073
- "k": "new",
1074
- "i": "report-three-audiences"
1075
- }
1076
- ]
1077
1109
  }
1078
1110
  ]
1079
1111
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@4669bd89c
1
+ kernel-source: pmos@fb68a5461
2
2
  assembled: 2026-11-25
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-25T18:02:34Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T18:22:10Z"}
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-25T18:02:34Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T18:22:10Z"}
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-25T18:02:34Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T18:22:10Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,50 @@
1
1
  [
2
+ {
3
+ "v": "0.847.0",
4
+ "at": "2026-11-25T18:22:14.213Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1883,
9
+ "t": "The chat runs pmos pick when you say how long you have",
10
+ "s": "The chat runs pmos pick when you say how long you have",
11
+ "k": "fix"
12
+ },
13
+ {
14
+ "n": 2031,
15
+ "t": "One RAID list per initiative, read from its own records (A101)",
16
+ "s": "One RAID list per initiative, read from its own records (A101)",
17
+ "k": "new",
18
+ "h": "One RAID list per initiative, read from its own records (A101)",
19
+ "try": {
20
+ "steps": [
21
+ "Open Work and open an initiative that has a late task or a risk nobody touched for two weeks",
22
+ "Read the RAID line in its Overview",
23
+ "Ask PMOS to show the whole RAID list of that initiative"
24
+ ],
25
+ "see": "The Overview has one RAID line, for example '2 of 5 have not moved in 14 days: Late: Ship the copy (due 12 Nov)'. An initiative where everything moved has no RAID line. The chat shows each risk,…",
26
+ "open": "/premium-board.html"
27
+ },
28
+ "i": "raid-fold"
29
+ },
30
+ {
31
+ "n": 2044,
32
+ "t": "Work checks for new rows instead of re-reading the board every 2 s",
33
+ "s": "Work checks for new rows instead of re-reading the board every 2 s",
34
+ "k": "imp",
35
+ "i": "page-open-200ms",
36
+ "try": {
37
+ "steps": [
38
+ "Open Today, then Work, then an initiative from Work.",
39
+ "Change something on the initiative (a task title), wait a second, then open Work again.",
40
+ "Open the same initiative again."
41
+ ],
42
+ "see": "each page shows its rows at once, in about the blink of an eye; the change you made shows on Work and on the initiative.",
43
+ "open": "/premium-board.html"
44
+ }
45
+ }
46
+ ]
47
+ },
2
48
  {
3
49
  "v": "0.845.0",
4
50
  "at": "2026-11-25T18:02:38.683Z",
@@ -430,6 +430,15 @@ Right after setup, PMOS drafts up to three starter goals from the product's own
430
430
  - `pmos goals drop <n>` drops draft n. It writes no goal.
431
431
  - `pmos goals undo` undoes the newest keep or drop. When you edited the kept line since, PMOS leaves it.
432
432
 
433
+ ### pmos raid: one RAID list per initiative
434
+
435
+ PMOS reads the risks, assumptions, issues and dependencies of an initiative from its own records and puts them in one list. Nothing is written.
436
+
437
+ - `pmos raid show <initiative>` prints each row with its owner, its next date and the day it last moved. A row with no move in 14 days is stale and comes first. `--json` prints the list as data.
438
+ - `pmos raid count` prints how many open initiatives have a stale row.
439
+
440
+ The risks are the experiment's Risks, the assumption is its hypothesis, the issues are open tasks that are late or blocked, and the dependencies are task links to another initiative's tasks. When an initiative has a stale row, its Overview in Work shows one RAID line.
441
+
433
442
  ### pmos hire: draft the next hire from the work that waits
434
443
 
435
444
  Show where the team is short before you ask for headcount. Run it in the product's repository, or pass `--root <dir>`, or ask the chat to "draft the next hire". No running workspace is needed.
@@ -509,7 +509,7 @@ A refresh waits for the sources it uses. The briefing waits for work assigned to
509
509
  - **One server runs the schedules.** When several PMOS servers run on one computer (for example an npm install and a checkout), only one of them runs the schedules and starts background runs; the others serve pages only. If that server stops, another one takes over within 3 minutes. A refresh you press runs on the server where you press it.
510
510
  - **Quiet start**: a server starts no background run in its first 5 minutes, so the first pages load quickly. A missed refresh catches up after that.
511
511
  - **Warm start**: 5 seconds after PMOS starts, it reads what Today and Work show once, so your first page opens as fast as later ones. This read writes nothing you would see as read or seen. `PMOS_WARM=off` turns it off.
512
- - **Pages open from their last answer**: Today, Work and an initiative show the answer PMOS read last, while nothing changed since, and PMOS reads them again quietly when it is not busy. A change you, the chat or an agent make shows on the next open, also when it is written outside PMOS (PMOS watches the planning and pmos folders): the change makes every kept answer too old, and PMOS reads the newest pages again about a second later. Work also reads its first twelve initiatives ahead, so opening one from Work is fast too. A restart starts empty.
512
+ - **Pages open from their last answer**: Today, Work and an initiative show the answer PMOS read last, while nothing changed since, and PMOS reads them again quietly when it is not busy. A change you, the chat or an agent make shows on the next open, also when it is written outside PMOS (PMOS watches the planning and pmos folders): the change makes every kept answer too old, and PMOS reads the newest pages again about a second later. Work also reads its first twelve initiatives ahead, so opening one from Work is fast too. A restart starts empty. While PMOS reads the initiative rows again, Work asks every 2 s only whether the new rows are there, and reads the whole board once, when they are.
513
513
  - **Fresh answers, asked once**: when two parts of a page ask for the same thing at the same moment, the server is asked once and both get the same answer. Nothing is kept after it arrives, so the next look always reads again.
514
514
  - **Last view while Today reads**: Today shows the list from your last visit at once, with a hollow ring next to "Good morning". You can read that list, but you cannot use it until the new read is in. Then the ring goes away. Before a section has data, it shows grey shapes with no names and no counts. Each section fills in when its own data arrives. If the Viewer was open on your last visit, its space stays empty, so the chat does not change width. Adler's face next to the greeting thinks while Today reads, and changes to handled when the read is in. If the read fails, it changes to honest.
515
515
  - **Work while it reads**: the toolbar and the tabs show at once, with grey rows below them. If the read takes more than 2 seconds, the line "Still reading the board." shows. There is no progress bar and no percent.
@@ -52,7 +52,7 @@ function routeOf(text) {
52
52
 
53
53
  const RULE = [
54
54
  'You are the PM\'s chief of staff in PMOS. This chat has no scope: it reads everything the PM works on.',
55
- 'Read with the `pmos` commands (pmos today, pmos board, pmos jira, pmos calendar, pmos past, pmos mention, pmos outcomes, pmos metrics, pmos people, pmos docs, pmos report list), never by opening PMOS record files (*.jsonl, planning/ records) yourself: the commands apply the same rules the pages do. Run `pmos <verb> help` when unsure.',
55
+ 'Read with the `pmos` commands (pmos today, pmos pick, pmos board, pmos jira, pmos calendar, pmos past, pmos mention, pmos outcomes, pmos metrics, pmos people, pmos docs, pmos report list), never by opening PMOS record files (*.jsonl, planning/ records) yourself: the commands apply the same rules the pages do. Run `pmos <verb> help` when unsure. When the PM says how long they have ("I have 30 minutes", "half an hour"), run `pmos pick --minutes <n>` with those minutes and answer with the line it prints.',
56
56
  'End every answer that rests on a read with one fenced code block with the language tag pmos-src holding one JSON array: [{"name":"Work","fresh":"read now"},{"name":"Jira","fresh":"read 4 min ago"}]. Name each source and how fresh it is; say "not read" for one you could not reach. The page shows it under your answer.',
57
57
  'Five kinds of work, one rule each. A read runs at once and asks nothing. Upkeep with one right answer (repair a record, close an ask a decision retired, refresh a stale read) you finish, and say it once. A change inside PMOS (move a date, add a task, set a state, a program\'s goal) that the PM asked for in their own words, or said yes to, you make at once with its `pmos` command and give the Undo it prints: the page shows it when your turn ends (Wawan 2026-11-23: a chat write always lands). A change the PM did not ask for is a proposal the PM keeps with ✓: file it with `pmos propose` or `pmos task`. Never write a record file by hand. Anything that leaves PMOS (email, Slack, a Jira comment, an invite) is a draft in the outbox that the PM sends: never send it. A longer job (a report, a grill, an update, a clean-up) runs to its end; stop only for a call that is the PM\'s, and save those for one proposal.',
58
58
  'Never from this chat: accept a run, anchor or dispose an initiative, approve a contract, merge a pull request. These stay on the PM-only pages. Say where each one waits and stop.',
@@ -99,6 +99,7 @@
99
99
  {"id": "metrics", "audience": "agent", "status": "ga", "group": "Your product", "name": "Metric drafts", "say": "A metric-draft run files a metric for you to keep or drop.", "cmd": "/metrics", "verb": "metrics"},
100
100
  {"id": "impact", "audience": "agent", "status": "ga", "group": "Your product", "name": "Impact findings", "say": "An impact run files a finding for you to check.", "cmd": "/impact", "verb": "impact"},
101
101
  {"id": "coredoc", "audience": "agent", "status": "ga", "group": "Plan and decide", "name": "Core document drafts", "say": "A run writes one draft of a core document; you issue it on the page.", "cmd": "/coredoc", "verb": "coredoc"},
102
- {"id": "mcp", "audience": "agent", "status": "ga", "group": "Find your way", "name": "PMOS cards for other agents", "say": "PMOS cards for another agent, over MCP.", "cmd": "/mcp-cards", "verb": "mcp"}
102
+ {"id": "mcp", "audience": "agent", "status": "ga", "group": "Find your way", "name": "PMOS cards for other agents", "say": "PMOS cards for another agent, over MCP.", "cmd": "/mcp-cards", "verb": "mcp"},
103
+ {"id": "raid", "audience": "user", "status": "beta", "group": "Catch up", "name": "RAID list", "say": "Risks, assumptions, late tasks and dependencies of one initiative, with owner, next date and what has gone stale.", "cmd": "/raid", "verb": "raid", "hint": "show <initiative>"}
103
104
  ]
104
105
  }
@@ -173,6 +173,9 @@ const VERBS = Object.freeze({
173
173
  // Not a pm-os-absorb verb (run: null): initiative starter-goals (job #1916, A84) added it through the same table.
174
174
  goals: Object.freeze({ module: 'goals-cli.js', run: null, guide: 'cli.md',
175
175
  help: 'pmos goals [starter|draft|keep <n>|drop <n>|undo] — starter goals PMOS drafts from your own product, each with its source; keep one and it becomes a goal (pmos goals help)' }),
176
+ // Not a pm-os-absorb verb (run: null): initiative raid-fold (job #2025, A101) added it through the same table.
177
+ raid: Object.freeze({ module: 'raid-cli.js', run: null, guide: 'cli.md',
178
+ help: 'pmos raid show|count — one RAID list per initiative: risks, assumptions, late tasks and dependencies, read from its own records (pmos raid help)' }),
176
179
  hire: Object.freeze({ module: 'hire-draft.js', run: null, guide: 'cli.md',
177
180
  help: 'pmos hire [draft|show|count] — the role your open work most needs, per person, and a one-page role brief PMOS drafts for you to edit (pmos hire help)' }),
178
181
  // Not a pm-os-absorb verb (run: null): initiative built-vs-design (job #1903, A380) added it through the same table.
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+ /* raid-cli.js — `pmos raid show|count` (initiative raid-fold, A101). The verb lives in lib/raid.js; this file is its name in lib/pmos-verbs.js. */
3
+ const R = require('./raid.js');
4
+
5
+ module.exports = { run: R.run, COMMANDS: R.COMMANDS, USAGE: R.USAGE };
@@ -0,0 +1,173 @@
1
+ 'use strict';
2
+ /* raid.js — one RAID list per initiative, read from its own records (initiative raid-fold, idea A101, light bar, read-only slice).
3
+ *
4
+ * fold(input, today) PURE → { id, rows, stale, total }
5
+ * input = { id, owner, check, risks: [{ text, by, at }], assumption: { text, by, at } | null,
6
+ * tasks: [{ id, title, state, owner, due, since, blocked }], links: [{ from, to, at }], taskIni: Map task id → initiative,
7
+ * taskOf: Map task id → { title, due, owner } }
8
+ * row = { kind: 'risk' | 'assumption' | 'issue' | 'dependency', text, owner, next, moved, stale, source }
9
+ * risk each line of the experiment's Risks (lib/artefacts.js); owner the record's owner; next the check date
10
+ * assumption the experiment's hypothesis; owner and next as a risk
11
+ * issue an open task (To do, In progress) that is blocked or past its due day; owner the task's; next its due day
12
+ * dependency a task link with one end on this initiative and the other on another initiative's task; next the other task's due day
13
+ * moved: the day the row last moved (a set's day, a task's last state change, the link's day). A row with no move in STALE_DAYS days is
14
+ * stale; stale rows come first, the stalest first. A row whose move is not known is never called stale.
15
+ * gather(ctx, w, id) → input the experiment artefact, the tasks `pmos task list` reads (lib/stage-read.js), task-links.jsonl, the
16
+ * record's owner and check date (outcome_horizon, check_date)
17
+ * ofRoot(root, id, today) → fold | null the same from a repository folder (the route and the CLI)
18
+ * lineOf(result) → { text, stale, total } | null the Work popup's one line (LINE.md Rule 12): null when no row is stale (zero is silence)
19
+ * CLI (pmos raid, lib/pmos-verbs.js): show <initiative> [--json] [--root <repo>] · count [--root <repo>]
20
+ *
21
+ * WHAT IT NEVER DOES. It writes no record, calls no model and sends nothing. Every read logs one [raid] line. */
22
+ const path = require('path');
23
+
24
+ const TAG = '[raid]';
25
+ const STALE_DAYS = 14;
26
+ const OPEN = new Set(['To do', 'In progress']);
27
+ const KIND_WORD = { risk: 'Risk', assumption: 'Assumption', issue: 'Late', dependency: 'Waits on' };
28
+ const day = (v) => { const s = String(v || '').slice(0, 10); return /^\d{4}-\d{2}-\d{2}$/.test(s) ? s : null; };
29
+ const daysBetween = (a, b) => Math.round((Date.parse(b + 'T00:00:00Z') - Date.parse(a + 'T00:00:00Z')) / 86400000);
30
+ const clean = (s) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim();
31
+
32
+ /** PURE. */
33
+ function fold(input, today) {
34
+ const I = input || {};
35
+ const t0 = day(today) || new Date().toISOString().slice(0, 10);
36
+ const rows = [];
37
+ const push = (r) => {
38
+ const moved = day(r.moved);
39
+ rows.push({ ...r, moved, stale: !!moved && daysBetween(moved, t0) >= STALE_DAYS });
40
+ };
41
+ for (const x of I.risks || []) if (x && clean(x.text)) push({ kind: 'risk', text: clean(x.text), owner: I.owner || '', next: day(I.check), moved: x.at, source: 'the experiment' });
42
+ if (I.assumption && clean(I.assumption.text)) push({ kind: 'assumption', text: clean(I.assumption.text), owner: I.owner || '', next: day(I.check), moved: I.assumption.at, source: 'the experiment' });
43
+ const mine = new Set((I.tasks || []).map((t) => t && t.id));
44
+ for (const t of I.tasks || []) {
45
+ if (!t || !OPEN.has(t.state)) continue;
46
+ const due = day(t.due);
47
+ const late = !!due && due < t0;
48
+ if (!late && !t.blocked) continue;
49
+ push({ kind: 'issue', text: clean(t.title), owner: t.owner || '', next: due, moved: t.since || null, source: 'task ' + t.id, why: t.blocked ? 'blocked' : 'late' });
50
+ }
51
+ const iniOf = I.taskIni || new Map(), taskOf = I.taskOf || new Map();
52
+ for (const l of I.links || []) {
53
+ if (!l) continue;
54
+ const a = mine.has(l.from), b = mine.has(l.to);
55
+ if (a === b) continue; // both ends here, or neither: not a dependency between initiatives
56
+ const other = a ? l.to : l.from;
57
+ const otherIni = iniOf.get(other) || (/^[A-Z][A-Z0-9]{1,9}-\d+$/.test(String(other)) ? 'Jira ' + other : '');
58
+ if (otherIni === I.id) continue;
59
+ const o = taskOf.get(other) || {};
60
+ const here = (I.tasks || []).find((t) => t.id === (a ? l.from : l.to)) || {};
61
+ const words = a ? `${clean(o.title) || other} waits on ${clean(here.title) || l.from}` : `${clean(here.title) || l.to} waits on ${clean(o.title) || other}`;
62
+ push({ kind: 'dependency', text: words + (otherIni ? ' (' + otherIni + ')' : ''), owner: (a ? here.owner : o.owner) || '', next: day(a ? here.due : o.due), moved: l.at, source: 'task link' });
63
+ }
64
+ rows.sort((x, y) => (y.stale - x.stale) || String(x.moved || '9').localeCompare(String(y.moved || '9')));
65
+ return { id: I.id || '', rows, stale: rows.filter((r) => r.stale).length, total: rows.length };
66
+ }
67
+
68
+ /** The Work popup's one line, or null when nothing is stale. */
69
+ function lineOf(res) {
70
+ if (!res || !res.stale) return null;
71
+ const r = res.rows.find((x) => x.stale);
72
+ const dd = (d) => { const t = new Date(d + 'T00:00:00Z'); return t.getUTCDate() + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][t.getUTCMonth()]; };
73
+ const when = r.kind === 'issue' && r.next ? ' (due ' + dd(r.next) + ')' : r.moved ? ' (last moved ' + dd(r.moved) + ')' : '';
74
+ return { text: `${res.stale} of ${res.total} have not moved in ${STALE_DAYS} days. ${KIND_WORD[r.kind]}: ${r.text}${when}`, stale: res.stale, total: res.total };
75
+ }
76
+
77
+ /* ── reading the records ── */
78
+ function gather(ctx, w, id) {
79
+ const A = require('./artefacts.js');
80
+ let ex = null;
81
+ try { const v = A.viewOf(A.fold(A.readLines(A.file(A.dirOf(w.root)))), 'experiment:' + id); ex = v && v.artefacts.find((a) => a.key === 'experiment'); } catch { ex = null; }
82
+ let front = {};
83
+ try { const IW = require('./item-why.js'), f = IW.recordPathOf(w.root, id); if (f) front = IW.frontOf(require('fs').readFileSync(f, 'utf8')) || {}; } catch { front = {}; }
84
+ let tasks = [];
85
+ try { tasks = require('./stage-read.js').tasksOf(ctx, w, id); } catch { tasks = []; }
86
+ const taskIni = new Map(), taskOf = new Map();
87
+ try {
88
+ const F = require('./routes-boards.js').foldOf(ctx, w);
89
+ for (const t of (F.tasks || new Map()).values()) { taskIni.set(t.id, t.initiative); taskOf.set(t.id, { title: t.title, due: t.due, owner: t.owner }); }
90
+ } catch { /* a board that cannot be read: no other initiative's task is known */ }
91
+ for (const t of tasks) { taskIni.set(t.id, id); taskOf.set(t.id, t); }
92
+ let links = [];
93
+ try { const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null; if (dir) links = [...require('./task-links.js').read(dir).links.values()]; } catch { links = []; }
94
+ const fx = (ex && ex.fields) || {};
95
+ return {
96
+ id,
97
+ owner: clean(front.owner || (fx.executor && fx.executor.text) || ''),
98
+ check: front.outcome_horizon || front.check_date || null,
99
+ risks: Array.isArray(fx.risks) ? fx.risks : [],
100
+ assumption: fx.hypothesis || null,
101
+ tasks: tasks.map((t) => ({ id: t.id, title: t.title, state: t.state, owner: t.owner, due: t.due, since: t.since || null, blocked: !!t.blocked })),
102
+ links: links.map((l) => ({ from: l.from, to: l.to, at: l.at })),
103
+ taskIni, taskOf,
104
+ };
105
+ }
106
+
107
+ function ctxOf(root) {
108
+ const driver = require('./driver.js');
109
+ const dir = driver.stateDirOf(root);
110
+ if (!dir) return null;
111
+ const w = { id: driver.wsIdOf(root), name: path.basename(root), root };
112
+ return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => dir, selfRoot: path.resolve(__dirname, '..', '..') } };
113
+ }
114
+ function ofRoot(root, id, today) {
115
+ const c = ctxOf(root);
116
+ if (!c) return null;
117
+ const res = fold(gather(c.ctx, c.w, id), today);
118
+ console.info(TAG + ' read ini=' + id + ' rows=' + res.total + ' stale=' + res.stale);
119
+ return res;
120
+ }
121
+ function count(root, today) {
122
+ // the open initiatives (lib/notes-links.js); a kit repository keeps its records in pmos/state/initiatives instead
123
+ let ids = require('./notes-links.js').initiativesOf(root).map((i) => i.id);
124
+ if (!ids.length) { try { ids = require('fs').readdirSync(path.join(root, 'pmos', 'state', 'initiatives')).filter((f) => /^[a-z0-9][a-z0-9-]*\.md$/.test(f)).map((f) => f.slice(0, -3)); } catch { ids = []; } }
125
+ const c = ctxOf(root);
126
+ let n = 0;
127
+ if (c) for (const id of ids) { const r = fold(gather(c.ctx, c.w, id), today); if (r.stale) n += 1; }
128
+ console.info(TAG + ' count initiatives=' + ids.length + ' stale=' + n);
129
+ return { initiatives: ids.length, stale: n };
130
+ }
131
+
132
+ /* ── pmos raid ── */
133
+ const COMMANDS = { raid: ['show', 'count'] };
134
+ const USAGE = [
135
+ 'usage: pmos raid show|count — one RAID list per initiative: risks, assumptions, issues and dependencies, read from its own records',
136
+ ' pmos raid show <initiative> [--json] each row with its owner, next date and the day it last moved; stale rows (14 days) first',
137
+ ' pmos raid count how many initiatives have a stale row, on the last line',
138
+ ' every command: [--root <repository>]. Nothing is written.',
139
+ ];
140
+ function run(argv, { say = console.log, cwd = process.cwd(), today } = {}) {
141
+ const args = argv.slice(1), pos = [], fl = {};
142
+ for (let i = 0; i < args.length; i++) {
143
+ if (args[i] === '--json' || args[i] === '--help') fl[args[i].slice(2)] = true;
144
+ else if (args[i] === '--root') fl.root = args[++i];
145
+ else pos.push(args[i]);
146
+ }
147
+ let sub = pos[0];
148
+ if (!sub || fl.help || sub === 'help') { USAGE.forEach((l) => say(l)); return sub || fl.help ? 0 : 2; }
149
+ if (!COMMANDS.raid.includes(sub)) { pos.unshift('show'); sub = 'show'; } // pmos raid <initiative> reads as show
150
+ const root = path.resolve(cwd, fl.root || '.');
151
+ if (sub === 'count') {
152
+ const c = count(root, today);
153
+ say(`${c.stale} of ${c.initiatives} open initiatives have a RAID row with no move in ${STALE_DAYS} days`);
154
+ say(String(c.stale));
155
+ return 0;
156
+ }
157
+ const id = pos[1];
158
+ if (!id) { say('usage: pmos raid show <initiative> [--json]'); return 2; }
159
+ const r = ofRoot(root, id, today);
160
+ if (!r) { say('✗ this repository has no PMOS state folder (pmos/state, state or .pmos)'); return 1; }
161
+ if (fl.json) { say(JSON.stringify({ ok: true, ...r })); return 0; }
162
+ if (!r.total) { say(`Nothing to list for ${id}: no risk, assumption, late or blocked task, or dependency on another initiative.`); return 0; }
163
+ say(`${id}: ${r.total} row${r.total === 1 ? '' : 's'}${r.stale ? `, ${r.stale} with no move in ${STALE_DAYS} days` : ''}`);
164
+ for (const x of r.rows) say(` ${x.stale ? '! ' : ' '}${KIND_WORD[x.kind]} · ${x.text} · ${x.owner || 'no owner'} · next ${x.next || 'no date'} · moved ${x.moved || 'unknown'}`);
165
+ return 0;
166
+ }
167
+
168
+ module.exports = { TAG, STALE_DAYS, fold, lineOf, gather, ofRoot, count, run, COMMANDS, USAGE };
169
+
170
+ if (require.main === module) {
171
+ // node lib/raid.js count [--root <repo>] → the health number on the last line
172
+ process.exitCode = run(['raid', ...process.argv.slice(2)]);
173
+ }
@@ -9,6 +9,7 @@
9
9
  * carries `power` ({ n, weeks, weekly, due, ends, text, path }) only when the record's baseline, min_change
10
10
  * and weekly_traffic cannot reach a conclusion by its check date (lib/experiment-power.js), and `copyTests` (lib/copy-tests.js foldOf)
11
11
  * when the initiative has a copy or layout test, else `copyTestOffer` { initiative, flag } when its record names a rollout_flag
12
+ * and `raid` ({ text, stale, total }) only when a RAID row has not moved in 14 days (lib/raid.js lineOf)
12
13
  * GET /api/artefacts/story?ws → { ok, ws, story: { scope, at, lines: [{ text, sources }] } | null, seeding? } "The story so far" on the
13
14
  * product page (board AwE): the Narrative of board:<ws>, else of the portfolio (lib/artefacts.js storyOf). A
14
15
  * shared Board carries it without the sources (lib/board-pack.js). seeding: there is no story yet and PMOS is
@@ -178,6 +179,10 @@ function withRecord(artefacts, root, id) {
178
179
  if (w) ex.power = { ...w, path: require('path').relative(root, f).split(require('path').sep).join('/') };
179
180
  } catch { /* an unreadable record shows no warning */ }
180
181
  }
182
+ // a RAID row with no move in 14 days (raid-fold, A101; LINE.md Rule 12): read only, carried only when a row is stale (zero is silence)
183
+ if (ex) {
184
+ try { const R = require('./raid.js'), l = R.lineOf(R.ofRoot(root, id)); if (l) ex.raid = l; } catch { /* an unreadable initiative shows no RAID line */ }
185
+ }
181
186
  // the initiative's copy and layout tests (copy-tests, A351): carried only when there is one (zero is silence)
182
187
  // with no test yet, a record that names its rollout_flag carries an offer (copyTestOffer), so the block shows by itself (LINE Rule 12)
183
188
  if (ex) {
@@ -62,6 +62,19 @@ module.exports = {
62
62
  handle: async (req, res, url, ctx) => {
63
63
  if (url.pathname === '/api/board-metrics-premium') return metrics(req, res, url, ctx);
64
64
  if (url.pathname === '/api/board-pack') return require('./board-pack-route.js').handle(req, res, url, ctx); // the data pack of a published board (board-publish), made from this route's own answer
65
+ /* GET /api/board-premium/stale?ws=<id>[,<id>] → { ok, stale } whether the rows of those workspaces (every one when none is named) are
66
+ * still derived again. Work asks this while its answer says `stale`, and reads the whole board again only when it says false: the board
67
+ * read takes a second or more, the check a few milliseconds (page-open-200ms). It starts a derivation when the rows are old and none runs. */
68
+ if (url.pathname === '/api/board-premium/stale') {
69
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
70
+ const want = String(url.searchParams.get('ws') || '').split(',').filter(Boolean);
71
+ const one = (id) => { try { return ctx.getWs ? ctx.getWs(id) : null; } catch { return null; } };
72
+ const list = (want.length ? want.map(one) : ctx.workspaceList ? ctx.workspaceList() : []).filter((w) => w && w.root);
73
+ let stale = false;
74
+ for (const w of list) { try { const r = Rows.rowsFor(w.root); if (r && (r.pending || r.stale)) stale = true; } catch { /* unreadable rows are not a derivation */ } }
75
+ ctx.json(res, { ok: true, stale });
76
+ return true;
77
+ }
65
78
  if (url.pathname !== '/api/board-premium') return false;
66
79
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
67
80
  const fail = (error) => { ctx.json(res, { ok: false, state: 'error', error: String(error).slice(0, 240) }, 500); return true; };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.845.0",
3
+ "version": "0.847.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.845.0",
9
+ "version": "0.847.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.845.0",
3
+ "version": "0.847.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",
@@ -305,6 +305,8 @@ export function overviewOf(r, v, o = {}) {
305
305
  else lines.push({ id: 'done', k: 'Done when', text: '', edit: { to: 'artefact', artefact: 'done-test', field: 'check' }, ...offer('Done when', 'the done test (how we will know it worked, and when we check)', 'done-test', 'check') });
306
306
  // too little traffic to conclude by the check date (experiment-traffic-warning, A404): GET /api/artefacts carries it only when it is so
307
307
  if (ex.power && ex.power.text) lines.push({ id: 'power', k: 'Can it conclude?', text: String(ex.power.text), src: 'the record', path: ex.power.path || '', edit: null });
308
+ // risks, assumptions, issues and dependencies that stopped moving (raid-fold, A101): GET /api/artefacts carries it only when a row is stale
309
+ if (ex.raid && ex.raid.text) lines.push({ id: 'raid', k: 'RAID', text: String(ex.raid.text), src: 'pmos raid show', edit: null });
308
310
  const sm = summaryOf(r, v, o);
309
311
  const status = sm.status.replace(/^It is in /, 'In ');
310
312
  // status in one line (status-line, A505): the record's line of at most 12 words; the item header shows it before PMOS's own words
@@ -1562,9 +1562,21 @@ async function load() {
1562
1562
  RFA.refresh($('#cRoadFor'), { ws: M.board.ws || null, single: !ALL, say });
1563
1563
  CMAP.mount($('#cCode'), { ws: M.board.ws || null, single: !ALL });
1564
1564
  focusOnce(); taskOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
1565
- if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
1565
+ if (r.stale) settle(); // the rows are still derived again: the board is read again once they land
1566
1566
  else { loadTrail(); loadGrill(); }
1567
1567
  }
1568
+ /* While the answer says `stale`, ask only whether the rows landed (GET /api/board-premium/stale, a few ms) every 2 s, and read the whole
1569
+ * board (a second or more of the server's one thread) once, when they did. A derivation is given up on after 3 minutes, as the server does. */
1570
+ let settleTimer = null;
1571
+ function settle(t0 = Date.now()) {
1572
+ clearTimeout(settleTimer);
1573
+ const ws = (M && M.board && M.board.all ? (M.board.products || []).map((x) => x.ws) : [M && M.board && M.board.ws]).filter(Boolean);
1574
+ settleTimer = setTimeout(async () => {
1575
+ let r = null;
1576
+ try { r = await pmGet('/api/board-premium/stale' + (ws.length ? '?ws=' + encodeURIComponent(ws.join(',')) : '')); } catch { r = null; }
1577
+ if (r && r.ok && r.stale && Date.now() - t0 < 180000) settle(t0); else load();
1578
+ }, 2000);
1579
+ }
1568
1580
  /** What PMOS changed by itself in the last 24 h, per product on this Board (pm/changed-mark.js, bet A456): read after each read of the board,
1569
1581
  * at most once a minute per product; a press of a row's Undo reads the board again. */
1570
1582
  function readChanges() {
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "One RAID list per initiative (initiative raid-fold, done test R1-R3, S1, N1-N2): the pure fold and its stale rule, the Work popup's one line, pmos raid show|count on a scratch repository. No browser, model or network.",
3
+ "modules": [
4
+ "raid.test.js"
5
+ ],
6
+ "seconds": {
7
+ "raid.test.js": 3
8
+ }
9
+ }