create-pmos 0.565.0 → 0.567.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/package.json +33 -27
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/gate-initiative.sh +6 -3
  6. package/payload/scripts/workflow-state.js +18 -7
  7. package/payload/state/discoveries.md +1 -1
  8. package/workspace/changelog.json +32 -0
  9. package/workspace/fixtures/initiatives-api/list.json +2 -1
  10. package/workspace/guide/cli.md +5 -3
  11. package/workspace/guide/initiatives-and-next-steps.md +4 -4
  12. package/workspace/guide/jira.md +3 -1
  13. package/workspace/lib/agent-team.js +1 -1
  14. package/workspace/lib/autonomy.js +1 -0
  15. package/workspace/lib/board-premium.js +2 -0
  16. package/workspace/lib/description-props.js +53 -2
  17. package/workspace/lib/engine/workflow-state.js +18 -7
  18. package/workspace/lib/grill-cli.js +4 -4
  19. package/workspace/lib/impact-cli.js +3 -3
  20. package/workspace/lib/initiative-cli.js +7 -4
  21. package/workspace/lib/jira-cli.js +2 -0
  22. package/workspace/lib/jira-tickets.js +78 -5
  23. package/workspace/lib/lab-cli.js +1 -1
  24. package/workspace/lib/lead-cli.js +1 -1
  25. package/workspace/lib/measure-cli.js +13 -7
  26. package/workspace/lib/measurements.js +34 -11
  27. package/workspace/lib/metrics-cli.js +4 -4
  28. package/workspace/lib/outcome-props.js +58 -4
  29. package/workspace/lib/outcomes-cli.js +9 -3
  30. package/workspace/lib/outcomes.js +188 -11
  31. package/workspace/lib/program-cli.js +2 -2
  32. package/workspace/lib/proposals.js +12 -3
  33. package/workspace/lib/propose-cli.js +2 -2
  34. package/workspace/lib/report-draft.js +5 -5
  35. package/workspace/lib/report-engine.js +1 -1
  36. package/workspace/lib/routes-artefacts.js +3 -2
  37. package/workspace/lib/routes-board-premium.js +2 -0
  38. package/workspace/lib/routes-boards.js +12 -6
  39. package/workspace/lib/routes-initiatives.js +1 -1
  40. package/workspace/lib/routes-proposals.js +26 -0
  41. package/workspace/lib/routes-stage-tools.js +1 -1
  42. package/workspace/lib/status-signal.js +6 -2
  43. package/workspace/lib/team-cli.js +4 -1
  44. package/workspace/lib/today-cli.js +1 -1
  45. package/workspace/lib/vendor/scripts/workflow-state.js +18 -7
  46. package/workspace/lib/work-kind.js +16 -4
  47. package/workspace/lib/workflow-cli.js +23 -1
  48. package/workspace/package-lock.json +2 -2
  49. package/workspace/package.json +1 -1
  50. package/workspace/public/pm/bd-asks.js +1 -1
  51. package/workspace/public/pm/bd-ini-panel.js +1 -1
  52. package/workspace/public/pm/bd-next.js +17 -5
  53. package/workspace/public/pm/bd-views.js +1 -1
  54. package/workspace/public/pm/ini-agent.js +14 -7
  55. package/workspace/public/pm/premium-board.js +1 -1
  56. package/workspace/public/pm/work-kind.js +10 -6
  57. package/workspace/skills/measure.skill +6 -6
@@ -69,12 +69,15 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
69
69
 
70
70
  if (verb === 'roles') {
71
71
  const t = T.tableForPage();
72
- if (json) return ok({ roles: t });
72
+ // launch simulation W3: say whether the Builder can run here, from the files on disk (lib/work-kind.js factoryRuns)
73
+ const factory = require('./work-kind.js').factoryRuns(root);
74
+ if (json) return ok({ roles: t, factory });
73
75
  for (const r of t) {
74
76
  say(`${r.initial.padEnd(2)} ${r.name} · class ${r.cls}${r.runs ? ` · up to ${r.budget} runs a day` : ' · runs no model here'}`);
75
77
  say(` owns: ${r.what}`);
76
78
  if (r.owns.paths.length || r.owns.verbs.length) say(` writes only: ${[...r.owns.paths, ...r.owns.verbs].join(', ')}`);
77
79
  say(` wakes on: ${r.triggers.map((x) => (x.on === 'stage' ? `stage ${x.stage}${x.unless ? ' without ' + x.unless : ''}` : x.on === 'written' ? 'a write by another role' : 'a dispatch')).join(', ')}`);
80
+ if (r.key === 'build') say(` here: ${factory ? 'the factory runs in this repository. It opens pull requests and never merges them; you merge.' : 'no factory runs in this repository, so the Builder does not run. The team\'s agents build from the done test and the pull request plan PMOS writes.'}`);
78
81
  }
79
82
  return 0;
80
83
  }
@@ -21,7 +21,7 @@ const USAGE = [
21
21
  ' pmos today --root <dir> [--json] [--wait]',
22
22
  'With a workspace server running, prints Your move: the list Home shows, in the same order (public/pm/move-rank.js rankMove):',
23
23
  'an overdue outcome verdict, a grill finding on shipped work, a meeting change, a finding on work ahead, a key result with no',
24
- 'reading, then the rest Claude proposes, one row per initiative. Rows older than 14 days fold under "Older".',
24
+ 'reading, then the rest PMOS proposes, one row per initiative. Rows older than 14 days fold under "Older".',
25
25
  'Without a server it reads the repository and prints the Today cards, ranked by kind (1 a gate is owed, 2 a session is',
26
26
  'waiting, 3 a step was returned to you, 4 work to check, 5 a breakdown to keep, 6 a capture, 7 a cycle review, 8 needs',
27
27
  'repair). It does not read sessions then.',
@@ -860,7 +860,7 @@ function computeWorkflowDerived(id, opts) {
860
860
 
861
861
  // ── D68: the pm-artifacts ladder replaces everything after the anchor ─────────────────────────
862
862
  if (pmProfile) {
863
- return pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, recRel, range, inChange, lastActivity, opts });
863
+ return pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, recRel, range, inChange, lastActivity, opts, doneTest, killCond });
864
864
  }
865
865
 
866
866
  const prd = String(fm.prd_path || '').trim();
@@ -1536,7 +1536,8 @@ function jiraKeysOf(L, id, fm) {
1536
1536
  * every profile — D59/D67); route is re-stated here because its product-code form asks the
1537
1537
  * specimen/surface questions, which a PM document does not need. What follows is evidence-derived
1538
1538
  * like every other rung — nothing is declared done:
1539
- * brief — the brief file (`brief_path`, or `prd_path`) exists
1539
+ * brief — the brief file (`brief_path`, or `prd_path`) exists; or, for a D107 experiment, its done test
1540
+ * (`done_test_path`, present) and its kill condition (`kill:`), as the Viewer gate reads them (launch simulation W4)
1540
1541
  * draft — the deliverable (`doc_path`) exists, and — governed only — did not appear before the brief
1541
1542
  * review — an evals.jsonl verdict for this id, or a named `reviewed_by:` (a rubric, an agent, a human)
1542
1543
  * approved — the PM's acceptance in acceptances.jsonl (D12, never automatic)
@@ -1548,7 +1549,7 @@ function jiraKeysOf(L, id, fm) {
1548
1549
  * existence and their order fail CI for a non-legacy record). Review, approval and handoff are never
1549
1550
  * CI-blocking in either track: none can be true before the PR exists.
1550
1551
  */
1551
- function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, recRel, range, inChange, lastActivity, opts }) {
1552
+ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, recRel, range, inChange, lastActivity, opts, doneTest = '', killCond = '' }) {
1552
1553
  const declared = String(fm.track || '').trim().toLowerCase();
1553
1554
  const track = declared === 'light' || declared === 'governed' ? declared
1554
1555
  : (laneDefs.laneDef('pm-artifacts', effLane) || laneDefs.laneDef('pm-artifacts', 'prd')).track;
@@ -1560,7 +1561,9 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
1560
1561
  const skipped = (key, label) => step(key, label, 'na', `${effLane} lane — ${label} is not part of this flow`);
1561
1562
 
1562
1563
  // route — the lane is a pm-artifacts lane
1563
- steps[0] = knownLane
1564
+ steps[0] = doneTest
1565
+ ? step('route', 'route', 'done', 'experiment — its done test and specimens route it (D107)')
1566
+ : knownLane
1564
1567
  ? step('route', 'route', 'done', `${lane} lane · ${track} track (pm-artifacts profile, D68)`)
1565
1568
  : step('route', 'route', 'done', `unknown lane '${lane}' — treated as a governed prd, the profile's strictest (D68)`,
1566
1569
  `set lane: to one of ${laneNames('pm-artifacts').join(', ')}`);
@@ -1571,10 +1574,18 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
1571
1574
  const docPath = String(fm.doc_path || '').trim();
1572
1575
  const foundBrief = exists(briefPath) ? null : foundOf('brief');
1573
1576
  const foundDraft = exists(docPath) ? null : foundOf('draft');
1574
- const briefIdx = briefPath ? firstAppearance(root, range, briefPath) : null;
1577
+ // D107: a done test with its kill condition is the experiment's brief; the deliverable is ordered after it like any brief.
1578
+ const dtPresent = exists(doneTest);
1579
+ const briefIdx = dtPresent && killCond ? firstAppearance(root, range, doneTest)
1580
+ : briefPath ? firstAppearance(root, range, briefPath) : null;
1575
1581
  const docIdx = docPath ? firstAppearance(root, range, docPath) : null;
1576
1582
 
1577
- if (!flows('brief')) steps.push(skipped('brief', def.brief_label));
1583
+ if (doneTest && dtPresent && killCond) steps.push(step('brief', def.brief_label, 'done', `done test ${doneTest} + kill condition (D107)`));
1584
+ else if (doneTest && dtPresent) steps.push(step('brief', def.brief_label, 'blocked', 'no kill condition — an experiment states what would stop it (D107)',
1585
+ `write kill: "<the result that would make us stop>" in ${recRel}`, { blocking: !legacy, rule: 'R2' }));
1586
+ else if (doneTest) steps.push(step('brief', def.brief_label, 'blocked', `done_test_path '${doneTest}' does not exist in the repo`,
1587
+ 'create the done test the record points at, or correct done_test_path', { blocking: !legacy, rule: 'R2' }));
1588
+ else if (!flows('brief')) steps.push(skipped('brief', def.brief_label));
1578
1589
  else if (foundBrief) steps.push(step('brief', def.brief_label, 'done', `${foundBrief} — found by the repository scan`));
1579
1590
  else if (exists(briefPath)) steps.push(step('brief', def.brief_label, 'done', `${briefPath} present`));
1580
1591
  else steps.push(step('brief', def.brief_label, enforce ? 'blocked' : 'pending',
@@ -1587,7 +1598,7 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
1587
1598
  else if (exists(docPath)) {
1588
1599
  const inOrder = briefIdx == null || docIdx == null ? null : docIdx >= briefIdx;
1589
1600
  if (enforce && inOrder === false) {
1590
- steps.push(step('draft', def.draft_label, 'blocked', `${docPath} appeared before its brief ${briefPath}`,
1601
+ steps.push(step('draft', def.draft_label, 'blocked', `${docPath} appeared before its brief ${dtPresent && killCond ? doneTest : briefPath}`,
1591
1602
  'a governed document is briefed before it is drafted — the brief must land first', { blocking: true, rule: 'P2' }));
1592
1603
  } else steps.push(step('draft', def.draft_label, 'done', `${docPath} present`));
1593
1604
  } else steps.push(step('draft', def.draft_label, enforce && docPath ? 'blocked' : 'pending',
@@ -8,8 +8,11 @@
8
8
  * valid(value) → bool one of the three, exactly
9
9
  * fromName(name, lane) → { kind, cue } the pre-pick from the name and the intake draft's lane; cue is the word that decided it,
10
10
  * or '' when nothing did (then the kind is 'product' and the page shows no ✦ line)
11
- * executorOf(kind) → 'factory' | 'team' who builds by default (lib/artefacts.js EXECUTORS): Full SDLC → PMOS (the factory, D65:
12
- * propose-only, the PM merges); Product and Project → the team
11
+ * factoryRuns(root) → bool a D65 factory runs in this repository: planning/work-items.jsonl and scripts/verify-work.js are both there.
12
+ * Only then may a page say "PMOS builds it". A product repository made by create-pmos has neither today.
13
+ * executorOf(kind, factory) → 'factory' | 'team-agents' | 'team' who builds by default (lib/artefacts.js EXECUTORS): Full SDLC → PMOS
14
+ * (the factory, D65: propose-only, the PM merges) where a factory runs, else the team's agents (PMOS writes
15
+ * the done test and the pull request plan); Product and Project → the team
13
16
  *
14
17
  * A HINT, NOT A LANE (D107). The kind sits on the record beside the lane; it does not replace the lane. The Initiative Gate, the stages
15
18
  * and the default workflow do not read it. No model call: the pre-pick is the small word table below, and when it cannot tell it says so
@@ -43,6 +46,15 @@ function fromName(name, lane) {
43
46
  return { kind: DEFAULT, cue: '' };
44
47
  }
45
48
 
46
- const executorOf = (kind) => (kindOf(kind) === 'sdlc' ? 'factory' : 'team');
49
+ /* HONEST ABOUT WHO BUILDS (launch simulation W3, 2026-11-12). Full SDLC used to promise "PMOS builds the first pull request" in every
50
+ * workspace. The factory is the D65 work-item engine (scripts/work-item.js, scripts/verify-work.js, planning/work-items.jsonl), which only
51
+ * the PMOS repository carries; the kit does not vendor it. So the promise is made only where both files are on disk. */
52
+ const fs = require('fs');
53
+ const path = require('path');
54
+ const factoryRuns = (root) => {
55
+ if (!root || typeof root !== 'string') return false;
56
+ try { return fs.statSync(path.join(root, 'planning', 'work-items.jsonl')).isFile() && fs.statSync(path.join(root, 'scripts', 'verify-work.js')).isFile(); } catch { return false; }
57
+ };
58
+ const executorOf = (kind, factory) => (kindOf(kind) !== 'sdlc' ? 'team' : factory ? 'factory' : 'team-agents');
47
59
 
48
- module.exports = { KINDS, LABEL, SHORT, DEFAULT, valid, kindOf, fromName, executorOf };
60
+ module.exports = { KINDS, LABEL, SHORT, DEFAULT, valid, kindOf, fromName, executorOf, factoryRuns };
@@ -257,6 +257,27 @@ function ofLines(r) {
257
257
  }
258
258
  const ofJson = (r) => ({ initiative: { id: r.row.id, title: r.row.title }, board: { id: r.board.id, name: r.board.name }, wf: r.row.wf, stage: r.row.wfStage, stages: r.row.wfStages, ended: r.row.ended, oneStage: r.row.oneStage || null });
259
259
 
260
+ /** A move past stages that still hold open tasks (launch simulation W2): the tasks stay open and the move goes ahead (no block), but the
261
+ * PM hears which ones, by stage. Only a forward move on the same workflow passes stages. → [{ id, title, state, stage, stageName }] */
262
+ function openPassed(verb, before, after, ctx, w, root, id) {
263
+ if (verb !== 'move' || !after || !after.ok) return [];
264
+ const list = before.row.wfStages || [], from = list.findIndex((s) => s.key === (before.row.wfStage || {}).key);
265
+ const to = list.findIndex((s) => s.key === (after.row.wfStage || {}).key);
266
+ if (from < 0 || to <= from) return [];
267
+ const passed = new Map(list.slice(from, to).map((s) => [s.key, s.name]));
268
+ let tasks = [];
269
+ // lib/stage-read.js is the one reader of an initiative's tasks outside HTTP (W1); open is To do or In progress, as pmos task list says
270
+ try { tasks = require('./stage-read.js').tasksOf(ctx, w, id).filter((t) => t.state === 'To do' || t.state === 'In progress'); } catch { return []; }
271
+ return tasks.filter((t) => passed.has(t.stage)).map((t) => ({ id: t.id, title: t.title, state: t.state, stage: t.stage, stageName: passed.get(t.stage) }));
272
+ }
273
+ function openBehind(verb, before, after, ctx, w, root, id) {
274
+ const open = openPassed(verb, before, after, ctx, w, root, id);
275
+ if (!open.length) return [];
276
+ const head = open.length === 1 ? '1 task stays open in a stage it passed:' : `${open.length} tasks stay open in the stages it passed:`;
277
+ return [head, ...open.slice(0, 12).map((t) => ` ${t.id} · ${t.state} · ${t.title} · under ${t.stageName}`), ...(open.length > 12 ? [` … and ${open.length - 12} more (pmos task list ${id})`] : []),
278
+ `Close them with pmos task state <task> --to Done (or "Won't do"), or leave them open on purpose.`];
279
+ }
280
+
260
281
  function onInitiative(verb, { pos, flags, json, say, fail, root, stateDir, actor, others }) {
261
282
  const id = pos[0];
262
283
  const usage = { of: 'pmos workflow of <initiative>', move: 'pmos workflow move <initiative> --stage <key|name|number> [--why <text>]', switch: 'pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]' }[verb];
@@ -293,11 +314,12 @@ function onInitiative(verb, { pos, flags, json, say, fail, root, stateDir, actor
293
314
  if (!r.body || r.body.ok !== true) return fail((r.body && r.body.error) || 'the write was refused');
294
315
  const after = rowOf(ctx, w, id);
295
316
  const warnings = r.body.warnings || [];
296
- if (json) { say(JSON.stringify({ ok: true, ...(after.ok ? ofJson(after) : {}), warnings })); return 0; }
317
+ if (json) { say(JSON.stringify({ ok: true, ...(after.ok ? ofJson(after) : {}), warnings, stillOpen: openPassed(verb, before, after, ctx, w, root, id) })); return 0; }
297
318
  const row = after.ok ? after.row : before.row;
298
319
  say(verb === 'move' ? `✓ moved ${row.title} to ${row.wfStage.name}, stage ${row.wfStage.n} of ${row.wfStage.of} of ${row.wf.name}.`
299
320
  : `✓ ${row.title} now runs ${row.wf.name}, in ${row.wfStage.name} (stage ${row.wfStage.n} of ${row.wfStage.of}).`);
300
321
  for (const x of warnings) say(' ' + x);
322
+ for (const l of openBehind(verb, before, after, ctx, w, root, id)) say(' ' + l);
301
323
  say(' The stage card and the Board show it. No task was moved. Nothing was sent.');
302
324
  return 0;
303
325
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.565.0",
3
+ "version": "0.567.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.565.0",
9
+ "version": "0.567.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.565.0",
3
+ "version": "0.567.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",
@@ -125,7 +125,7 @@ function materialChips() {
125
125
  + N.files.map((f, i) => `<span class="bd-chip sm">${SV(I.file)}${esc(f.name)}<button type="button" class="bd-x0" data-rmfile="${i}" aria-label="Remove ${esc(f.name)}">${SV(I.x)}</button></span>`).join('');
126
126
  }
127
127
  /** Kind of work (batch 29 item 11, KdA/KdAP): the pill switch with its caption, and the ✦ line while the pick is PMOS's from the name. */
128
- const kindBox = () => WK.segHtml(N.kind, N.kindBy === 'pmos');
128
+ const kindBox = () => WK.segHtml(N.kind, N.kindBy === 'pmos', !!M().board.factory);
129
129
  function hintsHtml() {
130
130
  const p = N.prior && N.prior[0] && !N.ack ? `<div class="bd-warn"><b>Close to something you declined</b><span>“${esc(N.prior[0].title)}” was set aside in ${esc(N.prior[0].file)}.</span><div class="bd-arow"><button type="button" class="bd-btn sm" data-newact="seewhy">See why</button><button type="button" class="bd-btn sm ghost" data-newact="ack">It is different</button></div></div>` : '';
131
131
  const c = N.close ? `<div class="bd-need">${SV(I.info)}<span>Also close to <button type="button" class="bd-dlink" data-newact="close">${esc(N.close.title)}</button> in ${esc(N.close.stage || 'its stage')}. Add to it instead?</span></div>` : '';
@@ -269,7 +269,7 @@ export function openIni(r, from, o = {}) {
269
269
  else if (a === 'kind' && x.id) WK.pick(b, x.kind, (to) => WK.change({ pmPost, ws: where(x).ws, id: x.id, from: x.kind, to, toast: (t, u) => O.toast(t, u),
270
270
  // the row shows the new kind at once (its icon, the Next words, the Experiment); the Board's read catches up in the background
271
271
  apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
272
- reload: async () => { if (O.reload) await O.reload(); } }));
272
+ reload: async () => { if (O.reload) await O.reload(); } }), !!((O.M() || {}).board || {}).factory);
273
273
  },
274
274
  render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
275
275
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
@@ -5,8 +5,10 @@
5
5
  * work?), a move the team reads (the next stage, the drafted tickets to Jira) and the sign-off. No PRD counters: a part count is the step's
6
6
  * machinery, not the PM's. Ticket and task counts stay: they are the team's work, read from Jira and the tasks.
7
7
  *
8
- * nextOf(r, ctx) → { who: claude | you | team, words, when, count, tone, title, act } | null PURE. ctx: { self (a PMOS-self board) }
9
- * r.kind (batch 29 item 11) words PMOS's own steps: Product as below, Project as dates and chasing, Full SDLC's Build as its pull request
8
+ * nextOf(r, ctx) → { who: claude | you | team, words, when, count, tone, title, act } | null PURE. ctx: { self (a PMOS-self board),
9
+ * factory (a D65 factory runs in this repository: the board model's board.factory, lib/work-kind.js factoryRuns) }
10
+ * r.kind (batch 29 item 11) words PMOS's own steps: Product as below, Project as dates and chasing, Full SDLC's Build as its
11
+ * pull request, said as PMOS's only where a factory runs (launch simulation W3); elsewhere the team's agents build it
10
12
  * nextHtml(r, o) → the cell's markup. o: { self, icon (false on the phone), due (false in the List: Finish says the date) }
11
13
  *
12
14
  * The icon action stays only where PMOS does the step from the page (move the stage, add a stage task, link the epic, read Jira): a button with
@@ -31,8 +33,12 @@ const KIND_WORDS = {
31
33
  project: { triage: 'PMOS writes the plan and its dates', discover: 'PMOS writes the plan and its dates', plan: 'PMOS sets the dates with the team', build: 'PMOS chases the team for the first update', monitor: 'PMOS writes the status line' },
32
34
  sdlc: { build: 'PMOS builds the first pull request' },
33
35
  };
34
- const kindWords = (r, key) => { const w = KIND_WORDS[r && r.kind]; return (w && w[key]) || null; };
36
+ // W3: no factory in this repository, so the team's agents build and PMOS hands them the plan
37
+ const SDLC_NO_FACTORY = { build: 'PMOS writes the pull request plan for the team’s agents' };
38
+ const kindWords = (r, key, ctx) => { const w = r && r.kind === 'sdlc' && !(ctx && ctx.factory) ? SDLC_NO_FACTORY : KIND_WORDS[r && r.kind]; return (w && w[key]) || null; };
35
39
  const ANCHOR = 'PMOS anchors it to a goal';
40
+ // a refuted outcome: the next step PMOS recommends under the ✦ (lib/outcomes.js refutedDrafts), as the PM's call
41
+ const NEXT_ASK = { kill: "it didn't work: stop it?", iterate: "it didn't work: one more round?", new: "it didn't work: a new experiment?" };
36
42
  const OPEN_TK = ['In review', 'In progress', 'To do'];
37
43
  const CLOSED = new Set(['Done', "Won't do", 'Archived']);
38
44
 
@@ -70,6 +76,12 @@ export function nextOf(r, ctx = {}) {
70
76
  }
71
77
  const key = t.key;
72
78
  if (!key) return null;
79
+ // the PM answered "did it work?" (launch simulation W2): a refuted outcome asks for the next step PMOS recommends under the ✦; a
80
+ // validated one leaves the lessons to PMOS; can't tell yet asks nothing new
81
+ const oc = r.outcome;
82
+ if (oc && oc.verdict === 'refuted' && oc.current) return yours(NEXT_ASK[oc.next] || NEXT_ASK.iterate);
83
+ if (oc && oc.verdict === 'validated' && (key === 'monitor' || key === 'evaluate')) return claude('PMOS writes the lessons');
84
+ if (oc && oc.verdict === 'inconclusive' && (key === 'monitor' || key === 'evaluate')) return claude('PMOS reads the outcome again');
73
85
  if (key === 'build' || key === 'deliver') {
74
86
  const tk = t.tickets || [];
75
87
  if (tk.length) {
@@ -82,8 +94,8 @@ export function nextOf(r, ctx = {}) {
82
94
  return moveLine(r, ctx, count);
83
95
  }
84
96
  const epic = (it.links && it.links.epic) || (r.epics || [])[0] || null;
85
- // Full SDLC builds with PMOS's own pull requests (no Jira epic needed); Project chases the team until there are tickets
86
- if (key === 'build' && !epic && kindWords(r, 'build')) return claude(kindWords(r, 'build'));
97
+ // Full SDLC builds with pull requests (PMOS's where a factory runs, else the team's agents'; no Jira epic needed); Project chases the team
98
+ if (key === 'build' && !epic && kindWords(r, 'build', ctx)) return claude(kindWords(r, 'build', ctx));
87
99
  return epic ? claude('PMOS reads Jira', { act: { kind: 'jira', label: 'Read Jira again for ' + epic } }) : claude('PMOS finds the Jira epic', { act: { kind: 'epic', label: 'Link the Jira epic' } });
88
100
  }
89
101
  const past = r.end && /^\d{4}-\d{2}-\d{2}/.test(r.end) && String(r.end).slice(0, 10) < new Date().toISOString().slice(0, 10);
@@ -86,7 +86,7 @@ function listRow(r, pg) {
86
86
  + `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${WK.iconHtml(r.kind)}${nameHtml(r)}</b></button>${pcells}`
87
87
  + `<span role="cell" class="bd-wfn">${WF.wfIcon(WF.wfOf(r), 18)}<span class="bd-ell">${esc(WF.wfOf(r).name)}</span></span><span role="cell">${stageChip(r, { ms: (r.track || {}).ms })}${(r.track || {}).days ? ' <span class="bd-ell">' + (r.track || {}).days + 'd</span>' : ''}</span><span role="cell">${catPill(r)}</span>`
88
88
  + `<span role="cell" class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i>${esc(s.text)}</span>`
89
- + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, due: false })}</span>`
89
+ + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, factory: M().board.factory, due: false })}</span>`
90
90
  + `<span role="cell"${r.over ? ' class="bd-late"' : ''}>${esc(finish)}</span>`
91
91
  + `<button type="button" class="bd-ib sm" data-rowmenu="${esc(r.key)}" aria-haspopup="menu" aria-expanded="false" aria-label="More for ${esc(r.title)}" title="Actions">${SV(MORE)}</button></div>`;
92
92
  }
@@ -34,13 +34,20 @@ const P = { undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', check: 'M5 12l5 5 9-
34
34
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
35
35
  const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
36
36
  const DAY = 864e5, SHOW = 3;
37
- export const WHO = { factory: 'PMOS builds it and opens pull requests. You merge.', team: 'The team builds it. PMOS writes the done test.', 'team-agents': 'The team’s agents build it. PMOS writes the done test.' };
37
+ export const WHO = { factory: 'PMOS builds it and opens pull requests. You merge.', team: 'The team builds it. PMOS writes the done test.', 'team-agents': 'The team’s agents build it. PMOS writes the done test and the pull request plan.' };
38
+ /* HONEST ABOUT WHO BUILDS (launch simulation W3, 2026-11-12): "PMOS builds it" is said only where a D65 factory runs in the repository (the
39
+ * artefacts answer's `factory`, lib/work-kind.js factoryRuns). Elsewhere Full SDLC defaults to the team's agents, the factory is not offered
40
+ * in the picker, and a line someone set to the factory says plainly that nothing here builds it. */
41
+ export const NO_FACTORY = 'No factory runs in this repository, so PMOS does not build it. The team’s agents build it; PMOS writes the done test and the pull request plan.';
42
+ const whoText = (ex, factory) => (ex === 'factory' && !factory ? NO_FACTORY : WHO[ex] || ex);
43
+ const picks = (factory, now) => Object.keys(WHO).filter((p) => p !== 'factory' || factory || now === 'factory');
38
44
  /* THE KIND OF WORK (batch 29 item 11, boards KdV1-3): the kind is named once, in the Experiment's header, and the rows follow it. Who builds
39
45
  * defaults from the kind until someone writes it (Full SDLC: PMOS, the factory; Product and Project: the team); Project reads "Who does it"
40
46
  * and needs no specimens. A kind never changes a line someone wrote. */
41
47
  export const KIND = { product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' };
42
48
  const kindOf = (k) => (KIND[k] ? k : 'product');
43
49
  const DEF_EX = { product: 'team', sdlc: 'factory', project: 'team' };
50
+ const defEx = (k, factory) => (k === 'sdlc' && !factory ? 'team-agents' : DEF_EX[k]);
44
51
  const PROJECT_WHO = 'The team does it. PMOS chases, syncs the dates and writes the status line.';
45
52
  /** The Experiment's rows for one kind: the model's rows, with Who builds from the kind when nobody wrote it, and Project's wording. */
46
53
  export function kindRows(M, kind) {
@@ -49,8 +56,8 @@ export function kindRows(M, kind) {
49
56
  let i = rows.findIndex((r) => r.key === 'executor');
50
57
  if (i < 0) {
51
58
  const at = rows.findIndex((r) => r.key === 'specimens' || r.key === 'done');
52
- const ex = DEF_EX[k];
53
- const r = { key: 'executor', label: 'Who builds', text: WHO[ex], value: ex, by: '', at: '', sub: k === 'sdlc' ? 'Set one experiment to the team in Jira any time.' : '', def: true, edit: { artefact: 'experiment', field: 'executor', pick: Object.keys(WHO) } };
59
+ const ex = defEx(k, M.factory);
60
+ const r = { key: 'executor', label: 'Who builds', text: WHO[ex], value: ex, by: '', at: '', sub: ex === 'factory' ? 'Set one experiment to the team in Jira any time.' : '', def: true, edit: { artefact: 'experiment', field: 'executor', pick: picks(M.factory, ex) } };
54
61
  if (at < 0) rows.push(r); else rows.splice(at, 0, r);
55
62
  i = rows.indexOf(r);
56
63
  }
@@ -77,13 +84,13 @@ export function agentModel(A, U, id, o = {}) {
77
84
  const X = art(A, 'experiment'), S = art(A, 'specimens'), T = art(A, 'done-test');
78
85
  const row = (key, label, v, edit) => (v ? { key, label, text: v.text, by: v.by || '', at: v.at || '', edit: edit || null } : null);
79
86
  const hyp = one(X, 'hypothesis') || (carried(X, 'hypothesis')[0] ? { text: carried(X, 'hypothesis')[0].text } : null);
80
- const kill = one(X, 'kill'), budget = one(X, 'budget'), ex = one(X, 'executor');
87
+ const kill = one(X, 'kill'), budget = one(X, 'budget'), ex = one(X, 'executor'), factory = !!(A && A.factory);
81
88
  const kept = one(S, 'kept'), tries = list(S, 'specimen'), checks = list(T, 'check'), result = one(T, 'result');
82
89
  const rows = [
83
90
  row('hypothesis', 'We bet', hyp, { artefact: 'experiment', field: 'hypothesis' }),
84
91
  row('kill', 'Stop if', kill, { artefact: 'experiment', field: 'kill' }),
85
92
  row('budget', 'Budget', budget, { artefact: 'experiment', field: 'budget' }),
86
- ex ? { key: 'executor', label: 'Who builds', text: WHO[ex.text] || ex.text, value: ex.text, by: ex.by || '', at: ex.at || '', edit: { artefact: 'experiment', field: 'executor', pick: Object.keys(WHO) } } : null,
93
+ ex ? { key: 'executor', label: 'Who builds', text: whoText(ex.text, factory), value: ex.text, by: ex.by || '', at: ex.at || '', edit: { artefact: 'experiment', field: 'executor', pick: picks(factory, ex.text) } } : null,
87
94
  kept ? row('specimens', 'Specimens', { ...kept, text: 'Kept: ' + kept.text + (tries.length > 1 ? ' (of ' + tries.length + ' attempts)' : '') })
88
95
  : tries.length ? row('specimens', 'Specimens', { text: tries.length + (tries.length === 1 ? ' attempt' : ' attempts') + ', none kept yet: ' + tries[tries.length - 1].text, at: tries[tries.length - 1].at }) : null,
89
96
  checks.length ? { key: 'done', label: 'Done when', text: checks.map((c) => c.text).join(' · '), sub: result ? 'Result: ' + result.text : '', at: checks[checks.length - 1].at || '', edit: null } : null,
@@ -100,7 +107,7 @@ export function agentModel(A, U, id, o = {}) {
100
107
  const week = work.filter((w) => now - Date.parse(w.at) <= 7 * DAY).length;
101
108
  const AH = o.ahead && o.ahead.ok !== false ? o.ahead : null;
102
109
  const ahead = AH ? { outcome: AH.outcome || null, jobs: Array.isArray(AH.jobs) ? AH.jobs : [] } : null;
103
- return { id, ws: (U && U.ws) || (A && A.ws) || '', exp, gate, work, week, failed, ahead, kill: kill ? kill.text : '', budget: budget ? budget.text : '' };
110
+ return { id, ws: (U && U.ws) || (A && A.ws) || '', exp, gate, work, week, failed, ahead, kill: kill ? kill.text : '', budget: budget ? budget.text : '', factory };
104
111
  }
105
112
 
106
113
  /** D107: with an experiment on record, the gate to Build is its done test and its kill condition (not the PRD and the rubric). */
@@ -228,7 +235,7 @@ export function edit(btn) {
228
235
  const sec = btn.closest('[data-ia]'), id = sec && sec.dataset.ia, M = cached(id);
229
236
  const r = kindRows(M, sec && sec.dataset.iaKind).find((x) => x.key === btn.dataset.iaEdit);
230
237
  if (!r || !r.edit) return;
231
- const field = r.edit.pick ? `<select name="v" aria-label="${esc(r.label)}">${r.edit.pick.map((p) => `<option value="${esc(p)}"${p === r.value ? ' selected' : ''}>${esc(WHO[p])}</option>`).join('')}</select>`
238
+ const field = r.edit.pick ? `<select name="v" aria-label="${esc(r.label)}">${r.edit.pick.map((p) => `<option value="${esc(p)}"${p === r.value ? ' selected' : ''}>${esc(whoText(p, M && M.factory))}</option>`).join('')}</select>`
232
239
  : `<textarea name="v" rows="2" aria-label="${esc(r.label)}">${esc(r.text)}</textarea>`;
233
240
  const f = document.createElement('form');
234
241
  f.className = 'ia-xr ia-ed'; f.dataset.iaKey = r.key;
@@ -507,7 +507,7 @@ function trackRow(r, cls = '', po = false) {
507
507
  return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
508
508
  + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${WK.iconHtml(r.kind)}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
509
509
  + `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
510
- + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, icon: !small() })}</div></div>`; // the Next cell (XocA): what finishes the step next
510
+ + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, factory: M.board.factory, icon: !small() })}</div></div>`; // the Next cell (XocA): what finishes the step next
511
511
  }
512
512
  const cellsCls = () => 'bt-cells' + (TK.mode === 'cats' ? ' bands' : TK.mode === 'wf' ? ' wfn' : '');
513
513
  const cellsStyle = () => (TK.mode === 'wf' ? ` style="--n:${Math.max(1, TK.steps.length)}"` : '');
@@ -5,9 +5,10 @@
5
5
  * kindOf(v) → kind 'product' for anything that is not one of the three
6
6
  * glyph(kind, w) → <svg> the glyph, aria-hidden
7
7
  * iconHtml(kind) → the Board's icon before a title (role img, the full name in its label and tooltip)
8
- * segHtml(kind, lean) → New initiative's field: the pill switch (role radio), the caption, and the blue ✦ line when PMOS picked it (lean)
8
+ * captionOf(kind, factory) → the kind's caption. Full SDLC promises that PMOS builds only where a factory runs (launch simulation W3)
9
+ * segHtml(kind, lean, factory) → New initiative's field: the pill switch (role radio), the caption, and the blue ✦ line when PMOS picked it (lean)
9
10
  * pressOf(kind) → the Viewer header's press { act: 'kind', … } (cozy-viewer presses, lead: before Discuss)
10
- * pick(btn, kind, onPick) the small menu of the three kinds under the header's press; onPick(kind) runs on a new one
11
+ * pick(btn, kind, onPick, factory) the small menu of the three kinds under the header's press; onPick(kind) runs on a new one
11
12
  *
12
13
  * A hint, not a lane (D107): no gate and no stage reads it. Copy says PMOS. */
13
14
 
@@ -19,6 +20,9 @@ export const CAPTION = {
19
20
  sdlc: 'From idea to shipped. PMOS also builds it, as pull requests you merge.',
20
21
  project: 'Get a piece of work delivered on time. Others do the work; PMOS chases, syncs and reports.',
21
22
  };
23
+ // where no D65 factory runs (every product repository today), Full SDLC says what is true: the team's agents build
24
+ export const SDLC_NO_FACTORY = 'From idea to shipped. PMOS writes the done test and the pull request plan; the team’s agents build it.';
25
+ export const captionOf = (k, factory) => (kindOf(k) === 'sdlc' && !factory ? SDLC_NO_FACTORY : CAPTION[kindOf(k)]);
22
26
  // compass · code brackets · three offset bars (KdA's G map)
23
27
  export const GLYPH = {
24
28
  product: '<circle cx="12" cy="12" r="8"/><path d="M15.5 8.5l-2 5-5 2 2-5z"/>',
@@ -44,11 +48,11 @@ export function iconHtml(k) {
44
48
  return `<span class="kd-g" role="img" aria-label="${esc(n)}" title="${esc(n)}">${glyph(k)}</span>`;
45
49
  }
46
50
 
47
- export function segHtml(k0, lean) {
51
+ export function segHtml(k0, lean, factory) {
48
52
  const k = kindOf(k0);
49
53
  const btn = (x) => `<button type="button" role="radio" aria-checked="${x === k}" aria-pressed="${x === k}" data-kind="${x}">${glyph(x)}${esc(SHORT[x])}</button>`;
50
54
  return `<span class="bd-flbl" id="nwKindL">Kind of work</span><div class="bd-seg kd-seg" role="radiogroup" aria-labelledby="nwKindL">${KINDS.map(btn).join('')}</div>`
51
- + `<p class="kd-cap"><b>${esc(LABEL[k])}.</b> ${esc(CAPTION[k])}</p>`
55
+ + `<p class="kd-cap"><b>${esc(LABEL[k])}.</b> ${esc(captionOf(k, factory))}</p>`
52
56
  + (lean ? `<p class="kd-lean"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${SPARK}"/></svg><span>PMOS picked this from the name. Tap another kind to change it.</span></p>` : '');
53
57
  }
54
58
 
@@ -58,9 +62,9 @@ export function pressOf(k) {
58
62
  }
59
63
 
60
64
  /** The header's menu of the three kinds (the initiative's shared popover, pm/hi-pop.js; a sheet on a phone). onPick(kind) runs on a new one. */
61
- export function pick(btn, k0, onPick) {
65
+ export function pick(btn, k0, onPick, factory) {
62
66
  const k = kindOf(k0);
63
- const html = KINDS.map((x) => `<button type="button" class="hi-mi${x === k ? ' on' : ''}" role="menuitemradio" aria-checked="${x === k}" data-kind="${x}" title="${esc(CAPTION[x])}">${glyph(x)}<span>${esc(LABEL[x])}</span></button>`).join('');
67
+ const html = KINDS.map((x) => `<button type="button" class="hi-mi${x === k ? ' on' : ''}" role="menuitemradio" aria-checked="${x === k}" data-kind="${x}" title="${esc(captionOf(x, factory))}">${glyph(x)}<span>${esc(LABEL[x])}</span></button>`).join('');
64
68
  openPop(btn, 'kind', html, (b) => { const nk = b.dataset.kind; closePop(); if (nk && nk !== k && onPick) onPick(nk); }, { menu: true, label: 'Kind of work', focus: '.hi-mi.on' });
65
69
  }
66
70
 
@@ -17,8 +17,8 @@ output:
17
17
  /measure — record the current value of one or more anchors (a KR or a health budget) for THIS repository. A measurement is evidence. It is not a decision and it does not move an initiative.
18
18
 
19
19
  Rules that always hold:
20
- 1. ONLY FROM A COMMITTED FILE. Read the value from a file in this repository. Use the commit that holds the file now. If the value is not in a committed file, do not record it. Write it under "Not recorded" with the reason.
21
- 2. ALWAYS A SOURCE. Every measurement has a source in the form `<path>@<commit sha>`. The command refuses a measurement with no source.
20
+ 1. ONLY FROM A SOURCE YOU CAN NAME. Read the value from a file in this repository, from an analytics tool or tracker through a connector, or from a shared document. If you cannot read the value, do not record it. Write it under "Not recorded" with the reason.
21
+ 2. ALWAYS A SOURCE. Every measurement has a source: `<path>@<commit sha>` for a file in this repository, `connector:<name>` for a connector (for example `connector:amplitude`), or `document:<path or link>` for a shared document. A connector or document source also needs `--how`: the query, chart or cell, so a person can read the value again. The command refuses a measurement with no source, and a connector or document source with no `--how`.
22
22
  3. NOTHING INVENTED. Do not estimate, round up or carry a value forward. If two files disagree, record neither value. Write both under "Not recorded".
23
23
  4. ONE WRITER. Record a value only with `pmos measure add`. Do not edit `planning/runs/measurements.jsonl` or any ledger file.
24
24
  5. NO ATTRIBUTION FLAGS. Do not give `--by` or `--via`. The command sets who wrote the line from the session.
@@ -26,11 +26,11 @@ Rules that always hold:
26
26
  Procedure (each step ends with a check that shows it is done):
27
27
  1. Find the anchors. Read `planning/okrs/` for the KRs of the current period and `planning/okrs/health-budgets.md` for the health budgets. If the PM named anchors, use only those.
28
28
  Done when: you have a list of anchors, each as a KR (for example `KR 2.1`) or `health:<id>`.
29
- 2. For each anchor, find the file that states its current value and its target. Get the commit with `git log -1 --format=%h -- <path>`.
29
+ 2. For each anchor, find where its current value and its target are. For a file in this repository, get the commit with `git log -1 --format=%h -- <path>`. For a connector or a document, write down how you read it.
30
30
  Done when: each anchor has a value, a target or none, a date and a source, or a reason it has none.
31
31
  3. Record each value:
32
- `pmos measure add "<anchor>" <value> --source <path>@<sha> [--target <number>] [--unit <unit>] [--as-of YYYY-MM-DD]`
33
- Use the date the file gives for the value as `--as-of`. With no date in the file, give no `--as-of`; the command uses today.
32
+ `pmos measure add "<anchor>" <value> --source <source> [--how "<how you read it>"] [--target <number>] [--unit <unit>] [--as-of YYYY-MM-DD]`
33
+ Use the date the source gives for the value as `--as-of`. With no date in the source, give no `--as-of`; the command uses today.
34
34
  Done when: the command printed "recorded" for each value. If it refused a value, read its message, correct the call once, and otherwise write the value under "Not recorded".
35
35
  4. Check the result with `pmos measure list --json`.
36
36
  Done when: each value you recorded is in the list.
@@ -38,6 +38,6 @@ Procedure (each step ends with a check that shows it is done):
38
38
  Read before you judge: [anti-optimism](/okf/core/concepts/okr-anti-optimism.md), [output eval](/okf/core/concepts/output-eval.md).
39
39
 
40
40
  Output sections:
41
- - **Recorded** — one line per value: anchor, value, target, as_of, source.
41
+ - **Recorded** — one line per value: anchor, value, target, as_of, source, and how for a connector or document.
42
42
  - **Not recorded** — one line per anchor with no value, and why.
43
43
  - **Sources** — each file you read, with its commit.