create-pmos 0.777.0 → 0.778.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.777.0",
3
+ "version": "0.778.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,29 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.778.0",
38
+ "at": "2026-11-24T14:17:30.065Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1745,
43
+ "t": "Every live initiative gets an expected outcome and a check date",
44
+ "s": "Every live initiative gets an expected outcome and a check date",
45
+ "k": "new",
46
+ "h": "Every live initiative gets an expected outcome and a check date",
47
+ "try": {
48
+ "steps": [
49
+ "Open Work and open an initiative that had no expected outcome",
50
+ "Press its ✦ and find Expected outcome",
51
+ "Press Undo on it if it is wrong"
52
+ ],
53
+ "see": "The initiative shows an expected outcome and a check date that PMOS drafted, with the line it came from, and Undo takes it back",
54
+ "open": "/premium-board.html"
55
+ }
56
+ }
57
+ ]
58
+ },
36
59
  {
37
60
  "v": "0.777.0",
38
61
  "at": "2026-11-24T14:02:27.034Z",
@@ -417,19 +440,6 @@
417
440
  "k": "fix"
418
441
  }
419
442
  ]
420
- },
421
- {
422
- "v": "0.758.0",
423
- "at": "2026-11-24T02:19:59.803Z",
424
- "f": 4,
425
- "prs": [
426
- {
427
- "n": 1708,
428
- "t": "A resumed chat's answer comes back to the chat panel",
429
- "s": "A resumed chat's answer comes back to the chat panel",
430
- "k": "fix"
431
- }
432
- ]
433
443
  }
434
444
  ]
435
445
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@bafe92ee
1
+ kernel-source: pmos@980bac88
2
2
  assembled: 2026-11-24
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-24T14:02:23Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T14:17:26Z"}
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-24T14:02:23Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T14:17:26Z"}
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-24T14:02:23Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T14:17:26Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,27 @@
1
1
  [
2
+ {
3
+ "v": "0.778.0",
4
+ "at": "2026-11-24T14:17:30.065Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1745,
9
+ "t": "Every live initiative gets an expected outcome and a check date",
10
+ "s": "Every live initiative gets an expected outcome and a check date",
11
+ "k": "new",
12
+ "h": "Every live initiative gets an expected outcome and a check date",
13
+ "try": {
14
+ "steps": [
15
+ "Open Work and open an initiative that had no expected outcome",
16
+ "Press its ✦ and find Expected outcome",
17
+ "Press Undo on it if it is wrong"
18
+ ],
19
+ "see": "The initiative shows an expected outcome and a check date that PMOS drafted, with the line it came from, and Undo takes it back",
20
+ "open": "/premium-board.html"
21
+ }
22
+ }
23
+ ]
24
+ },
2
25
  {
3
26
  "v": "0.777.0",
4
27
  "at": "2026-11-24T14:02:27.034Z",
@@ -170,6 +170,7 @@ PMOS's background run files proposals with these commands. The server pins the i
170
170
  - `pmos propose done --json <file|->`: a task that looks done, with the evidence.
171
171
  - `pmos propose name --json <file|->`: tidy names.
172
172
  - `pmos propose verdict --json <file|->`: whether an initiative's expected outcome worked, once its check date has passed, with cited evidence. Only the outcome check run can file it. `cant-tell` files nothing, and the check stays with you.
173
+ - `pmos propose outcome --json <file|->`: an expected outcome for an initiative that has none, with cited claims and an optional check date. Only PMOS's outcome-draft run can file it, and only while the record has no outcome. PMOS applies it, and Undo takes it back.
173
174
  - `pmos propose status`: what is open, kept and dropped.
174
175
  - `pmos propose loose <link|merge|finish|start> --json <file|->`: the clean-up of the work that is not in an initiative. Only the clean-up run can file these, and that run files nothing else. `pmos propose loose status` shows what is open and kept.
175
176
 
@@ -369,6 +370,7 @@ Run them in the product's repository, or pass `--root <dir>`.
369
370
  - `pmos outcomes test <id> --test "<text>" [--method data-count|fake-door|concierge|other] [--result planned|holds|fails|unclear] [--evidence "<text>"]` records the smallest test that could kill a ranked bet before it is built, and what the test showed. A result other than `planned` needs evidence. When the bet already has a named test, `--test` can be left out.
370
371
  - `pmos outcomes tests [--count]` lists the ranked bets with no smallest test, the tests that wait for a result, and the results. `--count` prints the number of bets with a result in the last 14 days.
371
372
  - `pmos outcomes rate [--days <n>]` shows how many outcome checks came due in the last n days (30 by default) and at least 2 days ago, how many got a verdict within 2 days of their check date, and how many of those PMOS recorded by itself. The last line is that percent. It changes nothing.
373
+ - `pmos outcomes coverage` shows how many live initiatives (not cancelled, paused or on hold) name an expected outcome and how many also have a check date. The last line is the percent with both. It changes nothing.
372
374
  - `pmos outcomes live --where <place> --version <version>` records the version a place runs now, for example after a deploy. When a record says `shipped_in: "<version>"` and `measured_on: "<place>"`, and that place still runs an older version, its outcome check shows as blocked with the step to fix it. PMOS does not ask for a verdict until the place runs the change.
373
375
  - When you record `didnt-work`, the initiative shows **At risk** on every page, with the check as the reason. PMOS compares the evidence with the kill condition and files one next step under the initiative's ✦. If the evidence meets the kill condition, PMOS suggests that you stop the initiative. If this is the second check that did not work, it suggests a new experiment. Otherwise it suggests one more round with a new check date. Work's Next column asks you the same question. Nothing happens until you press ✓. Undo reverses the step.
374
376
  - `pmos outcomes propose` also reads the experiment's hypothesis. When the hypothesis names a different KR from the initiative's anchor, the draft tells you.
@@ -37,9 +37,17 @@
37
37
  * scan `blocked`) is not due: it is never judged and starts no run. The pass logs one `[outcome-blocked]` line when a check becomes blocked
38
38
  * (per check and version pair) and one when it clears, so the health number and its dates can be read from the server log.
39
39
  *
40
+ * KEPT BUT NEVER WRITTEN (outcome-drafts-land). A kept outcome or date ✦ whose keep wrote nothing, on a record that still lacks it
41
+ * (lostKeeps), is filed once more under its `again` id by the daily pass, so the auto-keep writes it now.
42
+ *
43
+ * NOTHING TO CITE (outcome-drafts-land). Every tick in the hours the PM allows, an initiative that has no PRD line, hypothesis, record line or
44
+ * KR line to draft from gets ONE propose run (deps.startDraft → lib/proposal-runs.js why `outcome-draft`, the run kind the outcome check
45
+ * uses), once per initiative ever, and only once that product's outcome drafts passed the guard's replay. The run files `pmos propose outcome` (lib/propose-cli.js): cited and quote-checked, class B with Undo.
46
+ *
40
47
  * deps: { workspaces() → [w], isLead(w), stateDirFor(w), boardOf(w, id) → board id | null, runtime() → the per-user state folder, open(now),
41
48
  * env, every (ms, its own timer), mayRun(), warn(what, err),
42
- * recordsDir(w)? → the goal records folder, startRun(w, { ini, board, it, why, now })? → { ok, run } | { ok: false, held?, error } }
49
+ * recordsDir(w)? → the goal records folder, startRun(w, { ini, board, it, why, now })? → { ok, run } | { ok: false, held?, error },
50
+ startDraft(w, { ini, board, it, now })? → { ok, run } | { ok: false, held?, error } }
43
51
  */
44
52
  const crypto = require('crypto');
45
53
  const fs = require('fs');
@@ -58,9 +66,11 @@ const typeOf = (d) => (d.data.kind === 'undated' ? 'date' : d.data.kind === 'ref
58
66
  const J = require('./outcome-judge.js');
59
67
  const RUNS = 'outcome-runs.jsonl'; // <state>/outcome-runs.jsonl: one line per outcome run started { ini, horizon, run, at }
60
68
  const RUNS_PER_PASS = 1; // a backlog of due checks starts one run per pass (the machine runs at most 2 at once)
69
+ const DRAFT = 'draft'; // the outcome-runs.jsonl horizon of a draft run (outcome-drafts-land): one per initiative, ever
70
+ const DRAFT_TAG = '[outcome-draft]';
61
71
 
62
72
  /** The proposals line a draft becomes. */
63
- function lineOf(d, board, run) {
73
+ function lineOf(d, board, run, { again = false } = {}) {
64
74
  const type = typeOf(d), ini = d.data.initiative;
65
75
  const sources = d.claims.flatMap((c) => c.sources).map((s) => ({ label: s.label, ref: s.ref }));
66
76
  if (type === 'verdict' || type === 'source') {
@@ -82,7 +92,27 @@ function lineOf(d, board, run) {
82
92
  const c = PR.clean('outcome', type, { title: type === 'date' ? 'A date to check the outcome' : 'What should change once it ships', why: d.say, sources,
83
93
  items: [{ id: 'outcome', title: d.data.metric, due: d.data.horizon }], data: { metric: d.data.metric, horizon: d.data.horizon } });
84
94
  if (c.error) return null;
85
- return { kind: 'propose', ini, board, run, id: PR.idOf(ini, 'outcome', type, ''), ...c.prop };
95
+ return { kind: 'propose', ini, board, run, id: PR.idOf(ini, 'outcome', type, again ? 'again' : ''), ...c.prop };
96
+ }
97
+
98
+ /** The outcome drafts that were kept but never written (outcome-drafts-land: on idpf, 10 auto-keeps of 8 and 22 Nov wrote nothing, the
99
+ * agent:auto actor bug fixed in #1715). A keep that is not undone, holds an outcome new/date ✦ and wrote no `outcome` line, on a record that
100
+ * still lacks what it proposed. Such a ✦ is filed once more under its `again` id, so the auto-keep writes it now. → Set of ✦ ids */
101
+ function lostKeeps(F, S) {
102
+ const has = new Map((S.subjects || []).map((it) => [it.id, it]));
103
+ const out = new Set();
104
+ for (const k of F.kept || []) {
105
+ if (F.undone.has(k.batch) || (k.wrote || []).some((w) => w && w.op === 'outcome')) continue;
106
+ for (const id of k.ids || []) {
107
+ const p = F.props.get(id);
108
+ if (!p || p.group !== 'outcome' || (p.type !== 'new' && p.type !== 'date')) continue;
109
+ const it = has.get(p.ini);
110
+ if (it && (p.type === 'new' ? !it.metric : !it.horizon)) out.add(id);
111
+ }
112
+ }
113
+ // a later keep of the same ✦ that did write takes it off
114
+ for (const k of F.kept || []) if (!F.undone.has(k.batch) && (k.wrote || []).some((w) => w && w.op === 'outcome')) for (const id of k.ids || []) out.delete(id);
115
+ return out;
86
116
  }
87
117
 
88
118
  /** One product's replay cases: its own drafts must all pass, and an initiative with nothing to cite gets no draft. */
@@ -103,7 +133,7 @@ function create(deps) {
103
133
  const dir = deps.stateDirFor(w); if (!dir) return { ws: w.id, filed: 0, why: 'no state folder' };
104
134
  const rt = deps.runtime && deps.runtime();
105
135
  const S = ST.testScan(w.root, { today: localDay(now) });
106
- const F = PR.read(dir), kept = PR.keptIds(F);
136
+ const F = PR.read(dir), kept = PR.keptIds(F), lost = lostKeeps(F, S);
107
137
  // a record that has its outcome now: its open draft goes (zero is silence)
108
138
  const has = new Map(S.subjects.map((it) => [it.id, it]));
109
139
  for (const p of F.props.values()) {
@@ -117,11 +147,13 @@ function create(deps) {
117
147
  const fresh = [];
118
148
  for (const d of D) {
119
149
  const board = deps.boardOf(w, d.data.initiative); if (!board) continue;
120
- const l = lineOf(d, board, ''); if (!l) continue;
150
+ let l = lineOf(d, board, ''); if (!l) continue;
151
+ const again = lost.has(l.id);
152
+ if (again) { l = lineOf(d, board, '', { again: true }); if (!l) continue; } // kept before but never written: once more (lostKeeps)
121
153
  const prev = F.props.get(l.id);
122
154
  if (kept.has(l.id)) continue;
123
155
  if (prev && (F.drops.has(PR.sigOf(prev)) || (prev.type === l.type && prev.data && prev.data.metric === l.data.metric && prev.data.test === l.data.test))) continue; // dropped for good, or filed already (a default date that moves a day is not news)
124
- fresh.push({ d, board });
156
+ fresh.push({ d, board, again });
125
157
  }
126
158
  if (!fresh.length) return { ws: w.id, filed: 0 };
127
159
  const AG = guardLib(); if (!AG) return { ws: w.id, filed: 0, why: 'the shared guard is not installed' };
@@ -132,10 +164,40 @@ function create(deps) {
132
164
  }
133
165
  const byId = new Map(fresh.map((x) => [x.d.id, x]));
134
166
  const r = await AG.file({ job: O.JOB, version, run, root: w.root, stateDir: rt, refDir: dir, settingsDir: rt, env: deps.env || process.env, max: PER_DAY }, fresh.map((x) => x.d),
135
- async (acc) => { for (const p of acc) { const x = byId.get(p.id); const l = x && lineOf(x.d, x.board, run); if (l) PR.append(dir, { by: 'agent:outcomes' }, l); } });
167
+ async (acc) => { for (const p of acc) { const x = byId.get(p.id); const l = x && lineOf(x.d, x.board, run, { again: x.again }); if (l) { PR.append(dir, { by: 'agent:outcomes' }, l); log(`${DRAFT_TAG} ${w.id} ${l.ini} filed ${l.type}${x.again ? ' again (kept before, never written)' : ''}`); } } });
136
168
  return { ws: w.id, filed: (r.filed || []).length, held: !!r.held, off: r.off || null };
137
169
  }
138
170
 
171
+ /** The initiatives with nothing to cite (lib/outcomes.js drafts `ask`, outcome-drafts-land): ONE propose run each (deps.startDraft →
172
+ * lib/proposal-runs.js why `outcome-draft`, the run kind the outcome check uses), which reads the record and its sources and files
173
+ * `pmos propose outcome`. Once per initiative, ever (<state>/outcome-runs.jsonl, horizon `draft`); at most RUNS_PER_PASS a pass; nothing
174
+ * while the outcomes switch is off. → { ws, runs } */
175
+ async function draftPass(w, { now = Date.now() } = {}) {
176
+ const dir = deps.stateDirFor(w); if (!dir || !deps.startDraft) return { ws: w.id, runs: 0 };
177
+ const S = O.scan(w.root, { today: localDay(now) });
178
+ const ask = O.drafts(S).ask;
179
+ if (!ask.length) return { ws: w.id, runs: 0 };
180
+ const AG = guardLib(), rt = deps.runtime && deps.runtime();
181
+ if (!AG || off(deps.env) || AG.off(O.JOB, { env: deps.env || process.env, settingsDir: rt })) return { ws: w.id, runs: 0, off: true };
182
+ // only a product whose outcome drafts already passed the guard's replay (runProduct): a new or scratch product starts no run first
183
+ if (!AG.ready(rt, O.JOB, versionOf(w))) return { ws: w.id, runs: 0, why: 'the outcome drafts have not passed the replay here yet' };
184
+ const started = runsOf(dir);
185
+ let runs = 0;
186
+ for (const a of ask) {
187
+ if (runs >= RUNS_PER_PASS) break;
188
+ if (started.has(a.id + '|' + DRAFT)) continue;
189
+ const board = deps.boardOf(w, a.id); if (!board) continue;
190
+ const it = S.subjects.find((x) => x.id === a.id) || a;
191
+ let r = null;
192
+ try { r = deps.startDraft(w, { ini: a.id, board, it, now }); } catch (e) { warn('outcome draft run ' + w.id, e); r = null; }
193
+ if (!r || !r.ok) { if (r && r.held) break; continue; }
194
+ try { fs.mkdirSync(dir, { recursive: true }); fs.appendFileSync(path.join(dir, RUNS), JSON.stringify({ ini: a.id, horizon: DRAFT, run: r.run || null, at: new Date(now).toISOString() }) + '\n'); } catch (e) { warn('outcome runs ledger', e); }
195
+ log(`${DRAFT_TAG} ${w.id} ${a.id} run ${r.run || ''} started: nothing to cite`);
196
+ runs++;
197
+ }
198
+ return { ws: w.id, runs };
199
+ }
200
+
139
201
  /** A refuted outcome's next step (launch simulation W2): filed at the tick after the PM's verdict, not once a day. Quiet hours do not
140
202
  * hold it back: the PM just recorded the verdict. One ✦ per check; a ✦ the PM kept or dropped is not filed again. */
141
203
  async function refutedPass(w, { now = Date.now() } = {}) {
@@ -278,6 +340,7 @@ function create(deps) {
278
340
  for (const w of deps.workspaces()) {
279
341
  try { if (deps.isLead && !deps.isLead(w)) continue; } catch { continue; }
280
342
  try { out.push(await duePass(w, { now })); } catch (e) { warn('outcomes due ' + w.id, e); }
343
+ try { out.push(await draftPass(w, { now })); } catch (e) { warn('outcomes draft ' + w.id, e); }
281
344
  }
282
345
  } finally { busy = false; }
283
346
  return out;
@@ -303,7 +366,7 @@ function create(deps) {
303
366
  const t = setInterval(() => { try { if (deps.mayRun && !deps.mayRun()) return; } catch { /* no lock: run */ } tick({}).catch((e) => warn('outcomes tick', e)); }, deps.every);
304
367
  if (t.unref) t.unref();
305
368
  }
306
- return { tick, runProduct, refutedPass, duePass };
369
+ return { tick, runProduct, refutedPass, duePass, draftPass };
307
370
  }
308
371
 
309
372
  /** The outcome runs started, as `ini|horizon` keys (<state>/outcome-runs.jsonl). */
@@ -370,4 +433,4 @@ function waiting(root, stateDir, { today } = {}) {
370
433
  return out;
371
434
  }
372
435
 
373
- module.exports = { create, cases, lineOf, off, waiting, runsOf, silentDraft, SILENT_AFTER, PER_DAY, RUNS };
436
+ module.exports = { create, cases, lineOf, lostKeeps, off, waiting, runsOf, silentDraft, SILENT_AFTER, PER_DAY, RUNS, DRAFT, DRAFT_TAG };
@@ -32,7 +32,7 @@ const { execFileSync } = require('child_process');
32
32
  const O = require('./outcomes.js');
33
33
  const ST = require('./smallest-test.js');
34
34
 
35
- const COMMANDS = { outcomes: ['list', 'propose', 'declare', 'record', 'live', 'test', 'tests', 'rate'] };
35
+ const COMMANDS = { outcomes: ['list', 'propose', 'declare', 'record', 'live', 'test', 'tests', 'rate', 'coverage'] };
36
36
  const USAGE = [
37
37
  'usage: pmos outcomes list|propose|declare|record|live|test|tests — every initiative has an expected outcome and a date to check it',
38
38
  ' pmos outcomes list [--json] checks due, outcomes with no date, initiatives with no outcome; reads only',
@@ -44,6 +44,7 @@ const USAGE = [
44
44
  ' the smallest test that could kill a ranked bet, and what it showed',
45
45
  ' pmos outcomes tests [--count] [--json] ranked bets with no test, tests waiting for a result, results; --count: results in 14 days',
46
46
  ' pmos outcomes rate [--days <n>] [--json] checks due in the last n days (30) that got a verdict within 2 days, and how many PMOS did',
47
+ ' pmos outcomes coverage [--json] live initiatives with an expected outcome and a check date; the percent is the last line',
47
48
  'Run it in the product\'s repository, or pass --root <dir>. Show each ✦ to the PM and write only after a yes.',
48
49
  ];
49
50
  /* `pmos outcomes rate` (initiative outcome-checks-finish): the bet's own number. A check counts when its date fell in the last `days` days
@@ -103,7 +104,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
103
104
  if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
104
105
  if (!COMMANDS.outcomes.includes(sub)) { say(`unknown outcomes command "${sub}". Use one of: ${COMMANDS.outcomes.join(', ')}`); return 2; }
105
106
  const { pos, flags } = parse(args.slice(1));
106
- const allowed = { list: ['json', 'root'], propose: ['json', 'root', 'max'], declare: ['json', 'root', 'metric', 'horizon'], record: ['json', 'root', 'evidence'], live: ['json', 'root', 'where', 'version'], test: ['json', 'root', 'test', 'method', 'result', 'evidence'], tests: ['json', 'root', 'count'], rate: ['json', 'root', 'days'] }[sub];
107
+ const allowed = { list: ['json', 'root'], propose: ['json', 'root', 'max'], declare: ['json', 'root', 'metric', 'horizon'], record: ['json', 'root', 'evidence'], live: ['json', 'root', 'where', 'version'], test: ['json', 'root', 'test', 'method', 'result', 'evidence'], tests: ['json', 'root', 'count'], rate: ['json', 'root', 'days'], coverage: ['json', 'root'] }[sub];
107
108
  for (const k of Object.keys(flags)) if (!allowed.includes(k)) { say(`✗ --${k} is not an option of pmos outcomes ${sub}`); return 2; }
108
109
  const root = path.resolve(flags.root || repoRoot(cwd));
109
110
  const today = O.todayOf(now);
@@ -127,6 +128,17 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
127
128
  return 0;
128
129
  }
129
130
 
131
+ if (sub === 'coverage') {
132
+ // outcome-drafts-land: the share of live initiatives with an outcome and a check date (its done-test number)
133
+ if (pos.length) return fail('pmos outcomes coverage takes no argument', 2);
134
+ const c = O.coverageOf(O.scan(root, { today }));
135
+ if (flags.json) { say(JSON.stringify({ ok: true, ...c })); return 0; }
136
+ say(`${c.live} live initiatives · ${c.withOutcome} name an expected outcome · ${c.withBoth} have both an outcome and a check date`);
137
+ if (c.without.length) say(' without: ' + c.without.slice(0, 20).join(', ') + (c.without.length > 20 ? ` … and ${c.without.length - 20} more` : ''));
138
+ say(c.pct == null ? 'none live' : c.pct + '%');
139
+ return 0;
140
+ }
141
+
130
142
  if (sub === 'rate') {
131
143
  if (pos.length) return fail('pmos outcomes rate takes no argument', 2);
132
144
  const days = flags.days === undefined ? RATE_DAYS : Number(flags.days);
@@ -95,6 +95,8 @@ function liveChecks(rows) {
95
95
  const reopened = (it, row) => !!(it.horizon && it.horizon > String(row.horizon || row.date || String(row.at || '').slice(0, 10)));
96
96
 
97
97
  const STOPPED = new Set(['paused', 'cancelled', 'canceled', 'stopped', 'dropped', 'archived', 'killed']);
98
+ // the record's own status line counts too (outcome-drafts-land: idpf asked 3 cancelled records for an outcome); on hold and deferred are paused
99
+ const STOPPED_STATUS = new Set([...STOPPED, 'on-hold', 'on hold', 'onhold', 'deferred']);
98
100
  function workGroup(root) { try { return require('./initiative-rows.js').workGroupOf(root) || {}; } catch { return {}; } }
99
101
 
100
102
  /** Every subject of the outcome rule in this repository, read from the records and ledgers (no derivation, no git). */
@@ -129,8 +131,8 @@ function scan(root, { today = todayOf() } = {}) {
129
131
  if (!ID_RE.test(id) || deleted.has(id)) continue;
130
132
  const lane = (fm.lane && fm.lane.value) || (fm.type && fm.type.value !== 'Initiative' ? fm.type.value : '') || 'feature';
131
133
  if (groups[lane] && groups[lane] !== 'work') continue; // a document lane is a file, not a bet (D86)
132
- const st = life.get(id) || (fm.status && fm.status.value ? '' : '');
133
- if (STOPPED.has(st)) continue;
134
+ const st = life.get(id) || '';
135
+ if (STOPPED.has(st) || (!st && fm.status && STOPPED_STATUS.has(String(fm.status.value).trim().toLowerCase()))) continue;
134
136
  const it = {
135
137
  id, lane, title: (fm.title && fm.title.value) || id, record: rel(root, file), fm, accepted: accepted.has(id),
136
138
  anchor: fm.parent_kr ? fm.parent_kr.value : '', metric: fm.outcome_metric ? fm.outcome_metric.value : '',
@@ -260,14 +262,23 @@ function anchorMetric(root, it) {
260
262
  const a = String(it.anchor || '').trim();
261
263
  // a KR names what should move; a health budget (D59) names only a cap and a review trigger, and a domain names a topic, so neither is cited
262
264
  if (!a || /^(domain|health):/.test(a)) return null;
263
- const token = a;
265
+ // the KR's own line wins over a row that only maps an initiative to it (outcome-drafts-land: idpf drafted "Moves O-C.KR-C4:
266
+ // iam-migration-6.0" from the anchoring table). The full anchor first, then its KR id alone (`KR-C4` in `O-C.KR-C4`).
267
+ const tail = (/(?:^|[.:])(KR-?[A-Za-z]?\d+(?:\.\d+)*)$/i.exec(a) || [])[1] || '';
268
+ const tokens = [a, ...(tail && tail !== a ? [tail] : [])];
269
+ const has = (l, t) => (t === a ? l.includes(t) : new RegExp('(^|[^A-Za-z0-9.-])' + t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?![A-Za-z0-9])').test(l));
270
+ const isRow = (l) => /^\s*\|/.test(l);
264
271
  const dirs = [path.join(root, 'planning', 'okrs'), path.join(root, 'pmos', 'planning', 'okrs')];
272
+ const hits = [];
265
273
  for (const d of dirs) {
266
274
  let fl = []; try { fl = fs.readdirSync(d).filter((x) => x.endsWith('.md')).sort(); } catch { continue; }
267
275
  for (const x of fl) {
268
276
  const f = path.join(d, x), Ls = linesOf(f) || [];
269
- const i = Ls.findIndex((l) => l.includes(token) && !/^\s*(type|title|timestamp):/.test(l));
270
- if (i < 0) continue;
277
+ tokens.forEach((token, ti) => Ls.forEach((l, i) => { if (has(l, token) && !/^\s*(type|title|timestamp):/.test(l)) hits.push({ f, Ls, i, token, rank: (isRow(l) ? 2 : 0) + ti }); }));
278
+ }
279
+ }
280
+ hits.sort((p, q) => p.rank - q.rank);
281
+ for (const { f, Ls, i, token } of hits) {
271
282
  const text = Ls[i];
272
283
  const cells = text.split('|').map((c) => c.trim()).filter(Boolean);
273
284
  // the KR's own words, without its list marker, its bold and its id: "- **KR1** — 2,000 …" and "- **KR1 —** 2,000 …" read "2,000 …"
@@ -277,8 +288,36 @@ function anchorMetric(root, it) {
277
288
  const m = metricText(String(words || '').replace(/^[:\s—–.-]+/, ''));
278
289
  if (m.replace(/[^A-Za-z0-9]/g, '').length < 12) continue;
279
290
  return { metric: 'Moves ' + a + ': ' + m, source: src(root, f, i + 1, text, 'Anchor ' + clip(a, 40)) };
291
+ }
292
+ return null;
293
+ }
294
+
295
+ /** The record's own words (outcome-drafts-land): the first item under an outcome, success, goal or signal heading in its body, else the
296
+ * "so that …" clause of its description or intent line. → { metric, source } | null */
297
+ const SO_THAT = /\bso that\s+(.{12,}?)(?:[.;]\s|[.;]?$)/i;
298
+ function recordMetric(root, it) {
299
+ if (!it || !it.record) return null;
300
+ const file = path.join(root, it.record), Ls = linesOf(file); if (!Ls) return null;
301
+ let i0 = 0;
302
+ if (/^---\s*$/.test(Ls[0] || '')) { i0 = Ls.findIndex((l, i) => i > 0 && /^---\s*$/.test(l)) + 1; if (i0 <= 0) i0 = Ls.length; }
303
+ for (let i = i0; i < Ls.length; i++) {
304
+ if (!HEADING.test(Ls[i])) continue;
305
+ for (let j = i + 1; j < Ls.length && j < i + 40; j++) {
306
+ const t = Ls[j];
307
+ if (/^#{1,3}\s/.test(t)) break;
308
+ if (!t.trim() || /^\s*(>|\||<!--|```)/.test(t) || /^\s*\*[^*].*\*\s*$/.test(t) || /^\s*(to be written|tbd|todo)\b/i.test(t)) continue;
309
+ const m = metricText(t);
310
+ if (m.replace(/[^A-Za-z0-9]/g, '').length < 12) continue;
311
+ return { metric: m, source: src(root, file, j + 1, t, 'Record: ' + clip(Ls[i].replace(/^#+\s*/, ''), 50)) };
280
312
  }
281
313
  }
314
+ for (const key of ['description', 'intent']) {
315
+ const e = it.fm && it.fm[key]; if (!e) continue;
316
+ const m = SO_THAT.exec(String(e.value || ''));
317
+ if (!m) continue;
318
+ const said = m[1].replace(/[.;\s]+$/, '');
319
+ return { metric: clip(said.charAt(0).toUpperCase() + said.slice(1), 220), source: src(root, file, e.n, e.text, 'Record: ' + key) };
320
+ }
282
321
  return null;
283
322
  }
284
323
 
@@ -302,7 +341,7 @@ function tasksOf(root) {
302
341
  }
303
342
 
304
343
  /** The check date to propose: DAYS_AFTER after the last task's due date, never sooner than a week from today. */
305
- function horizonFor(S, it, tasks) {
344
+ function horizonFor(S, it, tasks = tasksOf(S.root)) {
306
345
  const t = taskDue(S.root, it, tasks);
307
346
  const floor = addDays(S.today, 7);
308
347
  if (t) { const h = addDays(t.due, DAYS_AFTER); return { horizon: h < floor ? floor : h, lastDue: t.due, why: `${DAYS_AFTER} days after its last task is due`, source: t.source }; }
@@ -340,10 +379,10 @@ function missingDraft(S, it, tasks) {
340
379
  // the experiment's hypothesis is its predicted outcome (D107): read it beside the anchor, and say when the two name different KRs
341
380
  const hyp = experimentField(S.root, it, 'hypothesis');
342
381
  const other = hyp ? krMismatch(hyp.text, it.anchor) : null;
343
- const m = prdMetric(S.root, it) || (hyp && !other ? { metric: metricText(hyp.text), source: hyp.source, hyp: true } : null) || anchorMetric(S.root, it);
382
+ const m = prdMetric(S.root, it) || (hyp && !other ? { metric: metricText(hyp.text), source: hyp.source, hyp: true } : null) || recordMetric(S.root, it) || anchorMetric(S.root, it);
344
383
  if (!m) return null; // nothing to cite: the PM names it (proven-only)
345
384
  const h = horizonFor(S, it, tasks);
346
- const said = m.hyp ? 'Its hypothesis' : m.source.label.startsWith('PRD') ? 'Its PRD' : 'Its anchor';
385
+ const said = m.hyp ? 'Its hypothesis' : m.source.label.startsWith('PRD') ? 'Its PRD' : m.source.label.startsWith('Record') ? 'Its record' : 'Its anchor';
347
386
  const claims = [claim(`${said} says: ${m.metric}`, [m.source])];
348
387
  if (hyp && !m.hyp) claims.push(claim(`Its hypothesis: ${clip(hyp.text, 160)}`, [hyp.source]));
349
388
  if (h.source) claims.push(claim(`Its last task is due on ${short(h.lastDue)}`, [h.source]));
@@ -573,5 +612,25 @@ function undoCheck(root, { initiative, at, by, via }, { now = Date.now() } = {})
573
612
  } catch (e) { return { ok: false, error: 'the outcome ledger could not be written: ' + String((e && e.message) || e).slice(0, 160) }; }
574
613
  }
575
614
 
576
- module.exports = { VERSION, undoCheck, liveChecks, JOB, DAYS_AFTER, DEFAULT_DAYS, DISPOSITIONS, scan, drafts, prdMetric, anchorMetric, horizonFor, recordCheck, todayOf, short, frontOf,
615
+ /** How many live initiatives carry an expected outcome and a check date (outcome-drafts-land: its done-test and health number). → { live,
616
+ * withOutcome, withBoth, pct, without: [id] } */
617
+ function coverageOf(S) {
618
+ const live = S.subjects.filter((it) => !it.accepted || it.metric); // an accepted one with no outcome is too late to declare: not counted
619
+ const withOutcome = live.filter((it) => it.metric), withBoth = withOutcome.filter((it) => it.horizon);
620
+ return { live: live.length, withOutcome: withOutcome.length, withBoth: withBoth.length, pct: live.length ? Math.round((withBoth.length / live.length) * 100) : null,
621
+ without: live.filter((it) => !(it.metric && it.horizon)).map((it) => it.id) };
622
+ }
623
+
624
+ if (require.main === module) {
625
+ // `node workspace/lib/outcomes.js coverage [--root <dir>]`: the health read of outcome-drafts-land; the percent is the last line
626
+ const a = process.argv.slice(2), at = a.indexOf('--root');
627
+ if (a[0] !== 'coverage') { console.log('usage: node lib/outcomes.js coverage [--root <dir>]'); process.exit(2); }
628
+ let root = at >= 0 && a[at + 1] ? a[at + 1] : process.cwd();
629
+ if (at < 0) { try { root = require('child_process').execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || root; } catch { /* not a git tree */ } }
630
+ const c = coverageOf(scan(root));
631
+ console.log(`${c.live} live initiatives · ${c.withOutcome} name an expected outcome · ${c.withBoth} have both an outcome and a check date`);
632
+ console.log(c.pct == null ? 'none live' : c.pct + '%');
633
+ }
634
+
635
+ module.exports = { VERSION, coverageOf, undoCheck, liveChecks, JOB, DAYS_AFTER, DEFAULT_DAYS, DISPOSITIONS, scan, drafts, prdMetric, anchorMetric, horizonFor, recordCheck, todayOf, short, frontOf,
577
636
  experimentField, krMismatch, killMet, anyRefuted, verdictsOf, rowOutcomes, outcomeOfRow, refutedDrafts, setLife, NEXT_WORDS, cmpVersion, recordLive, LIVE, LIVE_TAG };
@@ -12,6 +12,9 @@
12
12
  * outcome an outcome's check date passed and its goal's own reading did not decide it (lib/outcome-props.js duePass, once per initiative
13
13
  * and check date): PMOS reads the initiative's records and files whether it worked with `pmos propose verdict`, each claim cited
14
14
  * path:line with its quote, or nothing when it cannot tell (then Your move asks the PM). The verdict is class B: recorded with Undo.
15
+ * outcome-draft an initiative has no expected outcome and nothing PMOS reads by itself cites one (lib/outcome-props.js draftPass, once per
16
+ * initiative, ever; outcome-drafts-land): PMOS reads its record and sources and files `pmos propose outcome`, each claim cited
17
+ * path:line with its quote, or nothing. The ✦ is class B: applied with Undo.
15
18
  * check each morning inside the day-check window, once a day per initiative that has a late or at-risk task (devTpRules 1): Claude finds
16
19
  * WHY each one slipped (the stored reads, the calendar, meeting notes, chat, Jira status) and files its dates, "looks done" and
17
20
  * tidy names. A date that passes shows at once without a run: lib/proposals.js datesOf proposes from the tasks themselves, with
@@ -45,6 +48,7 @@ const localDay = (ms) => { const d = new Date(ms); return d.getFullYear() + '-'
45
48
  const WHY = {
46
49
  populate: 'The PM just added this initiative. It most likely already lives elsewhere: find it in every connected source and file what you find (Found elsewhere).',
47
50
  check: 'The morning check: some tasks are late or at risk. Find why each one slipped and file new dates, "looks done" and tidy names.',
51
+ 'outcome-draft': 'It has no expected outcome, and nothing PMOS reads by itself says one. Read its record, its PRD or brief, its tasks and its sources, then file what should change once it ships and, when a source says so, when to check it (`pmos propose outcome`). Cite every claim path:line with that line\'s text. When nothing says what it should change, file nothing.',
48
52
  outcome: 'Its outcome check date has passed and its goal\'s own reading did not decide it. Read its records and file whether it worked (`pmos propose verdict`); when you cannot tell, file `cant-tell` with what you read and what was missing.',
49
53
  };
50
54
 
@@ -54,6 +58,7 @@ function promptOf(skill, o) {
54
58
  + `- Initiative: ${o.ini} · ${one(o.title, 140)}${o.intent ? '\n- Its Why: ' + one(o.intent, 600) : ''}\n- Its stage now: ${o.stage || 'the first stage'}\n`
55
59
  + `- Its workflow's stages, in order:\n${list((o.stages || []).map((s) => s.key + ' · ' + s.name), 'not known')}\n`
56
60
  + (o.why === 'check' ? `- Its late and at-risk tasks:\n${list(o.tasks, 'none')}\n`
61
+ : o.why === 'outcome-draft' ? `- Its anchor: ${one((o.outcome && o.outcome.anchor) || '', 120) || 'none'}\n- Its record: ${one((o.outcome && o.outcome.record) || '', 200) || 'its initiative record'}\n`
57
62
  : o.why === 'outcome' && o.outcome ? `- Its expected outcome: ${one(o.outcome.metric, 400)}\n- Its check date: ${o.outcome.horizon}\n- Its anchor: ${one(o.outcome.anchor, 120) || 'none'}\n- Its record: ${one(o.outcome.record, 200)}\n- Why the goal's reading did not decide it: ${one(o.outcome.why, 300)}\n`
58
63
  : `- The material the PM gave and the people named are in its record and its first questions (\`pmos initiative export ${o.ini}\`).\n`)
59
64
  + `- Dropped by the PM (do not file these again unless the evidence is new):\n${list(o.dropped, 'none')}\n`
@@ -122,7 +127,7 @@ function create(deps) {
122
127
  active.set(run, { ws, ini, dir, session: null, why });
123
128
  let session = null;
124
129
  try {
125
- session = go({ name: (why === 'check' ? 'Task check · ' : why === 'outcome' ? 'Outcome check · ' : 'Looking for · ') + one(row.title || ini, 60), ws, origin: `propose:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
130
+ session = go({ name: (why === 'check' ? 'Task check · ' : why === 'outcome' ? 'Outcome check · ' : why === 'outcome-draft' ? 'Outcome draft · ' : 'Looking for · ') + one(row.title || ini, 60), ws, origin: `propose:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
126
131
  env: { PMOS_PROPOSE_FILE: PR.ledgerFile(dir), PMOS_PROPOSE_WS: ws, PMOS_PROPOSE_BOARD: board || '', PMOS_PROPOSE_INI: ini, PMOS_PROPOSE_RUN: run, PMOS_PROPOSE_ROOT: w.root }, onDone: (r) => ended(run, r) });
127
132
  } catch (e) { warn('proposal run', e); }
128
133
  if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs; it looks again in a minute' }; }
@@ -19,7 +19,7 @@ const fs = require('fs');
19
19
  const PR = require('./proposals.js');
20
20
  const LP = require('./loose-proposals.js');
21
21
 
22
- const COMMANDS = { propose: ['look', 'found', 'date', 'done', 'name', 'verdict', 'status', 'loose'] };
22
+ const COMMANDS = { propose: ['look', 'found', 'date', 'done', 'name', 'verdict', 'outcome', 'status', 'loose'] };
23
23
  const USAGE = [
24
24
  'usage: pmos propose look|found|date|done|name|status — what PMOS proposes on an initiative, under its ✦',
25
25
  ' pmos propose look <source> --reading | --found <n> --what "<5 documents>" | --none',
@@ -37,6 +37,9 @@ const USAGE = [
37
37
  ' pmos propose verdict --json <file|-> only in an outcome run: { "disposition": "worked" | "didnt-work" | "cant-tell", "evidence": "<one line>",',
38
38
  ' "claims": [{ "text", "sources": [{ "label", "ref": "<path:line>", "quote": "<the text on that line>" }] }] } each quote is checked',
39
39
  ' against its line; a claim that does not match is refused. cant-tell files nothing: the PM is asked.',
40
+ ' pmos propose outcome --json <file|-> only in an outcome-draft run: { "metric": "<what should change once it ships>", "horizon"?: "YYYY-MM-DD",',
41
+ ' "claims": [{ "text", "sources": [{ "label", "ref": "<path:line>", "quote": "<the text on that line>" }] }] } each quote is checked;',
42
+ ' with no horizon PMOS picks the date (30 days after the last task is due, else 90 days on)',
40
43
  ' pmos propose status',
41
44
  ' pmos propose loose link --json - { "initiative", "title", "why", "items": [{ "row" }] } rows that belong to one open initiative',
42
45
  ' pmos propose loose merge --json - { "into": "w:<item>", "why", "items": [{ "row": "c:<chat>" }] } a chat that doubles the PM\'s own item',
@@ -125,6 +128,41 @@ function verdict(args, { say, stdin, env, file, runId, ini, board, F, line }) {
125
128
  return 0;
126
129
  }
127
130
 
131
+ /** `pmos propose outcome`: the outcome-draft run's expected outcome for an initiative that has none (initiative outcome-drafts-land). Only
132
+ * in a run started with why `outcome-draft`, only while the record has no outcome, and only when every claim's quote is on its path:line
133
+ * (lib/ai-guard.js check). It files the same outcome/new ✦ the daily pass files (class B: applied with Undo). */
134
+ function outcomeDraft(args, { say, stdin, env, file, runId, ini, board, F, line }) {
135
+ const root = env.PMOS_PROPOSE_ROOT;
136
+ const L = F.looks.get(ini);
137
+ if (!root || !L || L.run !== runId || L.why !== 'outcome-draft') { say('✗ pmos propose outcome is for PMOS\'s outcome-draft run'); return 1; }
138
+ const jsonAt = args.indexOf('--json'), src = jsonAt >= 0 ? args[jsonAt + 1] : null;
139
+ if (!src) { say('usage: pmos propose outcome --json <file|->'); return 2; }
140
+ const r = readJson(src, stdin); if (r.error) { say('✗ ' + r.error); return 1; }
141
+ const b = r.body && typeof r.body === 'object' && !Array.isArray(r.body) ? r.body : {};
142
+ const metric = String(b.metric || '').replace(/\s+/g, ' ').trim();
143
+ if (metric.replace(/[^A-Za-z0-9]/g, '').length < 12 || metric.length > 300) { say('✗ refused: metric says what should change once it ships, in 12 to 300 characters'); return 1; }
144
+ const O = require('./outcomes.js'), AG = require('./ai-guard.js');
145
+ const S = O.scan(root), it = S.subjects.find((x) => x.id === ini);
146
+ if (!it) { say(`✗ refused: ${ini} is not a live initiative here`); return 1; }
147
+ if (it.metric) { say(`✗ refused: ${ini} has its expected outcome already`); return 1; }
148
+ if (!Array.isArray(b.claims) || !b.claims.length) { say('✗ refused: give at least one claim, cited path:line with that line\'s text'); return 1; }
149
+ const c0 = AG.check({ id: 'outcome-new:' + ini, title: 'Expected outcome', say: metric, confidence: 'medium', cls: 'B', claims: b.claims }, { root, stateDir: require('path').dirname(file) });
150
+ if (!c0.ok) { say('✗ refused: ' + c0.errors.join('; ')); return 1; }
151
+ const sources = c0.p.claims.flatMap((c) => c.sources).filter((x) => x.verified).map((x) => ({ label: x.label, ref: x.ref }));
152
+ if (!sources.length) { say('✗ refused: no claim\'s quote matched its line'); return 1; }
153
+ let horizon = String(b.horizon || '').trim(), how = 'a source names it';
154
+ if (horizon && (!/^\d{4}-\d{2}-\d{2}$/.test(horizon) || horizon <= S.today)) { say('✗ refused: horizon is a date after today, YYYY-MM-DD'); return 1; }
155
+ if (!horizon) { const h = O.horizonFor(S, it); horizon = h.horizon; how = h.why; }
156
+ const why = `It had no expected outcome. PMOS read its sources and suggests: "${metric}", checked on ${O.short(horizon)} (${how}). Undo takes it back.`;
157
+ const c = PR.clean('outcome', 'new', { title: 'What should change once it ships', why, sources, items: [{ id: 'outcome', title: metric, due: horizon }], data: { metric, horizon } });
158
+ if (c.error) { say('✗ refused: ' + c.error); return 1; }
159
+ const id = PR.idOf(ini, 'outcome', 'new', 'draft');
160
+ if (F.props.has(id)) { say(`already ${id}: PMOS drafted this initiative's outcome before`); return 0; }
161
+ line({ kind: 'propose', ini, board, run: runId, id, ...c.prop });
162
+ say(`filed ${id} · outcome/new · ${metric}`);
163
+ return 0;
164
+ }
165
+
128
166
  async function run(argv, { say = (s) => console.log(s), env = process.env, stdin } = {}) {
129
167
  const args = argv[0] === 'propose' ? argv.slice(1) : argv.slice();
130
168
  const verb = args[0];
@@ -158,6 +196,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
158
196
  const L = F.looks.get(ini);
159
197
  if (L && L.run === runId && L.stopped) { say('✗ the PM pressed Stop: file nothing more'); return 1; }
160
198
  if (verb === 'verdict') return verdict(args, { say, stdin, env, file, runId, ini, board, F, line });
199
+ if (verb === 'outcome') return outcomeDraft(args, { say, stdin, env, file, runId, ini, board, F, line });
161
200
  const type = verb === 'found' ? args[1] : verb === 'date' ? 'stage' : verb === 'done' ? 'done' : 'tidy';
162
201
  const jsonAt = args.indexOf('--json'), src = jsonAt >= 0 ? args[jsonAt + 1] : null;
163
202
  if (!src) { say(`usage: pmos propose ${verb}${verb === 'found' ? ' <type>' : ''} --json <file|->`); return 2; }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.777.0",
3
+ "version": "0.778.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.777.0",
9
+ "version": "0.778.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.777.0",
3
+ "version": "0.778.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",
@@ -3243,6 +3243,9 @@ const outcomeProps = require('./lib/outcome-props.js').create({
3243
3243
  // outcome-checks-run-themselves: a due check no reading decides gets one short run that reads the initiative's records (lib/proposal-runs.js)
3244
3244
  startRun: (w, o) => proposalRuns.start({ ws: w.id, board: o.board, ini: o.ini, why: 'outcome', press: false, now: o.now,
3245
3245
  outcome: { metric: o.it.metric, horizon: o.it.horizon, anchor: o.it.anchor, record: o.it.record, why: o.why } }),
3246
+ // outcome-drafts-land: an initiative with nothing to cite gets one run of the same kind that drafts its outcome (`pmos propose outcome`)
3247
+ startDraft: (w, o) => proposalRuns.start({ ws: w.id, board: o.board, ini: o.ini, why: 'outcome-draft', press: false, now: o.now,
3248
+ outcome: { anchor: o.it.anchor || '', record: o.it.record || '' } }),
3246
3249
  env: process.env,
3247
3250
  every: TICK_MS,
3248
3251
  mayRun: () => { try { return scheduleOwner.mayRun(); } catch { return true; } },
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: initiative-propose
3
3
  label: "Claude proposes, per initiative"
4
- description: "One short background run for one initiative. When the initiative was just added, it looks for it in every connected source and files what it finds: the stage the work is really in, its documents and its tasks with their dates. Each morning it finds why late tasks slipped and files new dates, done and tidy names. When an outcome check date passes and no reading decides it, it reads the records and files whether it worked. Everything waits under the initiative's ✦ for the PM's ✓. It writes no task, document or stage and sends nothing."
4
+ description: "One short background run for one initiative. When the initiative was just added, it looks for it in every connected source and files what it finds: the stage the work is really in, its documents and its tasks with their dates. Each morning it finds why late tasks slipped and files new dates, done and tidy names. When an outcome check date passes and no reading decides it, it reads the records and files whether it worked. When an initiative has no expected outcome and nothing cites one, it drafts one from its record and sources. Everything waits under the initiative's ✦ for the PM's ✓. It writes no task, document or stage and sends nothing."
5
5
  run: agent
6
6
  agent: claude
7
7
  output:
@@ -10,7 +10,7 @@ output:
10
10
  - Not read
11
11
  ---
12
12
 
13
- /initiative-propose: for ONE initiative, find what the evidence says and file it with `pmos propose`, then stop. The lines after this procedure name the initiative, why this run runs (populate, check or outcome), today, its stages and what the PM dropped.
13
+ /initiative-propose: for ONE initiative, find what the evidence says and file it with `pmos propose`, then stop. The lines after this procedure name the initiative, why this run runs (populate, check, outcome or outcome-draft), today, its stages and what the PM dropped.
14
14
 
15
15
  Rules that always hold:
16
16
  1. THE ONLY WRITE is `pmos propose`. You have no Write and no Edit tool. Do not add a task, move a stage or write a document: the PM's ✓ on the page does that. Do not commit and do not push.
@@ -45,6 +45,12 @@ Procedure when the run is `outcome` (the check date of its expected outcome has
45
45
  3. File once with `pmos propose verdict --json -`: `{ "disposition": "worked" | "didnt-work" | "cant-tell", "evidence": "<one line: what you found, with the number>", "claims": [{ "text": "<one fact>", "sources": [{ "label": "<what it is>", "ref": "<path:line, from the repository root>", "quote": "<the text on that line, at least 12 characters>" }] }] }`. Each quote is checked against its line; a claim that does not match is refused, and so is the verdict. Claims are optional for `cant-tell`. When `worked` or `didnt-work` is refused because the evidence is only in a connector (not on a line in the repository), file `cant-tell` and name that evidence: do not end the run with nothing filed.
46
46
  4. Do not record the check yourself: the server records your verdict with Undo.
47
47
 
48
+ Procedure when the run is `outcome-draft` (the initiative has no expected outcome, and nothing PMOS reads by itself says one):
49
+ 1. Read the record named below, its PRD, brief or done test if it names them, its tasks (`pmos initiative export <id>`), and the stored reads of its sources (`pmos source show <source>`).
50
+ 2. Write what should change for its users or its product once it ships, in one sentence, with a number or a direction you can check later (for example "Concurrent sessions per account fall, so one login is no longer shared across several people"). Take it only from what you read: a goal, a reason, a problem the record or its sources state. Do not invent a target number.
51
+ 3. File once with `pmos propose outcome --json -`: `{ "metric": "<the sentence>", "horizon": "<YYYY-MM-DD, only when a source names when to check>", "claims": [{ "text": "<one fact>", "sources": [{ "label": "<what it is>", "ref": "<path:line, from the repository root>", "quote": "<the text on that line, at least 12 characters>" }] }] }`. Each quote is checked against its line; a claim that does not match is refused. Leave `horizon` out to let PMOS pick the date. PMOS applies it with Undo.
52
+ 4. When nothing you read says what it should change, file nothing and say so under Not found.
53
+
48
54
  Output contract: produce EXACTLY these sections in your final message:
49
55
  - Filed (the proposal ids and their kinds, or "nothing new")
50
56
  - Not found (what you looked for and did not find)
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Every live initiative gets an expected outcome and a check date (initiative outcome-drafts-land, done test L1-L8): lost keeps refiled, stopped records left out, the KR line and the record's own words cited, one outcome-draft run for the rest, pmos propose outcome, coverage. Pure checks. No connector, model or network.",
3
+ "modules": [
4
+ "outcome-drafts-land.test.js"
5
+ ],
6
+ "seconds": {
7
+ "outcome-drafts-land.test.js": 5
8
+ }
9
+ }