create-pmos 0.655.0 → 0.657.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.655.0",
3
+ "version": "0.657.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,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.657.0",
38
+ "at": "2026-11-22T03:33:57.830Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1441,
43
+ "t": "Goals is built from the design system's blocks",
44
+ "s": "Goals is built from the design system's blocks",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.656.0",
51
+ "at": "2026-11-22T02:59:28.675Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1440,
56
+ "t": "Act alone only with a source, ask the rest once a day",
57
+ "s": "Act alone only with a source, ask the rest once a day",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.655.0",
38
64
  "at": "2026-11-22T02:03:29.259Z",
@@ -290,32 +316,6 @@
290
316
  "k": "new"
291
317
  }
292
318
  ]
293
- },
294
- {
295
- "v": "0.631.0",
296
- "at": "2026-11-19T11:03:25.147Z",
297
- "f": 4,
298
- "prs": [
299
- {
300
- "n": 1412,
301
- "t": "Keep a snapshot of every past sprint, with a sprint picker on the Backlog",
302
- "s": "Keep a snapshot of every past sprint, with a sprint picker on the Backlog",
303
- "k": "new"
304
- }
305
- ]
306
- },
307
- {
308
- "v": "0.630.0",
309
- "at": "2026-11-19T08:05:45.827Z",
310
- "f": 4,
311
- "prs": [
312
- {
313
- "n": 1411,
314
- "t": "Backlog shows names not ids, the product's name, and no empty columns",
315
- "s": "Backlog shows names not ids, the product's name, and no empty columns",
316
- "k": "fix"
317
- }
318
- ]
319
319
  }
320
320
  ]
321
321
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@45c585b5
1
+ kernel-source: pmos@5e4c4685
2
2
  assembled: 2026-11-22
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-22T02:03:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T03:33:54Z"}
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-22T02:03:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T03:33:54Z"}
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-22T02:03:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T03:33:54Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.657.0",
4
+ "at": "2026-11-22T03:33:57.830Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1441,
9
+ "t": "Goals is built from the design system's blocks",
10
+ "s": "Goals is built from the design system's blocks",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.656.0",
17
+ "at": "2026-11-22T02:59:28.675Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1440,
22
+ "t": "Act alone only with a source, ask the rest once a day",
23
+ "s": "Act alone only with a source, ask the rest once a day",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.655.0",
4
30
  "at": "2026-11-22T02:03:29.259Z",
@@ -42,6 +42,17 @@ PMOS agents finish work without waiting for you. A change that can be undone is
42
42
 
43
43
  A change with no Undo waits too, whatever its class. A "maybe" or a possible duplicate that PMOS found elsewhere waits, because it is a question for you.
44
44
 
45
+ ### Only with a source
46
+
47
+ PMOS changes a plan by itself only when the change cites a source. These changes wait for an answer instead:
48
+
49
+ - A date move, a task marked done, a name change, a task or document found elsewhere, or a task link that cites no source. This includes a late task where PMOS found no reason.
50
+ - A task closed, a name changed from outside text (Slack, mail, a meeting, Jira), or a date moved by more than 30 days, that cites only one kind of source. Two different kinds are needed, for example Jira and a meeting note. Two Slack messages are one kind.
51
+
52
+ A tidy name that uses only the task's own words is not a name change from a source. It still applies by itself.
53
+
54
+ The changes that wait come together in one list of questions a day: one question for each owner and initiative. The owner is the person the plan names on the task, or you. The list is fixed for the day. A change that waits later that day goes on the next day's list. A question for a teammate is a draft. PMOS does not send it. When you keep or drop the change, its question leaves the list.
55
+
45
56
  ### Undo
46
57
 
47
58
  Each change an agent applies is listed for 14 days with Undo. Undo puts the record back as it was. If someone changed the record since, Undo keeps that change.
@@ -219,12 +219,17 @@ The notes of a held meeting look the same wherever you open them: a short summar
219
219
 
220
220
  **Goals** in the navigation answers "Am I on track? What do I do?" for the products you chose at the top left. The product choice and each product's heading show the product's name, such as IDPF, not the name of its folder. When a key result waits on a source, Goals names the tool, such as Confluence, and not a page number. It reads your OKR file as one hierarchy: the North Star, then each objective with its key results, the levers behind them and the initiatives that move them.
221
221
 
222
- 1. The card at the top is the North Star. When PMOS drafted one, press the tick to approve it or the cross to drop it. You can undo either for a moment.
223
- 2. Each key result shows its reading against its target and the days left. A grey dot and a dash mean nothing reads it yet: the line under it says what it waits on. PMOS never shows a number it did not read.
224
- 3. Press a key result to open it with the chat beside it: what PMOS read, the target and time left, the levers, the work that names it, and the source to connect.
225
- 4. Press an initiative to open it. When its outcome check is overdue, the verdict page opens: press the tick and PMOS judges it in the chat.
226
- 5. **Budget** rows show the health budgets that have work in them. **Unlinked** shows the work that names no key result.
227
- 6. Under **⋯**: **Set up** (names to confirm and sources to connect), **Charts and dashboards** (the readings and charts, on the Intelligence page) and **Export CSV**. The filter shows only the key results that slip, are not read, or are read.
222
+ The page is one column of blocks.
223
+
224
+ 1. The top line is the path (**Goals ›** the product), the period, such as Q4 2026, then Search, **+** (New key result) and **⋯**.
225
+ 2. **Where it stands** says what matters now: how many key results are on pace, which one is behind and the work that moves it with its date, a key result with no reading and since when, and the next check. Press a name to open it.
226
+ 3. Under it, PMOS makes one suggestion. It shows **Why**, **PMOS will**, **What changes** and **Based on**. Press the tick to do it, the pencil to change the words first, or the cross to say no. When PMOS drafted a North Star, the tick keeps it and the cross drops it. You can undo either for a moment.
227
+ 4. **North Star**, **Input** and **Guardrail** show their reading, the day it was read and a small line of the readings. A measure that does not exist shows no block.
228
+ 5. **Key results** is one table, grouped by objective, then health budgets, then the work that names no key result. Each row shows the reading against its target, its pace, the work that moves it and its check date. A dash means nothing reads it yet, and the row says what it waits on. PMOS never shows a number it did not read. The tabs show **All**, **Behind**, **No reading** or **On pace**. **Choose columns** adds **Left** (the days left) and **Levers**.
229
+ 6. For work that names no key result, PMOS says which key result it thinks the work moves and the words they share. Press the link button to put the words in the chat box.
230
+ 7. Press a key result to open it with the chat beside it: what PMOS read, the target and time left, the levers, the work that names it, and the source to connect. Press an initiative to open it. When its outcome check is overdue, the verdict page opens.
231
+ 8. **Ask about your goals** at the end is the chat about the product's goals. Ask why a key result is behind, or say a new one.
232
+ 9. Under **⋯**: **Set up** (names to confirm and sources to connect), **Charts and dashboards** (the readings and charts, on the Intelligence page) and **Export CSV**.
228
233
 
229
234
  Reports are routine jobs, so they live in Routine.
230
235
 
@@ -118,6 +118,9 @@ const classOfDriver = (what) => DRIVER_CLASS[what] || 'C';
118
118
  function classOfProposal(p) {
119
119
  if (!isObj(p)) return 'C';
120
120
  const c = PROPOSAL_CLASS[p.group] || 'C';
121
+ // act-alone-only-with-a-source: a plan change with no source, or a close, rename or big date move on one kind of source, is the owner's
122
+ // question (lib/source-guard.js); it joins the day's question list instead of applying by itself
123
+ if (c !== 'C' && require('./source-guard.js').holdOf(p)) return 'C';
121
124
  if (p.group === 'status' && (p.items || []).some((x) => x && x.jira)) return 'C';
122
125
  if (p.group === 'outcome' && (p.type === 'refuted' || p.type === 'source')) return 'C'; // a next step, or the one ask for a source PMOS cannot read
123
126
  // D108 as amended 2026-11-16 (Wawan: "Open them automatically"): the factory's pull request opens by itself, from the server (never the
@@ -84,6 +84,7 @@ const JOBS = Object.freeze([
84
84
  { id: 'verify', step: 4, label: 'Verifier after merge' },
85
85
  { id: 'metric-reads', step: 4, label: 'Metric reads' },
86
86
  { id: 'forecast', step: 4, label: 'Forecast' },
87
+ { id: 'outcomes', step: 4, label: 'Outcome checks' }, // outcome-checks-run-themselves: a due check's verdict, and one short run when no reading decides it (lib/outcome-props.js)
87
88
  { id: 'report-design', step: 4, label: 'Report design' },
88
89
  { id: 'report-structure', step: 4, label: 'Report structure' },
89
90
  { id: 'team', step: 4, label: 'Role agents' },
@@ -69,6 +69,8 @@ const LEDGERS = Object.freeze({
69
69
  r('lib/routes-scan.js', null, 'the Horizon scan results')] },
70
70
  '<state>/outcome-runs.jsonl': { concept: 'outcome-runs', owner: 'lib/outcome-props.js', readers: [
71
71
  r('lib/outcome-props.js', 'runsOf', 'one outcome run per initiative and check date')] },
72
+ '<state>/question-days.jsonl': { concept: 'question-days', owner: 'lib/question-batch.js', readers: [
73
+ r('lib/routes-your-move.js', null, "the day's question list in Your move")] },
72
74
  '<state>/drift.jsonl': { concept: 'drift', owner: 'lib/drift.js', readers: [
73
75
  r('lib/routes-drift.js', null, "What you might have missed, in Home's chat")] },
74
76
  '<runtime>/idle-lab.jsonl': { concept: 'idle-lab', owner: 'lib/idle-lab.js', readers: [
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+ /* question-batch.js — the day's question list (initiative act-alone-only-with-a-source; A120 + A48 in pmos-ideas/proofs). The changes PMOS
3
+ * holds for want of a source (lib/source-guard.js) come to their owners as one question per owner per initiative, once a day, not one ask
4
+ * per change.
5
+ *
6
+ * questionsOf(held, { pm }) → [question] PURE. held: lib/routes-proposals.js heldOf. One per owner and initiative, the PM's first.
7
+ * today(stateDir, held, { day, pm }) → { day, questions, later } the list fixed for `day`: the first read of a day writes one line to
8
+ * <state>/question-days.jsonl with the proposal ids on it; later reads that day show only those (still held)
9
+ * ones. `later` counts the changes held since, which wait for the next day's list.
10
+ * LEDGER
11
+ *
12
+ * A question: { key, owner, toPm, ini, title, board, text, ids: [proposal id], n }. owner: the owner the plan names on the held work (a task's
13
+ * owner, or the dates proposal's `ask.owner`), else the PM. A question for a teammate is a draft for the PM to pass on: nothing is sent.
14
+ * An answered question leaves the list by itself: the PM's keep or drop closes the proposal, so heldOf no longer returns it. */
15
+ const fs = require('fs');
16
+ const path = require('path');
17
+
18
+ const LEDGER = 'question-days.jsonl';
19
+ const MAX_IDS = 400;
20
+ const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
21
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
22
+ const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
23
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
24
+ const { KIND_NAMES } = require('./source-guard.js');
25
+ const md = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
26
+
27
+ /** The owner of a held proposal: the first owner its items name, or the dates proposal's ask. '' when the plan names none. */
28
+ function ownerOf(p) {
29
+ const it = (p.items || []).find((x) => isObj(x) && x.owner);
30
+ return one((it && it.owner) || (isObj(p.ask) && p.ask.owner) || '', 60);
31
+ }
32
+
33
+ /** One line of what a held proposal asks. */
34
+ function partOf(p, hold) {
35
+ const items = (p.items || []).filter(isObj);
36
+ const first = items[0] || {};
37
+ const name = one(first.title || p.title || '', 80);
38
+ const kind = hold && hold.kinds && hold.kinds.length === 1 ? hold.kinds[0] : '';
39
+ const only = kind ? ` Only ${KIND_NAMES[kind] || 'one source'} says so.` : '';
40
+ if (p.group === 'dates' && (p.noReason || !kind)) {
41
+ const n = items.length;
42
+ return `${plural(n, 'task', 'tasks')} passed ${n === 1 ? 'its' : 'their'} date with no news${name ? ' (for example ' + name + ')' : ''}. Re-plan from today, or new dates?`;
43
+ }
44
+ if (p.group === 'dates') { const to = first.to && first.to.due; return `Move ${name || 'the work'}${to ? ' to ' + md(to) : ''}?${only}`; }
45
+ if (p.group === 'status') return `Is ${name || 'it'} done?${only || ' PMOS found no source.'}`;
46
+ if (p.group === 'names') return `Rename "${one(first.from || first.title || '', 60)}" to "${one(first.to || '', 60)}"?${only || ' PMOS found no source.'}`;
47
+ return `${one(p.title || p.why || 'A change', 120)}?${only || ' PMOS found no source.'}`;
48
+ }
49
+
50
+ /** One question per owner and initiative, the PM's first, then by initiative. PURE. */
51
+ function questionsOf(held, { pm = 'PM' } = {}) {
52
+ const by = new Map();
53
+ for (const h of held || []) {
54
+ if (!isObj(h) || !isObj(h.prop) || !h.ini) continue;
55
+ const o0 = ownerOf(h.prop), owner = /^pm:/.test(o0) ? '' : o0, key = (owner || '') + '|' + h.ini; // a task the PM owns (pm:<slug>) is the PM's
56
+ if (!by.has(key)) by.set(key, { key, owner: owner || pm, toPm: !owner, ini: h.ini, title: h.title || h.ini, board: h.board || '', parts: [], ids: [] });
57
+ const q = by.get(key);
58
+ q.ids.push(h.prop.id);
59
+ q.parts.push(partOf(h.prop, h.hold));
60
+ }
61
+ const out = [...by.values()].map((q) => {
62
+ const shown = q.parts.slice(0, 3), more = q.parts.length - shown.length;
63
+ return { key: q.key, owner: q.owner, toPm: q.toPm, ini: q.ini, title: q.title, board: q.board, ids: q.ids, n: q.ids.length,
64
+ text: shown.join(' ') + (more > 0 ? ` And ${plural(more, 'more change', 'more changes')}.` : '') };
65
+ });
66
+ return out.sort((a, b) => (a.toPm === b.toPm ? 0 : a.toPm ? -1 : 1) || a.title.localeCompare(b.title) || a.owner.localeCompare(b.owner));
67
+ }
68
+
69
+ function readDays(stateDir) {
70
+ let text = '';
71
+ try { text = fs.readFileSync(path.join(stateDir, LEDGER), 'utf8'); } catch { return []; }
72
+ const out = [];
73
+ for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { const l = JSON.parse(raw); if (isObj(l) && typeof l.day === 'string' && Array.isArray(l.ids)) out.push(l); } catch { /* a torn line is skipped */ } }
74
+ return out;
75
+ }
76
+
77
+ /** The list fixed for `day`. The first read of a day writes its line; later reads that day keep it. */
78
+ function today(stateDir, held, { day, pm, now } = {}) {
79
+ const list = (held || []).filter((h) => isObj(h) && isObj(h.prop) && h.prop.id);
80
+ if (!day) return { day: '', questions: questionsOf(list, { pm }), later: 0 };
81
+ let fixed = stateDir ? readDays(stateDir).filter((l) => l.day === day).pop() : null;
82
+ if (!fixed && stateDir && list.length) {
83
+ fixed = { day, at: new Date(now == null ? Date.now() : now).toISOString(), ids: [...new Set(list.map((h) => h.prop.id))].slice(0, MAX_IDS) };
84
+ try { fs.mkdirSync(stateDir, { recursive: true }); fs.appendFileSync(path.join(stateDir, LEDGER), JSON.stringify(fixed) + '\n'); } catch { /* the list still shows; tomorrow tries again */ }
85
+ }
86
+ const on = new Set(fixed ? fixed.ids : []);
87
+ const mine = fixed ? list.filter((h) => on.has(h.prop.id)) : list;
88
+ return { day, questions: questionsOf(mine, { pm }), later: list.length - mine.length };
89
+ }
90
+
91
+ module.exports = { questionsOf, today, ownerOf, partOf, LEDGER };
@@ -182,6 +182,32 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
182
182
  return out;
183
183
  }
184
184
 
185
+ /** act-alone-only-with-a-source: the open proposals of a workspace that PMOS holds for want of a source (lib/source-guard.js), on every
186
+ * board, for the day's question list (lib/question-batch.js). → [{ ini, title, board, prop, hold }] */
187
+ function heldOf(ctx, w) {
188
+ const SG = require('./source-guard.js');
189
+ const out = [];
190
+ if (!dirOf(ctx, w)) return out;
191
+ const fr = RB.frameFor(ctx, w);
192
+ for (const board of fr.boards || []) {
193
+ // no derive: a read that finds the rows still being derived skips the board this time (the list is fixed later in the day, and the
194
+ // synchronous derive would hold the server for every request behind it)
195
+ const f = TLR.frame(ctx, w, board);
196
+ if (!f) continue;
197
+ for (const row of f.rows || []) {
198
+ if (!row || !row.id) continue;
199
+ let v = null;
200
+ try { v = view(ctx, { w, fr, board, file: null }, row.id, f, { grillAll: true }); } catch { v = null; }
201
+ if (!v) continue;
202
+ for (const x of v.groups.flatMap((gr) => gr.props)) {
203
+ const hold = SG.holdOf(x);
204
+ if (hold) out.push({ ini: row.id, title: row.title || row.name || row.id, board: board.id, prop: x, hold });
205
+ }
206
+ }
207
+ }
208
+ return out;
209
+ }
210
+
185
211
  /** The writes of one proposal. → [write] (each { op, ... } that landed). sk: the item ids the PM left out (✕ on one item). */
186
212
  /** A live round's specimen kept (lib/live-round.js): it is the experiment's kept specimen and a lesson, and the grill runs once on it as
187
213
  * the Review step (D60 as amended 2026-11-17: never during the round, once after ✓). A grill that cannot start now is said in the lesson. */
@@ -520,7 +546,7 @@ const WRITES = {
520
546
 
521
547
  module.exports = {
522
548
  prefixes: ['/api/proposals'],
523
- viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep,
549
+ viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep, heldOf,
524
550
  handle: async (req, res, url, ctx) => {
525
551
  const p0 = url.pathname;
526
552
  if (req.method === 'GET') {
@@ -2,7 +2,8 @@
2
2
  /* routes-your-move.js — what Your move reads from a product beside its Board rows (workspace grill W3, frame WgW3Move).
3
3
  *
4
4
  * GET /api/your-move?ws=<id> → { ok, ws, today, verdicts: [lib/your-move.js verdict + board], kr: lib/your-move.js krOf | null,
5
- * expired: [{ ini, id, group, title, why, at }], done: lib/done-feed.js doneOf }
5
+ * expired: [{ ini, id, group, title, why, at }], done: lib/done-feed.js doneOf,
6
+ * questions: { day, questions, later } }
6
7
  *
7
8
  * verdicts: the outcome checks past their date with no verdict (lib/outcomes.js scan, less Intelligence's verdicts in
8
9
  * lib/insights-records.js), each with Claude's draft from the board's Jira tickets and the board it is on (the ✓ records it there through
@@ -12,7 +13,9 @@
12
13
  * EXPIRY (chief-of-staff C3, board CsE). The one write: a filed ✦ the PM left unanswered for 14 days expires here, as upkeep with one right
13
14
  * answer. Nothing on the initiative changes; one `expire` line per proposal goes to proposals.jsonl with its reason (lib/proposals.js
14
15
  * staleOf), and `expired` lists the ones of the last 7 days, so Your move says it once. Idempotent: an expired proposal folds as dropped.
15
- * DONE (C2, board CsD): what an agent kept by itself in the last 14 days, one line per batch with its Undo (lib/done-feed.js). */
16
+ * DONE (C2, board CsD): what an agent kept by itself in the last 14 days, one line per batch with its Undo (lib/done-feed.js).
17
+ * QUESTIONS (act-alone-only-with-a-source): { day, questions: [lib/question-batch.js question], later } — the changes PMOS holds for want
18
+ * of a source, one question per owner and initiative, the PM's first; the list is fixed for the day (one line in question-days.jsonl). */
16
19
  const YM = require('./your-move.js');
17
20
 
18
21
  const localDay = (ms = Date.now()) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -62,8 +65,16 @@ function expire(ctx, w, now = Date.now()) {
62
65
  return PR.expiredSince(F, now - 7 * 864e5).map((e) => ({ ini: e.ini, id: e.id, group: e.group, title: e.title, why: e.why, at: e.at }));
63
66
  }
64
67
 
68
+ /** The day's question list (act-alone-only-with-a-source): the changes PMOS holds for want of a source, one question per owner and
69
+ * initiative, fixed once a day (lib/question-batch.js). Questions for teammates are drafts: nothing is sent. */
70
+ function questions(ctx, w, today) {
71
+ const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
72
+ const held = require('./routes-proposals.js').heldOf(ctx, w);
73
+ return require('./question-batch.js').today(dir, held, { day: today });
74
+ }
75
+
65
76
  module.exports = {
66
- expire,
77
+ expire, questions,
67
78
  prefixes: ['/api/your-move'],
68
79
  handle: async (req, res, url, ctx) => {
69
80
  if (url.pathname !== '/api/your-move') return false;
@@ -78,7 +89,9 @@ module.exports = {
78
89
  try { X = expire(ctx, w); } catch { X = []; }
79
90
  let D = [];
80
91
  try { const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null; D = dir ? require('./done-feed.js').doneOf(require('./proposals.js').read(dir)) : []; } catch { D = []; }
81
- ctx.json(res, { ok: true, ws: w.id, today, verdicts: V, kr: K, expired: X, done: D });
92
+ let Q = { day: today, questions: [], later: 0 };
93
+ try { Q = questions(ctx, w, today); } catch { Q = { day: today, questions: [], later: 0 }; }
94
+ ctx.json(res, { ok: true, ws: w.id, today, verdicts: V, kr: K, expired: X, done: D, questions: Q });
82
95
  return true;
83
96
  },
84
97
  };
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+ /* source-guard.js — PMOS changes a plan by itself only with a source (initiative act-alone-only-with-a-source; bets 1b, 1c, 1d in
3
+ * pmos-ideas/bets.md, proofs A58, A120, A126). Pure: no file is read.
4
+ *
5
+ * holdOf(p) → null | { why, kinds } null: the proposal keeps its class. Otherwise PMOS asks instead of applying it.
6
+ * kindsOf(p) → [kind] the different kinds of source a proposal cites, e.g. ['jira', 'meeting']
7
+ * kindOf(text) → kind the kind of one source label or ref
8
+ * bigOf(p) → '' | 'close' | 'rename' | 'date' a change that needs two kinds of source
9
+ *
10
+ * THE RULE. It applies to the plan changes on a product: the groups in PLAN (dates, status, names, found, links).
11
+ * 1. No source, or a date proposal that found no reason (`noReason`): held.
12
+ * 2. A close (status done), a rename (names), or a date moved more than BIG_DAYS days needs two different kinds of source. Anyone who can
13
+ * post in a channel PMOS reads can write one line of text (A58), so one kind is not enough for a change that is hard to see afterwards.
14
+ * Two Slack lines are one kind. With one kind: held.
15
+ * 3. Anything else keeps its class. A tidy name (group names) that cites only the plan itself ('the tasks') is PMOS's name standard
16
+ * applied to the task's own words, not a rename from outside text: it keeps its class.
17
+ * A held proposal is class C (lib/autonomy.js classOfProposal): the self-apply step (lib/routes-proposals.js autoKeep) leaves it for the
18
+ * owner, and it joins the day's question list (lib/question-batch.js). Other groups (description, outcome, build, the idle lab) carry their
19
+ * own evidence rules and are not touched here. */
20
+
21
+ const PLAN = new Set(['dates', 'status', 'names', 'found', 'links']);
22
+ const BIG_DAYS = 30;
23
+ const KINDS = [
24
+ ['plan', /^\s*(the|this|its)\s+(tasks?|plan|board|initiative|stage)\b/i],
25
+ ['jira', /\bjira\b|\b[A-Z][A-Z0-9]+-\d+\b/],
26
+ ['slack', /\bslack\b/i],
27
+ ['mail', /\bg?mail\b|\be-?mail\b|\binbox\b/i],
28
+ ['meeting', /\bmeeting|\bcalendar\b|\bnotes?\b|\bminutes\b|\btranscript|\bwispr\b/i],
29
+ ['docs', /\bdrive\b|\bdocs?\b|\bdocument|\bsheets?\b|\bslides?\b|\bconfluence\b|\bwiki\b|docs\.google\.com/i],
30
+ ['repo', /\brepo(sitory)?\b|\bgithub\b|\bcommit\b|\bpull request\b|\bPR #?\d+|\.(md|js|ts|json|jsonl|py)(:\d+)?\b/i],
31
+ ['chat', /\bchat\b|\bteams\b/i],
32
+ ];
33
+ const KIND_NAMES = { plan: 'the plan itself', jira: 'Jira', slack: 'Slack', mail: 'mail', meeting: 'a meeting note', docs: 'a document', repo: 'the repository', chat: 'chat', other: 'one source' };
34
+ const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
35
+ const dn = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
36
+
37
+ /** The kind of one source label or ref. A text no rule names is 'other'. */
38
+ function kindOf(text) {
39
+ const s = String(text || '');
40
+ for (const [k, re] of KINDS) if (re.test(s)) return k;
41
+ return 'other';
42
+ }
43
+
44
+ /** The texts a proposal cites: its sources (label and ref together) and each item's own source. */
45
+ function citesOf(p) {
46
+ const out = [];
47
+ for (const s of (isObj(p) && Array.isArray(p.sources) ? p.sources : [])) if (isObj(s) && (s.label || s.ref)) out.push([s.label, s.ref].filter(Boolean).join(' '));
48
+ for (const x of (isObj(p) && Array.isArray(p.items) ? p.items : [])) if (isObj(x) && x.source) out.push(String(x.source));
49
+ return out.filter((t) => t.trim());
50
+ }
51
+ const kindsOf = (p) => [...new Set(citesOf(p).map(kindOf))];
52
+
53
+ /** The days a date item moves its due date, or null when the plan does not say where it was. */
54
+ function shiftOf(x) {
55
+ const a = dn(isObj(x.from) ? x.from.due : x.fromDue), b = dn(isObj(x.to) ? x.to.due : x.due);
56
+ return a == null || b == null ? null : b - a;
57
+ }
58
+ function bigOf(p) {
59
+ if (!isObj(p)) return '';
60
+ if (p.group === 'status') return 'close';
61
+ // a tidy name whose only source is the plan itself (the task's own words, PMOS's name standard) claims nothing from outside text: it is
62
+ // not a rename from a source. A name change that cites Slack, mail, a meeting or Jira is one (A58: 6 of the 11 it held).
63
+ if (p.group === 'names') return kindsOf(p).every((k) => k === 'plan') ? '' : 'rename';
64
+ if (p.group === 'dates' && (p.items || []).some((x) => isObj(x) && Math.abs(shiftOf(x) || 0) > BIG_DAYS)) return 'date';
65
+ return '';
66
+ }
67
+ const BIG_WORDS = { close: 'closes work', rename: 'renames work', date: 'moves a date by more than ' + BIG_DAYS + ' days' };
68
+
69
+ /** null when PMOS may apply the proposal by itself under its class; else { why, kinds }. PURE. */
70
+ function holdOf(p) {
71
+ if (!isObj(p) || !PLAN.has(p.group)) return null;
72
+ const kinds = kindsOf(p);
73
+ if (p.noReason === true || !kinds.length) return { why: 'It cites no source, so PMOS asks instead of changing the plan.', kinds };
74
+ const big = bigOf(p);
75
+ if (big && kinds.length < 2) return { why: `It ${BIG_WORDS[big]} on one kind of source (${KIND_NAMES[kinds[0]] || kinds[0]}). PMOS needs two kinds, or the owner's answer.`, kinds };
76
+ return null;
77
+ }
78
+
79
+ module.exports = { holdOf, kindsOf, kindOf, bigOf, shiftOf, PLAN, BIG_DAYS, KIND_NAMES };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.655.0",
3
+ "version": "0.657.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.655.0",
9
+ "version": "0.657.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.655.0",
3
+ "version": "0.657.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",