create-pmos 0.674.0 → 0.675.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 +14 -26
- package/payload/KIT-VERSION +1 -1
- 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/workspace/changelog.json +13 -0
- package/workspace/lib/metric-drafts.js +1 -0
- package/workspace/lib/metric-read-runs.js +23 -2
- package/workspace/lib/metric-source.js +86 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/skills/metric-draft.skill +3 -2
- package/workspace/test-lists/metric-source.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.675.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.675.0",
|
|
38
|
+
"at": "2026-11-22T05:53:46.914Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1460,
|
|
43
|
+
"t": "Read one goal metric per product from the query its source names",
|
|
44
|
+
"s": "Read one goal metric per product from the query its source names",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.674.0",
|
|
38
51
|
"at": "2026-11-22T05:18:00.036Z",
|
|
@@ -351,31 +364,6 @@
|
|
|
351
364
|
"k": "new"
|
|
352
365
|
}
|
|
353
366
|
]
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"v": "0.642.0",
|
|
357
|
-
"at": "2026-11-20T01:43:00.385Z",
|
|
358
|
-
"f": 4,
|
|
359
|
-
"prs": [
|
|
360
|
-
{
|
|
361
|
-
"n": 1423,
|
|
362
|
-
"t": "Welcome, capture and the meeting pages on the PMOS design system",
|
|
363
|
-
"s": "Welcome, capture and the meeting pages on the PMOS design system",
|
|
364
|
-
"k": "new"
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
"n": 1420,
|
|
368
|
-
"t": "The rail of places is the design system's Navigation part",
|
|
369
|
-
"s": "The rail of places is the design system's Navigation part",
|
|
370
|
-
"k": "new"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"n": 1421,
|
|
374
|
-
"t": "Library, Present and the Viewer page on the PMOS design system",
|
|
375
|
-
"s": "Library, Present and the Viewer page on the PMOS design system",
|
|
376
|
-
"k": "new"
|
|
377
|
-
}
|
|
378
|
-
]
|
|
379
367
|
}
|
|
380
368
|
]
|
|
381
369
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-22T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T05:53:43Z"}
|
|
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-22T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T05:53:43Z"}
|
|
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-22T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T05:53:43Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.675.0",
|
|
4
|
+
"at": "2026-11-22T05:53:46.914Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1460,
|
|
9
|
+
"t": "Read one goal metric per product from the query its source names",
|
|
10
|
+
"s": "Read one goal metric per product from the query its source names",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.674.0",
|
|
4
17
|
"at": "2026-11-22T05:18:00.036Z",
|
|
@@ -395,6 +395,7 @@ function keepFields(scope, id, row, o = {}) {
|
|
|
395
395
|
if (scope === 'initiative') { f.initiative = id; f.window = WINDOW; }
|
|
396
396
|
if (scope === 'product') f.product = id;
|
|
397
397
|
if (row.recipe) f.recipe = row.recipe;
|
|
398
|
+
else { const d = require('./metric-source.js').trackerRecipeOf({ source: f.source, metric: f.metric, type, why: f.why }); if (d) f.recipe = d; } // A3-pre: the query its own source names
|
|
398
399
|
f.draft = row.id;
|
|
399
400
|
return { fields: f, reading: now != null && DAY_RE.test(String(o.today || '')) ? { at: o.today, value: now } : null };
|
|
400
401
|
}
|
|
@@ -20,13 +20,19 @@
|
|
|
20
20
|
* _RUN, _RIDS, _TEST). A value lands on the record with its source and time; a test value lands only in the ledger. Nothing is sent.
|
|
21
21
|
* When the run ends, a goal it neither read nor said it could not read is filed as not read ("the run ended before it read this").
|
|
22
22
|
*
|
|
23
|
+
* A3-pre (one-goal-read-per-product): before a scan, a product with no goal PMOS can read gets the cheapest query one of its goals names
|
|
24
|
+
* (lib/metric-source.js pickOf), saved on that goal's record (deps.saveRecipe, else scripts/records edit by `pmos:metric-source`). It is due
|
|
25
|
+
* at once and read daily after. The PM changes or removes it on the goal page (POST /api/goal-status/recipe).
|
|
26
|
+
*
|
|
23
27
|
* deps: { workspaces(), isLead(w), stateDirFor(w), recordsDir(w), records(w) → [kr-metrics record], open(now), workOpen(now), hours() → { start, end },
|
|
24
28
|
* headlessOff(), env,
|
|
25
29
|
* promptFor(skillId), spawn(spec), spawnNow(spec), stop(session), afterRead(w, rids) (the alert check and the bell), warn(what, err),
|
|
26
|
-
* draftsFile(w) → the metric-drafts ledger, testItems(w, rids) → [{ rid, title, unit, recipe }] for drafted rows
|
|
30
|
+
* draftsFile(w) → the metric-drafts ledger, testItems(w, rids) → [{ rid, title, unit, recipe }] for drafted rows,
|
|
31
|
+
* saveRecipe(w, rid, recipe) → { ok } (optional) }
|
|
27
32
|
*/
|
|
28
33
|
const crypto = require('crypto');
|
|
29
34
|
const MR = require('./metric-reads.js');
|
|
35
|
+
const MS = require('./metric-source.js');
|
|
30
36
|
|
|
31
37
|
const flagOff = (v) => /^(off|0|false|no)$/i.test(String(v || '').trim());
|
|
32
38
|
const off = (env) => flagOff((env || process.env).PMOS_METRIC_READ);
|
|
@@ -107,6 +113,19 @@ function create(deps) {
|
|
|
107
113
|
return { ok: true, run, rids: ids };
|
|
108
114
|
}
|
|
109
115
|
|
|
116
|
+
/** A3-pre: a product with no goal PMOS can read gets the cheapest query its own goals name, saved on that one goal (lib/metric-source.js).
|
|
117
|
+
* → true when a query was saved (the records are read again). */
|
|
118
|
+
function saveCheapest(w, recs, F) {
|
|
119
|
+
const pick = MS.pickOf(recs, F);
|
|
120
|
+
if (!pick) return false;
|
|
121
|
+
try {
|
|
122
|
+
const save = deps.saveRecipe || ((ws, rid, recipe) => require(require('./repo-script.js').repoScript('records/index.js'))
|
|
123
|
+
.edit(deps.recordsDir(ws), 'kr-metrics', rid, { recipe }, { by: 'pmos:metric-source', via: 'server' }, MS.WHY));
|
|
124
|
+
const r = save(w, pick.rid, pick.recipe);
|
|
125
|
+
return !!(r && r.ok);
|
|
126
|
+
} catch (e) { warn('metric source save', e); return false; }
|
|
127
|
+
}
|
|
128
|
+
|
|
110
129
|
function stop(run) { const a = active.get(run); if (a && a.session && deps.stop) deps.stop(a.session); }
|
|
111
130
|
|
|
112
131
|
function tick({ now = Date.now(), env } = {}) {
|
|
@@ -124,7 +143,9 @@ function create(deps) {
|
|
|
124
143
|
const dir = deps.stateDirFor(w); if (!dir) continue;
|
|
125
144
|
lastScan.set(w.id, now);
|
|
126
145
|
let recs = []; try { recs = deps.records(w) || []; } catch (e) { warn('metric read records', e); continue; }
|
|
127
|
-
const
|
|
146
|
+
const F = MR.read(dir);
|
|
147
|
+
if (saveCheapest(w, recs, F)) { try { recs = deps.records(w) || []; } catch (e) { warn('metric read records', e); continue; } }
|
|
148
|
+
const due = MR.dueOf(recs, F, now, { only, hours });
|
|
128
149
|
if (!due.length) continue;
|
|
129
150
|
const r = start({ ws: w.id, rids: due.slice(0, PER_RUN), why: 'due', now });
|
|
130
151
|
if (r.ok) return { started: w.id, rids: r.rids };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* metric-source.js — the cheapest way to read one goal (bet A3-pre, initiative one-goal-read-per-product; critic F2: 0 readings on 5 of 5
|
|
3
|
+
* test products). PURE: no file, no clock, no network. lib/metric-read-runs.js saves what it picks; lib/metric-drafts.js keepFields uses it
|
|
4
|
+
* when the PM keeps a draft that names its source and has no recipe.
|
|
5
|
+
*
|
|
6
|
+
* trackerRecipeOf(goal) → recipe | null the query a goal's own words name, in the recipe shape of lib/metric-drafts.js recipeOf.
|
|
7
|
+
* goal: { source, metric | name, type, why? }. Only a tracker source (Jira) gives one:
|
|
8
|
+
* a "Done or not" goal that names an issue key key = ABC-123, counted 1 when done, 0 while open
|
|
9
|
+
* a Count goal that names a project, no issue project = ABC AND created >= -<window>d [AND issuetype = Bug]
|
|
10
|
+
* The window is the goal's own ("per 8 weeks" → 56 days, "30 days" → 30), else 28 days. Analytics, a sheet,
|
|
11
|
+
* a typed goal or any other type gets null: the review run (lib/metric-draft-runs.js gapsOf) drafts its fix.
|
|
12
|
+
* pickOf(records, F) → { rid, recipe } | null the ONE goal of a product to save a query on. null when a live goal already has a
|
|
13
|
+
* query that has not failed its last try (F: lib/metric-reads.js fold, optional), or when no goal's source
|
|
14
|
+
* gives one. Order: north-star, kr, program-goal, success, input, the rest; a retired or watch goal never.
|
|
15
|
+
* WHY the why on the record's edit line
|
|
16
|
+
*
|
|
17
|
+
* Why the tracker first: the read is one saved query through the PM's own tracker connection. It needs no event, no analytics setup and no
|
|
18
|
+
* PM time (proof pmos-ideas/proofs/A3-pre: three goals that named Jira read in one query each).
|
|
19
|
+
*/
|
|
20
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
21
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
22
|
+
const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
23
|
+
|
|
24
|
+
const WHY = 'PMOS saved the cheapest query this goal names, so it is read every day';
|
|
25
|
+
const ORDER = ['north-star', 'kr', 'program-goal', 'success', 'input'];
|
|
26
|
+
const DEFAULT_DAYS = 28;
|
|
27
|
+
const TRACKER_RE = /\bjira\b/i;
|
|
28
|
+
const KEY_RE = /\b([A-Z][A-Z0-9_]{1,9})-(\d{1,7})\b/;
|
|
29
|
+
const PROJECT_RE = /^[\s:·,-]*(?:project\s+)?([A-Z][A-Z0-9_]{1,9})\b(?!-\d)/i; // right after the word Jira
|
|
30
|
+
const BUG_RE = /\bbugs?\b|\bdefects?\b/i;
|
|
31
|
+
|
|
32
|
+
/** The days a goal counts over, from its own words; DEFAULT_DAYS when it names none. */
|
|
33
|
+
function windowDays(text) {
|
|
34
|
+
const t = str(text);
|
|
35
|
+
let m = /(\d{1,3})\s*weeks?\b/i.exec(t); if (m && +m[1] > 0) return Math.min(+m[1] * 7, 366);
|
|
36
|
+
m = /(\d{1,3})\s*days?\b/i.exec(t); if (m && +m[1] > 0) return Math.min(+m[1], 366);
|
|
37
|
+
if (/\bper\s+(?:a\s+)?week\b|\bweekly\b/i.test(t)) return 7;
|
|
38
|
+
if (/\bper\s+(?:a\s+)?month\b|\bmonthly\b/i.test(t)) return 30;
|
|
39
|
+
return DEFAULT_DAYS;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function trackerRecipeOf(goal) {
|
|
43
|
+
if (!isObj(goal)) return null;
|
|
44
|
+
const source = str(goal.source), name = one(goal.metric || goal.name, 120), type = str(goal.type);
|
|
45
|
+
if (!TRACKER_RE.test(source)) return null;
|
|
46
|
+
const key = KEY_RE.exec(source);
|
|
47
|
+
if (type === 'Done or not' || (!type && str(goal.unit) === 'done')) {
|
|
48
|
+
if (!key) return null;
|
|
49
|
+
const k = key[0];
|
|
50
|
+
return { connector: 'Jira', query: `key = ${k}`, cadence: 'daily',
|
|
51
|
+
counts: { what: `1 when ${k} is in a done status, 0 while it is open`, num_label: '', den_label: '' } };
|
|
52
|
+
}
|
|
53
|
+
if (type === 'Count') {
|
|
54
|
+
if (key) return null; // one ticket is not a count
|
|
55
|
+
const after = source.slice(source.search(TRACKER_RE) + 4), p = PROJECT_RE.exec(after);
|
|
56
|
+
if (p && !/^[A-Z][A-Z0-9_]*$/.test(p[1])) return null; // a project key is upper case: "Jira board" names none
|
|
57
|
+
if (!p) return null;
|
|
58
|
+
const days = windowDays([name, source, str(goal.why)].join(' ')), bugs = BUG_RE.test(name);
|
|
59
|
+
return { connector: 'Jira', query: `project = ${p[1]}${bugs ? ' AND issuetype = Bug' : ''} AND created >= -${days}d`, cadence: 'daily',
|
|
60
|
+
counts: { what: `${bugs ? 'Bugs' : 'Issues'} created in ${p[1]} in the last ${days} days${name ? ` that match the goal "${name}"` : ''}`, num_label: '', den_label: '' } };
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const live = (r) => isObj(r) && r.retired !== true && r.role !== 'watch';
|
|
66
|
+
const rank = (r) => { const i = ORDER.indexOf(r.role); return i < 0 ? ORDER.length : i; };
|
|
67
|
+
/** A goal whose query has not failed its last try reads already. */
|
|
68
|
+
function reads(rec, F) {
|
|
69
|
+
if (!(isObj(rec.recipe) && rec.recipe.connector && rec.recipe.query)) return false;
|
|
70
|
+
const x = F && F.rids && F.rids.get(rec.rid);
|
|
71
|
+
return !(x && x.last && x.last.ok === false);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function pickOf(records, F) {
|
|
75
|
+
const R = (records || []).filter(live);
|
|
76
|
+
if (R.some((r) => reads(r, F))) return null;
|
|
77
|
+
const order = R.map((r, i) => ({ r, i })).sort((a, b) => rank(a.r) - rank(b.r) || a.i - b.i);
|
|
78
|
+
for (const { r } of order) {
|
|
79
|
+
if (isObj(r.recipe) && r.recipe.connector) continue; // its own query failed: its fix is drafted, never overwritten here
|
|
80
|
+
const recipe = trackerRecipeOf(r);
|
|
81
|
+
if (recipe) return { rid: r.rid, recipe };
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = { trackerRecipeOf, pickOf, windowDays, WHY, DEFAULT_DAYS };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.675.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.675.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -21,7 +21,8 @@ Rules that always hold:
|
|
|
21
21
|
6. NO EVENT, NO NUMBER. When no event counts a metric, file it with `"now": null` and a ticket: `"ticket": { "key": "<PROJECT>-<n> drafted", "text": "<the event to add, its name and its properties>" }`. Say it in `why`, for example "No event to count it. Ticket MS-212 drafted."
|
|
22
22
|
7. A TARGET HAS A REASON. Base it on the baseline and on past launches (what the same kind of change did before). `why` says that reason in one line.
|
|
23
23
|
8. DO NOT DRAFT AGAIN what the PM kept or dropped, unless the evidence is new.
|
|
24
|
-
9.
|
|
24
|
+
9. SAVE THE QUERY. Every row whose source can be queried carries `"recipe": { "connector", "query", "cadence": "daily" }`, so PMOS reads it every day from the PM's ✓. Use the cheapest source that measures the same thing: the tracker first (a Jira query: `key = ABC-123` for a done-or-not goal, `project = ABC AND created >= -56d` for a count), then analytics, then a sheet. Name the source in `source` the same way ("Jira ABC-123 status", "Jira ABC"). A row with no source that can be queried has no recipe.
|
|
25
|
+
10. PLAIN WORDS. First person, short sentences, no praise and no blame. Name a metric in a few words, the way a PM says it: "Weekly signed-in shoppers", not "WSS (7d)".
|
|
25
26
|
|
|
26
27
|
Procedure:
|
|
27
28
|
1. Run `pmos metrics draft read "<source>" --found "<what it says, one line>"` for each source as you read it. Read in this order, and skip what does not exist:
|
|
@@ -31,7 +32,7 @@ Procedure:
|
|
|
31
32
|
- a quarter start: last quarter's key results, their readings and how each one ended.
|
|
32
33
|
Use `--state now` while you read a source and `--state done` when you finish it. A source you cannot read: `--state wait`, and say so in your answer.
|
|
33
34
|
2. Run `pmos metrics draft step shape`. Decide the rows. File each with `pmos metrics draft row --json -`:
|
|
34
|
-
`{ "group", "name", "type", "now", "nowTxt", "target", "targetTxt", "by", "why", "source", "ticket", "direction" }`.
|
|
35
|
+
`{ "group", "name", "type", "now", "nowTxt", "target", "targetTxt", "by", "why", "source", "recipe", "ticket", "direction" }`.
|
|
35
36
|
- type is one of Count, Percentage, Amount, Duration, Done or not, Stay within. A guardrail that must not get worse is Stay within, with the limit as its target and `"direction": "down"` for a ceiling or `"up"` for a floor.
|
|
36
37
|
- nowTxt and targetTxt are short: "38.8k", "94.1%", "45k by Dec 31", "Stays under 1.2 s".
|
|
37
38
|
- by is YYYY-MM-DD. For an initiative, "Proves it worked" is read 4 weeks after release: the release day from the plan plus 28 days. With no release day, use the last day of this quarter and say so in why.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "A3-pre one goal read per product (pure, node): lib/metric-source.js, its save step in lib/metric-read-runs.js tick, and keepFields in lib/metric-drafts.js.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"metric-source.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"metric-source.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|