create-pmos 0.705.0 → 0.707.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.705.0",
3
+ "version": "0.707.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.705.0",
38
- "at": "2026-11-22T11:04:46.265Z",
37
+ "v": "0.707.0",
38
+ "at": "2026-11-22T11:12:27.208Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
@@ -49,6 +49,18 @@
49
49
  "t": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
50
50
  "s": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
51
51
  "k": "new"
52
+ },
53
+ {
54
+ "n": 1535,
55
+ "t": "Corrections become standing rules (A464)",
56
+ "s": "Corrections become standing rules (A464)",
57
+ "k": "new"
58
+ },
59
+ {
60
+ "n": 1533,
61
+ "t": "Date moves only the tracker says wait for the owner, default to the tracker's date (A449)",
62
+ "s": "Date moves only the tracker says wait for the owner, default to the tracker's date (A449)",
63
+ "k": "new"
52
64
  }
53
65
  ]
54
66
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@08ad453a
1
+ kernel-source: pmos@1753291a
2
2
  assembled: 2026-11-22
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-22T11:04:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T11:12:23Z"}
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-22T11:04:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T11:12:23Z"}
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-22T11:04:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T11:12:23Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
- "v": "0.705.0",
4
- "at": "2026-11-22T11:04:46.265Z",
3
+ "v": "0.707.0",
4
+ "at": "2026-11-22T11:12:27.208Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
@@ -15,6 +15,18 @@
15
15
  "t": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
16
16
  "s": "A blocked outcome check shows as blocked, with the step to fix it (A451)",
17
17
  "k": "new"
18
+ },
19
+ {
20
+ "n": 1535,
21
+ "t": "Corrections become standing rules (A464)",
22
+ "s": "Corrections become standing rules (A464)",
23
+ "k": "new"
24
+ },
25
+ {
26
+ "n": 1533,
27
+ "t": "Date moves only the tracker says wait for the owner, default to the tracker's date (A449)",
28
+ "s": "Date moves only the tracker says wait for the owner, default to the tracker's date (A449)",
29
+ "k": "new"
18
30
  }
19
31
  ]
20
32
  },
@@ -159,6 +159,7 @@ An "off" switch accepts `off`, `0`, `false` or `no` unless the row says a differ
159
159
  | `PMOS_LEAN_JOBS` | How background runs start. `off` starts every run with all tools, skills and settings. `all` also starts the runs that read your connectors lean. By default a run that reads no connector starts lean, with only its own tools. | lean for runs with no connector | — |
160
160
  | `PMOS_RUN_MEMORY` | `off` stops adding the repository's curated memory (what PMOS remembers about you and the product) to each background run, and stops each team role's notebook (what became of its earlier work). A web run never gets it. | on | — |
161
161
  | `PMOS_CORRECTION_MEMORY` | `off` stops your ✕ reasons from becoming memory. By default a reason of 12 characters or more is remembered as one unconfirmed entry for 30 days, at most 6 at once. | on | — |
162
+ | `PMOS_CORRECTION_RULES` | `off` stops PMOS from recording each ✕ reason with a kind and offering a kind that repeats 3 times in 30 days as a standing rule in the Lab. | on | — |
162
163
  | `PMOS_FACTORY_LESSONS` | `off` stops factory lessons. By default each factory setback (a failed check, a revert or rollback, a pull request the guardrail sent to a person, your Undo of one, a reviewer FAIL) becomes one Lessons line on its initiative and one line in the Builder's notebook. The Builder prompt carries the last 5. The same setback 3 times in 14 days files one proposal, "Change the factory harness", for your ✓. | on | — |
163
164
  | `PMOS_CLAUDE_HOME` | The one folder where PMOS looks for PMOS transcripts. | the PMOS config folders | — |
164
165
  | `PMOS_HEADLESS_TIMEOUT_MS` | The longest time a background run may take. | 20 minutes | — |
@@ -0,0 +1,213 @@
1
+ 'use strict';
2
+ /* correction-kinds.js — teach PMOS once: corrections become standing rules (bet A464, initiative correction-rules).
3
+ *
4
+ * The PM's ✕ reasons repeat, but nothing could see the repeat: run records hold a count, and each reason became one memory line that goes
5
+ * stale in 30 days. Here every reason is recorded WITH A KIND, and a kind that repeats becomes a ✦ in the Lab: "make this a standing rule".
6
+ * ✓ (lib/routes-lab.js) writes it as a confirmed memory entry by the PM, so every later run reads it and it never goes stale. Undo removes it.
7
+ *
8
+ * KINDS. A fixed word list, no model: sources, dates, scope, wording, duplicates, owners, priority, tests, design, numbers. A reason that
9
+ * matches no word is `other` and is never offered. The kind with the most matching words wins; a tie goes to the earlier kind in the list.
10
+ *
11
+ * LEDGER. corrections.jsonl in the product's PMOS state folder (pmos/state, state or .pmos under the repository), one line per correction:
12
+ * { at, kind, why, source, ini? }
13
+ * A repository with no state folder records nothing (and says nothing). PMOS_CORRECTION_RULES=off stops all of it.
14
+ *
15
+ * OFFERS. A kind with MIN_REPEAT or more corrections from MIN_REPEAT different sources in WINDOW_DAYS, counted after its last drop or undo,
16
+ * is offered (most corrections first, at most MAX_OPEN open at once). A kept rule is never offered again. Each offer logs one line with TAG.
17
+ *
18
+ * kindOf(text) → kind id ('other' when no word matches)
19
+ * stateDir(root) → the state folder, or null
20
+ * readLines(dir) · append(dir, line) the ledger
21
+ * offersOf(lines, lab, { now }) PURE → [{ kind, n, latest, sources }] to file now
22
+ * propLine(offer) PURE → the idle-lab propose line for an offer
23
+ * note(root, { why, source, ini, env, now, log }) → { ok, kind?, offered?: [kind] } never throws
24
+ * countRecent(lines, now, days) · effectOf(lines, lab, now) PURE (the health number and the outcome check)
25
+ */
26
+ const fs = require('fs');
27
+ const path = require('path');
28
+
29
+ const DAY = 86400000;
30
+ const LEDGER = 'corrections.jsonl';
31
+ const TAG = '[correction-rules]';
32
+ const MIN_WHY = 12;
33
+ const MIN_REPEAT = 3;
34
+ const WINDOW_DAYS = 30;
35
+ const MAX_OPEN = 3;
36
+ const PREFIX = 'rule-';
37
+
38
+ /* Each kind: the words that place a reason in it, and the standing rule PMOS offers for it. Plain, for any product. */
39
+ const KINDS = Object.freeze([
40
+ { id: 'sources', label: 'Sources', words: /\b(sources?|sourced|cite[sd]?|citations?|evidence|references?|proofs?|unsourced|where (?:is|does) (?:this|that|it) come from)\b/gi,
41
+ rule: 'Cite the source of every claim or change you propose.' },
42
+ { id: 'dates', label: 'Dates', words: /\b(dates?|deadlines?|due|overdue|schedule[sd]?|timeline|sprints?|moved?|reschedul\w*|postpone\w*|delay\w*|slip\w*|end date|start date)\b/gi,
43
+ rule: 'Move a date only with a cited reason, and say what it moved from.' },
44
+ { id: 'scope', label: 'Scope', words: /\b(scope|out of scope|too (?:big|much|broad)|not (?:now|needed|asked)|later|unrelated|off[- ]topic|nobody asked|stick to)\b/gi,
45
+ rule: 'Keep each proposal to what was asked. Put extra ideas on a line of their own.' },
46
+ { id: 'wording', label: 'Wording', words: /\b(word(?:s|ing)?|tone|jargon|phras\w*|wordy|verbose|too long|rename|naming|named?|label|copy|plain|spelling|typo)\b/gi,
47
+ rule: 'Use the product\'s own words, and keep text short and plain.' },
48
+ { id: 'duplicates', label: 'Duplicates', words: /\b(duplicates?|duplicated|already (?:exists?|have|there|done)|same as|again|twice|repeat\w*|copy of)\b/gi,
49
+ rule: 'Check for an existing item before you propose a new one.' },
50
+ { id: 'owners', label: 'Owners', words: /\b(owners?|ownership|assign\w*|assignee|who owns|reassign\w*|not (?:his|hers|theirs|mine)|wrong person)\b/gi,
51
+ rule: 'Name the owner, and do not change an owner without asking.' },
52
+ { id: 'priority', label: 'Priority', words: /\b(priorit\w*|rank\w*|urgent|important|less important|more important|p[0-3])\b/gi,
53
+ rule: 'Follow the agreed ranking, and say why before you change a priority.' },
54
+ { id: 'tests', label: 'Tests', words: /\b(tests?|tested|untested|testing|checks?|verif\w*|qa|regression|broke|broken|breaks)\b/gi,
55
+ rule: 'Say how each change was checked, and test what it touches.' },
56
+ { id: 'design', label: 'Design', words: /\b(design|layout|colou?rs?|spacing|font|icons?|buttons?|style|looks?|ui|ux|mockup|pixel)\b/gi,
57
+ rule: 'Follow the design system, and change no layout or style beyond the ask.' },
58
+ { id: 'numbers', label: 'Numbers', words: /\b(numbers?|counts?|figures?|totals?|wrong (?:number|count|data)|data|stale|outdated|out of date|percent\w*|metrics?)\b/gi,
59
+ rule: 'Read numbers from current data, and say where and when they were read.' },
60
+ ]);
61
+ const IDS = Object.freeze(KINDS.map((k) => k.id));
62
+ const byId = new Map(KINDS.map((k) => [k.id, k]));
63
+
64
+ const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
65
+ const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
66
+ const off = (env) => /^(off|0|false|no)$/i.test(String((env || process.env).PMOS_CORRECTION_RULES || '').trim());
67
+
68
+ function kindOf(text) {
69
+ const t = String(text || '');
70
+ let best = 'other', most = 0;
71
+ for (const k of KINDS) {
72
+ const n = (t.match(k.words) || []).length;
73
+ if (n > most) { most = n; best = k.id; }
74
+ }
75
+ return best;
76
+ }
77
+
78
+ function stateDir(root) {
79
+ if (!root) return null;
80
+ for (const rel of [['pmos', 'state'], ['state'], ['.pmos']]) {
81
+ const d = path.join(root, ...rel);
82
+ try { if (fs.statSync(d).isDirectory()) return d; } catch { /* next */ }
83
+ }
84
+ return null;
85
+ }
86
+
87
+ function readLines(dir) {
88
+ if (!dir) return [];
89
+ let text = '';
90
+ try { text = fs.readFileSync(path.join(dir, LEDGER), 'utf8'); } catch { return []; }
91
+ const out = [];
92
+ for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { const l = JSON.parse(raw); if (isObj(l) && l.kind && l.at) out.push(l); } catch { /* a torn line is skipped */ } }
93
+ return out;
94
+ }
95
+ function append(dir, line) { fs.appendFileSync(path.join(dir, LEDGER), JSON.stringify(line) + '\n'); return line; }
96
+
97
+ /* What the Lab ledger (lib/idle-lab.js fold) says about each rule id: open, kept (not undone), and since when its count restarts. */
98
+ function labState(L) {
99
+ const st = new Map();
100
+ if (!L) return st;
101
+ const get = (id) => { if (!st.has(id)) st.set(id, { open: false, kept: null, since: 0 }); return st.get(id); };
102
+ const keptBatches = new Map();
103
+ for (const k of L.kept || []) if (String(k.id).startsWith(PREFIX)) {
104
+ if (L.undone && L.undone.has(k.batch)) { const s = get(k.id); s.since = Math.max(s.since, Date.parse(k.at) || 0); } // counted again from the keep
105
+ else get(k.id).kept = k.at;
106
+ keptBatches.set(k.batch, k.id);
107
+ }
108
+ for (const [id, d] of L.drops || []) if (String(id).startsWith(PREFIX)) { const s = get(id); s.since = Math.max(s.since, Date.parse(d.at) || 0); }
109
+ for (const [id, p] of L.props || []) if (String(id).startsWith(PREFIX)) {
110
+ const s = get(id);
111
+ if (!s.kept && !(L.drops && L.drops.has(id))) s.open = true;
112
+ s.proposed = Math.max(s.proposed || 0, Date.parse(p.at) || 0);
113
+ }
114
+ return st;
115
+ }
116
+
117
+ /** PURE. The offers to file now: kinds that repeat, not open, not kept, counted after their last drop or undo. */
118
+ function offersOf(lines, L, { now = Date.now() } = {}) {
119
+ const st = labState(L), since = now - WINDOW_DAYS * DAY;
120
+ const open = [...st.values()].filter((s) => s.open).length;
121
+ const room = Math.max(0, MAX_OPEN - open);
122
+ if (!room) return [];
123
+ const groups = new Map();
124
+ for (const l of lines || []) {
125
+ if (!IDS.includes(l.kind)) continue;
126
+ const at = Date.parse(l.at) || 0, s = st.get(PREFIX + l.kind);
127
+ if (at < since || at > now || (s && (s.open || s.kept || at <= s.since))) continue;
128
+ if (!groups.has(l.kind)) groups.set(l.kind, []);
129
+ groups.get(l.kind).push(l);
130
+ }
131
+ const out = [];
132
+ for (const [kind, ls] of groups) {
133
+ const sources = [...new Set(ls.map((l) => String(l.source || '') || 'at:' + l.at))];
134
+ if (ls.length < MIN_REPEAT || sources.length < MIN_REPEAT) continue;
135
+ ls.sort((a, b) => String(a.at).localeCompare(String(b.at)));
136
+ const latest = ls[ls.length - 1];
137
+ out.push({ kind, n: ls.length, latest: one(latest.why, 140), at: latest.at, sources: sources.slice(-3) });
138
+ }
139
+ out.sort((a, b) => b.n - a.n || String(b.at).localeCompare(String(a.at)) || IDS.indexOf(a.kind) - IDS.indexOf(b.kind));
140
+ return out.slice(0, room);
141
+ }
142
+
143
+ /** PURE. The idle-lab propose line for an offer (lib/idle-lab.js loose type 'rule'). */
144
+ function propLine(o) {
145
+ const k = byId.get(o.kind);
146
+ return { kind: 'propose', id: PREFIX + o.kind, type: 'rule', title: k.rule,
147
+ why: one(`You corrected this ${o.n} times in ${WINDOW_DAYS} days. Latest: "${o.latest}"`, 300),
148
+ sources: o.sources.map((ref) => ({ label: 'Your correction', ...(ref.startsWith('at:') ? {} : { ref }) })),
149
+ data: { kind: o.kind, n: o.n } };
150
+ }
151
+
152
+ /** Record one correction with its kind and file any offer it completes. Never throws. */
153
+ function note(root, { why = '', source = '', ini = null, env = process.env, now = Date.now(), log = console.log } = {}) {
154
+ try {
155
+ const reason = one(why, 300);
156
+ if (!root || reason.length < MIN_WHY || off(env)) return { ok: true };
157
+ const dir = stateDir(root);
158
+ if (!dir) return { ok: true };
159
+ const kind = kindOf(reason);
160
+ append(dir, { at: new Date(now).toISOString(), kind, why: reason, source: one(source, 120), ...(ini ? { ini: one(ini, 80) } : {}) });
161
+ if (kind === 'other') return { ok: true, kind, offered: [] };
162
+ const LAB = require('./idle-lab.js');
163
+ const offers = offersOf(readLines(dir), LAB.read(dir), { now });
164
+ for (const o of offers) {
165
+ const line = propLine(o), v = LAB.loose('rule', line);
166
+ if (v.error) continue;
167
+ LAB.append(dir, { by: 'agent:corrections' }, { kind: 'propose', ...v.prop });
168
+ try { log(`${TAG} offered a standing rule for ${o.kind} (${o.n} corrections in ${WINDOW_DAYS} days)`); } catch { /* the line is filed */ }
169
+ }
170
+ return { ok: true, kind, offered: offers.map((o) => o.kind) };
171
+ } catch (e) { return { ok: false, why: String((e && e.message) || e).slice(0, 160) }; }
172
+ }
173
+
174
+ /** PURE. Corrections recorded in the last `days` days (the health number). */
175
+ function countRecent(lines, now = Date.now(), days = 7) {
176
+ const since = now - days * DAY;
177
+ return (lines || []).filter((l) => { const at = Date.parse(l.at) || 0; return at >= since && at <= now; }).length;
178
+ }
179
+
180
+ /** PURE. Per kept rule: corrections of its kind in the 30 days before it was kept and the 30 days after (the outcome check). */
181
+ function effectOf(lines, L, now = Date.now()) {
182
+ const out = [];
183
+ for (const [id, s] of labState(L)) {
184
+ if (!s.kept) continue;
185
+ const kind = id.slice(PREFIX.length), t = Date.parse(s.kept) || 0, W = WINDOW_DAYS * DAY;
186
+ const of = (lines || []).filter((l) => l.kind === kind).map((l) => Date.parse(l.at) || 0);
187
+ out.push({ kind, kept: s.kept, before: of.filter((a) => a >= t - W && a < t).length, after: of.filter((a) => a >= t && a < t + W).length,
188
+ complete: now >= t + W });
189
+ }
190
+ return out.sort((a, b) => String(a.kept).localeCompare(String(b.kept)));
191
+ }
192
+
193
+ module.exports = { KINDS, IDS, LEDGER, TAG, MIN_WHY, MIN_REPEAT, WINDOW_DAYS, MAX_OPEN, PREFIX, kindOf, stateDir, readLines, append, offersOf, propLine, note, countRecent, effectOf, ruleOf: (kind) => (byId.get(kind) || {}).rule || '' };
194
+
195
+ /* node correction-kinds.js count|effect [--root <repo>] [--json] */
196
+ if (require.main === module) {
197
+ const argv = process.argv.slice(2), cmd = argv[0];
198
+ const opt = (k) => { const i = argv.indexOf(k); return i >= 0 ? argv[i + 1] : null; };
199
+ const root = path.resolve(opt('--root') || '.'), dir = stateDir(root), lines = readLines(dir);
200
+ if (cmd === 'count') {
201
+ const n = countRecent(lines);
202
+ if (argv.includes('--json')) process.stdout.write(JSON.stringify({ dir, last7: n }) + '\n');
203
+ else process.stdout.write(`${dir ? '' : 'No PMOS state folder here, so no corrections are recorded.\n'}${n}\n`);
204
+ } else if (cmd === 'effect') {
205
+ const e = effectOf(lines, require('./idle-lab.js').read(dir));
206
+ if (argv.includes('--json')) process.stdout.write(JSON.stringify({ dir, rules: e }) + '\n');
207
+ else if (!e.length) process.stdout.write('No standing rule kept yet.\n');
208
+ else for (const r of e) process.stdout.write(`${r.kind}: kept ${String(r.kept).slice(0, 10)}, ${r.before} corrections in the 30 days before, ${r.after} after${r.complete ? '' : ' (so far)'}\n`);
209
+ } else {
210
+ process.stdout.write('usage: node correction-kinds.js count|effect [--root <repo>] [--json]\n');
211
+ process.exitCode = cmd ? 1 : 0;
212
+ }
213
+ }
@@ -10,6 +10,9 @@
10
10
  * live at once: the oldest is removed first. A full memory is never forced: the write is skipped and the reason stays on the ✕ line.
11
11
  * The same text twice is written once. PMOS_CORRECTION_MEMORY=off stops it.
12
12
  *
13
+ * KINDS (bet A464): every reason is also recorded with a kind (lib/correction-kinds.js), so a repeat can become a standing rule the PM
14
+ * keeps once. PMOS_CORRECTION_RULES=off stops that part only.
15
+ *
13
16
  * SCOPE (chief-unit-owners ✦4): with `ini` the entry is written at initiative scope (initiative:<id>), so only runs on that initiative read
14
17
  * it until the unit's tick sees the same lesson on a second initiative and promotes it (lib/unit-memory.js). The KEEP bound is per scope.
15
18
  *
@@ -33,6 +36,8 @@ function remember(root, { what = '', why = '', source = '', ini = null, env = pr
33
36
  try {
34
37
  const reason = one(why, 300);
35
38
  if (!root || reason.length < MIN_WHY) return { ok: true, wrote: false, why: 'no reason to learn from' };
39
+ // the same reason, recorded with its kind: a kind that repeats becomes a standing-rule ✦ in the Lab (lib/correction-kinds.js, bet A464)
40
+ require('./correction-kinds.js').note(root, { why: reason, source, ini, env, now });
36
41
  if (off(env)) return { ok: true, wrote: false, why: 'PMOS_CORRECTION_MEMORY=off' };
37
42
  const c = require('./memory.js').core();
38
43
  if (!c.ok) return { ok: true, wrote: false, why: c.error };
@@ -19,6 +19,12 @@
19
19
  * writes one drop line per change in proposals.jsonl, marked `default: true` with the batch (by `pmos:default`, so no job learns from it as
20
20
  * from the PM's ✕), and one `applied` line for the job `propose:default` in autonomy.jsonl, so "PMOS did" lists it with Undo. The plan
21
21
  * itself is not written; nothing is sent.
22
+ * THE TRACKER'S DATE (initiative tracker-date-moves-wait-for-owner, idea A449). A date move of 30 days or less that only the tracker says
23
+ * (lib/source-guard.js trackerMoveOf) has a source: the question asks its owner to confirm it, and the default is `tracker`, PMOS takes the
24
+ * tracker's date. take() applies it through `apply(held)` (lib/routes-proposals.js keepDefault: the board's own writer, one keep line marked
25
+ * `default: true` with the batch and `held: [id]`), records one `applied` line for `propose:default` and logs one [tracker-date-wait] line.
26
+ * A move on a task that is itself a Jira ticket (item `jira`) keeps `leave`: the ticket already has the date. Undo puts the old date back,
27
+ * and the question comes back with no default, like any undone default.
22
28
  * NEVER A DEFAULT (NEVER below): a Jira ticket's state, a stage move, a message to a person, a pull request, a merge, a delete, spend, and
23
29
  * a refuted outcome's next step. They wait for the PM, however long.
24
30
  * UNDO. An undo line for the batch (lib/proposals.js fold then reads its drops as never written) brings the question back. An undone id is
@@ -56,6 +62,8 @@ const NEVER = [
56
62
  { key: 'signoff', test: (p) => p.group === 'ask', waits: 'It needs an answer from someone outside the team.' },
57
63
  ];
58
64
  const LEAVE_GROUPS = new Set(['dates', 'status', 'names', 'found', 'links']);
65
+ const TAKE_SAY = "PMOS takes the tracker's date";
66
+ const TOOK = (due) => `No answer by ${md(due)}, so PMOS took the tracker's date.`;
59
67
 
60
68
  /** The default of one held change. PURE. */
61
69
  function defaultOf(p) {
@@ -63,6 +71,7 @@ function defaultOf(p) {
63
71
  const never = NEVER.find((n) => { try { return n.test(p); } catch { return false; } });
64
72
  if (never) return { choice: null, waits: never.waits, never: never.key };
65
73
  if (!LEAVE_GROUPS.has(p.group)) return { choice: null, waits: 'PMOS has no safe default for this kind of change.' };
74
+ if (require('./source-guard.js').trackerMoveOf(p) && !(p.items || []).some((x) => isObj(x) && x.jira)) return { choice: 'tracker', say: TAKE_SAY };
66
75
  return { choice: 'leave', say: 'PMOS leaves the plan as it is' };
67
76
  }
68
77
 
@@ -86,6 +95,12 @@ function defaultedOf(lines) {
86
95
  batches.get(l.batch).push(l);
87
96
  }
88
97
  const taken = new Map(), undone = new Set();
98
+ // a tracker's date PMOS took (THE TRACKER'S DATE): one keep line, marked default, naming the held proposal ids
99
+ for (const l of lines || []) {
100
+ if (!isObj(l) || l.kind !== 'keep' || l.default !== true || !str(l.batch) || !Array.isArray(l.held)) continue;
101
+ if (!batches.has(l.batch)) batches.set(l.batch, []);
102
+ for (const id of l.held) batches.get(l.batch).push({ id: String(id), kind: 'keep' });
103
+ }
89
104
  for (const [b, ls] of batches) for (const l of ls) { const id = str(l.id); if (!id) continue; if (undoneB.has(b)) undone.add(id); else taken.set(id, b); }
90
105
  return { taken, undone, batches, undoneBatches: undoneB };
91
106
  }
@@ -97,7 +112,7 @@ function stateOf(h, first, D, today) {
97
112
  const since = first.get(id) || '';
98
113
  const waiting = since && dn(today) != null ? Math.max(0, dn(today) - dn(since)) : 0;
99
114
  if (!d.choice) return { id, d, since, waiting, due: '', open: false };
100
- if (D.undone.has(id)) return { id, d: { choice: null, waits: 'You undid PMOS\'s default, so it waits for you.' }, since, waiting, due: '', open: false };
115
+ if (D.undone.has(id)) return { id, d: { choice: null, waits: 'You undid PMOS\'s default.' }, since, waiting, due: '', open: false };
101
116
  const due = since ? addDays(since, DEFAULT_DAYS) : '';
102
117
  return { id, d, since, waiting, due, open: !D.taken.has(id) };
103
118
  }
@@ -113,7 +128,13 @@ function annotate(questions, held, { dayLines = [], lines = [], today = '', extr
113
128
  const yes = st.filter((s) => s.d.choice && s.due), no = st.filter((s) => !s.d.choice);
114
129
  const due = yes.map((s) => s.due).sort()[0] || '';
115
130
  const part = yes.length && yes.length < st.length ? ` for ${yes.length} of these ${st.length} changes` : '';
116
- const def = yes.length ? { choice: 'leave', due, n: yes.length, say: `If nobody answers by ${md(due)}, PMOS leaves the plan as it is${part}. You can undo it.` } : null;
131
+ const tr = yes.filter((s) => s.d.choice === 'tracker').length, lv = yes.length - tr;
132
+ const sayOf = () => {
133
+ if (!tr) return `If nobody answers by ${md(due)}, PMOS leaves the plan as it is${part}. You can undo it.`;
134
+ if (!lv) return `If nobody answers by ${md(due)}, ${TAKE_SAY}${part}. You can undo it.`;
135
+ return `If nobody answers by ${md(due)}, ${TAKE_SAY} for ${tr} and leaves the plan as it is for ${lv} of these ${st.length} changes. You can undo it.`;
136
+ };
137
+ const def = yes.length ? { choice: tr && lv ? 'mixed' : tr ? 'tracker' : 'leave', due, n: yes.length, say: sayOf() } : null;
117
138
  const reasons = [...new Set(no.map((s) => s.d.waits))];
118
139
  const waits = no.length ? (reasons.join(' ') + ' So ' + (no.length === st.length ? 'it waits' : plural(no.length, 'change waits', 'changes wait')) + ' for you.') : null;
119
140
  const waiting = Math.max(0, ...st.map((s) => s.waiting));
@@ -141,12 +162,14 @@ function dueOf(held, { dayLines = [], lines = [], today = '' } = {}) {
141
162
  return (held || []).filter((h) => {
142
163
  if (!isObj(h) || !isObj(h.prop) || !h.prop.id || !h.ini) return false;
143
164
  const s = stateOf(h, first, D, today);
144
- return s.open && s.d.choice === 'leave' && s.due && s.due <= today;
165
+ return s.open && (s.d.choice === 'leave' || s.d.choice === 'tracker') && s.due && s.due <= today;
145
166
  });
146
167
  }
147
168
 
148
- /** Take the defaults due today: one batch per question (owner and initiative). → { taken: [...], why? } */
149
- function take(dir, held, { dayLines = [], today = '', product = '', pm, now, env = process.env, settingsDir = null } = {}) {
169
+ /** Take the defaults due today: one batch per question (owner and initiative) for `leave`, one per change for `tracker`.
170
+ * apply(h) → { batch } | null writes the tracker's date (lib/routes-proposals.js keepDefault); without it a `tracker` default waits.
171
+ * → { taken: [...], why? } */
172
+ function take(dir, held, { dayLines = [], today = '', product = '', pm, now, env = process.env, settingsDir = null, apply = null, log = console.error } = {}) {
150
173
  const out = { taken: [] };
151
174
  if (!dir || !today) return out;
152
175
  const PR = require('./proposals.js');
@@ -157,7 +180,20 @@ function take(dir, held, { dayLines = [], today = '', product = '', pm, now, env
157
180
  const dec = A.decide({ stateDir: dir, job: JOB, product, cls: 'B', mode: 'auto', undoable: true, now, env, settingsDir });
158
181
  if (!dec.apply) { out.why = dec.why; return out; }
159
182
  const first = firstDays(dayLines);
160
- const groups = require('./question-batch.js').questionsOf(due, { pm });
183
+ const isTr = (h) => defaultOf(h.prop).choice === 'tracker';
184
+ for (const h of due.filter(isTr)) {
185
+ if (typeof apply !== 'function') continue;
186
+ const p = h.prop, dueDay = addDays(first.get(String(p.id)), DEFAULT_DAYS), why = TOOK(dueDay);
187
+ let r = null;
188
+ try { r = apply(h, { why }); } catch { r = null; }
189
+ if (!r || !r.batch) continue; // the change is gone or did not land: it stays on the list
190
+ const it = (p.items || []).find(isObj) || {};
191
+ const title = `Took the tracker's date on ${one(h.title || h.ini, 80)}: ${one(it.title || p.title || 'a task', 60)}${it.to && it.to.due ? ' to ' + md(it.to.due) : ''}, nobody answered by ${md(dueDay)}`;
192
+ A.recordApplied(dir, { job: JOB, product, ref: r.batch, title, cls: 'B', ini: h.ini, why, src: [`Tracker, unanswered question due ${dueDay}`] }, { now, settingsDir });
193
+ try { log(`[tracker-date-wait] took the tracker's date on ${product || '*'} ${h.ini} ${p.id}: nobody answered by ${dueDay}`); } catch { /* a log never stops a default */ }
194
+ out.taken.push({ batch: r.batch, ini: h.ini, board: h.board, ids: [String(p.id)], title, tracker: true });
195
+ }
196
+ const groups = require('./question-batch.js').questionsOf(due.filter((h) => !isTr(h)), { pm });
161
197
  const byId = new Map(due.map((h) => [String(h.prop.id), h]));
162
198
  for (const q of groups) {
163
199
  const batch = PR.newBatch();
@@ -197,4 +233,4 @@ function isDefaultBatch(dir, batch) {
197
233
  return defaultedOf(PR.readLines(PR.ledgerFile(dir))).batches.has(String(batch || ''));
198
234
  }
199
235
 
200
- module.exports = { DEFAULT_DAYS, JOB, BY, WHY, NEVER, defaultOf, firstDays, defaultedOf, annotate, costOf, dueOf, take, undo, isDefaultBatch, addDays };
236
+ module.exports = { DEFAULT_DAYS, JOB, BY, WHY, TOOK, TAKE_SAY, NEVER, defaultOf, firstDays, defaultedOf, annotate, costOf, dueOf, take, undo, isDefaultBatch, addDays };
@@ -16,6 +16,8 @@
16
16
  * in Intelligence › Lab only the ✦ that fit no initiative, in <state>/idle-lab.jsonl (THE ONE WRITER and THE ONE FOLD of that file):
17
17
  * start start an initiative from a scan finding. data { title, board, anchor, stage? } ✓ starts it through the Board (Add an ask, Accept)
18
18
  * scan a finding worth knowing that no initiative holds yet. ✓ keeps it (writes nothing else)
19
+ * rule a correction the PM keeps giving, offered as a standing rule (lib/correction-kinds.js, bet A464). data { kind, n }
20
+ * ✓ writes it to memory as the PM's own confirmed entry; Undo removes that entry (lib/routes-lab.js)
19
21
  *
20
22
  * THE LAB LEDGER, <state>/idle-lab.jsonl, one line per event { at, by, kind, ... }:
21
23
  * propose { id, type: 'start' | 'scan', title, why, sources: [{ label, ref }], data } the last line for an id wins
@@ -46,7 +48,7 @@ const LEDGER = 'idle-lab.jsonl';
46
48
  const KINDS = new Set(['propose', 'drop', 'keep', 'undo', 'run', 'next']);
47
49
  const GROUPS = Object.freeze(['prototyped', 'improved', 'scanned']);
48
50
  const TITLES = Object.freeze({ prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it' });
49
- const LOOSE = Object.freeze(['start', 'scan']);
51
+ const LOOSE = Object.freeze(['start', 'scan', 'rule']);
50
52
  const PROVEN = Object.freeze({ production: false, design: false });
51
53
  const WEEK = 7 * 864e5;
52
54
  const LIM = { title: 140, why: 300, label: 80, ref: 500, caption: 120, file: 200, changed: 200, checked: 200 };
@@ -140,6 +142,11 @@ function loose(type, input) {
140
142
  if (!one(d.title, LIM.title) || !ID_RE.test(str(d.board)) || !one(d.anchor, 80)) return { error: 'start needs data { title, board, anchor }: the new initiative, its board and what it counts toward' };
141
143
  Object.assign(data, { title: one(d.title, LIM.title), board: d.board, anchor: one(d.anchor, 80), ...(str(d.stage) ? { stage: one(d.stage, 40) } : {}) });
142
144
  }
145
+ if (type === 'rule') {
146
+ const K = require('./correction-kinds.js');
147
+ if (!K.IDS.includes(str(d.kind))) return { error: 'rule needs data { kind }: one of ' + K.IDS.join(', ') };
148
+ Object.assign(data, { kind: d.kind, n: Math.max(0, Math.floor(Number(d.n) || 0)) });
149
+ }
143
150
  if (str(d.refreshed)) data.refreshed = one(d.refreshed, LIM.checked);
144
151
  const id = ID_RE.test(str(input.id)) ? input.id : 'lab-' + hash([type, title].join('|'));
145
152
  return { prop: { id, type, title, why, sources: s.v, data } };
@@ -215,16 +222,20 @@ function labOf({ P, L, extra = [], now = Date.now(), titleOf = () => '' } = {})
215
222
  if (!inWeek(p.at)) continue;
216
223
  const state = keptL.has(p.id) ? 'kept' : L.drops.has(p.id) ? 'dropped' : 'open';
217
224
  tally.scan[1]++; if (state === 'kept') tally.scan[0]++;
218
- record.push({ kind: 'loose', id: p.id, at: p.at, state, why: state === 'dropped' ? (L.drops.get(p.id).why || '') : '', title: 'Scan · ' + p.title, meta: plural((p.sources || []).length, 'page', 'pages') + ' read' });
225
+ const rule = p.type === 'rule';
226
+ record.push({ kind: 'loose', id: p.id, at: p.at, state, why: state === 'dropped' ? (L.drops.get(p.id).why || '') : '', title: (rule ? 'Standing rule · ' : 'Scan · ') + p.title,
227
+ meta: rule ? plural((p.data && p.data.n) || (p.sources || []).length, 'correction', 'corrections') : plural((p.sources || []).length, 'page', 'pages') + ' read' });
219
228
  }
220
229
  for (const x of extra || []) if (x && inWeek(x.at) && one(x.title, LIM.title)) record.push({ kind: 'job', job: one(x.job, 40), at: x.at, state: 'done', title: one(x.title, LIM.title), meta: one(x.meta, LIM.why), ...(x.ini ? { ini: x.ini, board: x.board || '' } : {}) });
221
230
  record.sort((a, b) => String(b.at).localeCompare(String(a.at)));
222
231
  const next = L.next && L.next.items.length ? L.next.items : [];
223
232
  if (!record.length && !open.length && !next.length) return null;
224
233
  const filed = tally.proto[1] + tally.scan[1], kept = tally.proto[0] + tally.scan[0];
234
+ const nRule = open.filter((p) => p.type === 'rule').length, nFind = open.length - nRule;
225
235
  const idle = L.runs.filter((r) => inWeek(r.at)).reduce((s, r) => s + r.ms, 0);
226
236
  const say = [idle ? 'This week I used ' + fmtMs(idle) + ' of your idle time.' : '', filed ? 'You kept ' + kept + ' of ' + filed + '.' : '',
227
- open.length ? plural(open.length, 'finding fits', 'findings fit') + ' no initiative yet.' : ''].filter(Boolean).join(' ');
237
+ nFind ? plural(nFind, 'finding fits', 'findings fit') + ' no initiative yet.' : '',
238
+ nRule ? plural(nRule, 'correction repeats', 'corrections repeat') + ': keep ' + (nRule === 1 ? 'it' : 'them') + ' as a standing rule?' : ''].filter(Boolean).join(' ');
228
239
  return { say, loose: open.map((p) => ({ id: p.id, type: p.type, title: p.title, why: p.why, sources: p.sources, data: p.data, at: p.at })),
229
240
  record: record.slice(0, 12), more: Math.max(0, record.length - 12),
230
241
  kept: filed ? { kept, filed, proto: tally.proto, scan: tally.scan } : null, next };
@@ -41,6 +41,13 @@ function partOf(p, hold) {
41
41
  const n = items.length;
42
42
  return `${plural(n, 'task', 'tasks')} passed ${n === 1 ? 'its' : 'their'} date with no news${name ? ' (for example ' + name + ')' : ''}. Re-plan from today, or new dates?`;
43
43
  }
44
+ // tracker-date-moves-wait-for-owner (A449): the tracker moved the date; the owner sees the old and the new date and where it came from
45
+ if (p.group === 'dates' && hold && hold.tracker) {
46
+ const who = kind === 'jira' ? 'Jira' : 'The tracker', from = first.from && first.from.due, to = first.to && first.to.due;
47
+ const span = `${from ? ' from ' + md(from) : ''}${to ? ' to ' + md(to) : ''}`;
48
+ if (items.length > 1) return `${who} moved ${plural(items.length, 'task', 'tasks')} (for example ${name || 'one'}${span}). Take the new dates?`;
49
+ return `${who} moved ${name || 'the work'}${span}. Take the new date?`;
50
+ }
44
51
  if (p.group === 'dates') { const to = first.to && first.to.due; return `Move ${name || 'the work'}${to ? ' to ' + md(to) : ''}?${only}`; }
45
52
  if (p.group === 'status') return `Is ${name || 'it'} done?${only || ' PMOS found no source.'}`;
46
53
  if (p.group === 'names') return `Rename "${one(first.from || first.title || '', 60)}" to "${one(first.to || '', 60)}"?${only || ' PMOS found no source.'}`;
@@ -190,6 +190,14 @@ const WRITES = {
190
190
  if (r.error) return fail(ctx, res, 409, r.error);
191
191
  wrote.push(r.write); said = 'Started ' + p.data.title + '.';
192
192
  }
193
+ if (p.type === 'rule') {
194
+ // a standing rule (lib/correction-kinds.js, bet A464): the PM's own memory entry, so it is confirmed and never goes stale
195
+ const by = humanOf(g.actor);
196
+ if (!by) return fail(ctx, res, 403, 'Only the PM keeps a standing rule');
197
+ const r = ruleWrite(w.root, { op: 'add', text: p.title, by, source: 'rule:' + ((p.data && p.data.kind) || '') });
198
+ if (!r.ok) return fail(ctx, res, 409, 'The rule was not saved: ' + r.error);
199
+ wrote.push({ op: 'memory', text: p.title }); said = 'PMOS will follow this from now on.';
200
+ }
193
201
  const batch = PR.newBatch();
194
202
  LAB.append(dir, g.actor, { kind: 'keep', id: p.id, batch, wrote });
195
203
  ctx.json(res, { ok: true, batch, said });
@@ -209,6 +217,11 @@ const WRITES = {
209
217
  const F = LAB.read(dir), b = String(body.batch || '');
210
218
  const known = F.kept.some((k) => k.batch === b) || readsDrop(dir, b);
211
219
  if (!known || F.undone.has(b)) return fail(ctx, res, 409, 'Nothing to undo');
220
+ // a kept standing rule: take its memory entry out again
221
+ for (const k of F.kept) if (k.batch === b) for (const x of k.wrote) if (x.op === 'memory' && x.text) {
222
+ const r = ruleWrite(w.root, { op: 'remove', old: x.text, by: humanOf(g.actor) || 'agent:corrections' });
223
+ if (!r.ok && !/no (?:entry|match)|not found/i.test(String(r.error))) return fail(ctx, res, 409, 'The rule was not removed: ' + r.error);
224
+ }
212
225
  LAB.append(dir, g.actor, { kind: 'undo', batch: b });
213
226
  ctx.json(res, { ok: true });
214
227
  return true;
@@ -253,6 +266,14 @@ const WRITES = {
253
266
  },
254
267
  };
255
268
  const COMMENTS = 'lab-comments.jsonl';
269
+ /* The PM's press as the memory ledger names a person ('pm:<slug>' → 'human:<slug>', lib/pm-slug.js), or null. */
270
+ const humanOf = (actor) => { const by = String((actor && actor.by) || ''); return /^pm:[A-Za-z0-9_-]{1,40}$/.test(by) ? 'human:' + by.slice(3) : /^human:/.test(by) ? by : null; };
271
+ /* One memory write for a standing rule (D72 ledger through lib/memory.js). */
272
+ function ruleWrite(root, req) {
273
+ const c = require('./memory.js').core();
274
+ if (!c.ok) return { ok: false, error: c.error };
275
+ try { return c.core.write(root, { target: 'memory', ...req }); } catch (e) { return { ok: false, error: String((e && e.message) || e).slice(0, 160) }; }
276
+ }
256
277
  /* ── delete a prototype version (batch 31 item 9, Wawan 2026-11-18: "should be able to delete the prototype") ──
257
278
  * Asked in the chat ("delete version 1"), the chat's agent runs `pmos lab delete`; in the Viewer, the trash in the version bar. No
258
279
  * confirm: Undo is the safety (the delete-task rule). The version's folder (<round>/<key>/: the prototype, its flow, lanes, copy, tweaks and
@@ -141,6 +141,9 @@ function undoCore(ctx, p, g, id) {
141
141
  // D106: the Undo of a change an agent applied by itself is a setback of its job (lib/autonomy.js), which may demote the job
142
142
  const line = PR.readLines(PR.ledgerFile(dir)).find((l) => l.kind === 'keep' && l.batch === id);
143
143
  let demoted = null;
144
+ // tracker-date-moves-wait-for-owner: the tracker's date PMOS took when nobody answered is a default; its Undo is a setback of
145
+ // propose:default (lib/default-decisions.js), and the question comes back with no default
146
+ if (line && line.default === true && Array.isArray(line.held)) demoted = require('./autonomy.js').recordSetback(dir, { job: require('./default-decisions.js').JOB, product: p.w.id, ref: id, kind: 'undo' }).demoted;
144
147
  if (line && line.auto === true && line.group) {
145
148
  const A = require('./autonomy.js');
146
149
  demoted = A.recordSetback(dir, { job: `propose:${line.group}`, product: p.w.id, ref: id, kind: 'undo' }).demoted;
@@ -172,6 +175,7 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
172
175
  for (const x of v.groups.flatMap((gr) => gr.props)) {
173
176
  const cls = A.classOfProposal(x);
174
177
  const src = SGc.citedOf(x); // no source, no auto (A443), in every group
178
+ if (SGc.trackerMoveOf(x)) logTrackerWait(w.id, ini, x);
175
179
  const d = A.decide({ stateDir: dir, job: `propose:${x.group}`, product: w.id, cls, mode: modeOf(board.id), undoable: true, now, settingsDir: ctx.runtimeDir || null, sources: src });
176
180
  if (!d.apply && !src.length) A.logHeld(`propose:${x.group}`, w.id, x.id);
177
181
  if (!d.apply) { out.held++; continue; }
@@ -187,6 +191,34 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
187
191
  return out;
188
192
  }
189
193
 
194
+ /** tracker-date-moves-wait-for-owner: one [tracker-date-wait] line per held tracker move per process (its health log). */
195
+ const trackerLogged = new Set();
196
+ function logTrackerWait(product, ini, x, log = console.error) {
197
+ const k = product + '|' + x.id + '|' + x.sig;
198
+ if (trackerLogged.has(k)) return;
199
+ if (trackerLogged.size > 5000) trackerLogged.clear();
200
+ trackerLogged.add(k);
201
+ const owner = ((x.items || []).find((y) => y && y.owner) || {}).owner || (x.ask && x.ask.owner) || 'the PM';
202
+ try { log(`[tracker-date-wait] held ${product} ${ini} ${x.id}: asks ${String(owner).slice(0, 60)} before the tracker's date applies`); } catch { /* a log never stops the apply step */ }
203
+ }
204
+
205
+ /** tracker-date-moves-wait-for-owner: take the tracker's date for one held change nobody answered by its deadline (lib/default-decisions.js
206
+ * take). It is the same write as a ✓ (keepCore, the board's own writer), on one keep line marked `default: true` with the held id, so
207
+ * Undo puts the old date back and the question returns with no default. → { batch, wrote } | null (the change is gone or did not land). */
208
+ function keepDefault(ctx, w, h, { why = '' } = {}) {
209
+ if (!dirOf(ctx, w) || !h || !h.prop) return null;
210
+ const fr = RB.frameFor(ctx, w), board = (fr.boards || []).find((b) => b.id === h.board);
211
+ if (!board) return null;
212
+ const p = { w, fr, board, file: null };
213
+ const f = TLR.frame(ctx, w, board, { derive: true });
214
+ if (!f) return null;
215
+ const v = view(ctx, p, h.ini, f, { grillAll: true });
216
+ const x = v && v.groups.flatMap((gr) => gr.props).find((y) => y.id === h.prop.id && y.sig === h.prop.sig);
217
+ if (!x || !require('./source-guard.js').trackerMoveOf(x)) return null;
218
+ const r = keepCore(ctx, p, { ok: true, actor: { by: 'agent:auto' } }, f, h.ini, [x], {}, { default: true, held: [String(x.id)], group: x.group, ...(why ? { why } : {}) });
219
+ return r.keptIds.length ? { batch: r.batch, wrote: r.wrote.length } : null;
220
+ }
221
+
190
222
  /** act-alone-only-with-a-source: the open proposals of a workspace that PMOS holds for want of a source (lib/source-guard.js), on every
191
223
  * board, for the day's question list (lib/question-batch.js). → [{ ini, title, board, prop, hold }] */
192
224
  function heldOf(ctx, w) {
@@ -554,7 +586,7 @@ const WRITES = {
554
586
 
555
587
  module.exports = {
556
588
  prefixes: ['/api/proposals'],
557
- viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep, heldOf,
589
+ viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep, heldOf, keepDefault,
558
590
  handle: async (req, res, url, ctx) => {
559
591
  const p0 = url.pathname;
560
592
  if (req.method === 'GET') {
@@ -84,7 +84,9 @@ function questions(ctx, w, today, { take = true } = {}) {
84
84
  // Undo); the question then leaves the list. Every question left says its default or why it waits, and what the wait costs (A27).
85
85
  let taken = [];
86
86
  if (take) {
87
- try { taken = DD.take(dir, held, { dayLines: QB.readDays(dir), today, product: w.id, settingsDir: ctx.runtimeDir || null }).taken; } catch { taken = []; }
87
+ // tracker-date-moves-wait-for-owner: a tracker's date nobody answered is taken through the board's own writer, with Undo
88
+ const apply = (h, o) => require('./routes-proposals.js').keepDefault(ctx, w, h, o);
89
+ try { taken = DD.take(dir, held, { dayLines: QB.readDays(dir), today, product: w.id, settingsDir: ctx.runtimeDir || null, apply }).taken; } catch { taken = []; }
88
90
  if (taken.length) { const gone = new Set(taken.flatMap((t) => t.ids)); held = held.filter((h) => !gone.has(String(h.prop.id))); Q = QB.today(dir, held, { day: today, extra }); }
89
91
  }
90
92
  const PR = require('./proposals.js');
@@ -9,13 +9,18 @@
9
9
  * citedOf(x) → [label] what ANY agent change cites (one-change-record-no-source-no-auto): its sources, its items'
10
10
  * sources, its claims' sources, a link's PRD or Jira source, a build's work item. [] = no source
11
11
  * noReason(why) → bool a reason that says it has none ("No reason found") or is empty
12
+ * trackerMoveOf(p) → bool a date move of BIG_DAYS days or less that only the tracker says (rule 3 below)
12
13
  *
13
14
  * THE RULE. It applies to the plan changes on a product: the groups in PLAN (dates, status, names, found, links).
14
15
  * 1. No source, or a date proposal that found no reason (`noReason`): held.
15
16
  * 2. A close (status done), a rename (names), or a date moved more than BIG_DAYS days needs two different kinds of source. Anyone who can
16
17
  * post in a channel PMOS reads can write one line of text (A58), so one kind is not enough for a change that is hard to see afterwards.
17
18
  * Two Slack lines are one kind. With one kind: held.
18
- * 3. Anything else keeps its class. A tidy name (group names) that cites only the plan itself ('the tasks') is PMOS's name standard
19
+ * 3. A date move of BIG_DAYS days or less whose only kind of source is the tracker (Jira, or another tracker by name) waits for the
20
+ * owner the plan names on the work (initiative tracker-date-moves-wait-for-owner, idea A449: 23 of 35 such moves after an import
21
+ * were applied with nobody told). It joins the day's question list with the old and the new date, and when nobody answers by the
22
+ * deadline PMOS takes the tracker's date (lib/default-decisions.js, choice 'tracker'), with Undo.
23
+ * 4. Anything else keeps its class. A tidy name (group names) that cites only the plan itself ('the tasks') is PMOS's name standard
19
24
  * applied to the task's own words, not a rename from outside text: it keeps its class.
20
25
  * A held proposal is class C (lib/autonomy.js classOfProposal): the self-apply step (lib/routes-proposals.js autoKeep) leaves it for the
21
26
  * owner, and it joins the day's question list (lib/question-batch.js). Other groups (description, outcome, build, the idle lab) carry their
@@ -26,6 +31,7 @@ const BIG_DAYS = 30;
26
31
  const KINDS = [
27
32
  ['plan', /^\s*(the|this|its)\s+(tasks?|plan|board|initiative|stage)\b/i],
28
33
  ['jira', /\bjira\b|\b[A-Z][A-Z0-9]+-\d+\b/],
34
+ ['tracker', /\blinear\b|\basana\b|\bclickup\b|\btrello\b|\byoutrack\b|\bazure boards\b|\bshortcut story\b|\btracker\b/i],
29
35
  ['slack', /\bslack\b/i],
30
36
  ['mail', /\bg?mail\b|\be-?mail\b|\binbox\b/i],
31
37
  ['meeting', /\bmeeting|\bcalendar\b|\bnotes?\b|\bminutes\b|\btranscript|\bwispr\b/i],
@@ -33,7 +39,7 @@ const KINDS = [
33
39
  ['repo', /\brepo(sitory)?\b|\bgithub\b|\bcommit\b|\bpull request\b|\bPR #?\d+|\.(md|js|ts|json|jsonl|py)(:\d+)?\b/i],
34
40
  ['chat', /\bchat\b|\bteams\b/i],
35
41
  ];
36
- const KIND_NAMES = { plan: 'the plan itself', jira: 'Jira', slack: 'Slack', mail: 'mail', meeting: 'a meeting note', docs: 'a document', repo: 'the repository', chat: 'chat', other: 'one source' };
42
+ const KIND_NAMES = { plan: 'the plan itself', jira: 'Jira', tracker: 'the tracker', slack: 'Slack', mail: 'mail', meeting: 'a meeting note', docs: 'a document', repo: 'the repository', chat: 'chat', other: 'one source' };
37
43
  const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
38
44
  const dn = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
39
45
 
@@ -67,6 +73,14 @@ function bigOf(p) {
67
73
  if (p.group === 'dates' && (p.items || []).some((x) => isObj(x) && Math.abs(shiftOf(x) || 0) > BIG_DAYS)) return 'date';
68
74
  return '';
69
75
  }
76
+ const TRACKER_KINDS = new Set(['jira', 'tracker']);
77
+ /** A date move of BIG_DAYS days or less that only the tracker says: the owner confirms it, or PMOS takes it after the deadline. PURE. */
78
+ function trackerMoveOf(p) {
79
+ if (!isObj(p) || p.group !== 'dates' || p.noReason === true || bigOf(p)) return false;
80
+ const kinds = kindsOf(p);
81
+ return kinds.length === 1 && TRACKER_KINDS.has(kinds[0]);
82
+ }
83
+ const TRACKER_WHY = (k) => `${k === 'jira' ? 'Jira' : 'The tracker'} moved this date. PMOS asks the owner first, and takes the tracker's date if nobody answers by the deadline.`;
70
84
  const BIG_WORDS = { close: 'closes work', rename: 'renames work', date: 'moves a date by more than ' + BIG_DAYS + ' days' };
71
85
 
72
86
  /** null when PMOS may apply the proposal by itself under its class; else { why, kinds }. PURE. */
@@ -76,6 +90,7 @@ function holdOf(p) {
76
90
  if (p.noReason === true || !kinds.length) return { why: 'It cites no source, so PMOS asks instead of changing the plan.', kinds };
77
91
  const big = bigOf(p);
78
92
  if (big && kinds.length < 2) return { why: `It ${BIG_WORDS[big]} on one kind of source (${KIND_NAMES[kinds[0]] || kinds[0]}). PMOS needs two kinds, or the owner's answer.`, kinds };
93
+ if (trackerMoveOf(p)) return { why: TRACKER_WHY(kinds[0]), kinds, tracker: true };
79
94
  return null;
80
95
  }
81
96
 
@@ -101,4 +116,4 @@ function citedOf(x) {
101
116
  return [...new Set(out)];
102
117
  }
103
118
 
104
- module.exports = { citedOf, noReason, LINK_SOURCES, holdOf, kindsOf, kindOf, bigOf, shiftOf, PLAN, BIG_DAYS, KIND_NAMES };
119
+ module.exports = { citedOf, noReason, LINK_SOURCES, holdOf, trackerMoveOf, TRACKER_KINDS, kindsOf, kindOf, bigOf, shiftOf, PLAN, BIG_DAYS, KIND_NAMES };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.705.0",
3
+ "version": "0.707.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.705.0",
9
+ "version": "0.707.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.705.0",
3
+ "version": "0.707.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",
@@ -132,7 +132,8 @@
132
132
  "project-onboard.test.js",
133
133
  "loop-telemetry.test.js",
134
134
  "signals.test.js",
135
- "task-jira-sync.test.js"
135
+ "task-jira-sync.test.js",
136
+ "correction-kinds.test.js"
136
137
  ],
137
138
  "panels": [
138
139
  "pm-r7-test.js",
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Date changes from the tracker wait for the owner (initiative tracker-date-moves-wait-for-owner, done test C1-C7): a date move of 30 days or less that only the tracker says is held, asks the task's owner with the old and new date, and defaults to the tracker's date with Undo. Pure checks plus one scratch server. No connector, model or network.",
3
+ "modules": [
4
+ "tracker-date-wait.test.js"
5
+ ],
6
+ "seconds": {
7
+ "tracker-date-wait.test.js": 15
8
+ }
9
+ }