create-pmos 0.536.0 → 0.538.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 +81 -33
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/board-columns-test.js +11 -10
- package/workspace/board-programs-test.js +27 -24
- package/workspace/board-publish-ui-test.js +19 -15
- package/workspace/board-shared-ui-test.js +16 -13
- package/workspace/board-workflows-test.js +26 -32
- package/workspace/briefing-premium-board-test.js +70 -50
- package/workspace/briefing-premium-insights-test.js +24 -31
- package/workspace/briefing-premium-metrics-test.js +2 -2
- package/workspace/calm-timeline-test.js +1 -1
- package/workspace/changelog.json +80 -0
- package/workspace/ev-everywhere-test.js +4 -5
- package/workspace/fixtures/board-premium-facts.js +1 -1
- package/workspace/fixtures/board-workflows-facts.js +7 -1
- package/workspace/fixtures/initiative-premium-facts.js +1 -1
- package/workspace/fixtures/insights-premium-facts.js +6 -6
- package/workspace/fixtures/program-ascent.js +1 -1
- package/workspace/guide/adler.md +2 -2
- package/workspace/guide/agent-capabilities.md +38 -6
- package/workspace/guide/board.md +20 -2
- package/workspace/guide/claude-proposes.md +1 -1
- package/workspace/guide/home.md +2 -2
- package/workspace/guide/index.md +3 -3
- package/workspace/guide/intelligence-okr-goals.md +18 -7
- package/workspace/guide/lifecycle.md +2 -2
- package/workspace/guide/programs.md +2 -2
- package/workspace/guide/reports-needs-you.md +5 -5
- package/workspace/guide/settings.md +14 -11
- package/workspace/guide/workflows.md +3 -3
- package/workspace/guide/your-impact.md +1 -1
- package/workspace/lib/agent-team.js +262 -0
- package/workspace/lib/ai-cli.js +36 -4
- package/workspace/lib/bg-queue.js +9 -4
- package/workspace/lib/board-premium.js +6 -3
- package/workspace/lib/goal-source.js +77 -0
- package/workspace/lib/grill-runs.js +6 -3
- package/workspace/lib/headless.js +36 -4
- package/workspace/lib/idle-lab-engine.js +7 -6
- package/workspace/lib/initiative-premium.js +6 -3
- package/workspace/lib/insights-premium.js +1 -1
- package/workspace/lib/job-graph.js +191 -0
- package/workspace/lib/okr-goals.js +3 -0
- package/workspace/lib/orchestrator-keeprate.js +108 -7
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/proposal-runs.js +8 -5
- package/workspace/lib/proposals.js +32 -2
- package/workspace/lib/report-slots.js +14 -10
- package/workspace/lib/routes-boards.js +2 -2
- package/workspace/lib/routes-insights-premium.js +11 -4
- package/workspace/lib/routes-premium-dashboards.js +20 -6
- package/workspace/lib/routes-proposals.js +10 -5
- package/workspace/lib/routes-your-move.js +6 -7
- package/workspace/lib/status-proof.js +45 -0
- package/workspace/lib/status-signal.js +4 -2
- package/workspace/lib/task-links.js +3 -1
- package/workspace/lib/team-cli.js +164 -0
- package/workspace/lib/team-runs.js +244 -0
- package/workspace/lib/verify-runs.js +112 -0
- package/workspace/okr-goals-ui-test.js +10 -13
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-backlog-test.js +2 -2
- package/workspace/premium-vw-jira-test.js +2 -2
- package/workspace/public/pm/bd-acts.js +30 -45
- package/workspace/public/pm/bd-ini-panel.js +38 -27
- package/workspace/public/pm/bd-publish.js +1 -1
- package/workspace/public/pm/bd-span.js +2 -1
- package/workspace/public/pm/bd-views.js +7 -5
- package/workspace/public/pm/bd-wf.js +5 -28
- package/workspace/public/pm/c3-ini-ui.js +9 -7
- package/workspace/public/pm/cozy-board.css +75 -31
- package/workspace/public/pm/cozy-insights.css +18 -0
- package/workspace/public/pm/cozy-nav.js +2 -2
- package/workspace/public/pm/cozy-search.js +29 -7
- package/workspace/public/pm/cozy-settings.js +39 -20
- package/workspace/public/pm/home-data.js +3 -1
- package/workspace/public/pm/home-ini-model.js +15 -1
- package/workspace/public/pm/home-ini.js +9 -3
- package/workspace/public/pm/ini-tail.js +61 -0
- package/workspace/public/pm/ini-view-model.js +10 -7
- package/workspace/public/pm/premium-board.js +119 -119
- package/workspace/public/pm/premium-insights.js +95 -112
- package/workspace/public/pm/premium-report-intel.js +3 -2
- package/workspace/public/pm/readonly.js +4 -3
- package/workspace/public/pm/stage-chip.js +2 -1
- package/workspace/public/pm/status-proof.js +43 -0
- package/workspace/public/premium-board.html +14 -35
- package/workspace/public/premium-intelligence.html +7 -9
- package/workspace/server.js +35 -1
- package/workspace/sort-order-test.js +10 -8
- package/workspace/test-files.json +4 -2
- package/workspace/test-lists/agent-team.json +9 -0
- package/workspace/test-lists/job-graph.json +11 -0
- package/workspace/test-lists/status-proof.json +5 -0
- package/workspace/workflows-setup-test.js +3 -2
- package/workspace/public/premium-chat.html +0 -14
- package/workspace/public/premium-initiative.html +0 -15
- package/workspace/public/premium-work.html +0 -14
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (initiative workspace-headless-jobs; PM decision 2026-10-11: keep Jev, no direct Claude API, background
|
|
4
4
|
* jobs that need no human run headless).
|
|
5
5
|
*
|
|
6
|
-
* kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | 'propose' | 'metric-draft' | 'grill' | 'impact' | 'metric-read' | 'lab-proto' | 'lab-scan' | null (null: open a pane, as before)
|
|
6
|
+
* kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | 'propose' | 'metric-draft' | 'grill' | 'impact' | 'verify' | 'metric-read' | 'lab-proto' | 'lab-scan' | 'team' | null (null: open a pane, as before)
|
|
7
7
|
* argsFor(kind, { modelArgs, addDirs, writePaths }) → the argv after `claude` (writePaths: the one render file a report-design job may write;
|
|
8
8
|
* for the skill kind, the folders the run may write in, from skillWriteDirs)
|
|
9
9
|
* skillWriteDirs(skill, { root, scratch }) → the absolute folders a background skill run may write in: its scratch folder and the state folders its skill writes
|
|
@@ -121,6 +121,9 @@ const METRIC_DRAFT_ORIGINS = Object.freeze(['metric-draft:']);
|
|
|
121
121
|
const GRILL_ORIGINS = Object.freeze(['grill:']);
|
|
122
122
|
// batch 16 item 7: Claude's daily impact read (origin `impact:<run>`, lib/impact-runs.js). Its only write is `pmos impact add`, pinned to that run.
|
|
123
123
|
const IMPACT_ORIGINS = Object.freeze(['impact:']);
|
|
124
|
+
// loop-telemetry: the verifier after merge (origin `verify:<run_id>:<token>`, lib/verify-runs.js). A fresh evaluator grades one merged run;
|
|
125
|
+
// its only write is `node scripts/verifier.js record`, pinned by PMOS_VERIFY_RUN to that run (D65(i): never the builder's own session).
|
|
126
|
+
const VERIFY_ORIGINS = Object.freeze(['verify:']);
|
|
124
127
|
// batch 16 item 6: Claude reads the goals with their recipes (origin `metric-read:<ws>:<run>`, lib/metric-read-runs.js). Its only write is
|
|
125
128
|
// `pmos metrics reading`, pinned by the server to that run and those goals.
|
|
126
129
|
const METRIC_READ_ORIGINS = Object.freeze(['metric-read:']);
|
|
@@ -138,6 +141,10 @@ const WRITE_PATH_KINDS = Object.freeze(['report-design', 'report-sample-fetch',
|
|
|
138
141
|
// in its own folder; a scan run (origin `idle-lab-scan:<ws>:<ini|->:<run>`) searches the web and reads pages only through `pmos lab page`, with no
|
|
139
142
|
// repository. Neither sends anything; each files only with `pmos lab file`.
|
|
140
143
|
const LAB_PROTO_ORIGINS = Object.freeze(['idle-lab-proto:']);
|
|
144
|
+
// The role agents (lib/team-runs.js, brief agent-team): one role's run (origin `team:<ws>:<role>:<ini|->:<run>`). Its tools are the role's
|
|
145
|
+
// (lib/agent-team.js toolsOf): read and search, the `pmos team` verbs, and in auto mode Write and Edit on the role's own artifacts only and the
|
|
146
|
+
// role's own `pmos` verbs. No web, nothing that sends.
|
|
147
|
+
const TEAM_ORIGINS = Object.freeze(['team:']);
|
|
141
148
|
const LAB_SCAN_ORIGINS = Object.freeze(['idle-lab-scan:']);
|
|
142
149
|
const WRITE_DIR_KINDS = Object.freeze(['skill', 'lab-proto']); // kinds whose writable folders the caller names (argsFor writePaths, each folder and what is under it)
|
|
143
150
|
// A background skill run reads untrusted text (Jira, mail, calendar), so it may write only in its own scratch folder and in the state folders its skill writes
|
|
@@ -197,6 +204,10 @@ const TOOLS = Object.freeze({
|
|
|
197
204
|
// nothing that sends, posts or reacts.
|
|
198
205
|
impact: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos impact *)', 'Bash(pmos source show *)', 'Bash(pmos source status *)', 'Bash(pmos initiative list *)',
|
|
199
206
|
'Bash(pmos initiative export *)', 'Bash(git log *)', 'Bash(date *)']),
|
|
207
|
+
// The verifier run (lib/verify-runs.js): read and search the repository and its history, and the one command that records the verdict for
|
|
208
|
+
// the run it was started for. No Write, no Edit, no web, no connector, nothing that sends; `git` only to read.
|
|
209
|
+
verify: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(git show *)', 'Bash(git log *)', 'Bash(git diff *)', 'Bash(node scripts/verifier.js record *)',
|
|
210
|
+
'Bash(node scripts/workflow-state.js *)', 'Bash(date *)']),
|
|
200
211
|
// The reading run (lib/metric-read-runs.js): read and search, and the one verb that files a reading. The PM's analytics and Jira are read through
|
|
201
212
|
// the PM's own connectors only where the PM's settings allow it. No Write, no Edit, no web fetch, nothing that sends.
|
|
202
213
|
'metric-read': Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos metrics reading *)', 'Bash(pmos source show *)', 'Bash(pmos source status *)', 'Bash(date *)']),
|
|
@@ -206,6 +217,9 @@ const TOOLS = Object.freeze({
|
|
|
206
217
|
'Bash(pmos task list *)', 'Bash(git log *)', 'Bash(date *)']),
|
|
207
218
|
// The idle lab scan run: WebSearch, and pages only through `pmos lab page` (PMOS fetches public pages and keeps the text the claims quote).
|
|
208
219
|
// No Read, Glob or Grep, no directory, no WebFetch, nothing that sends.
|
|
220
|
+
// A role run in propose mode; argsFor replaces the list with the role's own (agent-team.js toolsOf) when it knows the role.
|
|
221
|
+
team: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos team done *)', 'Bash(pmos team status *)', 'Bash(pmos initiative export *)', 'Bash(pmos initiative list *)',
|
|
222
|
+
'Bash(pmos task list *)', 'Bash(git log *)', 'Bash(date *)']),
|
|
209
223
|
'lab-scan': Object.freeze(['WebSearch', 'Bash(pmos lab page *)', 'Bash(pmos lab file *)', 'Bash(pmos lab status)']),
|
|
210
224
|
// The design run: read and search only. Its one write, the render file, is added per run by argsFor (writePaths). No Bash, no web, nothing that sends.
|
|
211
225
|
'report-design': Object.freeze(['Read', 'Glob', 'Grep']),
|
|
@@ -335,8 +349,10 @@ function kindFor({ agent, origin, skill, env } = {}) {
|
|
|
335
349
|
if (METRIC_DRAFT_ORIGINS.some((p) => o.startsWith(p))) return 'metric-draft';
|
|
336
350
|
if (GRILL_ORIGINS.some((p) => o.startsWith(p))) return 'grill';
|
|
337
351
|
if (IMPACT_ORIGINS.some((p) => o.startsWith(p))) return 'impact';
|
|
352
|
+
if (VERIFY_ORIGINS.some((p) => o.startsWith(p))) return 'verify';
|
|
338
353
|
if (METRIC_READ_ORIGINS.some((p) => o.startsWith(p))) return 'metric-read';
|
|
339
354
|
if (LAB_PROTO_ORIGINS.some((p) => o.startsWith(p))) return 'lab-proto';
|
|
355
|
+
if (TEAM_ORIGINS.some((p) => o.startsWith(p))) return 'team';
|
|
340
356
|
if (LAB_SCAN_ORIGINS.some((p) => o.startsWith(p))) return 'lab-scan';
|
|
341
357
|
if (REPORT_DESIGN_ORIGINS.some((p) => o.startsWith(p))) return 'report-design';
|
|
342
358
|
if (REPORT_SAMPLE_FETCH_ORIGINS.some((p) => o.startsWith(p))) return 'report-sample-fetch';
|
|
@@ -348,9 +364,24 @@ function kindFor({ agent, origin, skill, env } = {}) {
|
|
|
348
364
|
return null;
|
|
349
365
|
}
|
|
350
366
|
|
|
351
|
-
function argsFor(kind, { modelArgs = [], addDirs = [], writePaths = [], budgetUsd = null, connectorTools = [] } = {}) {
|
|
367
|
+
function argsFor(kind, { modelArgs = [], addDirs = [], writePaths = [], budgetUsd = null, connectorTools = [], team = null } = {}) {
|
|
352
368
|
if (!TOOLS[kind]) throw new Error('unknown headless kind: ' + kind);
|
|
353
|
-
|
|
369
|
+
let tools = TOOLS[kind].slice();
|
|
370
|
+
// A role run: the role's own tools. Its writable paths (auto mode only) are each a folder ("/" at the end: it and what is under it) or one file.
|
|
371
|
+
if (kind === 'team' && team && team.role) {
|
|
372
|
+
const AT = require('./agent-team.js');
|
|
373
|
+
if (AT.roleOf(team.role)) {
|
|
374
|
+
const mode = team.mode === 'auto' ? 'auto' : 'propose';
|
|
375
|
+
tools = AT.toolsOf(team.role, { mode }).tools;
|
|
376
|
+
if (mode === 'auto') for (const p of Array.isArray(writePaths) ? writePaths : []) {
|
|
377
|
+
const s = String(p || ''), dir = s.endsWith('/'), b = s.replace(/\/+$/, '');
|
|
378
|
+
if (!b.startsWith('/') || /[\s,*?()\[\]{}]/.test(b) || b.includes('..')) continue;
|
|
379
|
+
// only a path that IS one of the role's own artifacts, whatever the caller passes
|
|
380
|
+
if (!AT.roleOf(team.role).owns.paths.some((o) => (o.endsWith('/') === dir) && (b + (dir ? '/' : '')).endsWith('/' + o))) continue;
|
|
381
|
+
tools.push(dir ? `Write(/${b}/**)` : `Write(/${b})`, dir ? `Edit(/${b}/**)` : `Edit(/${b})`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
354
385
|
// A kind that reads the PM's sources gets the read-shaped connector tools the server names; any other kind gets none, whatever is passed.
|
|
355
386
|
if (CONNECTOR_READ_KINDS.includes(kind)) for (const t of connectorReads(connectorTools)) tools.push(t);
|
|
356
387
|
// A report-design run may write its render file (a report-sample-fetch run, its text copy) and nothing else: one absolute path, no wildcard, no comma.
|
|
@@ -519,7 +550,8 @@ const RUN_ENV = Object.freeze(['PMOS_SCAN_FILE', 'PMOS_SCAN_ORIGIN', 'PMOS_SCAN_
|
|
|
519
550
|
'PMOS_METRIC_READ_FILE', 'PMOS_METRIC_READ_RECORDS', 'PMOS_METRIC_READ_DRAFTS', 'PMOS_METRIC_READ_WS', 'PMOS_METRIC_READ_RUN', 'PMOS_METRIC_READ_RIDS', 'PMOS_METRIC_READ_TEST',
|
|
520
551
|
'PMOS_PROPOSE_FILE', 'PMOS_PROPOSE_WS', 'PMOS_PROPOSE_BOARD', 'PMOS_PROPOSE_INI', 'PMOS_PROPOSE_RUN',
|
|
521
552
|
'PMOS_GRILL_FILE', 'PMOS_GRILL_LOG', 'PMOS_GRILL_WS', 'PMOS_GRILL_BOARD', 'PMOS_GRILL_INI', 'PMOS_GRILL_RUN', 'PMOS_GRILL_BUDGET',
|
|
522
|
-
'PMOS_IMPACT_FILE', 'PMOS_IMPACT_RUN', 'PMOS_MS_REVIEW_FILE', 'PMOS_MS_REVIEW_RUN', 'PMOS_MS_REVIEW_PROGRAM',
|
|
553
|
+
'PMOS_IMPACT_FILE', 'PMOS_IMPACT_RUN', 'PMOS_VERIFY_RUN', 'PMOS_MS_REVIEW_FILE', 'PMOS_MS_REVIEW_RUN', 'PMOS_MS_REVIEW_PROGRAM',
|
|
554
|
+
'PMOS_TEAM_FILE', 'PMOS_TEAM_ROOT', 'PMOS_TEAM_WS', 'PMOS_TEAM_ROLE', 'PMOS_TEAM_RUN', 'PMOS_TEAM_INI', 'PMOS_TEAM_MODE',
|
|
523
555
|
'PMOS_LAB_RUN', 'PMOS_LAB_KIND', 'PMOS_LAB_PENDING', 'PMOS_LAB_INI', 'PMOS_LAB_BUDGET', 'PMOS_LAB_PAGES', 'PMOS_LAB_SPECIMENS']);
|
|
524
556
|
function runEnvOf(extra) {
|
|
525
557
|
const out = {};
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* <state>/idle-lab.jsonl a result that fits no initiative (loose scan), the `run` line of each idle stretch, the `next` line
|
|
40
40
|
*
|
|
41
41
|
* JOB · VERSION · MAX_RESULTS · candidates(input) PURE · nextOf(cands) PURE · promptOf(skill, c, o) PURE
|
|
42
|
-
* readRuns(rt) · appendRun(rt, line) · spentIn(rt, month) · pagesDir(rt, run) · pendingFile(rt, run) · runSpecimenDir(rt, run)
|
|
42
|
+
* readRuns(rt) · appendRun(rt, line, now?) · spentIn(rt, month) · pagesDir(rt, run) · pendingFile(rt, run) · runSpecimenDir(rt, run)
|
|
43
43
|
* pageRef(run, n, line) · guardProposal(entry, { run }) PURE · renderCheck(abs) · ensureReplay(rt)
|
|
44
44
|
* create(deps) → { tick(turn), finish(run, r), active(), status() }
|
|
45
45
|
*/
|
|
@@ -77,10 +77,11 @@ const runSpecimenDir = (rt, run) => path.join(LAB.specimenDir(rt), run);
|
|
|
77
77
|
/** The guard ref of line `line` of page `n` this run read (resolved against the runtime folder). */
|
|
78
78
|
const pageRef = (run, n, line) => `state:idle-lab/pages/${run}/${n}.txt:${line}`;
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
/** now: the engine's clock (the tick's), so a start's time and the 7-day retry read the same clock. */
|
|
81
|
+
function appendRun(rt, line, now = Date.now()) {
|
|
81
82
|
const f = runsFile(rt); if (!f) return null;
|
|
82
83
|
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
83
|
-
const l = { at: new Date().toISOString(), ...line };
|
|
84
|
+
const l = { at: new Date(now).toISOString(), ...line };
|
|
84
85
|
fs.appendFileSync(f, JSON.stringify(l) + '\n');
|
|
85
86
|
return l;
|
|
86
87
|
}
|
|
@@ -394,11 +395,11 @@ function create(deps) {
|
|
|
394
395
|
initialInput: prompt + '\r', initiative: c.ini || undefined, env, writePaths: proto ? [spec] : [], addDirs: proto ? [LAB.specimenDir(r)] : [], onDone: (res) => { finish(run, res).catch((e) => warn('idle lab finish', e)); } });
|
|
395
396
|
} catch (e) { warn('idle lab run', e); }
|
|
396
397
|
if (session && session.held) { active = null; return { ok: false, held: true }; }
|
|
397
|
-
appendRun(r, { kind: 'start', run, job: c.kind, ws: c.ws, ini: c.ini || '', key: c.key, budget });
|
|
398
|
+
appendRun(r, { kind: 'start', run, job: c.kind, ws: c.ws, ini: c.ini || '', key: c.key, budget }, now);
|
|
398
399
|
const kind = proto ? 'lab-proto' : 'lab-scan';
|
|
399
400
|
if (!session || session.state === 'exited' || session.headless !== kind) {
|
|
400
401
|
if (session && session.state !== 'exited' && deps.stop) try { deps.stop(session); } catch { /* best effort */ }
|
|
401
|
-
appendRun(r, { kind: 'end', run, ok: false, cost: 0, ms: 0, filed: 0, dropped: [(session && session.note) || 'the run could not start in the background'] });
|
|
402
|
+
appendRun(r, { kind: 'end', run, ok: false, cost: 0, ms: 0, filed: 0, dropped: [(session && session.note) || 'the run could not start in the background'] }, now);
|
|
402
403
|
active = null;
|
|
403
404
|
return { ok: false };
|
|
404
405
|
}
|
|
@@ -440,7 +441,7 @@ function create(deps) {
|
|
|
440
441
|
if (g.off) dropped.push(g.off);
|
|
441
442
|
}
|
|
442
443
|
} catch (e) { dropped.push('filing failed: ' + one(e && e.message, 160)); warn('idle lab filing', e); }
|
|
443
|
-
appendRun(r, { kind: 'end', run, ok, cost, ms: Math.max(0, now - a.start), filed, dropped: dropped.slice(0, 6) });
|
|
444
|
+
appendRun(r, { kind: 'end', run, ok, cost, ms: Math.max(0, now - a.start), filed, dropped: dropped.slice(0, 6) }, now);
|
|
444
445
|
if (stretch) {
|
|
445
446
|
stretch.filed += filed;
|
|
446
447
|
const v = stretch.perWs.get(a.c.ws) || { ms: 0, n: 0 };
|
|
@@ -26,7 +26,8 @@ const shortDate = (v) => { const d = isoDay(v); return d ? d.getDate() + ' ' + M
|
|
|
26
26
|
const plural = (n, one, many) => (n === 1 ? one : many);
|
|
27
27
|
const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
28
28
|
const cap1 = (s) => (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : '');
|
|
29
|
-
const
|
|
29
|
+
const SP = require('./status-proof.js'); // T3: a status renders only with its source and read time
|
|
30
|
+
const STATUS_LABEL = { 'no signal': 'No signal', 'on track': 'On track', 'at risk': 'At risk', late: 'Late', 'on hold': 'On hold', done: 'Done', cancelled: 'Cancelled' };
|
|
30
31
|
const DOC_STATE = { missing: 'Not started', draft: 'Draft', ok: 'Up to date', stale: 'Stale', due: 'Due' };
|
|
31
32
|
const BY = { drafts: 'PMOS drafts it', proposes: 'PMOS proposes', reviews: 'PMOS reviews', you: 'You write it', live: 'Live view' };
|
|
32
33
|
const STEP_STATE = { done: 'Done', current: 'In progress', todo: 'To do', skipped: 'Skipped', blocked: 'Blocked' };
|
|
@@ -60,8 +61,10 @@ function build(f) {
|
|
|
60
61
|
const key = 'init:' + id;
|
|
61
62
|
|
|
62
63
|
// ── header ──
|
|
63
|
-
|
|
64
|
+
// T3 (lib/status-proof.js): a status the row cannot prove says No signal; the header says where a proven one came from
|
|
65
|
+
const status = row.status ? SP.provenStatus(row) : null, bad = status === 'late' || status === 'at risk';
|
|
64
66
|
const head = {
|
|
67
|
+
statusFrom: status && status !== SP.NO_SIGNAL ? SP.fromLine(row.signal) : '',
|
|
65
68
|
statusLabel: status ? (STATUS_LABEL[status] || cap1(status)) : null, tone: status === 'on track' || status === 'done' ? 'ok' : bad ? (status === 'late' ? 'bad' : 'warn') : 'mut',
|
|
66
69
|
meta: [board.name || '', row.owner || '', row.end ? 'planned finish ' + shortDate(row.end) : ''].filter(Boolean),
|
|
67
70
|
stage: row.stage || null, stageNote: row.stageSource === 'derived' ? 'derived by the workflow engine' : null,
|
|
@@ -154,7 +157,7 @@ function build(f) {
|
|
|
154
157
|
|
|
155
158
|
const files = ((sheet && sheet.files) || []).filter((x) => x && x.path).slice(0, 12).map((x) => ({ label: x.label || x.kind, path: x.path }));
|
|
156
159
|
const one = row.oneStage || null, stageWords = one && one.label ? one.label : row.stage;
|
|
157
|
-
const say = (row.title || id) + ' is ' + (status ? STATUS_LABEL[status] ? STATUS_LABEL[status].toLowerCase() : status : 'without a status') + (stageWords ? ', in the ' + stageWords + ' stage' : '') + '.'
|
|
160
|
+
const say = (row.title || id) + ' is ' + (status === SP.NO_SIGNAL ? 'without a status signal' : status ? STATUS_LABEL[status] ? STATUS_LABEL[status].toLowerCase() : status : 'without a status') + (stageWords ? ', in the ' + stageWords + ' stage' : '') + '.'
|
|
158
161
|
+ (one && one.source ? ' The stage comes from ' + one.source + '.' : row.stageSource === 'derived' ? ' The stage comes from the workflow engine, not from a person.' : '');
|
|
159
162
|
const facts = [['Lane', row.lane], ['Stage', stageWords], ['Anchor', row.anchor], ['Rank', Number.isInteger(row.rank) ? '#' + (row.rank + 1) + ' on the Roadmap' : ''], ['Status', head.statusLabel], ['Owner', row.owner], ['Planned finish', row.end ? shortDate(row.end) : ''], ['Progress', prog && prog.total ? prog.done + ' of ' + prog.total : '']].filter((x) => x[1]);
|
|
160
163
|
|
|
@@ -290,7 +290,7 @@ const ptsOf = (v, u) => (String(u).trim() === '%' ? r2(v) + (r2(v) === 1 ? ' pt'
|
|
|
290
290
|
const anchorHits = (a, o) => !!a && (String(a) === String(o.id) || String(a) === String(o.name));
|
|
291
291
|
function initOf(r) {
|
|
292
292
|
const i = lifeIndex(r.stage);
|
|
293
|
-
return { id: String(r.id), title: clip(r.title || r.id, 120), stage: r.stage || '', idx: i, stageLabel: i >= 0 ? LIFE_LABEL[i] : (r.stage || ''), status: r.status || '', lane: r.lane || '',
|
|
293
|
+
return { id: String(r.id), title: clip(r.title || r.id, 120), stage: r.stage || '', idx: i, stageLabel: i >= 0 ? LIFE_LABEL[i] : (r.stage || ''), status: r.status || '', signal: r.signal || null, lane: r.lane || '',
|
|
294
294
|
owner: r.owner || '', end: r.end ? shortDate(r.end) : '', endAt: r.end ? String(r.end).slice(0, 10) : null, anchor: r.anchor || '', epic: Array.isArray(r.epics) && r.epics.length ? String(r.epics[0]) : null,
|
|
295
295
|
startAt: r.start ? String(r.start).slice(0, 10) : null, skipped: IG.skippedOf(r.warnings), milestone: milestoneOf(r, i) };
|
|
296
296
|
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* job-graph.js — every background job PMOS runs, in one table: what it reads, what it writes, and who reads what it writes
|
|
3
|
+
* (OS evaluation T1, 2026-11-08, Wawan: "Let's start work in the recommendation"). The evaluation found ledgers that are written and
|
|
4
|
+
* never read (planning/runs/verify-queue.jsonl: 143 requests, 0 verdicts, no reader until T4's verifier) and one concept with two producers (goals in the
|
|
5
|
+
* OKR files and in kr-metrics records). Nothing declared them, so nothing could see them. This table declares them; job-graph.test.js
|
|
6
|
+
* keeps it true.
|
|
7
|
+
*
|
|
8
|
+
* JOBS [{ id, kind: 'queue' | 'ai' | 'script', module, reads: [ledger], writes: [ledger], note? }]
|
|
9
|
+
* queue: a row of lib/bg-queue.js JOBS. ai: a job that files through lib/ai-guard.js (its module exports JOB).
|
|
10
|
+
* script: a repository script that writes a ledger a job or a person should act on.
|
|
11
|
+
* LEDGERS { <ledger>: { concept, owner, readers: [{ file, needle, what }] } } paths relative to the workspace folder, or
|
|
12
|
+
* `repo:<path>` for a file in the repository root. `<state>/` is a product's state folder, `<runtime>/` the per-user one.
|
|
13
|
+
* A reader is a file that ACTS on the ledger: it shows it to the PM or a later job decides from it. `needle` is a string the
|
|
14
|
+
* reader's source holds (the function that reads it); with no needle the reader must hold the ledger's file name or require
|
|
15
|
+
* its owner module. So each claim is checked against the code.
|
|
16
|
+
* KNOWN [{ rule, ledger | concept, why, fix }] the known hits: the debt, recorded so the test is green and the debt is visible.
|
|
17
|
+
* check({ root, queueJobs, aiJobs }) → { errors: [string], hits: [{ rule, key, why }], stale: [KNOWN row] }
|
|
18
|
+
*
|
|
19
|
+
* THE RULES (check):
|
|
20
|
+
* declared every queue job and every AI job has a row; every ledger a row writes is in LEDGERS; every module, owner and reader
|
|
21
|
+
* file exists, and each reader file holds its needle
|
|
22
|
+
* no-reader a ledger that a job writes and nothing reads (readers is empty) → a hit
|
|
23
|
+
* two-producers two ledgers that hold the same concept → a hit
|
|
24
|
+
* A hit that KNOWN does not list fails the test. A KNOWN row that no longer hits fails it too, so a fixed debt leaves the list.
|
|
25
|
+
*/
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
|
|
29
|
+
const audit = 'ai-audit.jsonl';
|
|
30
|
+
const props = '<state>/proposals.jsonl';
|
|
31
|
+
const r = (file, needle, what) => ({ file, needle, what });
|
|
32
|
+
|
|
33
|
+
const LEDGERS = Object.freeze({
|
|
34
|
+
[props]: { concept: 'claude-proposals', owner: 'lib/proposals.js', readers: [
|
|
35
|
+
r('lib/routes-proposals.js', null, "the initiative's ✦ in the Viewer"),
|
|
36
|
+
r('lib/orchestrator-keeprate.js', null, 'the ✦ keep rate in `pmos ai status`'),
|
|
37
|
+
r('lib/grill-runs.js', 'PR.lessonsOf', "the grill's next run: dropped findings and the PM's reasons"),
|
|
38
|
+
r('lib/proposal-runs.js', 'PR.lessonsOf', "the task checks' next run: dropped proposals and the PM's reasons")] },
|
|
39
|
+
[`<runtime>/${audit}`]: { concept: 'ai-audit', owner: 'lib/ai-guard.js', readers: [
|
|
40
|
+
r('lib/ai-cli.js', 'AG.readAudit', '`pmos ai log` and `pmos ai status`')] },
|
|
41
|
+
'<runtime>/bg-queue.jsonl': { concept: 'background-turns', owner: 'lib/bg-queue.js', readers: [
|
|
42
|
+
r('lib/routes-lab.js', 'bgQueue.record', 'Intelligence › Lab: what Claude did in the background')] },
|
|
43
|
+
'<runtime>/grill-runs.jsonl': { concept: 'grill-spend', owner: 'lib/grill.js', readers: [
|
|
44
|
+
r('lib/bg-queue.js', 'grill-runs.jsonl', 'the spend limit that holds step 5'),
|
|
45
|
+
r('lib/routes-grill.js', null, "Settings › Claude's checks: this month's spend")] },
|
|
46
|
+
'<state>/driver.jsonl': { concept: 'driver-runs', owner: 'lib/driver.js', readers: [
|
|
47
|
+
r('lib/routes-driver.js', null, "the initiative's Agent strip"),
|
|
48
|
+
r('lib/driver-needs.js', null, 'Needs you')] },
|
|
49
|
+
'<state>/core-docs.jsonl': { concept: 'core-doc-drafts', owner: 'lib/core-docs.js', readers: [
|
|
50
|
+
r('lib/routes-core-docs.js', null, 'the core documents of an initiative'),
|
|
51
|
+
r('lib/core-docs-needs.js', null, 'Needs you')] },
|
|
52
|
+
'<state>/metric-drafts.jsonl': { concept: 'metric-drafts', owner: 'lib/metric-drafts.js', readers: [
|
|
53
|
+
r('lib/routes-metric-drafts.js', null, 'the metric ✦ on a product, program or initiative page')] },
|
|
54
|
+
'<state>/metric-reads.jsonl': { concept: 'metric-readings', owner: 'lib/metric-reads.js', readers: [
|
|
55
|
+
r('lib/routes-goal-status.js', null, 'goal status'),
|
|
56
|
+
r('lib/insights-premium.js', null, 'Intelligence')] },
|
|
57
|
+
'<runtime>/impact.jsonl': { concept: 'impact', owner: 'lib/impact.js', readers: [
|
|
58
|
+
r('lib/routes-impact.js', null, "Adler's sprout on Home and the impact log")] },
|
|
59
|
+
'<state>/forecast.jsonl': { concept: 'forecast', owner: 'lib/forecast.js', readers: [
|
|
60
|
+
r('lib/routes-forecast.js', null, 'the forecast on the Board and Intelligence')] },
|
|
61
|
+
'<state>/scan.jsonl': { concept: 'horizon-scan', owner: 'lib/scan.js', readers: [
|
|
62
|
+
r('lib/routes-scan.js', null, 'the Horizon scan results')] },
|
|
63
|
+
'<state>/drift.jsonl': { concept: 'drift', owner: 'lib/drift.js', readers: [
|
|
64
|
+
r('lib/routes-drift.js', null, "What you might have missed, in Home's chat")] },
|
|
65
|
+
'<runtime>/idle-lab.jsonl': { concept: 'idle-lab', owner: 'lib/idle-lab.js', readers: [
|
|
66
|
+
r('lib/routes-lab.js', null, 'Intelligence › Lab')] },
|
|
67
|
+
'<runtime>/refresh-log.jsonl': { concept: 'refresh-log', owner: 'lib/refresh.js', readers: [
|
|
68
|
+
r('lib/routes-refresh.js', null, 'Settings › Data refresh and `pmos refresh since`'),
|
|
69
|
+
r('lib/harness-health.js', null, 'harness health')] },
|
|
70
|
+
'<state>/report-setups.jsonl': { concept: 'report-setups', owner: 'lib/report-setups.js', readers: [
|
|
71
|
+
r('lib/routes-report-setups.js', null, 'Reports: recurring reports and what the finder found')] },
|
|
72
|
+
'<state>/ready-reports.jsonl': { concept: 'ready-reports', owner: 'lib/ready-reports.js', readers: [
|
|
73
|
+
r('lib/routes-ready-reports.js', null, 'Reports: the ready-made reports')] },
|
|
74
|
+
'<state>/design.jsonl': { concept: 'report-design', owner: 'lib/report-design.js', readers: [
|
|
75
|
+
r('lib/routes-report-design.js', null, 'the report design studio')] },
|
|
76
|
+
'<state>/team.jsonl': { concept: 'role-team', owner: 'lib/team-runs.js', readers: [
|
|
77
|
+
r('lib/team-cli.js', 'R.status', '`pmos team status`: who works on what, and the inbox entry of each ended dispatch'),
|
|
78
|
+
r('lib/team-runs.js', 'function advance', 'the next role of a dispatch, and the Evaluator woken by another role\'s write')] },
|
|
79
|
+
'<state>/structure.jsonl': { concept: 'report-structure', owner: 'lib/report-structure.js', readers: [
|
|
80
|
+
r('lib/routes-report-structure.js', null, 'the report structure step')] },
|
|
81
|
+
'<state>/milestone-reviews.jsonl': { concept: 'milestone-reviews', owner: 'lib/milestone-suggest.js', readers: [
|
|
82
|
+
r('lib/routes-programs.js', null, "a program's milestone suggestions")] },
|
|
83
|
+
'<runtime>/prepare-queue.jsonl': { concept: 'prepare-queue', owner: 'server.js', readers: [
|
|
84
|
+
r('server.js', 'queueEntries()', 'Today: the day tasks waiting or running')] },
|
|
85
|
+
'<runtime>/learn-events.jsonl': { concept: 'learn-events', owner: 'server.js', readers: [
|
|
86
|
+
r('server.js', 'nsRead(PRO_LEARN_EVENTS())', 'the weekly rollup of what the PM kept')] },
|
|
87
|
+
'repo:planning/runs/agent-runs.jsonl': { concept: 'agent-runs', owner: 'repo:scripts/log-run.js', readers: [
|
|
88
|
+
r('lib/briefing-premium.js', 'agent-runs.jsonl', 'the briefing'),
|
|
89
|
+
r('repo:scripts/check-verify-queue.js', 'agent-runs.jsonl', 'what verification is owed')] },
|
|
90
|
+
// check-verify-queue.js COUNTS the queue (a CI report) and is not a reader; verifier.js takes the next merged run that owes a verdict (T4)
|
|
91
|
+
'repo:planning/runs/verify-queue.jsonl': { concept: 'verify-requests', owner: 'repo:scripts/verify-queue.js', readers: [
|
|
92
|
+
r('repo:scripts/verifier.js', 'deriveQueue', 'the verifier after merge: the next merged run to grade')] },
|
|
93
|
+
'repo:planning/runs/evals.jsonl': { concept: 'review-verdicts', owner: 'repo:scripts/record-eval.js', readers: [
|
|
94
|
+
r('repo:scripts/check-calibration.js', 'evals.jsonl', 'κ per evaluator model against the PM\'s labels'),
|
|
95
|
+
r('repo:scripts/verifier.js', 'verdictOracle', 'a verdict closes its queue entry')] },
|
|
96
|
+
'repo:planning/work-items.jsonl': { concept: 'work-items', owner: 'repo:scripts/work-item.js', readers: [
|
|
97
|
+
r('lib/factory-join.js', 'work-items.jsonl', 'a plan item reads Done once its work item is integrated')] },
|
|
98
|
+
// goals (one goal source, T2): the OKR files are the only goal list; lib/goal-source.js joins each key result to the kr-metrics record that reads it,
|
|
99
|
+
// and Intelligence, Your move, report KR slots and dashboards all read source(). A kr-metrics record is a goal's readings, not a second goal list.
|
|
100
|
+
'repo:planning/okrs/': { concept: 'goals', owner: 'PM (OKR files)', readers: [
|
|
101
|
+
r('lib/okr-goals.js', 'okrs', 'the goal list (lib/goal-source.js source())')] },
|
|
102
|
+
'repo:planning/records/kr-metrics.jsonl': { concept: 'goal-readings', owner: 'lib/routes-metric-drafts.js', readers: [
|
|
103
|
+
r('lib/goal-source.js', 'kr-metrics', 'the readings of each goal: Intelligence, Your move, report KR slots, dashboards')] },
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const q = (id, module, writes, reads = [], note) => ({ id, kind: 'queue', module, reads, writes, ...(note ? { note } : {}) });
|
|
107
|
+
const ai = (id, module, writes, reads = []) => ({ id, kind: 'ai', module, reads, writes: [...writes, `<runtime>/${audit}`] });
|
|
108
|
+
const JOBS = Object.freeze([
|
|
109
|
+
q('schedules', 'server.js', [], ['<runtime>/schedules.json'], 'starts the scheduled skills; each skill writes its own records'),
|
|
110
|
+
q('proactive', 'lib/proactive.js', ['<runtime>/learn-events.jsonl'], ['connectors']),
|
|
111
|
+
q('prepare', 'lib/prepare-queue.js', ['<runtime>/prepare-queue.jsonl'], ['connectors']),
|
|
112
|
+
q('day', 'server.js', [], ['<runtime>/prepare-queue.jsonl'], 'the day plan is drawn from the brief; it keeps no ledger of its own'),
|
|
113
|
+
q('refresh', 'lib/refresh.js', ['<runtime>/refresh-log.jsonl'], ['connectors']),
|
|
114
|
+
q('reports', 'lib/routes-report-setups.js', ['<state>/report-setups.jsonl', '<state>/ready-reports.jsonl'], ['<state>/report-setups.jsonl']),
|
|
115
|
+
q('sync', 'lib/auto-sync.js', [], ['git'], 'git only: no model and no ledger'),
|
|
116
|
+
q('driver', 'lib/driver.js', ['<state>/driver.jsonl'], ['initiative records', 'jira']),
|
|
117
|
+
q('finder', 'lib/report-finder.js', ['<state>/report-setups.jsonl'], ['connectors']),
|
|
118
|
+
q('coredocs', 'lib/core-docs.js', ['<state>/core-docs.jsonl'], ['initiative records']),
|
|
119
|
+
q('milestones', 'lib/milestone-review.js', ['<state>/milestone-reviews.jsonl'], ['program charters']),
|
|
120
|
+
q('propose', 'lib/proposal-runs.js', [props], ['connectors', props]),
|
|
121
|
+
q('grill', 'lib/grill-runs.js', [props, '<runtime>/grill-runs.jsonl'], [props, 'repo:DECISIONS.md']),
|
|
122
|
+
q('metric-drafts', 'lib/metric-draft-runs.js', ['<state>/metric-drafts.jsonl'], ['<state>/metric-reads.jsonl']),
|
|
123
|
+
q('impact', 'lib/impact-runs.js', ['<runtime>/impact.jsonl'], ['connectors']),
|
|
124
|
+
q('verify', 'lib/verify-runs.js', ['repo:planning/runs/evals.jsonl', 'repo:planning/runs/verify-queue.jsonl', 'repo:planning/work-items.jsonl'], ['repo:planning/runs/verify-queue.jsonl', 'git']),
|
|
125
|
+
q('metric-reads', 'lib/metric-read-runs.js', ['<state>/metric-reads.jsonl'], ['connectors']),
|
|
126
|
+
q('forecast', 'lib/forecast-tick.js', ['<state>/forecast.jsonl'], ['<state>/boards.jsonl']),
|
|
127
|
+
q('report-design', 'lib/routes-report-design.js', ['<state>/design.jsonl']),
|
|
128
|
+
q('report-structure', 'lib/routes-report-structure.js', ['<state>/structure.jsonl']),
|
|
129
|
+
q('team', 'lib/team-runs.js', ['<state>/team.jsonl'], ['<state>/team.jsonl', 'initiative records']),
|
|
130
|
+
q('scan', 'lib/scan-run.js', ['<state>/scan.jsonl'], ['public web']),
|
|
131
|
+
q('idle-lab', 'lib/idle-lab-engine.js', ['<runtime>/idle-lab.jsonl', props], [props]),
|
|
132
|
+
ai('past-repeat', 'lib/past-repeat.js', [props], ['repo:DECISIONS.md']),
|
|
133
|
+
ai('decision-memory', 'lib/decision-memory.js', [props], ['repo:DECISIONS.md']),
|
|
134
|
+
ai('outcomes', 'lib/outcome-props.js', [props], ['initiative records']),
|
|
135
|
+
ai('descriptions', 'lib/description-props.js', [props], ['initiative records']),
|
|
136
|
+
ai('drift', 'lib/drift-runs.js', ['<state>/drift.jsonl'], ['<state>/boards.jsonl']),
|
|
137
|
+
ai('rehearse', 'lib/rehearse-guard.js', [], ['task links']),
|
|
138
|
+
ai('next-prompt', 'lib/next-prompt.js', []),
|
|
139
|
+
ai('sharpen-prompt', 'lib/next-prompt.js', []),
|
|
140
|
+
{ id: 'log-run', kind: 'script', module: 'repo:scripts/log-run.js', reads: [], writes: ['repo:planning/runs/agent-runs.jsonl', 'repo:planning/runs/verify-queue.jsonl'] },
|
|
141
|
+
]);
|
|
142
|
+
|
|
143
|
+
const KNOWN = Object.freeze([
|
|
144
|
+
]);
|
|
145
|
+
|
|
146
|
+
/** Does source t require the module at owner (a workspace-relative lib path)? */
|
|
147
|
+
function requires(t, owner) {
|
|
148
|
+
const b = path.basename(String(owner || '')).replace(/\.js$/, '');
|
|
149
|
+
if (!b || !/\.js$/.test(String(owner))) return false;
|
|
150
|
+
return new RegExp(`require\\((['"])\\.{1,2}/(lib/)?${b.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(\\.js)?\\1\\)`).test(t);
|
|
151
|
+
}
|
|
152
|
+
/** Where a declared path lives on disk: `repo:` → the repository root, else the workspace folder. null: not a file (a <state> ledger). */
|
|
153
|
+
function fileOf(root, p) {
|
|
154
|
+
if (!p || /^</.test(p) || !/[./]/.test(p) || p.startsWith('PM ')) return null;
|
|
155
|
+
return p.startsWith('repo:') ? path.join(root, '..', p.slice(5)) : path.join(root, p);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** root: the workspace folder. queueJobs: lib/bg-queue.js JOBS ids. aiJobs: the JOB ids of the files that use lib/ai-guard.js. */
|
|
159
|
+
function check({ root = path.join(__dirname, '..'), queueJobs = [], aiJobs = [], jobs = JOBS, ledgers = LEDGERS, known = KNOWN } = {}) {
|
|
160
|
+
const errors = [], hits = [];
|
|
161
|
+
const ids = new Set(jobs.map((j) => j.id));
|
|
162
|
+
for (const id of queueJobs) if (!ids.has(id)) errors.push(`queue job ${id} has no row in lib/job-graph.js JOBS`);
|
|
163
|
+
for (const id of aiJobs) if (!ids.has(id)) errors.push(`AI job ${id} has no row in lib/job-graph.js JOBS`);
|
|
164
|
+
const text = new Map();
|
|
165
|
+
const src = (p) => { const f = fileOf(root, p); if (!f) return null; if (!text.has(f)) { try { text.set(f, fs.readFileSync(f, 'utf8')); } catch { text.set(f, null); } } return text.get(f); };
|
|
166
|
+
const written = new Set();
|
|
167
|
+
for (const j of jobs) {
|
|
168
|
+
if (src(j.module) == null) errors.push(`job ${j.id}: its module ${j.module} does not exist`);
|
|
169
|
+
for (const l of j.writes) { written.add(l); if (!ledgers[l]) errors.push(`job ${j.id} writes ${l}, which LEDGERS does not declare`); }
|
|
170
|
+
}
|
|
171
|
+
const byConcept = new Map();
|
|
172
|
+
for (const [key, L] of Object.entries(ledgers)) {
|
|
173
|
+
if (fileOf(root, L.owner) && src(L.owner) == null) errors.push(`${key}: its owner ${L.owner} does not exist`);
|
|
174
|
+
for (const x of L.readers) {
|
|
175
|
+
const t = src(x.file);
|
|
176
|
+
if (t == null) errors.push(`${key}: its reader ${x.file} does not exist`);
|
|
177
|
+
else if (x.needle ? !t.includes(x.needle) : !(t.includes(path.basename(key)) || requires(t, L.owner))) errors.push(`${key}: its reader ${x.file} does not hold "${x.needle || path.basename(key) + ' or a require of ' + L.owner}", so it may not read it`);
|
|
178
|
+
}
|
|
179
|
+
if (!byConcept.has(L.concept)) byConcept.set(L.concept, []);
|
|
180
|
+
byConcept.get(L.concept).push(key);
|
|
181
|
+
if (written.has(key) && !L.readers.length) hits.push({ rule: 'no-reader', key, why: `${key} is written and nothing reads it` });
|
|
182
|
+
}
|
|
183
|
+
for (const [concept, keys] of byConcept) if (keys.length > 1) hits.push({ rule: 'two-producers', key: concept, why: `${concept} has ${keys.length} producers: ${keys.join(', ')}` });
|
|
184
|
+
const isKnown = (h) => known.some((k) => k.rule === h.rule && k.key === h.key);
|
|
185
|
+
for (const h of hits) if (!isKnown(h)) errors.push(`${h.rule}: ${h.why}`);
|
|
186
|
+
const stale = known.filter((k) => !hits.some((h) => h.rule === k.rule && h.key === k.key));
|
|
187
|
+
for (const k of stale) errors.push(`KNOWN ${k.rule} ${k.key} no longer hits: take it off the list`);
|
|
188
|
+
return { errors, hits, stale };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
module.exports = { JOBS, LEDGERS, KNOWN, check, fileOf };
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* matchAnchor(anchor, objectives) → { o, k } | null the key result an initiative's parent_kr names. PURE
|
|
8
8
|
* build({ okr, goals, initiatives, records, today }) → the model's okrFile. PURE
|
|
9
9
|
*
|
|
10
|
+
* ONE GOAL SOURCE (OS evaluation T2). lib/goal-source.js source() is the goal list every reader takes: this file's key results, each with the KR metric
|
|
11
|
+
* record that reads it, and the records no key result claims. No other file lists the kr-metrics records for goals.
|
|
12
|
+
*
|
|
10
13
|
* WHY. Every product keeps an OKR file (IDPF: okrs-h2-2026.md, 10 key results), and the Board anchors initiatives to it (KR-A1, O-C.KR-C1), but
|
|
11
14
|
* Intelligence listed only the KR metric records, so IDPF showed 1 goal and OOH 0. Here the file's key results are the list. A KR metric record is
|
|
12
15
|
* a key result's READER (its readings and recipe), attached by its `kr` field or by its title naming the key result's id; it is never a second
|
|
@@ -5,16 +5,26 @@
|
|
|
5
5
|
* fromDriver(state) → [item] the Driver's proposals (lib/driver.js fold), each with its outcome
|
|
6
6
|
* fromCoreDocs(store) → [item] the agent's core-document drafts (lib/core-docs.js fold): issued is kept, dropped is dropped
|
|
7
7
|
* report(items, { now, weeks, runs }) → { weeks: [week], types: [type], pause: [type] }
|
|
8
|
-
*
|
|
8
|
+
* fromProposals(lines, { product }) → [item] every ✦ job's proposals (lib/proposals.js ledger), one item per proposal, by job
|
|
9
|
+
* jobOf(p) → the ✦ job a proposal belongs to (JOBS)
|
|
10
|
+
* byJob(items, { now, product? }) → [{ job, label, decided, kept, dropped, open, keepRate, pause }] the last 14 days, every ✦ job
|
|
11
|
+
* readAll(roots) → [item] every included repository's ledgers. A ledger that cannot be read gives nothing.
|
|
9
12
|
*
|
|
10
|
-
* An item is { src: 'driver' | 'coredoc', type, at, decidedAt, outcome: 'kept' | 'returned' | 'dropped' | 'open' }. `type` is the kind of work
|
|
13
|
+
* An item is { src: 'driver' | 'coredoc' | 'proposal', type, at, decidedAt, outcome: 'kept' | 'returned' | 'dropped' | 'open', product? }. `type` is the kind of work
|
|
11
14
|
* (the proposal's `what`, or `doc:<key>`), which is the "task type" of the PRD.
|
|
12
15
|
*
|
|
13
16
|
* A WEEK is Monday to Sunday on this machine's clock, named by its Monday (YYYY-MM-DD), and holds the items DECIDED in it:
|
|
14
17
|
* keepRate kept / decided, or null with nothing decided. The primary measure.
|
|
15
18
|
* correctionRate (returned + dropped) / the Driver's runs that ended in the week, or null with no run. The north star, per agent run.
|
|
16
19
|
* PAUSE: a type with at least MIN_DECIDED items decided in the last 14 days and none kept is listed in `pause`. The report says so; the PM
|
|
17
|
-
* pauses it. Nothing here pauses anything, because a pause is a gate the PM holds (driver.js: pause lines are PM only).
|
|
20
|
+
* pauses it. Nothing here pauses anything, because a pause is a gate the PM holds (driver.js: pause lines are PM only).
|
|
21
|
+
*
|
|
22
|
+
* THE ✦ JOBS (OS evaluation T1, 2026-11-08). Every job that files under an initiative's ✦ has its own keep rate, per product, read from
|
|
23
|
+
* proposals.jsonl. A proposal is kept when a keep line names it (and its batch is not undone), dropped when a drop line names it, by its
|
|
24
|
+
* id (drop lines carry it since T1) or by the signature of any version of it that was filed. A drop of a computed proposal that was never
|
|
25
|
+
* filed (an old date proposal) cannot be placed and is counted in `unplaced`, never guessed. A date proposal's kept id is `<id>:<sig>`.
|
|
26
|
+
* A change the agent applied by itself (D106: a keep line with `auto: true`) counts as kept until the PM undoes it, then as not kept.
|
|
27
|
+
* A drop PMOS wrote itself (by `pmos:…`: a draft retired because the record changed) is nobody's decision: that proposal is left out. */
|
|
18
28
|
const fs = require('fs');
|
|
19
29
|
const path = require('path');
|
|
20
30
|
|
|
@@ -55,6 +65,92 @@ function fromCoreDocs(store) {
|
|
|
55
65
|
return out;
|
|
56
66
|
}
|
|
57
67
|
|
|
68
|
+
/* ── the ✦ jobs ─────────────────────────────────────────────────────────────────────────────── */
|
|
69
|
+
/* off: the `pmos ai off` name that pauses the job (the four task checks share the queue job `propose`). */
|
|
70
|
+
const JOBS = Object.freeze([
|
|
71
|
+
{ job: 'found-elsewhere', off: 'propose', label: 'Found elsewhere' },
|
|
72
|
+
{ job: 'dates', off: 'propose', label: 'New dates' },
|
|
73
|
+
{ job: 'looks-done', off: 'propose', label: 'Looks done' },
|
|
74
|
+
{ job: 'names', off: 'propose', label: 'Tidy names' },
|
|
75
|
+
{ job: 'grill', label: 'Grill' },
|
|
76
|
+
{ job: 'past-repeat', label: 'You decided this before' },
|
|
77
|
+
{ job: 'decision-memory', label: 'Decision memory' },
|
|
78
|
+
{ job: 'descriptions', label: 'Descriptions' },
|
|
79
|
+
{ job: 'outcomes', label: 'Expected outcomes' },
|
|
80
|
+
{ job: 'idle-lab', label: 'Idle lab' },
|
|
81
|
+
]);
|
|
82
|
+
const GROUP_JOB = { found: 'found-elsewhere', dates: 'dates', status: 'looks-done', names: 'names', description: 'descriptions', outcome: 'outcomes',
|
|
83
|
+
prototyped: 'idle-lab', improved: 'idle-lab', scanned: 'idle-lab' };
|
|
84
|
+
/** The ✦ job of a proposal { group, type }: a grill finding of type past or decision is its own job. null: not a ✦ job. */
|
|
85
|
+
function jobOf(p) {
|
|
86
|
+
if (!p) return null;
|
|
87
|
+
if (p.group === 'grill') return p.type === 'past' ? 'past-repeat' : p.type === 'decision' ? 'decision-memory' : 'grill';
|
|
88
|
+
return GROUP_JOB[p.group] || null;
|
|
89
|
+
}
|
|
90
|
+
const DATE_KEPT = /:s:[0-9a-f]{10}$/;
|
|
91
|
+
|
|
92
|
+
/** PURE. lines: the proposals ledger, oldest first. → [item] with type = the job, plus `unplaced` (the drops no filed proposal explains). */
|
|
93
|
+
function fromProposals(lines, { product = '' } = {}) {
|
|
94
|
+
const S = require('./proposals.js');
|
|
95
|
+
const props = new Map(); // id → { id, ini, job, at }
|
|
96
|
+
const bySig = new Map(); // the signature of any filed version, or of one of its items → id
|
|
97
|
+
const dec = new Map(); // id → { outcome, at, batch? }
|
|
98
|
+
const batches = new Map(); // keep batch → [id]
|
|
99
|
+
let unplaced = 0;
|
|
100
|
+
for (const l of Array.isArray(lines) ? lines : []) {
|
|
101
|
+
if (!l || typeof l !== 'object') continue;
|
|
102
|
+
if (l.kind === 'propose' && l.id && l.ini) {
|
|
103
|
+
if (typeof l.by === 'string' && l.by.startsWith('pm:')) continue;
|
|
104
|
+
const job = jobOf(l); if (!job) continue;
|
|
105
|
+
if (!props.has(l.id)) props.set(l.id, { id: l.id, ini: String(l.ini), job, at: msOf(l.at) });
|
|
106
|
+
const p = { id: l.id, why: l.why, sources: Array.isArray(l.sources) ? l.sources : [], items: Array.isArray(l.items) ? l.items : [] };
|
|
107
|
+
bySig.set(S.sigOf(p), l.id);
|
|
108
|
+
for (const x of p.items) if (x && typeof x === 'object') bySig.set(S.itemSig(p, x), l.id);
|
|
109
|
+
} else if (l.kind === 'drop' && l.sig) {
|
|
110
|
+
const machine = typeof l.by === 'string' && l.by.startsWith('pmos:'); // PMOS retired a stale draft: no one decided it
|
|
111
|
+
const id = (l.id && props.has(l.id)) ? l.id : bySig.get(String(l.sig));
|
|
112
|
+
if (machine) { if (id && !dec.has(id)) dec.set(id, { outcome: 'retired', at: msOf(l.at) }); continue; }
|
|
113
|
+
if (!id) { if (l.group && jobOf(l)) { const k = 'drop:' + l.sig; props.set(k, { id: k, ini: String(l.ini || ''), job: jobOf(l), at: msOf(l.at) }); dec.set(k, { outcome: 'dropped', at: msOf(l.at) }); } else unplaced++; continue; }
|
|
114
|
+
const d = dec.get(id); if (!d || d.outcome !== 'kept') dec.set(id, { outcome: 'dropped', at: msOf(l.at) });
|
|
115
|
+
} else if (l.kind === 'keep' && l.batch) {
|
|
116
|
+
const ids = [];
|
|
117
|
+
for (const raw of Array.isArray(l.ids) ? l.ids : []) {
|
|
118
|
+
const s = String(raw), base = s.replace(DATE_KEPT, '');
|
|
119
|
+
let id = props.has(s) ? s : props.has(base) ? base : null;
|
|
120
|
+
if (!id && DATE_KEPT.test(s)) { id = base; props.set(id, { id, ini: String(l.ini || ''), job: 'dates', at: msOf(l.at) }); }
|
|
121
|
+
if (!id) continue;
|
|
122
|
+
dec.set(id, { outcome: 'kept', at: msOf(l.at), batch: l.batch, auto: l.auto === true }); ids.push(id);
|
|
123
|
+
}
|
|
124
|
+
batches.set(l.batch, ids);
|
|
125
|
+
} else if (l.kind === 'undo' && l.batch) {
|
|
126
|
+
// the PM's own ✓ undone: it waits again. A change the agent applied by itself (D106, keep `auto: true`) and the PM undid: not kept
|
|
127
|
+
for (const id of batches.get(l.batch) || []) { const d = dec.get(id); if (d && d.batch === l.batch) { if (d.auto) dec.set(id, { outcome: 'dropped', at: msOf(l.at) }); else dec.delete(id); } }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const out = [];
|
|
131
|
+
for (const p of props.values()) {
|
|
132
|
+
const d = dec.get(p.id);
|
|
133
|
+
if (d && d.outcome === 'retired') continue;
|
|
134
|
+
out.push({ src: 'proposal', type: p.job, ini: p.ini, product, at: p.at, decidedAt: d ? d.at : null, outcome: d ? d.outcome : 'open' });
|
|
135
|
+
}
|
|
136
|
+
out.unplaced = unplaced;
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** PURE. Every ✦ job's last 14 days (by decision time; open counts what still waits), with the PAUSE rule. product: only that product. */
|
|
141
|
+
function byJob(items, { now = Date.now(), product = null } = {}) {
|
|
142
|
+
const since = now - PAUSE_DAYS * DAY;
|
|
143
|
+
const rows = new Map(JOBS.map((j) => [j.job, { job: j.job, off: j.off || j.job, label: j.label, decided: 0, kept: 0, dropped: 0, open: 0 }]));
|
|
144
|
+
for (const it of Array.isArray(items) ? items : []) {
|
|
145
|
+
if (it.src !== 'proposal' || (product != null && it.product !== product)) continue;
|
|
146
|
+
const r = rows.get(it.type); if (!r) continue;
|
|
147
|
+
if (it.outcome === 'open') { r.open++; continue; }
|
|
148
|
+
if (it.decidedAt == null || it.decidedAt < since) continue;
|
|
149
|
+
r.decided++; if (it.outcome === 'kept') r.kept++; else r.dropped++;
|
|
150
|
+
}
|
|
151
|
+
return [...rows.values()].map((r) => ({ ...r, keepRate: rate(r.kept, r.decided), pause: r.decided >= MIN_DECIDED && r.kept === 0 }));
|
|
152
|
+
}
|
|
153
|
+
|
|
58
154
|
/** runs: the ends of the Driver's runs, as epoch ms. */
|
|
59
155
|
function report(items, { now = Date.now(), weeks = 4, runs = [] } = {}) {
|
|
60
156
|
const list = Array.isArray(items) ? items : [];
|
|
@@ -83,10 +179,11 @@ function report(items, { now = Date.now(), weeks = 4, runs = [] } = {}) {
|
|
|
83
179
|
return { weeks: out, types: typeList, pause: typeList.filter((x) => x.decided >= MIN_DECIDED && x.kept === 0).map((x) => x.type) };
|
|
84
180
|
}
|
|
85
181
|
|
|
86
|
-
/** roots: the repository roots to read. → { items, runs } */
|
|
182
|
+
/** roots: the repository roots to read. → { items, runs, unplaced } */
|
|
87
183
|
function readAll(roots) {
|
|
88
|
-
const D = require('./driver.js'), CD = require('./core-docs.js');
|
|
184
|
+
const D = require('./driver.js'), CD = require('./core-docs.js'), PR = require('./proposals.js');
|
|
89
185
|
const items = [], runs = [];
|
|
186
|
+
let unplaced = 0;
|
|
90
187
|
for (const root of roots || []) {
|
|
91
188
|
try {
|
|
92
189
|
const dir = D.stateDirOf(root);
|
|
@@ -96,9 +193,13 @@ function readAll(roots) {
|
|
|
96
193
|
for (const r of st.runs.values()) if (r.end) runs.push(r.end);
|
|
97
194
|
}
|
|
98
195
|
} catch { /* this ledger gives nothing */ }
|
|
196
|
+
try {
|
|
197
|
+
const dir = D.stateDirOf(root);
|
|
198
|
+
if (dir) { const P = fromProposals(PR.readLines(PR.ledgerFile(dir)), { product: path.basename(path.resolve(root)) }); items.push(...P); unplaced += P.unplaced || 0; }
|
|
199
|
+
} catch { /* this ledger gives nothing */ }
|
|
99
200
|
try { if (fs.existsSync(path.join(root))) items.push(...fromCoreDocs(CD.storeOf(root))); } catch { /* this ledger gives nothing */ }
|
|
100
201
|
}
|
|
101
|
-
return { items, runs };
|
|
202
|
+
return { items, runs, unplaced };
|
|
102
203
|
}
|
|
103
204
|
|
|
104
|
-
module.exports = { fromDriver, fromCoreDocs, report, readAll, weekOf, PAUSE_DAYS, MIN_DECIDED };
|
|
205
|
+
module.exports = { fromDriver, fromCoreDocs, fromProposals, jobOf, byJob, report, readAll, weekOf, JOBS, PAUSE_DAYS, MIN_DECIDED };
|
|
@@ -85,6 +85,9 @@ const VERBS = Object.freeze({
|
|
|
85
85
|
propose: Object.freeze({ module: 'propose-cli.js', run: null, guide: 'claude-proposes.md',
|
|
86
86
|
help: 'pmos propose look|found|date|done|name|status … — what Claude\'s run files under an initiative\'s ✦ for the PM to keep or drop (pmos propose help)' }),
|
|
87
87
|
// Not a pm-os-absorb verb (run: null): the AI-ideas round (2026-11-03) added it through the same table: the kill switch and audit of lib/ai-guard.js.
|
|
88
|
+
// Not a pm-os-absorb verb (run: null): the role-agent team (brief agent-team, 2026-11-08) added it through the same table.
|
|
89
|
+
team: Object.freeze({ module: 'team-cli.js', run: null, guide: 'agent-capabilities.md',
|
|
90
|
+
help: 'pmos team roles|dispatch|status|pause|resume — the role agents under the chief of staff: who owns what, who works on what (pmos team help)' }),
|
|
88
91
|
ai: Object.freeze({ module: 'ai-cli.js', run: null, guide: 'claude-proposes.md',
|
|
89
92
|
help: 'pmos ai status|off|on|log … — the AI jobs: their kill switch, replay state and audit (pmos ai help)' }),
|
|
90
93
|
// Not a pm-os-absorb verb (run: null): the AI-ideas round (2026-11-03, feature 5, plan-rehearsal) added it through the same table.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* proposal-runs.js — Claude's runs that file what the ✦ proposes (feedback batch 12 items 2, 3 and 4; lib/proposals.js).
|
|
3
3
|
*
|
|
4
4
|
* off(env) → true when PMOS_PROPOSE=off (or 0, false, no)
|
|
5
|
-
* promptOf(skill, o) → the prompt of one run. o: { run, why, ini, title, intent, stages, stage, today, tasks, dropped }
|
|
5
|
+
* promptOf(skill, o) → the prompt of one run. o: { run, why, ini, title, intent, stages, stage, today, tasks, dropped, lessons }
|
|
6
6
|
* create(deps) → { tick(opts), start({ ws, board, ini, why }), stop(run), active() }
|
|
7
7
|
*
|
|
8
8
|
* TWO MOMENTS, ONE RUN KIND (headless kind `propose`, origin `propose:<ws>:<initiative>:<run>`):
|
|
@@ -50,8 +50,9 @@ function promptOf(skill, o) {
|
|
|
50
50
|
+ `- Initiative: ${o.ini} · ${one(o.title, 140)}${o.intent ? '\n- Its Why: ' + one(o.intent, 600) : ''}\n- Its stage now: ${o.stage || 'the first stage'}\n`
|
|
51
51
|
+ `- Its workflow's stages, in order:\n${list((o.stages || []).map((s) => s.key + ' · ' + s.name), 'not known')}\n`
|
|
52
52
|
+ (o.why === 'check' ? `- Its late and at-risk tasks:\n${list(o.tasks, 'none')}\n` : `- The material the PM gave and the people named are in its record and its first questions (\`pmos initiative export ${o.ini}\`).\n`)
|
|
53
|
-
+ `- Dropped by the PM (do not file these again unless the evidence is new):\n${list(o.dropped, 'none')}\n
|
|
54
|
-
+
|
|
53
|
+
+ `- Dropped by the PM (do not file these again unless the evidence is new):\n${list(o.dropped, 'none')}\n`
|
|
54
|
+
+ (o.lessons && o.lessons.length ? `- What the PM said about your earlier proposals here, newest first (learn from it: file what they would keep):\n${list(o.lessons, 'none')}\n` : '')
|
|
55
|
+
+ '\nFile with `pmos propose` only (the server pins this initiative and run). Report each source as you read it with `pmos propose look`. Send nothing.';
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
const LOOSE = '~loose';
|
|
@@ -104,11 +105,13 @@ function create(deps) {
|
|
|
104
105
|
if (!skill) return { ok: false, error: 'the initiative-propose skill is not installed' };
|
|
105
106
|
const run = 'pr' + now.toString(36) + crypto.randomBytes(3).toString('hex');
|
|
106
107
|
const row = (deps.rowOf && deps.rowOf(w, ini)) || {};
|
|
107
|
-
const
|
|
108
|
+
const lines = PR.readLines(PR.ledgerFile(dir)), F = PR.fold(lines);
|
|
108
109
|
const dropped = [...F.props.values()].filter((p) => p.ini === ini && F.drops.has(PR.sigOf(p))).slice(0, 20).map((p) => p.group + ' · ' + (p.title || p.type) + ' · ' + one(p.why, 100));
|
|
110
|
+
// the learning edge (OS evaluation T1): the last 3 reasons the PM gave this job on this initiative (found, dates, done, names)
|
|
111
|
+
const lessons = PR.lessonsOf(lines, { ini, match: (p) => ['found', 'dates', 'status', 'names'].includes(p.group), n: 3 });
|
|
109
112
|
let tasks = [];
|
|
110
113
|
if (why === 'check') { try { const c = (deps.checks(w, localDay(now)) || []).find((x) => x.ini === ini); tasks = c ? c.tasks : []; } catch { tasks = []; } }
|
|
111
|
-
const prompt = promptOf(skill, { run, why, ini, title: row.title || ini, intent: row.intent || '', stage: row.stage || '', stages: row.stages || [], today: localDay(now), tasks, dropped });
|
|
114
|
+
const prompt = promptOf(skill, { run, why, ini, title: row.title || ini, intent: row.intent || '', stage: row.stage || '', stages: row.stages || [], today: localDay(now), tasks, dropped, lessons });
|
|
112
115
|
const go = press && deps.spawnNow ? deps.spawnNow : deps.spawn;
|
|
113
116
|
active.set(run, { ws, ini, dir, session: null, why });
|
|
114
117
|
let session = null;
|