create-pmos 0.492.0 → 0.493.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/package.json +14 -14
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/mods/pmos-cockpit/README.md +1 -1
  4. package/payload/mods/pmos-cockpit/hooks/lib/guard.mjs +2 -2
  5. package/payload/planning/evals/eval-calibration.md +1 -1
  6. package/payload/planning/okrs/health-budgets.md +1 -1
  7. package/payload/state/discoveries.md +1 -1
  8. package/workspace/changelog.json +13 -0
  9. package/workspace/fixtures/initiatives-api/list.json +0 -4
  10. package/workspace/fixtures/initiatives-api/roadmap.json +255 -275
  11. package/workspace/fixtures/initiatives-api/sheet.json +2 -3
  12. package/workspace/fixtures/report-api/draft.json +4 -4
  13. package/workspace/fixtures/reports-page/draft-biweekly-2026-10-16.md +4 -4
  14. package/workspace/guide/board.md +2 -2
  15. package/workspace/guide/index.md +2 -2
  16. package/workspace/guide/initiative-boards.md +2 -2
  17. package/workspace/guide/initiatives-roadmap.md +38 -39
  18. package/workspace/guide/initiatives-screen.md +20 -20
  19. package/workspace/guide/initiatives-timeline.md +7 -9
  20. package/workspace/guide/integrated-work.md +7 -8
  21. package/workspace/guide/layout.md +2 -2
  22. package/workspace/guide/lifecycle.md +2 -2
  23. package/workspace/guide/notes.md +1 -1
  24. package/workspace/guide/pm-only-acts.md +5 -5
  25. package/workspace/guide/pm-only-lines.md +3 -3
  26. package/workspace/guide/reports.md +2 -2
  27. package/workspace/guide/today.md +2 -2
  28. package/workspace/lib/board-cli.js +1 -1
  29. package/workspace/lib/board-fold.js +6 -6
  30. package/workspace/lib/board-premium.js +3 -3
  31. package/workspace/lib/calendar-tidy.js +1 -1
  32. package/workspace/lib/core-docs.js +2 -2
  33. package/workspace/lib/engine/boards.js +11 -11
  34. package/workspace/lib/engine/signals/detectors.js +13 -13
  35. package/workspace/lib/engine/signals/facts.js +5 -3
  36. package/workspace/lib/health-rules-factory.js +13 -14
  37. package/workspace/lib/health-rules-plan.js +8 -7
  38. package/workspace/lib/initiative-cli.js +59 -63
  39. package/workspace/lib/initiative-needs.js +6 -6
  40. package/workspace/lib/initiative-premium.js +2 -2
  41. package/workspace/lib/initiative-writer.js +2 -2
  42. package/workspace/lib/lifecycle-stage.js +39 -0
  43. package/workspace/lib/placements.js +117 -95
  44. package/workspace/lib/plan-rules.js +7 -5
  45. package/workspace/lib/pm-guard.js +1 -3
  46. package/workspace/lib/pm-lines-needs.js +1 -1
  47. package/workspace/lib/report-draft.js +17 -16
  48. package/workspace/lib/report-slides-data.js +11 -7
  49. package/workspace/lib/routes-boards.js +8 -7
  50. package/workspace/lib/routes-initiatives.js +29 -43
  51. package/workspace/lib/routes-notes.js +24 -15
  52. package/workspace/lib/split-merge.js +2 -3
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -1
  55. package/workspace/public/pm/http.js +1 -1
  56. package/workspace/public/pm/view-notes.js +8 -8
  57. package/workspace/replaced-tests.json +14 -0
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Today: what needs you"
4
4
  description: "The Agenda month and the calendar it remembers, the meeting notes of a meeting, the two-column day (your jobs and the agent's jobs), the eight kinds of card on Today, the one button on each card, the count, the empty state, and the pmos today command."
5
- timestamp: 2026-10-08
5
+ timestamp: 2026-11-02
6
6
  ---
7
7
 
8
8
  # Today: what needs you
@@ -157,7 +157,7 @@ Today puts the cards in this order. Within a kind, the cards keep a fixed order,
157
157
  | 4. Work to check | An item is in Review, or an item is Done with no evidence. | Open |
158
158
  | 5. Keep an agent breakdown | Retired by D98: an agent's items are live at once, so this card no longer shows. | — |
159
159
  | 6. A triaged capture | A capture was triaged and waits for you to add it or dismiss it. | Open |
160
- | 7. Cycle review | The cycle review is due. You confirm what is in Now, or move it. | Open |
160
+ | 7. Cycle review | The cycle review is due: an agent proposal to keep or drop, or a check-by date that passed. | Open |
161
161
  | 8. Needs repair | A schedule left no output, a line from the PM has no attestation, or a record has no anchor. Today shows the card until it is fixed. | Open |
162
162
 
163
163
  A stalled initiative is not a card. It shows as a health reason on the initiative, in the list and in its detail.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * The SAME fold the Board page reads (lib/board-fold.js, the one behind GET /api/board), so a terminal line and a card
7
7
  * cannot disagree about an item. No server is needed: the command reads the ledgers of the repository. With no flag it
8
- * prints the Active filter (an item with an event in the last stall_days, an open item under an initiative in Now, and
8
+ * prints the Active filter (an item with an event in the last stall_days, an open item under an initiative ranked on the Roadmap, and
9
9
  * your own items). `--mine` prints your own items. `--init <initiative>` prints one initiative. `--json` prints the same
10
10
  * answer as GET /api/board for that filter, without the workspace id. The command only reads: it writes no line.
11
11
  *
@@ -14,7 +14,7 @@
14
14
  * lib/plan-tree.js layout() builds each initiative's columns (R19, the same 14-day Done window).
15
15
  *
16
16
  * FILTERS (R9). `active` is the default: an item with an event in the last stall_days (planning/plan-rules.json), an open
17
- * item under an initiative that is in Now, and the PM's own items (owner `you`). `mine` is the PM's own items. `init:<id>`
17
+ * item under an initiative a line ranked on the Roadmap (D105), and the PM's own items (owner `you`). `mine` is the PM's own items. `init:<id>`
18
18
  * is one initiative. Done shows the last 14 days under Active and under an initiative, however old the item's last event is
19
19
  * (the layout's own window, lib/plan-tree.js DONE_WINDOW_MS); older Done items are counted, never listed. Under Mine, Done
20
20
  * shows the PM's own items by the same window.
@@ -44,7 +44,6 @@ const planRules = require('./plan-rules.js');
44
44
  const actor = require('./actor.js');
45
45
 
46
46
  const DAY = 86400000;
47
- const HORIZON_RANK = { now: 0, next: 1, later: 2 };
48
47
  const STATES = ['todo', 'doing', 'review', 'done'];
49
48
  const NOT_MERGED = planTree.NOT_MERGED_LABEL || 'Done · your call · not merged';
50
49
  const TOKEN_TEXT_RE = /\b(sess-\d+)\.[0-9a-f]{8}\b/g;
@@ -203,15 +202,16 @@ function boardRead(w, { filter, now = Date.now() } = {}) {
203
202
 
204
203
  const rows = inits.map((i) => {
205
204
  const p = place.byInit && place.byInit[i.id];
206
- return { ...i, horizon: placements.horizonOf(place, i.id), rank: p && Number.isFinite(p.rank) ? p.rank : 0 };
207
- }).sort((a, b) => (HORIZON_RANK[a.horizon] - HORIZON_RANK[b.horizon]) || (a.rank - b.rank) || a.id.localeCompare(b.id));
205
+ // D105: one Roadmap rank. `ranked` = a line put it on the Roadmap (Prioritize's output), not day one's guess
206
+ return { ...i, rank: p && Number.isFinite(p.rank) ? p.rank : 0, ranked: !!(p && p.confirmed) };
207
+ }).sort((a, b) => (a.rank - b.rank) || a.id.localeCompare(b.id));
208
208
 
209
209
  const wanted = (it, row) => {
210
210
  if (f.kind === 'init') return it.initiative === f.init;
211
211
  if (it.owner === 'you') return true;
212
212
  if (f.kind === 'mine') return false;
213
213
  if (it.state === 'done') return true; // plan-tree's 14-day window lists the recent ones; the rest are counted
214
- if (row.horizon === 'now') return true;
214
+ if (row.ranked) return true; // every item of a ranked initiative (was: of a Now initiative; D105)
215
215
  return Date.parse(it.updatedAt) >= now - stallMs;
216
216
  };
217
217
 
@@ -232,7 +232,7 @@ function boardRead(w, { filter, now = Date.now() } = {}) {
232
232
  const doneAll = [...keep].filter((id) => lay.items[id].state === 'done').length;
233
233
  board.doneOlder += doneAll - lay.board.done.filter((id) => keep.has(id)).length;
234
234
  initiatives.push({
235
- id: row.id, title: row.title, lane: row.lane, laneLabel: row.laneLabel, horizon: row.horizon, rank: row.rank,
235
+ id: row.id, title: row.title, lane: row.lane, laneLabel: row.laneLabel, rank: row.rank,
236
236
  stages: lay.stages.map((s) => ({ id: s.id, label: s.label })), batches: pageBatches(lay.batches), shown: listed,
237
237
  });
238
238
  }
@@ -7,7 +7,7 @@
7
7
  * facts come from the routes of lib/routes-boards.js and lib/routes-core-docs.js:
8
8
  * board GET /api/boards/board → .board { ws, id, name, workflow: [{ name, cat }], … }
9
9
  * counts the same answer's counts { total, open, byStage, byStatus }
10
- * rows GET /api/boards/backlog → rows [{ id, title, lane, stage, cat, owner, anchor, horizon, status, start, end, progress, warnings, updated, stageSource, dupOf,
10
+ * rows GET /api/boards/backlog → rows [{ id, title, lane, stage, cat, owner, anchor, rank, status, start, end, progress, warnings, updated, stageSource, dupOf,
11
11
  * wf, wfStage, wfStages, ended }] (the workflow fields: workflows-per-initiative; a row without `wf` is on Product feature)
12
12
  * columns GET /api/boards/columns → [{ stage, cat, count, rows }]
13
13
  * sprints GET /api/boards/sprints → { source: 'jira'|'none', readAt, sprints: [{ name, state, start, end, counts: { todo, doing, done } }] }
@@ -257,7 +257,7 @@ function rowOf(r, wf, today) {
257
257
  const names = (wf || []).map((s) => s.name), cur = names.indexOf(r.stage);
258
258
  const bad = r.status === 'late' || r.status === 'at risk';
259
259
  const facts = [
260
- ['Lane', r.lane], ['Stage', r.stage ? r.stage + (r.stageSource ? ' (' + r.stageSource + ')' : '') : ''], ['Anchor', r.anchor], ['Horizon', r.horizon],
260
+ ['Lane', r.lane], ['Stage', r.stage ? r.stage + (r.stageSource ? ' (' + r.stageSource + ')' : '') : ''], ['Anchor', r.anchor], ['Rank', Number.isInteger(r.rank) ? '#' + (r.rank + 1) + ' on the Roadmap' : ''],
261
261
  ['Status', STATUS_LABEL[r.status] || (r.status ? r.status.charAt(0).toUpperCase() + r.status.slice(1) : '')], ['Owner', r.owner],
262
262
  ['Progress', pctOf(r.progress) != null ? pctOf(r.progress) + '%' : ''], ['Starts', r.start ? shortDate(r.start) : ''], ['Ends', r.end ? shortDate(r.end) : ''],
263
263
  ['Last changed', r.updated ? shortDate(String(r.updated).slice(0, 10)) : ''], ['Possible duplicate of', r.dupOf], ['Warnings', (r.warnings || []).map((w) => (typeof w === 'string' ? w : w && (w.text || w.message || w.id)) || '').filter(Boolean).join('; ')],
@@ -296,7 +296,7 @@ function build(f) {
296
296
  const rows = (f.rows || []).slice(0, MAX_LIST).map((r) => rowOf(r, wf, todayIso));
297
297
  // the on-hold rows follow the open ones; the cancelled and archived rows sit under the list's fold (initiative premium-board-actions)
298
298
  for (const r of (f.held || [])) if (rows.length < MAX_LIST + 50 && !rows.some((x) => x.id === r.id)) rows.push(rowOf(r, wf, todayIso));
299
- // an initiative a program holds stays on the list whatever its horizon: the list reads the `now` and `risk` views, and a member the
299
+ // an initiative a program holds stays on the list whatever its state: the list reads the open and `risk` views, and a member the
300
300
  // program page cannot find here shows as "not read" and its program as "No open initiatives"
301
301
  for (const r of (f.members || [])) if (rows.length < MAX_LIST + 100 && !rows.some((x) => x.id === r.id)) rows.push(rowOf(r, wf, todayIso));
302
302
  const gone ={ cancelled: (f.cancelled || []).slice(0, MAX_LIST).map((r) => rowOf(r, wf, todayIso)), archived: (f.archived || []).slice(0, MAX_LIST).map((r) => rowOf(r, wf, todayIso)) };
@@ -9,7 +9,7 @@
9
9
  * INPUT (plain data that routes-calendar-views.js already holds):
10
10
  * range = { start, end } 'YYYY-MM-DD'
11
11
  * events = imported events ({ id, at, end, title, initiative, prep, prep_done, steps }); all of them, this filters
12
- * inis = the initiative facts ({ id, title, done, status, promised, stopped:{state}, horizon })
12
+ * inis = the initiative facts ({ id, title, done, status, promised, stopped:{state} }; an old `horizon` word, such as a parked bet's, is still read)
13
13
  * gantt = model.ganttRows rows ({ id, status, promised })
14
14
  * planItems = [{ id, initiative, title, due, milestone, state }]
15
15
  *
@@ -63,7 +63,7 @@ const SETS = Object.freeze({
63
63
  ]),
64
64
  board: Object.freeze([
65
65
  e('board', { key: 'charter', title: 'Board charter', ic: 'flag', for: 'Why this board exists: purpose, owner, the key results it serves, scope in and out, how work flows.', reader: 'Owner, team, new joiners', cadence: 'When the board changes', by: 'drafts', kind: 'doc', isNew: true }),
66
- e('board', { key: 'backlog', title: 'Roadmap and backlog', ic: 'todo', for: 'Initiatives by stage, horizon and owner.', reader: 'Team, stakeholders', cadence: 'Live', by: 'live', kind: 'live' }),
66
+ e('board', { key: 'backlog', title: 'Roadmap and backlog', ic: 'todo', for: 'Initiatives by rank, stage and owner.', reader: 'Team, stakeholders', cadence: 'Live', by: 'live', kind: 'live' }),
67
67
  e('board', { key: 'intake', title: 'Intake log', ic: 'inbox', for: 'Asks received, accepted or declined, and why.', reader: 'Owner, requesters', cadence: 'Live', by: 'live', kind: 'live' }),
68
68
  e('board', { key: 'bstatus', title: 'Board status report', ic: 'report', for: 'Progress, slips, asks and what needs a decision, for the owner\'s manager.', reader: 'Stakeholders', cadence: 'Every two weeks', by: 'drafts', kind: 'report' }),
69
69
  e('board', { key: 'capacity', title: 'Capacity plan', ic: 'user', for: 'Who works on the board, their points a week, and whether the plan fits.', reader: 'Owner, eng lead', cadence: 'Each sprint', by: 'drafts', kind: 'doc', days: 14, isNew: true }),
@@ -708,7 +708,7 @@ const S = '<state>'; // the state folder, named in the prompt as the run sees
708
708
  const GUIDE = Object.freeze({
709
709
  strategy: { sources: ['The issued product strategy, if any, under <state>/core-docs/portfolio/strategy/', 'planning/okrs/ (the key results and health budgets)', 'The board charters under <state>/core-docs/board-*/charter/', 'The boards and their initiatives with their anchors (`pmos board`, `pmos initiative list`)', 'The Horizon scan reports and the research under planning/radar/ and planning/research/, if any'],
710
710
  sections: ['A short line: this is a proposal for the PM to change, keep or drop; the PM issues the strategy', 'Where we are going', 'Where we play (one line per pillar, with its boards)', 'What we will not do', 'How we will know (a table: Pillar, Key results, Boards)'] },
711
- roadmap: { sources: ['`pmos initiative list` (every initiative with its horizon, stage and anchor)', 'planning/okrs/ (the key results the bets serve)', 'The issued portfolio roadmap before this one, if any'],
711
+ roadmap: { sources: ['`pmos initiative list` (every initiative with its Roadmap rank, lifecycle stage and anchor)', 'planning/okrs/ (the key results the bets serve)', 'The issued portfolio roadmap before this one, if any'],
712
712
  sections: ['Now (each bet, its board and the key result it serves)', 'Next', 'Later', 'What changed since the last roadmap'] },
713
713
  invest: { sources: ['`pmos initiative list` (anchors: key result or health budget)', 'The plan items and their points on every board (`pmos board`)', 'The people and their points a week (`pmos people list`)', 'The Jira snapshots under the state folder, if any (read-only)'],
714
714
  sections: ['Headline (two sentences: where the effort goes and the one thing to look at)', 'By board (a share of the effort per board)', 'Feature work against upkeep (key results against health budgets)', 'By pillar, when a product strategy is issued', 'Worth a look (key results with no effort, effort with no key result)'] },
@@ -555,18 +555,18 @@ function applyWorkflowEdit(board, stages, moveRemoved, rowsByStage) {
555
555
  }
556
556
 
557
557
  // ── backlog ─────────────────────────────────────────────────────────────────────────────────────────
558
- const HZ = { now: 0, next: 1, later: 2 };
559
- const SORTS = ['rank', 'id', 'title', 'stage', 'status', 'owner', 'horizon', 'end', 'start', 'updated', 'progress'];
558
+ const SORTS = ['rank', 'id', 'title', 'stage', 'status', 'owner', 'end', 'start', 'updated', 'progress'];
560
559
  const listParam = (v) => (v == null || v === '' ? null : String(v).split(',').map((x) => x.trim()).filter(Boolean));
561
560
  const lc = (v) => String(v == null ? '' : v).toLowerCase();
562
561
 
563
- /* A view's own status rule (active only; at risk or late) gives way to a status filter the PM picks, so "Now and next" with
564
- * Status: On hold lists the paused initiatives on the horizon (c3-initiative-lifecycle). */
562
+ /* A view's own status rule (active only; at risk or late) gives way to a status filter the PM picks, so the open view with
563
+ * Status: On hold lists the paused initiatives (c3-initiative-lifecycle). The `now` view keeps its name for old links; since
564
+ * D105 retired Now / Next / Later it is every open initiative, in Roadmap rank, on no horizon. */
565
565
  function viewFilter(view, me, statusGiven) {
566
566
  const mine = new Set([lc(me), lc(me ? `pm:${me}` : '')].filter(Boolean));
567
567
  const act = (r) => statusGiven || isActive(r);
568
568
  switch (view) {
569
- case 'now': return (r) => (r.horizon === 'now' || r.horizon === 'next') && act(r);
569
+ case 'now': return (r) => act(r);
570
570
  case 'mine': return (r) => !!r.owner && mine.has(lc(r.owner)) && act(r);
571
571
  case 'risk': return (r) => statusGiven || r.status === 'at risk' || r.status === 'late';
572
572
  case 'noowner': return (r) => !r.owner && act(r);
@@ -582,11 +582,12 @@ function facetOf(rows, field) {
582
582
  }
583
583
 
584
584
  /**
585
- * query = { q, stage, status, owner, horizon, anchor (each a comma list), view, sort ('-' prefix = descending), offset,
585
+ * query = { q, stage, status, owner, anchor (each a comma list), view, sort ('-' prefix = descending), offset,
586
586
  * limit, me, stages (the workflow's stage names, for the stage sort), archived ('1' = the archive only) }. Facets count the rows
587
- * after the view and the search, before the stage/status/owner/horizon/anchor filters, so each filter shows what choosing it
587
+ * after the view and the search, before the stage/status/owner/anchor filters, so each filter shows what choosing it
588
588
  * would give. An archived row (`r.archived`) is in no list but the archive. A cancelled row is in no view unless the status
589
589
  * filter names `cancelled`; `cancelledHidden` counts the board's cancelled rows while they are hidden (0 once asked for).
590
+ * D105: there is no horizon filter, facet or sort; a `horizon` in the query is read past, and sort=horizon reads as rank.
590
591
  */
591
592
  function filterRows(rows, query = {}) {
592
593
  const archive = query.archived === '1' || query.archived === true;
@@ -595,13 +596,13 @@ function filterRows(rows, query = {}) {
595
596
  const wantStatus = listParam(query.status);
596
597
  let base = (rows || []).filter((r) => !!r.archived === archive).filter(viewFilter(view, query.me, !!wantStatus));
597
598
  if (q) base = base.filter((r) => lc(r.title).includes(q) || lc(r.id).includes(q) || lc(r.anchor).includes(q) || lc(r.owner).includes(q));
598
- const facets = { stage: facetOf(base, 'stage'), status: facetOf(base, 'status'), owner: facetOf(base, 'owner'), horizon: facetOf(base, 'horizon'), anchor: facetOf(base, 'anchor'), cat: facetOf(base, 'cat') };
599
+ const facets = { stage: facetOf(base, 'stage'), status: facetOf(base, 'status'), owner: facetOf(base, 'owner'), anchor: facetOf(base, 'anchor'), cat: facetOf(base, 'cat') };
599
600
  const askCancelled = archive || !!(wantStatus && wantStatus.map(lc).includes('cancelled'));
600
601
  let out = askCancelled ? base : base.filter((r) => r.status !== 'cancelled');
601
602
  // How many cancelled initiatives the list leaves out: every one on the board, whatever the view, since the link that shows them
602
603
  // opens All with Status: Cancelled.
603
604
  const cancelledHidden = askCancelled ? 0 : (rows || []).filter((r) => !r.archived && r.status === 'cancelled').length;
604
- for (const f of ['stage', 'status', 'owner', 'horizon', 'anchor', 'cat']) {
605
+ for (const f of ['stage', 'status', 'owner', 'anchor', 'cat']) {
605
606
  const want = listParam(query[f]);
606
607
  if (!want) continue;
607
608
  const set = new Set(want.map(lc));
@@ -615,10 +616,9 @@ function filterRows(rows, query = {}) {
615
616
  const statusIdx = new Map(STATUSES.map((s, i) => [s, i]));
616
617
  const nul = (v) => (v == null ? '￿' : v);
617
618
  const cmpBy = {
618
- rank: (a, b) => ((HZ[a.horizon] ?? 3) - (HZ[b.horizon] ?? 3)) || ((a.rank ?? 1e9) - (b.rank ?? 1e9)) || a.id.localeCompare(b.id),
619
+ rank: (a, b) => ((a.rank ?? 1e9) - (b.rank ?? 1e9)) || a.id.localeCompare(b.id),
619
620
  id: (a, b) => a.id.localeCompare(b.id, undefined, { numeric: true }),
620
621
  owner: (a, b) => String(nul(a.owner)).localeCompare(String(nul(b.owner))) || a.id.localeCompare(b.id),
621
- horizon: (a, b) => ((HZ[a.horizon] ?? 3) - (HZ[b.horizon] ?? 3)) || a.id.localeCompare(b.id),
622
622
  title: (a, b) => String(a.title).localeCompare(String(b.title)) || a.id.localeCompare(b.id),
623
623
  stage: (a, b) => ((stageIdx.get(a.stage) ?? 1e9) - (stageIdx.get(b.stage) ?? 1e9)) || a.id.localeCompare(b.id),
624
624
  status: (a, b) => ((statusIdx.get(a.status) ?? 9) - (statusIdx.get(b.status) ?? 9)) || a.id.localeCompare(b.id),
@@ -235,25 +235,25 @@ reg('discover', 'ideate.concentration', (f) => {
235
235
  reg('prioritize', 'strategize.kr-deviation', (f) => REG.find((d) => d.id === 'cal.kr-deviation').fn(f).map((x) => ({ ...x, page: 'prioritize' })));
236
236
  reg('prioritize', 'strategize.unanchored', (f) => f.inis.filter((i) => !i.done && !i.parent_kr).map((i) => s({
237
237
  id: 'strategize.unanchored:' + i.id, page: 'prioritize', key: 'anchor:' + i.id, entity: i.id, magnitude: 0.5, deadlineDays: 14, policyCritical: true, shape: 'rows',
238
- title: `${i.title} has no KR or health budget`, facts: ['horizon ' + i.horizon],
238
+ title: `${i.title} has no KR or health budget`, facts: ['stage ' + (i.stage || 'none')],
239
239
  })));
240
240
  reg('prioritize', 'strategize.single-bet', (f) => {
241
- const now = f.inis.filter((i) => i.horizon === 'now');
242
- return now.length === 1 && f.inis.length >= 3 ? [s({ id: 'strategize.single-bet', page: 'prioritize', key: 'bets', entity: 'portfolio', magnitude: 0.4, deadlineDays: 30, strategic: true, title: `Everything in flight rides on one bet (${now[0].title}); ${f.inis.length - 1} others are Next or Later`, facts: [] })] : [];
241
+ const now = f.inis.filter((i) => i.underway);
242
+ return now.length === 1 && f.inis.length >= 3 ? [s({ id: 'strategize.single-bet', page: 'prioritize', key: 'bets', entity: 'portfolio', magnitude: 0.4, deadlineDays: 30, strategic: true, title: `Everything under way rides on one bet (${now[0].title}); ${f.inis.length - 1} others are not under way`, facts: [] })] : [];
243
243
  });
244
244
  reg('prioritize', 'prioritize.capacity-free', (f) => {
245
- const inflight = f.inis.filter((i) => i.horizon === 'now').length, CAP = 4;
245
+ const inflight = f.inis.filter((i) => i.underway).length, CAP = 4;
246
246
  return inflight < CAP && f.ideas.length ? [s({
247
247
  id: 'prioritize.capacity', page: 'prioritize', key: 'capacity', entity: 'portfolio', magnitude: Math.min(1, (CAP - inflight) / CAP), deadlineDays: 14, shape: 'ring',
248
- title: `${inflight} of ${CAP} bets in flight; the top idea is ${f.ideas[0].title} (score ${f.ideas[0].score})`, facts: f.ideas.slice(0, 3).map((i) => i.title + ' ' + i.score),
248
+ title: `${inflight} of ${CAP} bets under way; the top idea is ${f.ideas[0].title} (score ${f.ideas[0].score})`, facts: f.ideas.slice(0, 3).map((i) => i.title + ' ' + i.score),
249
249
  })] : [];
250
250
  });
251
251
  reg('prioritize', 'prioritize.score-vs-roadmap', (f) => {
252
252
  const onRoad = new Set(f.inis.map((i) => String(i.id).split('/').pop()));
253
253
  const top = f.ideas.filter((i) => !onRoad.has(i.slug));
254
- return top.length && f.inis.some((i) => i.horizon === 'next' && !i.hasPlan) ? [s({
254
+ return top.length && f.inis.some((i) => !i.done && !i.underway && !i.hasPlan) ? [s({
255
255
  id: 'prioritize.rank', page: 'prioritize', key: 'capacity', entity: 'portfolio', magnitude: 0.4, deadlineDays: 14, child: true,
256
- title: `${top[0].title} (score ${top[0].score}) outranks work already placed in Next that has no plan`, facts: [],
256
+ title: `${top[0].title} (score ${top[0].score}) outranks work on the Roadmap that is not under way and has no plan`, facts: [],
257
257
  })] : [];
258
258
  });
259
259
  reg('plan', 'plan.critical-density', (f) => {
@@ -265,9 +265,9 @@ reg('plan', 'plan.long-ticket', (f) => {
265
265
  const L = f.tickets.filter((t) => t.dur > 10 && t.status !== 'done');
266
266
  return L.length ? [s({ id: 'plan.long', page: 'plan', key: 'split', entity: 'plan', magnitude: Math.min(1, Math.max(...L.map((t) => t.dur)) / 30), deadlineDays: 7, shape: 'bars', title: `${L.length} open tickets run over 10 days (${L.map((t) => t.key + ' ' + t.dur + 'd').join(', ')}); long tickets hide slips, so split them`, facts: L.map((t) => t.key + ' owner ' + t.owner) })] : [];
267
267
  });
268
- reg('plan', 'plan.unplanned', (f) => f.inis.filter((i) => !i.hasPlan && ['now', 'next'].includes(i.horizon)).map((i) => s({
268
+ reg('plan', 'plan.unplanned', (f) => f.inis.filter((i) => !i.hasPlan && i.underway).map((i) => s({
269
269
  id: 'plan.unplanned:' + i.id, page: 'plan', key: 'plan:' + i.id, entity: i.id, magnitude: 0.5, deadlineDays: i.promised ? i.daysToPromise : 60,
270
- title: `${i.title} is in ${i.horizon} with no work breakdown`, facts: ['promised ' + (i.promised || 'none')],
270
+ title: `${i.title} is under way with no work breakdown`, facts: ['promised ' + (i.promised || 'none')],
271
271
  })));
272
272
  reg('monitor', 'monitor.slip', (f) => f.inis.filter((i) => i.slip > 0).map((i) => s({
273
273
  id: 'monitor.slip:' + i.id, page: 'monitor', key: 'slip:' + i.id, entity: i.id, magnitude: slipMag(i.slip, i.tolerance), promiseMissed: i.slip > i.tolerance && i.holders.length > 0,
@@ -299,12 +299,12 @@ reg('evaluate', 'evaluate.retro-missing', (f) => f.inis.filter((i) => i.retroMis
299
299
 
300
300
  // ---------- INITIATIVES: views ----------
301
301
  reg('roadmap', 'roadmap.overcommit', (f) => {
302
- const n = f.inis.filter((i) => i.horizon === 'now').length;
303
- return n > 4 ? [s({ id: 'roadmap.overcommit', page: 'roadmap', key: 'cap', entity: 'portfolio', magnitude: Math.min(1, (n - 4) / 4), deadlineDays: 7, title: `${n} bets in Now against a capacity of 4`, facts: [] })] : [];
302
+ const n = f.inis.filter((i) => i.underway).length;
303
+ return n > 4 ? [s({ id: 'roadmap.overcommit', page: 'roadmap', key: 'cap', entity: 'portfolio', magnitude: Math.min(1, (n - 4) / 4), deadlineDays: 7, title: `${n} initiatives under way against a capacity of 4`, facts: [] })] : [];
304
304
  });
305
305
  reg('roadmap', 'roadmap.unanchored', (f) => REG.find((d) => d.id === 'strategize.unanchored').fn(f).map((x) => ({ ...x, page: 'roadmap' })));
306
- reg('roadmap', 'roadmap.no-forecast', (f) => f.inis.filter((i) => ['now', 'next'].includes(i.horizon) && !i.hasPlan).map((i) => s({
307
- id: 'roadmap.no-forecast:' + i.id, page: 'roadmap', key: 'plan:' + i.id, entity: i.id, magnitude: 0.4, deadlineDays: 30, title: `${i.title} sits in ${i.horizon} with no forecast date`, facts: [],
306
+ reg('roadmap', 'roadmap.no-forecast', (f) => f.inis.filter((i) => i.underway && !i.hasPlan).map((i) => s({
307
+ id: 'roadmap.no-forecast:' + i.id, page: 'roadmap', key: 'plan:' + i.id, entity: i.id, magnitude: 0.4, deadlineDays: 30, title: `${i.title} is under way with no forecast date`, facts: [],
308
308
  })));
309
309
  const lateTickets = (f) => f.tickets.filter((t) => t.status !== 'done' && t.end && dateMs(t.end) < dateMs(f.nowDate));
310
310
  reg('tickets', 'tickets.late', (f) => lateTickets(f).map((t) => s({
@@ -5,7 +5,7 @@
5
5
  // It is pure. readRepoFacts(root) is the only function that touches the repo, and the tests do not use it.
6
6
  //
7
7
  // WIRED TO REAL DATA (readRepoFacts): initiative records (id, title, lane, anchor `parent_kr`, stage, accepted,
8
- // horizon, `promised`, `planned_days`, `slip_tolerance_days`) from planning/initiatives/*.md through
8
+ // `promised`, `planned_days`, `slip_tolerance_days`) from planning/initiatives/*.md through
9
9
  // scripts/workflow-state.js listInitiatives and computeWorkflow, which also supply the gate-order
10
10
  // violations (`gate_failures`). Work-item status per item comes from the repo's work-item ledger and its plan items (see layout-paths.js).
11
11
  //
@@ -22,7 +22,7 @@
22
22
  //
23
23
  // Raw facts shape (every key optional):
24
24
  // now 'YYYY-MM-DDTHH:MM' | 'YYYY-MM-DD', stance 'hold'|'move', capFocusMin,
25
- // inis[{id,title,promised,forecast,hasPlan,plannedDays,slip_tolerance_days,parent_kr,horizon,lane,done,
25
+ // inis[{id,title,promised,forecast,hasPlan,plannedDays,slip_tolerance_days,parent_kr,underway,lane,done,
26
26
  // holders[{who,told}], meeting{title,at}, slipFromEdits, slipFromAdds, adds, criticalPath[], tripScope,
27
27
  // options[{id,label,slipAfter,touches[],promiseChange}], gateViolations[{gate}], retroMissing, accepted}],
28
28
  // tickets[{key,status,dur,owner,deps[],end,pts,origin,edits}],
@@ -97,7 +97,9 @@ function readRepoFacts(root, opts) {
97
97
  const fm = readFrontmatter(path.join(base, w.record || `planning/initiatives/${id}.md`));
98
98
  inis.push({
99
99
  id, title: w.title || id, lane: w.lane, parent_kr: w.anchor || fm.parent_kr || null, stage: w.stage,
100
- done: !!w.accepted, horizon: fm.horizon || (w.accepted ? 'done' : 'now'), promised: fm.promised || null,
100
+ done: !!w.accepted, promised: fm.promised || null,
101
+ // D105: no horizon. "Under way" is the engine's contract, build or eval rung, not yet accepted (workspace/lib/lifecycle-stage.js).
102
+ underway: !w.accepted && ['contract', 'build', 'eval'].includes(String(w.stage || '')),
101
103
  plannedDays: fm.planned_days != null ? Number(fm.planned_days) : null,
102
104
  slip_tolerance_days: fm.slip_tolerance_days != null ? Number(fm.slip_tolerance_days) : undefined,
103
105
  gateViolations: (w.gate_failures || []).map((g) => ({ gate: g.rule || g.gate || String(g) })),
@@ -7,10 +7,11 @@
7
7
  * item whose folded state is `failed` is unresolved. UNKNOWN (code factory-unreadable) when the
8
8
  * factory ledger exists but cannot be read or folded (the join's `unreadable`, R8): a failure
9
9
  * the rule cannot see must not read as on track.
10
- * factory-outside-now AT RISK — building outside Now: a factory item is claimed (a live claim) while the initiative
11
- * is in Next or Later, or the trunk holds commits that scripts/delivery-index.js attributes to
12
- * it while it is in Next or Later and it is not accepted. An initiative with no placement is in
13
- * Later (lib/placements.js horizonOf).
10
+ * factory-unranked AT RISK — building before Prioritize: a factory item is claimed (a live claim), or the trunk
11
+ * holds commits that scripts/delivery-index.js attributes to it while it is not accepted, and no
12
+ * line ranked the initiative on the Roadmap (lib/placements.js byInit[id].source is not
13
+ * 'ledger': day one's guess and a new initiative's landing line are not a rank). D105 replaced
14
+ * "building outside Now" (code factory-outside-now) with this rule when Now / Next / Later went.
14
15
  *
15
16
  * What a rule reads (lib/health.js ctx): `factory` = lib/factory-join.js factoryOf(joinFactory(root), id), `placement`
16
17
  * = lib/placements.js byInit[id], `row` = the workflow row (scripts/workflow-state.js). A rule whose input is missing
@@ -27,7 +28,6 @@ const fs = require('fs');
27
28
  const path = require('path');
28
29
 
29
30
  const SOURCE = 'planning/work-items.jsonl';
30
- const HORIZON_WORD = { next: 'Next', later: 'Later' };
31
31
  const DELIVERY_PATHS = [
32
32
  path.join(__dirname, '..', '..', 'scripts', 'delivery-index.js'),
33
33
  path.join(__dirname, 'engine', 'delivery-index.js'),
@@ -42,7 +42,8 @@ function attributionSentences(id) {
42
42
  return ['branch', 'mention'].map((s) => delivery.attributionEvidence(s, id));
43
43
  }
44
44
 
45
- const horizonOf = (ctx) => (ctx && ctx.placement && ctx.placement.horizon) || 'later';
45
+ /** A line put the initiative on the Roadmap (a ranked line, an adopted proposal, or an old placed line). */
46
+ const rankedOf = (ctx) => !!(ctx && ctx.placement && ctx.placement.source === 'ledger');
46
47
  const list = (ids) => (ids.length > 3 ? `${ids.slice(0, 3).join(', ')} and ${ids.length - 3} more` : ids.join(', '));
47
48
 
48
49
  module.exports = [
@@ -65,17 +66,15 @@ module.exports = [
65
66
  },
66
67
  },
67
68
  {
68
- id: 'factory-outside-now',
69
+ id: 'factory-unranked',
69
70
  check(ctx) {
70
- const horizon = horizonOf(ctx);
71
- if (horizon === 'now' || !HORIZON_WORD[horizon]) return null;
72
- const where = HORIZON_WORD[horizon];
71
+ if (rankedOf(ctx)) return null;
73
72
  const items = (ctx && ctx.factory && Array.isArray(ctx.factory.items)) ? ctx.factory.items : [];
74
73
  const claimed = items.filter((it) => it && it.state === 'claimed').map((it) => it.id);
75
74
  if (claimed.length) {
76
75
  return {
77
- level: 'at-risk', code: 'factory-outside-now', source: SOURCE,
78
- text: `Factory work is claimed (${list(claimed)}), but the initiative is in ${where}. Factory work starts only from Now.`,
76
+ level: 'at-risk', code: 'factory-unranked', source: SOURCE,
77
+ text: `Factory work is claimed (${list(claimed)}), but the initiative is not ranked on the Roadmap. Rank it first (Prioritize).`,
79
78
  };
80
79
  }
81
80
  const row = ctx && ctx.row;
@@ -84,8 +83,8 @@ module.exports = [
84
83
  const said = build && build.status === 'done' ? String(build.evidence || '') : '';
85
84
  if (!said || !attributionSentences(ctx.id || row.id).some((s) => said.includes(s))) return null;
86
85
  return {
87
- level: 'at-risk', code: 'factory-outside-now', source: 'git (scripts/delivery-index.js)',
88
- text: `Commits on the trunk are attributed to this initiative, but it is in ${where}. Building starts only from Now.`,
86
+ level: 'at-risk', code: 'factory-unranked', source: 'git (scripts/delivery-index.js)',
87
+ text: 'Commits on the trunk are attributed to this initiative, but it is not ranked on the Roadmap. Rank it first (Prioritize).',
89
88
  };
90
89
  },
91
90
  },
@@ -7,19 +7,20 @@
7
7
  * (seams §5.4). A field a rule needs and ctx does not carry makes that rule say nothing.
8
8
  *
9
9
  * off track an overdue milestone; a predecessor from another initiative that was withdrawn
10
- * at risk a Now initiative idle for stall_days; a PM step owed longer than that; a passed check-by date; an
10
+ * at risk an initiative under way (past its spec, not accepted) idle for stall_days (was: a Now initiative; D105); a PM step owed longer than that; a passed check-by date; an
11
11
  * overdue item; an item that starts before an open predecessor ends
12
12
  * unknown a source could not be read (the workflow row, or lines of plan-items.jsonl)
13
13
  *
14
- * Not here: an unresolved failed factory item and building outside Now (Run 4, health-rules-factory.js). A finished
14
+ * Not here: an unresolved failed factory item and building before it is ranked (Run 4, health-rules-factory.js). A finished
15
15
  * initiative (Accepted, Handed off) has no health: every rule here says nothing for it. A PM step's age is the age of the
16
16
  * initiative's last evidence, because the ladder does not record when a step became owed. A stopped initiative (On hold, Closed,
17
- * Cancelled) has none either: it is off the board. A check-by date belongs to Now, so one that a card keeps in Next or Later is
18
- * not read.
17
+ * Cancelled) has none either: it is off the board. A check-by date is read wherever the initiative ranks (D105: it belonged to
18
+ * Now while there was a Now).
19
19
  *
20
20
  * Pure: no I/O, no clock beyond ctx.now, no cache.
21
21
  */
22
22
  const display = require('./initiative-display.js');
23
+ const lifecycle = require('./lifecycle-stage.js');
23
24
 
24
25
  const DAY = 86400000;
25
26
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -86,9 +87,9 @@ const RULES = [
86
87
  },
87
88
  },
88
89
  {
89
- id: 'idle-in-now',
90
+ id: 'idle-underway', // was idle-in-now (D105): the lifecycle stage, not a horizon, says the work is under way
90
91
  check(ctx) {
91
- if (!ctx.row || !ctx.placement || ctx.placement.horizon !== 'now' || finishedWord(ctx)) return null;
92
+ if (!ctx.row || !lifecycle.underway(ctx.row) || finishedWord(ctx)) return null;
92
93
  const label = display.idleLabel(ctx.row, displayCtx(ctx));
93
94
  if (!label) return null;
94
95
  return { level: 'at-risk', code: 'idle', text: label, source: recordOf(ctx) };
@@ -110,7 +111,7 @@ const RULES = [
110
111
  {
111
112
  id: 'check-by-passed',
112
113
  check(ctx) {
113
- const by = ctx.placement && ctx.placement.horizon === 'now' && ctx.placement.check_by;
114
+ const by = ctx.placement && ctx.placement.check_by;
114
115
  if (!by || by >= todayOf(ctx) || finishedWord(ctx)) return null;
115
116
  return { level: 'at-risk', code: 'check-by-passed', text: `check-by ${shortDate(by)} passed`, source: PLACEMENTS };
116
117
  },