create-pmos 0.423.0 → 0.424.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 (47) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-products-test.js +16 -3
  8. package/workspace/changelog.json +12 -0
  9. package/workspace/guide/claude-proposes.md +37 -0
  10. package/workspace/guide/index.md +1 -0
  11. package/workspace/home-pill-test.js +138 -0
  12. package/workspace/lib/headless.js +14 -1
  13. package/workspace/lib/pmos-verbs.js +3 -0
  14. package/workspace/lib/proposal-runs.js +148 -0
  15. package/workspace/lib/proposals.js +370 -0
  16. package/workspace/lib/propose-cli.js +96 -0
  17. package/workspace/lib/route-modules.js +1 -0
  18. package/workspace/lib/routes-board-premium.js +11 -0
  19. package/workspace/lib/routes-boards.js +1 -1
  20. package/workspace/lib/routes-proposals.js +325 -0
  21. package/workspace/lib/routes-task-links.js +35 -28
  22. package/workspace/package-lock.json +2 -2
  23. package/workspace/package.json +1 -1
  24. package/workspace/premium-board-actions-test.js +2 -2
  25. package/workspace/public/pm/bd-asks.js +3 -0
  26. package/workspace/public/pm/cozy-today.css +23 -0
  27. package/workspace/public/pm/cozy-viewer.js +14 -3
  28. package/workspace/public/pm/cozy-vw-shell.css +8 -0
  29. package/workspace/public/pm/home-app.js +20 -6
  30. package/workspace/public/pm/home-task.js +2 -1
  31. package/workspace/public/pm/home-today.js +66 -16
  32. package/workspace/public/pm/ini-groups.js +30 -5
  33. package/workspace/public/pm/ini-links.js +6 -48
  34. package/workspace/public/pm/ini-props.js +218 -0
  35. package/workspace/public/pm/ini-view-model.js +6 -1
  36. package/workspace/public/pm/ini-view.css +47 -0
  37. package/workspace/public/pm/ini-view.js +23 -6
  38. package/workspace/public/pm/premium-vw-item.js +2 -1
  39. package/workspace/public/pm/task-card.css +13 -0
  40. package/workspace/public/pm/task-card.js +37 -2
  41. package/workspace/server.js +37 -2
  42. package/workspace/skills/initiative-propose.skill +45 -0
  43. package/workspace/stage-card-test.js +1 -1
  44. package/workspace/task-links-test.js +26 -14
  45. package/workspace/test-lists/claude-proposes.json +5 -0
  46. package/workspace/test-lists/home-sessions-pill.json +6 -0
  47. package/workspace/tk-tasks-test.js +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.423.0",
3
+ "version": "0.424.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": {
@@ -32,6 +32,18 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.424.0",
37
+ "at": "2026-10-27T00:38:50.632Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 1064,
42
+ "t": "Twelfth testing feedback batch",
43
+ "s": "Twelfth testing feedback batch"
44
+ }
45
+ ]
46
+ },
35
47
  {
36
48
  "v": "0.423.0",
37
49
  "at": "2026-10-26T16:10:21.071Z",
@@ -259,18 +271,6 @@
259
271
  "s": "Home session list, program chat, and new initiative sessions"
260
272
  }
261
273
  ]
262
- },
263
- {
264
- "v": "0.404.0",
265
- "at": "2026-10-24T05:07:12.902Z",
266
- "f": 2,
267
- "prs": [
268
- {
269
- "n": 1034,
270
- "t": "Chat names the real program press; add Turn into a program to the initiative ⋯",
271
- "s": "Chat names the real program press; add Turn into a program to the initiative ⋯"
272
- }
273
- ]
274
274
  }
275
275
  ]
276
276
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@926779f8
2
- assembled: 2026-10-26
1
+ kernel-source: pmos@a7084712
2
+ assembled: 2026-10-27
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-10-26T16:10:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-27T00:38:47Z"}
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-10-26T16:10:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-27T00:38:47Z"}
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-10-26T16:10:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-27T00:38:47Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  Newest first, ISO dates.
4
4
 
5
- ## 2026-10-26
5
+ ## 2026-10-27
6
6
 
7
7
  - Adopted OKF v0.2 (D73).
@@ -97,8 +97,20 @@ const product = (name, cond) => {
97
97
  const pickText = (page) => page.textContent('#czViewer #hxCount');
98
98
  // premium-uncovered-features (canvas HmProducts): another product is a closed group of the one list ("IDPF · 1 your turn"); open it to see its rows
99
99
  const openGroups = (page) => page.evaluate(() => { document.querySelectorAll('#hmList [data-hm-pg][aria-expanded="false"]').forEach((b) => b.click()); });
100
- const rowsOf = async (page) => { await openGroups(page).catch(() => {}); return rowsOf0(page); };
101
- const rowsOf0 = (page) => page.$$eval('#hmList .hm-r[data-id^="n:decision:"]', (els) => els.map((e) => ({ key: e.dataset.id.slice(2), tag: (e.closest('section.hm-pg') || e).getAttribute('aria-label') || '', title: e.querySelector('.hm-rt b').textContent })));
100
+ const rowsOf = async (page) => { await openGroups(page).catch(() => {}); return rowsOf0(page).then(async (a) => a.concat(await pillRows(page))); };
101
+ // a next step of an initiative sits in the pill on its row (batch 12 item 6): open each pill in turn and read the rows behind it
102
+ const pillRows = (page) => page.evaluate(async () => {
103
+ const out = [], wait = () => new Promise((r) => setTimeout(r, 60));
104
+ for (const id of [...document.querySelectorAll('#hmList [data-hm-ses]')].map((b) => b.dataset.hmSes)) {
105
+ const b = document.querySelector(`#hmList [data-hm-ses="${CSS.escape(id)}"]`); if (!b) continue;
106
+ const tag = (b.closest('section.hm-pg') || b).getAttribute('aria-label') || '';
107
+ b.click(); await wait();
108
+ for (const e of document.querySelectorAll('#hmList .hv-spp .hm-r[data-id^="n:decision:"]')) if (!out.some((x) => x.key === e.dataset.id.slice(2))) out.push({ key: e.dataset.id.slice(2), tag, title: e.querySelector('.hm-rt b').textContent, ses: id });
109
+ const c = document.querySelector(`#hmList [data-hm-ses="${CSS.escape(id)}"]`); if (c && c.getAttribute('aria-expanded') === 'true') { c.click(); await wait(); }
110
+ }
111
+ return out;
112
+ });
113
+ const rowsOf0 = (page) => page.$$eval('#hmList .hm-r[data-id^="n:decision:"]:not(.hv-spp .hm-r)', (els) => els.map((e) => ({ key: e.dataset.id.slice(2), tag: (e.closest('section.hm-pg') || e).getAttribute('aria-label') || '', title: e.querySelector('.hm-rt b').textContent })));
102
114
 
103
115
  {
104
116
  const { ctx, page, errors } = await open();
@@ -141,7 +153,8 @@ const product = (name, cond) => {
141
153
  // P9 decide a row of IDPF, from the page
142
154
  const { ctx, page } = await open();
143
155
  await until(async () => (await rowsOf(page)).length === 2, 20000);
144
- const key = (await rowsOf(page)).find((r) => r.tag === 'IDPF').key;
156
+ const row = (await rowsOf(page)).find((r) => r.tag === 'IDPF'), key = row.key;
157
+ if (row.ses) await page.click(`#hmList [data-hm-ses="${row.ses}"]`); // the row sits behind its initiative's pill (batch 12 item 6)
145
158
  await page.click(`#hmList [data-hm-sel="n:${key}"]`);
146
159
  await page.waitForSelector('#hmLog [data-dc-opt]'); // the decision card in the chat (canvas HmDecide)
147
160
  await page.click('#hmLog [data-dc-opt="extend"]');
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "v": "0.424.0",
4
+ "at": "2026-10-27T00:38:50.632Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 1064,
9
+ "t": "Twelfth testing feedback batch",
10
+ "s": "Twelfth testing feedback batch"
11
+ }
12
+ ]
13
+ },
2
14
  {
3
15
  "v": "0.423.0",
4
16
  "at": "2026-10-26T16:10:21.071Z",
@@ -0,0 +1,37 @@
1
+ ---
2
+ type: Guide
3
+ title: "Claude proposes: the one ✦ on each initiative"
4
+ description: "What Claude finds when you add an initiative that already lives elsewhere, the new dates, done and tidy names it proposes for late tasks, how you keep or drop them in the Viewer, Undo, and the pmos propose commands."
5
+ timestamp: 2026-10-26
6
+ ---
7
+
8
+ # Claude proposes: the one ✦ on each initiative
9
+
10
+ Each initiative has one blue ✦, next to its title. Its number is everything Claude proposes on that initiative. Nothing lands on the initiative until you press ✓. With nothing to propose, the ✦ is not shown.
11
+
12
+ Press the ✦ to open "Claude proposes N" in the Viewer. On a desk the chat stays beside it, and ← goes back to the initiative. On a phone it is full screen. The groups come in this order:
13
+
14
+ - **Found elsewhere.** When you add an initiative, Claude looks for it by itself in every source you connected: Drive, Docs, Sheets, Slides, Jira, the calendar and meeting notes, Gmail, Slack and Confluence. The Viewer shows one live line per source while it reads. A source that finds nothing drops off. ■ Stop is the only control. Claude then proposes the stage the work is really in, with the dates past stages really ended, the documents, and the tasks by stage with their own dates and owners. A Jira epic is linked, never copied.
15
+ - **Check these.** A maybe match, with its reason, and an item that is already in another initiative. A duplicate is linked, never copied. These need their own ✓.
16
+ - **Not placed.** What Claude could not fit. It is kept under Linked.
17
+ - **Dates.** Each morning, and whenever a date passes, Claude proposes new dates for tasks that are late or at risk (due within 3 days and not started), one proposal per stage. The reason is one line with its source. When Claude finds no reason, it says "No reason found" and offers to ask the owner. When a new date reaches a task that waits on it, the proposal shows the link: keep it (the waiting task moves too) or ignore it (it stays and the two overlap). Claude marks the one it recommends with a small ✦.
18
+ - **Status.** "Looks done" when the evidence says the work happened, such as an email that was sent.
19
+ - **Names.** Tidy names: the WBS number kept, verb first, about 7 words, no "+" and no brackets. The detail that is cut goes to the task's notes.
20
+ - **Links.** The links between tasks that Claude proposes.
21
+
22
+ ✓ in the Viewer's header keeps everything Claude is sure of. Check these and Not placed are never part of it. Each proposal has its own ✓ and ✕, and ⌄ shows its items. ✕ on one item leaves just that item out. × closes the Viewer and keeps or drops nothing. One toast says what changed, with Undo for the whole batch.
23
+
24
+ ✕ means gone: a dropped proposal comes back only when its evidence changes or the date passes again. A Jira ticket keeps Jira's name and dates: a proposal for one becomes a drafted comment in your outbox. A draft plan is never changed.
25
+
26
+ ## The commands
27
+
28
+ Claude's background run files proposals with these commands. The server pins the initiative and the run, so the commands refuse outside that run. You keep and drop proposals on the page.
29
+
30
+ - `pmos propose look <source> --reading | --found <n> --what "<5 documents>" | --none`: one source's live line.
31
+ - `pmos propose found <stage|docs|tasks|link|maybe|unplaced> --json <file|->`: Found elsewhere.
32
+ - `pmos propose date --json <file|->`: new dates for late or at-risk tasks, with the reason.
33
+ - `pmos propose done --json <file|->`: a task that looks done, with the evidence.
34
+ - `pmos propose name --json <file|->`: tidy names.
35
+ - `pmos propose status`: what is open, kept and dropped.
36
+
37
+ Every proposal carries its source. Nothing is sent.
@@ -65,6 +65,7 @@ On a desktop the workspace is one frame. [Layout](layout.md) explains each part.
65
65
  - [Initiatives: the Roadmap, the List and the initiative sheet](initiatives-screen.md): how to read and order the initiatives of a repository, open the sheet, make a new initiative, and review the cycle.
66
66
  - [Initiatives and the Roadmap: Now, Next and Later](initiatives-roadmap.md): what day one shows, how an agent proposes a move, and `pmos initiative` and `pmos measure` from a terminal.
67
67
  - [The Initiative Driver: drafts the agent files for you](initiative-driver.md): when the driver runs, the unblock sweep, the limits, Keep, Send back and Drop, the board modes, and `pmos driver`.
68
+ - [Claude proposes: the one ✦ on each initiative](claude-proposes.md): what Claude finds when you add an initiative, new dates, done and tidy names for late tasks, ✓, ✕, Undo, and `pmos propose`.
68
69
  - [Core documents: what each level keeps](core-documents.md): the core documents of the portfolio, a board and an initiative, their states, how PMOS drafts them, Issue it, and `pmos coredoc write`.
69
70
  - [The Horizon scan: the agent looks outside your initiatives](horizon-scan.md): how often it runs, the watch list you keep, what a scan does, where findings land, what it cannot do, and `pmos scan`.
70
71
  - [PM-only acts: what you and your agents can do](pm-only-acts.md): the acts that were yours alone, how the workspace checks that a press comes from your page, your terminal or an agent session, how an agent's act is logged under its name (D98), and what to do when a press is refused.
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* home-pill-test.js — what sits in an initiative shows as a pill on its Home row (feedback batch 12 item 6, agreed A; canvas HsA1Desk,
4
+ * HsA2Phone, HsA3Sheet; public/pm/home-today.js pillOf, kidSub, iniHtml, sesSheetHtml; home-app.js sesPill).
5
+ * P pure: the pill's most urgent state (waits on you > blocked > running > a meeting > open), its count and words; none: no pill;
6
+ * the quiet line under each row of its list
7
+ * D1 a desktop: sessions are no rows under the initiative any more; its row has the pill (a blue dot and 3), no chevron
8
+ * D2 a press lists them right under the pill, waiting first, each with one quiet line; Escape closes it and gives the focus back
9
+ * D3 a press on one opens its chat and closes the list; + starts a new session in the initiative
10
+ * D4 a phone (390 px): the pill opens a sheet with the initiative's name; the scrim closes it
11
+ * The real page from the real server, its routes answered from the fixtures. PMOS_SHOTS=<dir> also saves a screenshot of each state. */
12
+ const path = require('path');
13
+ const fs = require('fs');
14
+ const { spawn } = require('child_process');
15
+ const { pathToFileURL } = require('url');
16
+ const { findBrowser } = require('./lib/find-browser');
17
+ const T = require('./test-run').configure({ name: 'home-pill' });
18
+ const BP = require('./lib/board-premium.js');
19
+ const BF = require('./fixtures/board-premium-facts.js');
20
+ const BRP = require('./lib/briefing-premium.js');
21
+ const BRF = require('./fixtures/briefing-premium-facts.js');
22
+
23
+ const BASE = T.BASE;
24
+ const SHOTS = process.env.PMOS_SHOTS || '';
25
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
26
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
27
+ const results = [];
28
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
29
+ let srv = null; let browser = null;
30
+ const finish = async (code) => {
31
+ if (browser) await browser.close().catch(() => {});
32
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
33
+ T.killTmux();
34
+ const bad = results.filter((x) => !x.cond).length;
35
+ console.log(`\n${results.length - bad}/${results.length} home-pill assertions passed`);
36
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
37
+ };
38
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
39
+
40
+ const now = new Date().toISOString();
41
+ const ses = (id, title, shown, extra = {}) => ({ id, name: 'chat: ' + title, agent: 'claude', state: shown === 'working' ? 'running' : 'idle', shown, initiative: 'self-serve-v2', created: now, hx: { title }, ...extra });
42
+ const SESSIONS = [ses('q1', 'Investigate stage cards not updating', 'quiet'), ses('n1', 'Remove duplicate tasks', 'needs'), ses('w1', 'Plan the sprint tasks', 'working')];
43
+
44
+ (async () => {
45
+ /* P */
46
+ const TD = await import(pathToFileURL(path.join(__dirname, 'public/pm/home-today.js')).href);
47
+ const r = (kids) => ({ name: 'Tender', kids });
48
+ const s = (state, extra = {}) => ({ kind: 'session', state, hint: 'Claude', ...extra });
49
+ const m1 = TD.pillOf(r([s('quiet'), s('needs'), s('working')]));
50
+ ok('P the pill leads with what waits on you and counts all three', m1 && m1.top === 'needs' && m1.n === 3 && m1.say === '3 things in Tender: 1 waits on you, 1 running, 1 open', JSON.stringify(m1));
51
+ ok('P running beats a meeting and an open session', TD.pillOf(r([s('quiet'), { kind: 'meeting', state: 'quiet', hint: '14:00 meeting' }, s('working')])).top === 'working');
52
+ ok('P a meeting today beats an open session', TD.pillOf(r([s('quiet'), { kind: 'meeting', state: 'quiet' }])).top === 'meeting');
53
+ ok('P a next step waits on you', TD.pillOf(r([s('quiet'), { kind: 'need', step: true, state: 'quiet', hint: 'Next step' }])).top === 'needs');
54
+ ok('P nothing in it: no pill (zero is silence)', TD.pillOf(r([])) === null);
55
+ ok('P the quiet line: the state in words, then who', TD.kidSub(s('needs')) === 'Asks you · Claude' && TD.kidSub(s('working')) === 'Running · Claude' && TD.kidSub(s('blocked')) === 'Blocked, asks you · Claude' && TD.kidSub({ kind: 'meeting', hint: '14:00 meeting' }) === '14:00 meeting');
56
+
57
+ const exe = findBrowser();
58
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the home-pill suite cannot run'); return finish(1); }
59
+ let chromium;
60
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the home-pill suite cannot run'); return finish(1); }
61
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
62
+ await T.waitForServer(BASE);
63
+ browser = await chromium.launch({ executablePath: exe });
64
+ const BOARD = BP.build(BF.facts()), BRIEF = BRP.build(BRF.facts());
65
+ if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
66
+
67
+ const open = async ({ w = 1440, h = 900, theme = 'light' } = {}) => {
68
+ const ctx = await browser.newContext({ viewport: { width: w, height: h }, hasTouch: w < 500 });
69
+ const page = await ctx.newPage();
70
+ const errors = [];
71
+ page.on('pageerror', (e) => errors.push(String(e)));
72
+ const json = (rq, b) => rq.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(b) });
73
+ await page.route(/\/api\/board-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BOARD, as_of: Date.now() }));
74
+ await page.route(/\/api\/briefing-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BRIEF, as_of: Date.now() }));
75
+ await page.route('**/api/briefing-premium/**', (rq) => json(rq, { ok: true, turns: [], working: false }));
76
+ await page.route(/\/api\/sessions(\?.*)?$/, (rq) => json(rq, { sessions: SESSIONS }));
77
+ await page.goto(BASE + '/premium.html?theme=' + theme);
78
+ const up = await until(() => page.evaluate(() => !!document.querySelector('#hmList [data-hm-ses$="|i:self-serve-v2"]')), 30000);
79
+ return { ctx, page, errors, up };
80
+ };
81
+ const shot = async (p, name) => { if (!SHOTS) return; await sleep(300); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
82
+ const PILL = '#hmList [data-hm-ses$="|i:self-serve-v2"]';
83
+
84
+ /* D1 to D3, a desktop */
85
+ {
86
+ const A = await open(), p = A.page;
87
+ ok('D1 the initiative row has its pill', A.up);
88
+ if (!A.up) return finish(1);
89
+ const row = await p.evaluate((sel) => {
90
+ const b = document.querySelector(sel), rw = b.closest('.hv-r');
91
+ return { cls: b.className, n: b.querySelector('.n').textContent, dot: !!b.querySelector('.hv-pm.needs'), aria: b.getAttribute('aria-label'), chev: !!rw.querySelector('.hv-xc'),
92
+ nested: !!document.querySelector('#hmList .hm-nest'), rows: [...document.querySelectorAll('#hmList .hm-rt b')].map((x) => x.textContent).filter((t) => /Remove duplicate|Plan the sprint|Investigate stage/.test(t)) };
93
+ }, PILL);
94
+ ok('D1 the pill: a blue dot and 3, said in words', /\bneeds\b/.test(row.cls) && row.n === '3' && row.dot && /^3 things in Self-serve onboarding v2: 1 waits on you, 1 running, 1 open\. Show$/.test(row.aria), JSON.stringify(row));
95
+ ok('D1 no session is a row under the initiative, and the row has no chevron', !row.nested && !row.chev && row.rows.length === 0, JSON.stringify(row));
96
+ await shot(p, 'pill-desk');
97
+
98
+ await p.click(PILL);
99
+ const L = await until(() => p.evaluate(() => { const d = document.querySelector('#hmList .hv-spp'); return d ? { rows: [...d.querySelectorAll('.hv-r')].map((x) => [x.querySelector('.hm-rt b').textContent, x.querySelector('.hm-rt em').textContent]), plus: !!d.querySelector('[data-hm-sesnew="self-serve-v2"]'), focus: document.activeElement && d.contains(document.activeElement), exp: document.querySelector('[data-hm-ses$="|i:self-serve-v2"]').getAttribute('aria-expanded') } : null; }));
100
+ ok('D2 a press lists them under the pill, waiting first, each with its quiet line', !!L && JSON.stringify(L.rows) === JSON.stringify([['Remove duplicate tasks', 'Asks you · Claude'], ['Plan the sprint tasks', 'Running · Claude'], ['Investigate stage cards not updating', 'Open · Claude']]), JSON.stringify(L));
101
+ ok('D2 + is there, the focus is in the list and the pill says it is open', !!L && L.plus && L.focus && L.exp === 'true', JSON.stringify(L));
102
+ await shot(p, 'pill-desk-open');
103
+ await p.keyboard.press('Escape');
104
+ const shut = await until(() => p.evaluate((sel) => (!document.querySelector('#hmList .hv-spp') && document.activeElement === document.querySelector(sel) ? true : null), PILL));
105
+ ok('D2 Escape closes it and gives the focus back to the pill', !!shut);
106
+
107
+ await p.click(PILL);
108
+ await until(() => p.evaluate(() => !!document.querySelector('#hmList .hv-spp')));
109
+ await p.evaluate(() => [...document.querySelectorAll('#hmList .hv-spp .hm-rm')].find((b) => /Remove duplicate tasks/.test(b.textContent)).click());
110
+ const opened = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-spp') && /Remove duplicate tasks/.test((document.querySelector('#hmChat, .hm-chat, main') || document.body).textContent) ? true : null)));
111
+ ok('D3 a press on one opens its chat and closes the list', !!opened);
112
+ await p.click(PILL);
113
+ await until(() => p.evaluate(() => !!document.querySelector('#hmList .hv-spp')));
114
+ await p.click('#hmList [data-hm-sesnew="self-serve-v2"]');
115
+ const fresh = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-spp') && /A new session in Self-serve onboarding v2/.test(document.body.textContent) ? true : null)));
116
+ ok('D3 + starts a new session in the initiative', !!fresh);
117
+ ok('D the page raised no error', A.errors.length === 0, A.errors.join(' | '));
118
+ await A.ctx.close();
119
+ }
120
+
121
+ /* D4 a phone, dark */
122
+ {
123
+ const A = await open({ w: 390, h: 844, theme: 'dark' }), p = A.page;
124
+ ok('D4 the phone draws the pill', A.up);
125
+ if (A.up) {
126
+ await p.click(PILL);
127
+ const S = await until(() => p.evaluate(() => { const d = document.querySelector('#hmList .hv-sps'); return d ? { title: d.querySelector('.hv-sbar b').textContent, n: d.querySelectorAll('.hv-r').length, pop: !!document.querySelector('#hmList .hv-spp') } : null; }));
128
+ ok('D4 the pill opens a sheet with the initiative\'s name and its 3 rows (no popover)', !!S && S.title === 'Self-serve onboarding v2' && S.n === 3 && !S.pop, JSON.stringify(S));
129
+ await shot(p, 'pill-phone-sheet');
130
+ await p.click('#hmList .hv-scrim');
131
+ const gone = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-sps') ? true : null)));
132
+ ok('D4 the scrim closes the sheet', !!gone);
133
+ ok('D4 the page raised no error', A.errors.length === 0, A.errors.join(' | '));
134
+ }
135
+ await A.ctx.close();
136
+ }
137
+ finish();
138
+ })();
@@ -3,7 +3,7 @@
3
3
  * (initiative workspace-headless-jobs; PM decision 2026-10-11: keep Jev, no direct Claude API, background
4
4
  * jobs that need no human run headless).
5
5
  *
6
- * kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | null (null: open a pane, as before)
6
+ * kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | 'propose' | null (null: open a pane, as before)
7
7
  * argsFor(kind, { modelArgs, addDirs, writePaths }) → the argv after `claude` (writePaths: the one render file a report-design job may write;
8
8
  * for the skill kind, the folders the run may write in, from skillWriteDirs)
9
9
  * skillWriteDirs(skill, { root, scratch }) → the absolute folders a background skill run may write in: its scratch folder and the state folders its skill writes
@@ -53,6 +53,10 @@
53
53
  * The `ms-review` kind is Claude's milestone review of one program (feedback batch 4 item 6): origin `ms-review:<program>:<run>`. It reads the
54
54
  * repositories of the program's initiatives and, where the PM's own settings allow it, Jira and meeting notes through connectors; its only write is
55
55
  * `pmos program suggest`, pinned by the server to that program and run. It never writes the charter and sends nothing. It never runs in a pane.
56
+ * The `propose` kind is Claude's proposals on one initiative (feedback batch 12 items 2, 3 and 4): origin `propose:<ws>:<initiative>:<run>`. On a new
57
+ * initiative it looks for it in the PM's sources; each morning it finds why tasks slipped. It reads the repository, the stored reads and, where the PM's
58
+ * own settings allow it, the PM's sources through connectors; its only write is `pmos propose`, pinned by the server to that initiative and run. Only
59
+ * the PM's ✓ writes a task, a document or a stage. It sends nothing and never runs in a pane.
56
60
  * The `report-structure` and `report-structure-dry` kinds are the report structure step (initiative report-structure): origins `report-structure:<id>` and
57
61
  * `report-structure-dry:<id>`. A turn proposes or refines the plan of a report (sources, charts, outline); a dry run tries a saved version on the last complete
58
62
  * period. Each reads the repository and, where the PM's own Claude Code settings allow it, reads through connectors (none is named in the list, as for
@@ -93,6 +97,9 @@ const REPORT_FIND_ORIGINS = Object.freeze(['report-find:']);
93
97
  const CORE_DOC_ORIGINS = Object.freeze(['core-doc:']);
94
98
  // Claude's milestone review of one program (origin `ms-review:<program>:<run>`, lib/milestone-review.js).
95
99
  const MS_REVIEW_ORIGINS = Object.freeze(['ms-review:']);
100
+ // feedback batch 12 items 2, 3 and 4: Claude looks for a new initiative in the PM's sources, and the morning task check (origin
101
+ // `propose:<ws>:<initiative>:<run>`, lib/proposal-runs.js). Its only write is `pmos propose`, pinned by the server to that initiative and run.
102
+ const PROPOSE_ORIGINS = Object.freeze(['propose:']);
96
103
  // report-design-studio: a studio turn, a cycle render or a re-render to match (origin `report-design:<cadence>`).
97
104
  const REPORT_DESIGN_ORIGINS = Object.freeze(['report-design:']);
98
105
  // report-design-studio: reading ONE linked Google or Confluence file through the PM's own connectors (origin `report-sample-fetch:<cadence>:<sampleId>`).
@@ -142,6 +149,11 @@ const TOOLS = Object.freeze({
142
149
  // The milestone review run: read and search the initiatives' repositories, and the one verb that files a suggestion. Jira and meeting notes are
143
150
  // read through the PM's own connectors only where the PM's settings allow it. No Write, no Edit, no web, nothing that sends; it never writes the charter.
144
151
  'ms-review': Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos program suggest *)']),
152
+ // The proposal run (lib/proposal-runs.js): read and search the repository and the stored reads, and the one verb that files what the ✦ proposes.
153
+ // The PM's sources are read through the PM's own connectors only where the PM's settings allow it. No Write, no Edit, no web fetch, nothing
154
+ // that sends; it never writes a task, a document or a stage (only the PM's ✓ does).
155
+ propose: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos propose *)', 'Bash(pmos initiative export *)', 'Bash(pmos initiative list *)', 'Bash(pmos task list *)',
156
+ 'Bash(pmos source show *)', 'Bash(pmos source status *)', 'Bash(git log *)', 'Bash(date *)']),
145
157
  // The design run: read and search only. Its one write, the render file, is added per run by argsFor (writePaths). No Bash, no web, nothing that sends.
146
158
  'report-design': Object.freeze(['Read', 'Glob', 'Grep']),
147
159
  // The link fetch run: Read, and its one write (the text copy of the linked file) is added per run by argsFor. No Bash, no web, no connector tool named.
@@ -178,6 +190,7 @@ function kindFor({ agent, origin, skill, env } = {}) {
178
190
  if (REPORT_FIND_ORIGINS.some((p) => o.startsWith(p))) return 'report-find';
179
191
  if (CORE_DOC_ORIGINS.some((p) => o.startsWith(p))) return 'core-doc';
180
192
  if (MS_REVIEW_ORIGINS.some((p) => o.startsWith(p))) return 'ms-review';
193
+ if (PROPOSE_ORIGINS.some((p) => o.startsWith(p))) return 'propose';
181
194
  if (REPORT_DESIGN_ORIGINS.some((p) => o.startsWith(p))) return 'report-design';
182
195
  if (REPORT_SAMPLE_FETCH_ORIGINS.some((p) => o.startsWith(p))) return 'report-sample-fetch';
183
196
  // 'report-structure-dry:' is not a prefix of 'report-structure:' (the colon differs), so the two are told apart by their prefix alone
@@ -75,6 +75,9 @@ const VERBS = Object.freeze({
75
75
  extension: Object.freeze({ module: 'extension-cli.js', run: null, guide: 'console-calendar.md',
76
76
  help: 'pmos extension — the folder of the Chrome extension for Google Meet, and the three steps to load it' }),
77
77
  // Not a pm-os-absorb verb (run: null): initiative initiative-driver added it through the same table.
78
+ // Not a pm-os-absorb verb (run: null): feedback batch 12 items 2, 3 and 4 (Claude proposes, the one ✦) added it through the same table.
79
+ propose: Object.freeze({ module: 'propose-cli.js', run: null, guide: 'claude-proposes.md',
80
+ help: 'pmos propose look|found|date|done|name|status … — what Claude\'s run files under an initiative\'s ✦ for the PM to keep or drop (pmos propose help)' }),
78
81
  driver: Object.freeze({ module: 'driver-cli.js', run: null, guide: 'initiative-driver.md',
79
82
  help: 'pmos driver propose|status|keep|return|drop|pause|resume|mode … — the Initiative Driver: drafts for you to keep, send back or drop (pmos driver help)' }),
80
83
  // Not a pm-os-absorb verb (run: null): initiative horizon-scan added it through the same table; horizon-scan-portfolio added section, propose, setting and --boards.
@@ -0,0 +1,148 @@
1
+ 'use strict';
2
+ /* proposal-runs.js — Claude's runs that file what the ✦ proposes (feedback batch 12 items 2, 3 and 4; lib/proposals.js).
3
+ *
4
+ * off(env) → true when PMOS_PROPOSE=off (or 0, false, no)
5
+ * promptOf(skill, o) → the prompt of one run. o: { run, why, ini, title, intent, stages, stage, today, tasks, dropped }
6
+ * create(deps) → { tick(opts), start({ ws, board, ini, why }), stop(run), active() }
7
+ *
8
+ * TWO MOMENTS, ONE RUN KIND (headless kind `propose`, origin `propose:<ws>:<initiative>:<run>`):
9
+ * populate an initiative was just added (devPiRules 1): with no extra press, Claude looks for it in every connected source (the name, the
10
+ * Why, the material and the people in it) and files what it finds as Found elsewhere. The New initiative panel's Create starts it
11
+ * at once (POST /api/proposals/look); the tick starts it for every other way an initiative is made (a `created` placement line).
12
+ * 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
13
+ * WHY each one slipped (the stored reads, the calendar, meeting notes, chat, Jira status) and files its dates, "looks done" and
14
+ * tidy names. A date that passes shows at once without a run: lib/proposals.js datesOf proposes from the tasks themselves, with
15
+ * "No reason found" until a run files the reason.
16
+ *
17
+ * WHAT THE RUN MAY DO (lib/headless.js kind `propose`): read and search the repository, read through the PM's own connectors where the PM's
18
+ * Claude Code settings allow it, and file with `pmos propose`, pinned by the server to this initiative and run (PMOS_PROPOSE_FILE, _WS,
19
+ * _BOARD, _INI, _RUN). It writes no task, no document and no stage: only the PM's ✓ does. Nothing is sent.
20
+ *
21
+ * At most 2 runs at once for the machine; one per initiative. A run that ends writes the `end` line; ■ Stop ends it at once.
22
+ *
23
+ * deps: { workspaces() → [w], isLead(w), stateDirFor(w), boardOf(w, id) → board id | null, created(w) → [{ initiative, at }],
24
+ * checks(w, today) → [{ ini, board, title, tasks: [line] }] (the initiatives with a late or at-risk task), rowOf(w, id) → { title, intent,
25
+ * stage, stages } | null, open(now) → bool (the day-check window), headlessOff() → bool, env, promptFor(skillId) → skill body | null,
26
+ * spawn(spec) (through the capacity governor), spawnNow(spec) (a press), stop(session), warn(what, err) }
27
+ */
28
+ const crypto = require('crypto');
29
+ const PR = require('./proposals.js');
30
+
31
+ const flagOff = (v) => /^(off|0|false|no)$/i.test(String(v || '').trim());
32
+ const off = (env) => flagOff((env || process.env).PMOS_PROPOSE);
33
+ const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
34
+ const MAX = 2;
35
+ const localDay = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
36
+ const WHY = {
37
+ 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).',
38
+ 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.',
39
+ };
40
+
41
+ function promptOf(skill, o) {
42
+ const list = (a, none) => (a && a.length ? a.map((x) => '- ' + x).join('\n') : '- ' + none);
43
+ return `${skill}\n\nThis run:\n- Run: ${o.run}\n- Why it runs: ${WHY[o.why] || WHY.check} (${o.why})\n- Today: ${o.today}\n`
44
+ + `- 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`
45
+ + `- Its workflow's stages, in order:\n${list((o.stages || []).map((s) => s.key + ' · ' + s.name), 'not known')}\n`
46
+ + (o.why === 'check' ? `- Its late and at-risk tasks:\n${list(o.tasks, 'none')}\n` : `- The material the PM gave and the people named are in its record and its first questions (\`pmos initiative export ${o.ini}\`).\n`)
47
+ + `- Dropped by the PM (do not file these again unless the evidence is new):\n${list(o.dropped, 'none')}\n\n`
48
+ + 'File with `pmos propose` only (the server pins this initiative and run). Report each source as you read it with `pmos propose look`. Send nothing.';
49
+ }
50
+
51
+ function create(deps) {
52
+ const active = new Map(); // run → { ws, ini, dir, session, why }
53
+ const warn = deps.warn || (() => {});
54
+ const lastScan = new Map(); // ws → ms of the last morning-check scan
55
+
56
+ function ended(run, r, now = Date.now()) {
57
+ const a = active.get(run); if (!a) return;
58
+ active.delete(run);
59
+ const F = PR.read(a.dir), L = F.looks.get(a.ini);
60
+ if (L && L.run === run && L.ended) return; // ■ Stop wrote it already
61
+ const res = (r && r.result) || {};
62
+ const ok = !!(r && !r.timedOut && !r.stopped && r.code === 0 && res.ok !== false && !res.isError);
63
+ // every source still Reading… ends: it read what it could
64
+ if (L && L.run === run) for (const [k, s] of L.sources) if (s.state === 'reading') try { PR.append(a.dir, null, { kind: 'src', ini: a.ini, run, source: k, state: 'done', n: s.n, what: s.what }); } catch { /* best effort */ }
65
+ try { PR.append(a.dir, null, { kind: 'end', ini: a.ini, run, ok, ...(ok ? {} : { error: one((r && r.note) || res.text || 'the run failed', 200) }) }); } catch (e) { warn('proposal run end', e); }
66
+ }
67
+
68
+ /** Start one run now. → { ok, run } | { ok: false, error } */
69
+ function start({ ws, board, ini, why = 'populate', press = true, now = Date.now() } = {}) {
70
+ if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: 'Claude\'s background runs are off (PMOS_PROPOSE or PMOS_HEADLESS)' };
71
+ const w = (deps.workspaces() || []).find((x) => x.id === ws);
72
+ if (!w) return { ok: false, error: 'no such workspace' };
73
+ const dir = deps.stateDirFor(w);
74
+ if (!dir) return { ok: false, error: 'no PMOS state folder' };
75
+ for (const a of active.values()) if (a.ws === ws && a.ini === ini) return { ok: true, run: [...active.entries()].find(([, x]) => x === a)[0], already: true };
76
+ const skill = deps.promptFor('initiative-propose');
77
+ if (!skill) return { ok: false, error: 'the initiative-propose skill is not installed' };
78
+ const run = 'pr' + now.toString(36) + crypto.randomBytes(3).toString('hex');
79
+ const row = (deps.rowOf && deps.rowOf(w, ini)) || {};
80
+ const F = PR.read(dir);
81
+ const dropped = [...F.props.values()].filter((p) => p.ini === ini && F.drops.has(PR.sigOf(p))).slice(0, 20).map((p) => p.group + ' · ' + (p.title || p.type) + ' · ' + one(p.why, 100));
82
+ let tasks = [];
83
+ if (why === 'check') { try { const c = (deps.checks(w, localDay(now)) || []).find((x) => x.ini === ini); tasks = c ? c.tasks : []; } catch { tasks = []; } }
84
+ const prompt = promptOf(skill, { run, why, ini, title: row.title || ini, intent: row.intent || '', stage: row.stage || '', stages: row.stages || [], today: localDay(now), tasks, dropped });
85
+ const go = press && deps.spawnNow ? deps.spawnNow : deps.spawn;
86
+ active.set(run, { ws, ini, dir, session: null, why });
87
+ let session = null;
88
+ try {
89
+ session = go({ name: (why === 'check' ? 'Task check · ' : 'Looking for · ') + one(row.title || ini, 60), ws, origin: `propose:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
90
+ env: { PMOS_PROPOSE_FILE: PR.ledgerFile(dir), PMOS_PROPOSE_WS: ws, PMOS_PROPOSE_BOARD: board || '', PMOS_PROPOSE_INI: ini, PMOS_PROPOSE_RUN: run }, onDone: (r) => ended(run, r) });
91
+ } catch (e) { warn('proposal run', e); }
92
+ if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'Claude is busy with other runs; it looks again in a minute' }; }
93
+ // the look line lands before the run's first `pmos propose look` (the run starts reading after this returns)
94
+ // stamped with the tick's clock, so "once a day" compares the same clock the tick reads (a test or a tick near midnight)
95
+ PR.append(dir, null, { kind: 'look', ini, board: board || (deps.boardOf && deps.boardOf(w, ini)) || '', run, why, at: new Date(now).toISOString() });
96
+ if (!session || session.state === 'exited' || session.headless !== 'propose') {
97
+ if (session && session.headless !== 'propose' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
98
+ ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background', result: {} }, now);
99
+ return { ok: false, error: (session && session.note) || 'Claude could not start looking' };
100
+ }
101
+ const a = active.get(run); if (a) a.session = session;
102
+ return { ok: true, run };
103
+ }
104
+
105
+ function stop(run) { const a = active.get(run); if (a && a.session && deps.stop) deps.stop(a.session); }
106
+
107
+ function tick({ now = Date.now(), env } = {}) {
108
+ if (off(env || deps.env) || (deps.headlessOff && deps.headlessOff())) return { off: true };
109
+ if (active.size >= MAX) return { running: active.size };
110
+ let open = true;
111
+ try { open = deps.open ? !!deps.open(now) : true; } catch { open = true; }
112
+ for (const w of deps.workspaces() || []) {
113
+ if (deps.isLead && !deps.isLead(w)) continue;
114
+ const dir = deps.stateDirFor(w); if (!dir) continue;
115
+ const F = PR.read(dir);
116
+ // the first scan writes the epoch: only initiatives made after it are looked for (an old one is history)
117
+ const epoch = F.epoch;
118
+ if (!epoch) { PR.append(dir, null, { kind: 'epoch' }); continue; }
119
+ let created = [];
120
+ try { created = deps.created(w) || []; } catch { created = []; }
121
+ for (const c of created) {
122
+ if (!c || !c.initiative || String(c.at || '') < epoch || F.looks.has(c.initiative)) continue;
123
+ const r = start({ ws: w.id, ini: c.initiative, why: 'populate', press: false, now });
124
+ if (r.ok) return { started: c.initiative, why: 'populate' };
125
+ if (r.held) return { held: true }; // the governor said wait: the next tick tries again
126
+ }
127
+ // the morning check, once a day per initiative, inside the day-check window; the scan itself at most once an hour
128
+ if (!open || now - (lastScan.get(w.id) || 0) < 3600e3) continue;
129
+ lastScan.set(w.id, now);
130
+ const day = localDay(now);
131
+ let due = [];
132
+ try { due = deps.checks(w, day) || []; } catch (e) { warn('proposal check scan', e); }
133
+ for (const c of due) {
134
+ const L = F.looks.get(c.ini);
135
+ if (L && L.why === 'check' && localDay(Date.parse(L.at) || 0) === day) continue;
136
+ if (L && !L.ended) continue;
137
+ const r = start({ ws: w.id, board: c.board, ini: c.ini, why: 'check', press: false, now });
138
+ if (r.ok) return { started: c.ini, why: 'check' };
139
+ if (r.held) { lastScan.delete(w.id); return { held: true }; }
140
+ }
141
+ }
142
+ return { started: null };
143
+ }
144
+
145
+ return { tick, start, stop, active: () => [...active.keys()] };
146
+ }
147
+
148
+ module.exports = { off, promptOf, create, WHY, MAX };