create-pmos 0.556.0 → 0.558.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 (34) hide show
  1. package/package.json +27 -81
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +26 -0
  7. package/workspace/guide/home.md +7 -2
  8. package/workspace/guide/initiatives-and-next-steps.md +18 -2
  9. package/workspace/lib/board-premium.js +2 -1
  10. package/workspace/lib/coming-up.js +51 -0
  11. package/workspace/lib/initiative-cli.js +4 -4
  12. package/workspace/lib/initiative-premium.js +1 -1
  13. package/workspace/lib/initiative-writer.js +28 -4
  14. package/workspace/lib/routes-autonomy.js +12 -0
  15. package/workspace/lib/routes-boards.js +5 -4
  16. package/workspace/lib/routes-initiatives.js +12 -0
  17. package/workspace/lib/routes-intake.js +6 -2
  18. package/workspace/lib/work-kind.js +48 -0
  19. package/workspace/package-lock.json +2 -2
  20. package/workspace/package.json +1 -1
  21. package/workspace/public/pm/bd-asks.js +16 -10
  22. package/workspace/public/pm/bd-ini-panel.js +11 -1
  23. package/workspace/public/pm/bd-next.js +14 -4
  24. package/workspace/public/pm/bd-views.js +3 -2
  25. package/workspace/public/pm/cozy-board.css +10 -0
  26. package/workspace/public/pm/cozy-viewer.js +11 -5
  27. package/workspace/public/pm/home-ini.js +10 -1
  28. package/workspace/public/pm/ini-agent.js +122 -30
  29. package/workspace/public/pm/ini-view-model.js +3 -2
  30. package/workspace/public/pm/ini-view.css +5 -2
  31. package/workspace/public/pm/ini-view.js +4 -3
  32. package/workspace/public/pm/premium-board.js +3 -2
  33. package/workspace/public/pm/work-kind.js +82 -0
  34. package/workspace/test-files.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.556.0",
3
+ "version": "0.558.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,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.558.0",
38
+ "at": "2026-11-11T02:24:57.842Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1287,
43
+ "t": "Pick the kind of work on a new initiative",
44
+ "s": "Pick the kind of work on a new initiative",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.557.0",
51
+ "at": "2026-11-11T01:38:47.040Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1286,
56
+ "t": "Coming up is a short dated list of five kinds, each with its source",
57
+ "s": "Coming up is a short dated list of five kinds, each with its source",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.556.0",
38
64
  "at": "2026-11-11T01:22:29.972Z",
@@ -290,86 +316,6 @@
290
316
  "k": "new"
291
317
  }
292
318
  ]
293
- },
294
- {
295
- "v": "0.538.0",
296
- "at": "2026-11-08T03:45:27.128Z",
297
- "f": 4,
298
- "prs": [
299
- {
300
- "n": 1254,
301
- "t": "Declared background job graph, a keep rate for every ✦ job, and jobs that learn from ✕ (OS evaluation T1)",
302
- "s": "Declared background job graph, a keep rate for every ✦ job, and jobs that learn from ✕ (OS evaluation T1)",
303
- "k": "new"
304
- },
305
- {
306
- "n": 1257,
307
- "t": "One goal source — OKR key results are the goals, KR metric records their readings (OS evaluation T2)",
308
- "s": "One goal source — OKR key results are the goals, KR metric records their readings (OS evaluation T2)",
309
- "k": "new"
310
- },
311
- {
312
- "n": 1256,
313
- "t": "No status renders without a read behind it (OS evaluation T3)",
314
- "s": "No status renders without a read behind it (OS evaluation T3)",
315
- "k": "new"
316
- },
317
- {
318
- "n": 1260,
319
- "t": "The Board and Home open the same initiative view (UI grill U1, part 1)",
320
- "s": "The Board and Home open the same initiative view (UI grill U1, part 1)",
321
- "k": "new"
322
- },
323
- {
324
- "n": 1258,
325
- "t": "Role agents under the chief of staff (backend)",
326
- "s": "Role agents under the chief of staff (backend)",
327
- "k": "new"
328
- },
329
- {
330
- "n": 1262,
331
- "t": "Intelligence shows only key results with a reading, one report starter (UI grill U3)",
332
- "s": "Intelligence shows only key results with a reading, one report starter (UI grill U3)",
333
- "k": "new"
334
- },
335
- {
336
- "n": 1259,
337
- "t": "Settings from nine sections to five, old redirect pages folded (UI grill U4)",
338
- "s": "Settings from nine sections to five, old redirect pages folded (UI grill U4)",
339
- "k": "new"
340
- },
341
- {
342
- "n": 1263,
343
- "t": "Opening an initiative never moves its stage",
344
- "s": "Opening an initiative never moves its stage",
345
- "k": "fix"
346
- },
347
- {
348
- "n": 1255,
349
- "t": "Loop telemetry, corrections from evidence, builder model, Work-Item lines, verifier after merge",
350
- "s": "Loop telemetry, corrections from evidence, builder model, Work-Item lines, verifier after merge",
351
- "k": "new"
352
- },
353
- {
354
- "n": 1264,
355
- "t": "Board toolbar of seven, one search (UI grill U2)",
356
- "s": "Board toolbar of seven, one search (UI grill U2)",
357
- "k": "new"
358
- }
359
- ]
360
- },
361
- {
362
- "v": "0.537.0",
363
- "at": "2026-11-05T23:09:31.438Z",
364
- "f": 4,
365
- "prs": [
366
- {
367
- "n": 1253,
368
- "t": "One-row Board header, no workflow chips",
369
- "s": "One-row Board header, no workflow chips",
370
- "k": "new"
371
- }
372
- ]
373
319
  }
374
320
  ]
375
321
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@375168e6
1
+ kernel-source: pmos@b52be72d
2
2
  assembled: 2026-11-11
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-11T01:22:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-11T02:24:54Z"}
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-11T01:22:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-11T02:24:54Z"}
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-11T01:22:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-11T02:24:54Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.558.0",
4
+ "at": "2026-11-11T02:24:57.842Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1287,
9
+ "t": "Pick the kind of work on a new initiative",
10
+ "s": "Pick the kind of work on a new initiative",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.557.0",
17
+ "at": "2026-11-11T01:38:47.040Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1286,
22
+ "t": "Coming up is a short dated list of five kinds, each with its source",
23
+ "s": "Coming up is a short dated list of five kinds, each with its source",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.556.0",
4
30
  "at": "2026-11-11T01:22:29.972Z",
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Home: your list, the chat, the Viewer, My work, documents and people"
4
4
  description: "Home's list, Mentions, Your day, the chat and the Viewer; My work; documents and their copies; People; and the suggested next prompt."
5
- timestamp: 2026-11-10
5
+ timestamp: 2026-11-11
6
6
  ---
7
7
 
8
8
  # Home
@@ -78,7 +78,12 @@ Press an initiative's name in the list, or open `?ini=<id>`. The list stays as i
78
78
 
79
79
  - The page's header shows the lane and the anchor, the name, **New session** (+), ⋯, Open wide and Close.
80
80
  - **Experiment** shows what PMOS keeps for the initiative: **We bet**, **Stop if**, **Budget**, **Who builds**, **Specimens** and **Done when**. A line that nobody wrote does not show. Press a line to change it. After you change a line, PMOS asks before it changes that line again. When an experiment is on record, **Gate to Build** shows the done test and the kill condition (D107) instead of the PRD and the rubric.
81
- - **PMOS's work** lists what PMOS changed on this initiative by itself, each with its reason, its day and Undo. A run that stopped is one amber line. **Coming up** names the next dated thing, for example a milestone that is due.
81
+ - **PMOS's work** lists what PMOS changed on this initiative by itself, each with its reason, its day and Undo. A run that stopped is one amber line. Under it, **Coming up** lists what is ahead, by date. Three rows show, and **N more** opens the rest. A kind with nothing ahead is not shown. Each row says where it comes from:
82
+ - a milestone that is due, or the end of the plan
83
+ - the outcome check date (a check that is already due shows in Your move instead)
84
+ - the kill check: the date in the experiment's stop line, or the end of its budget (amber)
85
+ - a PMOS job on a schedule that names this initiative
86
+ - something that waits on someone else: a blocked Jira ticket or an open dependency
82
87
  - The stage card shows the stage, **N of M done** for its tasks, the days in the stage (for example "9 of ~7 days", amber when over the usual time) and → for the next stage. → turns blue when every task of the stage is done.
83
88
  - Under the header is one line for the whole initiative. Each stage is a part of the line, on its own dates. Done stages are grey, the current stage is blue, later stages are light, and a stage with no dated task is dashed. The ◇ marks are the milestone tasks, with the name above and the date below. The end ◇ is the end date. When the initiative has milestone tasks, the end ◇ stands for one of them (one on the end date, else the latest in the last milestone stage, else the latest of all), sits on that task's own date and shows it. A thin tick is Today.
84
89
  - Press a part to show that stage in **Tasks**. Press **N of M done** to do the same. Press a ◇ to open the milestone task in **Tasks**. Milestones a few days apart merge into one ◇ with a count. Press it to list them.
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Initiatives: the Roadmap, next steps, the Driver and done"
4
4
  description: "The ranked list of initiatives, how PMOS works out the next steps, the Initiative Driver, and integrated work."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-11
6
6
  ---
7
7
 
8
8
  # Initiatives: the Roadmap, next steps, the Driver and done
@@ -128,7 +128,23 @@ When anyone ranks the same initiative, the move replaces its open proposals.
128
128
 
129
129
  Every initiative needs an anchor: a KR of the current period or a health budget `health:<id>` from `planning/okrs/health-budgets.md`. The workspace refuses an initiative with no anchor, from the page, from the terminal and from an agent session.
130
130
 
131
- The writer makes the record in `planning/initiatives/<id>.md` with its type, title, timestamp, lane and anchor. A chore also needs its intent in one paragraph. The new initiative lands at the end of the Roadmap. Commit the record to keep it.
131
+ The writer makes the record in `planning/initiatives/<id>.md` with its type, title, timestamp, lane, anchor and kind of work. A chore also needs its intent in one paragraph. The new initiative lands at the end of the Roadmap. Commit the record to keep it.
132
+
133
+ #### Kind of work
134
+
135
+ **New initiative** asks for one kind of work. PMOS works out the rest from it.
136
+
137
+ - **Product.** Product management. You decide what to build and whether it worked. Engineers build it, and PMOS writes the specs.
138
+ - **Full SDLC.** From idea to shipped. PMOS also builds it, as pull requests that you merge.
139
+ - **Project.** Project management. Others do the work. PMOS chases, syncs the dates and reports.
140
+
141
+ PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is Product.
142
+
143
+ The kind is saved as `kind:` in the record (`product`, `sdlc` or `project`). An older record with no `kind:` line reads as Product. Use `pmos initiative new --kind <kind>` to set it from a terminal. The kind is not a lane: the Initiative Gate and the stages do not read it.
144
+
145
+ - **On the Board.** A small icon before each initiative's name shows its kind. The **Next** column follows the kind. For example, Full SDLC says "PMOS builds the first pull request", and Project says "PMOS writes the status line".
146
+ - **In the initiative.** The same icon is in the header, before **Discuss in chat**. Tap it to change the kind. The toast has **Undo**. The Experiment names the kind once. Until someone writes **Who builds**, it comes from the kind: PMOS for Full SDLC, the team for Product and Project. Project says **Who does it** and needs no specimens. A line that you or PMOS wrote stays as written.
147
+ - **A published Board** shows the icon but has no press to change the kind.
132
148
 
133
149
  The writer refuses:
134
150
 
@@ -21,6 +21,7 @@
21
21
  * a progress or a sprint that no record holds is not drawn. The header, the list, the stage columns and the dock read ONE set of counts. The Metrics
22
22
  * card and its charts of the mockup have no record behind them and are not built (PRD D18). */
23
23
 
24
+ const KINDS = ['product', 'sdlc', 'project']; // batch 29 item 11, lib/work-kind.js: a row with none reads as Product management
24
25
  const pad = (n) => String(n).padStart(2, '0');
25
26
  const hhmm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
26
27
  const Custom = require('./custom-docs.js');
@@ -289,7 +290,7 @@ function rowOf(r0, wf, today) {
289
290
  stage: r.stage || null, cat: r.cat || null, stageNote: r.stageSource === 'derived' ? 'derived' : null,
290
291
  seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: pctOf(r.progress),
291
292
  finish: r.end ? shortDate(r.end) : 'Not planned', over: !!over, start: r.start || null, end: r.end || null,
292
- owner: r.owner || null, lane: r.lane || null, anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
293
+ owner: r.owner || null, lane: r.lane || null, kind: KINDS.includes(r.kind) ? r.kind : 'product', anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
293
294
  acts: actsOf(r, names),
294
295
  holds: holdsOf(r), gaps: gapsOf(r), stageSpans: stageSpansOf(r),
295
296
  // D99: the workflow it runs and where it stands in it (lib/routes-boards.js workflowRowOf); Product feature when the server sends none
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+ /* coming-up.js — the dated things of one initiative that only the server can read (batch 29 item 7, Exploring 2 board CuA, picked by
3
+ * Wawan 2026-11-11). The initiative Viewer's Coming up list (pm/ini-agent.js comingUp) joins them with what the page already holds: the
4
+ * milestones and the plan's end, the experiment's kill condition, and what waits on someone else.
5
+ *
6
+ * aheadOf(root, ini, { today, schedules, now }) → { outcome: { date, metric, src } | null, jobs: [{ date, name, src }] }
7
+ * outcome the record's outcome check (outcome_metric + outcome_horizon, lib/outcomes.js), only while it is still ahead and nobody
8
+ * recorded a verdict. A check that is due is Your move on Home, so it is not repeated here.
9
+ * jobs PMOS's scheduled jobs that name this initiative (its id or its title, in the schedule's name or its request), enabled,
10
+ * each with its next run in the next 30 days (lib/schedule-logic.js nextRun: what is shown is what fires).
11
+ * Nothing here writes.
12
+ */
13
+ const path = require('path');
14
+
15
+ const DAY = 86400000;
16
+ const WINDOW_DAYS = 30;
17
+
18
+ function outcomeOf(root, ini, today) {
19
+ try {
20
+ const O = require('./outcomes.js');
21
+ const S = O.scan(root, { today });
22
+ const it = (S.pending || []).find((x) => x.id === ini);
23
+ if (!it || !it.horizon || !it.metric) return null;
24
+ return { date: it.horizon, metric: it.metric, src: it.record + ' · outcome_horizon' };
25
+ } catch { return null; }
26
+ }
27
+
28
+ const names = (s, words) => { const t = String(s || '').toLowerCase(); return words.some((w) => w && t.includes(w)); };
29
+
30
+ function jobsOf(ini, title, schedules, now) {
31
+ const L = require('./schedule-logic.js');
32
+ const words = [String(ini || '').toLowerCase(), String(title || '').trim().length >= 6 ? String(title).trim().toLowerCase() : ''].filter(Boolean);
33
+ const until = now.getTime() + WINDOW_DAYS * DAY, out = [];
34
+ for (const s of Array.isArray(schedules) ? schedules : []) {
35
+ if (!s || s.enabled === false || !(names(s.name, words) || names(s.args, words))) continue;
36
+ let at = null; try { at = L.nextRun(s, now); } catch { at = null; }
37
+ if (!at || Date.parse(at) > until) continue;
38
+ if (s.until && String(at).slice(0, 10) > String(s.until)) continue;
39
+ out.push({ date: at, name: String(s.name || s.skill || 'A scheduled job'), src: 'Scheduled ' + L.humanCadence(s) });
40
+ }
41
+ return out.sort((a, b) => a.date.localeCompare(b.date));
42
+ }
43
+
44
+ function aheadOf(root, ini, o = {}) {
45
+ const now = o.now ? new Date(o.now) : new Date();
46
+ const today = o.today || now.toISOString().slice(0, 10);
47
+ const outcome = root && ini ? outcomeOf(path.resolve(root), ini, today) : null;
48
+ return { outcome, jobs: jobsOf(ini, o.title || '', o.schedules || [], now) };
49
+ }
50
+
51
+ module.exports = { aheadOf, WINDOW_DAYS };
@@ -2,7 +2,7 @@
2
2
  /* initiative-cli.js — `pmos initiative …`: initiatives and their place on the Roadmap from a terminal (pm-os-absorb
3
3
  * Run 2, PRD R16, R20 A, R23, R24, R25; D86 point 4).
4
4
  *
5
- * pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>]
5
+ * pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>] [--kind product|sdlc|project]
6
6
  * pmos initiative new --from capture-YYYY-MM-DD-<n> [--anchor …] [--lane …] [--title "…"]
7
7
  * pmos initiative top|up|down|bottom <id> reorder it on the Roadmap (one ranked list, D105)
8
8
  * pmos initiative after <id> <other-id> rank it right after another initiative
@@ -66,7 +66,7 @@ const COMMANDS = { initiative: ['new', 'top', 'up', 'down', 'bottom', 'after', '
66
66
  const RETIRED = Object.freeze(['now', 'next', 'later']);
67
67
  const USAGE = [
68
68
  'usage: pmos initiative new|top|up|down|bottom|after|check-by|adopt|drop|list|export|describe — initiatives on the Roadmap',
69
- ' pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>]',
69
+ ' pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>] [--kind product|sdlc|project]',
70
70
  ' pmos initiative new --from capture-YYYY-MM-DD-<n> [--anchor <anchor>] [--lane <lane>] [--title "<title>"]',
71
71
  ' pmos initiative top|up|down|bottom <id> reorder it on the Roadmap',
72
72
  ' pmos initiative after <id> <other-id> rank it right after another initiative',
@@ -81,7 +81,7 @@ const USAGE = [
81
81
  'Now, Next and Later are retired (D105): the rank says what comes first, the lifecycle stage says where it is.',
82
82
  ];
83
83
  const BOOL = new Set(['json', 'top', 'help']); // --top is kept so an old script gets the retired answer, not a usage error
84
- const VALUE = new Set(['lane', 'anchor', 'intent', 'id', 'from', 'title', 'root']);
84
+ const VALUE = new Set(['lane', 'anchor', 'intent', 'id', 'from', 'title', 'root', 'kind']);
85
85
  const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
86
86
 
87
87
  function parse(argv) {
@@ -147,7 +147,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
147
147
  input.title = pos[0];
148
148
  }
149
149
  if (flags.title) input.title = flags.title;
150
- for (const k of ['lane', 'anchor', 'intent', 'id']) if (flags[k]) input[k] = flags[k];
150
+ for (const k of ['lane', 'anchor', 'intent', 'id', 'kind']) if (flags[k]) input[k] = flags[k];
151
151
  const actor = actorLib.fromCli(who);
152
152
  const r = writer.createInitiative(root, input, { actor, now });
153
153
  if (!r.ok) return fail(r.error);
@@ -165,7 +165,7 @@ function build(f) {
165
165
  pending: !!f.pending,
166
166
  header: { text: 'Real data · as of ' + hhmm(now) + (missing.length ? ' · not read: ' + missing.join(', ') : ''), missing },
167
167
  board: { name: board.name || '', id: board.id || null, ws: board.ws || null },
168
- id, key, title: clip(row.title || id, 160), lane: row.lane || '', anchor: row.anchor || '',
168
+ id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind: ['product', 'sdlc', 'project'].includes(row.kind) ? row.kind : 'product', anchor: row.anchor || '',
169
169
  // the bar's presses (initiative premium-board-actions): the workflow, the lifecycle and the archive entry the row holds
170
170
  acts: {
171
171
  self: !!board.self, stages: moveNames, stage: (own ? names[cur] : row.stage) || null,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * createInitiative(root, input, { actor, now }) → { ok: true, id, path, written }
5
5
  * | { ok: false, status, error, field }
6
- * input = { title, lane, anchor, id?, intent?, specimen_test?, surface_check?, from? }
6
+ * input = { title, lane, anchor, id?, intent?, specimen_test?, surface_check?, from?, kind? }
7
7
  * slugOf(title) → the id a title gives
8
8
  *
9
9
  * THREE CALLERS: the page's New initiative form (POST /api/initiatives, lib/routes-initiatives.js, behind
@@ -15,7 +15,8 @@
15
15
  * WHAT IT WRITES. One file, `<initiatives>/<id>.md` in the tree of `root` (planning/initiatives/ for PMOS-self,
16
16
  * pmos/state/initiatives/ in a kit repository, from the engine's layout): the frontmatter the gates read (`type`,
17
17
  * `title`, `timestamp`, `lane`, `parent_kr`, and `status` — the chore lane's intent — plus the router's
18
- * `specimen_test` and `surface_check` when the caller has them). No new frontmatter field (R24). Then ONE `created`
18
+ * `specimen_test` and `surface_check` when the caller has them), and `kind` (batch 29 item 11: product | sdlc | project, lib/work-kind.js;
19
+ * Product management when the caller sends none). The kind is a hint beside the lane; no gate reads it. Then ONE `created`
19
20
  * line in placements.jsonl (lib/placements.js): the initiative lands at the end of the Roadmap (D105), whoever made it (R16, R23).
20
21
  * The record is not committed: a commit is the caller's (the PM's) act.
21
22
  *
@@ -56,7 +57,8 @@ const actorLib = require('./actor.js');
56
57
  const ID_RE = /^[a-z0-9][a-z0-9._-]*$/;
57
58
  const MAX_ID = 60;
58
59
  const WRITER_SET = Object.freeze(['v', 'eid', 'by', 'via', 'at', 'override', 'pm', 'actor', 'nonce', 'timestamp', 'type']);
59
- const INPUT_KEYS = Object.freeze(['id', 'title', 'lane', 'anchor', 'intent', 'specimen_test', 'surface_check', 'from']);
60
+ const INPUT_KEYS = Object.freeze(['id', 'title', 'lane', 'anchor', 'intent', 'specimen_test', 'surface_check', 'from', 'kind']);
61
+ const WK = require('./work-kind.js');
60
62
  const ONE_LINE = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
61
63
 
62
64
  const refuse = (status, error, field) => ({ ok: false, status, error, field: field || null });
@@ -104,6 +106,8 @@ function createInitiative(root, input, { actor, now } = {}) {
104
106
  for (const k of ['specimen_test', 'surface_check']) {
105
107
  if (has(input, k) && input[k] != null && !ONE_LINE(input[k], 200)) return refuse(400, `${k} must be one line of at most 200 characters`, k);
106
108
  }
109
+ if (has(input, 'kind') && input.kind != null && input.kind !== '' && !WK.valid(input.kind)) return refuse(400, `kind must be one of ${WK.KINDS.join(', ')}`, 'kind');
110
+ const kind = has(input, 'kind') && WK.valid(input.kind) ? input.kind : WK.DEFAULT;
107
111
  if (has(input, 'from') && input.from != null && !(typeof input.from === 'string' && placements.CAPTURE_RE.test(input.from))) {
108
112
  return refuse(400, 'from must name a capture note, like capture-2026-10-04-1', 'from');
109
113
  }
@@ -127,6 +131,7 @@ function createInitiative(root, input, { actor, now } = {}) {
127
131
  if (intent.trim()) fm.push(`status: ${q(intent)}`);
128
132
  if (input.specimen_test) fm.push(`specimen_test: ${q(input.specimen_test)}`);
129
133
  if (input.surface_check) fm.push(`surface_check: ${q(input.surface_check)}`);
134
+ fm.push(`kind: ${kind}`);
130
135
  fm.push('---', '', `# ${title}`, '');
131
136
  if (intent.trim()) fm.push(intent.trim(), '');
132
137
  const text = fm.join('\n');
@@ -338,6 +343,25 @@ function restoreDescription(root, id, from, to, { actor } = {}) {
338
343
  return { ok: true, id };
339
344
  }
340
345
 
346
+ /** The kind of work (batch 29 item 11, Viewer KdV1-3): only the `kind:` line changes (added at the end of the front matter when an older
347
+ * record has none). → { ok: true, id, from, kind } where from is what the record read as before ('product' when it had no line). */
348
+ function setKind(root, id, kind, { actor } = {}) {
349
+ if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
350
+ if (!WK.valid(kind)) return refuse(400, `kind must be one of ${WK.KINDS.join(', ')}`, 'kind');
351
+ const f = recordFile(root, id);
352
+ if (!f.ok) return f;
353
+ const text = fs.readFileSync(f.file, 'utf8');
354
+ const m = /^---\r?\n([\s\S]*?)\r?\n---(\r?\n|$)/.exec(text);
355
+ if (!m) return refuse(409, `the record of ${id} has no front matter — nothing was saved`, 'id');
356
+ const lines = m[1].split(/\r?\n/);
357
+ const at = lines.findIndex((l) => /^kind:/.test(l));
358
+ const from = WK.kindOf(at >= 0 ? lines[at].slice(5) : '');
359
+ if (at >= 0 && from === kind && lines[at].trim() === 'kind: ' + kind) return { ok: true, id, from, kind, same: true };
360
+ if (at >= 0) lines[at] = 'kind: ' + kind; else lines.push('kind: ' + kind);
361
+ try { fs.writeFileSync(f.file, '---\n' + lines.join('\n') + '\n---' + m[2] + text.slice(m[0].length), { flag: 'w' }); } catch { return refuse(500, 'the record could not be written — nothing was saved'); }
362
+ return { ok: true, id, from, kind };
363
+ }
364
+
341
365
  function withdrawSplit(root, id, want, { actor } = {}) {
342
366
  if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
343
367
  const f = recordFile(root, id);
@@ -349,4 +373,4 @@ function withdrawSplit(root, id, want, { actor } = {}) {
349
373
  return { ok: true, removed: true };
350
374
  }
351
375
 
352
- module.exports = { setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
376
+ module.exports = { setKind, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
@@ -9,6 +9,8 @@
9
9
  * failed: the agent runs of the last 7 days that ended with an error and that no later run of the same target answered:
10
10
  * { run, ini, at, why, source: 'driver' | 'team' }, newest first. Requirement R4: a failure is never the PM's work; it is one amber
11
11
  * line where the work is.
12
+ * GET /api/autonomy/ahead?ws&ini&title → { ok, ws, ini, outcome: { date, metric, src } | null, jobs: [{ date, name, src }] }
13
+ * the initiative's dated things only the server reads, for the Viewer's Coming up list (lib/coming-up.js; batch 29 item 7)
12
14
  * POST /api/autonomy/undo { ws, ref } → { ok, back, demoted? } Undo of one change: a Driver proposal (p-…) or a ✦ batch (pk-…)
13
15
  * POST /api/autonomy/seen { ws, job, product, until } → { ok } Home said the demotion once
14
16
  * GET /api/autonomy/kinds → { ok, kinds: [{ kind, label, made, kept, undone, auto, set, way, until }], showUntil }
@@ -124,6 +126,16 @@ async function handle(req, res, url, ctx) {
124
126
  done.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
125
127
  return send({ status: 200, body: { ok: true, ws: w.id, done, notices, failed: failedOf(w, dirs) } });
126
128
  }
129
+ if (sub === 'ahead' && req.method === 'GET') {
130
+ const w = wsOf(ctx, url.searchParams.get('ws'));
131
+ if (!w) return send(bad(404, 'no such workspace'));
132
+ const ini = text(url.searchParams.get('ini'));
133
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(ini)) return send(bad(400, 'ini is required'));
134
+ let schedules = [];
135
+ try { schedules = require('./report-needs.js').readSchedules(); } catch { /* none */ }
136
+ const r = require('./coming-up.js').aheadOf(w.root, ini, { title: text(url.searchParams.get('title')), schedules });
137
+ return send({ status: 200, body: { ok: true, ws: w.id, ini, ...r } });
138
+ }
127
139
  if (sub === 'kinds' && req.method === 'GET') {
128
140
  const list = (ctx.workspaceList ? ctx.workspaceList() : []).filter((w) => w && w.root && !w.linked);
129
141
  const dirs = [];
@@ -20,7 +20,7 @@
20
20
  * POST /api/boards/move { ws, board, id, to, why? } → { ok, row, warnings }
21
21
  * POST /api/boards/assign { ws, id, to } → { ok }
22
22
  * POST /api/boards/asks/add { ws, board, line, source? } → { ok, ask, draft }
23
- * POST /api/boards/asks/accept { ws, board, ask, title, lane, anchor, intent?, id? } → { ok, initiative, stage }
23
+ * POST /api/boards/asks/accept { ws, board, ask, title, lane, anchor, intent?, id?, kind? } → { ok, initiative, stage } (kind: product | sdlc | project, default product)
24
24
  * POST /api/boards/asks/decline { ws, board, ask, why } → { ok }
25
25
  * POST /api/boards/asks/more { ws, board, ask, note? } → { ok }
26
26
  * POST /api/boards/settings { ws, board, buildDeliver?, jira?, offer?, defTpl? } → { ok, board } jira: one key or a list
@@ -103,6 +103,7 @@ const TS = require('./task-store.js');
103
103
  const holdSpans = require('./hold-spans.js');
104
104
  const ledgers = require('./plan-ledgers.js');
105
105
  const intake = require(repoScript('intake.js'));
106
+ const WK = require('./work-kind.js');
106
107
  const OS = require('./one-stage.js');
107
108
 
108
109
  const LEDGER = 'boards.jsonl';
@@ -363,7 +364,7 @@ function baseRowsRead(w) {
363
364
  const relRec = String(rec.record || '').split(path.sep).join('/');
364
365
  const dm = /^products\/([^/]+)\//.exec(relRec);
365
366
  rows.push({
366
- id, title: r.title, lane: r.lane || null,
367
+ id, title: r.title, lane: r.lane || null, kind: WK.kindOf(fm.kind), // batch 29 item 11: no line reads as Product management
367
368
  owner: fm.owner ? String(fm.owner) : null,
368
369
  anchor: r.anchor || null, rank: Number.isInteger(r.rank) ? r.rank : null, dormant: !!r.dormant,
369
370
  status: statusOf(rec, r.health, end, day, jiraOf(w.root, id)),
@@ -534,7 +535,7 @@ function boardRow(board, base, folded, lib) {
534
535
  const wf = B.workflowOf(board, base.id, folded);
535
536
  const cat = B.catOf({ workflow: wf }, s.stage);
536
537
  const row = {
537
- id: base.id, title: base.title, lane: base.lane, stage: s.stage, cat, owner: base.owner, anchor: base.anchor,
538
+ id: base.id, title: base.title, lane: base.lane, kind: WK.kindOf(base.kind), stage: s.stage, cat, owner: base.owner, anchor: base.anchor,
538
539
  status: base.status, start: ts ? minDay(base.start, ts.start) : base.start, end: ts ? maxDay(base.end, ts.end) : base.end, progress: base.progress, warnings: [],
539
540
  rank: base.rank, health: B.isActive(base) ? base.health : null, updated: base.updated, reading: base.reading, stageSource: s.source, lifecycle: base.lifecycle,
540
541
  stopped: base.stopped || null, archived: archivedOf(folded, base.id),
@@ -1181,7 +1182,7 @@ const WRITES = {
1181
1182
  if (a.state !== 'open') return fail(ctx, res, 409, `ask ${a.id} is ${a.state} already`);
1182
1183
  if (!p.file) return fail(ctx, res, 409, NO_STATE);
1183
1184
  const input = { title: body.title, lane: body.lane, anchor: body.anchor };
1184
- for (const k of ['intent', 'id']) if (body[k] != null && body[k] !== '') input[k] = body[k];
1185
+ for (const k of ['intent', 'id', 'kind']) if (body[k] != null && body[k] !== '') input[k] = body[k];
1185
1186
  const made = createAndPlace(ctx, p.w, p.board.id, input, g.actor,
1186
1187
  ({ file, initiative, stage }) => append(file, g.actor, { kind: 'ask-accept', board: p.board.id, ask: a.id, initiative, stage }));
1187
1188
  if (!made.ok) return fail(ctx, res, made.status || 400, made.error, { field: made.field || null });
@@ -9,6 +9,7 @@
9
9
  * POST /api/initiatives { ws, title, lane, anchor, intent?, id?, from?, specimen_test?, surface_check? }
10
10
  * → { ok, id, path, written, sig } New initiative (requirePagePress)
11
11
  * POST /api/initiatives/rename { ws, id, title } → { ok, id, from, title, path, sig } rename: the record's title only (requirePagePress)
12
+ * POST /api/initiatives/kind { ws, id, kind } → { ok, id, from, kind, sig } the kind of work: product | sdlc | project (requirePagePress)
12
13
  * POST /api/initiatives/rescan { ws } → { ok, started, running } read the repository again now (requirePagePress);
13
14
  * nothing is written: the cached rows go stale and one derivation starts
14
15
  * POST /api/initiatives/duplicates { ws } → { ok, profile, archive, groups } documents that share an initiative and a
@@ -648,6 +649,17 @@ async function handle(req, res, url, ctx) {
648
649
  ctx.json(res, { ok: true, id: r.id, from: r.from, title: r.title, path: r.path, sig: sigOf(w.root) });
649
650
  return true;
650
651
  }
652
+ if (p === '/api/initiatives/kind') {
653
+ // the kind of work (batch 29 item 11, Viewer KdV1-3): only the record's `kind:` line changes; product | sdlc | project
654
+ const g = guard.requirePagePress(req, body);
655
+ if (!g.ok) return answer(ctx, res, g), true;
656
+ const r = writer.setKind(w.root, body.id, body.kind, { actor: g.actor });
657
+ if (!r.ok) { ctx.json(res, { ok: false, status: r.status, error: r.error, field: r.field }, r.status); return true; }
658
+ rowsLib.invalidate(w.root);
659
+ if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id);
660
+ ctx.json(res, { ok: true, id: r.id, from: r.from, kind: r.kind, sig: sigOf(w.root) });
661
+ return true;
662
+ }
651
663
  // split or merge initiatives (feedback batch 11 item 14; lib/split-merge.js): the editor's button or ✓ on Claude's card, Undo, and ✕ Not now
652
664
  const SM_ROUTES = { '/api/initiatives/split': 'split', '/api/initiatives/merge': 'merge', '/api/initiatives/sm-undo': 'undo', '/api/initiatives/suggest': 'dismiss' };
653
665
  if (SM_ROUTES[p]) {
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
  /* routes-intake.js — planning-flows run 4: the one-line intake draft.
3
- * POST /api/intake/draft { line, acknowledged? } → { ok, draft }
3
+ * POST /api/intake/draft { line, acknowledged? } → { ok, draft } draft.kind and draft.kind_cue: the kind of work the name reads as
4
+ * (lib/work-kind.js fromName; kind_cue '' when the name tells nothing)
4
5
  * Drafts only. Creating the initiative stays with createInitiative, which refuses an unanchored create. */
5
6
  const path = require('path');
6
7
  const guard = require('./pm-guard.js');
7
8
  const { repoScript } = require('./repo-script.js');
8
9
  const intake = require(repoScript('intake.js'));
10
+ const WK = require('./work-kind.js');
9
11
 
10
12
  const ROOT = path.resolve(__dirname, '..', '..');
11
13
 
@@ -19,7 +21,9 @@ module.exports = {
19
21
  const g = guard.requirePagePress(req, body);
20
22
  if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
21
23
  if (typeof body.line !== 'string' || !body.line.trim()) { ctx.json(res, { ok: false, error: 'line is required' }, 400); return true; }
22
- ctx.json(res, { ok: true, draft: intake.intakeDraft({ line: body.line, root: ctx.root || ROOT, acknowledged: body.acknowledged === true }) });
24
+ const draft = intake.intakeDraft({ line: body.line, root: ctx.root || ROOT, acknowledged: body.acknowledged === true });
25
+ const k = WK.fromName(body.line, draft && draft.lane);
26
+ ctx.json(res, { ok: true, draft: { ...draft, kind: k.kind, kind_cue: k.cue } });
23
27
  return true;
24
28
  },
25
29
  };
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+ /* work-kind.js — the kind of work of an initiative (batch 29 item 11; main canvas boards KdA, KdAP, KdV1-3, KdBd, agreed by the PM
3
+ * 2026-11-11, option A). The PM picks one kind when the initiative is made; PMOS works out the rest from it.
4
+ *
5
+ * KINDS ['product', 'sdlc', 'project']
6
+ * LABEL[kind] · SHORT[kind] 'Product management' · 'Product' (the switch's word)
7
+ * kindOf(value) → kind a record's `kind:` value, read; anything else (no line, an old record) is 'product'
8
+ * valid(value) → bool one of the three, exactly
9
+ * fromName(name, lane) → { kind, cue } the pre-pick from the name and the intake draft's lane; cue is the word that decided it,
10
+ * or '' when nothing did (then the kind is 'product' and the page shows no ✦ line)
11
+ * executorOf(kind) → 'factory' | 'team' who builds by default (lib/artefacts.js EXECUTORS): Full SDLC → PMOS (the factory, D65:
12
+ * propose-only, the PM merges); Product and Project → the team
13
+ *
14
+ * A HINT, NOT A LANE (D107). The kind sits on the record beside the lane; it does not replace the lane. The Initiative Gate, the stages
15
+ * and the default workflow do not read it. No model call: the pre-pick is the small word table below, and when it cannot tell it says so
16
+ * (cue '') instead of guessing. */
17
+
18
+ const KINDS = Object.freeze(['product', 'sdlc', 'project']);
19
+ const LABEL = Object.freeze({ product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' });
20
+ const SHORT = Object.freeze({ product: 'Product', sdlc: 'Full SDLC', project: 'Project' });
21
+ const DEFAULT = 'product';
22
+
23
+ const valid = (v) => typeof v === 'string' && KINDS.includes(v);
24
+ /** The kind a record's value reads as: one of the three, else Product management (an old record has no line). */
25
+ const kindOf = (v) => { const s = typeof v === 'string' ? v.trim().replace(/^["']|["']$/g, '') : ''; return valid(s) ? s : DEFAULT; };
26
+
27
+ // the cues, as whole words. Full SDLC only on an explicit build word (never from a lane alone); Project on a delivery word.
28
+ const SDLC = ['build', 'implement', 'api', 'endpoint', 'refactor', 'fix bug', 'bug fix', 'bugfix', 'sdk'];
29
+ const PROJECT = ['migrate', 'migration', 'tender', 'rollout', 'roll out', 'vendor', 'procurement', 'rfp', 'cutover', 'decommission', 'renewal', 'contract', 'deadline', 'by q1', 'by q2', 'by q3', 'by q4'];
30
+ const DATE = /\b(by|before|until|due)\s+(\d{1,2}\s+)?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\b|\b20\d\d-\d\d-\d\d\b/i;
31
+ const hit = (text, words) => words.find((w) => new RegExp('\\b' + w.replace(/ /g, '\\s+') + '\\b', 'i').test(text)) || '';
32
+
33
+ /** The pre-pick. A build word gives Full SDLC; a delivery word or a date gives Project; nothing gives Product with no cue. */
34
+ function fromName(name, lane) {
35
+ const t = String(name || '');
36
+ if (!t.trim()) return { kind: DEFAULT, cue: '' };
37
+ const b = hit(t, SDLC);
38
+ if (b) return { kind: 'sdlc', cue: b };
39
+ const p = hit(t, PROJECT) || ((DATE.exec(t) || [])[0] || '');
40
+ if (p) return { kind: 'project', cue: p.trim() };
41
+ // feature, discovery, prototype and content are product work; a chore or an incident with no delivery cue stays product too
42
+ void lane;
43
+ return { kind: DEFAULT, cue: '' };
44
+ }
45
+
46
+ const executorOf = (kind) => (kindOf(kind) === 'sdlc' ? 'factory' : 'team');
47
+
48
+ module.exports = { KINDS, LABEL, SHORT, DEFAULT, valid, kindOf, fromName, executorOf };