create-pmos 0.787.0 → 0.788.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.787.0",
3
+ "version": "0.788.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,28 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.788.0",
38
+ "at": "2026-11-24T18:07:52.786Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1783,
43
+ "t": "Stuck work gets one prepared next step under the ✦",
44
+ "s": "Stuck work gets one prepared next step under the ✦",
45
+ "k": "new",
46
+ "try": {
47
+ "steps": [
48
+ "On Work, open an initiative that has a task In progress with no change for two weeks",
49
+ "Press its ✦ and find Stuck",
50
+ "Press ✓ on the prepared step, then Undo on the toast"
51
+ ],
52
+ "see": "Stuck lists the task with one step: a drafted note to its owner, or park it. ✓ parks the task (or puts the note in the Outbox, unsent); Undo puts it back",
53
+ "open": "/premium-board.html"
54
+ }
55
+ }
56
+ ]
57
+ },
36
58
  {
37
59
  "v": "0.787.0",
38
60
  "at": "2026-11-24T17:51:02.745Z",
@@ -443,25 +465,6 @@
443
465
  }
444
466
  }
445
467
  ]
446
- },
447
- {
448
- "v": "0.768.0",
449
- "at": "2026-11-24T07:49:37.442Z",
450
- "f": 4,
451
- "prs": [
452
- {
453
- "n": 1731,
454
- "t": "The workflow decides the kind of work, not a legacy type: feature",
455
- "s": "The workflow decides the kind of work, not a legacy type: feature",
456
- "k": "fix"
457
- },
458
- {
459
- "n": 1730,
460
- "t": "Drag to nest, take out and reorder in the Gantt, like the List",
461
- "s": "Drag to nest, take out and reorder in the Gantt, like the List",
462
- "k": "new"
463
- }
464
- ]
465
468
  }
466
469
  ]
467
470
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@8deceff9a
1
+ kernel-source: pmos@b4c98bfbb
2
2
  assembled: 2026-11-24
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-24T17:50:59Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T18:07:48Z"}
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-24T17:50:59Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T18:07:48Z"}
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-24T17:50:59Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T18:07:48Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,26 @@
1
1
  [
2
+ {
3
+ "v": "0.788.0",
4
+ "at": "2026-11-24T18:07:52.786Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1783,
9
+ "t": "Stuck work gets one prepared next step under the ✦",
10
+ "s": "Stuck work gets one prepared next step under the ✦",
11
+ "k": "new",
12
+ "try": {
13
+ "steps": [
14
+ "On Work, open an initiative that has a task In progress with no change for two weeks",
15
+ "Press its ✦ and find Stuck",
16
+ "Press ✓ on the prepared step, then Undo on the toast"
17
+ ],
18
+ "see": "Stuck lists the task with one step: a drafted note to its owner, or park it. ✓ parks the task (or puts the note in the Outbox, unsent); Undo puts it back",
19
+ "open": "/premium-board.html"
20
+ }
21
+ }
22
+ ]
23
+ },
2
24
  {
3
25
  "v": "0.787.0",
4
26
  "at": "2026-11-24T17:51:02.745Z",
@@ -117,6 +117,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
117
117
  | [You decided this before](claude-proposes.md) | You add an initiative that repeats an earlier decision | `DECISIONS.md`, the decision records, the PM journal, `planning/out-of-scope/` and the initiative records | The initiative's ✦ | `pmos ai off past-repeat` |
118
118
  | [✦ drafts](claude-proposes.md#drafts-from-a-) | You press ✓ on a ✦ that offers a draft: a line of the Overview, a program's For or Goal, the documents a gate needs, a goal or initiatives from the strategy, an outcome verdict or a goal's name. One short run for each press. | The records in the product's folder. It writes nothing and sends nothing. | The row you pressed: "PMOS is drafting it", then the draft | Press ✕ on the draft. Nothing is kept until you keep it. |
119
119
  | [Report readers](claude-proposes.md) | A report draft is written | The draft, read as the CFO, the engineering lead and the sceptic | The ✦ of each initiative the question quotes | `pmos ai off report-readers` |
120
+ | [Stuck work](claude-proposes.md) | Each time you open an initiative's ✦. No run, no model. | The tasks' own state days, and the last change of each Jira ticket | "Stuck" under the initiative's ✦: a drafted note to the owner, or Park | Press ✕ on the step. Nothing is sent: a note waits in the Outbox. |
120
121
  | [Initiative descriptions](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's first Problem or Why paragraph, or the record's own first paragraph | "Description" under the initiative's ✦ | `pmos ai off descriptions`. `PMOS_DESCRIPTIONS=off` |
121
122
  | [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. When a check date passes: the verdict, from the goal's reading or one short run. | The PRD's success criteria, or the anchored key result. For a verdict: the goal's reading, or the lines the run cites | "Expected outcome" under the initiative's ✦. A verdict is recorded with Undo. Your move when PMOS cannot tell. | `pmos ai off outcomes`. `PMOS_OUTCOMES=off` |
122
123
  | [Metric drafts](claude-proposes.md) | A product with no North Star, the first 14 days of a quarter, a program with no goal, and an initiative that gets a PRD | The last 8 weeks of real readings | The page of that product, program or initiative | `PMOS_METRIC_DRAFT=off` |
@@ -19,6 +19,7 @@ Press the ✦ to open "PMOS proposes N" in the Viewer. On a desk the chat stays
19
19
  - **Check these.** A maybe match, with its reason, and an item that is already in another initiative. A duplicate is linked, never copied. These need their own ✓.
20
20
  - **Not placed.** What PMOS could not fit. It is kept under Linked.
21
21
  - **Dates.** Each morning, and whenever a date passes, PMOS proposes new dates for tasks that are late or at risk (due within 3 days and not started), one proposal per stage. Each line names the task and its two days: "Move <task> from 24 Nov to 27 Nov". The reason is one line with its source. When PMOS finds no reason, it says "No reason found" and offers to ask the owner. When a new date reaches a task that waits on it, the proposal shows the link: keep it (the waiting task moves too) or ignore it (it stays and the two overlap). PMOS marks the one it recommends with a small ✦.
22
+ - **Stuck.** A task that is In progress and has not changed for 14 days gets one prepared next step. When someone else owns it, PMOS drafts a short note to them that names the task and the day it last moved: ✓ puts the note in the Outbox, and nothing is sent until you send it. When you own it, or nobody does, ✓ parks it back in To do with the reason. A Jira ticket is never changed: both steps are drafted comments. Undo moves the task back to In progress and takes the note out of the Outbox. ✕ hides the step until the task changes again.
22
23
  - **Cut to keep the date.** When an initiative's open tasks will finish after its date, and that date is still ahead, PMOS proposes "Cut 3 tasks to keep 12 Dec". It lists the tasks that finish after the date, and any task that waits on one of them. Each line shows when the task would end, where it moves to, and what the cut costs: "the PRD names it" (listed last) or a Jira ticket (PMOS drafts a comment and does not change the ticket). A ◇ milestone is never cut. Keep moves each task to the first working day after the date, with the same length, and adds a note that says why. Undo puts the dates and the notes back. This proposal is never in Keep all, and PMOS never applies it by itself. Remove a task you want to keep with its ✕. The date is the initiative's committed end, or else the latest due date of its tasks. Count the cuts you kept with `node lib/scope-cuts.js count`.
23
24
  - **Status.** "Looks done" when the evidence says the work happened, such as an email that was sent.
24
25
  - **Names.** Tidy names: the WBS number kept, verb first, about 7 words, no "+" and no brackets. The detail that is cut goes to the task's notes.
@@ -36,6 +36,9 @@
36
36
  * live the live round's ask (lib/live-round.js askOf): type new "PMOS will show 3 ways: A …, B …, C …" (data { brief, directions }) or type
37
37
  * feedback "Round n of B: …" (data { brief, base, round }). No items; section 'check'. ✓ starts the round (lib/live-round.js),
38
38
  * whose result is a prototyped or improved proposal with data.live (its slots: working, made, not made). Undo stops it
39
+ * stuck computed like the dates, never filed (lib/stuck-next.js, stuck-next-step): a task In progress with no change for 14 days. type
40
+ * nudge (a drafted note to its owner, queued in the Outbox on ✓) or park (✓ sets To do with the reason). One item; section
41
+ * 'check'; kept as id:sig, so the step comes back when the task changes again
39
42
  * grill what Claude found when it grilled the initiative by itself (lib/grill.js): type = the angle, no items, a next step in data.next;
40
43
  * always section 'check' (its own ✓, never Keep all). 3 show, best rank first; the group's `more` counts the rest and
41
44
  * `hidden` carries them short (id, type, title, why, at, sig), for Your move's ranked list (pm/move-rank.js)
@@ -428,7 +431,9 @@ function foundOf(F, ini) {
428
431
  function taskOf(x) {
429
432
  const s = dn(x.start), e = dn(x.end != null ? x.end : x.due);
430
433
  return { uid: x.uid || x.key, title: str(x.title), ini: str(x.ini), status: str(x.status) || 'To do', s: s == null ? e : s, e: e == null ? s : e, hasStart: s != null,
431
- jira: x.src === 'jira' || !!x.jira, ms: !!x.milestone, closed: CLOSED.has(x.status), sec: str(x.section) || str(x.itemStage) || '', owner: str(x.owner), notes: str(x.notes), kind: str(x.kind) };
434
+ jira: x.src === 'jira' || !!x.jira, ms: !!x.milestone, closed: CLOSED.has(x.status), sec: str(x.section) || str(x.itemStage) || '', owner: str(x.owner), notes: str(x.notes), kind: str(x.kind),
435
+ // when it last changed and who has it in Jira: lib/stuck-next.js reads them (stuck-next-step)
436
+ ...(x.since ? { since: str(x.since) } : {}), ...(x.updated ? { updated: str(x.updated) } : {}), ...(x.assignee ? { assignee: str(x.assignee) } : {}) };
432
437
  }
433
438
  function lateOf(t, today) {
434
439
  if (t.closed || t.e == null || t.kind === 'Epic') return '';
@@ -518,7 +523,7 @@ function datesOf(ini, T, o = {}) {
518
523
  }
519
524
 
520
525
  /* ── what r.props carries ── */
521
- const ORDER = { build: -3, harness: -2.5, description: -2, outcome: -1, live: -0.7, prototyped: -0.6, improved: -0.5, scanned: -0.4, found: 0, dates: 1, scope: 1.5, status: 2, names: 3, links: 4, grill: 5 };
526
+ const ORDER = { build: -3, harness: -2.5, description: -2, outcome: -1, live: -0.7, prototyped: -0.6, improved: -0.5, scanned: -0.4, found: 0, dates: 1, scope: 1.5, stuck: 1.6, status: 2, names: 3, links: 4, grill: 5 };
522
527
  const GRILL_SHOWN = 3;
523
528
  /**
524
529
  * One initiative's proposals, as the ✦ and the Viewer draw them, or null when there is nothing to show.
@@ -550,6 +555,12 @@ function viewOf(F, ini, o = {}) {
550
555
  const grillHidden = o.grillAll ? [] : grill.slice(GRILL_SHOWN).map((p) => ({ id: p.id, group: 'grill', type: p.type, title: p.title, why: p.why, at: p.at, sig: p.sig, sources: p.sources, data: p.data, items: [] }));
551
556
  if (!o.grillAll) for (const p of grill.slice(GRILL_SHOWN)) props.splice(props.indexOf(p), 1);
552
557
  if (today != null) for (const p of datesOf(ini, T, { today, filed: [...F.props.values()].filter((x) => x.group === 'dates' && x.ini === ini), stages: o.stages, links: o.links, settle: o.settle, drops: F.drops })) if (!kept.has(p.id + ':' + p.sig)) props.push(p);
558
+ // stuck work (stuck-next-step): one prepared step per task In progress with no change for 14 days, computed fresh like the dates
559
+ if (today != null) for (const p of require('./stuck-next.js').propsOf(ini, T, { today, drops: F.drops, me: o.me, pmName: o.pmName })) {
560
+ if (kept.has(p.id + ':' + p.sig)) continue;
561
+ p.items = p.items.filter((x) => !F.drops.has(itemSig(p, x)));
562
+ if (p.items.length) props.push(p);
563
+ }
553
564
  // the scope cuts that save the date (lib/scope-cuts.js, idea A43): computed fresh like the dates ✦, never filed; its own ✓ (class C)
554
565
  if (today != null && o.limit != null) {
555
566
  for (const p of require('./scope-cuts.js').cutsOf(ini, T, { today: o.today, limit: o.limit, links: o.links, named: o.named })) {
@@ -836,6 +836,7 @@ function jiraFacts(rd) {
836
836
  if (rd.points != null && rd.points !== '') o.points = rd.points;
837
837
  if (rd.status) o.jiraStatus = String(rd.status);
838
838
  if (rd.url) o.url = String(rd.url);
839
+ if (rd.updated) o.updated = String(rd.updated); // when the ticket last changed: a stuck ticket (lib/stuck-next.js)
839
840
  return o;
840
841
  }
841
842
  /** The work items of a board: its PMOS tasks (the ledger and the initiatives' breakdown items) and, with Build and deliver on, the Jira items of its initiatives
@@ -62,10 +62,14 @@ function view(ctx, p, ini, f, o = {}) {
62
62
  let linkProps = [];
63
63
  try { const lv = TL.viewOf(LF, ini, { T: f.T, today: todayIso(), limit: f.limit, src: TLR.sourcesOf(p.w.root, ini, f.items) }); linkProps = lv ? lv.proposals : []; } catch { linkProps = []; }
64
64
  const T = new Map(); for (const x of f.items) { if (!x || !(x.uid || x.key)) continue; const t = PR.taskOf(x); T.set(t.uid, t); }
65
+ // the PM's own name: a stuck task of theirs offers Park, never a nudge to themselves (stuck-next-step)
66
+ let me = '', pmName = '';
67
+ try { me = require('./actor.js').PM_SLUG || ''; } catch { me = ''; }
68
+ try { pmName = require('./routes-board-publish.js').sharedBy() || ''; } catch { pmName = ''; }
65
69
  // the scope cuts (lib/scope-cuts.js): the committed end, and the PRD's words to say which cut costs more
66
70
  const prd = (() => { try { return TLR.prdText(p.w.root, ini) || ''; } catch { return ''; } })();
67
71
  const named = (title) => { const t = String(title || '').replace(/^\d+(\.\d+)*\s+/, '').trim(); return t.length >= 6 && prd.toLowerCase().includes(t.toLowerCase()); };
68
- return PR.viewOf(F, ini, { T, today: todayIso(), stages: stagesOf(ctx, p, ini), links, settle: TL.settle, linkProps, grillAll: !!o.grillAll, limit: limitOf(f, T, ini), named });
72
+ return PR.viewOf(F, ini, { T, today: todayIso(), stages: stagesOf(ctx, p, ini), links, settle: TL.settle, linkProps, grillAll: !!o.grillAll, limit: limitOf(f, T, ini), named, me, pmName });
69
73
  }
70
74
  /** The date the scope cuts keep: the initiative's committed end (its plan items), else the plan end its tasks make, as the Board's row
71
75
  * shows it (routes-boards boardRow: the latest due date of its tasks). → day number | null */
@@ -109,10 +113,11 @@ function keepCore(ctx, p, g, f, ini, want, choices = {}, extra = {}) {
109
113
  if ((x.group === 'prototyped' || x.group === 'improved') && !w.length && x.failed) { failed.push({ id: x.id, why: x.failed }); continue; } // a round still being made stays open
110
114
  wrote.push(...w);
111
115
  if (x.group === 'dates' && x.plan && w.some((y) => y.op === 'dates')) plans++;
112
- keptIds.push(x.group === 'dates' || x.group === 'scope' ? x.id + ':' + x.sig : x.id); // computed fresh: kept while its signature holds
116
+ keptIds.push(x.group === 'dates' || x.group === 'scope' || x.group === 'stuck' ? x.id + ':' + x.sig : x.id); // computed fresh: kept while its signature holds
113
117
  if (x.group === 'scope' && w.length) console.error(`${require('./scope-cuts.js').TAG} kept ${ini}: ${w.filter((y) => y.op === 'dates').length} moved to after ${(x.data && x.data.date) || ''}`);
118
+ if (x.group === 'stuck') require('./stuck-next.js').say('kept ' + x.type + ' on ' + ini);
114
119
  }
115
- for (const a of outbox) { const id = toOutbox(ctx, a); if (id) wrote.push({ op: 'outbox', task: a.task, entry: id, why: a.text }); }
120
+ for (const a of outbox) { const id = toOutbox(ctx, a); if (id) wrote.push({ op: 'outbox', task: a.task, entry: id, why: a.text, ...(a.nudge ? { nudge: true } : {}) }); }
116
121
  const batch = PR.newBatch();
117
122
  PR.append(dir, g.actor, { kind: 'keep', ini, board: p.board.id, batch, ids: keptIds, wrote, ...extra });
118
123
  return { batch, wrote, plans, keptIds, failed };
@@ -143,6 +148,8 @@ function undoCore(ctx, p, g, id) {
143
148
  else if (w.op === 'link') { TL.append(dir, g.actor, { kind: 'unlink', from: w.from, to: w.to }); back++; continue; }
144
149
  else if (w.op === 'prd') { try { const file = path.resolve(p.w.root, w.file), text = fs.readFileSync(file, 'utf8'); if (text.includes(w.to)) { fs.writeFileSync(file, text.split(w.to).join(w.from)); back++; } else kept++; } catch { kept++; } continue; }
145
150
  else if (w.op === 'doc' || w.op === 'linked' || w.op === 'ran') { back++; continue; } // the fold leaves an undone batch out
151
+ // a stuck task's nudge (stuck-next-step): Undo discards the draft it queued; any other drafted comment waits in the outbox, where the PM drops it
152
+ else if (w.op === 'outbox' && w.nudge && w.entry) { try { require('./outbox-store.js').appendEvent(ctx.runtimeDir, { event: 'discarded', id: w.entry }, new Date()); back++; } catch { kept++; } continue; }
146
153
  else if (w.op === 'outbox') { kept++; continue; } // a drafted comment waits in the outbox, where the PM drops it
147
154
  else if (w.op === 'description') { const r2 = require('./initiative-writer.js').restoreDescription(p.w.root, k.ini, w.from || '', w.to || '', { actor: g.actor }); if (r2.ok && !r2.kept) back++; else kept++; continue; } // a record edited since keeps its edit
148
155
  else if (w.op === 'life') { const r2 = require('./outcomes.js').setLife(p.w.root, k.ini, w.from === 'cancelled' ? 'cancelled' : 'active', 'Undo: PMOS ✦ stopped it', g.actor); if (r2.ok) back++; else kept++; continue; }
@@ -476,6 +483,16 @@ function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
476
483
  const mine = own && x.data && x.data.next && own !== x.data.next ? { edited: { from: String(x.data.next).slice(0, 200), to: own } } : {};
477
484
  if (W.ok(r)) add({ op: 'add', task: r.body.item && (r.body.item.uid || r.body.item.id), title: next, to: { start: '', due: '' }, ...mine });
478
485
  }
486
+ } else if (x.group === 'stuck') {
487
+ // stuck work (stuck-next-step): park moves a PMOS task back to To do with the reason; a nudge is a drafted note in the Outbox, never
488
+ // sent. A Jira ticket is never written: both its steps are drafted comments
489
+ for (const it of items) {
490
+ const t = f.T.get(it.task); if (!t || t.closed) continue;
491
+ if (it.step === 'nudge') { outbox.push(t.jira ? { task: it.task, text: it.text } : { task: it.task, text: it.text, channel: 'team-note', recipient: it.to || t.owner, subject: 'About ' + t.title, nudge: true }); continue; }
492
+ if (t.jira) { outbox.push({ task: it.task, text: it.text + ' Could you move ' + it.task + ' back to To do, or tell me the next step?' }); continue; }
493
+ const r = RB.taskState(ctx, { ws: p.w.id, board: p.board.id, task: it.task, state: 'To do', why: it.text }, g);
494
+ if (W.ok(r)) add({ op: 'state', task: it.task, title: t.title, from: t.status, to: 'To do' });
495
+ }
479
496
  } else if (x.group === 'scope') {
480
497
  // the scope cuts that save the date (lib/scope-cuts.js): each task moves to after the date, with a note saying why; Undo puts both back
481
498
  const SC = require('./scope-cuts.js'), note = SC.noteOf(x), date = (x.data && x.data.date) || '';
@@ -524,12 +541,13 @@ function prdRename(root, ini, from, to) {
524
541
  return { file: path.relative(root, file), n };
525
542
  } catch { return null; }
526
543
  }
527
- /** A drafted Jira comment for a ticket Claude would change: it goes to the outbox, never to Jira (rule 8). */
544
+ /** A drafted Jira comment for a ticket Claude would change: it goes to the outbox, never to Jira (rule 8). ask.channel 'team-note' with a
545
+ * recipient: a note to a teammate (a stuck task's nudge, stuck-next-step). Nothing is sent. */
528
546
  function toOutbox(ctx, ask) {
529
547
  try {
530
548
  const { repoScript } = require('./repo-script.js');
531
549
  const outbox = require(repoScript('outbox.js')), store = require('./outbox-store.js');
532
- const e = outbox.draftOutbox({ channel: 'jira-write', recipient: ask.task, subject: 'About ' + ask.task, body: ask.text, origin: 'pm' });
550
+ const e = outbox.draftOutbox({ channel: ask.channel || 'jira-write', recipient: ask.recipient || ask.task, subject: ask.subject || 'About ' + ask.task, body: ask.text, origin: 'pm' });
533
551
  const entry = { id: 'out-' + crypto.randomBytes(6).toString('hex'), ...e };
534
552
  store.appendEvent(ctx.runtimeDir, { event: 'queued', ...entry }, new Date());
535
553
  return entry.id;
@@ -545,9 +563,13 @@ function saidOf(wrote, plans, left) {
545
563
  if (cutN) bits.push((bits.length ? 'moved ' : 'Moved ') + plural(cutN, 'task', 'tasks') + ' to after ' + PR.md(PR.dn(cuts[0].cut)));
546
564
  const moved = new Set(wrote.filter((w) => w.op === 'dates' && !w.scope).map((w) => w.task)).size;
547
565
  if (moved) bits.push((bits.length ? 'moved ' : 'Moved ') + plural(moved, 'task', 'tasks') + (plans ? ' and ' + plural(plans, 'plan', 'plans') : ''));
548
- if (n('state')) bits.push((bits.length ? 'ticked ' : 'Ticked ') + n('state') + ' done');
566
+ const parked = wrote.filter((w) => w.op === 'state' && w.to === 'To do').length, ticked = n('state') - parked; // park: a stuck task (stuck-next-step)
567
+ if (ticked) bits.push((bits.length ? 'ticked ' : 'Ticked ') + ticked + ' done');
568
+ if (parked) bits.push((bits.length ? 'parked ' : 'Parked ') + plural(parked, 'task', 'tasks') + ' in To do');
549
569
  if (n('rename')) bits.push((bits.length ? 'renamed ' : 'Renamed ') + n('rename'));
550
- if (n('outbox')) bits.push(plural(n('outbox'), 'Jira comment', 'Jira comments') + ' drafted');
570
+ const notes = wrote.filter((w) => w.op === 'outbox' && w.nudge).length, jc = n('outbox') - notes;
571
+ if (jc) bits.push(plural(jc, 'Jira comment', 'Jira comments') + ' drafted');
572
+ if (notes) bits.push(plural(notes, 'note', 'notes') + ' drafted in the Outbox, not sent');
551
573
  // a refuted outcome's next step (launch simulation W2)
552
574
  if (n('created')) bits.push((bits.length ? 'started ' : 'Started ') + 'the next experiment');
553
575
  if (wrote.some((w) => w.op === 'life' && w.to === 'cancelled')) bits.push((bits.length ? 'stopped ' : 'Stopped ') + 'this one');
@@ -623,6 +645,7 @@ const WRITES = {
623
645
  // the PM's reason, when given (the idle lab's ✕ asks for one; Claude learns from it)
624
646
  const why = typeof body.why === 'string' ? body.why.replace(/\s+/g, ' ').trim().slice(0, 300) : '';
625
647
  PR.append(dirOf(ctx, p.w), g.actor, { kind: 'drop', ini, sig, ...which, ...(facts.length ? { facts } : {}), ...(why ? { why } : {}) });
648
+ if (of && of.group === 'stuck') require('./stuck-next.js').say('dropped ' + of.type + ' on ' + ini);
626
649
  // a live round or its ask (lib/live-round.js): the ✕ is a Lessons line of the experiment, with the reason when given
627
650
  if (of && (of.group === 'live' || ((of.group === 'prototyped' || of.group === 'improved') && of.data && of.data.live))) {
628
651
  try { const AF = require('./artefacts.js'); AF.set(AF.file(dirOf(ctx, p.w)), { scope: 'experiment:' + ini, artefact: 'lessons', field: 'line', text: `✕ dropped "${String(of.title || '').slice(0, 140)}"${why ? ': ' + why : ''}`, sources: [{ label: 'live round' }] }, { by: g.actor && /^(pm|agent):/.test(String(g.actor.by)) ? g.actor.by : 'agent:live-round' }); } catch { /* the drop line holds it */ }
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+ /* stuck-next.js — work that sat In progress for two weeks gets one prepared next step (initiative stuck-next-step, idea A63; done test
3
+ * planning/done-tests/stuck-next-step.md).
4
+ *
5
+ * On the proof product 48 in-progress sprint items had not changed in 14 or more days, and nobody asked about them: asking meant opening
6
+ * each one, finding its owner and writing a note. Here each one gets the step PMOS thinks most likely, ready, under its initiative's ✦
7
+ * (group `stuck`, beside the computed date proposals of lib/proposals.js). The PM answers yes or no.
8
+ *
9
+ * touchedOf(t) → the day the task last changed: a PMOS task's state day (`since`), a Jira ticket's `updated` day, or null PURE
10
+ * stuckOf(ini, T, o) → [task] In progress, not an Epic, last changed DAYS or more before o.today (a day number). No change day:
11
+ * never stuck (can't tell) PURE
12
+ * stepOf(t, o) → { step: 'nudge' | 'park', to?, text } an owner who is not the PM (o.me, o.pmName): nudge, with the note
13
+ * drafted; the PM's own task or one with no owner: park. A Jira ticket is never written: its steps are drafted
14
+ * comments (lib/routes-proposals.js sends them to the Outbox) PURE
15
+ * propsOf(ini, T, o) → [proposal] one per stuck task: { id, ini, group: 'stuck', type: 'nudge' | 'park', section: 'check' (its own ✓, never Keep all), title,
16
+ * why, sources: [], items: [{ id, task, title, step, to, text, since, days, jira? }], sig }. o.drops: a dropped
17
+ * signature hides it until the task changes again PURE
18
+ * say(s) the health log, `[stuck-next] kept …` / `[stuck-next] dropped …`
19
+ *
20
+ * Split, the bet's third step, needs a model to cut a task in two; it is not here. */
21
+ const crypto = require('crypto');
22
+
23
+ const DAYS = 14;
24
+ const DAY_MS = 86400000;
25
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
26
+ const dn = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Math.floor(Date.UTC(+m[1], +m[2] - 1, +m[3]) / DAY_MS) : null; };
27
+ const isoN = (n) => new Date(n * DAY_MS).toISOString().slice(0, 10);
28
+ const md = (n) => { const d = new Date(n * DAY_MS); return d.getUTCDate() + ' ' + MON[d.getUTCMonth()]; };
29
+ const one = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : t; };
30
+ const hash = (s) => crypto.createHash('sha1').update(String(s)).digest('hex').slice(0, 10);
31
+ const say = (s) => { try { console.log('[stuck-next] ' + s); } catch { /* no console */ } };
32
+
33
+ /** The PM's own name against an owner: the same name, or the same first name (Jira shows "Wawan Setiawan", the PM is "Wawan"), or the
34
+ * PM's own actor id (pm:<slug>, the owner of a task the PM made). */
35
+ function isPm(who, o = {}) {
36
+ const w = String(who || '').trim().toLowerCase().replace(/^pm:/, ''); // a task PMOS made carries its maker, pm:<slug>
37
+ if (!w) return false;
38
+ if (/^pm:/i.test(String(who).trim()) && (!o.me || String(o.me).toLowerCase() === w)) return true;
39
+ return [o.me, o.pmName].filter(Boolean).map((m) => String(m).trim().toLowerCase()).some((m) => w === m || w.split(/\s+/)[0] === m.split(/\s+/)[0]);
40
+ }
41
+
42
+ function touchedOf(t) { return dn(t && (t.jira ? t.updated || t.since : t.since || t.updated)); }
43
+
44
+ function stuckOf(ini, T, o = {}) {
45
+ const today = o.today, days = o.days || DAYS, out = [];
46
+ if (today == null) return out;
47
+ for (const t of T.values()) {
48
+ if (t.ini !== ini || t.closed || t.kind === 'Epic' || t.status !== 'In progress') continue;
49
+ const at = touchedOf(t);
50
+ if (at == null || today - at < days) continue;
51
+ out.push(t);
52
+ }
53
+ return out.sort((a, b) => touchedOf(a) - touchedOf(b));
54
+ }
55
+
56
+ function stepOf(t, o = {}) {
57
+ const who = String(t.owner || t.assignee || '').trim(), at = touchedOf(t), days = o.today != null && at != null ? o.today - at : null;
58
+ const when = at != null ? md(at) + (days != null ? ' (' + days + ' days)' : '') : 'a while';
59
+ const title = one(t.title || t.uid, 120);
60
+ if (who && !isPm(who, o)) {
61
+ const first = who.split(/\s+/)[0];
62
+ return { step: 'nudge', to: who, text: `Hi ${first}, ${title} has not moved since ${when}. What is the next step? If it should wait, tell me and I will park it.` };
63
+ }
64
+ return { step: 'park', text: `Parked: no change since ${when}.` + (t.jira ? ' Moving it back to To do.' : '') };
65
+ }
66
+
67
+ function propsOf(ini, T, o = {}) {
68
+ const out = [];
69
+ for (const t of stuckOf(ini, T, o)) {
70
+ const s = stepOf(t, o), at = touchedOf(t), days = o.today - at;
71
+ const id = 'stuck-' + hash(ini + '|' + t.uid);
72
+ const sig = 's:' + hash(id + '|' + isoN(at) + '|' + t.status); // a change to the task is a new signature: a ✕ holds until then
73
+ if (o.drops && o.drops.has(sig)) continue;
74
+ const title = s.step === 'nudge' ? 'Nudge ' + s.to + ': ' + one(t.title, 80) : 'Park ' + one(t.title, 80);
75
+ out.push({ id, ini, group: 'stuck', type: s.step, section: 'check', sig,
76
+ title, why: one(t.title, 80) + ' is In progress and has not changed since ' + md(at) + ' (' + days + ' days).', sources: [],
77
+ items: [{ id: t.uid, task: t.uid, title: t.title, step: s.step, ...(s.to ? { to: s.to } : {}), text: s.text, since: isoN(at), days, ...(t.jira ? { jira: true } : {}) }] });
78
+ }
79
+ return out;
80
+ }
81
+
82
+ module.exports = { DAYS, isPm, touchedOf, stuckOf, stepOf, propsOf, say };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.787.0",
3
+ "version": "0.788.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.787.0",
9
+ "version": "0.788.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.787.0",
3
+ "version": "0.788.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",
@@ -42,7 +42,7 @@ const md = (iso) => { const m = DAY.exec(String(iso || '')); return m ? MON[+m[2
42
42
  const span = (a, b) => (a && b && a !== b ? md(a) + ' – ' + md(b) : md(a || b));
43
43
  const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
44
44
  const clip = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
45
- const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', scope: 'Cut to keep the date', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
45
+ const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', scope: 'Cut to keep the date', stuck: 'Stuck', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
46
46
 
47
47
  /* ── the chip and the live look ── */
48
48
  export function chipOf(p) {
@@ -111,7 +111,7 @@ const titleOf = (p) => {
111
111
  return '';
112
112
  };
113
113
  const iconOf = (p) => (p.group === 'description' ? I.doc : p.group === 'outcome' ? I.goal : p.group === 'found' ? (p.type === 'stage' ? I.stage : p.type === 'docs' ? I.doc : p.type === 'tasks' ? I.tasks : p.type === 'link' ? I.link : I.maybe)
114
- : p.group === 'dates' ? I.cal : p.group === 'scope' ? I.cut : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
114
+ : p.group === 'dates' ? I.cal : p.group === 'scope' ? I.cut : p.group === 'stuck' ? (p.type === 'nudge' ? I.ask : I.stop) : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
115
115
  const ib = (attr, label, icon, cls = '') => `<button type="button" class="pp-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16, 2.2)}</button>`;
116
116
  function itemHtml(p, x) {
117
117
  let t = '', m = '';
@@ -121,13 +121,14 @@ function itemHtml(p, x) {
121
121
  else if (p.type === 'tasks') { t = (x.wbs && !String(x.title || '').startsWith(x.wbs) ? x.wbs + ' ' : '') + (x.title || x.jira || ''); m = [x.jira ? 'Jira epic ' + x.jira : '', x.stage, span(x.start, x.due), x.owner].filter(Boolean).join(' · '); }
122
122
  else { t = x.title; m = x.other ? 'In ' + x.other.title : x.why || ''; }
123
123
  } else if (p.group === 'dates') { t = x.title || x.task; m = (x.from && x.from.due ? md(x.from.due) + ' → ' : '') + span(x.to && x.to.start, x.to && x.to.due) + (x.jira ? ' · Jira: a drafted comment' : '') + (x.ms ? ' · ◇ a promise' : ''); }
124
+ else if (p.group === 'stuck') { t = x.text; m = [x.step === 'nudge' ? 'A note to ' + (x.to || 'the owner') + ', not sent until you send it' : 'Back to To do', x.jira ? 'Jira: a drafted comment' : ''].filter(Boolean).join(' · '); }
124
125
  else if (p.group === 'scope') { t = x.title || x.task; m = [x.finish ? 'Ends ' + md(x.finish) : '', x.waits ? 'waits on ' + x.waits : '', 'moves to ' + span(x.to && x.to.start, x.to && x.to.due), x.cost === 'prd' ? 'the PRD names it' : '', x.jira ? 'Jira: a drafted comment' : ''].filter(Boolean).join(' · '); }
125
126
  else if (p.group === 'status') { t = x.title || taskTitle(p.ini, x.task); m = x.jira ? 'Jira: a drafted comment' : ''; }
126
127
  else if (p.group === 'outcome') { t = x.title; m = x.due ? 'Check on ' + md(x.due) : ''; }
127
128
  else if (p.group === 'description') { t = (p.data && p.data.text) || x.title; m = p.type === 'enrich' && p.data && p.data.from ? 'Now: ' + clip(p.data.from, 120) : ''; }
128
129
  else if (p.group === 'build') { const d = p.data || {}; t = x.title; m = [d.branch ? d.branch + ' → ' + (d.base || 'main') : '', d.files && d.files.length ? (d.files.length === 1 ? '1 file' : d.files.length + ' files') : '', 'the guardrail decides who merges'].filter(Boolean).join(' · '); }
129
130
  else if (p.group === 'names') { t = x.to; m = 'Was: ' + (x.from || '') + (x.jira ? ' · Jira: a drafted comment' : ''); }
130
- return `<div class="pp-it"><span class="w"><b>${esc(clip(t, p.group === 'description' ? 700 : 90))}</b>${m ? `<small>${esc(m)}</small>` : ''}</span>${x.sig ? ib(`data-pp-dropit="${esc(x.sig)}"`, 'Leave this one out', I.x) : ''}</div>`;
131
+ return `<div class="pp-it"><span class="w"><b>${esc(clip(t, p.group === 'description' || p.group === 'stuck' ? 700 : 90))}</b>${m ? `<small>${esc(m)}</small>` : ''}</span>${x.sig ? ib(`data-pp-dropit="${esc(x.sig)}"`, 'Leave this one out', I.x) : ''}</div>`;
131
132
  }
132
133
  function linkHtml(p, l) {
133
134
  const pick = S.choices[l.key] || l.rec;
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Stuck work gets one prepared next step (initiative stuck-next-step, done test S1-S7): the rule pure, a read of the Viewer code, and one scratch server for the ✦ view, ✓ park, ✓ nudge to the Outbox, Undo, ✕ and the [stuck-next] health lines. No browser or network.",
3
+ "modules": [
4
+ "stuck-next.test.js"
5
+ ],
6
+ "seconds": {
7
+ "stuck-next.test.js": 20
8
+ }
9
+ }