create-pmos 0.427.0 → 0.429.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 (147) hide show
  1. package/package.json +25 -25
  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/board-programs-test.js +16 -2
  7. package/workspace/briefing-premium-board-test.js +27 -22
  8. package/workspace/briefing-premium-insights-test.js +81 -60
  9. package/workspace/briefing-premium-metrics-test.js +5 -3
  10. package/workspace/briefing-premium-sources-test.js +5 -5
  11. package/workspace/briefing-premium-test.js +7 -5
  12. package/workspace/changelog.json +24 -0
  13. package/workspace/ev-everywhere-test.js +2 -2
  14. package/workspace/guide/briefing-premium.md +4 -2
  15. package/workspace/guide/home.md +34 -7
  16. package/workspace/guide/index.md +1 -0
  17. package/workspace/guide/metric-drafts.md +48 -0
  18. package/workspace/guide/programs.md +1 -0
  19. package/workspace/home-other-product-test.js +12 -2
  20. package/workspace/intel-report-ui-test.js +189 -0
  21. package/workspace/lib/board-metrics-premium.js +1 -1
  22. package/workspace/lib/headless.js +15 -2
  23. package/workspace/lib/insights-premium.js +5 -1
  24. package/workspace/lib/insights-records.js +14 -5
  25. package/workspace/lib/intel-report.js +419 -0
  26. package/workspace/lib/metric-draft-runs.js +193 -0
  27. package/workspace/lib/metric-drafts.js +231 -0
  28. package/workspace/lib/metrics-cli.js +104 -0
  29. package/workspace/lib/pmos-verbs.js +3 -0
  30. package/workspace/lib/report-setups.js +29 -13
  31. package/workspace/lib/route-modules.js +1 -0
  32. package/workspace/lib/routes-insights-premium.js +2 -2
  33. package/workspace/lib/routes-insights-records.js +13 -5
  34. package/workspace/lib/routes-meeting-material.js +22 -1
  35. package/workspace/lib/routes-metric-drafts.js +141 -0
  36. package/workspace/lib/routes-phone-day.js +13 -2
  37. package/workspace/lib/routes-report-setups.js +92 -3
  38. package/workspace/lib/routes-viewer.js +5 -2
  39. package/workspace/lib/settings-store.js +14 -0
  40. package/workspace/metric-drafts-ui-test.js +209 -0
  41. package/workspace/milestone-pins-test.js +13 -0
  42. package/workspace/milestone-suggest-test.js +10 -4
  43. package/workspace/package-lock.json +2 -2
  44. package/workspace/package.json +1 -1
  45. package/workspace/premium-board-actions-test.js +40 -13
  46. package/workspace/premium-phone-card-test.js +8 -5
  47. package/workspace/premium-rec-tab-test.js +8 -0
  48. package/workspace/premium-vw-item-test.js +7 -3
  49. package/workspace/premium-vw-jira-test.js +2 -1
  50. package/workspace/program-charter-test.js +1 -1
  51. package/workspace/program-leave-test.js +2 -2
  52. package/workspace/program-order-test.js +3 -2
  53. package/workspace/program-panel-test.js +2 -1
  54. package/workspace/public/pm/bd-acts.js +23 -29
  55. package/workspace/public/pm/bd-ini-panel.js +90 -32
  56. package/workspace/public/pm/bd-pin-card.css +4 -4
  57. package/workspace/public/pm/bd-pin-card.js +4 -1
  58. package/workspace/public/pm/bd-prog-panel.js +9 -4
  59. package/workspace/public/pm/bd-span.js +22 -12
  60. package/workspace/public/pm/cozy-aud.css +1 -1
  61. package/workspace/public/pm/cozy-board.css +256 -256
  62. package/workspace/public/pm/cozy-ev.css +45 -45
  63. package/workspace/public/pm/cozy-evmodel.js +1 -1
  64. package/workspace/public/pm/cozy-home-rows.css +23 -23
  65. package/workspace/public/pm/cozy-home.css +207 -207
  66. package/workspace/public/pm/cozy-insights.css +207 -108
  67. package/workspace/public/pm/cozy-live-pill.css +5 -5
  68. package/workspace/public/pm/cozy-mtg-present.css +23 -23
  69. package/workspace/public/pm/cozy-nav.js +1 -1
  70. package/workspace/public/pm/cozy-news.js +2 -2
  71. package/workspace/public/pm/cozy-panel.css +29 -29
  72. package/workspace/public/pm/cozy-pick.css +5 -5
  73. package/workspace/public/pm/cozy-rec-now.css +20 -20
  74. package/workspace/public/pm/cozy-rec-present.css +11 -11
  75. package/workspace/public/pm/cozy-rec-tab.css +13 -13
  76. package/workspace/public/pm/cozy-rec-tab.js +12 -3
  77. package/workspace/public/pm/cozy-settings.js +1 -1
  78. package/workspace/public/pm/cozy-steps.css +9 -9
  79. package/workspace/public/pm/cozy-today.css +107 -71
  80. package/workspace/public/pm/cozy-viewer.css +7 -7
  81. package/workspace/public/pm/cozy-viewer.js +157 -23
  82. package/workspace/public/pm/cozy-vw-mtg.css +81 -81
  83. package/workspace/public/pm/cozy-vw-rp.css +53 -53
  84. package/workspace/public/pm/cozy-vw-shell.css +34 -21
  85. package/workspace/public/pm/cozy-vw.css +117 -117
  86. package/workspace/public/pm/cozy-xv.css +11 -11
  87. package/workspace/public/pm/cozy.css +18 -15
  88. package/workspace/public/pm/hi-pop.css +82 -0
  89. package/workspace/public/pm/hi-pop.js +65 -0
  90. package/workspace/public/pm/home-app.js +83 -28
  91. package/workspace/public/pm/home-day.js +131 -26
  92. package/workspace/public/pm/home-ini.css +38 -108
  93. package/workspace/public/pm/home-ini.js +50 -68
  94. package/workspace/public/pm/home-line.css +7 -7
  95. package/workspace/public/pm/home-list.js +41 -4
  96. package/workspace/public/pm/home-phone-card.js +18 -15
  97. package/workspace/public/pm/home-today.js +18 -7
  98. package/workspace/public/pm/ini-more.js +67 -0
  99. package/workspace/public/pm/ini-view-model.js +3 -2
  100. package/workspace/public/pm/ini-view.css +104 -102
  101. package/workspace/public/pm/ini-view.js +16 -8
  102. package/workspace/public/pm/loose-props.css +13 -13
  103. package/workspace/public/pm/metric-drafts.css +82 -0
  104. package/workspace/public/pm/metric-drafts.js +165 -0
  105. package/workspace/public/pm/ms-suggest.css +8 -8
  106. package/workspace/public/pm/order-model.js +85 -0
  107. package/workspace/public/pm/ov-view.css +12 -12
  108. package/workspace/public/pm/premium-board.js +57 -11
  109. package/workspace/public/pm/premium-chart-tab.js +6 -6
  110. package/workspace/public/pm/premium-insights.js +306 -105
  111. package/workspace/public/pm/premium-report-intel.css +56 -0
  112. package/workspace/public/pm/premium-report-intel.js +232 -0
  113. package/workspace/public/pm/premium-shell.js +2 -2
  114. package/workspace/public/pm/premium-vw-file.js +2 -2
  115. package/workspace/public/pm/premium-vw-item.js +3 -1
  116. package/workspace/public/pm/premium-vw-jira.js +2 -0
  117. package/workspace/public/pm/premium.css +127 -128
  118. package/workspace/public/pm/prog-order.css +6 -6
  119. package/workspace/public/pm/prog-order.js +15 -2
  120. package/workspace/public/pm/program-charter.css +23 -23
  121. package/workspace/public/pm/rp-parts.js +2 -2
  122. package/workspace/public/pm/sort-order.css +17 -0
  123. package/workspace/public/pm/sort-order.js +108 -0
  124. package/workspace/public/pm/split-merge.css +15 -15
  125. package/workspace/public/pm/task-card.css +21 -21
  126. package/workspace/public/pm/tk-tasks.css +37 -37
  127. package/workspace/public/pm/tk-view.css +6 -6
  128. package/workspace/public/pm/tk-view.js +3 -2
  129. package/workspace/public/pm/wf-page.css +28 -28
  130. package/workspace/public/pm/wf-page.js +1 -1
  131. package/workspace/public/premium-board.html +1 -0
  132. package/workspace/public/premium-intelligence.html +82 -0
  133. package/workspace/server.js +38 -3
  134. package/workspace/skills/metric-draft.skill +47 -0
  135. package/workspace/sort-order-test.js +201 -0
  136. package/workspace/stage-card-test.js +1 -0
  137. package/workspace/task-card-test.js +1 -1
  138. package/workspace/test-lists/intel-report-ui.json +5 -0
  139. package/workspace/test-lists/intel-report.json +9 -0
  140. package/workspace/test-lists/metric-drafts-ui.json +5 -0
  141. package/workspace/test-lists/metric-drafts.json +9 -0
  142. package/workspace/test-lists/sort-order.json +6 -0
  143. package/workspace/test-lists/viewer-trail.json +5 -0
  144. package/workspace/test-run.js +3 -0
  145. package/workspace/tk-tasks-test.js +5 -3
  146. package/workspace/viewer-trail-test.js +145 -0
  147. package/workspace/public/premium-insights.html +0 -81
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
  /* ev-everywhere-test.js — the Everywhere parts (initiative premium-uncovered-features, E1 to E4; canvas EvMenu, EvSearch, EvInbox, EvSources,
4
4
  * EvSettings, EvStates, EvDark, EvPhone). The real server with one scratch product repository that has a worktree with a draft.
5
- * U1 the place menu: Home, Board, Insights, then Search, New for you, Sources, Settings and Theme; More only on Home
5
+ * U1 the place menu: Home, Board, Intelligence, then Search, New for you, Sources, Settings and Theme; More only on Home
6
6
  * S1 Ctrl K opens Search over the page; typing finds a document on main and a draft on the worktree; the kind chips narrow; Escape closes
7
7
  * S2 the worktree chip lists the worktree and leaving it out drops its draft; S3 a result opens in the Viewer
8
8
  * N1 New for you opens in the Viewer, with the rows the old Around you held named under Where the rest went; nothing is posted on open
@@ -83,7 +83,7 @@ const put = (root, rel, text) => { fs.mkdirSync(path.dirname(path.join(root, rel
83
83
  const { ctx, pg, errors, posts } = await open();
84
84
  await menu(pg);
85
85
  const m = await pg.evaluate(() => ({ links: [...document.querySelectorAll('#czMenu a')].map((a) => a.textContent.trim()), items: [...document.querySelectorAll('#czMenu .ev-mi')].map((b) => b.textContent.replace(/\s+/g, ' ').trim()), more: !!document.querySelector('#czMenu [data-cz-more]'), theme: [...document.querySelectorAll('#czMenu [data-ev-theme]')].map((b) => b.textContent) }));
86
- ok('U1 the menu holds Home, Board, Insights, then Search, New for you, Sources and Settings, More (on Home) and Theme', m.links.join() === 'Home,Board,Insights' && /^Search/.test(m.items[0]) && /^New for you/.test(m.items[1]) && /^Sources/.test(m.items[2]) && /^Settings/.test(m.items[3]) && m.more && m.theme.join() === 'Light,Dark,Auto', JSON.stringify(m));
86
+ ok('U1 the menu holds Home, Board, Intelligence, then Search, New for you, Sources and Settings, More (on Home) and Theme', m.links.join() === 'Home,Board,Intelligence' && /^Search/.test(m.items[0]) && /^New for you/.test(m.items[1]) && /^Sources/.test(m.items[2]) && /^Settings/.test(m.items[3]) && m.more && m.theme.join() === 'Light,Dark,Auto', JSON.stringify(m));
87
87
  await snap(pg, 'menu-1440-light');
88
88
  await pg.keyboard.press('Escape');
89
89
  ok('U2 Escape closes the menu', await until(() => pg.isHidden('#czMenu')));
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "The premium Briefing (/premium.html)"
4
4
  description: "The Briefing page at /premium.html: the hero sentence, What you need to do, Today, the dock, and what each one reads from the repository."
5
- timestamp: 2026-10-26
5
+ timestamp: 2026-10-27
6
6
  ---
7
7
 
8
8
  # The premium Briefing
@@ -288,6 +288,8 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
288
288
 
289
289
  **Leads written after each refresh.** PMOS keeps a short list of the popups you opened in the last 14 days, with what each one showed. Forms such as Add a task and Settings are left out. Opening a popup only adds it to that list and starts nothing. When a read of your tools ends well, and once no other read is going, one **Popup leads** session writes the lead of each popup on the list whose lead is missing or older than the newest stored read, at most 12. Refresh all runs it after the reads and before the Briefing. It reads only the stored reads and the repository, never a tool, and runs only when a lead is due. `pmos lead due` lists the popups it will write for. Popup leads is on whenever the Briefing is, and you can turn it off under Settings › Data refresh.
290
290
 
291
+ **A Jira ticket's header and description.** The header shows the key and the ticket's title, for example "MSD-4329 Try out the different options". The description is PMOS's copy, from the initiative's ticket draft, so it says **PMOS's copy, Jira may differ**. PMOS does not read the description in Jira. Status and the other facts come from the Jira read.
292
+
291
293
  **A Jira ticket PMOS has not read.** A task's Jira tab first looks in the initiative's ticket draft and the sprint reads. When neither holds the ticket, it shows the newest Jira check that read it, or else what the stored Jira read says about it, and names which one. When nothing stored holds it, the tab says **Not read yet**, gives the time of the last Jira read, and offers **Read it now**. Read it now asks the popup's own Claude session to read that one ticket with your Atlassian connection, read only, and to save the popup's lead. Nothing reads Jira when the tab opens.
292
294
 
293
295
  **A Board measure popup.** On Insights, a measure's popup first says what the numbers are: this week's value, the change from last week, and the target. For Merged a week it also says when the trunk was last fetched, and the details list it as **Trunk read**. When the last two weeks are 0 after a busy week, it says that is a quiet trunk or an old fetch, and gives the fetch time, so you can tell which. PMOS does not fetch when the popup opens.
@@ -326,7 +328,7 @@ Board is the fourth place on the rail, after Chat, at `/premium-board.html`. It
326
328
  - **The view chip** in the Initiatives head says which view is shown (List, By stage or Timeline); press it to pick another.
327
329
  - **List** shows the late and at-risk initiatives first, then the board's now view, up to 100 loaded and 25 on screen at a time. A row shows the owner and lane, a status chip when it is not on track, how far through the workflow it is (and "derived" when the workflow engine placed it), a progress bar only when a record holds progress, and the planned finish only when an end date was set ("Not planned" otherwise). "Do this first" appears only when the first row is late.
328
330
  - **By stage** has one column for each stage of the board's workflow with the board's own count and its first five initiatives.
329
- - **List** and **Timeline** show ten tasks a page with Previous and Next; **By stage** shows six cards a column with Show more. **Timeline** draws a bar for each initiative that has dates, with the days left or over, and counts the rest. A bar runs from the earliest start to the latest due date of the initiative's breakdown items and its tasks. Every stage shows, Monitor and Evaluate too. Under a program, every initiative of the program has a row; one with no dates says **No dates** beside today. In each group the rows run by start date, then end date, and the ones with no dates come last; the status dot still marks a late or at-risk initiative. With no dates on record it says so and draws nothing. A gap in the plan that overlaps a hold still leaves out the days outside the hold, also when the hold has no return date.
331
+ - **List** and **Timeline** show ten tasks a page with Previous and Next; **By stage** shows six cards a column with Show more. **Timeline** draws a bar for each initiative that has dates, with the days left or over, and counts the rest. A bar runs from the earliest start to the latest due date of the initiative's breakdown items and its tasks. Every stage shows, Monitor and Evaluate too. Under a program, every initiative of the program has a row; one with no dates says **No dates** beside today. A product whose initiatives all have no dates keeps its row too, with each initiative saying **No dates**, so the product is never missing from the Board. In each group the rows run by start date, then end date, and the ones with no dates come last; the status dot still marks a late or at-risk initiative. With no dates on record it says so and draws nothing. A gap in the plan that overlaps a hold still leaves out the days outside the hold, also when the hold has no return date.
330
332
  - **Sprint** appears when an agent session has read Jira for the board. Otherwise it says there is none. Press it to open the sprint's facts, with the sprint as a board in a second tab: **To do**, **In progress** and **Done** columns from the last Jira read, with the dates, the days left and the points. The sprint goal is the one the Jira status check writes from the sprint's tickets, as on the console's Sprints tab, with its summary; Jira's own goal shows under it only as a reference (**In Jira: "…"**). Until the check has written one, the tab says **No goal yet**. The active and next sprints are buttons at the top. The closed sprints are behind **Past sprints**, which is shut until you press it. Press any card to open its ticket in another tab. A ticket that is on no initiative of this board shows what the sprint read holds (title, status, points and its Jira link). The board is read only: Jira owns each ticket's status and sprint, so you move tickets in Jira. Tickets with no sprint are not in this read. **Coming up** shows the next release, from the releases ledger.
331
333
  - **Open the backlog** is in the Sprint dialog and on its sprint tab. It opens the board's Jira backlog in a tab beside the dialog: the open sprints (active, then next) and then **Backlog**, the tickets in no sprint and not done. A row shows the key, title, status, points and initiative, and why a blocked ticket is blocked. **All**, **Blocked** and **Bugs** filter it (Bugs appears only when the Jira read holds the issue type). A row opens its ticket. The list holds only the tickets the board's initiatives pushed to Jira or hold under their epics, in key order: the Jira read has no rank, assignee or capacity. You move and rank tickets in Jira. With no Jira read, the tab says so.
332
334
  - **Next release** shows the next release that carries an initiative of this board, the one planned after it, and the three latest past releases (**Released** when accepted, else **Past**). It reads the release records (`releases/releases.jsonl`, written from the console's Releases view); Jira fix versions alone do not make a release. With no release planned it says so and still lists the past ones. With none at all it says "No release is on record for this board, past or planned."
@@ -2,17 +2,20 @@
2
2
  type: Guide
3
3
  title: "Home (/premium.html) and the designed features"
4
4
  description: "Home in the Agreed design: the list grouped by product, the Viewer, the place menu, New for you, Search, and the initiative, meeting, report, Board and Insights features designed after it."
5
- timestamp: 2026-10-26
5
+ timestamp: 2026-10-27
6
6
  ---
7
7
 
8
8
  # Home
9
9
 
10
10
  Home is the page at `/premium.html`. It follows the Agreed design and the "Uncovered features" canvas (initiative `premium-uncovered-features`). The left side is one list. The middle is the chat. The right side is the Viewer. A row opens its item in the Viewer. On a phone the list is the page, and a row opens its conversation with a back bar.
11
11
 
12
+ Home, the Board, Insights and the Viewer use one type scale: 11, 12, 14, 16, 20 and 28 px. A list row's name is 14 px on a desktop and 16 px on a phone, a group head is 16 px, the quiet meta line and a chip are 12 px, a badge is 11 px, a page title is 20 px and a large number is 28 px. The same kind of text has the same size on every page; weight and colour make the difference, not a half pixel.
13
+
12
14
  ## The list
13
15
 
14
16
  - The top line has **Good morning**, the product picker, the filter icon (on a desktop) and **New**. The line under it says how many items are yours, for example "4 are yours".
15
- - Press **Good morning** to open **Your day**. Your day shows the date, the meetings of the day, **Your move** (the items that wait on you, with their count) and **This week** (the Weekly review). Your move shows only in Your day, not in the list.
17
+ - On a computer, press **Good morning** to open the calendar in the Viewer. The list already shows each item that waits on you, under its initiative. A program's milestone changes that wait on you are the first line of the program's card.
18
+ - On a phone, press **Good morning** to open **Your day**. Your day shows the date, the meetings of the day, **Your move** (the items that wait on you, with their count) and **This week** (the Weekly review).
16
19
  - A **program** comes first, above the products. Its header shows the program icon, its name, the next milestone (◆ and the date) and how many of its initiatives are ready for that milestone. Inside it, the program's own tasks come first, then its initiatives under a small heading for each product. Each initiative shows once. Press the program's name to open the program in the Viewer. The chat then talks about the program. Press the chevron to close or open the group.
17
20
  - The **product picker** is the chip on the top line. It shows the tiles of the ticked products, overlapped, with **+N** after 3, or **All** when every product is ticked. It shows even with one product. Hold the pointer on it to read the names. Press it to open the list: **All products**, then each product with its tile, its name and one line (for example "3 initiatives · 1 of 2 goals"), then **Add a product**. Press a product to tick or untick it; the list stays open, and the last ticked product stays ticked. The pick applies when the list closes (Escape, a press outside, or the chip again). On a phone the list is a sheet at the bottom. The pick is one saved setting (`ws.briefing.include`) that Home, the Board and Insights share, so a product that you untick on one page goes from all three. With **All** ticked, a product that you add later is ticked too. The **Product** row in Settings opens the same list.
18
21
  - A program with no open initiative yet still shows, with "No initiatives yet" or "No open initiatives". A program shows only when it holds work of a ticked product. Home reads again when you come back to its tab, so a program made on the Board shows at once.
@@ -51,22 +54,41 @@ Press an initiative's name in the list, or open `?ini=<id>`. The list stays as i
51
54
  - 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. A thin tick is Today.
52
55
  - 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.
53
56
  - The line also shows what the Board's timeline shows: » for a skipped stage, a dotted gap and ⏸ for a hold (press ⏸ to set or change the return date), a hairline for 2 weeks or more with no activity (press it; ahead of Today, + adds a task in the gap), hatching past the end date, a dashed Jira forecast, a thin line under it for a saved plan, and "after <initiative>" when it waits on another initiative.
57
+ - A cancelled, done or archived initiative leaves Home, and so do the next steps that were for it.
54
58
  - With no dates at all, the parts are even and dashed. The calendar button opens **Tasks** in the Timeline view to set the dates.
55
59
  - On a phone the line shows only the next open milestone's name. Press the line to unfold the stages and milestones as a list under it.
56
60
  - Under the card are the 3 most urgent tasks and the documents that need a look. **Show N more** opens all the tasks and **Show all N** opens all the documents. ← goes back to the page. A task or a document that you open from the page also has ← back to the page.
57
- - ⋯ has **Moves on by itself**, **Move back a stage**, **Move to a stage**, **Add a stakeholder**, **Turn into a program**, **Open on the Board**, **The record**, **Put on hold** and **Cancel the initiative**.
58
- - To go back to all work, press the browser's Back, or Menu > **Home**. Neither reloads the page. Close (×) closes the page but keeps the initiative's chat.
61
+ - ⋯ is the same menu on Home and on the Board, in the same order. A line separates the groups:
62
+ 1. **Change workflow**, **Rename**, **Moves on by itself**, **Move back a stage**, **Move to a stage**, **Change the plan dates** and **Add a stakeholder**.
63
+ 2. **Split into a new initiative**, **Merge into**, and **Move out of** or **Move to another program**. An initiative that is in no program has **Turn into a program**.
64
+ 3. **Read Jira again** (only when the board reads Jira), **Open on the Board** (only on Home), **The record**, **Copy link** and **Copy as text**.
65
+ 4. **Won't do** (**Back to Triage** after Won't do) and **Archive**.
66
+ 5. **Put on hold** (**Resume** when it is on hold) and **Cancel the initiative**, which is red and last.
67
+ - An item that does not apply does not show. For example, a PMOS-self initiative has no stage moves and no workflow to change. To open the initiative wide, use the expand button in the header.
68
+ - To go back to all work, press the browser's Back, or Menu > **Home**. Neither reloads the page. Close (×) closes the page but keeps the initiative's chat. See [Back and forward](#back-and-forward).
59
69
  - If there is no room beside the chat, the Viewer shows on top of the chat. The list stays.
60
70
  - On a phone the page fills the screen. **Message Claude about <name>** opens the chat.
61
71
  - **Moves on by itself** is a switch, on by default. When every exit item is done, the stage moves to the next stage and a message shows **Undo**. A stage never moves by itself into a milestone (Deliver or Evaluate). This rule is a proposal that the PM has not confirmed yet.
62
72
  - → with open tasks in the stage asks first (**Move anyway**, with a note). **Back** always asks for a reason.
63
73
  - **Tasks** in the Viewer can be grouped by stage, by groups that you name, by owner or by status. Drag a task to another group.
64
- - In the Build stage, the open Jira tickets show with the tasks. A task whose name starts with a Jira key (for example "MSD-4376 Navigation tabs") is that ticket, so the ticket shows once, as the task, and counts once.
74
+ - In the Build stage, the open Jira tickets show with the tasks. A task whose name starts with a Jira key (for example "MSD-4376 Navigation tabs") is that ticket, so the ticket shows once, as the task, and counts once. It looks like the ticket rows: a blue square in place of the box and the key in blue. Its status follows Jira; press its name to open it.
65
75
  - **Set a Jira ticket's dates.** Press the dates of a Jira ticket in the List, or drag its bar on the Timeline, as you do for a task. PMOS keeps the start and due days and shows them in place of the sprint end. Jira does not change. The status and the name stay Jira's.
66
76
  - **Tasks** show one row (one group) for each stage of the workflow, in order. Finished stages and later stages are never merged into one row; they start folded, and the current stage and any stage with a late task start open.
67
77
  - **Delete a task.** Press the caret under a task's box (on a phone, press and hold the box) and press the trash at the end of the status picker. The task goes at once and the message shows **Undo**. The ⋯ menu of a task also has **Delete**. You can delete every PMOS task, also a task that Claude planned in the breakdown. A Jira ticket has no Delete: change it in Jira. A task deleted in a draft leaves only the draft.
68
78
 
69
- ## Rename a program, an initiative or a task
79
+ ## Back and forward
80
+
81
+ The Viewer keeps one trail on Home, the Board and Insights.
82
+
83
+ - A press inside the Viewer keeps the item behind the one it opens. For example: an initiative, then a ticket in its Tasks, then a Linked ticket, then that ticket's epic card. A press on the page outside the Viewer (a row in the list, a row on the Board) starts a new trail.
84
+ - ← goes one step back. Point to it to see where it goes, for example "Back to PSLE Landing Page". At the first item of the trail, a computer shows no ←, and × closes. On a phone, ← at the first item closes the Viewer.
85
+ - → shows only after you go back. It goes one step forward. When you open something new, → goes away, as in a browser.
86
+ - To see the whole trail, point to ← or → on a computer, or hold it on a phone. The list shows the newest item first and ends with the page. Press an item to go to it. Press the page to close the Viewer.
87
+ - The browser's Back and Forward buttons and the back swipe on a phone move along the same trail. Back at the first item closes the Viewer. One more Back goes to the page before.
88
+ - Close (×, Escape) ends the trail. Back then does not open the closed item again.
89
+ - The address keeps the open initiative or program on Home and the Board, and the open goal on Insights. When you go to another page and come back with Back, that item is open again. The rest of its trail is not kept.
90
+
91
+ ## Rename a product, a program, an initiative or a task
70
92
 
71
93
  Press the name in the Viewer's header. The name becomes a field.
72
94
 
@@ -77,6 +99,7 @@ Press the name in the Viewer's header. The name becomes a field.
77
99
  - An initiative with a Jira epic shows **Rename the Jira epic too**. It is off by default. When you select it, Home opens the initiative's chat with the request typed. Send it to let your agent rename the epic in Jira. PMOS does not change Jira itself.
78
100
  - A program has no Jira box. Its goal stays as it is.
79
101
  - A Jira ticket keeps its Jira name. Rename it in Jira.
102
+ - A product's new name is your name for its repository. The folder and the workspace id do not change. Home, the Board, Insights and the product picker show the new name.
80
103
 
81
104
  ## Session names
82
105
 
@@ -115,7 +138,11 @@ There is no My work page. The list on Home is your list:
115
138
 
116
139
  - **Tasks.** An initiative shows its 3 most urgent tasks: yours first, then due today, late, and due this week. **Show N more tasks** shows the rest.
117
140
  - **Your items.** A PM item opens alone, as its own card. There is no Focus chip. Items that nobody touched are in the Weekly review.
118
- - **Add a task.** Press **New**, then **A task**, then choose the initiative, or **Not in an initiative**. Home has no add box that is always open.
141
+ - **New.** Press **+** at the top of the list. It offers four things, and each one lands where you are: the initiative or product that is open, or else Home.
142
+ - **Task.** In an open initiative, the task goes there. On Home, choose an initiative, or **Not in an initiative** (your own list). Home has no add box that is always open.
143
+ - **Chat.** A new session in the open initiative or product. On Home, a loose chat that you link to an initiative later.
144
+ - **Recording.** Record a note now, with no calendar event.
145
+ - **Initiative.** The Board opens with **New initiative**, in the open product.
119
146
  - **Sessions.** A session row names its agent. The coloured dot beside it is its state: blue waits on you, amber may be blocked, green is running. A session PMOS started itself (a skill or a background job) shows on Home only while it works or asks you something. Once it finishes its prompt, it leaves the list. On an initiative's page, a session that waits on you shows once, under **Needs you**, not again under **Sessions**. **Finished sessions** does not list an old run of a chat that is open again.
120
147
  - **One chat box.** Every conversation has the same box: **+** (attach a file, notes, the terminal, and **Link to an initiative** for a loose chat), **/** for commands, **@** inside an initiative, the To or In chip, the mic, and Send. A chat opens at its newest message.
121
148
  - **Documents not written yet.** A document that does not exist yet shows **Draft it**, in its stage or ahead of it. The agent writes a draft. Nothing is issued until you read it.
@@ -67,6 +67,7 @@ On a desktop the workspace is one frame. [Layout](layout.md) explains each part.
67
67
  - [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.
68
68
  - [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`.
69
69
  - [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`.
70
+ - [Claude drafts metrics without being asked](metric-drafts.md): when Claude drafts the metrics of a product, a program or an initiative, keep, drop, Undo, and `pmos metrics draft`.
70
71
  - [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`.
71
72
  - [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`.
72
73
  - [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,48 @@
1
+ ---
2
+ type: Guide
3
+ title: "Claude drafts metrics without being asked"
4
+ description: "When Claude drafts the metrics of a product, a program or an initiative, what each draft says, how you keep or drop it, Undo, how to turn it off, and the pmos metrics draft commands."
5
+ timestamp: 2026-10-27
6
+ ---
7
+
8
+ # Claude drafts metrics without being asked
9
+
10
+ You do not fill in a form to get metrics. When something has no metrics yet, Claude drafts them by itself and shows the drafts on the page. Nothing becomes a metric until you press ✓.
11
+
12
+ ## When Claude drafts
13
+
14
+ - **A product with no North Star.** Claude drafts a North Star, up to 3 inputs and up to 2 guardrails.
15
+ - **A new quarter.** In the first 14 days of a quarter, Claude drafts next quarter's key results from how the last quarter ended.
16
+ - **A program charter with no goal.** Claude drafts the program goal with checkpoints at its milestones, one metric for each product that it rolls up from, and one guardrail.
17
+ - **An initiative that gets a PRD and has no success measure.** Claude drafts how it proves it worked (read 4 weeks after release), one early signal and one guardrail. An initiative that already had its PRD when the workspace first scanned is not drafted by itself. Press Draft again to draft it.
18
+
19
+ Claude drafts each one once. A run that failed tries again the next day. At most 2 runs go at once.
20
+
21
+ ## What a draft says
22
+
23
+ The page shows the run as five steps: read, shape, measure, target and ready. Each source shows one line while Claude reads it.
24
+
25
+ Each row has a name, a type, the number now, a target and why. Every number now comes from the last 8 weeks of real readings, with its source. When no event counts a metric, the row says so and shows the ticket Claude drafted for the event. Claude does not create the ticket.
26
+
27
+ ## Keep, drop and Undo
28
+
29
+ - ✓ keeps one row. It writes one KR metric record and, when the number now is known, its first reading.
30
+ - ✓ in the header keeps every open row.
31
+ - ✕ drops one row.
32
+ - Undo on a kept row retires its record. Undo on a dropped row brings it back.
33
+ - Draft again starts a new run. The rows you kept stay. The rows you did not keep are drafted again.
34
+ - ■ Stop ends a run. What it drafted so far stays on the page.
35
+
36
+ To turn the drafts off, start the workspace with `PMOS_METRIC_DRAFT=off`.
37
+
38
+ ## The commands
39
+
40
+ Claude's background run files its drafts with these commands. The server pins the product, program or initiative and the run, so the commands refuse outside that run. You keep and drop drafts on the page.
41
+
42
+ - `pmos metrics draft read "<source>" --found "<one line>" [--state done|now|wait]`: one source read.
43
+ - `pmos metrics draft step shape|measure|target|ready`: the run moves to the next step.
44
+ - `pmos metrics draft row --json <file|->`: one drafted row, or a list of rows.
45
+ - `pmos metrics draft end --head "<line>" --sub "<line>" --src "<sources>"`: the run is done, with what the page says on top.
46
+ - `pmos metrics draft status`: what is open, kept and dropped.
47
+
48
+ The run writes no record and sends nothing.
@@ -21,6 +21,7 @@ Programs do not change how Insights, the weekly update or sprints count initiati
21
21
  - The **timeline** draws a program row that brackets its initiatives' bars, on every span. Program milestones are diamonds. Milestones that are close together merge into one diamond with a count.
22
22
  - On the timeline, a **product's head row** also shows milestones. Nothing is added by hand: the row shows every milestone of the product's initiatives, which are each milestone task and each initiative's end diamond (its Deliver or Evaluate date). The diamonds are the same as on the initiative rows: open, filled when done, orange when late. Diamonds that are close together merge into one diamond with a count and the date range under it. Press it to see a list with the milestone, its initiative and the date. Press a line to open that initiative. Hold the pointer on a single diamond to see its milestone and initiative. A thin line goes from the first start to the last end of the product's initiatives. When the product is folded, the row stays the same, so it is a summary of the product. On a phone the diamonds have no dates; tap the row to see all the milestones in date order. A product inside a program has no such row, because the program row shows its milestones.
23
23
  - On the timeline, an initiative row shows only its **pinned** milestones. By default that is its last milestone. Press a diamond to see every milestone of the initiative, with how many are on the timeline. Press the pin beside a milestone to show it or to hide it. To see every milestone or none, open **Filter** and pick **Milestones on the timeline: Pinned**, **All** or **None**. The Board keeps your pick. From a terminal: `pmos task set <task> --pin`, `--no-pin`, or `--pin-default` to go back to the default.
24
+ - The label at the end of an initiative row says what lands and when. When a milestone task is in the last milestone stage, or is on the end date, or is in the Deliver stage, the label shows its name and its own date, and the end date of the initiative shows when you hold the pointer on the label. Otherwise the label is **Deliver** (or **Evaluate**) and the end date. Press that end diamond: the card has the same words as the label, then the milestones of the initiative.
24
25
  - **List** has a Product column and a Program column. Press a column header to sort by it.
25
26
  - **New** opens a menu: **New initiative** or **New program**.
26
27
  - A new program shows at once, before any initiative joins it. A program with no open initiative shows on its own product's Board and on All products, with "No initiatives yet" or "No open initiatives". Press its name, then **⋯** and **Move an initiative in**. That menu lists open initiatives only, grouped by product, with the program's own product first, wherever you open the program (Home, another product's Board or All products). An initiative joins in its own product.
@@ -9,6 +9,7 @@
9
9
  * O5 its chat's first message starts a session in Microsites, and "A new session" (In: chip, + New) starts a second one beside it
10
10
  * O6 batch 11 item 10: an initiative `pmos initiative new` made in Microsites sits in Later, so the Microsites model does not list it. Its
11
11
  * next step (tagged ws=microsites) puts it on Home; pressing it reads it from Microsites, never IDPF's board, under its title
12
+ * O8 batch 14 item 9: the product's name in its page's header renames it (POST /api/workspaces/rename), with Undo
12
13
  * O7 the same initiative opened by a link with no next step: the read on IDPF fails, the Microsites one finds it, and its chat is Microsites'
13
14
  * Serves the real page from the real server; the reads are fixtures (fixtures/program-ascent.js through the Board and Home fixtures). */
14
15
  const path = require('path');
@@ -92,6 +93,15 @@ const model = () => { const m = IP.build(F.facts()); return { ...m, id: ID, key:
92
93
  await sleep(500);
93
94
  ok('O3 Home stays on IDPF: no navigation, and the IDPF group is still in the list', opens.length === navs && new URL(page.url()).searchParams.get('ws') === 'idpf' && await page.evaluate(() => [...document.querySelectorAll('#hmList [data-hm-prodopen]')].some((b) => /IDPF/.test(b.getAttribute('aria-label') || ''))), JSON.stringify(opens.slice(navs)) + ' ' + page.url());
94
95
  ok('O3 the chat is the Microsites product\'s own', await page.evaluate(() => (document.querySelector('#hmChat textarea, textarea') || {}).placeholder === 'Message Claude about Microsites'));
96
+ // O8 batch 14 item 9 (Wawan, "Should be able to rename product"): the product's name in its page's header is the rename press. It saves
97
+ // the PM's name for the repository (POST /api/workspaces/rename, the id stays) and the header shows the new name.
98
+ const renames = [];
99
+ await page.route('**/api/workspaces/rename', (r) => { renames.push(JSON.parse(r.request().postData() || '{}')); return json(r, { ok: true, workspace: { id: 'microsites', name: 'Microsites web', label: 'Microsites web' } }); });
100
+ const rnBtn = await until(() => page.evaluate((v) => { const b = document.querySelector(v + ' [data-cz-vw-rn]'); if (!b || !/Microsites/.test(b.textContent)) return false; b.click(); return true; }, V), 5000);
101
+ ok('O8 the product\'s name in its page header is a rename press', rnBtn);
102
+ if (rnBtn) { await page.fill(V + ' [data-cz-vw-ren] input', 'Microsites web'); await page.keyboard.press('Enter'); }
103
+ ok('O8 it saves the name for the Microsites repository', await until(() => renames.length === 1, 5000) && renames[0].id === 'microsites' && renames[0].name === 'Microsites web', JSON.stringify(renames));
104
+ ok('O8 the header shows the new name, with Undo in the toast', await until(() => page.evaluate((v) => /Microsites web/.test((document.querySelector(v + ' #czVwTitle') || {}).textContent || '') && /Undo/.test((document.querySelector('#toast') || {}).textContent || ''), V), 5000));
95
105
  // O5 a product's chat starts its first session and, like an initiative, a new one beside it (batch 9 item 3, Wawan 2026-10-26: "I can't
96
106
  // initiate a new session" on pmos-scarlet). Each send asks with the product's own key in its own workspace; a new session has the next key.
97
107
  const asks = [];
@@ -105,8 +115,8 @@ const model = () => { const m = IP.build(F.facts()); return { ...m, id: ID, key:
105
115
  await page.fill('#hmIn', 'A second thread'); await page.keyboard.press('Enter');
106
116
  ok('O5 it sends with the next key, so a second session starts beside the first', await until(() => asks.length === 2, 5000) && asks[1].key === 'chat:product:microsites:2' && asks[1].ws === 'microsites', JSON.stringify(asks));
107
117
  await page.click('[data-hm-new]');
108
- const nw = await until(() => page.evaluate(() => [...document.querySelectorAll('#hmMenu [role=menuitem], #hmMenu button')].map((x) => x.textContent).find((x) => /New session in/.test(x)) || null), 3000);
109
- ok('O5 the + New menu names the product: "New session in Microsites"', !!nw && /New session in Microsites/.test(nw), nw);
118
+ const nw = await until(() => page.evaluate(() => [...document.querySelectorAll('#hmMenu [role=menuitem], #hmMenu button')].map((x) => x.textContent).find((x) => /^Chat/.test(x)) || null), 3000);
119
+ ok('O5 the + New menu\'s Chat names the product on its right: "Chat Microsites" (batch 14 item 10)', !!nw && /^ChatMicrosites$/.test(nw), nw);
110
120
  await page.keyboard.press('Escape');
111
121
 
112
122
  // O4 a phone (Wawan, 2026-10-25): the chat is not beside the page, so the page ends with the way to its own chat
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* intel-report-ui-test.js — a report made from Intelligence, on the page (batch 15 item 4; canvas RfA1Entry, RfA2Draft, RfA6Phone). Serves the real
4
+ * Intelligence page from the real server. GET /api/insights-premium answers the model lib/insights-premium.js builds from its fixture; the
5
+ * /api/report-setups routes are stubbed here, answering with lib/intel-report.js on that same model, so the panel shows what the server would.
6
+ * H the report icon sits between Filter and +, icon-only with a label; its menu: This whole view, A dashboard, One key result or outcome
7
+ * D the draft opens in the side panel: ✦ "I drafted the story", the chips (how often, who, format, ⓘ from history), The answer, The story with
8
+ * numbered finding titles and switches (Appendix off), the five checks; a switch redraws the checks; ✓ is off until someone reads it
9
+ * S ✓ sets it up (source intelligence, the scope, the storyline); the panel says Set up with Undo; Undo removes it and discards its draft
10
+ * G a key result's Viewer carries the report press
11
+ * P the ✦ strip proposes a report: See the draft, Not now, ✓ Set it up, icon-only; Not now files strip-dismiss and the item goes
12
+ * T the type scale only · M on a phone. PMOS_SHOTS=<dir> also saves the screenshots. */
13
+ const path = require('path');
14
+ const fs = require('fs');
15
+ const { spawn } = require('child_process');
16
+ const { findBrowser } = require('./lib/find-browser');
17
+ const T = require('./test-run').configure({ name: 'intel-report-ui' });
18
+ const IP = require('./lib/insights-premium.js');
19
+ const F = require('./fixtures/insights-premium-facts.js');
20
+ const IR = require('./lib/intel-report.js');
21
+
22
+ const BASE = T.BASE;
23
+ const SHOTS = process.env.PMOS_SHOTS || '';
24
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
25
+ 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); } };
26
+ const results = [];
27
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 700) : ''}`); };
28
+ let srv = null; let browser = null;
29
+ const finish = async (code) => {
30
+ if (browser) await browser.close().catch(() => {});
31
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
32
+ T.killTmux();
33
+ const bad = results.filter((x) => !x.cond).length;
34
+ console.log(`\n${results.length - bad}/${results.length} intel-report-ui assertions passed`);
35
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
36
+ };
37
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
38
+
39
+ const BUDGETS = [{ id: 'docs', covers: 'documentation upkeep', cap: 0.2 }];
40
+ const MODEL = IP.build(F.facts({ pinned: 'all', budgets: BUDGETS }));
41
+ /* a Library finding (the same numbers mailed every Monday): the defaults and the ✦ proposal come from it */
42
+ const FINDING = { id: 'rf-0123456789', name: 'Partner numbers to Lee', why: 'You mail Lee the partner numbers every Monday.', evidence: [{ kind: 'mail', text: 'Partner numbers, 6 Mondays' }, { kind: 'mail', text: 'Re: partner numbers' }],
43
+ proposal: { name: 'Partner numbers weekly', audience: 'Lee', output: 'pdf', schedule: { cadence: 'weekly', day: 'Mon', time: '09:00' } } };
44
+
45
+ (async () => {
46
+ const exe = process.env.PMOS_CHROME || findBrowser();
47
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
48
+ let chromium;
49
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
50
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
51
+ await T.waitForServer(BASE);
52
+ browser = await chromium.launch({ executablePath: exe });
53
+ if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
54
+ const shot = async (p, name) => { if (SHOTS) { await sleep(450); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
55
+
56
+ const open = async ({ w = 1440, h = 900, dark = false } = {}) => {
57
+ const c = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
58
+ const page = await c.newPage();
59
+ const errors = [], posts = [], gets = [];
60
+ const st = { dismissed: [], setups: [] };
61
+ page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
62
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
63
+ await page.route('**/api/insights-premium*', (r) => json(r, { ok: true, state: 'ready', model: MODEL, as_of: 1 }));
64
+ await page.route('**/api/board-metrics-premium*', (r) => json(r, { ok: true, state: 'ready', model: { tiles: [] } }));
65
+ await page.route('**/api/briefing-premium/products', (r) => json(r, { ok: true, all: false, chosen: true, products: [{ ws: MODEL.board.ws, name: MODEL.board.name, home: false, primary: true, initials: null, on: true }] }));
66
+ await page.route('**/api/metric-drafts**', (r) => json(r, { ok: true, rows: [], run: { state: 'idle', step: 0, reads: [] } }));
67
+ await page.route('**/api/report-setups/**', (r) => {
68
+ const rq = r.request(), u = new URL(rq.url());
69
+ if (rq.method() === 'GET' && u.pathname === '/api/report-setups/storyline') {
70
+ const scope = u.searchParams.get('scope') || 'view'; gets.push({ scope, story: u.searchParams.get('story') });
71
+ let story = {}; if (u.searchParams.get('story')) { const c0 = IR.checkStoryline(JSON.parse(u.searchParams.get('story'))); if (!c0.ok) return json(r, { ok: false, error: c0.error }, 400); story = c0.storyline; }
72
+ const S = IR.storylineOf(MODEL, { scope, ask: story.ask, items: story.items }); if (story.answer) S.answer = story.answer;
73
+ const d = IR.defaultsOf([FINDING], scope, S.name);
74
+ const doc = IR.documentOf(MODEL, { id: 'preview', name: S.name, audience: d.audience, output: d.output, source: IR.sourceOf(scope), storyline: story }, { slot: MODEL.today });
75
+ return json(r, { ok: true, storyline: S, defaults: d, checks: IR.storyChecks(doc), proposals: IR.proposalsOf(MODEL, { findings: [FINDING], dismissed: st.dismissed, now: Date.parse(MODEL.today) }), as_of: MODEL.today });
76
+ }
77
+ const body = JSON.parse(rq.postData() || '{}'); posts.push({ path: u.pathname, body });
78
+ if (u.pathname.endsWith('/strip-dismiss')) { st.dismissed.push(body.id); return json(r, { ok: true }); }
79
+ if (u.pathname.endsWith('/setup')) { st.setups.push(body); return json(r, { ok: true, setup: { id: 'partner-weekly', name: body.name, source: 'intelligence:' + body.scope, scope: body.scope }, first_draft: { slot: '2026-11-02' }, drafted: { ok: true, slot: '2026-11-02', path: 'pmos/state/reports/partner-weekly/2026-11-02.md' } }); }
80
+ if (u.pathname.endsWith('/remove')) return json(r, { ok: true });
81
+ return json(r, { ok: true });
82
+ });
83
+ await page.route('**/api/report-setups?*', (r) => json(r, { setups: [], findings: [], asks: [], finder: {} }));
84
+ await page.route('**/api/report-documents/**', (r) => { posts.push({ path: new URL(r.request().url()).pathname, body: JSON.parse(r.request().postData() || '{}') }); return json(r, { ok: true }); });
85
+ await page.goto(BASE + '/premium-intelligence.html');
86
+ await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0), 20000);
87
+ return { page, ctx: c, errors, posts, gets, st };
88
+ };
89
+ const vClose = async (pg) => { for (let k = 0; k < 4; k++) { const shown = await pg.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden; }); if (!shown) break; await pg.evaluate(() => window.czViewer && window.czViewer.close()); await sleep(250); } };
90
+ const sizes = (p, sel) => p.evaluate((s) => [...new Set([...document.querySelectorAll(s + ', ' + s + ' *')].filter((e) => e.childNodes.length && [...e.childNodes].some((n) => n.nodeType === 3 && n.textContent.trim())).map((e) => getComputedStyle(e).fontSize))], sel);
91
+ const SCALE = new Set(['11px', '12px', '14px', '16px', '20px', '28px']);
92
+ const panel = (p) => p.evaluate(() => {
93
+ const b = document.querySelector('#czViewer:not([hidden]) .ins-rpd') || document.querySelector('#side:not([hidden]) .ins-rpd'); if (!b) return null;
94
+ return { title: (document.querySelector('#czViewer .cz-vw-title') || {}).textContent || '', kind: (document.querySelector('#czViewer .cz-vw-kind') || {}).textContent || '', sum: (b.querySelector('.ins-rps b') || {}).textContent || '',
95
+ chips: [...b.querySelectorAll('.ins-rpchip')].map((c) => c.querySelector('select') ? c.querySelector('select').selectedOptions[0].textContent : c.querySelector('input') ? c.querySelector('input').value : c.textContent.trim()),
96
+ answer: (b.querySelector('.ins-rpa') || {}).value || '', story: [...b.querySelectorAll('.ins-rpst')].map((r) => ({ n: r.querySelector('.n').textContent, t: r.querySelector('b').textContent, on: r.querySelector('[role="switch"]').getAttribute('aria-checked') === 'true', live: !!r.querySelector('.ins-rplive') })),
97
+ checks: [...b.querySelectorAll('.ins-rpck .ck')].map((c) => ({ ok: !c.classList.contains('w'), t: c.textContent })), checkHead: (b.querySelectorAll('.ins-rpl')[2] || {}).textContent || '',
98
+ set: (() => { const x = b.querySelector('[data-rd="set"]'); return x ? { label: x.getAttribute('aria-label'), disabled: x.disabled, solid: x.classList.contains('solid'), text: x.textContent.trim() } : null; })(),
99
+ undo: !!b.querySelector('[data-rd="undo"]') };
100
+ });
101
+
102
+ /* ── H: the header icon and its menu ── */
103
+ const A = await open();
104
+ const p = A.page;
105
+ const hd = await p.evaluate(() => { const ids = [...document.querySelectorAll('#insBar .ins-tools button.cz-ib')].map((b) => b.id); const b = document.querySelector('#repB'); return { ids, label: b && b.getAttribute('aria-label'), text: b && b.textContent.trim(), svg: !!(b && b.querySelector('svg[aria-hidden="true"]')) }; });
106
+ ok('H the report icon sits between Filter and +, icon-only with a label', hd.ids.indexOf('repB') === hd.ids.indexOf('filtB') + 1 && hd.ids.indexOf('newB') === hd.ids.indexOf('repB') + 1 && hd.label === 'Make a report from this' && !hd.text && hd.svg, JSON.stringify(hd));
107
+ await p.click('#repB');
108
+ const mn = await p.evaluate(() => [...document.querySelectorAll('#repMenu [role="menuitem"]')].map((x) => x.querySelector('span').firstChild.textContent));
109
+ ok('H its menu: This whole view, A dashboard, One key result or outcome', mn.join() === 'This whole view,A dashboard,One key result or outcome', mn.join());
110
+ await shot(p, 'RfA1-menu');
111
+ await p.click('#repMenu [data-rs="one"]');
112
+ const one = await p.evaluate(() => [...document.querySelectorAll('#repMenu [data-rs^="goal:"]')].length);
113
+ ok('H One key result or outcome lists the goals', one >= 3, one);
114
+ await p.click('#repMenu [data-rs="back"]');
115
+ await p.keyboard.press('Escape');
116
+ ok('H Escape closes it', await p.evaluate(() => document.querySelector('#repMenu').hidden));
117
+
118
+ /* ── D: the draft ── */
119
+ await p.click('#repB'); await p.click('#repMenu [data-rs="view"]');
120
+ const d = await until(() => panel(p));
121
+ const S0 = IR.storylineOf(MODEL, { scope: 'view' });
122
+ ok('D the draft opens in the side panel: Report · Lee, named from history', !!d && d.kind === 'Report · Lee' && d.title === 'Partner numbers weekly', JSON.stringify(d && { kind: d.kind, title: d.title }));
123
+ ok('D ✦ I drafted the story from Intelligence', !!d && d.sum === 'I drafted the story from Intelligence');
124
+ ok('D the chips: how often, who reads it, format, and why from history', !!d && d.chips.join(' / ') === 'Weekly · Mon 09:00 / Lee / One page + appendix / from your 2 Monday emails', d && d.chips.join(' / '));
125
+ ok('D The answer is the drafted governing thought', !!d && d.answer === S0.answer, d && d.answer);
126
+ ok('D The story: numbered finding titles, each a switch; Appendix and the ask off; live only on the data items', !!d && d.story.length === S0.items.length && d.story.every((r, i) => r.n === String(i + 1))
127
+ && !d.story[0].on && !d.story[d.story.length - 1].on && d.story[1].on && d.story[1].live && !d.story[0].live, JSON.stringify(d && d.story));
128
+ ok('D the five checks, with how many pass', !!d && d.checks.length === 5 && /Checks before it goes out\s*\d of 5/.test(d.checkHead), JSON.stringify(d && d.checks));
129
+ ok('D ✓ Set it up is one solid icon, with a label', !!d && d.set && d.set.solid && d.set.label === 'Set it up' && !d.set.text && !d.set.disabled, JSON.stringify(d && d.set));
130
+ await shot(p, 'RfA2-draft');
131
+ // the ask switch opens its three fields; filling them redraws the checks (the ask has who and by when)
132
+ await p.click('.ins-rpd [data-rd="tog"][data-id="ask"]');
133
+ await p.fill('.ins-rpd [data-rf="askt"]', 'Move the partner launch to after 15 December');
134
+ await p.fill('.ins-rpd [data-rf="askb"]', '2026-11-06');
135
+ await until(() => A.gets.some((g) => g.story && /"ask"/.test(g.story) && /2026-11-06/.test(g.story)), 4000);
136
+ const d2 = await until(async () => { const x = await panel(p); return x && x.story[0].on && /Your decision: Move the partner launch/.test(x.story[0].t) ? x : null; }, 4000);
137
+ ok('D the ask switch turns on with the decision, who (the reader) and by when, and the checks are read again', !!d2 && d2.checks.find((c) => /ask/.test(c.t)) && d2.checks.find((c) => /ask/.test(c.t)).ok, JSON.stringify(d2 && d2.checks));
138
+ // who reads it: empty → ✓ is off
139
+ await p.fill('.ins-rpd [data-rf="aud"]', '');
140
+ ok('D with nobody to read it, ✓ is off', await p.evaluate(() => document.querySelector('.ins-rpd [data-rd="set"]').disabled));
141
+ await p.fill('.ins-rpd [data-rf="aud"]', 'Lee');
142
+ const ts = await sizes(p, '.ins-rpd');
143
+ ok('T the draft uses the type scale only', ts.length && ts.every((x) => SCALE.has(x)), ts.join());
144
+
145
+ /* ── S: ✓ sets it up; Undo takes it back ── */
146
+ await p.click('.ins-rpd [data-rd="set"]');
147
+ const sp = await until(() => A.posts.find((x) => x.path === '/api/report-setups/setup'), 4000);
148
+ ok('S ✓ posts the setup: source intelligence, the scope, who, how often, the format and the storyline', !!sp && sp.body.source === 'intelligence' && sp.body.scope === 'view' && sp.body.audience === 'Lee' && sp.body.schedule.day === 'Mon' && sp.body.output === 'pdf'
149
+ && sp.body.storyline.ask && sp.body.storyline.ask.by === '2026-11-06' && sp.body.storyline.items.length === S0.items.length && sp.body.finding === FINDING.id, JSON.stringify(sp && sp.body));
150
+ const d3 = await until(async () => { const x = await panel(p); return x && x.sum === 'Set up' ? x : null; }, 4000);
151
+ ok('S the panel says Set up, with Undo', !!d3 && d3.undo);
152
+ ok('S the toast says who gets it and when, with Undo', await until(() => p.evaluate(() => { const t = document.querySelector('#toast'); return t && /Set up\. Lee gets it weekly at mon 09:00 from your mail\./i.test(t.textContent) && /Undo/.test(t.textContent); }), 3000), await p.evaluate(() => (document.querySelector('#toast') || {}).textContent));
153
+ await shot(p, 'RfA2-set');
154
+ await p.click('.ins-rpd [data-rd="undo"]');
155
+ await until(() => A.posts.some((x) => x.path === '/api/report-documents/discard'), 4000);
156
+ ok('S Undo removes the setup and discards its first draft', A.posts.some((x) => x.path === '/api/report-setups/remove' && x.body.id === 'partner-weekly') && A.posts.some((x) => x.path === '/api/report-documents/discard' && x.body.path === 'pmos/state/reports/partner-weekly/2026-11-02.md'), JSON.stringify(A.posts.map((x) => x.path)));
157
+ ok('S after Undo the draft is back', !!(await until(async () => { const x = await panel(p); return x && x.sum === 'I drafted the story from Intelligence'; }, 3000)));
158
+ await vClose(p);
159
+
160
+ /* ── G: a key result's Viewer carries the press ── */
161
+ await p.click('#goalTbl .ins-row');
162
+ const gp = await until(() => p.evaluate(() => { const b = document.querySelector('#czViewer:not([hidden]) [data-cz-vw-p="report"]'); return b ? { label: b.getAttribute('aria-label'), text: b.textContent.trim() } : null; }), 4000);
163
+ ok('G a key result\'s Viewer has the report icon', !!gp && gp.label === 'Make a report from this' && !gp.text, JSON.stringify(gp));
164
+ if (gp) { await p.click('#czViewer [data-cz-vw-p="report"]'); await until(() => A.gets.some((g) => /^goal:/.test(g.scope)), 3000); ok('G it opens the draft for that one goal', A.gets.some((g) => /^goal:/.test(g.scope))); }
165
+ await vClose(p);
166
+
167
+ /* ── P: the ✦ strip proposes a report ── */
168
+ const pageTo = async () => { for (let i = 0; i < 6; i++) { const has = await p.evaluate(() => !!document.querySelector('#insAct [data-rp="see"]')); if (has) return true; const dots = await p.$$('#insPg button:not([hidden])'); if (!dots.length) return false; await dots[dots.length - 1].click(); await sleep(120); } return false; };
169
+ ok('P the strip holds a report Claude proposes', await until(pageTo, 4000));
170
+ const pr = await p.evaluate(() => ({ text: document.querySelector('#brief').textContent, acts: [...document.querySelectorAll('#insAct [data-rp]')].map((b) => ({ k: b.dataset.rp, label: b.getAttribute('aria-label'), text: b.textContent.trim(), solid: b.classList.contains('solid') })), ask: document.querySelector('#askWhy').hidden, askShown: getComputedStyle(document.querySelector('#askWhy')).display }));
171
+ ok('P it says the pattern in plain words', /^You send Lee these numbers every Monday\. Shall I make it a report that drafts itself\?$/.test(pr.text), pr.text);
172
+ ok('P See the draft, Not now and a solid ✓ Set it up, icon-only, and no Ask why', pr.acts.map((a) => a.label).join() === 'See the draft,Not now,Set it up for Lee' && pr.acts.every((a) => !a.text) && pr.acts[2].solid && pr.ask && pr.askShown === 'none', JSON.stringify(pr));
173
+ await shot(p, 'RfA1-strip');
174
+ await p.click('#insAct [data-rp="no"]');
175
+ await until(() => A.posts.some((x) => x.path === '/api/report-setups/strip-dismiss'), 3000);
176
+ ok('P Not now files strip-dismiss and the item goes', A.posts.some((x) => x.path === '/api/report-setups/strip-dismiss' && x.body.id === 'found:' + FINDING.id) && await until(() => p.evaluate((id) => !document.querySelector('#insAct [data-rpid="' + id + '"]'), 'found:' + FINDING.id), 2000), await p.evaluate(() => document.querySelector('#insHero').textContent));
177
+ ok('no page errors', !A.errors.length, A.errors.join(' | '));
178
+
179
+ /* ── M: on a phone ── */
180
+ const B = await open({ w: 390, h: 844 });
181
+ await B.page.click('#repB'); await B.page.click('#repMenu [data-rs="view"]');
182
+ const m = await until(() => panel(B.page));
183
+ ok('M on a phone the draft opens full screen with the same parts', !!m && m.story.length === S0.items.length && m.checks.length === 5);
184
+ const ov = await B.page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1);
185
+ ok('M no sideways scroll', ov);
186
+ await shot(B.page, 'RfA6-phone');
187
+ ok('M no page errors', !B.errors.length, B.errors.join(' | '));
188
+ return finish();
189
+ })();
@@ -124,7 +124,7 @@ function build(f) {
124
124
  const look = tiles.filter((t) => t.look).length, withTg = tiles.filter((t) => t.tg != null).length;
125
125
  const lead = look ? look + ' of ' + tiles.length + ' need a look.' : '';
126
126
  const body = 'Each chart is one measure over the last ' + N + ' weeks. ' + (withTg
127
- ? 'The dashed line is the target set on Insights. Orange is off target or needs a look.' + (withTg < tiles.length ? ' ' + (tiles.length - withTg) + ' ' + plural(tiles.length - withTg, 'measure has', 'measures have') + ' no target.' : '')
127
+ ? 'The dashed line is the target set on Intelligence. Orange is off target or needs a look.' + (withTg < tiles.length ? ' ' + (tiles.length - withTg) + ' ' + plural(tiles.length - withTg, 'measure has', 'measures have') + ' no target.' : '')
128
128
  : 'No measure here has a target yet, so none is on or off target. Orange needs a look.')
129
129
  + ' Press a measure for its definition and values. A week with fewer than ' + MIN_RUNS + ' runs is left blank. Blocked and idle are kept from the first day this card was read.';
130
130
  return {
@@ -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' | 'propose' | 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' | 'metric-draft' | 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
@@ -57,6 +57,10 @@
57
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
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
59
  * the PM's ✓ writes a task, a document or a stage. It sends nothing and never runs in a pane.
60
+ * The `metric-draft` kind is Claude's metric drafts for one product, program or initiative (batch 15 item 1): origin
61
+ * `metric-draft:<ws>:<scope>:<id>:<run>`. It reads the repository, the stored reads and, where the PM's own settings allow it, the PM's sources through
62
+ * connectors; its only write is `pmos metrics draft`, pinned by the server to that scope and run. Only the PM's ✓ keep writes a record. It sends nothing
63
+ * and never runs in a pane.
60
64
  * The `report-structure` and `report-structure-dry` kinds are the report structure step (initiative report-structure): origins `report-structure:<id>` and
61
65
  * `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
62
66
  * 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
@@ -100,6 +104,9 @@ const MS_REVIEW_ORIGINS = Object.freeze(['ms-review:']);
100
104
  // 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
105
  // `propose:<ws>:<initiative>:<run>`, lib/proposal-runs.js). Its only write is `pmos propose`, pinned by the server to that initiative and run.
102
106
  const PROPOSE_ORIGINS = Object.freeze(['propose:']);
107
+ // batch 15 item 1: Claude drafts the metrics of a product, a program or an initiative (origin `metric-draft:<ws>:<scope>:<id>:<run>`,
108
+ // lib/metric-draft-runs.js). Its only write is `pmos metrics draft`, pinned by the server to that scope and run.
109
+ const METRIC_DRAFT_ORIGINS = Object.freeze(['metric-draft:']);
103
110
  // report-design-studio: a studio turn, a cycle render or a re-render to match (origin `report-design:<cadence>`).
104
111
  const REPORT_DESIGN_ORIGINS = Object.freeze(['report-design:']);
105
112
  // report-design-studio: reading ONE linked Google or Confluence file through the PM's own connectors (origin `report-sample-fetch:<cadence>:<sampleId>`).
@@ -154,6 +161,11 @@ const TOOLS = Object.freeze({
154
161
  // that sends; it never writes a task, a document or a stage (only the PM's ✓ does).
155
162
  propose: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos propose *)', 'Bash(pmos initiative export *)', 'Bash(pmos initiative list *)', 'Bash(pmos task list *)',
156
163
  'Bash(pmos source show *)', 'Bash(pmos source status *)', 'Bash(git log *)', 'Bash(date *)']),
164
+ // The metric-draft run (lib/metric-draft-runs.js): read and search the repository and the stored reads, and the one verb that files a draft.
165
+ // The PM's analytics, Jira and documents are read through the PM's own connectors only where the PM's settings allow it. No Write, no Edit,
166
+ // no web fetch, nothing that sends; it never writes a record (only the PM's ✓ keep does).
167
+ 'metric-draft': Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos metrics draft *)', 'Bash(pmos initiative export *)', 'Bash(pmos initiative list *)',
168
+ 'Bash(pmos source show *)', 'Bash(pmos source status *)', 'Bash(git log *)', 'Bash(date *)']),
157
169
  // 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.
158
170
  'report-design': Object.freeze(['Read', 'Glob', 'Grep']),
159
171
  // 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.
@@ -191,6 +203,7 @@ function kindFor({ agent, origin, skill, env } = {}) {
191
203
  if (CORE_DOC_ORIGINS.some((p) => o.startsWith(p))) return 'core-doc';
192
204
  if (MS_REVIEW_ORIGINS.some((p) => o.startsWith(p))) return 'ms-review';
193
205
  if (PROPOSE_ORIGINS.some((p) => o.startsWith(p))) return 'propose';
206
+ if (METRIC_DRAFT_ORIGINS.some((p) => o.startsWith(p))) return 'metric-draft';
194
207
  if (REPORT_DESIGN_ORIGINS.some((p) => o.startsWith(p))) return 'report-design';
195
208
  if (REPORT_SAMPLE_FETCH_ORIGINS.some((p) => o.startsWith(p))) return 'report-sample-fetch';
196
209
  // 'report-structure-dry:' is not a prefix of 'report-structure:' (the colon differs), so the two are told apart by their prefix alone
@@ -352,4 +365,4 @@ function logLines(r, exitCode) {
352
365
  return out;
353
366
  }
354
367
 
355
- module.exports = { HEADLESS_SKILLS, HEADLESS_ORIGINS, ASK_ORIGINS, DRIVE_ORIGINS, SCAN_WEB_ORIGINS, SCAN_REPO_ORIGINS, SCAN_RESEARCH_WEB_ORIGINS, SCAN_RESEARCH_REPO_ORIGINS, WEB_KINDS, REPORT_SETUP_ORIGINS, REPORT_FIND_ORIGINS, CORE_DOC_ORIGINS, REPORT_DESIGN_ORIGINS, REPORT_SAMPLE_FETCH_ORIGINS, REPORT_STRUCTURE_ORIGINS, REPORT_STRUCTURE_DRY_ORIGINS, TOOLS, SKILL_WRITE_DIRS, DEFAULT_TIMEOUT_MS, kindFor, argsFor, skillWriteDirs, timeoutMs, parseResult, streamLines, outcomeOf, signedOut, SIGNED_OUT_WHY, logLines, switchedOff };
368
+ module.exports = { HEADLESS_SKILLS, HEADLESS_ORIGINS, ASK_ORIGINS, DRIVE_ORIGINS, SCAN_WEB_ORIGINS, SCAN_REPO_ORIGINS, SCAN_RESEARCH_WEB_ORIGINS, SCAN_RESEARCH_REPO_ORIGINS, WEB_KINDS, REPORT_SETUP_ORIGINS, REPORT_FIND_ORIGINS, CORE_DOC_ORIGINS, REPORT_DESIGN_ORIGINS, REPORT_SAMPLE_FETCH_ORIGINS, REPORT_STRUCTURE_ORIGINS, REPORT_STRUCTURE_DRY_ORIGINS, METRIC_DRAFT_ORIGINS, TOOLS, SKILL_WRITE_DIRS, DEFAULT_TIMEOUT_MS, kindFor, argsFor, skillWriteDirs, timeoutMs, parseResult, streamLines, outcomeOf, signedOut, SIGNED_OUT_WHY, logLines, switchedOff };
@@ -299,6 +299,9 @@ function milestoneOf(r, i) {
299
299
  return i < 5 ? { name: LIFE_LABEL[5] } : i < 7 ? { name: LIFE_LABEL[7] } : null;
300
300
  }
301
301
  /** One goal per KR metric record, with or without a series. `today` is a day in ms (UTC midnight). */
302
+ /** A KR metric record's role on Intelligence (batch 15 item 1): the North Star, an input or a guardrail of it, a key result, or a program's or an
303
+ * initiative's own measure (lib/metric-drafts.js writes them on a ✓). A record with none is a key result. */
304
+ const ROLES = ['north-star', 'input', 'guardrail', 'kr', 'program-goal', 'rollup', 'success', 'signal'];
302
305
  function goalsOf(outcomes, charts, inits, today, meta) {
303
306
  return outcomes.map((o) => {
304
307
  const x = (meta && meta[o.id]) || {}; // the fields New goal keeps on the record (lib/insights-goals.js goalFields)
@@ -337,6 +340,7 @@ function goalsOf(outcomes, charts, inits, today, meta) {
337
340
  direction: x.direction || (dir > 0 ? 'up' : dir < 0 ? 'down' : ''),
338
341
  dirTxt: x.type === 'Stay within' ? (x.limit === 'floor' ? 'stay above' : 'stay below') : x.direction === 'exact' ? 'exactly the target' : dir > 0 ? 'up is better' : dir < 0 ? 'down is better' : '',
339
342
  period: x.period || null, checkpoints: Array.isArray(x.checkpoints) ? x.checkpoints : [], source: x.source || '', owner: x.owner || '', guardrail: x.guardrail || '',
343
+ role: ROLES.includes(x.role) ? x.role : null, program: typeof x.program === 'string' ? x.program : null, initiative: typeof x.initiative === 'string' ? x.initiative : null, // Intelligence: North Star, inputs, guardrails; a program's or an initiative's own measure
340
344
  steps: Array.isArray(x.steps) ? x.steps : null, items: Array.isArray(x.items) ? x.items.filter((s) => typeof s === 'string' && s.trim()).map((s) => clip(s.trim(), 60)) : null, limit: x.limit || null, alwaysOn: x.always_on === true, series: rs.map((r) => ({ at: String(r.at).slice(0, 10), v: r.v })), base, baseTxt: base !== null ? num(base, u) : '', from: fromAt ? shortDate(fromAt) : '',
341
345
  now, nowTxt: now !== null ? num(now, u) : '', target: tgt, targetTxt: tgt !== null ? num(tgt, u) : '', by: byAt ? shortDate(byAt) : '', byAt, fromAt,
342
346
  done, timeGone, tone: STATE_TONE[o.status] || 'q', state: o.status || 'unscored', chip: (CHIP[o.status] || ['No line scored'])[0], reason: o.reason || '',
@@ -397,7 +401,7 @@ function build(facts) {
397
401
  const board = f.board || {};
398
402
  const model = {
399
403
  header: { text: (f.pending ? 'Reading the records · ' : '') + 'Real data' + (missing.length ? ' · not read: ' + missing.join(', ') : ''), missing },
400
- board: { ws: board.ws || null, id: board.id || null, name: board.name || 'Insights', switcher: (f.boards || []).map((b) => Object.assign({ ws: b.ws, id: b.id, name: b.name }, fin(b.goals) ? { goals: b.goals } : {})) },
404
+ board: { ws: board.ws || null, id: board.id || null, name: board.name || 'Intelligence', switcher: (f.boards || []).map((b) => Object.assign({ ws: b.ws, id: b.id, name: b.name }, fin(b.goals) ? { goals: b.goals } : {})) },
401
405
  charts, mine, mineGone, mineSaved: mineAll, noSeries, dashboards, rows: charts,
402
406
  findings: findings.length ? findings : [{ kind: 'calm', key: null, text: charts.length ? (charts.some((c) => c.target !== null) ? 'Nothing stands out. No measure moved much, and none is far behind its line.' : 'Nothing stands out. No measure here has a target, so the series can only be described.') : '' }],
403
407
  calm: !findings.length && charts.length > 0,