create-pmos 0.547.0 → 0.549.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 (38) hide show
  1. package/package.json +27 -57
  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/changelog.json +26 -0
  8. package/workspace/guide/home.md +9 -4
  9. package/workspace/guide/programs.md +2 -0
  10. package/workspace/guide/settings-and-switches.md +15 -1
  11. package/workspace/lib/artefacts.js +49 -0
  12. package/workspace/lib/autonomy.js +107 -9
  13. package/workspace/lib/board-pack-route.js +5 -0
  14. package/workspace/lib/board-pack.js +7 -1
  15. package/workspace/lib/driver-decide.js +6 -1
  16. package/workspace/lib/routes-artefacts.js +40 -1
  17. package/workspace/lib/routes-autonomy.js +65 -8
  18. package/workspace/lib/routes-proposals.js +1 -1
  19. package/workspace/lib/settings-store.js +5 -0
  20. package/workspace/package-lock.json +2 -2
  21. package/workspace/package.json +1 -1
  22. package/workspace/public/pm/cozy-board.css +6 -0
  23. package/workspace/public/pm/cozy-ev.css +5 -0
  24. package/workspace/public/pm/cozy-settings.js +47 -4
  25. package/workspace/public/pm/cozy-today.css +7 -0
  26. package/workspace/public/pm/good-morning.js +73 -14
  27. package/workspace/public/pm/home-app.js +24 -10
  28. package/workspace/public/pm/home-day.js +11 -6
  29. package/workspace/public/pm/ini-agent.js +164 -0
  30. package/workspace/public/pm/ini-view.css +32 -3
  31. package/workspace/public/pm/ini-view.js +25 -2
  32. package/workspace/public/pm/move-rank.js +6 -3
  33. package/workspace/public/pm/readonly.js +18 -0
  34. package/workspace/public/pm/story.css +8 -0
  35. package/workspace/public/pm/story.js +39 -0
  36. package/workspace/skills/report-weekly.skill +2 -1
  37. package/workspace/stage-card-tasks-test.js +3 -0
  38. package/workspace/test-lists/agent-run-workspace.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.547.0",
3
+ "version": "0.549.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,32 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.549.0",
37
+ "at": "2026-11-10T07:06:56.286Z",
38
+ "f": 4,
39
+ "prs": [
40
+ {
41
+ "n": 1277,
42
+ "t": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
43
+ "s": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
44
+ "k": "new"
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "v": "0.548.0",
50
+ "at": "2026-11-10T02:35:02.323Z",
51
+ "f": 4,
52
+ "prs": [
53
+ {
54
+ "n": 1276,
55
+ "t": "Agent-run Your day and initiative Viewer",
56
+ "s": "Agent-run Your day and initiative Viewer",
57
+ "k": "new"
58
+ }
59
+ ]
60
+ },
35
61
  {
36
62
  "v": "0.547.0",
37
63
  "at": "2026-11-09T23:58:24.564Z",
@@ -337,62 +363,6 @@
337
363
  "k": "new"
338
364
  }
339
365
  ]
340
- },
341
- {
342
- "v": "0.529.0",
343
- "at": "2026-11-04T13:14:44.790Z",
344
- "f": 4,
345
- "prs": [
346
- {
347
- "n": 1243,
348
- "t": "A look change from a report's chat becomes its next look, kept with ✓ and redrawn into the open draft; the drafting session's answer shows",
349
- "s": "A look change from a report's chat becomes its next look, kept with ✓ and redrawn into the open draft; the drafting session's answer shows",
350
- "k": "fix"
351
- },
352
- {
353
- "n": 1245,
354
- "t": "The Lab's background record says in plain words what Claude did, what came out and when",
355
- "s": "The Lab's background record says in plain words what Claude did, what came out and when",
356
- "k": "fix"
357
- },
358
- {
359
- "n": 1244,
360
- "t": "Meeting player, Jev crop display and word fix A",
361
- "s": "Meeting player, Jev crop display and word fix A",
362
- "k": "new"
363
- }
364
- ]
365
- },
366
- {
367
- "v": "0.528.0",
368
- "at": "2026-11-04T12:00:44.809Z",
369
- "f": 4,
370
- "prs": [
371
- {
372
- "n": 1229,
373
- "t": "Dates carry their year, and plain words across the workspace (workspace grill W4)",
374
- "s": "Dates carry their year, and plain words across the workspace (workspace grill W4)",
375
- "k": "fix"
376
- },
377
- {
378
- "n": 1241,
379
- "t": "Good morning on live data — a stale source said once, a quiet quarter, goal tags, say-it-once folds",
380
- "s": "Good morning on live data — a stale source said once, a quiet quarter, goal tags, say-it-once folds",
381
- "k": "fix"
382
- },
383
- {
384
- "n": 1239,
385
- "t": "The Lab's background record leaves out a chat's own runs",
386
- "s": "The Lab's background record leaves out a chat's own runs",
387
- "k": "fix"
388
- },
389
- {
390
- "n": 1242,
391
- "t": "Report reader no longer flickers while a draft is written",
392
- "s": "Report reader no longer flickers while a draft is written",
393
- "k": "fix"
394
- }
395
- ]
396
366
  }
397
367
  ]
398
368
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@6054bc9a
2
- assembled: 2026-11-09
1
+ kernel-source: pmos@38a9732b
2
+ assembled: 2026-11-10
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-09T23:58:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-10T07:06:52Z"}
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-09T23:58:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-10T07:06:52Z"}
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-09T23:58:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-10T07:06:52Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  Newest first, ISO dates.
4
4
 
5
- ## 2026-11-09
5
+ ## 2026-11-10
6
6
 
7
7
  - Adopted OKF v0.2 (D73).
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.549.0",
4
+ "at": "2026-11-10T07:06:56.286Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1277,
9
+ "t": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
10
+ "s": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.548.0",
17
+ "at": "2026-11-10T02:35:02.323Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1276,
22
+ "t": "Agent-run Your day and initiative Viewer",
23
+ "s": "Agent-run Your day and initiative Viewer",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.547.0",
4
30
  "at": "2026-11-09T23:58:24.564Z",
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Home: your list, the chat, the Viewer, My work, documents and people"
4
4
  description: "Home's list, Mentions, Your day, the chat and the Viewer; My work; documents and their copies; People; and the suggested next prompt."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-10
6
6
  ---
7
7
 
8
8
  # Home
@@ -17,11 +17,14 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
17
17
  - Press **Good morning** to open **Your day** in the Viewer. This is the same on a computer and on a phone. To open the calendar, press the calendar icon in Your day's header. A program's milestone changes that wait on you are the first line of the program's card.
18
18
  - Your day is the **Good morning** page. It shows the date and greeting, then the quarter, then two columns. On a computer it opens wide.
19
19
  - **The quarter.** One bar with all goals of the products Home reads: reached, on track, still reading, at risk and will miss, each with its count. A black tick marks your line, for example "line 18". One sentence says how many goals are on track or better, and one line says why. When no goal has a reading yet, the sentence says that instead, for example "3 goals, none read yet." **By product** opens Intelligence. With no goals, there is no bar. With no line, there is no tick, and Claude can propose a line with ✦: press ✓ to keep it, or ✕ to not set one this quarter. A product that could not be read is named and is not counted.
20
- - **The left column.** Claude's lead, with one line of what Claude did for you. When a source such as Jira cannot be read, one quiet line under the lead says so and what it shows instead, with an icon to read it again. The source never takes the lead's place. **Your call**: the one decision that needs you, and what Yes does when that is known. **Your move**: the top 3 items of the ranked list (Your move is the one place every ask waits: see [Your move](#your-move)), each with the goal it moves and its due day (orange only when late). An item shows its goal when its initiative is anchored to a key result that a goal reads. Then one line: **N more in Your move**, **N drafted for you** and **N can wait**. Press one to open its fold under the page. A fold shows only after you press its line, so it is not said twice. **Since yesterday**: up to 3 new items, then **New for you · N** to see all of them. ✓✓ marks all of them seen.
20
+ - **The left column.** Claude's lead says it straight, for example "Straight answer: 5 calls are yours. I did the other 54." When a source such as Jira cannot be read, one quiet line under the lead says so and what it shows instead, with an icon to read it again. The source never takes the lead's place.
21
+ - **Your move** shows only the calls that always wait for you: a verdict, a new request or a decision, a message to people, a move the team reads, a merge, and a delete or spend. Each row starts with its kind and says why, for example "Message · I drafted it. It goes to people and cannot be unsent." It also shows its due day (orange when late) and the goal it moves when a goal reads it. At most 5 show. **N more calls of yours** opens the rest. Claude acts on everything else by itself, so there is no Can wait.
22
+ - **Claude did** lists what Claude finished by itself, newest first. Each row has a one-line reason, for example "Did it quietly. You kept this kind 4 times before.", and Undo. Undo works for 14 days. After two Undos in a row on one kind, Claude asks first for that kind for 7 days. A run that stopped is one amber line at the top, never a row in Your move. **N more Claude did** opens the rest. A kind Claude shows you comes first. **By product** opens Settings › Claude, where you set how Claude decides for each kind.
23
+ - **Since yesterday**: up to 3 new items, then **New for you · N** to see all of them. ✓✓ marks all of them seen.
21
24
  - **The right column.** Today's agenda, not to scale: a line at the time now, each meeting with its prep note, ✦ picks in free time, and "3 h free" for a long free stretch. The meeting where your call is decided has an orange edge. Under it, **Notes since yesterday**: meeting notes with their main lines, and recordings with no initiative. When Claude finds the initiative a recording belongs to, press the link icon to link it.
22
25
  - **In the hour before a meeting**, the meeting's prep leads: what to agree, the points, and the record icon. The quarter shows only when it moved since the morning. Past meetings fade, with their notes under them.
23
- - **On a phone or in a narrow Viewer**, the page is one column: the quarter, the lead, your call, Your move, the agenda, then Since yesterday.
24
- - Under the page are **Now** (on a phone), **Done** (what Claude finished by itself, each with Undo) and **This week** (the Weekly review and **Mentions**). The rest of **Your move**, **Drafted for you** and **Can wait** open there from their line.
26
+ - **On a phone or in a narrow Viewer**, the page is one column: the quarter, the lead, Your move, Claude did, the agenda, then Since yesterday.
27
+ - Under the page are **Now** (on a phone) and **This week** (the Weekly review and **Mentions**). The rest of your calls, the rest of Claude did and **Drafted for you** open there from their line.
25
28
  - **Drafted for you** lists what Claude drafted today and the weekly update. Press a row to open it: a finished draft opens what Claude wrote, and the weekly update opens the update.
26
29
  - Your day does not show the meeting on now or the next meeting. Home's meeting line shows them. On a phone, the **Now** card does not show while a meeting is in progress.
27
30
  - When a conversation in Mentions waits on your answer, Your day names the oldest one under its first line: who asked, where, how many more wait, and what they asked. Press its icon to open that conversation in Mentions.
@@ -74,6 +77,8 @@ A reply PMOS sees in the thread clears the ask on the next read. A new ask after
74
77
  Press an initiative's name in the list, or open `?ini=<id>`. The list stays as it is and the initiative's row is selected. The chat talks about the initiative, and its page opens in the Viewer.
75
78
 
76
79
  - The page's header shows the lane and the anchor, the name, **New session** (+), ⋯, Open wide and Close.
80
+ - **Experiment** shows what Claude keeps for the initiative: **We bet**, **Stop if**, **Budget**, **Who builds**, **Specimens** and **Done when**. A line that nobody wrote does not show. Press a line to change it. After you change a line, Claude asks before it changes that line again. When an experiment is on record, **Gate to Build** shows the done test and the kill condition (D107) instead of the PRD and the rubric.
81
+ - **Claude's work** lists what Claude changed on this initiative by itself, each with its reason, its day and Undo. A run that stopped is one amber line. **Coming up** names the next dated thing, for example a milestone that is due.
77
82
  - The stage card shows the stage, **N of M done** for its tasks, the days in the stage (for example "9 of ~7 days", amber when over the usual time) and → for the next stage. → turns blue when every task of the stage is done.
78
83
  - Under the header is one line for the whole initiative. Each stage is a part of the line, on its own dates. Done stages are grey, the current stage is blue, later stages are light, and a stage with no dated task is dashed. The ◇ marks are the milestone tasks, with the name above and the date below. The end ◇ is the end date. When the initiative has milestone tasks, the end ◇ stands for one of them (one on the end date, else the latest in the last milestone stage, else the latest of all), sits on that task's own date and shows it. A thin tick is Today.
79
84
  - Press a part to show that stage in **Tasks**. Press **N of M done** to do the same. Press a ◇ to open the milestone task in **Tasks**. Milestones a few days apart merge into one ◇ with a count. Press it to list them.
@@ -82,12 +82,14 @@ Press a program's name on the Board to open its panel. Home links to it with `?p
82
82
  The Viewer of a program, and the product page, are one page. There is no Work and Dashboard switch.
83
83
 
84
84
  - The top shows Claude's ✦ line, then the goal card with its milestones and the forecast bar. Goals show a short title, not the KR's full text.
85
+ - On the product page, **The story so far** comes under the ✦ line. Claude writes it from the records, and every line shows its source as a chip. This story is your weekly update: the update leads with it, without the sources. The ✦ line then says "Your weekly update is this story." Claude keeps it current when it prepares the weekly report. With no story, there is no card.
85
86
  - Each goal row shows the KR as a chip, then a short title, then one grey line on how it reads. The KR id alone is never the title.
86
87
  - When Claude proposes changes, a folded row under the goal card counts them. Only the owner sees this row. Press it to open every proposal, each with Claude's pick: ✕ drops it, ✎ opens it to change, ✓ keeps the pick.
87
88
  - On the product page, the same row also holds **Goals I would change**: a KR whose wording reads badly, with the old words struck through, the new words, one reason and a test read (its source and number). Claude lists a goal only when its test read returned a number.
88
89
  - The tabs are **Tasks**, **Initiatives** (the default), **Reports** and **Documents**.
89
90
  - The product page also shows a **Programs** card and a **Health budgets** card. Its **Initiatives** tab lists the product's own initiatives, then one card for each program that holds some of them.
90
91
  - A teammate on a shared board sees the same page, with no proposals.
92
+ - A shared Board link of a product shows the same story above the timeline, without the sources and without what Claude did.
91
93
 
92
94
  ## Claude suggests milestones
93
95
 
@@ -12,7 +12,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
12
12
  | Section | What it holds |
13
13
  |---|---|
14
14
  | General | The theme (Light, Dark or Auto), whether the Viewer opens as a column or a popup, the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
15
- | Claude | The Claude profile that new sessions start with, the Anthropic API key for Claude's own runs, Sharpen prompts, and **Checks**: when Claude grills an initiative by itself and the monthly credit for its checks. |
15
+ | Claude | **How Claude decides** for each kind of change, the calls that are **Always yours**, and Claude's **Lessons**. Then the Claude profile that new sessions start with, the Anthropic API key for Claude's own runs, Sharpen prompts, and **Checks**: when Claude grills an initiative by itself and the monthly credit for its checks. |
16
16
  | Connectors | Every connector your Claude session has. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
17
17
  | Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. See [Workflows](statuses.md). |
18
18
  | Updates | The version of the app and of each workspace's kit, the check for updates, and what changed. |
@@ -39,6 +39,20 @@ Under the update card, **Updates** shows what changed in the published kits. **T
39
39
  - A change published before Claude wrote stories shows the pull request's title and its sentence instead.
40
40
  - The card in **General** that says a new PMOS is ready opens **Updates**.
41
41
 
42
+ ## Claude: how Claude decides, and its Lessons
43
+
44
+ **How Claude decides** lists each kind of change that Claude made by itself, for example "Notes on where work stands" or "Task names". Each row says how many Claude made and how many you kept. Each kind has three ways:
45
+
46
+ - **Quietly**: Claude does it and lists it in Claude did.
47
+ - **Show me**: Claude does it and shows it first in Claude did.
48
+ - **Ask first**: Claude does not do it. It waits for your ✓ as a proposal.
49
+
50
+ Claude picks the way by itself. A new kind is **Show me** until you keep 3 of its changes; then it is **Quietly**. Two Undos on a kind and Claude asks first for 7 days. Press a way to set a kind yourself. Your way wins over Claude's, the 7 days included. Press the way Claude would pick to give the choice back to Claude. **By product** under Claude did on Your day opens this section.
51
+
52
+ **Always yours** lists the calls Claude never makes by itself, whatever it has learned: a new request, a verdict on an outcome, a message to people, a move the team reads in Jira or on the Board, and a merge, a delete or spend.
53
+
54
+ **Lessons** lists what Claude got wrong and what it changed, newest first, from the Lessons of every product. The first line says what went wrong; the next says what changed.
55
+
42
56
  ## Claude: the profile and the API key
43
57
 
44
58
  **Claude login and profile.** Choose a separate PMOS login or an existing Claude setup. Complete sign-in in that profile’s terminal. **Check and use this profile** verifies access and saves the choice for new sessions. The check can consume a small amount of Claude usage. A discovered profile is not a verified login. The same login test appears in [first-run setup](layout.md).
@@ -12,8 +12,12 @@
12
12
  * file(dir) · readLines(file) · fold(lines) → Map scope → Map artefact → { fields: { name: value|[values] }, carried: [line] }
13
13
  * set(file, { scope, artefact, field, text, sources }, actor, { now }) → { ok, line } | { ok: false, status, error }
14
14
  * undo(file, { ref }, actor, { now }) → { ok, line } | refusal a set goes back; carry lines cannot be undone (they point at records)
15
+ * pmEdited(state, { scope, artefact, field }) → bool the newest set of that field is the PM's: Claude asks before it changes it (board AwB)
15
16
  * viewOf(state, scope) → { scope, artefacts: [{ key, title, owner, for, fields, carried, empty }] } always all seven that fit the scope
16
17
  * migrate({ dir, coreDocs, driverLines, reports }, { now }) → { ok, carried, already, lines } idempotent; deletes nothing
18
+ * storyOf(state, scopes, { now, days }) → { at, lines: [{ text, sources }] } | null "The story so far" (board AwE): the Narrative's
19
+ * `now` (one paragraph per line) and its `week` lines of the last `days` days; every line carries the sources of its set
20
+ * lessonsOf(state) → [{ scope, text, sources, at }] every Lessons line of every scope, newest first (Settings › Claude, AwG2)
17
21
  *
18
22
  * THE LINES. Every line is { v: 1, ev, id, scope, at, by }.
19
23
  * set { artefact, field, text, sources: [{ label, ref }] } a value. A `one` field: the newest set wins. A `list` field: every set is a line.
@@ -226,6 +230,50 @@ function viewOf(state, scope) {
226
230
  return { scope: p.scope, kind: p.kind, artefacts };
227
231
  }
228
232
 
233
+ /** True when the newest set of this field is the PM's own (the Viewer's "You edit any line. Claude asks before it changes one you edited",
234
+ * agent-run workspace board AwB). The Driver then files Claude's change as a proposal instead of applying it. Pure. */
235
+ function pmEdited(state, { scope, artefact, field } = {}) {
236
+ const p = parseScope(scope);
237
+ const x = p && state && state.get(p.scope) && state.get(p.scope).get(artefact);
238
+ if (!x) return false;
239
+ const sets = x.sets.filter((l) => l.field === field);
240
+ return !!sets.length && /^pm:/.test(String(sets[sets.length - 1].by || ''));
241
+ }
242
+
243
+ /** "The story so far" of a product (board AwE, the weekly update): the Narrative of the first scope that has one, else nothing.
244
+ * `now` gives one paragraph per line of its text; the `week` lines of the last `days` days follow, oldest first. With as many sources as
245
+ * lines, line N shows source N; otherwise the sources of a set ride on its last line. Pure. */
246
+ function storyOf(state, scopes, { now, days = 7 } = {}) {
247
+ const t = now == null ? Date.now() : now;
248
+ for (const sc of scopes || []) {
249
+ const v = viewOf(state, sc);
250
+ const n = v && v.artefacts.find((a) => a.key === 'narrative');
251
+ if (!n || n.empty) continue;
252
+ const lines = [];
253
+ const add = (set) => {
254
+ const ps = String(set.text || '').split(/\n+/).map((x) => x.trim()).filter(Boolean);
255
+ const src = set.sources || [];
256
+ // one source per line, in order, when the agent gave as many as it wrote lines; else every source rides on the last line
257
+ ps.forEach((x, i) => lines.push({ text: x, sources: src.length === ps.length && ps.length > 1 ? [src[i]] : i === ps.length - 1 ? src : [] }));
258
+ };
259
+ if (n.fields.now) add(n.fields.now);
260
+ for (const w of n.fields.week || []) if (Date.parse(w.at || '') >= t - days * 86400000) add(w);
261
+ if (!lines.length) continue;
262
+ const ats = [n.fields.now, ...(n.fields.week || [])].filter(Boolean).map((x) => x.at).filter(Boolean).sort();
263
+ return { scope: v.scope, at: ats[ats.length - 1] || null, lines };
264
+ }
265
+ return null;
266
+ }
267
+ /** Every Lessons line, newest first. Pure. */
268
+ function lessonsOf(state) {
269
+ const out = [];
270
+ for (const [scope, m] of state || new Map()) {
271
+ const x = m.get('lessons');
272
+ if (x) for (const l of x.sets) if (l.field === 'line') out.push({ scope, text: l.text, sources: l.sources || [], at: l.at || null });
273
+ }
274
+ return out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
275
+ }
276
+
229
277
  // ── writes ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
230
278
  const refuse = (status, error) => ({ ok: false, status, error });
231
279
  const oneLine = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
@@ -363,6 +411,7 @@ function migrateRepo(root, { now } = {}) {
363
411
  }
364
412
 
365
413
  module.exports = {
414
+ pmEdited, storyOf, lessonsOf,
366
415
  LEDGER, EVENTS, ARTEFACTS, KEYS, EXECUTORS, FROM_DOCS, FROM_WHATS, FROM_CADENCES, FROM_LANES,
367
416
  parseScope, targetOfDoc, targetOfWhat, fieldOf, file, readLines, append, fold, viewOf, checkSet, set, undo,
368
417
  planMigration, migrate, migrateRepo, reportDrafts, dirOf, proposalText,
@@ -10,7 +10,8 @@
10
10
  * A change with no Undo writer is never applied by itself, whatever its class ("no Undo, no auto"): it waits like C.
11
11
  *
12
12
  * THE LEDGER: <state folder>/autonomy.jsonl, append-only, THIS FILE IS ITS ONE WRITER. One line per event { v: 1, at, ev, ... }:
13
- * applied { job, product, ref, title, cls } an agent applied a change by itself (ref: the proposal id or the ✦ batch)
13
+ * applied { job, product, ref, title, cls, ini?, why? } an agent applied a change by itself (ref: the proposal id or the ✦ batch;
14
+ * ini: the initiative it changed; why: the evidence it acted on, one line)
14
15
  * setback { job, product, ref?, kind } kind: undo (the PM pressed Undo) · revert (a revert of the change) ·
15
16
  * verifier-fail (the T4 verifier failed it; counts like an Undo)
16
17
  * demote { job, product, until, why } the job falls back to propose for this product until `until`
@@ -33,8 +34,18 @@
33
34
  * killed({ env, settingsDir }) → null | reason PMOS_AUTONOMY=off or `pmos ai off` stops every auto apply
34
35
  * demotedNow(state, job, product, now) → null | { until, why }
35
36
  * notices(stateDir, { now }) → [{ job, product, until, why }] demotions Home has not said yet; markSeen(stateDir, n, { now })
36
- * done(stateDir, { now, days }) → [applied line, newest first] the applied changes of the last 14 days that are not undone
37
+ * done(stateDir, { now, days }) → [applied line, newest first] the applied changes of the last 14 days that are not undone, each with
38
+ * `kept` (earlier changes of its job and product nobody undid) and `reason` (reasonOf)
39
+ * reasonOf({ cls, why, kept }) → one line: how Claude did it and why ("Did it quietly. You kept this kind 4 times before.")
37
40
  * restore(stateDir, { job, product }, actor, { now })
41
+ *
42
+ * HOW CLAUDE DECIDES (Settings › Claude, agent-run workspace boards AwG and AwG2, agreed by the PM 2026-11-10). The jobs are grouped into
43
+ * KINDS of change the PM can name ("Notes on where work stands"). Each kind has a WAY:
44
+ * quiet Claude does it and lists it in Claude did (the kind is kept: SHOW_UNTIL or more of its changes nobody undid)
45
+ * show Claude does it and shows it first in Claude did (a new kind, until the PM keeps SHOW_UNTIL)
46
+ * ask Claude asks first: the change waits as a proposal (two Undos on a kind: the demotion above, for 7 days)
47
+ * The PM may set any kind (setting claude.ways, { kind: way }); the PM's way wins over the automatic one, a demotion included.
48
+ * WAYS · SHOW_UNTIL · KIND_LIST · kindOf(job) · waysSet(settingsDir) · autoWay({ kept, demoted }) · kindsOf(dirs, { now, settingsDir })
38
49
  */
39
50
  const fs = require('fs');
40
51
  const path = require('path');
@@ -51,6 +62,8 @@ const KINDS = Object.freeze(['undo', 'revert', 'verifier-fail']);
51
62
  const EVENTS = Object.freeze(['applied', 'setback', 'demote', 'seen', 'restore']);
52
63
  const JOB_RE = /^(driver|propose|ai|goal):[a-z0-9][a-z0-9-]{0,40}$/;
53
64
  const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
65
+ const WAYS = Object.freeze(['quiet', 'show', 'ask']);
66
+ const SHOW_UNTIL = 3;
54
67
  const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
55
68
 
56
69
  /* The Initiative Driver's kinds (lib/driver.js WHATS). */
@@ -67,6 +80,36 @@ const PROPOSAL_CLASS = Object.freeze({
67
80
  description: 'B', outcome: 'B', found: 'B', status: 'B', grill: 'B', links: 'B', prototyped: 'B', improved: 'B', scanned: 'B',
68
81
  });
69
82
 
83
+ /* The kinds of change the PM can name, each with the jobs it holds (Settings › Claude, How Claude decides). A job in no kind (a role
84
+ * agent's ai:<role>, a goal loop) keeps the automatic rules only. */
85
+ const k = (key, label, jobs) => Object.freeze({ key, label, jobs: Object.freeze(jobs) });
86
+ const KIND_LIST = Object.freeze([
87
+ k('notes', 'Notes on where work stands', ['driver:note']),
88
+ k('problem', 'Problem statements and evidence', ['driver:problem', 'driver:evidence', 'driver:sizing', 'driver:assumption', 'driver:stakeholders', 'driver:overlap']),
89
+ k('experiment', 'The experiment and its next step', ['driver:artefact', 'driver:doc', 'driver:next-step']),
90
+ k('outcome', 'Expected outcomes and check dates', ['propose:outcome']),
91
+ k('names', 'Task names', ['propose:names']),
92
+ k('dates', 'Dates moved by evidence', ['propose:dates']),
93
+ k('status', 'Closing tasks Jira marked Done', ['propose:status']),
94
+ k('description', 'Descriptions and links', ['propose:description', 'propose:links']),
95
+ k('found', 'What Claude found elsewhere', ['propose:found', 'propose:scanned', 'propose:improved', 'propose:prototyped']),
96
+ k('grill', 'Fixes from a check', ['propose:grill']),
97
+ ]);
98
+ const KIND_OF_JOB = new Map(KIND_LIST.flatMap((x) => x.jobs.map((j) => [j, x.key])));
99
+ const kindOf = (job) => KIND_OF_JOB.get(String(job || '')) || null;
100
+ /** The ways the PM set, { kind: way }, from the settings (claude.ways). {} when none or unreadable. */
101
+ function waysSet(settingsDir) {
102
+ if (!settingsDir) return {};
103
+ try {
104
+ const v = require('./settings-store.js').get(settingsDir, 'claude.ways');
105
+ const out = {};
106
+ if (isObj(v)) for (const [kk, w] of Object.entries(v)) if (KIND_LIST.some((x) => x.key === kk) && WAYS.includes(w)) out[kk] = w;
107
+ return out;
108
+ } catch { return {}; }
109
+ }
110
+ /** The automatic way of a kind: ask while demoted, quiet once kept SHOW_UNTIL times, else show. Pure. */
111
+ const autoWay = ({ kept = 0, demoted = false } = {}) => (demoted ? 'ask' : kept >= SHOW_UNTIL ? 'quiet' : 'show');
112
+
70
113
  const classOfDriver = (what) => DRIVER_CLASS[what] || 'C';
71
114
  function classOfProposal(p) {
72
115
  if (!isObj(p)) return 'C';
@@ -112,7 +155,7 @@ function fold(lines) {
112
155
  if (!isObj(l) || typeof l.job !== 'string') continue;
113
156
  const j = get(l.job, l.product);
114
157
  if (l.ev === 'applied') {
115
- const a = { ref: l.ref || null, title: l.title || '', cls: l.cls || null, job: l.job, product: l.product || null, at: l.at, undone: false, undoneAt: null };
158
+ const a = { ref: l.ref || null, title: l.title || '', cls: l.cls || null, job: l.job, product: l.product || null, ini: l.ini || null, why: l.why || '', at: l.at, undone: false, undoneAt: null };
116
159
  j.applied.push(a);
117
160
  if (a.ref) applied.set(a.ref, a);
118
161
  } else if (l.ev === 'setback') {
@@ -148,9 +191,10 @@ function trip(j, now) {
148
191
  return null;
149
192
  }
150
193
 
151
- function recordApplied(stateDir, { job, product, ref, title, cls }, { now } = {}) {
194
+ function recordApplied(stateDir, { job, product, ref, title, cls, ini, why }, { now } = {}) {
152
195
  if (!JOB_RE.test(String(job || ''))) return null;
153
- return append(stateDir, { ev: 'applied', job, product: product || null, ref: ref ? one(ref, 120) : null, title: one(title, 200), cls: CLASSES.includes(cls) ? cls : null }, { now });
196
+ return append(stateDir, { ev: 'applied', job, product: product || null, ref: ref ? one(ref, 120) : null, title: one(title, 200), cls: CLASSES.includes(cls) ? cls : null,
197
+ ...(ini ? { ini: one(ini, 80) } : {}), ...(why ? { why: one(why, 200) } : {}) }, { now });
154
198
  }
155
199
 
156
200
  /** THE HOOK for an Undo, a revert or a verifier FAIL. Writes the setback and, when it trips, the demotion. */
@@ -182,7 +226,12 @@ function decide({ stateDir, job, product, cls, mode = 'auto', undoable = true, n
182
226
  if (mode !== 'auto') return { apply: false, why: `the mode is ${mode}` };
183
227
  if (cls === 'C' || !CLASSES.includes(cls)) return { apply: false, why: 'class C: seen by others or not reversible, so it waits for the daily press' };
184
228
  if (!undoable) return { apply: false, why: 'no Undo for this change, so it waits' };
185
- const d = demotedNow(fold(read(stateDir)), job, product, now);
229
+ const set = waysSet(settingsDir)[kindOf(job)];
230
+ if (set === 'ask') return { apply: false, why: 'you set this kind to Ask first' };
231
+ if (set) return { apply: true, why: `class ${cls}: applied with Undo, as you set this kind` };
232
+ // a demotion holds for its whole kind (How Claude decides: "two Undos on a kind and it asks first"), so evidence waits when problems were undone
233
+ const st = fold(read(stateDir)), kind = KIND_LIST.find((x) => x.key === kindOf(job));
234
+ const d = (kind ? kind.jobs : [job]).map((j) => demotedNow(st, j, product, now)).find(Boolean) || null;
186
235
  if (d) return { apply: false, why: `back to propose until ${d.until.slice(0, 10)}: ${d.why}` };
187
236
  return { apply: true, why: `class ${cls}: applied with Undo` };
188
237
  }
@@ -205,15 +254,63 @@ function notices(stateDir, { now } = {}) {
205
254
  }
206
255
  const markSeen = (stateDir, n, { now } = {}) => append(stateDir, { ev: 'seen', job: n.job, product: n.product || null, until: n.until }, { now });
207
256
 
257
+ /** The one-line reason a change shows beside its Undo (agent-run workspace, board AwA: "each change says why"). Honest from the ledger:
258
+ * a kind the PM kept before is done quietly and says how often; the first of its kind is done and shown; the evidence follows when the
259
+ * change carries one. Pure. */
260
+ function reasonOf({ cls = null, why = '', kept = 0, way = null } = {}) {
261
+ const w0 = WAYS.includes(way) && way !== 'ask' ? way : autoWay({ kept });
262
+ const times = kept === 1 ? 'once' : kept + ' times';
263
+ const how = w0 === 'quiet' ? (kept > 0 ? 'Did it quietly. You kept this kind ' + times + ' before.' : 'Did it quietly, as you set this kind.')
264
+ : kept > 0 ? 'Did it and showed you. You kept this kind ' + times + (way === 'show' ? ' before; you asked to see it.' : '; it shows until you keep ' + SHOW_UNTIL + '.')
265
+ : 'Did it and showed you. It is the first of its kind' + (cls === 'A' ? ', and it is upkeep with one right answer.' : '.');
266
+ const w = one(why, 200);
267
+ return w ? how + ' ' + w.replace(/\.?$/, '.') : how;
268
+ }
269
+
208
270
  /** The Done group: what agents applied by themselves in the last `days` days and nobody undid, newest first. */
209
- function done(stateDir, { now, days = UNDO_DAYS } = {}) {
271
+ function done(stateDir, { now, days = UNDO_DAYS, settingsDir = null } = {}) {
210
272
  const t = now == null ? Date.now() : now;
211
273
  const since = t - days * DAY;
274
+ const set = waysSet(settingsDir);
212
275
  const out = [];
213
- for (const j of fold(read(stateDir)).jobs.values()) for (const a of j.applied) if (!a.undone && Date.parse(a.at) >= since) out.push(a);
276
+ for (const j of fold(read(stateDir)).jobs.values()) {
277
+ let kept = 0;
278
+ const own = set[kindOf(j.job)] || null;
279
+ for (const a of j.applied) {
280
+ if (!a.undone && Date.parse(a.at) >= since) {
281
+ const way = own && own !== 'ask' ? own : autoWay({ kept });
282
+ out.push({ ...a, kept, way, reason: reasonOf({ cls: a.cls, why: a.why, kept, way: own }) });
283
+ }
284
+ if (!a.undone) kept++;
285
+ }
286
+ }
214
287
  return out.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
215
288
  }
216
289
 
290
+ /** How Claude decides, per kind, over the state folders of every product (Settings › Claude). made: changes applied by itself; kept: the
291
+ * ones nobody undid; undone; way: what Claude does now; set: the PM's way or null; auto: the automatic way; until: the end of a demotion.
292
+ * Only the kinds with a change or a way the PM set are listed (zero is silence), most made first. */
293
+ function kindsOf(dirs, { now, settingsDir = null } = {}) {
294
+ const t = now == null ? Date.now() : now;
295
+ const set = waysSet(settingsDir);
296
+ const acc = new Map(KIND_LIST.map((x) => [x.key, { made: 0, kept: 0, undone: 0, until: null }]));
297
+ for (const d of dirs || []) {
298
+ const st = fold(read(d));
299
+ for (const j of st.jobs.values()) {
300
+ const kk = kindOf(j.job); if (!kk) continue;
301
+ const a = acc.get(kk);
302
+ a.made += j.applied.length;
303
+ a.undone += j.applied.filter((x) => x.undone).length;
304
+ a.kept += j.applied.filter((x) => !x.undone).length;
305
+ if (j.demote && Date.parse(j.demote.until) > t && (!a.until || j.demote.until > a.until)) a.until = j.demote.until;
306
+ }
307
+ }
308
+ return KIND_LIST.map((x) => {
309
+ const a = acc.get(x.key), auto = autoWay({ kept: a.kept, demoted: !!a.until });
310
+ return { kind: x.key, label: x.label, made: a.made, kept: a.kept, undone: a.undone, auto, set: set[x.key] || null, way: set[x.key] || auto, until: a.until };
311
+ }).filter((x) => x.made || x.set).sort((p, q) => q.made - p.made);
312
+ }
313
+
217
314
  /** May this applied change still be undone (within 14 days, not undone yet)? */
218
315
  function undoOpen(stateDir, ref, { now } = {}) {
219
316
  const a = fold(read(stateDir)).applied.get(ref);
@@ -230,6 +327,7 @@ function restore(stateDir, { job, product }, actor, { now } = {}) {
230
327
  }
231
328
 
232
329
  module.exports = {
330
+ WAYS, SHOW_UNTIL, KIND_LIST, kindOf, waysSet, autoWay, kindsOf,
233
331
  LEDGER, CLASSES, DRIVER_CLASS, PROPOSAL_CLASS, DEMOTE_DAYS, UNDO_DAYS, RATE_LIMIT, RATE_MIN, KINDS,
234
- classOfDriver, classOfProposal, killed, autoFor, file, read, fold, recordApplied, recordSetback, decide, demotedNow, notices, markSeen, done, undoOpen, restore,
332
+ classOfDriver, classOfProposal, killed, autoFor, file, read, fold, recordApplied, reasonOf, recordSetback, decide, demotedNow, notices, markSeen, done, undoOpen, restore,
235
333
  };
@@ -60,6 +60,11 @@ module.exports = {
60
60
  for (const sc of scopes) { const dk = '/api/ready-reports/dashboard?' + new URLSearchParams({ ws, scope: sc }).toString(); const d = await via(RRoutes, dk, req, ctx); if (d.body && d.body.ok) answers[dk] = d.body; }
61
61
  const ik = '/api/boards/items?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board); const it = await via(Boards, ik, req, ctx); if (it.body && it.body.ok) answers[ik] = it.body;
62
62
  }
63
+ // the product's story (board AwF): the same Narrative as its page, above the timeline; the pack drops the sources
64
+ if (selection.some((s) => s.kind === 'product')) {
65
+ const sk = '/api/artefacts/story?ws=' + encodeURIComponent(ws); const st = await via(require('./routes-artefacts.js'), sk, req, ctx);
66
+ if (st.body && st.body.ok && st.body.story) answers[sk] = st.body;
67
+ }
63
68
  const meta = { by: q.get('by') || '', at: q.get('at') || '', ends: q.get('ends') || '', viewer: q.get('viewer') || '', hub: q.get('hub') || '', view: q.get('view') || '' };
64
69
  ctx.json(res, { ok: true, pack: Pack.buildPack({ ws, board, selection, answers, meta }) });
65
70
  } catch (e) { return bad(String((e && e.message) || e).slice(0, 240), /not on this board|Pick at least|at most 2 MB|product, a program/.test(String(e && e.message)) ? 400 : 500); }
@@ -8,7 +8,8 @@
8
8
  * ws, board the board the answers are from (a product is a board)
9
9
  * selection [{ kind: 'product' | 'program' | 'initiative', id }], one or more; the pack holds the union
10
10
  * answers { '/api/…?query': body } — the Board's GET answers, as the workspace's own routes gave them. Pure: nothing is read here.
11
- * The one program and product page (batch 21 item 2) reads two more: /api/ready-reports/dashboard (teammateDash) and /api/boards/items
11
+ * The one program and product page (batch 21 item 2) reads two more: /api/ready-reports/dashboard (teammateDash) and /api/boards/items;
12
+ * a product carries its story, /api/artefacts/story, as text lines only (board AwF: no sources, no Claude's activity)
12
13
  * meta { by, at, ends, viewer, hub? } — shown on the one line above the Board, and the version of the Board's code that reads the pack
13
14
  * assertSize(pack) throws the host's limit (2 MB, H5)
14
15
  *
@@ -173,6 +174,11 @@ function buildPack({ ws, board, selection, answers, meta }) {
173
174
  if (Array.isArray(body.items)) body.items = body.items.filter((t) => t && R.keep.has(t.ini));
174
175
  if (Array.isArray(body.initiatives)) body.initiatives = body.initiatives.filter((x) => x && R.keep.has(x.id || x));
175
176
  responses[k] = sweep(settled(body), needles) || {};
177
+ } else if (p === '/api/artefacts/story') {
178
+ // "The story so far" (board AwF): a stakeholder reads the same story as the product page, without its sources or Claude's activity
179
+ const st = R.wholeBoard && answers[k] && answers[k].story;
180
+ const lines = st && Array.isArray(st.lines) ? st.lines.map((l) => sweep(String((l && l.text) || ''), needles)).filter((x) => x) : [];
181
+ if (lines.length) responses[p + '?' + new URLSearchParams({ ws: q.get('ws') || ws }).toString()] = { ok: true, ws: q.get('ws') || ws, story: { at: st.at || null, lines: lines.map((text) => ({ text })) } };
176
182
  } else if (p === '/api/initiative-layout') {
177
183
  if (R.keep.has(q.get('initiative'))) responses[k] = sweep(clone(answers[k]), needles) || {};
178
184
  }
@@ -137,9 +137,14 @@ async function autoApply({ file, proposal, actor, ctx = {}, now, stateDir, produ
137
137
  const cls = A.classOfDriver(p.what);
138
138
  const d = A.decide({ stateDir, job: jobOf(p), product, cls, mode: m, undoable: UNDOABLE.has(p.what), now, settingsDir: ctx.settingsDir || null });
139
139
  if (!d.apply) return { applied: false, why: d.why, cls };
140
+ // board AwB: a line of an artefact the PM edited is the PM's now; Claude's change to it waits as a proposal
141
+ if (p.what === 'artefact' && ctx.root) {
142
+ const AR = require('./artefacts.js');
143
+ try { if (AR.pmEdited(AR.fold(AR.readLines(AR.file(AR.dirOf(ctx.root)))), p.data || {})) return { applied: false, why: 'the PM edited this line, so Claude asks first', cls }; } catch { /* no artefacts yet: nothing edited */ }
144
+ }
140
145
  const r = await decide('keep', { file, proposal, actor, ctx, now, auto: true });
141
146
  if (!r.ok) return { applied: false, why: r.error, cls };
142
- A.recordApplied(stateDir, { job: jobOf(p), product, ref: p.id, title: `${p.what}: ${p.why}`, cls }, { now });
147
+ A.recordApplied(stateDir, { job: jobOf(p), product, ref: p.id, title: `${p.what}: ${p.why}`, cls, ini: p.target && p.target.kind === 'initiative' ? p.target.id : null }, { now });
143
148
  return { applied: true, why: d.why, cls, wrote: r.wrote };
144
149
  } catch (e) { return { applied: false, why: 'the apply failed: ' + String((e && e.message) || e).slice(0, 160) }; }
145
150
  }