create-pmos 0.550.0 → 0.551.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.550.0",
3
+ "version": "0.551.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.551.0",
38
+ "at": "2026-11-10T11:25:58.991Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1279,
43
+ "t": "Intent card on the product page; the Board by goal, and a Next column that says what Claude does next",
44
+ "s": "Intent card on the product page; the Board by goal, and a Next column that says what Claude does next",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.550.0",
38
51
  "at": "2026-11-10T08:31:44.572Z",
@@ -351,19 +364,6 @@
351
364
  "k": "new"
352
365
  }
353
366
  ]
354
- },
355
- {
356
- "v": "0.531.0",
357
- "at": "2026-11-04T18:44:50.726Z",
358
- "f": 4,
359
- "prs": [
360
- {
361
- "n": 1247,
362
- "t": "Report library frame and 23 slide layouts",
363
- "s": "Report library frame and 23 slide layouts",
364
- "k": "new"
365
- }
366
- ]
367
367
  }
368
368
  ]
369
369
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@a8c2162c
1
+ kernel-source: pmos@bc3f5f8c
2
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-10T08:31:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-10T11:25:55Z"}
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-10T08:31:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-10T11:25:55Z"}
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-10T08:31:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-10T11:25:55Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -153,10 +153,10 @@ const IVREAD = () => {
153
153
  /* B1 the stage track (premium-agreed-design): eight columns, two of them milestones, the board's counts, rows by stage.
154
154
  * The milestone mark is a drawn diamond (.msh header holding .cz-ms, cozy.css), not a ◆ glyph in the text; the heads read '◆ ' only where
155
155
  * that shape is present, so the check pins which two columns are milestones. Evaluate 21 is the fixture's own count (+20 done). */
156
- const tr = await p.evaluate(() => ({ heads: [...document.querySelectorAll('.bt-h .bt-cells > div')].map((d) => (d.classList.contains('msh') && d.querySelector('.cz-ms') ? '◆ ' : '') + d.textContent.replace(/\s+/g, ' ').trim()), rows: [...document.querySelectorAll('#ibBody .bt-l')].map((r) => ({ t: r.querySelector('.bt-nm b').textContent, cur: [...r.querySelectorAll('.bt-cells > div')].findIndex((c) => c.classList.contains('c')), nx: ((r.querySelector('.bt-dl .bd-nx .tx') || {}).textContent || ''), cnt: ((r.querySelector('.bt-dl .bd-nx .mu') || {}).textContent || ''), act: ((r.querySelector('.bt-dl .bd-nxa') || { getAttribute: () => '' }).getAttribute('aria-label') || ''), you: !!r.querySelector('.bt-dl .bd-nx .cz-dot.you'), st: r.querySelector('.cs').textContent, days: (r.querySelector('.sc.c small') || {}).textContent, dt: (r.querySelector('.sc.c') || {}).title })), pressed: document.querySelector('#bdViewMenu [aria-pressed="true"]').dataset.pv, n: document.querySelector('.bt-nmh').textContent.replace(/\s+/g, ' ').trim(), oh: document.querySelector('.bt-oh').textContent, lg: !!document.querySelector('.bt-oh .lg, #ibBody .seg5'), tf: document.querySelector('.bt-tf').textContent }));
156
+ const tr = await p.evaluate(() => ({ heads: [...document.querySelectorAll('.bt-h .bt-cells > div')].map((d) => (d.classList.contains('msh') && d.querySelector('.cz-ms') ? '◆ ' : '') + d.textContent.replace(/\s+/g, ' ').trim()), rows: [...document.querySelectorAll('#ibBody .bt-l')].map((r) => ({ t: r.querySelector('.bt-nm b').textContent, cur: [...r.querySelectorAll('.bt-cells > div')].findIndex((c) => c.classList.contains('c')), nx: ((r.querySelector('.bt-dl .bd-nx .tx') || {}).textContent || ''), cnt: ((r.querySelector('.bt-dl .bd-nx .mu') || {}).textContent || ''), act: ((r.querySelector('.bt-dl .bd-nxa') || { getAttribute: () => '' }).getAttribute('aria-label') || ''), you: !!r.querySelector('.bt-dl .bd-nx.y'), st: r.querySelector('.cs').textContent, days: (r.querySelector('.sc.c small') || {}).textContent, dt: (r.querySelector('.sc.c') || {}).title })), pressed: document.querySelector('#bdViewMenu [aria-pressed="true"]').dataset.pv, n: document.querySelector('.bt-nmh').textContent.replace(/\s+/g, ' ').trim(), oh: document.querySelector('.bt-oh').textContent, lg: !!document.querySelector('.bt-oh .lg, #ibBody .seg5'), tf: document.querySelector('.bt-tf').textContent }));
157
157
  ok('B1 the default view is the stage track with six stages and two milestones, each with the board\'s count (old names count for the new ones); a step with none says no 0 (UI grill U2)', tr.pressed === 'track' && tr.heads.join('|') === 'Triage|Discover1|Plan1|Prioritize|Build2|◆ Deliver1|Monitor1|◆ Evaluate21', JSON.stringify(tr.heads));
158
158
  ok('B1 one row per initiative, sorted by stage, with its current step marked; the head counts the open initiatives', tr.rows.length === 7 && tr.rows.map((r) => r.cur).join() === '1,2,4,4,5,6,7' && tr.rows[0].t === 'Usage-based billing' && tr.n === 'Initiative 9', JSON.stringify(tr.rows.map((r) => r.t + ':' + r.cur)));
159
- ok('B1 the Next column says what finishes the step next, with its count; the initiative\'s whole progress is never the step\'s, and a part not on record draws nothing; a draft step has no "with Claude" link (chief-of-staff: Claude drafts it by itself)', tr.oh === 'Next' && tr.rows[0].nx === '' && tr.rows[1].nx === 'Draft the tickets' && tr.rows[1].cnt === '1/2 parts' && tr.rows.every((r) => !/%/.test(r.cnt)) && tr.rows[3].nx === 'Link the Jira epic' && tr.rows[3].act === 'Link the Jira epic' && tr.rows[6].nx === 'Draft the outcome report' && tr.rows[6].act === '', JSON.stringify(tr.rows.map((r) => [r.nx, r.cnt, r.act])));
159
+ ok('B1 the Next column says what Claude does next (board AwH): no document asks and no part counters; the PM\'s calls only read "Your call"; the epic keeps its link icon', tr.oh === 'Next' && tr.rows[1].nx === 'Claude drafts the tickets' && tr.rows[1].cnt === '' && tr.rows.every((r) => !/%|parts|PRD|^Draft |^Write |^Add the /.test(r.cnt + ' ' + r.nx)) && tr.rows[3].nx === 'Claude finds the Jira epic' && tr.rows[3].act === 'Link the Jira epic' && tr.rows[5].nx === 'Claude reads the outcome' && tr.rows[5].act === '' && tr.rows[6].nx === 'Your call · did it work?' && tr.rows[6].act === '', JSON.stringify(tr.rows.map((r) => [r.nx, r.cnt, r.act])));
160
160
  ok('B1 the status line says late in days over and at risk with no owner', tr.rows.some((r) => /^\d+ days over$/.test(r.st)) && tr.rows[0].st === 'At risk · no owner', JSON.stringify(tr.rows.map((r) => r.st)));
161
161
  ok('B1 days in a step are not on record, so the current step shows a dash and says so; nothing is invented', tr.rows.every((r) => (r.days === '—' || /Deliver/.test(r.dt)) && /days in this step are not on record/.test(r.dt)), JSON.stringify(tr.rows.map((r) => r.days + ':' + r.dt)));
162
162
  // PgBoard: a committed date (the planned end) shows under the Deliver milestone; at the milestone itself it replaces the days count
@@ -212,11 +212,11 @@ const IVREAD = () => {
212
212
  }
213
213
  {
214
214
  const R = await open({ model: BP.build(FJ.facts()) }), q = R.page;
215
- const c = await q.evaluate(() => ({ chips: [...document.querySelectorAll('#bdChipset .bd-chip')].map((b) => b.textContent.replace(/\s+/g, ' ').trim() + (b.getAttribute('aria-pressed') === 'true' ? '*' : '')), spr: document.querySelector('#bdChipset #chSprint').getAttribute('aria-label'), jiraRow: !!document.querySelector('.bd-hd #bdLgdMenu #chJira') && !document.querySelector('#bdJiraw'), need: document.querySelector('#chNeed').getAttribute('aria-label'), rows: [...document.querySelectorAll('#bdNeedMenu button')].map((b) => b.textContent.trim() + (b.getAttribute('aria-pressed') === 'true' ? '*' : '')).join('|'), jira: document.querySelector('#chJira').getAttribute('title'), ss: document.querySelector('.bt-l[data-row="board:self-serve-v2"] .bd-nx .tx').textContent, sso: document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx .tx').textContent, red: !!document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx em.red'), ssoTitle: document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx .tx').title, st: document.querySelector('.bt-l[data-row="board:sso-partners"] .cs').textContent, ssoCount: document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx .mu').textContent, ssCount: document.querySelector('.bt-l[data-row="board:self-serve-v2"] .bd-nx .mu').textContent }));
215
+ const c = await q.evaluate(() => ({ chips: [...document.querySelectorAll('#bdChipset .bd-chip')].map((b) => b.textContent.replace(/\s+/g, ' ').trim() + (b.getAttribute('aria-pressed') === 'true' ? '*' : '')), spr: document.querySelector('#bdChipset #chSprint').getAttribute('aria-label'), jiraRow: !!document.querySelector('.bd-hd #bdLgdMenu #chJira') && !document.querySelector('#bdJiraw'), need: document.querySelector('#chNeed').getAttribute('aria-label'), rows: [...document.querySelectorAll('#bdNeedMenu button')].map((b) => b.textContent.trim() + (b.getAttribute('aria-pressed') === 'true' ? '*' : '')).join('|'), jira: document.querySelector('#chJira').getAttribute('title'), ss: document.querySelector('.bt-l[data-row="board:self-serve-v2"] .bd-nx .tx').textContent, sso: document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx .tx').textContent, red: !!document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx .tx .red'), ssoTitle: document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx .tx').title, st: document.querySelector('.bt-l[data-row="board:sso-partners"] .cs').textContent, ssoCount: document.querySelector('.bt-l[data-row="board:sso-partners"] .bd-nx .mu').textContent, ssCount: document.querySelector('.bt-l[data-row="board:self-serve-v2"] .bd-nx .mu').textContent }));
216
216
  ok('B1 the one row holds one pill for the new asks, late, at risk and blocked; its (i) holds the sprint and release and the Jira read with its ↻ (batch 24 item 7, UI grill U2)', c.chips.length === 1 && c.spr === 'Sprint 24 · v2.4 ships Nov 4. Sprints and releases' && c.need === '1 new ask, 1 late, 3 at risk, 1 blocked. Show them' && c.rows === 'New ask1|Late1|At risk3|Blocked1' && /^Jira · read .*Read Jira again$/.test(c.jira) && c.jiraRow, JSON.stringify(c));
217
217
  await q.click('#bdFilter'); const fo = await q.evaluate(() => { const b = document.querySelector('#bdPop [data-fsonly]'); return b ? b.textContent + (b.getAttribute('aria-pressed') === 'true' ? '*' : '') : null; }); await q.keyboard.press('Escape');
218
218
  ok('B1 This sprint (on by default) is Filter\'s first sprint chip now that the chip row is gone (batch 28 item 3)', fo === 'Sprint 24 only*', String(fo));
219
- ok('B1 Build and Deliver say the ticket that matters, counted in points or tickets; a blocked ticket comes first, in red', c.ssCount === '5/13 pts' && c.ssoCount === '1/4 tickets' && /^Finish SSO-12/.test(c.sso) && c.red && /blocked/.test(c.ssoTitle) && /^Finish ONB-\d+ · 2 more$/.test(c.ss), JSON.stringify(c));
219
+ ok('B1 Build and Deliver say the ticket that matters, counted in points or tickets; a blocked ticket comes first, in red', c.ssCount === '5/13 pts' && c.ssoCount === '1/4 tickets' && /^Claude chases SSO-12/.test(c.sso) && c.red && /blocked/.test(c.ssoTitle) && /^Claude follows ONB-\d+ · 2 more$/.test(c.ss), JSON.stringify(c));
220
220
  ok('B1 a Deliver row whose release has a date says when it ships', c.st === 'Ships Nov 4', c.st);
221
221
  // a metric chip opens its trend (BdPanel); its "Show only" filters
222
222
  await needOpen(q); await q.click('#bdChipset [data-f="blocked"]');
@@ -318,7 +318,7 @@ const IVREAD = () => {
318
318
  await view(p, 'list');
319
319
  const listOf = () => p.evaluate(() => ({ tag: !!document.querySelector('#ibBody .bd-wtag'), rows: [...document.querySelectorAll('#ibBody .bd-lt[data-row] .bd-ltn b')].map((b) => b.textContent), ss: ((document.querySelector('#ibBody .bd-lt[data-row="board:self-serve-v2"]') || {}).textContent || '').replace(/\s+/g, ' '), head: [...document.querySelectorAll('#ibBody .bd-lt.h [role="columnheader"]')].map((h) => h.textContent).join('|'), foot: (document.querySelector('#ibBody .bd-lt.foot') || {}).textContent || '', v: document.querySelector('#bdViewMenu [aria-pressed="true"]').dataset.pv }));
320
320
  const lv = await listOf();
321
- ok('B4 the List view lists the initiatives with workflow, stage, category, status, owner, next and finish, sorted by need; Monitor and Evaluate fold below', !lv.tag && lv.rows.length === 5 && lv.head === 'Initiative · sorted by need|Workflow|Stage|Category|Status|Owner|Next|Finish|' && /Self-serve onboarding v2.*Product feature.*Build.*In progress.*7 days over.*Link the Jira epic.*10 Oct/.test(lv.ss) && /2 more in Monitor and Evaluate/.test(lv.foot) && lv.v === 'list', JSON.stringify(lv));
321
+ ok('B4 the List view lists the initiatives with workflow, stage, category, status, owner, next and finish, sorted by need; Monitor and Evaluate fold below', !lv.tag && lv.rows.length === 5 && lv.head === 'Initiative · sorted by need|Workflow|Stage|Category|Status|Owner|Next|Finish|' && /Self-serve onboarding v2.*Product feature.*Build.*In progress.*7 days over.*Claude finds the Jira epic.*10 Oct/.test(lv.ss) && /2 more in Monitor and Evaluate/.test(lv.foot) && lv.v === 'list', JSON.stringify(lv));
322
322
  await p.click('#ibBody [data-sort="title"]');
323
323
  const lt = await listOf();
324
324
  ok('B4 a column title sorts the list', lt.rows[0] === 'Docs search' && lt.rows.join() === lt.rows.slice().sort((a, b) => a.localeCompare(b)).join(), JSON.stringify(lt.rows));
@@ -468,12 +468,12 @@ const IVREAD = () => {
468
468
  const gone = F.row('old-idea', 'Old idea', { status: 'cancelled', stopped: { reason: 'Not worth it now' } });
469
469
  const R = await open({ model: BP.build(FJ.facts({ cancelled: [gone] })), trail: FT.trail() }), q = R.page;
470
470
  await until(() => q.evaluate(() => /18d/.test(document.querySelector('#ibBody').textContent)));
471
- const row = (id) => q.evaluate((k) => { const r = document.querySelector(`.bt-l[data-row="board:${k}"]`); if (!r) return null; const c = r.querySelector('.sc.c'); return { days: (c.querySelector('small') || {}).textContent, dt: c.title, st: r.querySelector('.cs').textContent, stc: r.querySelector('.cs').className, prog: ((r.querySelector('.bt-dl .bd-nx .mu') || {}).textContent || ''), line: ((r.querySelector('.bt-dl .bd-nx .tx') || {}).textContent || ''), you: !!r.querySelector('.bt-dl .bd-nx .cz-dot.you'), skip: [...r.querySelectorAll('.bt-cells > div.k')].map((d) => d.title) }; }, id);
471
+ const row = (id) => q.evaluate((k) => { const r = document.querySelector(`.bt-l[data-row="board:${k}"]`); if (!r) return null; const c = r.querySelector('.sc.c'); return { days: (c.querySelector('small') || {}).textContent, dt: c.title, st: r.querySelector('.cs').textContent, stc: r.querySelector('.cs').className, prog: ((r.querySelector('.bt-dl .bd-nx .mu') || {}).textContent || ''), line: ((r.querySelector('.bt-dl .bd-nx .tx') || {}).textContent || ''), you: !!r.querySelector('.bt-dl .bd-nx.y'), skip: [...r.querySelectorAll('.bt-cells > div.k')].map((d) => d.title) }; }, id);
472
472
  const ss = await row('self-serve-v2'), pr = await row('partner-rate-limits'), ub = await row('usage-billing'), rf = await row('refund-reason-codes'), ds = await row('docs-search');
473
473
  ok('T days in the step come from the trail, with "usually N days" only from three samples on', ss.days === '18d' && ss.dt === 'Build · 18 days in this step · usually 14 days' && pr.days === '6d' && pr.dt === 'Plan · 6 days in this step', JSON.stringify([ss, pr]));
474
474
  ok('T a skipped step is a ring that says why: the move\'s reason, or the lane\'s ladder', pr.skip.join() === 'Discover skipped: Moved from Triage to Plan: the PRD came with the ask.' && ds.skip.length === 3 && /The chore lane has no Triage step/.test(ds.skip[0]), JSON.stringify([pr.skip, ds.skip]));
475
- ok('T the Next cell counts the parts from the records and names the next one', ub.prog === 'PRD 2/6' && ub.line === 'Add the evidence' && pr.prog === '1/4 parts' && pr.line === 'Set the timeline', JSON.stringify([ub, pr]));
476
- ok('T what waits on you comes first, in blue', rf.st === 'Your verdict' && /s-you/.test(rf.stc) && rf.you && rf.line === 'Give your verdict', JSON.stringify(rf));
475
+ ok('T the Next cell says what Claude writes next, with no part counter (board AwH)', ub.prog === '' && ub.line === 'Claude writes the experiment' && pr.prog === '' && pr.line === 'Claude writes the done test', JSON.stringify([ub, pr]));
476
+ ok('T what waits on you comes first, in blue', rf.st === 'Your verdict' && /s-you/.test(rf.stc) && rf.you && rf.line === 'Your call · did it work?', JSON.stringify(rf));
477
477
  // UI grill U2 took the Board's bell off: what it listed is the pill's "Waits on you" row, which shows only those initiatives
478
478
  await needOpen(q);
479
479
  const wy = await q.evaluate(() => { const b = document.querySelector('#bdNeedMenu [data-f="you"]'); return b ? b.textContent.trim() : null; });
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.551.0",
4
+ "at": "2026-11-10T11:25:58.991Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1279,
9
+ "t": "Intent card on the product page; the Board by goal, and a Next column that says what Claude does next",
10
+ "s": "Intent card on the product page; the Board by goal, and a Next column that says what Claude does next",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.550.0",
4
17
  "at": "2026-11-10T08:31:44.572Z",
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "The Board: programs, views, published boards and core documents"
4
4
  description: "The Board's views and programs, milestones, a read-only published copy of a Board, and the core documents of each level."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-10
6
6
  ---
7
7
 
8
8
  # The Board
@@ -53,6 +53,8 @@ The weekly update in Home follows the same rules. Claude drafts it only when som
53
53
  - A program comes first. Its band shows the stage spread of its initiatives, the next milestone and how many initiatives are ready for it. Under the band, the initiatives sit under a small heading for each product. Then each product has its own group.
54
54
  - A product's group head works like a program's: press the product's tile or name to open its page in Home's Viewer. Press the chevron to fold the group. This works in every view: the stage track, Kanban, the timeline and List. On a shared board, the product's name is plain text.
55
55
  - To group by product only, press the tune button in the top row and choose **By product** under **Group**. A program member then shows a small layers icon and stays under its product in every view, the timeline included.
56
+ - **By goal** is the stage track's first grouping. Each goal row shows the goal's name, its KR id and its reading ("KR-A1 · no reading yet"), the spread of its initiatives over the steps, and in the Next column its target and where the reading comes from. A health budget is a goal too: its cap is the target, and its share of the open initiatives is its reading. The goals come from your OKR file and your health budgets; nothing is typed here. An initiative whose anchor names no goal sits under **No goal yet**. Choose **Programs first** or **By product** under **Group** for the other groupings; Kanban, the timeline and List keep the programs.
57
+ - The **Next** column says what Claude does next, with ✦, for example "Claude writes the experiment" or "Claude reads the outcome". It does not ask you to write a document. Only your calls show in blue with a person icon: **Your call** · did it work?, move it to the next stage, send the drafted tickets to Jira, and the release sign-off. Ticket and task counts stay.
56
58
  - **Kanban** shows programs as swimlanes, then products. Press a column header to fold the column to a strip with its count. An empty column starts folded. The Board remembers each fold.
57
59
  - 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.
58
60
  - On the timeline, **every initiative has a row**, in a program or not, in every grouping. An initiative with no dates says **No dates** beside today; in each group it comes after the dated ones. Under the chart, a line gives how many have no dates, with **Ask to propose dates**.
@@ -83,6 +85,7 @@ The Viewer of a program, and the product page, are one page. There is no Work an
83
85
 
84
86
  - 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
87
  - 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.
88
+ - On the product page, **Intent** comes under the story: what we want, the limits Claude works inside, and what we will not do. It is yours. Press the pencil to edit the three parts, one line each. Claude never changes it; when a record says it should change, Claude adds a ✦ row under the card, for example "Add a limit: …" with its source. ✓ adds it, ✕ declines it.
86
89
  - 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.
87
90
  - 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.
88
91
  - 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.
@@ -18,6 +18,9 @@
18
18
  * storyOf(state, scopes, { now, days }) → { at, lines: [{ text, sources }] } | null "The story so far" (board AwE): the Narrative's
19
19
  * `now` (one paragraph per line) and its `week` lines of the last `days` days; every line carries the sources of its set
20
20
  * lessonsOf(state) → [{ scope, text, sources, at }] every Lessons line of every scope, newest first (Settings › Claude, AwG2)
21
+ * intentOf(state, scopes) → { scope, fields: { want, limits, not } } the Intent card on the product page (board AwI): the first scope
22
+ * that holds an Intent line, else the first scope with every field empty. A field is { id, text, at, by } | null
23
+ * withLine(current, text) → text an Intent proposal that adds one line: the field's text with the line after it (a line already there is kept once)
21
24
  *
22
25
  * THE LINES. Every line is { v: 1, ev, id, scope, at, by }.
23
26
  * set { artefact, field, text, sources: [{ label, ref }] } a value. A `one` field: the newest set wins. A `list` field: every set is a line.
@@ -274,6 +277,22 @@ function lessonsOf(state) {
274
277
  return out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
275
278
  }
276
279
 
280
+ /** The Intent of a product (board AwI): the first of `scopes` that holds an Intent line. Pure. */
281
+ function intentOf(state, scopes) {
282
+ const L = (scopes || []).filter((sc) => parseScope(sc));
283
+ const pick = (sc) => { const v = viewOf(state, sc); return v && v.artefacts.find((a) => a.key === 'intent'); };
284
+ for (const sc of L) {
285
+ const a = pick(sc);
286
+ if (a && !a.empty && ['want', 'limits', 'not'].some((k) => a.fields[k])) return { scope: parseScope(sc).scope, fields: { want: a.fields.want, limits: a.fields.limits, not: a.fields.not } };
287
+ }
288
+ return L.length ? { scope: parseScope(L[0]).scope, fields: { want: null, limits: null, not: null } } : null;
289
+ }
290
+ /** One line added under an Intent field: the lines already there, then this one. A line already there is not added twice. Pure. */
291
+ function withLine(current, text) {
292
+ const have = String(current || '').split(/\n+/).map((x) => x.trim()).filter(Boolean), t = String(text || '').trim();
293
+ return (have.includes(t) || !t ? have : have.concat(t)).join('\n');
294
+ }
295
+
277
296
  // ── writes ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
278
297
  const refuse = (status, error) => ({ ok: false, status, error });
279
298
  const oneLine = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
@@ -411,7 +430,7 @@ function migrateRepo(root, { now } = {}) {
411
430
  }
412
431
 
413
432
  module.exports = {
414
- pmEdited, storyOf, lessonsOf,
433
+ pmEdited, storyOf, lessonsOf, intentOf, withLine,
415
434
  LEDGER, EVENTS, ARTEFACTS, KEYS, EXECUTORS, FROM_DOCS, FROM_WHATS, FROM_CADENCES, FROM_LANES,
416
435
  parseScope, targetOfDoc, targetOfWhat, fieldOf, file, readLines, append, fold, viewOf, checkSet, set, undo,
417
436
  planMigration, migrate, migrateRepo, reportDrafts, dirOf, proposalText,
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+ /* board-goals.js — the Board's "By goal" grouping (agent-run workspace board AwH, agreed by the PM 2026-11-10).
3
+ *
4
+ * goalsFor({ src, budgets, anchors, rows }) → { goals: [goal], of: { <anchor>: <goal key> } } PURE
5
+ * readingOf(record) → { text, at, words } | null a KR metric record's newest reading. PURE
6
+ * readBudgets(root) → [{ id, covers, cap }] | null the workspace's health budget registry
7
+ *
8
+ * A goal is the Goal artefact (D107): derived, never typed. It is a key result of the OKR file (lib/goal-source.js source(), the one goal source)
9
+ * or a health budget of planning/okrs/health-budgets.md (D59: a budget is a goal). Each goal row on the Board says three things:
10
+ * meta the key result's id and whether it has a reading ("KR-A1 · no reading yet"), or a budget's "under its cap" / "over its cap"
11
+ * target what it must reach ("60.2% → ≥ 70% by Dec 2026"), from the OKR file's words; a budget's "20% cap a quarter"
12
+ * from where the reading comes from, or what it waits on ("Reads idpf.pm-os.app once connected"); a budget's "2 of 11 initiatives"
13
+ * Nothing is invented: a key result with no reading says so, and an anchor that names no key result or budget is left out of `of` (the Board
14
+ * puts its rows under "No goal yet").
15
+ *
16
+ * src: lib/goal-source.js source() of the workspace
17
+ * budgets: [{ id, covers, cap }] (lib/insights-goals.js parseBudgets)
18
+ * anchors: the anchors the Board's rows carry (parent_kr): "O-A.KR-A1", "KR-A2", "health:tech"
19
+ * rows: the Board's open rows [{ anchor, status }]: a budget's share is counted from them
20
+ */
21
+ const OG = require('./okr-goals.js');
22
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
23
+ const fin = (v) => typeof v === 'number' && Number.isFinite(v);
24
+ const r2 = (v) => Math.round(v * 100) / 100;
25
+ const day = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
26
+ const cap1 = (s) => String(s || '').charAt(0).toUpperCase() + String(s || '').slice(1);
27
+
28
+ /** The newest reading of a record, as words: "61.4% · 2 Nov". null when it has none. */
29
+ function readingOf(rec) {
30
+ const R = (rec && Array.isArray(rec.readings) ? rec.readings : []).filter((x) => x && fin(x.v));
31
+ if (!R.length) return null;
32
+ const last = R.slice().sort((a, b) => String(a.at || '').localeCompare(String(b.at || ''))).pop();
33
+ const u = String(rec.unit || '').trim();
34
+ const v = u === 'done' ? (last.v >= 1 ? 'done' : 'not done') : r2(last.v) + (u ? (/^[A-Za-z]/.test(u) ? ' ' + u : u) : '');
35
+ return { text: v, at: last.at || null, words: [v, day(last.at)].filter(Boolean).join(' · ') };
36
+ }
37
+
38
+ function krGoal(g) {
39
+ const rec = g.record, read = readingOf(rec);
40
+ const conn = rec && rec.recipe && (rec.recipe.connector || rec.recipe.source);
41
+ const need = g.k.need || '';
42
+ return {
43
+ key: g.key, kind: 'kr', token: g.token, title: cap1(g.title), objective: g.objective || '',
44
+ meta: g.token + ' · ' + (read ? read.words : 'no reading yet'),
45
+ reading: read, target: String(g.k.line || '').replace(/\s*\([^)]*\)/g, '').trim(), // "60.2% (Jun 2026 steady-state) → ≥ 70%" reads "60.2% → ≥ 70%"
46
+ from: read ? (conn ? 'Read from ' + conn : '') : g.k.decision ? 'A decision, read from its record' : conn ? 'Reads ' + conn + ' at its next run' : need ? 'Reads ' + need + ' once connected' : '',
47
+ };
48
+ }
49
+ function budgetGoal(b, rows) {
50
+ const open = (rows || []).filter((r) => r && !['done', 'cancelled'].includes(String(r.status || '').toLowerCase()) && !r.archived);
51
+ const n = open.filter((r) => String(r.anchor || '') === 'health:' + b.id).length, total = open.length;
52
+ const over = total && fin(b.cap) ? n / total > b.cap : false;
53
+ const pct = fin(b.cap) ? Math.round(b.cap * 100) + '%' : '';
54
+ return {
55
+ key: 'health:' + b.id, kind: 'budget', token: 'Health', title: cap1(b.id) + ' health', objective: b.covers || '',
56
+ meta: 'Health · ' + (total ? (over ? 'over its cap' : 'under its cap') : 'no reading yet'),
57
+ reading: total ? { text: Math.round((n / total) * 100) + '%', at: null, words: n + ' of ' + total } : null, over,
58
+ target: pct ? pct + ' cap a quarter' : '', from: total ? n + ' of ' + total + ' initiatives' : '',
59
+ };
60
+ }
61
+
62
+ function goalsFor({ src, budgets, anchors, rows } = {}) {
63
+ const okr = src && src.okr && src.okr.ok ? src.okr.objectives : [];
64
+ const G = (src && src.goals) || [];
65
+ const out = new Map(), of = {};
66
+ for (const a of new Set((anchors || []).map((x) => String(x || '').trim()).filter(Boolean))) {
67
+ const h = /^health:([a-z0-9-]+)$/i.exec(a);
68
+ if (h) {
69
+ const b = (budgets || []).find((x) => x.id === h[1].toLowerCase());
70
+ if (!b) continue;
71
+ if (!out.has('health:' + b.id)) out.set('health:' + b.id, budgetGoal(b, rows));
72
+ of[a] = 'health:' + b.id;
73
+ continue;
74
+ }
75
+ const m = OG.matchAnchor(a, okr);
76
+ if (!m) continue;
77
+ const key = m.o.id + '::' + m.k.id, g = G.find((x) => x.key === key);
78
+ if (!g) continue;
79
+ if (!out.has(key)) out.set(key, krGoal(g));
80
+ of[a] = key;
81
+ }
82
+ return { goals: [...out.values()], of };
83
+ }
84
+
85
+ /** The health budget registry of a workspace (D59): planning/okrs/health-budgets.md, or pmos/planning/okrs/ in a product repository. null when neither reads. */
86
+ function readBudgets(root) {
87
+ const path = require('path'), fs = require('fs'), IG = require('./insights-goals.js');
88
+ for (const f of [path.join(root, 'planning', 'okrs', 'health-budgets.md'), path.join(root, 'pmos', 'planning', 'okrs', 'health-budgets.md')]) {
89
+ try { return IG.parseBudgets(fs.readFileSync(f, 'utf8')); } catch { /* the next place */ }
90
+ }
91
+ return null;
92
+ }
93
+
94
+ module.exports = { goalsFor, readingOf, readBudgets };
@@ -65,8 +65,13 @@ async function writeRecord(p, actor, ctx, now) {
65
65
  // R18 (D107): one field of one of the seven artefacts. Intent is the PM's: an agent's Keep of it is refused and it waits.
66
66
  if (!ctx.root) return refuse(409, 'this repository has no folder for the artefacts');
67
67
  const A = require('./artefacts.js');
68
- const d = p.data || {};
69
- const r = A.set(A.file(A.dirOf(ctx.root)), { scope: d.scope, artefact: d.artefact, field: d.field, text: d.text, sources: p.sources }, actor, { now });
68
+ const d = p.data || {}, f = A.file(A.dirOf(ctx.root));
69
+ let text = d.text;
70
+ if (d.op === 'add') { // board AwI: the line goes under the field's lines as they are when the PM keeps it
71
+ const v = A.viewOf(A.fold(A.readLines(f)), d.scope), a = v && v.artefacts.find((x) => x.key === d.artefact), cur = a && a.fields[d.field];
72
+ text = A.withLine(cur && !Array.isArray(cur) ? cur.text : '', d.text);
73
+ }
74
+ const r = A.set(f, { scope: d.scope, artefact: d.artefact, field: d.field, text, sources: p.sources }, actor, { now });
70
75
  if (!r.ok) return refuse(r.status || 409, r.error);
71
76
  return { ok: true, wrote: 'artefact', undo: { op: 'artefact', ref: r.line.id } };
72
77
  }
@@ -137,6 +142,8 @@ async function autoApply({ file, proposal, actor, ctx = {}, now, stateDir, produ
137
142
  const cls = A.classOfDriver(p.what);
138
143
  const d = A.decide({ stateDir, job: jobOf(p), product, cls, mode: m, undoable: UNDOABLE.has(p.what), now, settingsDir: ctx.settingsDir || null });
139
144
  if (!d.apply) return { applied: false, why: d.why, cls };
145
+ // board AwI: Intent is the PM's; Claude's change to it is a ✦ proposal on the product page and never applies by itself
146
+ if (p.what === 'artefact' && p.data && p.data.artefact === 'intent') return { applied: false, why: 'Intent is the PM\'s, so Claude only proposes', cls };
140
147
  // 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
148
  if (p.what === 'artefact' && ctx.root) {
142
149
  const AR = require('./artefacts.js');
@@ -189,10 +189,14 @@ function checkProposal(input) {
189
189
  // R18 (D107): one field of one of the seven artefacts (lib/artefacts.js). Keep writes it to artefacts.jsonl, with Undo.
190
190
  // The scope is this experiment unless data.scope names the portfolio or a board (Intent, Narrative, Lessons).
191
191
  const A = require('./artefacts.js');
192
- const scope = typeof data.scope === 'string' && data.scope ? data.scope : `experiment:${t.target.id}`;
192
+ // Intent (board AwI) is the product's: with no scope it lands on board:<ws>, the scope the product page's Intent card reads first
193
+ const scope = typeof data.scope === 'string' && data.scope ? data.scope : data.artefact === 'intent' ? `board:${t.target.ws}` : `experiment:${t.target.id}`;
193
194
  const c = A.checkSet({ scope, artefact: data.artefact, field: data.field, text: data.text }, { by: 'pm:check' });
194
195
  if (!c.ok) return { ok: false, error: `an artefact proposal: ${c.error}` };
195
- data = { scope: c.line.scope, artefact: c.line.artefact, field: c.line.field, text: c.line.text };
196
+ // board AwI: an Intent proposal may add one line to a field (op: add, "Add a limit: …") instead of replacing the field's words
197
+ if (data.op != null && data.op !== 'add') return { ok: false, error: 'an artefact proposal: op is add, or left out to replace the field' };
198
+ if (data.op === 'add' && /[\r\n]/.test(c.line.text)) return { ok: false, error: 'an artefact proposal: an added line is one line' };
199
+ data = { scope: c.line.scope, artefact: c.line.artefact, field: c.line.field, text: c.line.text, ...(data.op === 'add' ? { op: 'add' } : {}) };
196
200
  } else if (i.what === 'next-step') {
197
201
  if (!oneLine(data.text, 500)) return { ok: false, error: 'a next step needs data.text: one line of up to 500 characters' };
198
202
  if (data.due != null && !(typeof data.due === 'string' && DATE_RE.test(data.due))) return { ok: false, error: 'data.due is YYYY-MM-DD' };
@@ -9,6 +9,14 @@
9
9
  * GET /api/artefacts/lessons → { ok, lessons: [{ ws, product, scope, text, at }] } every product's Lessons, newest first, at most 20
10
10
  * (Settings › Claude, board AwG2)
11
11
  * GET /api/artefacts/map → { ok, artefacts, rows: [{ from, name, artefact, field, note }] } what every older shape became
12
+ * GET /api/artefacts/intent?ws → { ok, ws, intent: { scope, fields: { want, limits, not } }, proposals: [{ id, field, op, text, why, sources, at }] }
13
+ * the Intent card on the product page (board AwI): board:<ws>, else the portfolio. The proposals are
14
+ * Claude's open ✦ changes to it (driver proposals of what `artefact`, artefact `intent`); the PM keeps one
15
+ * with POST /api/driver/keep and declines it with /api/driver/drop. Claude never writes the Intent itself.
16
+ * GET /api/artefacts/goals?ws&a=<anchor>… → { ok, ws, goals: [{ key, kind, token, title, meta, reading, target, from }], of: { anchor: key } }
17
+ * the Board's "By goal" grouping (board AwH): the Goal artefact, derived from the OKR file's key results and
18
+ * the health budgets (lib/board-goals.js). `a` names the anchors of the Board's rows; one the file does not
19
+ * name is left out of `of`.
12
20
  * POST /api/artefacts/set { ws, scope, artefact, field, text } → { ok, line } the PM edits one line from the Viewer (board AwB: "You edit
13
21
  * any line"). A page press (pm-guard requirePagePress); the actor is the PM, so Claude asks before it
14
22
  * changes that line again (lib/artefacts.js pmEdited, lib/driver-decide.js autoApply).
@@ -58,6 +66,33 @@ async function handle(req, res, url, ctx) {
58
66
  out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
59
67
  return send(200, { ok: true, lessons: out.slice(0, 20) });
60
68
  }
69
+ if (sub === 'intent') {
70
+ const w = wsOf(ctx, url.searchParams.get('ws'));
71
+ if (!w || !w.root) return send(404, { ok: false, error: 'no such workspace' });
72
+ let dir;
73
+ try { dir = A.dirOf(w.root); } catch (e) { return send(409, { ok: false, error: String((e && e.message) || e) }); }
74
+ const scopes = (A.parseScope('board:' + w.id) ? ['board:' + w.id] : []).concat('portfolio');
75
+ const intent = A.intentOf(A.fold(A.readLines(A.file(dir))), scopes);
76
+ const D = require('./driver.js');
77
+ let open = [];
78
+ try { const f = D.ledgerFile(ctx.stateDirFor ? ctx.stateDirFor(w) : null); open = f ? D.openProposals(D.fold(D.readLines(f))) : []; } catch { open = []; }
79
+ const here = new Set(scopes.map((sc) => A.parseScope(sc).scope));
80
+ const proposals = open.filter((p) => p.what === 'artefact' && p.target.ws === w.id && p.data && p.data.artefact === 'intent' && here.has(p.data.scope))
81
+ .map((p) => ({ id: p.id, field: p.data.field, op: p.data.op === 'add' ? 'add' : 'set', text: p.data.text, why: p.why || '', sources: p.sources || [], at: p.at || null }));
82
+ const fields = intent ? Object.fromEntries(Object.entries(intent.fields).map(([k, v]) => [k, pageBy(v)])) : null;
83
+ return send(200, { ok: true, ws: w.id, intent: intent ? { scope: intent.scope, fields } : null, proposals });
84
+ }
85
+ if (sub === 'goals') {
86
+ const w = wsOf(ctx, url.searchParams.get('ws'));
87
+ if (!w || !w.root) return send(404, { ok: false, error: 'no such workspace' });
88
+ const BG = require('./board-goals.js');
89
+ const anchors = url.searchParams.getAll('a').slice(0, 200);
90
+ let src = null;
91
+ try { src = require('./goal-source.js').source({ root: w.root, recordsDir: require('./records-dir.js').recordsDirFor(ctx, w.id) }); } catch { src = null; }
92
+ const rows = anchors.map((anchor) => ({ anchor })); // a budget's share: of the open rows the Board named
93
+ const r = BG.goalsFor({ src, budgets: BG.readBudgets(w.root) || [], anchors, rows });
94
+ return send(200, { ok: true, ws: w.id, goals: r.goals, of: r.of });
95
+ }
61
96
  if (sub === 'story') {
62
97
  const w = wsOf(ctx, url.searchParams.get('ws'));
63
98
  if (!w || !w.root) return send(404, { ok: false, error: 'no such workspace' });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.550.0",
3
+ "version": "0.551.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.550.0",
9
+ "version": "0.551.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.550.0",
3
+ "version": "0.551.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -193,7 +193,10 @@ function filterHtml() {
193
193
  const chip = (k, v, label) => `<button type="button" class="bd-chip${F[k].has(v) ? ' on' : ''}" data-flt="${k}" data-v="${esc(v)}" aria-pressed="${F[k].has(v)}">${label || esc(v)}</button>`;
194
194
  // the grouping (PgBoard, PgBoardProduct): programs first by default; a desktop has its own Group button, a phone has it here
195
195
  const G = A.grouping ? A.grouping() : null;
196
- const grp = G && G.on ? `<p class="bd-mlbl">Group</p><div class="bd-fg" role="radiogroup" aria-label="Group">${[['program', 'Programs first'], ['product', 'By product']].map(([k, n]) => `<button type="button" class="bd-chip${(k === 'product') === G.byProduct ? ' on' : ''}" role="radio" aria-checked="${(k === 'product') === G.byProduct}" data-fgrp="${k}">${n}</button>`).join('')}</div>` : '';
196
+ // board AwH: By goal groups the Track under each goal its initiatives anchor to; it shows when a goal resolves for a row here
197
+ const gopts = G ? [...(G.on ? [['program', 'Programs first'], ['product', 'By product']] : G.goal ? [['product', 'By product']] : []), ...(G.goal ? [['goal', 'By goal']] : [])] : [];
198
+ const gnow = G ? G.by || (G.byProduct ? 'product' : 'program') : '';
199
+ const grp = gopts.length > 1 ? `<p class="bd-mlbl">Group</p><div class="bd-fg" role="radiogroup" aria-label="Group">${gopts.map(([k, n]) => `<button type="button" class="bd-chip${k === gnow ? ' on' : ''}" role="radio" aria-checked="${k === gnow}" data-fgrp="${k}">${n}</button>`).join('')}</div>` : '';
197
200
  // a phone's tune sheet (batch 28 item 3, canvas BhA): Group, Sort, the filters, then the Jira read. A desktop has Group and Sort as buttons
198
201
  const T = A.tune ? A.tune() : null;
199
202
  const so = A.sprintOnly ? A.sprintOnly() : null;
@@ -372,7 +375,7 @@ document.addEventListener('click', async (e) => {
372
375
  if (!A || !M()) return;
373
376
  const t = e.target;
374
377
  const fl = t.closest('[data-flt]'); if (fl && Pop.isOpen() && Pop.el().contains(fl)) { const S = A.F[fl.dataset.flt], v = fl.dataset.v; if (S.has(v)) S.delete(v); else S.add(v); Pop.redraw(filterHtml()); A.redraw(); return; }
375
- const fg = t.closest('[data-fgrp]'); if (fg && Pop.isOpen() && Pop.el().contains(fg)) { A.setGrouping(fg.dataset.fgrp === 'product'); Pop.redraw(filterHtml()); return; }
378
+ const fg = t.closest('[data-fgrp]'); if (fg && Pop.isOpen() && Pop.el().contains(fg)) { A.setGrouping(fg.dataset.fgrp); Pop.redraw(filterHtml()); return; }
376
379
  if (t.closest('[data-fsonly]') && Pop.isOpen() && Pop.el().contains(t)) { A.toggleSprintOnly(); Pop.redraw(filterHtml()); A.redraw(); return; }
377
380
  const sk = t.closest('[data-so-pick]'); if (sk && Pop.isOpen() && Pop.el().contains(sk)) { await A.sortPick(sk.dataset.soPick); if (Pop.isOpen()) Pop.redraw(filterHtml()); const b = Pop.isOpen() && Pop.el().querySelector(`[data-so-pick="${sk.dataset.soPick}"]`); if (b) b.focus(); return; }
378
381
  if (t.closest('[data-jread]') && Pop.isOpen() && Pop.el().contains(t)) { Pop.close(false); A.refreshJira(); return; }
@@ -0,0 +1,61 @@
1
+ /* pm/bd-goal.js — the Board's "By goal" grouping (agent-run workspace board AwH, agreed by the PM 2026-11-10).
2
+ *
3
+ * readGoals(ws, rows) → Promise<{ goals, of } | null> GET /api/artefacts/goals: the Goal artefact of each anchor the rows carry (D107, derived)
4
+ * goalGroups(rows, R) → [{ key, goal, rows }] | null PURE. The rows under each goal, key results in the file's order, then the health budgets,
5
+ * then "No goal yet". null when no row's anchor names a goal (zero is silence)
6
+ * goalHeadHtml(g, o) → the Track's goal row: the goal icon, its name, "KR-A1 · no reading yet", the spread of its initiatives over the steps,
7
+ * and in the Next column its target and where the reading comes from. o: { steps, plain, open }
8
+ *
9
+ * A goal is never typed here: it is read from the OKR file and the health budgets (lib/board-goals.js). The stages stay derived. */
10
+ import { pmGet } from './http.js';
11
+
12
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
13
+ const SV = (d, n) => `<svg viewBox="0 0 24 24" aria-hidden="true"${n ? ` width="${n}" height="${n}"` : ''}><path d="${d}"/></svg>`;
14
+ const TARGET = 'M12 4a8 8 0 1 0 0 16a8 8 0 0 0 0-16zM12 8.5a3.5 3.5 0 1 0 0 7a3.5 3.5 0 0 0 0-7z';
15
+ const CHEV_D = 'M7 10l5 5 5-5', CHEV_R = 'M10 7l5 5-5 5';
16
+ const plural = (n, a, b) => (n === 1 ? a : b);
17
+ const NONE = 'goal:none';
18
+
19
+ const CACHE = new Map(); // ws|anchors → { goals, of }
20
+ /** Each open row's anchor goes once per row, so a budget's share counts the rows. */
21
+ export async function readGoals(ws, rows) {
22
+ const A = (rows || []).filter((r) => r && !r.ended).map((r) => String(r.anchor || ''));
23
+ const key = (ws || '') + '|' + A.join(',');
24
+ if (CACHE.has(key)) return CACHE.get(key);
25
+ const q = new URLSearchParams(); if (ws) q.set('ws', ws); for (const a of A) q.append('a', a);
26
+ const r = await pmGet('/api/artefacts/goals?' + q.toString()).catch(() => null);
27
+ const v = r && r.ok ? { goals: r.goals || [], of: r.of || {} } : null;
28
+ if (v) CACHE.set(key, v);
29
+ return v;
30
+ }
31
+
32
+ export function goalGroups(rows, R) {
33
+ if (!R || !(R.goals || []).length) return null;
34
+ const by = new Map(R.goals.map((g) => [g.key, { key: 'goal:' + g.key, goal: g, rows: [] }]));
35
+ const none = { key: NONE, goal: null, rows: [] };
36
+ for (const r of rows || []) { const k = (R.of || {})[String(r.anchor || '')]; (k && by.has(k) ? by.get(k) : none).rows.push(r); }
37
+ const G = [...by.values()].filter((g) => g.rows.length);
38
+ if (!G.length) return null;
39
+ G.sort((a, b) => (a.goal.kind === 'budget') - (b.goal.kind === 'budget') || String(a.goal.key).localeCompare(String(b.goal.key)));
40
+ return none.rows.length ? G.concat(none) : G;
41
+ }
42
+
43
+ /** The goal's fold, as the program and product heads fold (pm/bd-prog.js fold, data-fold). */
44
+ export function goalHeadHtml(g, o = {}) {
45
+ const x = g.goal, open = o.open !== false, steps = o.steps || [], N = steps.length || 8;
46
+ const pc = (n) => ((n / N) * 100).toFixed(3) + '%';
47
+ const ks = g.rows.map((r) => (r.track && Number.isInteger(r.track.k) ? r.track.k : -1)).filter((k) => k >= 0);
48
+ const lo = ks.length ? Math.min(...ks) : -1, hi = ks.length ? Math.max(...ks) : -1, n = g.rows.length;
49
+ const name = (k) => (steps[k] && (steps[k].label || steps[k].name)) || '';
50
+ const words = n + ' ' + plural(n, 'initiative', 'initiatives') + (lo >= 0 && !o.plain ? ', ' + (lo === hi ? name(lo) : name(lo) + ' to ' + name(hi)) : '');
51
+ const band = lo >= 0 && !o.plain ? `<span class="bd-spb" style="left:calc(${pc(lo)} + 4px);width:calc(${pc(hi - lo + 1)} - 8px)"></span>` : '';
52
+ const lab = `<span class="bd-spl" style="left:calc(${pc(lo >= 0 && !o.plain ? lo : 0)} + 14px)">${esc(words)}</span>`;
53
+ const title = x ? x.title : 'No goal yet';
54
+ const meta = x ? x.meta : 'Claude anchors each one to a goal';
55
+ const dl = x ? `<div class="bd-pm"><b>${esc(x.target || '')}</b></div>${x.from ? `<div class="t3">${esc(x.from)}</div>` : ''}` : '';
56
+ return `<div class="bt-r bt-pg bt-goal${x && x.over ? ' over' : ''}" role="row" data-goal="${esc(g.key)}">`
57
+ + `<div class="bt-pgn" role="rowheader"><span class="bt-pgo bt-gln" title="${esc(x && x.objective ? x.objective : title)}"><span class="bd-pti">${SV(TARGET)}</span><span class="tt"><b>${esc(title)}</b><span class="m">${esc(meta)}</span></span></span>`
58
+ + `<button type="button" class="bd-ib sm bd-fold" data-fold="${esc(g.key)}" aria-expanded="${open}" aria-label="${open ? 'Fold' : 'Show'} ${esc(title)}" title="${open ? 'Fold' : 'Show'}">${SV(open ? CHEV_D : CHEV_R)}</button></div>`
59
+ + `<div class="bt-spread" role="cell">${band}${lab}</div>`
60
+ + `<div class="bt-dl" role="cell">${dl}</div></div>`;
61
+ }
@@ -1,13 +1,16 @@
1
- /* pm/bd-next.js — the Board's Next cell (batch 9 item 4; canvas XocA, XocAList, XocAPhone): one line that says what finishes the step next.
2
- * The stage track, the List and the phone draw the same cell.
1
+ /* pm/bd-next.js — the Board's Next cell (batch 9 item 4; canvas XocA, XocAList, XocAPhone). The stage track, the List and the phone draw the same cell.
3
2
  *
4
- * nextOf(r, ctx) → { you, verb, obj, tail, tone, count, due, act } | null PURE. ctx: { self (a PMOS-self board: the stage moves with the files) }
3
+ * Agent-run workspace board AwH (agreed by the PM 2026-11-10): the cell no longer asks the PM to write documents. It says what Claude does next
4
+ * ("✦ Claude writes the experiment"), and only a call that is the PM's reads "Your call · …" in blue ink with a person icon: the verdict (did it
5
+ * work?), a move the team reads (the next stage, the drafted tickets to Jira) and the sign-off. No PRD counters: a part count is the step's
6
+ * machinery, not the PM's. Ticket and task counts stay: they are the team's work, read from Jira and the tasks.
7
+ *
8
+ * nextOf(r, ctx) → { who: claude | you | team, words, when, count, tone, title, act } | null PURE. ctx: { self (a PMOS-self board) }
5
9
  * nextHtml(r, o) → the cell's markup. o: { self, icon (false on the phone), due (false in the List: Finish says the date) }
6
10
  *
7
- * The line is `[blue dot when it waits on the PM] <verb> <object in blue ink>`, the count muted on the right, and an icon action only where
8
- * PMOS can do the step itself (draft with Claude, move the stage, add a stage task, link the epic, read Jira). The icon is a button with
9
- * data-nx (draft | move | add | epic | jira) and data-nxrow (the row key); the page runs it. Nothing is invented: a step with no record
10
- * behind it draws nothing (zero is silence), and the initiative's whole progress is never shown as the step's. */
11
+ * The icon action stays only where PMOS does the step from the page (move the stage, add a stage task, link the epic, read Jira): a button with
12
+ * data-nx (move | add | epic | jira) and data-nxrow (the row key); the page runs it. Nothing is invented: a step with no record behind it draws
13
+ * nothing (zero is silence). */
11
14
  import { esc } from './premium-shell.js';
12
15
  import { sectionOf } from './ini-view-model.js';
13
16
 
@@ -19,17 +22,9 @@ const IC = {
19
22
  };
20
23
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
21
24
  const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
22
- // a part's name as the line says it, and the verb that writes it ("Write the problem statement")
23
- const PART = {
24
- problem: ['Write the', 'problem statement'], users: ['Describe the', 'users'], evidence: ['Add the', 'evidence'], scope: ['Write the', 'scope'],
25
- 'success metric': ['Set the', 'success metric'], 'success measure': ['Set the', 'success measure'], risks: ['List the', 'risks'],
26
- 'business case': ['Write the', 'business case'], 'who asked': ['Name', 'who asked'], timeline: ['Set the', 'timeline'], tickets: ['Draft the', 'tickets'],
27
- 'KR or health budget': ['Pick the', 'KR or health budget'], rank: ['Rank it on the', 'roadmap'],
28
- report: ['Draft the', 'outcome report'], evaluation: ['Write the', 'evaluation'], 'your verdict': ['Give', 'your verdict'],
29
- };
30
- // the parts PMOS can draft with Claude (a document's section); the others are the PM's or another tool's
31
- const DRAFTS = new Set(['problem', 'users', 'evidence', 'scope', 'success metric', 'success measure', 'risks', 'business case', 'report', 'evaluation']);
32
- const OUT = { triage: 'BRD', discover: 'PRD' };
25
+ // what Claude does with the parts of a step: the documents became the seven artefacts (D107); Claude writes them by itself
26
+ const CLAUDE = { triage: 'Claude writes the experiment', discover: 'Claude writes the experiment', plan: 'Claude writes the done test', prioritize: 'Claude ranks it against its goal' };
27
+ const ANCHOR = 'Claude anchors it to a goal';
33
28
  const OPEN_TK = ['In review', 'In progress', 'To do'];
34
29
  const CLOSED = new Set(['Done', "Won't do", 'Archived']);
35
30
 
@@ -39,25 +34,17 @@ function nextStage(r) {
39
34
  return i >= 0 && L[i + 1] ? L[i + 1] : null;
40
35
  }
41
36
  const canMove = (r, ctx) => !(ctx && ctx.self) && !(r.acts && r.acts.life);
37
+ const claude = (words, x = {}) => ({ who: 'claude', words, ...x });
38
+ const yours = (words, x = {}) => ({ who: 'you', words, ...x });
39
+ /** The next stage: the PM's call when the Board moves it (the team reads the stage); Claude's when the stage follows the files (PMOS-self). */
42
40
  function moveLine(r, ctx, count) {
43
41
  const to = nextStage(r);
44
- return to ? { you: true, verb: 'Move to', obj: to, count, act: canMove(r, ctx) ? { kind: 'move', label: 'Move to ' + to } : null } : null;
45
- }
46
- /** A part of the step's output, as the line: Write the <part>, or Review the <part> when the part waits on the PM. */
47
- function partLine(p, count, draftable) {
48
- const [verb, obj] = PART[p.name] || ['Finish the', p.name];
49
- if (/verdict/.test(p.name)) return { you: true, verb: 'Give', obj: 'your verdict', count }; // the verdict is always the PM's
50
- if (p.you && /^your /.test(p.name)) return { you: true, verb: 'Give', obj: p.name, count }; // "your review": Give your review
51
- if (p.you) return { you: true, verb: 'Review the', obj, count };
52
- return { verb, obj, count, act: draftable && DRAFTS.has(p.name) ? { kind: 'draft', label: 'Draft the ' + obj + ' with Claude', q: 'Draft the ' + obj } : null };
53
- }
54
- /** The open parts in the order the line reads them: one that waits on the PM first, then the first not done. */
55
- const firstPart = (parts) => parts.find((p) => !p.done && p.you) || parts.find((p) => !p.done) || null;
56
- /** A task title split into its verb and the rest: "Score vendor B's POC" → Score + vendor B's POC; a title that does not start with a word is finished. */
57
- function taskLine(title) {
58
- const m = /^([A-Z][a-z]+)\s+(\S.*)$/.exec(String(title || '').trim());
59
- return m ? { verb: m[1], obj: m[2] } : { verb: 'Finish', obj: String(title || '').trim() };
42
+ if (!to) return null;
43
+ return canMove(r, ctx) ? yours('move it to ' + to + '?', { count, act: { kind: 'move', label: 'Move to ' + to } }) : claude('Claude moves it to ' + to + ' when its files land', { count });
60
44
  }
45
+ /** A task title as the team's line: "Score vendor B's POC". */
46
+ const taskLine = (title) => ({ who: 'team', words: String(title || '').trim() });
47
+ const isVerdict = (p) => /verdict/.test(p.name);
61
48
 
62
49
  export function nextOf(r, ctx = {}) {
63
50
  if (!r || (r.acts && (r.acts.life === 'cancelled' || r.acts.archived))) return null;
@@ -68,7 +55,7 @@ export function nextOf(r, ctx = {}) {
68
55
  const mine = (r.tasks || []).filter((k) => sectionOf(k, list, r.wfMap) === st.key && k.status !== 'Archived')
69
56
  .map((k, i) => ({ k, i })).sort((a, b) => (Number.isFinite(a.k.order) ? a.k.order : 1e9 + a.i) - (Number.isFinite(b.k.order) ? b.k.order : 1e9 + b.i)).map((x) => x.k);
70
57
  const counted = mine.filter((k) => k.status !== "Won't do"), done = counted.filter((k) => k.status === 'Done').length;
71
- if (!mine.length) return { verb: 'Add what finishes', obj: st.name, act: { kind: 'add', label: 'Add a task to ' + st.name, stage: st.key } };
58
+ if (!mine.length) return claude('Claude plans what finishes ' + st.name, { act: { kind: 'add', label: 'Add a task to ' + st.name, stage: st.key } });
72
59
  const open = mine.find((k) => !CLOSED.has(k.status));
73
60
  const count = counted.length ? done + '/' + counted.length + ' tasks' : '';
74
61
  return open ? { ...taskLine(open.title), count } : moveLine(r, ctx, count);
@@ -81,40 +68,47 @@ export function nextOf(r, ctx = {}) {
81
68
  const p = t.prog || {}, count = p.total ? p.done + '/' + p.total + (p.unit === 'pts' ? ' pts' : ' tickets') : '';
82
69
  const open = tk.filter((k) => k.status !== 'Done');
83
70
  const pick = open.find((k) => k.blocked) || OPEN_TK.map((s) => open.find((k) => !k.blocked && k.status === s)).find(Boolean);
84
- if (pick) return { verb: 'Finish', obj: pick.key, tail: open.length > 1 ? (open.length - 1) + ' more' : '', tone: pick.blocked ? 'red' : '', count, title: pick.key + ' · ' + pick.title + (pick.blocked ? ' · blocked' : '') };
85
- if (key === 'deliver') return { you: true, verb: 'Give your', obj: 'sign-off', count };
71
+ const more = open.length > 1 ? ' · ' + (open.length - 1) + ' more' : '';
72
+ if (pick) return claude((pick.blocked ? 'Claude chases ' : 'Claude follows ') + pick.key + more, { tone: pick.blocked ? 'red' : '', count, title: pick.key + ' · ' + pick.title + (pick.blocked ? ' · blocked' : '') });
73
+ if (key === 'deliver') return yours('sign off the release?', { count });
86
74
  return moveLine(r, ctx, count);
87
75
  }
88
76
  const epic = (it.links && it.links.epic) || (r.epics || [])[0] || null;
89
- return epic ? { verb: 'Read', obj: 'Jira', act: { kind: 'jira', label: 'Read Jira again for ' + epic } } : { verb: 'Link the', obj: 'Jira epic', act: { kind: 'epic', label: 'Link the Jira epic' } };
77
+ return epic ? claude('Claude reads Jira', { act: { kind: 'jira', label: 'Read Jira again for ' + epic } }) : claude('Claude finds the Jira epic', { act: { kind: 'epic', label: 'Link the Jira epic' } });
90
78
  }
91
- const due = (key === 'monitor' || key === 'evaluate') && r.end ? 'due ' + dm(r.end) : '';
92
- if (key === 'monitor') return { verb: 'Draft the', obj: 'outcome report', due, act: { kind: 'draft', label: 'Draft the outcome report with Claude', q: 'Draft the outcome report' } };
79
+ const past = r.end && /^\d{4}-\d{2}-\d{2}/.test(r.end) && String(r.end).slice(0, 10) < new Date().toISOString().slice(0, 10);
80
+ const due = (key === 'monitor' || key === 'evaluate') && r.end ? (past ? 'was due ' : 'due ') + dm(r.end) : '';
81
+ if (key === 'monitor') return claude('Claude reads the outcome', { when: due });
93
82
  // the parts of the step: the trail's (the documents' headings, the tickets drafted), else what the model counts (Prioritize's anchor and rank)
94
83
  let parts = Array.isArray(it.parts) && it.parts.length ? it.parts : null;
95
84
  if (!parts && (key === 'plan' || key === 'prioritize')) parts = (t.segs || []).filter((s) => s.st === 'done' || s.st === 'to do').map((s) => ({ name: key === 'prioritize' && /^kr/i.test(s.name) ? 'KR or health budget' : s.name.toLowerCase(), done: s.st === 'done' }));
96
- if (!parts || !parts.length) return key === 'evaluate' ? { verb: 'Draft the', obj: 'outcome report', due, act: { kind: 'draft', label: 'Draft the outcome report with Claude', q: 'Draft the outcome report' } } : null;
97
- // Plan's ticket part says how many: "3 tickets drafted, waiting on you" is the PM's Commit
98
- parts = parts.map((p) => (/tickets/.test(p.name) ? { ...p, name: 'tickets', pushed: /pushed/.test(p.name) } : p));
99
- const d = parts.filter((p) => p.done).length, n = parts.length;
100
- const count = OUT[key] ? OUT[key] + ' ' + d + '/' + n : key === 'evaluate' ? '' : d + '/' + n + ' parts';
101
- const p = firstPart(parts);
102
- if (!p) return moveLine(r, ctx, count);
103
- const L = partLine(p, count, true);
104
- if (p.name === 'tickets' && p.you) { L.verb = 'Commit the'; L.obj = 'drafted tickets'; } else if (p.pushed) L.verb = 'Push the';
105
- return { ...L, due };
85
+ if (key === 'evaluate' && (!parts || !parts.length || parts.some((p) => !p.done && isVerdict(p)) || parts.every((p) => p.done))) return yours('did it work?', { when: due });
86
+ if (!parts || !parts.length) return CLAUDE[key] ? claude(CLAUDE[key]) : null;
87
+ const open = parts.filter((p) => !p.done);
88
+ if (!open.length) return moveLine(r, ctx, '');
89
+ if (open.some(isVerdict)) return yours('did it work?', { when: due });
90
+ // Plan's drafted tickets waiting on the PM: pushing them to Jira is a move the team reads
91
+ const tickets = open.find((p) => /tickets/.test(p.name) && p.you);
92
+ if (tickets) return yours(/pushed/.test(tickets.name) ? 'push the drafted tickets to Jira?' : 'send the drafted tickets to Jira?');
93
+ if (open.some((p) => /^kr or health budget$/i.test(p.name))) return claude(ANCHOR);
94
+ if (open[0] && /tickets/.test(open[0].name)) return claude('Claude drafts the tickets');
95
+ if (key === 'evaluate') return claude('Claude writes the lessons', { when: due });
96
+ return claude(CLAUDE[key] || 'Claude writes the experiment');
106
97
  }
107
98
 
108
- /** The cell. The icon is ghosted and lights with the row's hover or focus; the phone draws no icon (the row opens the panel). */
99
+ const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
100
+ const PERSON = 'M12 4.5a3.5 3.5 0 1 1 0 7a3.5 3.5 0 0 1 0-7zM5 20a7 7 0 0 1 14 0';
101
+ /** The cell. Claude's line is muted with ✦; the PM's call is blue ink with a person icon and "Your call"; the team's line is plain. The icon
102
+ * action is ghosted and lights with the row's hover or focus; the phone draws no action (the row opens the panel). */
109
103
  export function nextHtml(r, o = {}) {
110
104
  const x = nextOf(r, o);
111
105
  if (!x) return '';
112
- const words = (x.verb ? x.verb + ' ' : '') + x.obj + (x.tail ? ' · ' + x.tail : '');
113
- const count = [x.count, o.due === false ? '' : x.due].filter(Boolean)[0] || '';
114
- // chief-of-staff C5 (UI grill delete list): no "Draft … with Claude" link on a row; the words stay, and the chat over the Board drafts it
115
- const act = x.act && x.act.kind !== 'draft' && o.icon !== false
116
- ? `<button type="button" class="bd-nxa" data-nx="${esc(x.act.kind)}" data-nxrow="${esc(r.key)}"${x.act.q ? ` data-q="${esc(x.act.q)}"` : ''}${x.act.stage ? ` data-stage="${esc(x.act.stage)}"` : ''} aria-label="${esc(x.act.label)}" title="${esc(x.act.label)}">${SV(IC[x.act.kind])}</button>` : '';
117
- return `<div class="bd-nx">${x.you ? '<i class="cz-dot you" role="img" aria-label="Waits on you"></i>' : ''}`
118
- + `<span class="tx" title="${esc(x.title || words)}">${x.verb ? esc(x.verb) + ' ' : ''}<em${x.tone ? ` class="${x.tone}"` : ''}>${esc(x.obj)}</em>${x.tail ? ' · ' + esc(x.tail) : ''}</span>`
106
+ const count = [x.count, o.due === false ? '' : x.when].filter(Boolean)[0] || '';
107
+ const act = x.act && o.icon !== false
108
+ ? `<button type="button" class="bd-nxa" data-nx="${esc(x.act.kind)}" data-nxrow="${esc(r.key)}"${x.act.stage ? ` data-stage="${esc(x.act.stage)}"` : ''} aria-label="${esc(x.act.label)}" title="${esc(x.act.label)}">${SV(IC[x.act.kind])}</button>` : '';
109
+ const ic = x.who === 'claude' ? `<span class="ic" aria-hidden="true">${SV(SPARK)}</span>` : x.who === 'you' ? `<span class="ic" role="img" aria-label="Waits on you">${SV(PERSON)}</span>` : '';
110
+ const words = x.who === 'you' ? `<b>Your call</b> · ${esc(x.words)}` : `<span${x.tone ? ` class="${x.tone}"` : ''}>${esc(x.words)}</span>`;
111
+ const plain = (x.who === 'you' ? 'Your call · ' : '') + x.words;
112
+ return `<div class="bd-nx ${x.who === 'you' ? 'y' : x.who === 'claude' ? 'c' : 't'}">${ic}<span class="tx" title="${esc(x.title || plain)}">${words}</span>`
119
113
  + `${count ? `<span class="mu">${esc(count)}</span>` : ''}${act}</div>`;
120
114
  }
@@ -250,9 +250,13 @@ body.bd-page main.bd-main { position: relative; max-width: none; margin: 16px; p
250
250
  /* the Next cell (pm/bd-next.js; canvas XocA, XocAList, XocAPhone): verb in ink, the object in blue ink, the count muted on the right, the icon lit on the row's hover */
251
251
  .bd-nx { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink); white-space: nowrap; line-height: var(--lh-label); }
252
252
  .bd-nx .tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
253
- .bd-nx em { font-style: normal; font-weight: var(--fw-strong); color: var(--cz-blueink); }
254
- .bd-nx em.red { color: var(--cz-red); }
255
- .bd-nx .cz-dot { width: 7px; height: 7px; }
253
+ /* board AwH: Claude's line is muted with ✦; the PM's call is blue ink with a person icon; the team's line is plain */
254
+ .bd-nx .ic { flex: none; display: inline-grid; place-items: center; color: var(--cz-ink3); }
255
+ .bd-nx .ic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
256
+ .bd-nx.c .tx { font-weight: var(--fw-body); color: var(--cz-ink2); }
257
+ .bd-nx.y .tx { font-weight: var(--fw-body); }
258
+ .bd-nx.y .tx b, .bd-nx.y .ic { color: var(--cz-blueink); font-weight: var(--fw-strong); }
259
+ .bd-nx .tx .red { color: var(--cz-red); }
256
260
  .bd-nx .mu { margin-left: auto; flex: none; font-size: var(--fs-badge); font-weight: var(--fw-strong); color: var(--cz-ink3); line-height: var(--lh-badge); }
257
261
  .bd-nxa { all: unset; box-sizing: border-box; flex: none; width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink3); border: 1px solid var(--cz-hair); cursor: pointer; }
258
262
  .bd-nx .tx + .bd-nxa { margin-left: auto; }
@@ -1150,6 +1154,11 @@ html[data-theme="dark"] body.bd-page { --bd-prog: rgb(180,170,240); --bd-progbg:
1150
1154
  .bt-pgo .tt b { font-size: var(--fs-row); font-weight: var(--fw-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cz-ink); line-height: var(--lh-row); }
1151
1155
  .bt-pgo .tt .m { font-size: var(--fs-badge); color: var(--cz-ink2); font-weight: var(--fw-strong); line-height: var(--lh-badge); }
1152
1156
  .bt-pgo:hover .tt b { color: var(--bd-prog); }
1157
+ /* board AwH: a goal's row on the Track (By goal). It folds; it opens nothing, so its name is not a button */
1158
+ .bt-gln { cursor: default; }
1159
+ .bt-gln:hover .tt b { color: var(--cz-ink); }
1160
+ .bt-goal .bd-pm b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1161
+ .bt-goal.over .tt .m { color: var(--cz-late); }
1153
1162
  .bt-spread { position: relative; }
1154
1163
  .bd-spb { position: absolute; top: 50%; height: 10px; margin-top: -5px; border-radius: 5px; background: var(--bd-progsp); }
1155
1164
  .bd-spl { position: absolute; top: 50%; transform: translateY(-50%); font-size: var(--fs-badge); font-weight: var(--fw-strong); color: var(--bd-prog); white-space: nowrap; line-height: var(--lh-badge); }
@@ -26,6 +26,7 @@ import * as VW from './cozy-viewer.js';
26
26
  import * as SV from './small-vw.js'; // the small Viewers: a stakeholder, its form, a routine (batch 18 item 2-C)
27
27
  import { pmGet, pmPost, pmHeaders } from './http.js';
28
28
  import * as ST from './story.js';
29
+ import * as IT from './intent.js'; // board AwI: the Intent card under the story
29
30
  import * as H from './home-data.js';
30
31
  import { mountChat, avHtml } from './home-chat.js';
31
32
  import * as MORE from './home-more.js';
@@ -1240,9 +1241,11 @@ function productPageHtml(x, ws, vid, name, g) {
1240
1241
  ];
1241
1242
  // "The story so far" (board AwE): the product's Narrative under the top line, a source on every line; the top line says it is the weekly update
1242
1243
  const story = x.story ? ST.storyHtml(x.story, { sources: true }) : '';
1244
+ // the Intent card (board AwI): the PM's what we want, limits and what we will not do, with Claude's ✦ proposals to add or decline
1245
+ const intent = x.intent ? IT.intentHtml(x.intent, { edit: !!x.intent.edit }) : '';
1243
1246
  const lead = story ? 'Your weekly update is this story.' : d && d.handled ? d.handled.lead : '';
1244
1247
  const rest = story ? 'I keep it current from the records, and every line says where it came from.' : d && d.handled ? d.handled.rest : '';
1245
- return PV.pageHtml({ page: 'product:' + (ws || 'own'), line: { lead, rest, warn: !story && !!(d && d.handled && d.handled.tone === 'warn') }, goal: story + goal, cards: progs + budgets, props, tabs,
1248
+ return PV.pageHtml({ page: 'product:' + (ws || 'own'), line: { lead, rest, warn: !story && !!(d && d.handled && d.handled.tone === 'warn') }, goal: story + intent + goal, cards: progs + budgets, props, tabs,
1246
1249
  tail: isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '' });
1247
1250
  }
1248
1251
  function productDash(b, ws, vid, name, g) {
@@ -1253,6 +1256,13 @@ function productDash(b, ws, vid, name, g) {
1253
1256
  if (!(x.d && (x.d.goals || []).some((y) => !y.budget))) fillGoals(b, ws); // no goal in the page model yet: the goals line of /api/goal-status
1254
1257
  };
1255
1258
  PV.wirePage(b, { redraw: paint });
1259
+ // the Intent card's presses (pm/intent.js); a reused Viewer body follows the product it shows now
1260
+ b.__itO = { ws: () => ws, get: () => x.intent || null, set: (v) => { x.intent = v; }, redraw: paint, toast };
1261
+ if (!b.__itWired) {
1262
+ b.__itWired = true;
1263
+ b.addEventListener('click', (e) => { IT.onIntentClick(e, b, b.__itO); });
1264
+ b.addEventListener('submit', (e) => { IT.onIntentSubmit(e, b, b.__itO); });
1265
+ }
1256
1266
  {
1257
1267
  DB.wireDash(b, { d: () => x.d, open: x.open, ws, toast, redraw: paint, kr: () => x.kr, reloadKr: async () => { x.kr = await DB.readKr(ws); },
1258
1268
  // the chart icon at the Goals block's head: Intelligence › Delivery trends, of this product
@@ -1266,6 +1276,7 @@ function productDash(b, ws, vid, name, g) {
1266
1276
  DB.readDash(ws, 'product', 'read').then((d) => { if (d) { x.d = d; paint(); } });
1267
1277
  DB.readKr(ws).then((k) => { x.kr = k; if (DB.krOf(k).length) paint(); });
1268
1278
  ST.readStory(ws).then((st) => { STORY.set(ws || '', st); if (JSON.stringify(st) !== JSON.stringify(x.story || null)) { x.story = st; paint(); } });
1279
+ if (!(x.intent && x.intent.edit)) IT.readIntent(ws).then((v) => { if (x.intent && x.intent.edit) return; if (JSON.stringify(v) !== JSON.stringify(x.intent || null)) { x.intent = v; paint(); } });
1269
1280
  }
1270
1281
  /** The product's story (pm/story.js) by workspace, as last read: the weekly update Claude drafts leads with it. */
1271
1282
  const STORY = new Map();
@@ -0,0 +1,29 @@
1
+ /* pm/intent.css — the Intent card on the product page (pm/intent.js; board AwI). Tokens only. */
2
+ .it-card { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; }
3
+ .it-h { display: flex; align-items: center; gap: 8px; }
4
+ .it-h h4 { margin: 0; font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); }
5
+ .it-h small { font-size: var(--fs-label); color: var(--cz-ink3); line-height: var(--lh-label); }
6
+ .it-h .sp { flex: 1; }
7
+ .it-ed, .it-pr button, .it-eb button { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 6px; border: 0; cursor: pointer; background: var(--cz-well); color: var(--cz-ink2); }
8
+ .it-pr button { background: var(--cz-card); }
9
+ .it-pr button.ok, .it-eb button.ok { background: var(--cz-blueink); color: var(--cz-card); }
10
+ .it-ed:focus-visible, .it-pr button:focus-visible, .it-eb button:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
11
+ .it-pr button:disabled { opacity: .5; cursor: default; }
12
+ .it-card dl { margin: 0; display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px 16px; }
13
+ .it-card dt { font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); padding-top: 2px; line-height: var(--lh-label); }
14
+ .it-card dd { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
15
+ .it-card dd p { margin: 0 0 4px; }
16
+ .it-none { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink3); }
17
+ .it-pr { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--cz-well); }
18
+ .it-pr .tx { flex: 1; min-width: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
19
+ .it-pr .tx small { display: block; margin-top: 2px; font-size: var(--fs-label); color: var(--cz-ink3); line-height: var(--lh-label); }
20
+ .it-pr .st { color: var(--cz-blueink); margin-top: 3px; display: inline-grid; }
21
+ .it-form { display: flex; flex-direction: column; gap: 10px; }
22
+ .it-f { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 16px; align-items: start; }
23
+ .it-f span { font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); padding-top: 9px; line-height: var(--lh-label); }
24
+ .it-f textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: var(--fs-field); color: var(--cz-ink); padding: 8px 10px; border-radius: 6px; border: 1px solid var(--cz-hair); background: var(--cz-card); resize: vertical; }
25
+ .it-eb { display: flex; justify-content: flex-end; gap: 8px; }
26
+ @media (max-width: 560px) {
27
+ .it-card dl, .it-f { grid-template-columns: minmax(0, 1fr); gap: 4px; }
28
+ .it-card dd { margin-bottom: 8px; }
29
+ }
@@ -0,0 +1,94 @@
1
+ /* pm/intent.js — the Intent card on the product page (agent-run workspace board AwI, agreed by the PM 2026-11-10).
2
+ * The Intent artefact (D107): what we want, the limits Claude works inside, and what we will not do. It is the PM's: Claude never writes it.
3
+ * Claude's change to it is a ✦ proposal under the card, which the PM adds (✓) or declines (✕); the pencil edits the three lines in place.
4
+ *
5
+ * readIntent(ws) GET /api/artefacts/intent → { intent: { scope, fields }, proposals } | null
6
+ * intentHtml(x, { edit }) the card. Empty with no proposal: one quiet line that says Claude proposes it and the pencil writes it
7
+ * onIntentClick(e, root, o) · onIntentSubmit(e, root, o) the presses, called by the page's own listeners: pencil, Save, Cancel, ✓ Add it (POST /api/driver/keep), ✕ Not this (POST /api/driver/drop).
8
+ * o: { ws, get() → x, set(x), redraw(), toast(msg) }
9
+ */
10
+ import { pmGet, pmPost } from './http.js';
11
+
12
+ const CSS = new URL('./intent.css', import.meta.url).href;
13
+ if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
14
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
15
+ }
16
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
17
+ const SV = (d, n = 16, w = 1.9) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
18
+ const P = {
19
+ pen: 'M4 20h4L19 9l-4-4L4 16v4zM13.5 6.5l4 4', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
20
+ x: 'M6 6l12 12M18 6L6 18', check: 'M5 12.5l4.5 4.5L19 7',
21
+ };
22
+ export const FIELDS = [['want', 'What we want'], ['limits', 'Limits'], ['not', 'We will not']];
23
+ const NOUN = { want: 'what we want', limits: 'a limit', not: 'what we will not do' };
24
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
25
+ const day = (iso) => { const t = Date.parse(iso || ''); if (!Number.isFinite(t)) return ''; const d = new Date(t); return d.getDate() + ' ' + MON[d.getMonth()]; };
26
+ const linesOf = (v) => String((v && v.text) || '').split(/\n+/).map((x) => x.trim()).filter(Boolean);
27
+
28
+ export async function readIntent(ws) {
29
+ const r = await pmGet('/api/artefacts/intent' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
30
+ return r && r.ok && r.intent ? { intent: r.intent, proposals: r.proposals || [] } : null;
31
+ }
32
+
33
+ /** One ✦ proposal: "Add a limit: …" or "Change what we want to: …", where it came from, ✕ and ✓. */
34
+ function propHtml(p) {
35
+ const say = p.op === 'add' ? (p.field === 'limits' ? 'Add a limit: ' : p.field === 'not' ? 'Add to what we will not do: ' : 'Add to what we want: ') : 'Change ' + (NOUN[p.field] || p.field) + ' to: ';
36
+ const src = (p.sources || []).filter((s) => s && s.label).map((s) => s.label)[0];
37
+ const from = [src ? 'From ' + src : p.why, day(p.at)].filter(Boolean).join(' · ');
38
+ return `<div class="it-pr" data-it-prop="${esc(p.id)}"><span class="st">${SV(P.spark, 16)}</span><div class="tx">${esc(say + p.text)}${from ? `<small>${esc(from)}</small>` : ''}</div>`
39
+ + `<button type="button" data-it-drop="${esc(p.id)}" aria-label="Not this" title="Not this">${SV(P.x, 14, 2)}</button>`
40
+ + `<button type="button" class="ok" data-it-keep="${esc(p.id)}" aria-label="Add it" title="Add it">${SV(P.check, 16, 2.4)}</button></div>`;
41
+ }
42
+
43
+ export function intentHtml(x, o = {}) {
44
+ if (!x || !x.intent) return '';
45
+ const F = x.intent.fields || {}, props = x.proposals || [];
46
+ const empty = FIELDS.every(([k]) => !linesOf(F[k]).length);
47
+ const head = `<div class="it-h"><h4>Intent</h4><small>Yours. Claude works inside it.</small><span class="sp"></span>${o.edit ? '' : `<button type="button" class="it-ed" data-it-edit aria-label="Edit the intent" title="Edit">${SV(P.pen, 16)}</button>`}</div>`;
48
+ if (o.edit) {
49
+ const f = FIELDS.map(([k, label]) => `<label class="it-f"><span>${esc(label)}</span><textarea name="${k}" rows="${Math.max(2, linesOf(F[k]).length + 1)}" placeholder="One line each">${esc(linesOf(F[k]).join('\n'))}</textarea></label>`).join('');
50
+ return `<section class="pv-card it-card" aria-label="Intent">${head}<form class="it-form" data-it-form>${f}<div class="it-eb"><button type="button" data-it-cancel aria-label="Cancel" title="Cancel">${SV(P.x, 14, 2)}</button><button type="submit" class="ok" aria-label="Save" title="Save">${SV(P.check, 16, 2.4)}</button></div></form></section>`;
51
+ }
52
+ const dl = empty ? `<p class="it-none">Not written yet. Claude proposes it from the strategy and the records, or write it with the pencil.</p>`
53
+ : `<dl>${FIELDS.map(([k, label]) => { const L = linesOf(F[k]); return L.length ? `<dt>${esc(label)}</dt><dd>${L.map((l) => `<p>${esc(l)}</p>`).join('')}</dd>` : ''; }).join('')}</dl>`;
54
+ return `<section class="pv-card it-card" aria-label="Intent">${head}${dl}${props.map(propHtml).join('')}</section>`;
55
+ }
56
+
57
+ const busy = new Set();
58
+ const reload = async (o) => { const v = await readIntent(o.ws()); o.set(v ? { ...v, edit: false } : null); o.redraw(); };
59
+ /** A click inside the page that holds the card: true when it was the card's. The page owns the listener (home-app.js). */
60
+ export async function onIntentClick(e, root, o) {
61
+ {
62
+ const t = e.target.closest('[data-it-edit],[data-it-cancel],[data-it-keep],[data-it-drop]');
63
+ if (!t || !root.contains(t)) return false;
64
+ const x = o.get(); if (!x) return true;
65
+ if (t.matches('[data-it-edit]')) { o.set({ ...x, edit: true }); o.redraw(); const a = root.querySelector('[data-it-form] textarea'); if (a) a.focus(); return true; }
66
+ if (t.matches('[data-it-cancel]')) { o.set({ ...x, edit: false }); o.redraw(); return true; }
67
+ const id = t.dataset.itKeep || t.dataset.itDrop; if (!id || busy.has(id)) return true;
68
+ busy.add(id); t.disabled = true;
69
+ const keep = t.matches('[data-it-keep]');
70
+ const r = await pmPost('/api/driver/' + (keep ? 'keep' : 'drop'), { ws: o.ws() || undefined, proposal: id, ...(keep ? {} : { note: 'Not this, from the Intent card' }) }).catch(() => null);
71
+ busy.delete(id);
72
+ if (!r || !r.ok) { t.disabled = false; if (o.toast) o.toast((r && r.error) || 'Nothing changed. Try again.'); return true; }
73
+ if (o.toast) o.toast(keep ? 'Added to your intent.' : 'Declined. Claude keeps the reason.');
74
+ await reload(o);
75
+ return true;
76
+ }
77
+ }
78
+ /** A form submit inside the page: the card's edit form saves the parts that changed, as the PM. */
79
+ export async function onIntentSubmit(e, root, o) {
80
+ {
81
+ const f = e.target.closest('[data-it-form]'); if (!f || !root.contains(f)) return false;
82
+ e.preventDefault();
83
+ const x = o.get(); if (!x || !x.intent) return true;
84
+ const F = x.intent.fields || {};
85
+ const changed = FIELDS.map(([k]) => [k, String((f.elements[k] && f.elements[k].value) || '').split(/\n+/).map((l) => l.trim()).filter(Boolean).join('\n')])
86
+ .filter(([k, v]) => v && v !== linesOf(F[k]).join('\n'));
87
+ for (const [k, v] of changed) {
88
+ const r = await pmPost('/api/artefacts/set', { ws: o.ws() || undefined, scope: x.intent.scope, artefact: 'intent', field: k, text: v }).catch(() => null);
89
+ if (!r || !r.ok) { if (o.toast) o.toast((r && r.error) || 'It could not be saved. Nothing changed.'); break; }
90
+ }
91
+ await reload(o);
92
+ return true;
93
+ }
94
+ }
@@ -52,6 +52,7 @@ import * as BI from './bd-ini-panel.js';
52
52
  import * as DL from './bd-deliveries.js';
53
53
  import * as CO from './bd-cols.js'; // the timeline's columns, their menu and their sort (batch 19 item 5, StsA8Board) // the Deliveries lane under the timeline's axis (batch 13 item 4, XcalmA6Lane)
54
54
  import { nextHtml } from './bd-next.js';
55
+ import * as GL from './bd-goal.js'; // board AwH: the Track grouped By goal
55
56
  import { statusOf as ivStatus } from './ini-view-model.js';
56
57
  import { initiativeRename, taskRename } from './rename-press.js';
57
58
  import { setSay } from './cozy-xv.js';
@@ -87,7 +88,10 @@ let ALL = Q0.get('all') === '1' || PICK.length > 1; // All products, or severa
87
88
  const DEEP = ALL || PICK.length > 0 || Q0.has('ws') || Q0.has('board');
88
89
  let ONE = null; // the one ticked product's board, 'ws|id', when the pick holds one
89
90
  let PKP = null, picked = false; // the saved pick (GET /api/briefing-premium/products), and whether it has been turned into boards
90
- let byProduct = store.get(GROUPING_KEY) === 'product'; // the grouping: programs first (default) or By product (PgBoardProduct)
91
+ // the grouping: By goal (board AwH, the default on the Track), programs first, or By product (PgBoardProduct)
92
+ let grouping = ['program', 'product', 'goal'].includes(store.get(GROUPING_KEY)) ? store.get(GROUPING_KEY) : 'goal';
93
+ let byProduct = grouping === 'product';
94
+ let GOALS = null, goalsFor = ''; // GET /api/artefacts/goals for the rows on screen ({ goals, of }), and the rows it was read for
91
95
  let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
92
96
  let peek = null; // what the Viewer shows for the Board: { kind: 'ini', key } an initiative or its ticket, { kind: 'acts' } an acts panel
93
97
  mountNav('board', document, { scope: () => Acts.findScope() }); // ⌘K and Find open Search scoped to this Board first (UI grill U2)
@@ -505,8 +509,19 @@ function trackRow(r, cls = '', po = false) {
505
509
  const cellsCls = () => 'bt-cells' + (TK.mode === 'cats' ? ' bands' : TK.mode === 'wf' ? ' wfn' : '');
506
510
  const cellsStyle = () => (TK.mode === 'wf' ? ` style="--n:${Math.max(1, TK.steps.length)}"` : '');
507
511
  const isME = (r) => r.track && r.track.k >= 6;
512
+ /** By goal (board AwH): on the Track, when a goal resolves for a row here; else the programs-first grouping draws as before. */
513
+ const goalsHere = () => !!(GOALS && GOALS.goals.length && M && GL.goalGroups(M.initiatives.list.rows, GOALS));
514
+ const goalOn = () => grouping === 'goal' && curView() === 'track' && goalsHere();
515
+ function readGoals() {
516
+ if (!M) return;
517
+ const rows = M.initiatives.list.rows, sig = ((M.board && M.board.ws) || '') + '|' + rows.map((r) => r.anchor || '').join(',');
518
+ if (sig === goalsFor) return;
519
+ goalsFor = sig;
520
+ GL.readGoals((M.board && M.board.ws) || '', rows).then((R) => { if (sig !== goalsFor) return; const was = goalOn(); GOALS = R; if (goalOn() !== was || goalOn()) { drawChips(); drawInit(); } });
521
+ }
508
522
  function drawTrack(L) {
509
523
  TK = trackMode(L);
524
+ readGoals();
510
525
  const S = TK.mode === 'pf' ? M.steps || [] : TK.steps || [];
511
526
  // one product and no program: its initiatives in the PM's sort or own order, the same as Home's (batch 14 item 8); grouped, groups() sorts each
512
527
  const sorted = sortInis(prodKey((M.board && (M.board.product || M.board.name)) || ''), L, SO.layout(), INI_ACC);
@@ -526,7 +541,8 @@ function drawTrack(L) {
526
541
  // programs first, then the product (PgBoard); "By product" draws the product only, a program's rows with its layers icon (PgBoardProduct).
527
542
  // Grouped, each product folds its own Monitor and Evaluate rows after the first of each, under "N more" (PgBoard .tf); the foot keeps
528
543
  // only the ones this page has not loaded
529
- const G = groups(sorted);
544
+ const GG = goalOn() && TK.mode !== 'cats' ? GL.goalGroups(sorted, GOALS) : null;
545
+ const G = GG ? null : groups(sorted);
530
546
  let inGroups = 0;
531
547
  const meFold = (rs) => { const seen2 = new Set(), on = [], off = []; for (const r of rs) { if (isME(r) && seen2.has(r.track.k) && !foldOpen) off.push(r); else { if (isME(r)) seen2.add(r.track.k); on.push(r); } } return { on, off }; };
532
548
  // the programs and products are one list the grip arranges, and each product's initiatives another, shared with Home (batch 14 item 8)
@@ -543,9 +559,15 @@ function drawTrack(L) {
543
559
  if (PG.folded(g.key)) return grp(pk, g.name, PG.prodHtml(g));
544
560
  const f = meFold(g.rows); inGroups += f.off.length;
545
561
  return grp(pk, g.name, PG.prodHtml(g) + own(pk, f.on.map((r) => trackRow(r, ' bt-gr', true)).join('')) + (f.off.length ? `<button type="button" class="dlink bt-gmore" data-mefold aria-expanded="false">${SV(I.chev)}${f.off.length} more</button>` : ''));
546
- }).join('')}</div>` : own(prodKey((M.board && (M.board.product || M.board.name)) || ''), shown.map((r) => trackRow(r, '', true)).join(''));
547
- const rest = G ? Math.max(0, meTotal - sorted.filter(isME).length) : more; // grouped: the ones not loaded here
548
- const tf2 = !G ? tf : rest > 0 && !foldOpen && !inGroups ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${rest} more in Monitor and Evaluate</button>` : foldOpen && meTotal > 1 ? tf : '<span></span>';
562
+ }).join('')}</div>` : GG ? GG.map((g) => {
563
+ // By goal (board AwH): each goal's row, then its initiatives; Monitor and Evaluate fold after the first of each, as a product's do
564
+ const f = meFold(g.rows); if (!PG.folded(g.key)) inGroups += f.off.length;
565
+ const kids = PG.folded(g.key) ? '' : f.on.map((r, i) => trackRow(r, ' bt-kid' + (i === f.on.length - 1 ? ' last' : ''), false)).join('')
566
+ + (f.off.length ? `<button type="button" class="dlink bt-gmore" data-mefold aria-expanded="false">${SV(I.chev)}${f.off.length} more</button>` : '');
567
+ return `<div class="so-g bt-gg" role="rowgroup">${GL.goalHeadHtml(g, { steps: S, plain: TK.mode !== 'pf', open: !PG.folded(g.key) })}${kids}</div>`;
568
+ }).join('') : own(prodKey((M.board && (M.board.product || M.board.name)) || ''), shown.map((r) => trackRow(r, '', true)).join(''));
569
+ const rest = G || GG ? Math.max(0, meTotal - sorted.filter(isME).length) : more; // grouped: the ones not loaded here
570
+ const tf2 = !G && !GG ? tf : rest > 0 && !foldOpen && !inGroups ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${rest} more in Monitor and Evaluate</button>` : foldOpen && meTotal > 1 ? tf : '<span></span>';
549
571
  return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${rows}<div class="bt-tf">${tf2}</div>${small() ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
550
572
  }
551
573
 
@@ -613,7 +635,7 @@ PHONE.addEventListener('change', () => { if (M) { drawChips(); drawInit(); } });
613
635
  /** The grouping (PgBoard, PgBoardProduct): programs first (the default) or By product, in the tune sheet (#bdFilter) since UI grill U2.
614
636
  * Only when a program holds a row here (zero is silence). */
615
637
  const groupingOn = () => !!(M && PGS.length && PG.groupsOf(PGS, M.initiatives.list.rows, M, false));
616
- function setGrouping(bp) { byProduct = !!bp; store.set(GROUPING_KEY, byProduct ? 'product' : 'program'); drawChips(); drawInit(); }
638
+ function setGrouping(k) { grouping = ['program', 'product', 'goal'].includes(k) ? k : k === true ? 'product' : 'program'; byProduct = grouping === 'product'; store.set(GROUPING_KEY, grouping); drawChips(); drawInit(); }
617
639
  /* a narrower or wider Board fits another number of columns: redraw the timeline then, and only then */
618
640
  new ResizeObserver(() => {
619
641
  if (!M || curView() !== 'time' || small()) return;
@@ -1197,7 +1219,7 @@ V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta,
1197
1219
  Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
1198
1220
  Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); }, F, rowOf, statusOf, openIni: openIniAny,
1199
1221
  openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
1200
- grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
1222
+ grouping: () => ({ on: groupingOn(), byProduct, by: grouping === 'goal' && !(curView() === 'track' && goalsHere()) ? (groupingOn() ? 'program' : 'product') : grouping, goal: curView() === 'track' && goalsHere() }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
1201
1223
  tune: tuneParts, sprintOnly, toggleSprintOnly: () => { if (F.chips.has('sprint')) F.chips.delete('sprint'); else F.chips.add('sprint'); }, sortPick, refreshJira: () => refreshJira() });
1202
1224
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
1203
1225
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
@@ -37,7 +37,8 @@ Procedure:
37
37
  d. Budget. Reach and impact with every assumption stated, and the effort it is worth (`field: budget`), with the sources of the numbers.
38
38
  e. People. Who to ask and why, one line each, with the pointer that names them (`field: people`).
39
39
  f. Done test. The checks that will say the experiment is done, one proposal per check: `{"artefact": "done-test", "field": "check", "text": "<a check someone can run>"}`. The done test comes before any build (D13 as amended by D107).
40
- g. When the problem (a), the evidence (b) and the budget (d) are all kept, propose the move to Plan. File `--what move` with `{"to": "<the name of the first Plan stage of this initiative's workflow>"}` and a `--why` that says what the PM can now decide. You only propose it. The PM moves the stage.
40
+ g. Intent, only when a record you read changes it. The product's Intent (what we want, the limits, what we will not do) is the PM's: you never write it, and your proposal waits for the PM on the product page. To add one line, file `{"artefact": "intent", "field": "limits", "op": "add", "text": "<one line>"}` (field `want`, `limits` or `not`) with the `--source` that says it. Leave out `op` only to replace the whole field.
41
+ h. When the problem (a), the evidence (b) and the budget (d) are all kept, propose the move to Plan. File `--what move` with `{"to": "<the name of the first Plan stage of this initiative's workflow>"}` and a `--why` that says what the PM can now decide. You only propose it. The PM moves the stage.
41
42
  5. Plan, Do and Learn. Do not write the missing work yourself. Name the blocker the prompt gives, check that it is true, and propose what would clear it:
42
43
  - Plan: no PRD, no done-criteria, or no anchor. File a `note` that says which is missing and what the PM could do (for a PRD, which requirement notes and evidence it could start from; for an anchor, which KR or health budget fits, with the pointer to it).
43
44
  - Do: no ticket moved, or a ticket is blocked. File a `note` with the ticket keys, how long they have not moved and who could unblock them.