create-pmos 0.411.0 → 0.412.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 (63) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +1 -1
  7. package/workspace/briefing-premium-insights-test.js +2 -2
  8. package/workspace/briefing-premium-test.js +3 -3
  9. package/workspace/changelog.json +12 -0
  10. package/workspace/guide/board.md +1 -1
  11. package/workspace/guide/breakdown.md +6 -13
  12. package/workspace/guide/index.md +1 -1
  13. package/workspace/guide/initiative-driver.md +1 -1
  14. package/workspace/guide/initiatives-screen.md +1 -1
  15. package/workspace/guide/pm-only-acts.md +23 -24
  16. package/workspace/guide/today.md +1 -1
  17. package/workspace/lib/briefing-premium-writes.js +5 -4
  18. package/workspace/lib/coredoc-cli.js +1 -1
  19. package/workspace/lib/driver-cli.js +2 -1
  20. package/workspace/lib/driver-decide.js +3 -2
  21. package/workspace/lib/driver.js +2 -1
  22. package/workspace/lib/grant-mint.js +3 -2
  23. package/workspace/lib/initiative-cli.js +9 -9
  24. package/workspace/lib/issues.js +5 -4
  25. package/workspace/lib/people-store.js +1 -1
  26. package/workspace/lib/people.js +3 -1
  27. package/workspace/lib/placements.js +13 -15
  28. package/workspace/lib/plan-items.js +17 -48
  29. package/workspace/lib/pm-guard.js +18 -5
  30. package/workspace/lib/pm-lines-needs.js +9 -5
  31. package/workspace/lib/report-cli.js +2 -2
  32. package/workspace/lib/routes-board-metric-targets.js +0 -1
  33. package/workspace/lib/routes-briefing-premium.js +3 -5
  34. package/workspace/lib/routes-core-docs.js +0 -1
  35. package/workspace/lib/routes-custom-docs.js +0 -1
  36. package/workspace/lib/routes-driver.js +0 -1
  37. package/workspace/lib/routes-home-desk.js +1 -1
  38. package/workspace/lib/routes-home-review.js +1 -1
  39. package/workspace/lib/routes-initiative-layout.js +1 -1
  40. package/workspace/lib/routes-insights-records.js +0 -1
  41. package/workspace/lib/routes-meeting-material.js +0 -1
  42. package/workspace/lib/routes-onboarding.js +3 -1
  43. package/workspace/lib/routes-orchestrator.js +0 -1
  44. package/workspace/lib/routes-premium-charts.js +0 -1
  45. package/workspace/lib/routes-premium-dashboards.js +0 -1
  46. package/workspace/lib/routes-programs.js +1 -1
  47. package/workspace/lib/routes-records.js +1 -1
  48. package/workspace/lib/routes-report-design.js +7 -3
  49. package/workspace/lib/routes-report-setups.js +0 -1
  50. package/workspace/lib/routes-report-structure.js +0 -1
  51. package/workspace/lib/routes-runs.js +2 -5
  52. package/workspace/lib/routes-scan.js +0 -1
  53. package/workspace/lib/routes-sources.js +1 -1
  54. package/workspace/lib/run-answers.js +14 -5
  55. package/workspace/lib/scan-cli.js +2 -1
  56. package/workspace/lib/scan.js +2 -1
  57. package/workspace/lib/vendor/scripts/onboarding/proposals.js +7 -3
  58. package/workspace/package-lock.json +2 -2
  59. package/workspace/package.json +1 -1
  60. package/workspace/premium-core-doc-issue-test.js +1 -1
  61. package/workspace/premium-viewer-share-test.js +5 -2
  62. package/workspace/replaced-tests.json +101 -0
  63. package/workspace/server.js +8 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.411.0",
3
+ "version": "0.412.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.412.0",
37
+ "at": "2026-10-25T06:20:40.812Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 1041,
42
+ "t": "Agents finish the work they were asked to do (D98)",
43
+ "s": "Agents finish the work they were asked to do"
44
+ }
45
+ ]
46
+ },
35
47
  {
36
48
  "v": "0.411.0",
37
49
  "at": "2026-10-25T04:42:12.945Z",
@@ -264,18 +276,6 @@
264
276
  "s": "Show Claude's questions in the chat as a card, not a picker the panel cannot show"
265
277
  }
266
278
  ]
267
- },
268
- {
269
- "v": "0.392.0",
270
- "at": "2026-10-22T04:00:27.581Z",
271
- "f": 2,
272
- "prs": [
273
- {
274
- "n": 1006,
275
- "t": "Files Claude wrote in a git worktree open in the chat viewer",
276
- "s": "Files Claude wrote in a git worktree open in the chat viewer"
277
- }
278
- ]
279
279
  }
280
280
  ]
281
281
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@e87cb4f8
1
+ kernel-source: pmos@ab4f6312
2
2
  assembled: 2026-10-25
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-25T04:42:10Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-25T06:20:38Z"}
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-25T04:42:10Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-25T06:20:38Z"}
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-25T04:42:10Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-25T06:20:38Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -176,7 +176,7 @@ const PAGES = {
176
176
  const noNonce = await send({ scope: 'board:nope', title: 'A' }, { 'Content-Type': 'application/json' });
177
177
  ok('A3 a request without the page headers is refused with 403', noNonce.status === 403, JSON.stringify(noNonce));
178
178
  const agent = await send({ scope: 'board:nope', title: 'A' }, Object.assign({}, H, { 'x-pmos-session': 'abc' }));
179
- ok('A3 an agent session is refused with 403', agent.status === 403, JSON.stringify(agent));
179
+ ok('A3 D98: an agent session is not refused as an agent: its press is checked like the PM\'s (an unknown board is 404)', agent.status === 404, JSON.stringify(agent));
180
180
  const empty = await send({ scope: 'board:nope', title: ' ' }, H);
181
181
  ok('A4 an empty title is refused with 400 and a reason', empty.status === 400 && /title/.test(empty.body.error), JSON.stringify(empty));
182
182
  const orphan = await send({ scope: 'board:no-such-board-xyz', title: 'A' }, H);
@@ -487,7 +487,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
487
487
  const asAgent = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: { ...H, 'x-pmos-session': 's1' }, body }).then((x) => x.status);
488
488
  const noNonce = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: { 'Content-Type': 'application/json', Origin: base2 }, body }).then((x) => x.status);
489
489
  const unknown = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: H, body: JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'Other', purpose: 'x', charts: ['krm-none'] }) }).then((x) => x.status);
490
- ok('E9 the real save route refuses an agent session (403), a press without the nonce (403) and a chart no record holds (400)', asAgent === 403 && noNonce === 403 && unknown === 400, [asAgent, noNonce, unknown].join());
490
+ ok('E9 the real save route refuses a press without the nonce (403) and a chart no record holds (400); an agent session saves (D98)', asAgent === 200 && noNonce === 403 && unknown === 400, [asAgent, noNonce, unknown].join());
491
491
  /* New goal against the real route: the record lands in the scratch repository with every field the page sent */
492
492
  await pg.click('#newB'); await pg.click('#newMenu [data-new="goal"]'); await pg.fill('#ngName', 'Weekly partners'); await pg.fill('#ngBase', '5'); await pg.fill('#ngTgt', '9');
493
493
  await pg.click('#sideBody [data-seg="Type"] [data-v="Count"]'); await pg.fill('#ngOwner', 'Lee'); await pg.click('#sideBody [data-src="file"]'); await pg.click('#sideGo');
@@ -508,7 +508,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
508
508
  const tg = await post('target', { key: 'scope', target: 3 });
509
509
  const asAgent2 = await post('verdict', { ini: 'x', verdict: 'Keep', learned: 'y' }, { ...H, 'x-pmos-session': 's1' });
510
510
  const j3 = await (await fetch(base2 + '/api/insights-premium')).json(), m3 = j3.model;
511
- ok('E12 describe reads the goals and writes nothing; the dashboard, its chart settings, the pin, a verdict and a tile target land in the ledger and come back in the model', dsc.status === 200 && dsc.body.goals.join() === 'krm-a' && dsh.status === 200 && dsh.body.pinned === dsh.body.id && chs.status === 200 && vd.status === 200 && tg.status === 200 && asAgent2.status === 403
511
+ ok('E12 describe reads the goals and writes nothing; the dashboard, its chart settings, the pin, a verdict and a tile target land in the ledger and come back in the model', dsc.status === 200 && dsc.body.goals.join() === 'krm-a' && dsh.status === 200 && dsh.body.pinned === dsh.body.id && chs.status === 200 && vd.status === 200 && tg.status === 200 && asAgent2.status === 200
512
512
  && m3.pinned === dsh.body.id && m3.chartSet[dsh.body.id]['krm-a'].form === 'Number' && m3.chartSet[dsh.body.id]['krm-a'].note === 'After the kit' && m3.trends.targets.scope === 3, JSON.stringify([dsc.body, dsh.status, chs.body, vd.status, tg.body, asAgent2.status, m3.chartSet]));
513
513
  const csv = await fetch(base2 + '/api/insights-records/export?ws=' + m.board.ws).then(async (x) => ({ status: x.status, type: x.headers.get('content-type'), text: await x.text() }));
514
514
  ok('E13 Export answers the goals as CSV, one row each', csv.status === 200 && /^text\/csv/.test(csv.type) && /^id,goal,objective,type/.test(csv.text) && /krm-a,Partner activation,Growth,Percentage/.test(csv.text) && /Weekly partners/.test(csv.text), csv.text.slice(0, 200));
@@ -195,7 +195,7 @@ const vw = () => { const v = document.querySelector('#czViewer:not([hidden])');
195
195
  const nonce = await T.nonce(BASE);
196
196
  ok('W5 a press without the launch nonce is refused', !nonce || noN.s === 403, JSON.stringify(noN));
197
197
  const ag = await send({ ...hdr, 'x-pmos-session': 'sess-1' }, good);
198
- ok('W5 an agent session is refused with 403', ag.s === 403, JSON.stringify(ag));
198
+ ok('W5 D98: an agent session is not refused as an agent: its press is checked like the PM\'s (an unknown prototype is 404)', ag.s === 404, JSON.stringify(ag));
199
199
  const wf = await send(hdr, { ...good, by: 'pm' });
200
200
  ok('W5 a body with a writer field is refused with 400', wf.s === 400, JSON.stringify(wf));
201
201
  const before = fs.readFileSync(path.join(__dirname, '..', 'pm-decisions.md'), 'utf8');
@@ -204,10 +204,10 @@ const vw = () => { const v = document.querySelector('#czViewer:not([hidden])');
204
204
  const after = fs.readFileSync(path.join(__dirname, '..', 'pm-decisions.md'), 'utf8');
205
205
  ok('W6 a bad key and an unknown prototype are refused and pm-decisions.md is unchanged', bad.s === 400 && none.s === 404 && before === after, JSON.stringify([bad, none]));
206
206
  const askBad = await send(hdr, { key: '../x', text: 'q' }, 'ask');
207
- const askAgent = await send({ ...hdr, 'x-pmos-session': 'sess-1' }, { key: 'decision:KC5', text: 'q' }, 'ask');
207
+ const askAgent = await send({ ...hdr, 'x-pmos-session': 'sess-1' }, { key: '../x', text: 'q' }, 'ask');
208
208
  const askNoNonce = await send({ 'Content-Type': 'application/json', Origin: BASE }, { key: 'decision:KC5', text: 'q' }, 'ask');
209
209
  const askWriter = await send(hdr, { key: 'decision:KC5', text: 'q', by: 'pm' }, 'ask');
210
- ok('A7 the ask route refuses an agent session (403), a missing nonce (403), a writer field (400) and a bad key (400), and starts nothing', askAgent.s === 403 && (!nonce || askNoNonce.s === 403) && askWriter.s === 400 && askBad.s === 400, JSON.stringify([askAgent, askNoNonce, askWriter, askBad]));
210
+ ok('A7 the ask route refuses a missing nonce (403), a writer field (400) and a bad key (400), for an agent session too (D98: checked, not refused as an agent), and starts nothing', askAgent.s === 400 && (!nonce || askNoNonce.s === 403) && askWriter.s === 400 && askBad.s === 400, JSON.stringify([askAgent, askNoNonce, askWriter, askBad]));
211
211
  const thr = await fetch(BASE + '/api/briefing-premium/thread?key=../x').then((r) => r.status);
212
212
  const thrGet = await fetch(BASE + '/api/briefing-premium/ask').then((r) => r.status);
213
213
  ok('A7 the thread route refuses a bad key and the ask route refuses GET', thr === 400 && thrGet === 405, JSON.stringify([thr, thrGet]));
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "v": "0.412.0",
4
+ "at": "2026-10-25T06:20:40.812Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 1041,
9
+ "t": "Agents finish the work they were asked to do (D98)",
10
+ "s": "Agents finish the work they were asked to do"
11
+ }
12
+ ]
13
+ },
2
14
  {
3
15
  "v": "0.411.0",
4
16
  "at": "2026-10-25T04:42:12.945Z",
@@ -65,7 +65,7 @@ Today shows three things from the Board:
65
65
  | no evidence | an agent marked the item Done and gave no evidence |
66
66
  | late | the due date passed and the item is not Done |
67
67
  | moved by you | you moved a card that an agent owns |
68
- | Proposed | an agent proposed the item and you did not keep it |
68
+ | Proposed | an item an agent added before D98 that was never kept (since D98 an agent's item is live at once) |
69
69
 
70
70
  ## From a terminal
71
71
 
@@ -38,7 +38,7 @@ The Tree shows the stages of the initiative in order, for example Intake, Spec,
38
38
  | late | The due date is in the past and the item is not Done. |
39
39
  | Doing, Review | The state of the item, in the Tree only. On the Board, the column shows the state. |
40
40
  | moved by you | You moved an item that an agent owns. The agent sees the same signal. |
41
- | Proposed | An agent added the item and you did not keep it yet. A proposed item does not count in the progress. |
41
+ | Proposed | Only on an item an agent added before D98 that was never kept. Since D98 an agent's item is live at once. |
42
42
 
43
43
  ### Keys in the Tree
44
44
 
@@ -72,7 +72,7 @@ If you move an item that an agent owns, the item shows "moved by you". The agent
72
72
  The sheet shows every field of one item, from top to bottom:
73
73
 
74
74
  1. The state: Todo, Doing, Review or Done. Under it, two lines show only when they apply:
75
- - "Proposed by agent · sess-3 on 5 Oct." with **Keep all**, for an item that an agent proposed. Keep all keeps every item of that agent's card.
75
+ - "Added by agent · sess-3 on 5 Oct." for an item that an agent added. It is live; withdraw it if you do not want it.
76
76
  - **Add evidence**, for an item that reads Done with no evidence. Type `commit:<sha>`, `pr:<number>`, `file:<path>` or `note:<text>` and press Enter. If the workspace refuses the reference, a message tells you why and your text stays in the field to correct.
77
77
  2. Title.
78
78
  3. Owner: You, Agent, a person (type the name) or a tracker (type the reference).
@@ -93,18 +93,11 @@ Done and Withdraw wait 8 seconds before they are saved. A message shows at the b
93
93
 
94
94
  A tick back from Done to Todo is saved at once.
95
95
 
96
- ## Items an agent proposes
96
+ ## Items an agent adds
97
97
 
98
- An agent can add items with `pmos item add`. Its items arrive as proposed. They show in the Tree and on the Board, but they do not count in the progress until you keep them.
98
+ An agent can add items with `pmos item add`. Since D98 its items are live at once: they show in the Tree and on the Board and count in the progress, with no Keep card. Each item names the agent that added it, so you can withdraw it if you do not want it. A Keep line from before D98 has no effect any more and is not flagged.
99
99
 
100
- The Tree shows one card for each agent session, named by the session: "Agent · sess-3 proposed 9 items on 5 Oct." Today shows the same card in its needs-you list, and the Today count in the navigation counts it.
101
-
102
- - **Keep** keeps all the items of the card. Only you can keep items, and only from the workspace page. There is no command for it.
103
- - **Withdraw all** withdraws all the items of the card, with Undo.
104
-
105
- If the agent adds more items after the card shows, they stay proposed. The card shows the new count when it refreshes.
106
-
107
- Today also shows two other breakdown cards:
100
+ Today shows two breakdown cards:
108
101
 
109
102
  - **no evidence**: an agent marked an item Done without evidence, such as a commit or a pull request. Open the item and add the evidence, or ask the agent to run its move again with `--evidence`.
110
103
  - **check**: a line in `plan-items.jsonl` that has no effect, for example a Keep that the workspace page did not write.
@@ -133,7 +126,7 @@ Each line in the file names who wrote it. The workspace shows it as:
133
126
 
134
127
  The file records an agent with its full session token, for example `agent:sess-3.0a1b2c3d`. The workspace page gets only `agent:sess-3` and shows "agent · sess-3".
135
128
 
136
- An agent cannot keep its own items. An agent can withdraw only the items that it added; the items you added, only you can withdraw.
129
+ An agent can change, move and withdraw any item, the items you added included. Each of those lines names the agent, so the history of the item shows who did what.
137
130
 
138
131
  A terminal that the workspace starts for an agent is marked as that agent's, so its commands are recorded as the agent even when they run at a terminal. Your own shell terminals are not marked, so their commands are recorded as you.
139
132
 
@@ -67,7 +67,7 @@ On a desktop the workspace is one frame. [Layout](layout.md) explains each part.
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
68
  - [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
69
  - [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
- - [PM-only acts: what only you can do](pm-only-acts.md): which acts are yours, how the workspace checks that a press comes from your page or your terminal, and what to do when one is refused.
70
+ - [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.
71
71
  - [PM-only lines: how the workspace checks your acts](pm-only-lines.md): how each act is recorded, what the Today card "A PM-only line is not attested" means, and the grants for a bulk lifecycle change and a Release.
72
72
  - [Breakdown › Timeline](timeline.md): an initiative's items on a time axis, split by stage, with milestones, today, and the at-risk flag when an item starts before its predecessor ends.
73
73
  - [Initiatives › Timeline](initiatives-timeline.md): when each initiative runs, one row per initiative, and how to reorder rows by their grip.
@@ -66,7 +66,7 @@ Open proposals appear in Needs you as one row for each initiative or task: "Agen
66
66
  - **Send back** needs a note. The note starts a new run. It counts as a correction.
67
67
  - **Drop** closes the proposal. It counts as a correction.
68
68
 
69
- The agent cannot keep, send back, drop, pause or change the mode. Those acts need your page or your terminal.
69
+ An agent session can keep, send back, drop, pause or change the mode too, with no typed confirmation (D98). Each line names the agent, so you see who decided.
70
70
 
71
71
  ## Board modes
72
72
 
@@ -75,7 +75,7 @@ Only you can move an initiative into Now. The workspace writes the line as yours
75
75
  ### Unconfirmed, proposed and dormant
76
76
 
77
77
  - **unconfirmed.** An initiative that reads Now only because it is active, with no line from you. Confirm it in the Cycle review.
78
- - **proposed.** An agent proposed a move. It changes nothing until you keep it in the Cycle review.
78
+ - **proposed.** A move an agent proposed before D98. It changes nothing until you or an agent keep it in the Cycle review. Since D98 an agent's move applies at once and names the agent.
79
79
  - **Dormant.** An initiative with no activity for a long time. Press the dormant line under Later to show them.
80
80
  - **No record yet.** A PRD, rubric or prototype folder that no initiative record points at. Press the "with no record" line under Later to show them. In List they are the last group. Press one to open its PRD. Only a record can be placed, so these have no menu.
81
81
 
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  type: Guide
3
- title: "PM-only acts: what only you can do"
4
- description: "Which acts only the PM can do, how the workspace checks that a press comes from your page or your terminal, what to do when a press is refused, and what an agent can and cannot write."
5
- timestamp: 2026-10-05
3
+ title: "PM-only acts: what you and your agents can do"
4
+ description: "The acts that were only the PM's, how the workspace checks that a press comes from your page, your terminal or an agent session, what to do when a press is refused, and how every agent act is logged under the agent's name (D98)."
5
+ timestamp: 2026-10-24
6
6
  ---
7
7
 
8
- # PM-only acts: what only you can do
8
+ # PM-only acts: what you and your agents can do
9
9
 
10
- Some acts decide what the work is and when it is done. Only you, the PM, can do them. An agent cannot do them, even when you ask it to in a chat.
10
+ Some acts decide what the work is and when it is done. Since [D98](/okf/products/pmos/adr/d98-agents-finish-asked-work.md), an agent that you asked to do a piece of work does these acts too, so it can finish the work without stopping to ask you. It does not ask you to type anything. Every line it writes names the agent (`by: agent:sess-…`, or `agent:unknown`), so you see who acted, and you can move it back, withdraw it or return the run.
11
11
 
12
12
  ## The acts
13
13
 
@@ -18,14 +18,15 @@ Some acts decide what the work is and when it is done. Only you, the PM, can do
18
18
  | Approve a contract | Not on the page yet. In your own terminal, run `node scripts/log-run.js` with `PM_approved: true` in the contract. |
19
19
  | Record a D60 disposition of a prototype | Not on the page yet. A later run adds it. |
20
20
  | Hold, close, cancel or reopen an initiative | The initiative's lifecycle menu |
21
- | Keep the items an agent proposed | The Keep card in the Breakdown or on Today |
22
- | Move an initiative to Now, or adopt an agent's proposal to move it | Initiatives (arrives with the Initiatives screen) |
21
+ | Move an initiative to Now, or adopt an open proposal to move it | Initiatives (arrives with the Initiatives screen) |
23
22
  | Change the anchor (`parent_kr`) of an initiative | The document editor, or the confirm step of Add a repository |
24
23
  | Bind a session to an initiative | The session's initiative menu, or + session on an initiative |
25
24
  | Issue a report | Reports (arrives in Run 5) |
26
25
  | Release a batch of factory work | The Board (arrives in Run 4) |
27
26
 
28
- Each line that the workspace server writes for one of these acts says who wrote it (`by: pm:wawan`) and how (`via: ui` from the page, `via: cli` from a terminal).
27
+ Each line that the workspace server writes for one of these acts says who wrote it (`by: pm:wawan`, or the agent's `by`) and how (`via: ui` from the page, `via: cli` from a terminal).
28
+
29
+ An agent's items in the Breakdown are live as soon as it adds them, so there is no Keep card any more.
29
30
 
30
31
  ## How the workspace checks a press
31
32
 
@@ -35,6 +36,9 @@ Each press from the page sends three things: the page's own address (the Origin)
35
36
 
36
37
  - the request has no Origin, or the Origin is a different site or a different port;
37
38
  - the launch value is missing or wrong.
39
+
40
+ A press that carries an agent session's `x-pmos-session` value passes these checks like yours, and its line names that agent, never you.
41
+
38
42
  The server also refuses a request that sets a field that only the server sets, for example `by`, `via`, `at` or `grant`.
39
43
 
40
44
  A press that is refused writes nothing.
@@ -49,14 +53,9 @@ If a press shows "the workspace restarted, so reload the page, then try again",
49
53
 
50
54
  ## Acts from a terminal
51
55
 
52
- A command that does a PM-only act asks you to type a word first, usually the initiative id. Type the id exactly, then press Enter. If the text does not match, the command writes nothing.
53
-
54
- The command refuses the act when:
55
-
56
- - it runs inside an agent session (the session has a `PMOS_SESSION` value);
57
- - it does not run in an interactive terminal, for example in a pipe or a script.
56
+ A command that does one of these acts asks you, at your own terminal, to type a word first, usually the initiative id. Type the id exactly, then press Enter. If the text does not match, the command writes nothing.
58
57
 
59
- Any other command that runs without a terminal is recorded as `agent:unknown`, not as you.
58
+ Inside an agent session (the session has a `PMOS_SESSION` value) the command does the act without asking, and records the session as `by`. A command that runs without a terminal, for example in a pipe or a script, is recorded as `agent:unknown`, not as you.
60
59
 
61
60
  ## Change many initiatives at once
62
61
 
@@ -66,18 +65,17 @@ You cannot move initiatives to Now or change an anchor in one press for many ini
66
65
 
67
66
  ## What an agent can write
68
67
 
69
- An agent can:
68
+ An agent can do every act in the table above, and it can:
70
69
 
71
- - add items, and order, date, start and finish the items of its session (with evidence);
72
- - move an item that you handed to that session with Hand to agent. It cannot move any other item that you own;
70
+ - add items, which are live at once, and change, move, block and withdraw any item, yours included;
73
71
  - create an initiative (it lands in Later), write report text, and record a measurement with a source;
74
- - propose a change for you to keep or drop.
72
+ - place an initiative in Now, Next or Later; the placement applies at once.
75
73
 
76
- An agent cannot:
74
+ Every line it writes names the agent. Some things stay yours:
77
75
 
78
- - do any act in the table above;
79
- - change the title, stage, dates or owner of an item that you own (owner "you"), or mark it blocked. It asks you instead;
80
- - withdraw an item that it did not add.
76
+ - An agent's acceptance is not marked as yours and carries no `pm_label`; that label is your calibration answer.
77
+ - A run does not answer its own permission request.
78
+ - Merging and publishing follow their own rules (D93, D94), and the factory's propose-only rule (D65) is unchanged.
81
79
 
82
80
  ## What this does not prevent
83
81
 
@@ -86,4 +84,5 @@ A program that runs as your own user can read the page, as your browser does, an
86
84
  Some paths are still open:
87
85
 
88
86
  - A program can connect to the terminal socket without the launch value. It cannot bind a session to an initiative, but it can start a session and type into any terminal, including your own shell. A `pmos` command that it types in your shell runs as you.
89
- - An agent's `pmos item` commands are not yet checked against the initiative that its session is bound to, and a session value that names no session is not refused. The repository's checks find the other lines later, when they reach a pull request. See [Breakdown](breakdown.md) for the items and the Keep card.
87
+ - An agent's `pmos item` commands are not yet checked against the initiative that its session is bound to, and a session value that names no session is recorded as `agent:unknown`.
88
+ - An undo is not automatic. You undo an agent's act with an ordinary act of your own: move the item back, withdraw it, or return the run. See [Breakdown](breakdown.md) for the items and the Keep card.
@@ -155,7 +155,7 @@ Today puts the cards in this order. Within a kind, the cards keep a fixed order,
155
155
  | 2. A session is waiting | A session in a terminal asked you a question and waits for the answer. | Open |
156
156
  | 3. A step you returned | You returned an acceptance and the initiative has not been accepted since. | Open |
157
157
  | 4. Work to check | An item is in Review, or an item is Done with no evidence. | Open |
158
- | 5. Keep an agent breakdown | An agent proposed items. They count in no progress until you keep them. | Keep |
158
+ | 5. Keep an agent breakdown | Retired by D98: an agent's items are live at once, so this card no longer shows. | — |
159
159
  | 6. A triaged capture | A capture was triaged and waits for you to add it or dismiss it. | Open |
160
160
  | 7. Cycle review | The cycle review is due. You confirm what is in Now, or move it. | Open |
161
161
  | 8. Needs repair | A schedule left no output, a line from the PM has no attestation, or a record has no anchor. Today shows the card until it is fixed. | Open |
@@ -60,7 +60,8 @@ function tripwireDecided(root, id, date) {
60
60
  return t.split(/^## /m).slice(1).some((b) => /^\d{4}-\d{2}-\d{2}/.test(b) && b.slice(0, 10) >= date && new RegExp('\\b' + id + '\\b').test(b));
61
61
  }
62
62
 
63
- function decide({ root, key, choice, why, now }) {
63
+ /** `by` is the agent's page name when an agent session decides (D98); absent, the PM did. */
64
+ function decide({ root, key, choice, why, now, by }) {
64
65
  now = now || Date.now();
65
66
  const m = /^decision:([A-Za-z0-9._-]+)$/.exec(String(key || ''));
66
67
  if (!m || !ID_RE.test(m[1])) return refuse(400, 'key must name a decision row');
@@ -86,7 +87,7 @@ function decide({ root, key, choice, why, now }) {
86
87
  const block = [
87
88
  '## ' + heading,
88
89
  '- context: ' + (isTrip ? 'tripwire ' + id + ' passed its date with no decision on record; recorded from the premium Briefing' : 'prototype ' + id + ' waited for a disposition (D60); recorded from the premium Briefing'),
89
- '- decision: ' + (isTrip ? id + ' ' + choice : choice) + ' (chosen by the PM)',
90
+ '- decision: ' + (isTrip ? id + ' ' + choice : choice) + ' (chosen by ' + (by ? by : 'the PM') + ')',
90
91
  '- rationale: ' + reason,
91
92
  '- supersedes: none',
92
93
  '',
@@ -104,13 +105,13 @@ function untilMs(until, now) {
104
105
  const add = ((8 - d.getDay()) % 7) || 7; // the next Monday
105
106
  d.setDate(d.getDate() + add); d.setHours(9, 0, 0, 0); return d.getTime();
106
107
  }
107
- function putOff({ runtimeDir, key, until, now }) {
108
+ function putOff({ runtimeDir, key, until, now, by }) {
108
109
  now = now || Date.now();
109
110
  if (!runtimeDir) return refuse(409, 'this workspace has no state folder to keep the answer in');
110
111
  if (!KEY_RE.test(String(key || ''))) return refuse(400, 'key must name a row');
111
112
  if (!UNTIL.includes(until)) return refuse(400, 'choose one of: ' + UNTIL.join(', '));
112
113
  const at = untilMs(until, now);
113
- appendLine(path.join(runtimeDir, DEFERRED), { key, until: at, choice: until, at: iso(now), by: 'pm' });
114
+ appendLine(path.join(runtimeDir, DEFERRED), { key, until: at, choice: until, at: iso(now), by: by || 'pm' });
114
115
  return { ok: true, until: at };
115
116
  }
116
117
  /** key → the time (ms) the row returns, for lines still in the future. The latest line for a key wins. */
@@ -77,7 +77,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
77
77
  const pinned = pinKey ? [pinKey] : pinKeys;
78
78
  if ((pinScope && pinScope !== flags.scope) || (pinned && !pinned.includes(flags.key))) return fail(`this run drafts ${(pinned || [flags.key]).join(', ')} for ${pinScope || flags.scope} only`);
79
79
  const actor = actorLib.fromCli({ isTTY: isTTY === undefined ? !!(process.stdin.isTTY && process.stdout.isTTY) : isTTY, env: e });
80
- if (c.entry.by === 'you' && actorLib.isAgent(actor)) return fail(`the PM writes the ${c.entry.title.toLowerCase()}; an agent only checks it`);
80
+ // D98: an agent writes a PM-owned core document too when asked; the draft records the agent as its author.
81
81
  let markdown;
82
82
  if (flags.file === '-') markdown = readStdin(stdin);
83
83
  else { try { markdown = fs.readFileSync(path.resolve(cwd, flags.file), 'utf8'); } catch (err) { return fail(`cannot read ${flags.file}: ${String(err.code || err.message)}`, 2); } }
@@ -115,7 +115,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
115
115
  };
116
116
  const pmOnly = (act) => {
117
117
  const a = actorLib.fromCli(who);
118
- if (!actorLib.isPm(a)) return { ok: false, error: `only the PM can ${act}, at an interactive terminal${actorLib.isAgent(a) && a.by !== 'agent:unknown' ? '; an agent session cannot' : ''}` };
118
+ // D98: an agent session may do it too; the ledger line carries its own `by`.
119
+ if (!actorLib.isPm(a) && !actorLib.isAgent(a)) return { ok: false, error: `only the PM or an agent session can ${act}` };
119
120
  return { ok: true, actor: a };
120
121
  };
121
122
 
@@ -28,7 +28,8 @@ const stageTools = require('./stage-tools.js');
28
28
  const pmItems = require('./pm-items.js');
29
29
 
30
30
  const refuse = (status, error) => ({ ok: false, status, error });
31
- const isPm = (a) => !!a && actorLib.isPm(a);
31
+ // D98: an agent session decides too; every line it writes keeps its own `by`.
32
+ const isPm = (a) => !!a && (actorLib.isPm(a) || actorLib.isAgent(a));
32
33
 
33
34
  function itemsPaths(dir) { return { items: path.join(dir, 'items.jsonl'), steps: path.join(dir, 'steps.jsonl') }; }
34
35
 
@@ -96,7 +97,7 @@ async function decide(verb, { file, proposal, note, actor, ctx = {}, now } = {})
96
97
  const reason = `driver:${verb}`;
97
98
  fs.mkdirSync(path.dirname(ctx.correctionsFile), { recursive: true });
98
99
  fs.appendFileSync(ctx.correctionsFile, JSON.stringify({ type: 'correction', kind: 'reject', reason, run: p.run, counted: true, at: new Date(t).toISOString(),
99
- record: { kind: 'correction', run: p.run, reason, by: 'pm' } }) + '\n');
100
+ record: { kind: 'correction', run: p.run, reason, by: actorLib.isPm(actor) ? 'pm' : actor.by } }) + '\n');
100
101
  } catch { /* the driver ledger already holds the correction */ }
101
102
  }
102
103
  }
@@ -76,7 +76,8 @@ const SLOT_RE = /^\d{4}-\d{2}-\d{2}(-[2-9]|-[1-9]\d)?$/; // a core document's
76
76
  const MAX_DATA = 8000;
77
77
  const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
78
78
  const oneLine = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
79
- const pm = (by) => typeof by === 'string' && by.startsWith('pm:');
79
+ // D98: a decision line by the PM or an agent session takes effect; the line keeps who wrote it.
80
+ const pm = (by) => typeof by === 'string' && (by.startsWith('pm:') || by.startsWith('agent:'));
80
81
 
81
82
  const targetKey = (t) => `${t.kind}:${t.ws}:${t.id}`;
82
83
  const wsIdOf = (root) => crypto.createHash('sha1').update(path.resolve(root)).digest('hex').slice(0, 10);
@@ -82,14 +82,15 @@ function bulkTarget({ target, ids, state } = {}) {
82
82
 
83
83
  function mintFromPress(root, { scope, target, ids, state, instruction, initiative } = {}, { actor: who } = {}) {
84
84
  if (!PRESS_SCOPES.includes(scope)) return { ok: false, status: 400, error: 'a press cannot mint a grant of scope ' + JSON.stringify(scope) };
85
- if (!actor.isPm(who)) return { ok: false, status: 403, error: 'only the PM mints a grant' };
85
+ // D98: an agent session mints one too; the grant's `pm` field names the agent, so the ledger says who pressed.
86
+ if (!actor.isPm(who) && !actor.isAgent(who)) return { ok: false, status: 403, error: 'only the PM or an agent session mints a grant' };
86
87
  if (scope === 'lifecycle-bulk') target = bulkTarget({ target, ids, state }) ?? target;
87
88
  if (typeof target !== 'string' || !target.trim()) return { ok: false, status: 400, error: 'a ' + scope + ' grant names its target' };
88
89
  const repo = planTree.mainTree(path.resolve(String(root)));
89
90
  const w = writerOf(repo);
90
91
  if (!w) return { ok: false, status: 500, error: 'this repository has no grants writer (scripts/record-grant.js or pmos/scripts/pmos-log.sh)' };
91
92
  const words = typeof instruction === 'string' && instruction.trim() ? instruction.trim() : 'the PM pressed ' + scope + ' in the workspace';
92
- const argv = [...w.argv, 'grant', scope + ':' + target, who.by.slice('pm:'.length), words, TTL_MINUTES];
93
+ const argv = [...w.argv, 'grant', scope + ':' + target, actor.isPm(who) ? who.by.slice('pm:'.length) : who.by, words, TTL_MINUTES];
93
94
  if (typeof initiative === 'string' && initiative) argv.push(initiative);
94
95
  const env = { PATH: process.env.PATH || '/usr/bin:/bin', HOME: process.env.HOME || repo, LANG: 'C.UTF-8' };
95
96
  const r = spawnSync(argv[0], argv.slice(1), { cwd: repo, env, encoding: 'utf8', timeout: 20000, shell: false });
@@ -6,19 +6,19 @@
6
6
  * pmos initiative new --from capture-YYYY-MM-DD-<n> [--anchor …] [--lane …] [--title "…"]
7
7
  * pmos initiative now <id> PM only: type the id to confirm
8
8
  * pmos initiative next|later <id> [--top] to the end of that horizon, or its top
9
- * pmos initiative top|up|down <id> reorder inside its horizon (in Now: PM only)
9
+ * pmos initiative top|up|down <id> reorder inside its horizon
10
10
  * pmos initiative check-by <id> <YYYY-MM-DD|none>
11
- * pmos initiative adopt <proposal-eid> PM only: type the eid to confirm
11
+ * pmos initiative adopt <proposal-eid> the PM types the eid to confirm; an agent passes (D98)
12
12
  * pmos initiative drop <proposal-eid>
13
13
  * pmos initiative list
14
14
  * pmos initiative export <id> the breakdown as markdown on stdout; nothing is written
15
15
  * every command: [--json] [--root <dir>]
16
16
  *
17
17
  * The SAME writers the workspace page uses (lib/initiative-writer.js, lib/placements.js) — no server is needed. Who
18
- * wrote a line comes from the call path, never from an argument: a PM-only act (Move to Now, adopt, and any line into
19
- * Now) goes through lib/pm-guard.js requirePmCli — an interactive terminal with no agent session, and the PM types the
20
- * confirmation; every other command takes lib/actor.js fromCli: the PM at a terminal, the bound agent session from
21
- * PMOS_SESSION, `agent:unknown` otherwise. An agent's placement is written as a proposal (`proposed: true`).
18
+ * wrote a line comes from the call path, never from an argument: Move to Now, adopt, and any line into Now go through
19
+ * lib/pm-guard.js requirePmCli — the PM types the confirmation at a terminal, and an agent session passes with its own
20
+ * actor (D98); every other command takes lib/actor.js fromCli: the PM at a terminal, the bound agent session from
21
+ * PMOS_SESSION, `agent:unknown` otherwise. An agent's placement applies at once and its line names the agent (D98).
22
22
  * Work lanes only (D86 point 4): `list` and `export` leave document-lane initiatives out.
23
23
  * Exit codes: 0 done, 1 refused, 2 usage.
24
24
  */
@@ -43,12 +43,12 @@ const USAGE = [
43
43
  ' pmos initiative next|later <id> [--top] move it to the end of Next or Later, or to its top',
44
44
  ' pmos initiative top|up|down <id> reorder it inside its horizon',
45
45
  ' pmos initiative check-by <id> <YYYY-MM-DD|none>',
46
- ' pmos initiative adopt <proposal> keep an agent proposal (you only; type the proposal to confirm)',
47
- ' pmos initiative drop <proposal> close an agent proposal',
46
+ ' pmos initiative adopt <proposal> keep an open proposal (you type the proposal to confirm)',
47
+ ' pmos initiative drop <proposal> close an open proposal',
48
48
  ' pmos initiative list Now, Next and Later, in order',
49
49
  ' pmos initiative export <id> the breakdown as markdown on stdout',
50
50
  ' every command: [--json] [--root <dir>]',
51
- 'An agent session writes a placement as a proposal for you to keep or drop. A new initiative lands in Later.',
51
+ 'An agent session\'s placement applies at once and names the agent. A new initiative lands in Later.',
52
52
  ];
53
53
  const BOOL = new Set(['json', 'top', 'help']);
54
54
  const VALUE = new Set(['lane', 'anchor', 'intent', 'id', 'from', 'title', 'root']);
@@ -99,7 +99,8 @@ function readIssues(root) {
99
99
  }
100
100
  const why = lineErr(rec);
101
101
  if (why) { out.flags.push({ kind: 'invalid', eid: rec.eid || null, why: `line ${n}: ${why}` }); continue; }
102
- if (!actorLib.isPm({ by: rec.by, via: rec.via })) { out.flags.push({ kind: 'not-pm', eid: rec.eid, why: `line ${n}: ${rec.by} issued ${rec.cadence} ${rec.slot}; only the PM issues a report (R25), so the line has no effect` }); continue; }
102
+ // D98: the PM or an agent session issues a report; the line keeps who issued it.
103
+ if (!actorLib.valid({ by: rec.by, via: rec.via })) { out.flags.push({ kind: 'not-pm', eid: rec.eid, why: `line ${n}: ${rec.by} issued ${rec.cadence} ${rec.slot}, but the line names no PM or agent session, so it has no effect` }); continue; }
103
104
  const key = `${rec.cadence}\u0000${rec.slot}`;
104
105
  if (seen.has(key)) { out.flags.push({ kind: 'duplicate-slot', eid: rec.eid, why: `line ${n}: ${rec.cadence} ${rec.slot} was issued on line ${seen.get(key)}; the later line has no effect` }); continue; }
105
106
  seen.set(key, n);
@@ -133,12 +134,12 @@ function randomChars(n) {
133
134
  }
134
135
 
135
136
  /**
136
- * One `issued` line per event. The actor is the caller's guard result (pm-guard.js), never a field; only the PM
137
- * issues, and the call path must match the actor (`ui` from the page, `cli` from a terminal). Each event names a file
137
+ * One `issued` line per event. The actor is the caller's guard result (pm-guard.js), never a field; the PM or an agent
138
+ * session issues (D98), and the call path must match the actor (`ui` from the page, `cli` from a terminal). Each event names a file
138
139
  * that exists in `root` with exactly the sha sent, so a line can never freeze bytes nobody read.
139
140
  */
140
141
  function append(root, events, actor, via, { now } = {}) {
141
- if (!actorLib.isPm(actor) || actor.via !== via) return refuse(403, `only the PM issues a report, from the ${via === 'ui' ? 'page' : 'terminal'}; nothing was written`, null);
142
+ if (!actorLib.valid(actor) || actor.via !== via) return refuse(403, `a report is issued by the PM or an agent session, from the ${via === 'ui' ? 'page' : 'terminal'}; nothing was written`, null);
142
143
  if (!Array.isArray(events) || !events.length) return refuse(400, 'send at least one line', null);
143
144
  if (events.length > MAX_LINES) return refuse(413, `send at most ${MAX_LINES} lines at once`, null);
144
145
  let read;
@@ -128,7 +128,7 @@ const noteId = () => 'n-' + crypto.randomBytes(6).toString('base64').replace(/[^
128
128
  */
129
129
  function decide(root, { actor, body, now = Date.now() } = {}) {
130
130
  const by = actor && typeof actor.by === 'string' ? actor.by : null;
131
- if (!by || !/^pm:/.test(by)) return { ok: false, error: 'only the PM decides who is a person' };
131
+ if (!by || !/^(?:pm|agent):/.test(by)) return { ok: false, error: 'only the PM or an agent session decides who is a person' }; // D98
132
132
  const b = body && typeof body === 'object' ? { ...body } : {};
133
133
  if (b.act === 'note' && !b.id) b.id = noteId();
134
134
  const c = P.checkDecision(b);
@@ -36,6 +36,7 @@ const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
36
36
  const ID_RE = /^[a-z0-9][a-z0-9-]{0,59}$/;
37
37
  const NOTE_ID_RE = /^n-[0-9a-z]{4,16}$/;
38
38
  const PM_BY_RE = /^pm:[a-z0-9_-]{1,40}$/;
39
+ const AGENT_BY_RE = /^agent:(?:unknown|sess-\d+\.[0-9a-f]{8})$/;
39
40
  const TONE_WINDOW = 10;
40
41
 
41
42
  const isObj = (x) => !!x && typeof x === 'object' && !Array.isArray(x);
@@ -221,7 +222,8 @@ function matchPeople(people, hay) {
221
222
 
222
223
  const sightKey = (r) => [handleKey(r.handle), r.interaction ? r.interaction.date : '', r.interaction ? r.interaction.pointer : '', r.interaction ? r.interaction.text : ''].join('\u0000');
223
224
  const pairKey = (a, b) => [handleKey(a), handleKey(b)].sort().join('\u0000');
224
- const isPm = (r) => typeof r.by === 'string' && PM_BY_RE.test(r.by);
225
+ // D98: a decision by the PM or an agent session takes effect; the row keeps who decided.
226
+ const isPm = (r) => typeof r.by === 'string' && (PM_BY_RE.test(r.by) || AGENT_BY_RE.test(r.by));
225
227
  const DECISION_KINDS = new Set(['add', 'ignore', 'remove', 'merge', 'keep-separate', 'edit', 'tone', 'note', 'note-remove', 'setting']);
226
228
 
227
229
  /**