create-pmos 0.679.0 → 0.680.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.679.0",
3
+ "version": "0.680.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,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.680.0",
38
+ "at": "2026-11-22T07:44:35.647Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1488,
43
+ "t": "Read a document as a CFO, an engineer and a sceptic (A110)",
44
+ "s": "Read a document as a CFO, an engineer and a sceptic (A110)",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.679.0",
38
51
  "at": "2026-11-22T06:54:44.843Z",
@@ -363,19 +376,6 @@
363
376
  "k": "new"
364
377
  }
365
378
  ]
366
- },
367
- {
368
- "v": "0.646.0",
369
- "at": "2026-11-20T03:32:31.987Z",
370
- "f": 4,
371
- "prs": [
372
- {
373
- "n": 1428,
374
- "t": "Today is built from the design system's blocks",
375
- "s": "Today is built from the design system's blocks",
376
- "k": "new"
377
- }
378
- ]
379
379
  }
380
380
  ]
381
381
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@29ab82b1
1
+ kernel-source: pmos@c2dc3982
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-22T06:54:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T07:44:31Z"}
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-22T06:54:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T07:44:31Z"}
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-22T06:54:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T07:44:31Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.680.0",
4
+ "at": "2026-11-22T07:44:35.647Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1488,
9
+ "t": "Read a document as a CFO, an engineer and a sceptic (A110)",
10
+ "s": "Read a document as a CFO, an engineer and a sceptic (A110)",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.679.0",
4
17
  "at": "2026-11-22T06:54:44.843Z",
@@ -237,7 +237,7 @@ What each part does:
237
237
  - **What the canvas can do.** The prototype runs in a sandboxed frame. It cannot reach PMOS. The canvas talks to it only to show a screen, point, pin, play and apply your edits.
238
238
  - **Your prototype rules.** After a version renders and before it opens, PMOS checks it against your prototype rules: no device or browser frame, no instructions on the screen, no sample copy, and each rule PMOS learns from your corrections. When a correction is true of every prototype (for example "no device frame"), the chat adds it as a rule (`pmos lab rule add`). PMOS keeps a rule only when it fails a bad example and passes a good one, so a button such as "See the week" is never read as an instruction. A change to one version ("make the alert orange") or a taste ("calmer") never becomes a rule. A version that breaks a rule gets one fix run, given only the lines that broke it. You see only the fixed version, with one quiet line: "PMOS fixed 3 things before showing you this." When the fix does not reach a rule, the version still opens and the line names the rule it breaks. When nothing was fixed, there is no line. Settings › Prototype rules lists the rules with Undo.
239
239
  - **The design critic.** After the prototype rules, a separate read-only session reads the version's desk and phone screenshots and its page against every standing design rule of your product. Each rule is a named check: each numbered principle in your design principles and each rule in your `design-rules.json`. A finding must name the rule it breaks, so the critic reports broken rules, not taste. Its findings go into the same one fix run. After the fix it reads only those rules again, so "PMOS fixed n things" is never claimed unchecked. A critic that cannot run never holds the version. `pmos lab critic` runs it on any screenshots, and `PMOS_CRITIC=off` turns it off.
240
- - **The sceptical reviewer.** Before you share a document, the chat's agent runs `pmos critic <file>`: a separate read-only session reads it as a sceptical reviewer and lists at most 3 hard questions. Each names its lens, quotes the document and gives the smallest fix; a question whose quote is not in the document is dropped. `pmos critic stats` shows how many you called real, and the gaps that repeat across documents.
240
+ - **The sceptical reviewer.** Before you share a document, the chat's agent runs `pmos critic <file>`: a separate read-only session reads it as a sceptical reviewer and lists at most 3 hard questions. Each names its lens, quotes the document and gives the smallest fix; a question whose quote is not in the document is dropped. For a report or an update that goes to leadership, it runs `pmos critic <file> --as all`: the same pass reads it as the CFO (cost, return, the cost of a slip), the engineering lead (can it be built as written, what it waits on, who builds it) and the sceptic, at most 2 questions each. `pmos critic stats` shows how many you called real, for each reader, and the gaps that repeat across documents.
241
241
  - **No time limit.** A version takes as long as the ask needs. While PMOS makes it, the Viewer shows what it is doing now (for example "Building screen 3 of 7"), the steps done, a progress bar and the time so far, with a Stop press. A run that writes nothing for 10 minutes is stuck: PMOS stops it. A version that does not render, that is stuck or that you stop is "not made" with the reason, and the chat says so. The Viewer still opens it: it says why and shows the version it was made from. While a version is being made, a new ask on the same initiative waits: PMOS says what is running.
242
242
  - **Lessons.** Each change sentence, ✓ and ✕ is a Lessons line of the experiment (`pmos artefacts show`). Each version that rendered is a Specimens line. The one you keep is the kept specimen.
243
243
  - **The grill runs after the session, not during it.** When you keep a version, the grill runs once on the kept specimen, as the Review step. Its findings wait under the ✦ (D60 as amended on 2026-11-17).
@@ -188,11 +188,12 @@ PMOS's grill run files with these commands, which refuse outside that run:
188
188
 
189
189
  Before you share a spec, a strategy, a roadmap or a report, PMOS reads it as a sceptical reviewer would and lists the hardest questions that reviewer would ask. Each question names its lens (evidence, outcome, trade-off, scope, risk, owner, contradiction or unverified claim), quotes the words of the document it rests on, and gives the smallest fix. A question whose quote is not in the document is dropped. The chat's agent runs it when you say you are about to share a document. Nothing is sent and the document is not changed.
190
190
 
191
- - `pmos critic <file> [--ws <id>]`: one pass on a markdown, text or HTML document. It prints at most 3 questions, the hardest first. The running PMOS server starts one read-only session.
191
+ - `pmos critic <file> [--as <readers>] [--ws <id>]`: one pass on a markdown, text or HTML document. It prints at most 3 questions, the hardest first. The running PMOS server starts one read-only session.
192
+ - `--as cfo,engineer,sceptic` (or `--as all`) reads the document as those readers in the same pass. Each reader asks at most 2 questions, and each question shows its reader, for example `[cfo · cost-of-delay]`. The CFO asks about cost, return and the cost of a slip. The engineering lead asks if it can be built as written, what it waits on, and who builds it. The sceptic asks the base questions. With no `--as`, the sceptic reads alone. Use `--as all` for a report or an update that goes to leadership.
192
193
  - `pmos critic show <file> [--ws <id>]`: the newest pass on that file, and whether the file changed since.
193
- - `pmos critic lenses [--root <dir>]`: the lenses. Add your product's own reviewer questions in `pmos/review-questions.json` (or `okf/products/<slug>/references/review-questions.json`): `{ "questions": [{ "id", "title", "rule" }] }`. An id that is a base lens replaces it. No server is needed.
194
+ - `pmos critic lenses [--as <readers>] [--root <dir>]`: the lenses. Add your product's own reviewer questions in `pmos/review-questions.json` (or `okf/products/<slug>/references/review-questions.json`): `{ "questions": [{ "id", "title", "rule", "reader" }] }`. `reader` is `cfo`, `engineer` or `sceptic` (none: the sceptic). An id that is a PMOS lens replaces it. `--as` lists those readers' lenses. No server is needed.
194
195
  - `pmos critic label <run> <n> real|noise`: your word on question `n` of a run.
195
- - `pmos critic stats`: the runs, the questions, how many you called real or noise, how many were dropped for a quote not in the document, and the gaps that repeat across documents. When the same gap is in several documents, fix the template or the generator that makes them.
196
+ - `pmos critic stats`: the runs, the questions, how many you called real or noise, how many were dropped for a quote not in the document, the same counts for each reader, and the gaps that repeat across documents. When the same gap is in several documents, fix the template or the generator that makes them.
196
197
 
197
198
  `PMOS_CRITIC=off` turns this critic and the design critic off.
198
199
 
@@ -2,10 +2,12 @@
2
2
  /* critic-cli.js — `pmos critic`: before you share a document, the hardest questions a sceptical reviewer would ask (initiative spec-critic;
3
3
  * lib/spec-critic.js, POST and GET /api/spec-critic in lib/routes-spec-critic.js).
4
4
  *
5
- * pmos critic <file> [--ws <id>] one pass through the running server: at most 3 questions, each with its lens, the quoted words and
6
- * the smallest fix. The chat's agent runs it when the PM says they are about to share a document.
5
+ * pmos critic <file> [--as <readers>] [--ws <id>] one pass through the running server: at most 3 questions, each with its lens, the
6
+ * quoted words and the smallest fix. The chat's agent runs it when the PM says they are about to share
7
+ * a document. --as cfo,engineer,sceptic (or all) reads it as those readers, at most 2 questions each
8
+ * (initiative review-lenses-cfo-engineer-sceptic, bet A110); none: the sceptic alone.
7
9
  * pmos critic show <file> [--ws <id>] the newest pass on that file, and whether the file changed since (through the server)
8
- * pmos critic lenses [--root <dir>] the lenses: the base set plus the product's review-questions.json (no server)
10
+ * pmos critic lenses [--as <readers>] [--root <dir>] the lenses: the readers' sets plus the product's review-questions.json (no server)
9
11
  * pmos critic label <run> <n> real|noise the PM's word on question n of a run (no server)
10
12
  * pmos critic stats runs, questions, real, noise, dropped for a missing quote, and the gaps that repeat across documents
11
13
  *
@@ -16,9 +18,10 @@ const SC = require('./spec-critic.js');
16
18
  const COMMANDS = { critic: ['show', 'lenses', 'label', 'stats'] };
17
19
  const USAGE = [
18
20
  'usage: pmos critic <file> [--ws <id>] — before you share a document, the hardest questions a sceptical reviewer would ask',
19
- ' pmos critic <file> [--ws <id>] a markdown, text or HTML document: at most 3 questions, each quoting the document, with the smallest fix',
21
+ ' pmos critic <file> [--as <readers>] [--ws <id>] a markdown, text or HTML document: at most 3 questions, each quoting the document, with the smallest fix',
22
+ ' --as cfo,engineer,sceptic (or all): read it as those readers, at most 2 questions each. None: the sceptic alone.',
20
23
  ' pmos critic show <file> [--ws <id>] the newest pass on that file, and whether the file changed since',
21
- ' pmos critic lenses [--root <dir>] the lenses the critic asks through: the base set plus the product\'s review-questions.json',
24
+ ' pmos critic lenses [--as <readers>] [--root <dir>] the lenses the critic asks through: each reader\'s set plus the product\'s review-questions.json',
22
25
  ' pmos critic label <run> <n> real|noise your word on question n of a run',
23
26
  ' pmos critic stats runs, questions, real, noise, and the gaps that repeat across documents',
24
27
  'A question whose quote is not in the document is dropped. Nothing is sent. PMOS_CRITIC=off turns the critic off.',
@@ -26,12 +29,18 @@ const USAGE = [
26
29
  const flag = (args, k) => { const i = args.indexOf('--' + k); return i >= 0 ? (args[i + 1] === undefined || args[i + 1].startsWith('--') ? true : args[i + 1]) : undefined; };
27
30
  const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
28
31
  const plural = (n, w) => `${n} ${w}${n === 1 ? '' : 's'}`;
29
- const fileArg = (args, from) => { for (let i = from; i < args.length; i++) { if (args[i] === '--ws' || args[i] === '--root') { i++; continue; } if (!args[i].startsWith('--')) return args[i]; } return ''; };
32
+ const fileArg = (args, from) => { for (let i = from; i < args.length; i++) { if (args[i] === '--ws' || args[i] === '--root' || args[i] === '--as') { i++; continue; } if (!args[i].startsWith('--')) return args[i]; } return ''; };
30
33
  const pathFor = (f) => (path.isAbsolute(f) ? f : path.resolve(f));
31
34
 
32
- function printQuestions(say, qs) {
35
+ const tag = (q, named) => (named && q.reader ? `${q.reader} · ${q.lens}` : q.lens);
36
+ /** Readers are named on each question when someone other than the sceptic alone read it. */
37
+ const named = (readers) => Array.isArray(readers) && !(readers.length === 1 && readers[0] === 'sceptic') && readers.length > 0;
38
+ const asOf = (args) => { const a = flag(args, 'as'); return a === true ? { ok: false, error: '--as needs readers: ' + SC.READER_IDS.join(', ') + ' (or all)' } : SC.readersOf(a); };
39
+
40
+ function printQuestions(say, qs, readers) {
41
+ const n = named(readers);
33
42
  qs.forEach((q, i) => {
34
- say(` ${i + 1}. [${q.lens}] ${q.question}`);
43
+ say(` ${i + 1}. [${tag(q, n)}] ${q.question}`);
35
44
  say(` quotes: "${one(q.quote, 200)}"`);
36
45
  if (q.why) say(` why it is hard: ${q.why}`);
37
46
  if (q.fix) say(` fix before sharing: ${q.fix}`);
@@ -44,16 +53,24 @@ async function run(argv, { say = (s) => console.log(s), call = null, env = proce
44
53
  if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 2; }
45
54
  const rt = () => require('./state-root.js').defaultRoot({ env });
46
55
 
56
+ const rd = asOf(args);
57
+ if (!rd.ok) { say('✗ ' + rd.error); return 2; }
47
58
  if (sub === 'lenses') {
48
59
  const root = typeof flag(args, 'root') === 'string' ? path.resolve(flag(args, 'root')) : process.cwd();
49
- const K = SC.lensesFor(root);
50
- say(K.added ? `${K.lenses.length} lenses: the base set and ${plural(K.added, 'question')} from ${K.from.join(' and ')}` : `${K.lenses.length} base lenses (add your own in pmos/review-questions.json):`);
51
- for (const l of K.lenses) say(` [${l.id}] ${l.title} ${one(l.rule, 160)}`);
60
+ const K = SC.lensesFor(root, { as: rd.readers });
61
+ const n = named(K.readers);
62
+ const whose = n ? ` for ${SC.readerList(K.readers)}` : '';
63
+ say(K.added ? `${K.lenses.length} lenses${whose}: ${n ? 'the PMOS set' : 'the base set'} and ${plural(K.added, 'question')} from ${K.from.join(' and ')}`
64
+ : n ? `${K.lenses.length} lenses${whose} (add your own in pmos/review-questions.json):` : `${K.lenses.length} base lenses (add your own in pmos/review-questions.json):`);
65
+ for (const l of K.lenses) say(` [${n ? l.reader + ' · ' : ''}${l.id}] ${l.title} ${one(l.rule, 160)}`);
52
66
  return 0;
53
67
  }
54
68
  if (sub === 'stats') {
55
69
  const st = SC.stats(rt());
56
70
  say(`${plural(st.runs, 'critic run')}${st.notRun ? ` (${st.notRun} did not run)` : ''} on ${plural(st.files, 'document')} · ${plural(st.questions, 'question')}: ${st.real} real, ${st.noise} noise, ${st.unlabelled} not labelled · ${st.dropped} dropped for a quote not in the document`);
71
+ if (Object.keys(st.byReader).some((r) => r !== 'sceptic')) {
72
+ for (const r of SC.READER_IDS) { const b = st.byReader[r]; if (b) say(` ${SC.READERS[r].name}: ${plural(b.questions, 'question')}, ${b.real} real, ${b.noise} noise, ${b.unlabelled} not labelled`); }
73
+ }
57
74
  for (const r of st.repeats) say(` the same gap in ${r.files.length} documents: [${r.lens}] ${r.files.map((f) => path.basename(f)).join(', ')}. Fix the template or the generator that makes them.`);
58
75
  return 0;
59
76
  }
@@ -79,19 +96,21 @@ async function run(argv, { say = (s) => console.log(s), call = null, env = proce
79
96
  const x = r.run;
80
97
  say(`${x.at.slice(0, 16).replace('T', ' ')} · run ${x.id}${r.changed ? ' · the document changed since: run it again before you share' : ''}`);
81
98
  if (!x.ok) { say('✗ it did not run: ' + (x.why || 'no answer')); return 0; }
82
- if (!x.questions.length) say('✓ no hard question'); else printQuestions(say, x.questions);
99
+ if (!x.questions.length) say('✓ no hard question'); else printQuestions(say, x.questions, x.readers);
83
100
  return 0;
84
101
  }
85
102
  const f = fileArg(args, 0);
86
103
  if (!f) { for (const l of USAGE) say(l); return 2; }
87
104
  if (typeof call !== 'function') { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
88
- let r = null; try { r = await call('POST', '/api/spec-critic', { path: pathFor(f), ...(wsq ? { ws: wsq } : {}) }); } catch { r = null; }
105
+ const asked = flag(args, 'as') !== undefined;
106
+ let r = null; try { r = await call('POST', '/api/spec-critic', { path: pathFor(f), ...(wsq ? { ws: wsq } : {}), ...(asked ? { as: rd.readers } : {}) }); } catch { r = null; }
89
107
  if (!r) { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
90
108
  if (!r.ok) { say('✗ ' + (r.error || 'the critic did not run')); return 1; }
109
+ const who = named(r.readers) ? SC.readerList(r.readers) : 'a sceptical reviewer';
91
110
  say(r.questions.length
92
- ? `${plural(r.questions.length, 'hard question')} a sceptical reviewer would ask of ${path.basename(r.file)} · run ${r.run}`
111
+ ? `${plural(r.questions.length, 'hard question')} ${who} would ask of ${path.basename(r.file)} · run ${r.run}`
93
112
  : `✓ no hard question on ${path.basename(r.file)} (${r.lenses} lenses) · run ${r.run}`);
94
- printQuestions(say, r.questions);
113
+ printQuestions(say, r.questions, r.readers);
95
114
  if (r.questions.length) say(`Label each: pmos critic label ${r.run} <n> real|noise`);
96
115
  return 0;
97
116
  }
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
  /* routes-spec-critic.js — the sceptical reviewer's routes (initiative spec-critic; lib/spec-critic.js).
3
3
  *
4
- * POST /api/spec-critic { path, ws? } → { ok, run, file, questions, dropped, lenses, added } | { ok: false, error }
4
+ * POST /api/spec-critic { path, ws?, as? } → { ok, run, file, readers, questions, dropped, lenses, added } | { ok: false, error }
5
+ * as: who reads it, 'cfo,engineer,sceptic' | 'all' | a list (none: the sceptic alone); an unknown reader is a 400.
5
6
  * one critic pass on a markdown, text or HTML document: a path relative to the workspace (it must stay inside it) or a full path.
6
7
  * `pmos critic <file>` reaches it with no Origin (D98, like `pmos lab critic`); from a page it needs a page press.
7
8
  * GET /api/spec-critic?path=&ws= → { ok, run: <the newest run on that file> | null, changed } a read; changed: the file differs from
@@ -40,16 +41,18 @@ async function run(ctx, res, b) {
40
41
  const w = wsOf(ctx, typeof b.ws === 'string' && b.ws ? b.ws : null);
41
42
  const d = docOf(w, b.path);
42
43
  if (!d.ok) return fail(ctx, res, d.status, d.error);
44
+ const rd = SC.readersOf(b.as);
45
+ if (!rd.ok) return fail(ctx, res, 400, rd.error);
43
46
  if (SC.off(process.env)) return fail(ctx, res, 409, 'the critic is off (PMOS_CRITIC=off)');
44
47
  let raw = ''; try { raw = fs.readFileSync(d.abs, 'utf8'); } catch { return fail(ctx, res, 400, 'the document could not be read'); }
45
- const K = SC.lensesFor(w ? w.root : '');
48
+ const K = SC.lensesFor(w ? w.root : '', { as: rd.readers });
46
49
  const text = SC.textOf(raw, d.abs);
47
50
  const ask = typeof ctx.specCritic === 'function' ? ctx.specCritic : SC.askVia(ctx.spawnSession);
48
51
  const r = await SC.critique(ask, { lenses: K.lenses, text: raw, file: d.abs });
49
52
  const id = ctx.runtimeDir ? SC.record(ctx.runtimeDir, { from: String(b.from || 'cli'), ws: w ? w.id : '', file: d.abs, sha: SC.sha(text), chars: text.length,
50
- lenses: r.lenses || [], ok: r.ok, why: r.why, questions: r.questions, dropped: r.dropped, ms: r.ms }) : null;
53
+ lenses: r.lenses || [], readers: K.readers, ok: r.ok, why: r.why, questions: r.questions, dropped: r.dropped, ms: r.ms }) : null;
51
54
  if (!r.ok) return fail(ctx, res, r.off ? 409 : 502, r.why);
52
- ctx.json(res, { ok: true, run: id, file: d.abs, questions: r.questions, dropped: r.dropped, lenses: r.lenses.length, added: K.added, from: K.from });
55
+ ctx.json(res, { ok: true, run: id, file: d.abs, readers: K.readers, questions: r.questions, dropped: r.dropped, lenses: r.lenses.length, added: K.added, from: K.from });
53
56
  return true;
54
57
  }
55
58
 
@@ -11,6 +11,12 @@
11
11
  * parse() keeps a question only when it names a known lens AND its quote is found in the document (case, whitespace, quote marks and
12
12
  * markdown emphasis ignored), so the PM never prepares for a question about words the document does not hold. At most 3 (MAX_QUESTIONS).
13
13
  *
14
+ * READERS (initiative review-lenses-cfo-engineer-sceptic, bet A110: a CFO, engineer and sceptic read of 5 real reports on 2 products left
15
+ * unanswered questions in all 15 reader reviews). The PM chooses who reads: `--as cfo,engineer,sceptic` or `--as all`. Each lens belongs
16
+ * to one reader: the CFO (cost, return, cost-of-delay), the engineering lead (feasibility, dependency, capacity), the sceptic (the base
17
+ * lenses). A product question joins a reader with "reader": "<id>" (none: the sceptic). With no reader given, the sceptic reads alone, as
18
+ * before. One run reads for every chosen reader; each reader keeps at most PER_READER (2) questions when several read, 3 when one reads.
19
+ *
14
20
  * THE RUN. One read-only session through the design critic's ask path (lib/design-critic.js askVia, origin `briefing-ask:spec-critic:<key>`,
15
21
  * kind `ask`). The document's text is in the prompt, so the run needs no file. A run that cannot start, times out or answers nonsense
16
22
  * files no questions, and the ledger says it did not run. PMOS_CRITIC=off runs none (the same switch as the design critic).
@@ -19,12 +25,13 @@
19
25
  * it when the PM says they are about to share a document. GET /api/spec-critic gives a page the latest run on a file.
20
26
  *
21
27
  * THE LEDGER. <runtime>/spec-critic.jsonl, append-only: { kind: 'run', id, at, from, ws?, file, sha, chars, lenses, ok, why?,
22
- * questions: [{ lens, title, question, quote, why, fix }], dropped, ms } and { kind: 'label', run, n, label: real | noise, by, at } (the PM's
23
- * word on question n, 1-based; the newest label wins). stats() counts them, and lists a lens flagged in 2 or more documents as a repeat:
28
+ * readers?, questions: [{ reader?, lens, title, question, quote, why, fix }], dropped, ms } and { kind: 'label', run, n, label: real | noise, by, at } (the PM's
29
+ * word on question n, 1-based; the newest label wins). stats() counts them (byReader: each reader's questions, real, noise), and lists a lens flagged in 2 or more documents as a repeat:
24
30
  * the same gap in several documents points at the template or generator that made them.
25
31
  *
26
32
  * BASE · ORIGIN · MAX_QUESTIONS · MAX_CHARS · DOC_RE · off(env)
27
- * questionsOf(json, rel) PURE → [lens] · lensesFor(root) → { lenses, from, added }
33
+ * READERS · readersOf(as) PURE → { ok, readers } | { ok: false, error } · readerList(ids) PURE → 'a CFO and a sceptic'
34
+ * questionsOf(json, rel) PURE → [lens] · lensesFor(root, { as? }) → { lenses, from, added, readers }
28
35
  * textOf(raw, file) PURE → the text the critic reads (HTML without its tags) · norm(s) PURE · sha(text) PURE
29
36
  * promptOf({ lenses, text, file, product? }) PURE → string
30
37
  * parse(answer, lenses, text) PURE → { questions, dropped } | null (null: the answer could not be read)
@@ -38,13 +45,44 @@ const DC = require('./design-critic.js');
38
45
 
39
46
  const FILE = 'spec-critic.jsonl';
40
47
  const ORIGIN = 'briefing-ask:spec-critic:';
41
- const MAX_QUESTIONS = 3, MAX_CHARS = 80000, MAX_RULE = 500, MIN_QUOTE = 6;
48
+ const MAX_QUESTIONS = 3, PER_READER = 2, MAX_ALL = 6, MAX_CHARS = 80000, MAX_RULE = 500, MIN_QUOTE = 6;
42
49
  const DOC_RE = /\.(md|markdown|txt|html?)$/i;
43
50
  const ID_RE = /^[a-z0-9][a-z0-9-]{0,59}$/;
44
51
  const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
45
52
  const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
46
53
  const off = (env) => DC.off(env);
47
54
 
55
+ /* ── the readers: who reads the document before it is shared ── */
56
+ const READERS = Object.freeze({
57
+ cfo: Object.freeze({ id: 'cfo', name: 'CFO', article: 'a', who: 'the CFO or finance partner who has to fund it and answer for what it costs' }),
58
+ engineer: Object.freeze({ id: 'engineer', name: 'engineering lead', article: 'an', who: 'the engineering lead who has to build it, run it and commit a team to it' }),
59
+ sceptic: Object.freeze({ id: 'sceptic', name: 'sceptic', article: 'a', who: 'the most sceptical senior reader in the room, who has to say yes' }),
60
+ });
61
+ const READER_IDS = Object.freeze(Object.keys(READERS));
62
+ const DEFAULT_READERS = Object.freeze(['sceptic']);
63
+ /** 'all' | 'cfo,engineer' | ['cfo'] | empty → { ok, readers (in reader order) } | { ok: false, error }. Empty: the sceptic alone. */
64
+ function readersOf(as) {
65
+ const given = (Array.isArray(as) ? as : String(as == null ? '' : as).split(',')).map((x) => String(x).trim().toLowerCase()).filter(Boolean);
66
+ if (!given.length) return { ok: true, readers: [...DEFAULT_READERS] };
67
+ if (given.includes('all')) return { ok: true, readers: [...READER_IDS] };
68
+ const unknown = given.filter((x) => !READERS[x]);
69
+ if (unknown.length) return { ok: false, error: `no reader ${unknown.map((x) => one(x, 30)).join(', ')}: the readers are ${READER_IDS.join(', ')} (or all)` };
70
+ return { ok: true, readers: READER_IDS.filter((r) => given.includes(r)) };
71
+ }
72
+ const readerList = (ids) => { const n = ids.map((r) => `${READERS[r].article} ${READERS[r].name}`); return n.length < 2 ? n.join('') : n.slice(0, -1).join(', ') + ' and ' + n[n.length - 1]; };
73
+
74
+ /* ── the CFO's and the engineering lead's lenses ── */
75
+ const CFO = [
76
+ { id: 'cost', title: 'What does it cost?', rule: 'No cost, budget, price, headcount or effort is stated, or a cost is left out on purpose, so the money asked for cannot be judged.' },
77
+ { id: 'return', title: 'What do we get back?', rule: 'No revenue, saving, retention or other value is tied to the cost, or the return has no number and no date.' },
78
+ { id: 'cost-of-delay', title: 'What does a slip cost?', rule: 'A date or a choice between dates is given with no cost of delay, no money at risk and no fallback if it slips.' },
79
+ ].map((c) => ({ ...c, reader: 'cfo', source: 'PMOS reader lenses' }));
80
+ const ENGINEER = [
81
+ { id: 'feasibility', title: 'Can it be built as written?', rule: 'A date, estimate or scope comes before the work it depends on (tests, sign-off, design), or no approach, stack or estimate is named.' },
82
+ { id: 'dependency', title: 'What does it wait on?', rule: 'A team, system, vendor, contract, data or decision the work needs is not named, not confirmed, or has no date.' },
83
+ { id: 'capacity', title: 'Who builds it, with what?', rule: 'No named team, people or effort for the build, or the work is called small or easy with nothing to show it.' },
84
+ ].map((c) => ({ ...c, reader: 'engineer', source: 'PMOS reader lenses' }));
85
+
48
86
  /* ── the base lenses: what a sceptical reviewer asks of any spec, strategy, roadmap or report ── */
49
87
  const BASE = Object.freeze([
50
88
  { id: 'evidence', title: 'What is the evidence?', rule: 'A claim, number, need or user problem stated with no source, data or example behind it.' },
@@ -55,7 +93,8 @@ const BASE = Object.freeze([
55
93
  { id: 'owner', title: 'Who decides, and by when?', rule: 'No owner, no date, or no clear decision or action asked of the reader.' },
56
94
  { id: 'contradiction', title: 'Which part is true?', rule: 'Two parts of the document disagree, or a summary says something its own detail contradicts.' },
57
95
  { id: 'unverified', title: 'Is it real yet?', rule: 'A status, delivery or result is claimed but marked unverified, assumed, or never checked.' },
58
- ].map((c) => Object.freeze({ ...c, source: 'PMOS base lenses' })));
96
+ ].map((c) => Object.freeze({ ...c, reader: 'sceptic', source: 'PMOS base lenses' })));
97
+ const ALL = Object.freeze([...CFO.map((c) => Object.freeze(c)), ...ENGINEER.map((c) => Object.freeze(c)), ...BASE]);
59
98
 
60
99
  /* ── the product's own reviewer questions ── */
61
100
  function questionsOf(json, rel = 'review-questions.json') {
@@ -65,16 +104,21 @@ function questionsOf(json, rel = 'review-questions.json') {
65
104
  const out = [], seen = new Set();
66
105
  for (const q of list) {
67
106
  if (!isObj(q) || !ID_RE.test(String(q.id || '')) || !one(q.title, 120) || !one(q.rule, MAX_RULE) || seen.has(q.id)) continue;
107
+ const reader = q.reader == null || q.reader === '' ? null : String(q.reader).trim().toLowerCase();
108
+ if (reader && !READERS[reader]) continue;
68
109
  seen.add(q.id);
69
- out.push({ id: q.id, title: one(q.title, 120), rule: one(q.rule, MAX_RULE), source: one([q.source, q.date].filter(Boolean).join(', ') || rel, 160) });
110
+ out.push({ id: q.id, title: one(q.title, 120), rule: one(q.rule, MAX_RULE), ...(reader ? { reader } : {}), source: one([q.source, q.date].filter(Boolean).join(', ') || rel, 160) });
70
111
  }
71
112
  return out;
72
113
  }
73
114
  const readOr = (abs) => { try { return fs.readFileSync(abs, 'utf8'); } catch { return null; } };
74
- /** The base lenses plus the product's own reviewer questions (an id that is a base lens replaces it). */
75
- function lensesFor(root) {
115
+ /** The chosen readers' lenses plus the product's own reviewer questions for them (an id that is a PMOS lens replaces it; a product
116
+ * question with no reader keeps the reader of the lens it replaces, else joins the sceptic). No reader given: the sceptic alone. */
117
+ function lensesFor(root, { as } = {}) {
76
118
  const R = String(root || '');
77
- let lenses = BASE.map((c) => ({ ...c }));
119
+ const rd = readersOf(as);
120
+ const readers = rd.ok ? rd.readers : [...DEFAULT_READERS];
121
+ let lenses = ALL.map((c) => ({ ...c }));
78
122
  const from = [];
79
123
  let added = 0;
80
124
  if (R) {
@@ -84,13 +128,21 @@ function lensesFor(root) {
84
128
  const t = readOr(path.join(R, rel)); if (t == null) continue;
85
129
  const qs = questionsOf(t, rel);
86
130
  if (!qs.length) continue;
87
- for (const q of qs) { const i = lenses.findIndex((l) => l.id === q.id); if (i >= 0) lenses[i] = q; else lenses.push(q); added++; }
131
+ for (const q of qs) {
132
+ const i = lenses.findIndex((l) => l.id === q.id);
133
+ const lens = { ...q, reader: q.reader || (i >= 0 ? lenses[i].reader : 'sceptic') };
134
+ if (i >= 0) lenses[i] = lens; else lenses.push(lens);
135
+ if (readers.includes(lens.reader)) added++;
136
+ }
88
137
  from.push(rel);
89
138
  break;
90
139
  }
91
140
  }
92
- return { lenses, from, added };
141
+ lenses = lenses.filter((l) => readers.includes(l.reader));
142
+ return { lenses, from: added ? from : [], added, readers };
93
143
  }
144
+ const readersIn = (lenses) => READER_IDS.filter((r) => lenses.some((l) => (l.reader || 'sceptic') === r));
145
+ const capOf = (readers) => (readers.length > 1 ? PER_READER : MAX_QUESTIONS);
94
146
 
95
147
  /* ── the text ── */
96
148
  /** What the critic reads: an HTML page without its scripts, styles and tags; any other document as it is. At most MAX_CHARS. */
@@ -112,10 +164,23 @@ const sha = (text) => crypto.createHash('sha1').update(String(text || '')).diges
112
164
 
113
165
  /* ── the run ── */
114
166
  function promptOf({ lenses, text, file = '', product = '' }) {
167
+ const readers = readersIn(lenses);
168
+ const about = `${product ? ' about ' + one(product, 80) : ''}${file ? ' (' + one(path.basename(file), 120) + ')' : ''}`;
169
+ const solo = readers.length < 2 ? (readers[0] || 'sceptic') : null;
170
+ const open = solo === 'sceptic'
171
+ ? `You are PMOS's sceptical reviewer. The user is about to share this document${about}. Read it as the most sceptical senior reader in the room would: an executive, an engineering lead, or a finance partner who has to say yes. List the hardest questions that reader would ask, so the user can answer them before sharing. Do not write or change anything.`
172
+ : solo
173
+ ? `You are PMOS's ${READERS[solo].name} reviewer. The user is about to share this document${about}. Read it as ${READERS[solo].who} would. List the hardest questions that reader would ask, so the user can answer them before sharing. Do not write or change anything.`
174
+ : `You are PMOS's review panel. The user is about to share this document${about}. Read it ${readers.length} times, once as each of these readers, and list the hardest questions each would ask, so the user can answer them before sharing. Do not write or change anything.\n` + readers.map((r) => `- ${READERS[r].name}: ${READERS[r].who}.`).join('\n');
175
+ const lensLine = (l) => `[${l.id}] ${l.title} ${l.rule}`;
176
+ const lensBlock = solo
177
+ ? 'The lenses. Each question must name exactly one of these ids:\n' + lenses.map(lensLine).join('\n')
178
+ : 'The lenses, by reader. Each question must name exactly one of these ids; the id says which reader asks it:\n' + readers.map((r) => `${READERS[r].name}:\n` + lenses.filter((l) => (l.reader || 'sceptic') === r).map(lensLine).join('\n')).join('\n');
179
+ const cap = solo ? `At most ${MAX_QUESTIONS} questions, the hardest first.` : `At most ${PER_READER} questions for each reader, the hardest first; a reader with nothing hard asks nothing.`;
115
180
  return [
116
- `You are PMOS's sceptical reviewer. The user is about to share this document${product ? ' about ' + one(product, 80) : ''}${file ? ' (' + one(path.basename(file), 120) + ')' : ''}. Read it as the most sceptical senior reader in the room would: an executive, an engineering lead, or a finance partner who has to say yes. List the hardest questions that reader would ask, so the user can answer them before sharing. Do not write or change anything.`,
117
- 'The lenses. Each question must name exactly one of these ids:\n' + lenses.map((l) => `[${l.id}] ${l.title} ${l.rule}`).join('\n'),
118
- `Rules. At most ${MAX_QUESTIONS} questions, the hardest first. Each question quotes the document's own words it rests on, copied exactly (a few words to one sentence). For something missing, quote the heading or sentence where it should be. A question whose quote is not in the document is thrown away. Give the smallest fix the user can make before sharing, in one line. No praise, no style or grammar notes, no question the document already answers. If a strong reader would ask nothing hard, answer an empty list.`,
181
+ open,
182
+ lensBlock,
183
+ `Rules. ${cap} Each question quotes the document's own words it rests on, copied exactly (a few words to one sentence). For something missing, quote the heading or sentence where it should be. A question whose quote is not in the document is thrown away. Give the smallest fix the user can make before sharing, in one line. No praise, no style or grammar notes, no question the document already answers. If a strong reader would ask nothing hard, answer an empty list.`,
119
184
  'The document:\n<<<DOCUMENT\n' + text + '\nDOCUMENT>>>',
120
185
  'Answer with JSON only: {"questions":[{"lens":"<id>","question":"<the question, as the reviewer would ask it>","quote":"<the exact words>","why":"<why it is hard, one line>","fix":"<the smallest fix>"}]}',
121
186
  ].join('\n\n');
@@ -132,6 +197,8 @@ function parse(answer, lenses, text) {
132
197
  }
133
198
  if (!isObj(o) || !Array.isArray(o.questions)) return null;
134
199
  const byId = new Map(lenses.map((l) => [l.id, l]));
200
+ const cap = capOf(readersIn(lenses));
201
+ const per = {};
135
202
  const doc = norm(text);
136
203
  const out = [], seen = new Set();
137
204
  let dropped = 0;
@@ -145,7 +212,8 @@ function parse(answer, lenses, text) {
145
212
  const k = l.id + '|' + nq;
146
213
  if (seen.has(k)) continue;
147
214
  seen.add(k);
148
- if (out.length < MAX_QUESTIONS) out.push({ lens: l.id, title: l.title, question, quote, why: one(q.why, 240), fix: one(q.fix, 240) });
215
+ const reader = l.reader || 'sceptic';
216
+ if ((per[reader] || 0) < cap) { per[reader] = (per[reader] || 0) + 1; out.push({ reader, lens: l.id, title: l.title, question, quote, why: one(q.why, 240), fix: one(q.fix, 240) }); }
149
217
  }
150
218
  return { questions: out, dropped };
151
219
  }
@@ -164,7 +232,7 @@ async function critique(ask, { root = '', lenses = null, text = '', file = '', p
164
232
  if (answer == null) return { ok: false, why: 'the critic session did not answer', ms };
165
233
  const p = parse(answer, L, T);
166
234
  if (!p) return { ok: false, why: 'the critic\'s answer could not be read', ms };
167
- return { ok: true, questions: p.questions, dropped: p.dropped, lenses: L.map((l) => l.id), ms };
235
+ return { ok: true, questions: p.questions, dropped: p.dropped, lenses: L.map((l) => l.id), readers: readersIn(L), ms };
168
236
  }
169
237
  /** The design critic's ask path with this critic's origin: a read-only `briefing-ask:` run (kind ask). */
170
238
  const askVia = (spawnSession, { timeoutMs } = {}) => DC.askVia(spawnSession, { name: 'spec critic', origin: ORIGIN, ...(timeoutMs ? { timeoutMs } : {}) });
@@ -180,8 +248,9 @@ function record(rt, run = {}) {
180
248
  const id = 'sc-' + Date.now().toString(36) + crypto.randomBytes(3).toString('hex');
181
249
  append(rt, { kind: 'run', id, at: new Date().toISOString(), from: one(run.from || 'cli', 40), ...(run.ws ? { ws: one(run.ws, 80) } : {}),
182
250
  file: one(run.file, 400), sha: one(run.sha, 16), chars: Number.isFinite(run.chars) ? run.chars : null, lenses: (run.lenses || []).slice(0, 40),
251
+ ...(Array.isArray(run.readers) && run.readers.length ? { readers: run.readers.filter((r) => READERS[r]) } : {}),
183
252
  ok: !!run.ok, ...(run.why ? { why: one(run.why, 200) } : {}),
184
- questions: (run.questions || []).slice(0, MAX_QUESTIONS).map((q) => ({ lens: q.lens, title: one(q.title, 120), question: one(q.question, 300), quote: one(q.quote, 400), why: one(q.why, 240), fix: one(q.fix, 240) })),
253
+ questions: (run.questions || []).slice(0, MAX_ALL).map((q) => ({ ...(READERS[q.reader] ? { reader: q.reader } : {}), lens: q.lens, title: one(q.title, 120), question: one(q.question, 300), quote: one(q.quote, 400), why: one(q.why, 240), fix: one(q.fix, 240) })),
185
254
  dropped: Number.isInteger(run.dropped) ? run.dropped : 0, ms: Number.isFinite(run.ms) ? run.ms : null });
186
255
  return id;
187
256
  }
@@ -218,7 +287,7 @@ function label(rt, run, n, lab, { by = 'pm:cli' } = {}) {
218
287
  /** The counts the Checker reads, and the lenses that repeat across documents (the newest run per file counts for repeats). */
219
288
  function stats(rt) {
220
289
  const R = read(rt);
221
- const s = { runs: R.length, notRun: 0, files: 0, questions: 0, real: 0, noise: 0, unlabelled: 0, dropped: 0, byLens: {}, repeats: [] };
290
+ const s = { runs: R.length, notRun: 0, files: 0, questions: 0, real: 0, noise: 0, unlabelled: 0, dropped: 0, byLens: {}, byReader: {}, repeats: [] };
222
291
  const newest = new Map();
223
292
  for (const r of R) {
224
293
  if (!r.ok) { s.notRun++; continue; }
@@ -227,8 +296,10 @@ function stats(rt) {
227
296
  r.questions.forEach((q, i) => {
228
297
  s.questions++;
229
298
  s.byLens[q.lens] = (s.byLens[q.lens] || 0) + 1;
299
+ const b = s.byReader[q.reader || 'sceptic'] = s.byReader[q.reader || 'sceptic'] || { questions: 0, real: 0, noise: 0, unlabelled: 0 };
300
+ b.questions++;
230
301
  const l = r.labels[i + 1];
231
- if (l === 'real') s.real++; else if (l === 'noise') s.noise++; else s.unlabelled++;
302
+ if (l === 'real') { s.real++; b.real++; } else if (l === 'noise') { s.noise++; b.noise++; } else { s.unlabelled++; b.unlabelled++; }
232
303
  });
233
304
  }
234
305
  s.files = newest.size;
@@ -238,4 +309,4 @@ function stats(rt) {
238
309
  return s;
239
310
  }
240
311
 
241
- module.exports = { FILE, BASE, ORIGIN, MAX_QUESTIONS, MAX_CHARS, DOC_RE, off, questionsOf, lensesFor, textOf, norm, sha, promptOf, parse, critique, askVia, file, record, read, latest, label, stats };
312
+ module.exports = { FILE, BASE, READERS, READER_IDS, ORIGIN, MAX_QUESTIONS, PER_READER, MAX_ALL, readersOf, readerList, MAX_CHARS, DOC_RE, off, questionsOf, lensesFor, textOf, norm, sha, promptOf, parse, critique, askVia, file, record, read, latest, label, stats };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.679.0",
3
+ "version": "0.680.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.679.0",
9
+ "version": "0.680.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.679.0",
3
+ "version": "0.680.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",
@@ -1,7 +1,11 @@
1
1
  {
2
- "_comment": "Sceptical spec critic (initiative spec-critic, bet A330 of the factory line): before a PM shares a document, at most 3 hard questions a sceptical reviewer would ask, each naming its lens and quoting the document (a question whose quote is not in the document is dropped); the product's own review-questions.json; ledger with the PM's real/noise labels and the gaps that repeat across documents (lib/spec-critic.js, lib/routes-spec-critic.js /api/spec-critic, lib/critic-cli.js `pmos critic`). Backend only.",
2
+ "_comment": "Sceptical spec critic (initiative spec-critic, bet A330 of the factory line): before a PM shares a document, at most 3 hard questions a sceptical reviewer would ask, each naming its lens and quoting the document (a question whose quote is not in the document is dropped); the product's own review-questions.json; ledger with the PM's real/noise labels and the gaps that repeat across documents (lib/spec-critic.js, lib/routes-spec-critic.js /api/spec-critic, lib/critic-cli.js `pmos critic`). Backend only. Reader roles (initiative review-lenses-cfo-engineer-sceptic, bet A110): --as cfo,engineer,sceptic, lenses per reader, per-reader caps and stats.",
3
3
  "modules": [
4
- "spec-critic.test.js"
4
+ "spec-critic.test.js",
5
+ "spec-critic-readers.test.js"
5
6
  ],
6
- "seconds": { "spec-critic.test.js": 1 }
7
+ "seconds": {
8
+ "spec-critic.test.js": 1,
9
+ "spec-critic-readers.test.js": 1
10
+ }
7
11
  }