create-pmos 0.820.0 → 0.822.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 (32) hide show
  1. package/package.json +27 -3
  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/scripts/workflows.js +26 -6
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/changelog.json +26 -2
  8. package/workspace/guide/agent-capabilities.md +1 -0
  9. package/workspace/guide/cli.md +4 -0
  10. package/workspace/lib/ai-cli.js +17 -2
  11. package/workspace/lib/driver.js +2 -0
  12. package/workspace/lib/engine/workflows.js +26 -6
  13. package/workspace/lib/line-driver.js +40 -12
  14. package/workspace/lib/line.js +30 -8
  15. package/workspace/lib/pmos-verbs.js +1 -1
  16. package/workspace/lib/route-modules.js +1 -0
  17. package/workspace/lib/routes-boards.js +1 -1
  18. package/workspace/lib/routes-stage-signoffs.js +71 -0
  19. package/workspace/lib/routes-your-move.js +10 -1
  20. package/workspace/lib/signoff-cli.js +13 -3
  21. package/workspace/lib/signoffs.js +24 -4
  22. package/workspace/lib/stage-signoffs.js +207 -0
  23. package/workspace/lib/vendor/scripts/workflows.js +26 -6
  24. package/workspace/lib/worth-it.js +66 -0
  25. package/workspace/package-lock.json +2 -2
  26. package/workspace/package.json +1 -1
  27. package/workspace/public/pm/cozy-today-app.js +61 -1
  28. package/workspace/public/pm/cozy-today-model.js +20 -4
  29. package/workspace/public/pm/cozy-today-view.js +17 -2
  30. package/workspace/public/pm/home-app.js +1 -1
  31. package/workspace/test-lists/factory-signoffs-reach-you.json +9 -0
  32. package/workspace/test-lists/worth-it-by-kind.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.820.0",
3
+ "version": "0.822.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": {
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.820.0",
38
- "at": "2026-11-25T09:08:51.103Z",
37
+ "v": "0.822.0",
38
+ "at": "2026-11-25T09:18:15.859Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
@@ -54,6 +54,30 @@
54
54
  "open": "/today.html"
55
55
  },
56
56
  "i": "next-hire-draft"
57
+ },
58
+ {
59
+ "n": 1869,
60
+ "t": "A stage's sign-offs reach You on Today (job #1861, Factory page slice A)",
61
+ "s": "A stage's sign-offs reach You on Today (job #1861, Factory page slice A)",
62
+ "k": "new",
63
+ "i": "factory-signoffs-reach-you"
64
+ },
65
+ {
66
+ "n": 1886,
67
+ "t": "Pmos ai worth puts each run kind's cost beside what was kept (job #1884)",
68
+ "s": "Pmos ai worth puts each run kind's cost beside what was kept (job #1884)",
69
+ "k": "new",
70
+ "h": "Pmos ai worth puts each run kind's cost beside what was kept (job #1884)",
71
+ "try": {
72
+ "steps": [
73
+ "Open Today and ask the chat: is each kind of AI run worth what it costs?",
74
+ "Read the line for each kind: its runs and cost this month, and what you kept of its work",
75
+ "Find any kind marked costs most, kept least"
76
+ ],
77
+ "see": "One line per kind of background run: its runs and cost this month, and how many of its ✦ proposals you kept of those you decided. A kind that costs a large share and is kept less than half the time…",
78
+ "open": "/today.html"
79
+ },
80
+ "i": "worth-it-by-kind"
57
81
  }
58
82
  ]
59
83
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@44f6d6827
1
+ kernel-source: pmos@68543021d
2
2
  assembled: 2026-11-25
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-25T09:08:47Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T09:18:11Z"}
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-25T09:08:47Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T09:18:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -22,7 +22,9 @@
22
22
  * A WORKFLOW is { id, name, icon, builtin?, decide, archived?, stages: [STAGE], bridge? }.
23
23
  * bridge { from, map: { [fromStageKey]: stageKey } }: where each stage of the workflow it replaces lands (batch 20 item 3, canvas WmB).
24
24
  * It is saved with the new workflow, so every later switch from `from` uses it. Many old stages may land in one new stage.
25
- * A STAGE is { key, name, cat, output: { name, kind, template? }, finish: [text], milestone, auto, when: { mode, text? }, then, unless: [{ text, to }] }.
25
+ * A STAGE is { key, name, cat, output: { name, kind, template? }, finish: [text], by?, milestone, auto, when: { mode, text? }, then, unless: [{ text, to }] }.
26
+ * by { [finish line]: who }: the To finish lines only a person can give, and who gives each (factory-signoffs-reach-you). A line with
27
+ * `by` is a sign-off: PMOS asks for it and never works it. A line may be written "PRD Aligned (by: PM)"; check() splits it.
26
28
  * cat ∈ CATS (To do, In progress, Done). Won't do and Archived (ENDS) are in every workflow and are not stages.
27
29
  * The first stage is always `triage`, in To do. `then` null means the next stage in the list. `unless` sends the initiative elsewhere
28
30
  * when PMOS judges its plain words true. A key is the slug of the stage's first name and survives a rename.
@@ -45,7 +47,16 @@ const WHEN_MODES = Object.freeze(['always', 'optional', 'only']);
45
47
  const DECIDE = Object.freeze(['pmos', 'confirm']);
46
48
  const ICONS = Object.freeze(['feature', 'doc', 'cart', 'swap', 'people', 'shield', 'box', 'flag', 'build', 'chart']);
47
49
  const PRODUCT_FEATURE_ID = 'product-feature';
48
- const NAME_MAX = 60, TEXT_MAX = 300, FINISH_MAX = 20, STAGES_MAX = 30;
50
+ const NAME_MAX = 60, TEXT_MAX = 300, FINISH_MAX = 20, STAGES_MAX = 30, BY_MAX = 80;
51
+ // "PRD Aligned (by: PM)" or "PRD Aligned — by: PM": the line and who signs it off
52
+ const BY_IN_LINE = /\s*(?:\(\s*by:\s*([^()]+?)\s*\)|[—–-]+\s*by:\s*(.+?))\s*$/i;
53
+ /** A To finish line written with its sign-off: → { line, by } (by '' when the line names nobody). PURE. */
54
+ function splitBy(text) {
55
+ const t = String(text == null ? '' : text).trim();
56
+ const m = BY_IN_LINE.exec(t);
57
+ if (!m || m.index === 0) return { line: t, by: '' };
58
+ return { line: t.slice(0, m.index).trim(), by: String(m[1] || m[2] || '').trim() };
59
+ }
49
60
 
50
61
  const slug = (s) => String(s || '').toLowerCase().normalize('NFKD').replace(/[^\x00-\x7f]/g, '').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40).replace(/-+$/, '');
51
62
  const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
@@ -143,6 +154,15 @@ function check(wf) {
143
154
  if (o.template != null && o.template !== '' && !oneLine(o.template, 120)) return bad(`stage "${sname}": the template is one line of at most 120 characters`);
144
155
  const finish = s.finish == null ? [] : s.finish;
145
156
  if (!Array.isArray(finish) || finish.length > FINISH_MAX || finish.some((x) => !oneLine(x, 200))) return bad(`stage "${sname}": To finish is a list of at most ${FINISH_MAX} lines of at most 200 characters`);
157
+ const by = {};
158
+ const lines = finish.map((x) => { const sp = splitBy(x); if (sp.by) by[sp.line] = sp.by; return sp.line; });
159
+ if (s.by != null && !isObj(s.by)) return bad(`stage "${sname}": by is { "<To finish line>": "<who signs it off>" }`);
160
+ for (const [k, v] of Object.entries(s.by || {})) {
161
+ if (!lines.includes(String(k).trim())) return bad(`stage "${sname}": by names "${k}", which is not one of its To finish lines`);
162
+ if (v == null || v === '') continue;
163
+ if (!oneLine(v, BY_MAX) || !/\p{L}/u.test(v)) return bad(`stage "${sname}": who signs off "${k}" is a person or a role, one line of at most ${BY_MAX} characters`);
164
+ if (!by[String(k).trim()]) by[String(k).trim()] = v.trim();
165
+ }
146
166
  const w = isObj(s.when) ? s.when : { mode: 'always' };
147
167
  if (!WHEN_MODES.includes(w.mode)) return bad(`stage "${sname}": When it runs is one of ${WHEN_MODES.join(', ')}`);
148
168
  if (w.mode === 'only' && !oneLine(w.text, TEXT_MAX)) return bad(`stage "${sname}": Only when needs the condition in your words (at most ${TEXT_MAX} characters)`);
@@ -152,7 +172,7 @@ function check(wf) {
152
172
  stages.push({
153
173
  key, name: sname, cat: s.cat,
154
174
  output: { name: o.name ? o.name.trim() : '', kind, ...(o.template ? { template: o.template.trim() } : {}) },
155
- finish: finish.map((x) => x.trim()), milestone: s.milestone === true, auto: s.auto === true,
175
+ finish: lines, ...(Object.keys(by).length ? { by } : {}), milestone: s.milestone === true, auto: s.auto === true,
156
176
  when: w.mode === 'only' ? { mode: 'only', text: w.text.trim() } : { mode: w.mode },
157
177
  then: typeof s.then === 'string' && s.then ? s.then : null,
158
178
  unless: unless.map((u) => ({ text: u.text.trim(), to: u.to })),
@@ -338,7 +358,7 @@ function stagesOf(wf, { judged = {}, current = null } = {}) {
338
358
  const j = judged && judged[s.key] ? judged[s.key] : null;
339
359
  const skipped = !!j && j.runs === false;
340
360
  const status = skipped ? 'skipped' : at < 0 ? (i === 0 ? 'current' : 'next') : i < at ? 'done' : i === at ? 'current' : 'next';
341
- return { key: s.key, name: s.name, cat: s.cat, milestone: s.milestone, auto: s.auto, output: s.output, finish: s.finish, when: s.when,
361
+ return { key: s.key, name: s.name, cat: s.cat, milestone: s.milestone, auto: s.auto, output: s.output, finish: s.finish, ...(s.by ? { by: { ...s.by } } : {}), when: s.when,
342
362
  then: s.then, unless: s.unless, n: i + 1, of: w.stages.length, status, reading: j ? { runs: j.runs, why: j.why || '', cite: j.cite || null } : null };
343
363
  });
344
364
  }
@@ -348,7 +368,7 @@ function copyOf(wf, name, taken) {
348
368
  const n = oneLine(name, NAME_MAX) ? name.trim() : 'Copy of ' + wf.name;
349
369
  let id = slug(n) || 'workflow', k = 2;
350
370
  while ((taken && taken.has(id)) || isBuiltin(id)) id = slug(n) + '-' + k++;
351
- return { id, name: n, icon: wf.icon, decide: wf.decide || 'pmos', ...(WORK_KINDS.includes(wf.kind) ? { kind: wf.kind } : {}), stages: wf.stages.map((s) => ({ ...s, output: { ...s.output }, finish: [...s.finish], when: { ...s.when }, unless: s.unless.map((u) => ({ ...u })) })) };
371
+ return { id, name: n, icon: wf.icon, decide: wf.decide || 'pmos', ...(WORK_KINDS.includes(wf.kind) ? { kind: wf.kind } : {}), stages: wf.stages.map((s) => ({ ...s, output: { ...s.output }, finish: [...s.finish], ...(s.by ? { by: { ...s.by } } : {}), when: { ...s.when }, unless: s.unless.map((u) => ({ ...u })) })) };
352
372
  }
353
373
 
354
374
  /** The workflow a kind of work starts on: Project and Full SDLC their own; Product management the workspace's default (defaultOf). */
@@ -370,5 +390,5 @@ const milestonesOf = (wf) => (wf || PRODUCT_FEATURE).stages.filter((s) => s.mile
370
390
  module.exports = {
371
391
  CATS, CAT_LABEL, ENDS, OUTPUT_KINDS, WHEN_MODES, DECIDE, ICONS, PRODUCT_FEATURE_ID, PRODUCT_FEATURE,
372
392
  PROJECT_ID, PROJECT, FULL_SDLC_ID, FULL_SDLC, BUILTIN, KIND_WF, KIND_GATE, MEANING, isBuiltin, forKind, isKindDefault,
373
- WORK_KINDS, kindOf, slug, check, fold, list, defaultOf, resolve, stageByRef, switchTarget, proposeBridge, mapOf, removedInUse, stagesOf, copyOf, milestonesOf,
393
+ WORK_KINDS, kindOf, slug, check, fold, list, defaultOf, resolve, stageByRef, switchTarget, proposeBridge, mapOf, removedInUse, stagesOf, copyOf, milestonesOf, splitBy,
374
394
  };
@@ -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-25T09:08:47Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T09:18:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
- "v": "0.820.0",
4
- "at": "2026-11-25T09:08:51.103Z",
3
+ "v": "0.822.0",
4
+ "at": "2026-11-25T09:18:15.859Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
@@ -20,6 +20,30 @@
20
20
  "open": "/today.html"
21
21
  },
22
22
  "i": "next-hire-draft"
23
+ },
24
+ {
25
+ "n": 1869,
26
+ "t": "A stage's sign-offs reach You on Today (job #1861, Factory page slice A)",
27
+ "s": "A stage's sign-offs reach You on Today (job #1861, Factory page slice A)",
28
+ "k": "new",
29
+ "i": "factory-signoffs-reach-you"
30
+ },
31
+ {
32
+ "n": 1886,
33
+ "t": "Pmos ai worth puts each run kind's cost beside what was kept (job #1884)",
34
+ "s": "Pmos ai worth puts each run kind's cost beside what was kept (job #1884)",
35
+ "k": "new",
36
+ "h": "Pmos ai worth puts each run kind's cost beside what was kept (job #1884)",
37
+ "try": {
38
+ "steps": [
39
+ "Open Today and ask the chat: is each kind of AI run worth what it costs?",
40
+ "Read the line for each kind: its runs and cost this month, and what you kept of its work",
41
+ "Find any kind marked costs most, kept least"
42
+ ],
43
+ "see": "One line per kind of background run: its runs and cost this month, and how many of its ✦ proposals you kept of those you decided. A kind that costs a large share and is kept less than half the time…",
44
+ "open": "/today.html"
45
+ },
46
+ "i": "worth-it-by-kind"
23
47
  }
24
48
  ]
25
49
  },
@@ -166,6 +166,7 @@ When you ask an agent session to do a piece of work, it can finish it, including
166
166
  - `pmos ai status`: whether each AI job is on, whether its replay passed, and what its last run filed. It also shows the keep rate of each job that files under ✦ for the last 14 days: how many you kept of the ones you decided, and how many wait. It shows each product too. A job with 3 or more decided and none kept is listed to pause. You decide: `pmos ai off <job>`.
167
167
  - `pmos ai status` also shows the background runs of the last 7 days: for each kind of run, how many ran, the tokens each run read, and the cost. Lean and full starts show side by side.
168
168
  - `pmos ai log [<job>]`: the last audit lines. Each dropped proposal shows why.
169
+ - `pmos ai worth`: each kind of background run this month, its cost next to how much of its ✦ work you kept. A kind that costs most and is kept least is flagged for you to decide. It pauses nothing.
169
170
  - `pmos ai off [<job>]` and `pmos ai on [<job>]`: turn every AI job, or one job, off or on. `PMOS_AI=off` in the environment wins over the setting.
170
171
 
171
172
  The AI jobs are `past-repeat`, `report-readers`, `report-translate`, `decision-memory`, `outcomes`, `descriptions`, `drift`, `rehearse`, `next-prompt`, `sharpen-prompt`, `idle-lab` and `live-round` (`pmos ai off live-round` stops new live rounds; one that runs ends by itself). The switch also covers each job in the queue by its queue name: `schedules`, `proactive`, `prepare`, `day`, `refresh`, `reports`, `meeting-prewarm`, `driver`, `goal-loops`, `finder`, `coredocs`, `milestones`, `propose`, `grill`, `metric-drafts`, `impact`, `metric-reads`, `forecast`, `report-design`, `report-structure`, `team`, `scan` and `idle-lab`. `pmos ai off` with no job stops all of them. Git sync uses no model, so the switch does not stop it. A background run cannot change the switch.
@@ -224,6 +224,7 @@ Before you share a spec, a strategy, a roadmap or a report, PMOS reads it as a s
224
224
  - `pmos ai status`: whether each AI job is on, whether its replay passed, and what its last run filed. It also shows the keep rate of each job that files under ✦ for the last 14 days, and each product.
225
225
  - `pmos ai log [<job>]`: the last audit lines. Each dropped proposal shows why.
226
226
  - `pmos ai off [<job>]` and `pmos ai on [<job>]`: turn every AI job, or one job, off or on. `PMOS_AI=off` in the environment wins over the setting.
227
+ - `pmos ai worth`: each kind of background run this month, with its runs and cost next to how many of its ✦ proposals you kept of those you decided. A kind that takes at least a quarter of the month's cost and is kept less than half the time (with 3 or more decided) is flagged with the `pmos ai off <kind>` that would pause it. It reads only and pauses nothing: you decide. `--json` prints the rows.
227
228
 
228
229
  [What PMOS does behind the scenes](agent-capabilities.md) lists the jobs and their queue names.
229
230
 
@@ -971,10 +972,13 @@ An outside sign-off is a yes that someone outside the team must give before the
971
972
  - `pmos signoff ask <initiative> --who "<name or team>" --what "<what they must say yes to>" [--asked <date>] [--due <date>] [--source <pointer>]` records a sign-off the initiative waits on.
972
973
  - `pmos signoff answer <id> --answer "<what they said>" --source <pointer>` records the answer. It needs a pointer to where it was given.
973
974
  - `pmos signoff drop <id> [--why "<reason>"]` closes a sign-off that is no longer needed.
975
+ - `pmos signoff evidence <id> --ref <file or Jira key> --quote "<the line, word for word>" [--doc <the document it agrees to>]` records where the yes is written. It also says whether Today can record it.
974
976
  - `pmos signoff list [<initiative>] [--all]` lists the open sign-offs. `--all` lists the answered and dropped ones too.
975
977
 
976
978
  An open sign-off that waited 3 days, or is past its due date, goes on your question list for the day, on the same card as the dry-run gaps of your tickets ([Jira tickets](jira.md)). Nothing is sent. Every command takes `--json` and `--root <dir>`.
977
979
 
980
+ A workflow stage can name its own sign-offs. Write a To finish line as `PRD Aligned (by: PM)`, or give the stage `"by": { "PRD Aligned": "PM" }`. A line with `by:` is a sign-off: PMOS asks for it and never works it, and the Driver does not wake for it. Each open one is a Your move row on Today, with who gives it and the stage that waits. ✓ records it only when its source has the quoted line and is newer than the document it agrees to. Otherwise the row opens the source. A row with no source drafts the question for the tracker, and it goes to the outbox only when you press it. Recording the last missing sign-off moves the stage in the same press, and one Undo puts both back. A workflow with no `by:` lines gets one ✦ row per stage that suggests them, with Keep or Change.
981
+
978
982
  ### pmos approver
979
983
 
980
984
  Walk into a sign-off with what that person asked last time. PMOS reads the sign-offs above and the decision journal, and groups what each approver had to say yes to, what they answered, and what they objected to. It writes nothing.
@@ -9,18 +9,21 @@
9
9
  * pmos ai off [<job>] turn every AI job off, or one job
10
10
  * pmos ai on [<job>] turn every AI job on again, or one job
11
11
  * pmos ai log [<job>] [--n N] the last audit lines: filed, dropped (with why), held, off, replay
12
+ * pmos ai worth [--json] each kind of background run this month: its cost next to how much of its ✦ work the PM kept, and the
13
+ * kinds that cost most and are kept least, flagged for the PM (lib/worth-it.js; reads only, pauses nothing)
12
14
  *
13
15
  * A background run never changes the switch: inside one (PMOS_AI_RUN set) off and on refuse. PMOS_AI=off in the environment wins
14
16
  * over Settings. Exit codes: 0 done, 1 refused, 2 usage. Nothing is sent. */
15
17
  const AG = require('./ai-guard.js');
16
18
 
17
- const COMMANDS = { ai: ['status', 'off', 'on', 'log'] };
19
+ const COMMANDS = { ai: ['status', 'off', 'on', 'log', 'worth'] };
18
20
  const USAGE = [
19
- 'usage: pmos ai status|off|on|log — the AI jobs: their kill switch and what each one filed or dropped',
21
+ 'usage: pmos ai status|off|on|log|worth — the AI jobs: their kill switch and what each one filed or dropped',
20
22
  ' pmos ai status [--json] is each job on, has its replay passed, what did its last run file',
21
23
  ' pmos ai off [<job>] every AI job off, or one job',
22
24
  ' pmos ai on [<job>] every AI job on again, or one job',
23
25
  ' pmos ai log [<job>] [--n N] the last audit lines',
26
+ ' pmos ai worth [--json] each kind of run this month: its cost next to what you kept of its work',
24
27
  'A job files only proposals. Each one cites its sources and waits under ✦ for your ✓. Nothing is sent.',
25
28
  ];
26
29
  const flag = (args, k) => { const i = args.indexOf('--' + k); return i >= 0 ? (args[i + 1] === undefined || args[i + 1].startsWith('--') ? true : args[i + 1]) : undefined; };
@@ -85,6 +88,18 @@ function run(argv, { say = (s) => console.log(s), env = process.env, stateDir =
85
88
  }
86
89
  return 0;
87
90
  }
91
+ if (verb === 'worth') {
92
+ const W = require('./worth-it.js');
93
+ const since = W.monthStart(now);
94
+ let runs = []; try { runs = require('./run-tokens.js').read(dir, { sinceMs: since }); } catch { runs = []; }
95
+ let items = []; try { items = require('./orchestrator-keeprate.js').readAll(roots || rootsOf(dir, cwd)).items; } catch { items = []; }
96
+ const w = W.worthOf({ runs, items, since });
97
+ try { require('./use-log.js').record(dir, [{ kind: 'use', page: 'today', control: 'aiWorth', device: 'desk' }], now); } catch { /* a count, never a reason to fail */ }
98
+ console.info(`[ai-worth] kinds=${w.rows.length} flagged=${w.rows.filter((r) => r.flag).length}`);
99
+ if (flag(args, 'json')) { say(JSON.stringify({ ok: true, ...w })); return 0; }
100
+ for (const l of W.lines(w)) say(l);
101
+ return 0;
102
+ }
88
103
  if (verb === 'log') {
89
104
  const n = Math.min(500, Math.max(1, Number(flag(args, 'n')) || 20));
90
105
  const lines = AG.readAudit(dir, { job, limit: n });
@@ -434,6 +434,8 @@ function detect(facts, state, { now, stalledDays } = {}) {
434
434
  if (i.last_activity != null && t - i.last_activity >= stall) b('stalled', 'agent', null, `Nothing changed for ${Math.floor((t - i.last_activity) / DAY)} days`);
435
435
  // product line slice 3 (lib/line-driver.js): the station's missing exit items, as `pmos line` reads them, wake the Driver to work them
436
436
  { const x = require('./line-driver.js').blockerOf(i.exit, state, { now: t }); if (x) { add(target, i.board || null, title, x.code, 'agent', i.cat || null, x.text, iniKey(i, x.key)); out[out.length - 1].exit = x.items; } }
437
+ // factory-signoffs-reach-you: the stage's missing sign-offs are the PM's blocker, never an agent wake (Today › Your move asks for them)
438
+ { const x = require('./line-driver.js').signoffBlockerOf(i.exit); if (x) { b('signoff-missing', 'pm', i.cat || null, x.text); out[out.length - 1].exit = x.items; } }
437
439
  }
438
440
  for (const w of facts.work || []) {
439
441
  if (!w || w.done) continue;
@@ -22,7 +22,9 @@
22
22
  * A WORKFLOW is { id, name, icon, builtin?, decide, archived?, stages: [STAGE], bridge? }.
23
23
  * bridge { from, map: { [fromStageKey]: stageKey } }: where each stage of the workflow it replaces lands (batch 20 item 3, canvas WmB).
24
24
  * It is saved with the new workflow, so every later switch from `from` uses it. Many old stages may land in one new stage.
25
- * A STAGE is { key, name, cat, output: { name, kind, template? }, finish: [text], milestone, auto, when: { mode, text? }, then, unless: [{ text, to }] }.
25
+ * A STAGE is { key, name, cat, output: { name, kind, template? }, finish: [text], by?, milestone, auto, when: { mode, text? }, then, unless: [{ text, to }] }.
26
+ * by { [finish line]: who }: the To finish lines only a person can give, and who gives each (factory-signoffs-reach-you). A line with
27
+ * `by` is a sign-off: PMOS asks for it and never works it. A line may be written "PRD Aligned (by: PM)"; check() splits it.
26
28
  * cat ∈ CATS (To do, In progress, Done). Won't do and Archived (ENDS) are in every workflow and are not stages.
27
29
  * The first stage is always `triage`, in To do. `then` null means the next stage in the list. `unless` sends the initiative elsewhere
28
30
  * when PMOS judges its plain words true. A key is the slug of the stage's first name and survives a rename.
@@ -45,7 +47,16 @@ const WHEN_MODES = Object.freeze(['always', 'optional', 'only']);
45
47
  const DECIDE = Object.freeze(['pmos', 'confirm']);
46
48
  const ICONS = Object.freeze(['feature', 'doc', 'cart', 'swap', 'people', 'shield', 'box', 'flag', 'build', 'chart']);
47
49
  const PRODUCT_FEATURE_ID = 'product-feature';
48
- const NAME_MAX = 60, TEXT_MAX = 300, FINISH_MAX = 20, STAGES_MAX = 30;
50
+ const NAME_MAX = 60, TEXT_MAX = 300, FINISH_MAX = 20, STAGES_MAX = 30, BY_MAX = 80;
51
+ // "PRD Aligned (by: PM)" or "PRD Aligned — by: PM": the line and who signs it off
52
+ const BY_IN_LINE = /\s*(?:\(\s*by:\s*([^()]+?)\s*\)|[—–-]+\s*by:\s*(.+?))\s*$/i;
53
+ /** A To finish line written with its sign-off: → { line, by } (by '' when the line names nobody). PURE. */
54
+ function splitBy(text) {
55
+ const t = String(text == null ? '' : text).trim();
56
+ const m = BY_IN_LINE.exec(t);
57
+ if (!m || m.index === 0) return { line: t, by: '' };
58
+ return { line: t.slice(0, m.index).trim(), by: String(m[1] || m[2] || '').trim() };
59
+ }
49
60
 
50
61
  const slug = (s) => String(s || '').toLowerCase().normalize('NFKD').replace(/[^\x00-\x7f]/g, '').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40).replace(/-+$/, '');
51
62
  const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
@@ -143,6 +154,15 @@ function check(wf) {
143
154
  if (o.template != null && o.template !== '' && !oneLine(o.template, 120)) return bad(`stage "${sname}": the template is one line of at most 120 characters`);
144
155
  const finish = s.finish == null ? [] : s.finish;
145
156
  if (!Array.isArray(finish) || finish.length > FINISH_MAX || finish.some((x) => !oneLine(x, 200))) return bad(`stage "${sname}": To finish is a list of at most ${FINISH_MAX} lines of at most 200 characters`);
157
+ const by = {};
158
+ const lines = finish.map((x) => { const sp = splitBy(x); if (sp.by) by[sp.line] = sp.by; return sp.line; });
159
+ if (s.by != null && !isObj(s.by)) return bad(`stage "${sname}": by is { "<To finish line>": "<who signs it off>" }`);
160
+ for (const [k, v] of Object.entries(s.by || {})) {
161
+ if (!lines.includes(String(k).trim())) return bad(`stage "${sname}": by names "${k}", which is not one of its To finish lines`);
162
+ if (v == null || v === '') continue;
163
+ if (!oneLine(v, BY_MAX) || !/\p{L}/u.test(v)) return bad(`stage "${sname}": who signs off "${k}" is a person or a role, one line of at most ${BY_MAX} characters`);
164
+ if (!by[String(k).trim()]) by[String(k).trim()] = v.trim();
165
+ }
146
166
  const w = isObj(s.when) ? s.when : { mode: 'always' };
147
167
  if (!WHEN_MODES.includes(w.mode)) return bad(`stage "${sname}": When it runs is one of ${WHEN_MODES.join(', ')}`);
148
168
  if (w.mode === 'only' && !oneLine(w.text, TEXT_MAX)) return bad(`stage "${sname}": Only when needs the condition in your words (at most ${TEXT_MAX} characters)`);
@@ -152,7 +172,7 @@ function check(wf) {
152
172
  stages.push({
153
173
  key, name: sname, cat: s.cat,
154
174
  output: { name: o.name ? o.name.trim() : '', kind, ...(o.template ? { template: o.template.trim() } : {}) },
155
- finish: finish.map((x) => x.trim()), milestone: s.milestone === true, auto: s.auto === true,
175
+ finish: lines, ...(Object.keys(by).length ? { by } : {}), milestone: s.milestone === true, auto: s.auto === true,
156
176
  when: w.mode === 'only' ? { mode: 'only', text: w.text.trim() } : { mode: w.mode },
157
177
  then: typeof s.then === 'string' && s.then ? s.then : null,
158
178
  unless: unless.map((u) => ({ text: u.text.trim(), to: u.to })),
@@ -338,7 +358,7 @@ function stagesOf(wf, { judged = {}, current = null } = {}) {
338
358
  const j = judged && judged[s.key] ? judged[s.key] : null;
339
359
  const skipped = !!j && j.runs === false;
340
360
  const status = skipped ? 'skipped' : at < 0 ? (i === 0 ? 'current' : 'next') : i < at ? 'done' : i === at ? 'current' : 'next';
341
- return { key: s.key, name: s.name, cat: s.cat, milestone: s.milestone, auto: s.auto, output: s.output, finish: s.finish, when: s.when,
361
+ return { key: s.key, name: s.name, cat: s.cat, milestone: s.milestone, auto: s.auto, output: s.output, finish: s.finish, ...(s.by ? { by: { ...s.by } } : {}), when: s.when,
342
362
  then: s.then, unless: s.unless, n: i + 1, of: w.stages.length, status, reading: j ? { runs: j.runs, why: j.why || '', cite: j.cite || null } : null };
343
363
  });
344
364
  }
@@ -348,7 +368,7 @@ function copyOf(wf, name, taken) {
348
368
  const n = oneLine(name, NAME_MAX) ? name.trim() : 'Copy of ' + wf.name;
349
369
  let id = slug(n) || 'workflow', k = 2;
350
370
  while ((taken && taken.has(id)) || isBuiltin(id)) id = slug(n) + '-' + k++;
351
- return { id, name: n, icon: wf.icon, decide: wf.decide || 'pmos', ...(WORK_KINDS.includes(wf.kind) ? { kind: wf.kind } : {}), stages: wf.stages.map((s) => ({ ...s, output: { ...s.output }, finish: [...s.finish], when: { ...s.when }, unless: s.unless.map((u) => ({ ...u })) })) };
371
+ return { id, name: n, icon: wf.icon, decide: wf.decide || 'pmos', ...(WORK_KINDS.includes(wf.kind) ? { kind: wf.kind } : {}), stages: wf.stages.map((s) => ({ ...s, output: { ...s.output }, finish: [...s.finish], ...(s.by ? { by: { ...s.by } } : {}), when: { ...s.when }, unless: s.unless.map((u) => ({ ...u })) })) };
352
372
  }
353
373
 
354
374
  /** The workflow a kind of work starts on: Project and Full SDLC their own; Product management the workspace's default (defaultOf). */
@@ -370,5 +390,5 @@ const milestonesOf = (wf) => (wf || PRODUCT_FEATURE).stages.filter((s) => s.mile
370
390
  module.exports = {
371
391
  CATS, CAT_LABEL, ENDS, OUTPUT_KINDS, WHEN_MODES, DECIDE, ICONS, PRODUCT_FEATURE_ID, PRODUCT_FEATURE,
372
392
  PROJECT_ID, PROJECT, FULL_SDLC_ID, FULL_SDLC, BUILTIN, KIND_WF, KIND_GATE, MEANING, isBuiltin, forKind, isKindDefault,
373
- WORK_KINDS, kindOf, slug, check, fold, list, defaultOf, resolve, stageByRef, switchTarget, proposeBridge, mapOf, removedInUse, stagesOf, copyOf, milestonesOf,
393
+ WORK_KINDS, kindOf, slug, check, fold, list, defaultOf, resolve, stageByRef, switchTarget, proposeBridge, mapOf, removedInUse, stagesOf, copyOf, milestonesOf, splitBy,
374
394
  };
@@ -7,10 +7,12 @@
7
7
  * workOf(row) PURE → { act, why, station, missing, next, flag } whether the Driver works this row's exit items
8
8
  * exitFact(row) PURE → the `exit` fact lib/driver-facts.js adds to one initiative (null when there is no row)
9
9
  * blockerOf(fact, state, { now }) PURE → null | { code: 'exit-missing', text, items, key } for lib/driver.js detect: a wake when the
10
- * missing set is new, and again each REWAKE_DAYS while it stays the same
10
+ * missing set is new, and again each REWAKE_DAYS while it stays the same. Sign-offs are left out.
11
+ * signoffBlockerOf(fact) PURE → null | { code: 'signoff-missing', text, items } the PM's blocker for the stage's sign-offs
11
12
  * checkExits(data) PURE → { ok, exits } | { ok: false, error } the shape of a move's `exits` list
12
13
  * quoteCheck(exits, readText) PURE → { ok, checks: [{ item, ok, why }] } every exit quotes a line that is really in its record
13
- * moveGate({ row, exits, from, readText }) PURE → { ok, why, checks } the Checker's gate before PMOS moves a stage by itself
14
+ * moveGate({ row, exits, from, readText, done }) PURE → { ok, why, checks } the Checker's gate before PMOS moves a stage by itself
15
+ * (done: the To finish lines a Done task finished; they need no quote)
14
16
  * readerOf(root, initiative) → readText(ref) → text | null a file inside the repository, or a Jira key in the initiative's read
15
17
  * trackerOf(root, initiative) → [{ key, summary, assignee, sprint, start, end }] who holds each ticket and in which sprint
16
18
  * linesFor(row, tracker) PURE → [text] the work list a Driver run reads (`pmos driver exits <id>`)
@@ -59,13 +61,18 @@ function workOf(row) {
59
61
  function exitFact(row) {
60
62
  if (!row) return null;
61
63
  const w = workOf(row);
62
- return { station: w.station ? w.station.name : null, missing: (w.missing || []).slice(0, 12), next: w.next, flag: w.flag, act: w.act, why: w.why };
64
+ const so = Array.isArray(row.signoffs) ? row.signoffs.filter((x) => x && x.item).slice(0, 12) : [];
65
+ return { station: w.station ? w.station.name : null, missing: (w.missing || []).slice(0, 12), ...(so.length ? { signoffs: so } : {}), next: w.next, flag: w.flag, act: w.act, why: w.why };
63
66
  }
64
67
 
65
68
  /** lib/driver.js detect: one exit-missing blocker while the Driver can act on missing items. It wakes a run when the missing set is new
66
69
  * for this station, and again every REWAKE_DAYS while it stays the same (state.blockerDays holds `key|day` of every blocker line). */
67
- function blockerOf(fact, state, { now = Date.now() } = {}) {
68
- if (!fact || !fact.act || !Array.isArray(fact.missing) || !fact.missing.length) return null;
70
+ function blockerOf(fact0, state, { now = Date.now() } = {}) {
71
+ if (!fact0 || !fact0.act || !Array.isArray(fact0.missing) || !fact0.missing.length) return null;
72
+ // factory-signoffs-reach-you: a sign-off (a To finish line with by:) is the person's to give; the Driver never wakes for it
73
+ const signed = new Set((fact0.signoffs || []).map((x) => lc(x.item)));
74
+ const fact = signed.size ? { ...fact0, missing: fact0.missing.filter((m) => !signed.has(lc(m))) } : fact0;
75
+ if (!fact.missing.length) return null;
69
76
  const key = `exit-missing:${hash(`${fact.station}|${fact.missing.join('|')}`)}`;
70
77
  const seen = state && state.blockerDays instanceof Set ? state.blockerDays : new Set();
71
78
  for (const k of seen) {
@@ -78,6 +85,15 @@ function blockerOf(fact, state, { now = Date.now() } = {}) {
78
85
  return { code: 'exit-missing', key, items, text: `${fact.station}: missing ${items.join('; ')}${fact.missing.length > 5 ? ` (+${fact.missing.length - 5} more)` : ''}` };
79
86
  }
80
87
 
88
+ /** lib/driver.js detect: the PM's blocker for the stage's missing sign-offs (factory-signoffs-reach-you). It is owned by the PM, so it never
89
+ * wakes a run; Today › Your move shows one row per sign-off (lib/stage-signoffs.js). PURE → null | { code: 'signoff-missing', text, items } */
90
+ function signoffBlockerOf(fact) {
91
+ if (!fact || !fact.act || !Array.isArray(fact.signoffs) || !fact.signoffs.length) return null;
92
+ const items = fact.signoffs.slice(0, 5);
93
+ return { code: 'signoff-missing', items: items.map((x) => x.item),
94
+ text: `${fact.station}: waits on ${items.map((x) => `${x.by}'s yes on "${x.item}"`).join('; ')}${fact.signoffs.length > 5 ? ` (+${fact.signoffs.length - 5} more)` : ''}` };
95
+ }
96
+
81
97
  /** The shape of a move's exits: [{ item, quote, ref }], at most 20. */
82
98
  function checkExits(data) {
83
99
  const list = isObj(data) ? data.exits : undefined;
@@ -118,21 +134,27 @@ function exitItemsOf(boardRow) {
118
134
  }
119
135
 
120
136
  /** The Checker's gate before PMOS moves a stage by itself. row: the line row; boardRow: the Board's row (its stage's To finish lines). */
121
- function moveGate({ row, boardRow, exits, from, readText }) {
137
+ function moveGate({ row, boardRow, exits, from, readText, done = [] }) {
122
138
  const w = workOf(row);
123
139
  if (!row || !row.live) return { ok: false, why: 'the initiative is not on the line', checks: [] };
124
140
  if (row.flag === 'cant-tell') return { ok: false, why: `can't tell where it stands (${row.why}), so PMOS does not move it`, checks: [] };
125
141
  const here = row.station;
126
142
  if (!here) return { ok: false, why: 'it has no station', checks: [] };
127
143
  if (from && lc(from) !== lc(here.key) && lc(from) !== lc(here.name)) return { ok: false, why: `it moved to ${here.name} since (you or the tracker moved it): the move from ${from} no longer applies`, checks: [] };
128
- const need = exitItemsOf(boardRow);
144
+ // done: the To finish lines a Done task already finished (the line's own record; factory-signoffs-reach-you). They need no quote, and the
145
+ // checks say so; every other line, a sign-off included, still needs its quote found in its record.
146
+ const byTask = new Set((done || []).map(lc));
147
+ const need = exitItemsOf(boardRow).filter((n) => !byTask.has(lc(n)));
129
148
  const given = new Map((exits || []).map((x) => [lc(x.item), x]));
130
149
  const absent = need.filter((n) => !given.has(lc(n)));
131
150
  if (absent.length) return { ok: false, why: `every exit item of ${here.name} needs a quote: missing ${absent.join('; ')}`, checks: [] };
151
+ const taskChecks = exitItemsOf(boardRow).filter((n) => byTask.has(lc(n))).map((n) => ({ item: n, ref: null, ok: true, why: 'its task is Done' }));
152
+ if (!need.length && taskChecks.length) return { ok: true, why: `every exit item of ${here.name} has a Done task`, checks: taskChecks };
132
153
  const q = quoteCheck(need.map((n) => given.get(lc(n))), readText);
133
- if (!q.ok) return { ok: false, why: q.checks.filter((c) => !c.ok).map((c) => `${c.item}: ${c.why}`).join('; '), checks: q.checks };
154
+ const checks = taskChecks.concat(q.checks);
155
+ if (!q.ok) return { ok: false, why: q.checks.filter((c) => !c.ok).map((c) => `${c.item}: ${c.why}`).join('; '), checks };
134
156
  void w;
135
- return { ok: true, why: `${q.checks.length} of ${q.checks.length} exit items of ${here.name} quote a real record line`, checks: q.checks };
157
+ return { ok: true, why: `${q.checks.length} of ${q.checks.length} exit items of ${here.name} quote a real record line${taskChecks.length ? `; ${taskChecks.length} have a Done task` : ''}`, checks };
136
158
  }
137
159
 
138
160
  /** readText for one repository: a path inside it, or a Jira key the initiative's last read holds (its summary, status and sprint). */
@@ -173,8 +195,14 @@ function linesFor(row, tracker = []) {
173
195
  if (!row) return ['Not on the line: `pmos line` does not list this initiative.'];
174
196
  out.push(`Station: ${w.station ? `${w.station.name} (${w.station.n} of ${w.station.of})` : 'none'} · flag: ${w.flag || 'none'}${row.why ? ` (${row.why})` : ''}.`);
175
197
  if (!w.act) { out.push(`Do not work its exit items and do not propose a stage move: ${w.why}.`); return out; }
176
- if (w.missing.length) {
177
- out.push(`Missing exit items (the station's To finish lines): ${w.missing.map((m) => `"${m}"`).join('; ')}.`);
198
+ const so = Array.isArray(row.signoffs) ? row.signoffs : [];
199
+ if (so.length) {
200
+ out.push(`Sign-offs (a person gives these; do not work them): ${so.map((x) => `"${x.item}" by ${x.by}`).join('; ')}. When you find where the yes is written, run \`pmos signoff list ${row.id}\` for its id, then \`pmos signoff evidence <id> --ref <file or Jira key> --quote "<the line, word for word>" [--doc <the document it agrees to>]\`. The PM records it on Today.`);
201
+ }
202
+ const work = so.length ? w.missing.filter((m) => !so.some((x) => lc(x.item) === lc(m))) : w.missing;
203
+ if (so.length && !work.length && w.missing.length) return out;
204
+ if (work.length) {
205
+ out.push(`Missing exit items (the station's To finish lines): ${work.map((m) => `"${m}"`).join('; ')}.`);
178
206
  out.push('Work these items first, in this order. For each, file the proposal that gets it done, with its source.');
179
207
  } else {
180
208
  out.push(`Every exit item is done. Next move: ${w.next}. Propose it with --what move and data {"to": "<stage>", "from": "${w.station.key}", "exits": [{"item": "<each To finish line>", "quote": "<a line copied word for word>", "ref": "<the file path or Jira key it is in>"}]}.`);
@@ -220,5 +248,5 @@ function countChecks(stateDir, now = Date.now()) {
220
248
  return { pass, flag };
221
249
  }
222
250
 
223
- module.exports = { countChecks, boardRowOf, boardMove, stationNow, sameStage, workOf, exitFact, blockerOf, checkExits, quoteCheck, exitItemsOf, moveGate, readerOf, trackerOf, linesFor, CHECKER_REASON, REWAKE_DAYS, MIN_QUOTE };
251
+ module.exports = { countChecks, boardRowOf, boardMove, stationNow, sameStage, workOf, exitFact, blockerOf, signoffBlockerOf, checkExits, quoteCheck, exitItemsOf, moveGate, readerOf, trackerOf, linesFor, CHECKER_REASON, REWAKE_DAYS, MIN_QUOTE };
224
252
 
@@ -55,13 +55,22 @@ function limitOf(st) {
55
55
  return CAT_LIMIT[st.cat] != null ? CAT_LIMIT[st.cat] : 15;
56
56
  }
57
57
 
58
- /** The exit items still missing on the current stage. → [text] */
59
- function missingOf(st, row, tasks, jira) {
58
+ /** Who signs off each To finish line of a stage: { [line in lower case]: who }. The stage's own `by:` wins over a kept suggestion. PURE. */
59
+ function byOf(st, kept = null) {
60
+ const out = {};
61
+ for (const src of [kept, st && st.by]) if (src && typeof src === 'object') for (const [k, v] of Object.entries(src)) if (typeof v === 'string' && v.trim()) out[lc(k)] = v.trim();
62
+ return out;
63
+ }
64
+
65
+ /** The exit items still missing on the current stage. → [text]
66
+ * answered: the To finish lines (lower case) whose sign-off is answered in lib/signoffs.js (factory-signoffs-reach-you): they are done. */
67
+ function missingOf(st, row, tasks, jira, answered = null) {
60
68
  const finish = Array.isArray(st.finish) ? st.finish.filter((f) => typeof f === 'string' && f.trim()) : [];
61
69
  if (finish.length) {
62
70
  const map = row.wfMap || {};
63
71
  const mine = (k) => k === st.key || map[k] === st.key;
64
- return finish.filter((f) => !(tasks || []).some((t) => t && t.from && mine(t.from.stage) && t.from.finish === f && DONE_STATES.has(lc(t.state))));
72
+ const signed = answered instanceof Set ? answered : new Set();
73
+ return finish.filter((f) => !signed.has(lc(f)) && !(tasks || []).some((t) => t && t.from && mine(t.from.stage) && t.from.finish === f && DONE_STATES.has(lc(t.state))));
65
74
  }
66
75
  const out = st.output || {};
67
76
  if (out.kind === 'jira' && jira && Array.isArray(jira.tickets) && jira.tickets.length) {
@@ -75,7 +84,7 @@ function missingOf(st, row, tasks, jira) {
75
84
  }
76
85
 
77
86
  function place(input, now = Date.now()) {
78
- const { row, tasks = [], moves = [], jira = null, activity = [] } = input || {};
87
+ const { row, tasks = [], moves = [], jira = null, activity = [], signoffs = [], byKept = null } = input || {};
79
88
  const one = row.oneStage || {};
80
89
  const base = { id: row.id, title: row.title || row.id, workflow: row.wf ? row.wf.name : null };
81
90
  const endWord = row.ended ? (row.ended.as === 'wontdo' ? "Won't do" : 'Archived') : row.archived ? 'Archived'
@@ -102,7 +111,15 @@ function place(input, now = Date.now()) {
102
111
  const quietDays = last != null ? days(last, now) : null;
103
112
  const clock = daysThere != null ? daysThere : quietDays;
104
113
 
105
- const missing = missingOf(st, row, tasks, jira);
114
+ // factory-signoffs-reach-you: the stage's sign-offs (its `by:` lines, and the ones the PM kept from PMOS's suggestion); one answered in
115
+ // the sign-off ledger is done, and a missing one is the person's to give, never the Driver's to work
116
+ const by = byOf(st, byKept);
117
+ const answered = new Set((signoffs || []).filter((x) => x && x.state === 'answered' && by[lc(x.what)] != null).map((x) => lc(x.what)));
118
+ const missing = missingOf(st, row, tasks, jira, answered);
119
+ const signoffList = missing.filter((m) => by[lc(m)] != null).map((m) => ({ item: m, by: by[lc(m)] }));
120
+ // a stage with no sign-off lines and no answer to PMOS's suggestion yet: the lines that read as a person's yes (board LnBy4)
121
+ let suggestBy = null;
122
+ if (!Object.keys(by).length && byKept == null && row.wf && row.wf.id) { try { const g = require('./stage-signoffs.js').suggestOf(st); if (Object.keys(g).length) suggestBy = { wf: row.wf.id, stage: st.key, stageName: st.name, by: g }; } catch { suggestBy = null; } }
106
123
  const stages = row.wfStages || [];
107
124
  const idx = stages.findIndex((s) => s.key === st.key);
108
125
  const nextStage = stages.slice(idx + 1).find((s) => s.status !== 'skipped');
@@ -115,7 +132,7 @@ function place(input, now = Date.now()) {
115
132
  else next = nextStage ? `move to ${nextStage.name}` : 'close it';
116
133
 
117
134
  const out = { ...base, station, live: true, ended: null, daysThere, since: since != null ? new Date(since).toISOString() : null, setBy,
118
- quietDays, clock, missing, next, limit: limit === 'tickets' ? `${TICKET_QUIET_WORKDAYS} working days with no ticket change` : limit };
135
+ quietDays, clock, missing, ...(signoffList.length ? { signoffs: signoffList } : {}), ...(suggestBy ? { suggestBy } : {}), next, limit: limit === 'tickets' ? `${TICKET_QUIET_WORKDAYS} working days with no ticket change` : limit };
119
136
  const flag = (f, why) => ({ ...out, flag: f, why });
120
137
 
121
138
  if (one.stage === 'on-hold') return flag('waiting', 'on hold: the clock is stopped');
@@ -245,6 +262,8 @@ function lineOf(root, { only = null, now = Date.now(), derive = true } = {}) {
245
262
  const liveIds = new Set(base.rows.filter((x) => !(x.status === 'done' || x.lifecycle)).map((x) => x.id));
246
263
  let JS = null; try { JS = require('./jira-status.js'); } catch { JS = null; }
247
264
  let JT = null; try { JT = require('./jira-tickets.js'); } catch { JT = null; }
265
+ let SO = null, SS = null, soFile = null, kept = null;
266
+ try { SO = require('./signoffs.js'); SS = require('./stage-signoffs.js'); const soDir = JT ? JT.stateDirOf(root) : stateDir; soFile = SO.fileOf(soDir); kept = SS.keptLedger(soDir); } catch { SO = null; SS = null; }
248
267
  const rows = [];
249
268
  for (const id of ids) {
250
269
  const r = boards.initiativeWorkflow(pass, w, id);
@@ -266,7 +285,10 @@ function lineOf(root, { only = null, now = Date.now(), derive = true } = {}) {
266
285
  const recRel = typeof b0.record === 'string' ? path.relative(root, path.resolve(root, b0.record)) : null;
267
286
  const activity = (acts.get(id) || []).concat(gitTimes(root, recRel, real));
268
287
  const deps = depsOf(root, recRel).filter((d) => d !== id && liveIds.has(d));
269
- rows.push({ deps, doubt: doubtOf(r.row, derived.get(id)), p: place({ row: r.row, tasks, moves, jira, activity }, now) });
288
+ // factory-signoffs-reach-you: this initiative's sign-offs, and the sign-off lines the PM kept from PMOS's suggestion for its stage
289
+ const signoffs = SO ? SO.list(soFile, { ini: id }) : [];
290
+ const byKept = SS && r.row.wf && r.row.wfStage ? SS.keptFor(kept, r.row.wf.id, r.row.wfStage.key) : null;
291
+ rows.push({ deps, doubt: doubtOf(r.row, derived.get(id)), p: place({ row: r.row, tasks, moves, jira, activity, signoffs, byKept }, now) });
270
292
  }
271
293
  // a dependency counts while it is itself live on the line (not ended): waiting on it is never stuck
272
294
  const first = new Map(rows.map((x) => [x.p.id, x.p]));
@@ -285,4 +307,4 @@ function summary(line) {
285
307
  return { live, placed, percent: live ? Math.round((placed / live) * 1000) / 10 : 0 };
286
308
  }
287
309
 
288
- module.exports = { place, lineOf, summary, missingOf, limitOf, activityIndex, doubtOf, depsOf, settle, LIMITS, STALE_DAYS };
310
+ module.exports = { place, lineOf, summary, missingOf, byOf, limitOf, activityIndex, doubtOf, depsOf, settle, LIMITS, STALE_DAYS };
@@ -53,7 +53,7 @@ const VERBS = Object.freeze({
53
53
  help: 'pmos people list|show|record|settings … — the people you work with in this repository (pmos people help)' }),
54
54
  // Not a pm-os-absorb verb (run: null): initiative dry-run-tickets-before-build added it through the same table.
55
55
  signoff: Object.freeze({ module: 'signoff-cli.js', run: null, guide: 'cli.md',
56
- help: 'pmos signoff ask|answer|drop|list … — the outside sign-offs an initiative waits on; open ones go on your question list (pmos signoff help)' }),
56
+ help: 'pmos signoff ask|answer|drop|evidence|list … — the sign-offs an initiative waits on; a stage\'s sign-offs are Your move rows on Today (pmos signoff help)' }),
57
57
  // Not a pm-os-absorb verb (run: null): initiative my-work added it through the same table.
58
58
  'my-work': Object.freeze({ module: 'my-work-cli.js', run: null, guide: 'cli.md',
59
59
  help: 'pmos my-work list|show|submit … — the Jira tickets and WBS items assigned to you, ranked (pmos my-work help)' }),
@@ -99,6 +99,7 @@ const MODULES = Object.freeze([
99
99
  'routes-task-links', // batch 11 item 15: links between tasks, Claude's proposals, the quiet moves (task-links.jsonl; page-press POST)
100
100
  'routes-proposals', // batch 12 items 2, 3 and 4: everything Claude proposes on an initiative, under its one ✦ (proposals.jsonl; page-press POST)
101
101
  'routes-autonomy', // D106: what agents did by themselves (the Done group, 14 days), its Undo, and the demotions Home says once (autonomy.jsonl)
102
+ 'routes-stage-signoffs', // factory-signoffs-reach-you: a stage's sign-offs as Your move rows, ✓ that records one (and moves the stage), Undo, the ✦ suggestion
102
103
  'routes-your-move', // workspace grill W3: Your move's overdue outcome verdicts (drafted from Jira) and the first key result with no reading (GET)
103
104
  'routes-tracker-sync', // tracker-sync-on-today: the sync with Jira of a product, the PM's ✓ that takes Jira's value, and its Undo (task ledger; page-press POST)
104
105
  'routes-standing-rules', // standing-rules-list (A470): the standing rules PMOS keeps, with edit, retire and bring back (memory + standing-rules.jsonl)
@@ -545,7 +545,7 @@ const wfRowFields = (x) => {
545
545
  wf: { id: x.wf.id, name: x.wf.name, icon: x.wf.icon, ...(x.own && x.own.pmos ? { setBy: 'pmos', why: x.own.why, from: x.own.from || null } : {}) },
546
546
  wfStage: { key: st.key, name: st.name, cat: st.cat, milestone: !!st.milestone, n: st.n, of: st.of },
547
547
  wfStages: x.stages.map((s) => ({ key: s.key, name: s.name, cat: s.cat, milestone: !!s.milestone, auto: !!s.auto, when: s.when, status: s.status, reading: s.reading,
548
- output: s.output, finish: s.finish })), // output and finish: what finishes the stage (the stage card's exit steps on a library workflow)
548
+ output: s.output, finish: s.finish, ...(s.by ? { by: s.by } : {}) })), // output and finish: what finishes the stage (the stage card's exit steps on a library workflow); by: who signs off a line
549
549
  ended: x.ended ? { as: x.ended.as, reason: x.ended.reason, note: x.ended.note, at: x.ended.at } : null,
550
550
  // batch 20 item 3: where the tasks of an earlier workflow's stages sit now (old key → stage key), and the switch Undo can still put back (7 days)
551
551
  wfMap: x.own && x.own.map ? x.own.map : null,