create-pmos 0.777.0 → 0.779.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 +45 -27
- 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 +44 -0
- package/workspace/guide/agent-capabilities.md +3 -2
- package/workspace/guide/cli.md +3 -0
- package/workspace/guide/settings-and-switches.md +1 -1
- package/workspace/lib/grill-runs.js +1 -1
- package/workspace/lib/job-graph.js +4 -0
- package/workspace/lib/orchestrator-keeprate.js +3 -2
- package/workspace/lib/outcome-props.js +72 -9
- package/workspace/lib/outcomes-cli.js +14 -2
- package/workspace/lib/outcomes.js +68 -9
- package/workspace/lib/proposal-runs.js +6 -1
- package/workspace/lib/propose-cli.js +40 -1
- package/workspace/lib/report-readers.js +216 -0
- package/workspace/lib/settings-store.js +3 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/grill-words.js +6 -2
- package/workspace/public/pm/readonly.js +2 -2
- package/workspace/server.js +6 -0
- package/workspace/skills/initiative-propose.skill +8 -2
- package/workspace/test-lists/outcome-drafts-land.json +9 -0
- package/workspace/test-lists/report-reader-review.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.779.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,50 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.779.0",
|
|
38
|
+
"at": "2026-11-24T15:18:38.678Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1743,
|
|
43
|
+
"t": "PMOS reads each report draft as the CFO, engineer and sceptic, questions under the ✦",
|
|
44
|
+
"s": "PMOS reads each report draft as the CFO, engineer and sceptic, questions under the ✦",
|
|
45
|
+
"k": "new",
|
|
46
|
+
"h": "PMOS reads each report draft as the CFO, engineer and sceptic, questions under the ✦",
|
|
47
|
+
"try": {
|
|
48
|
+
"steps": [
|
|
49
|
+
"Open Library and draft a report (or ask the chat: draft the weekly report)",
|
|
50
|
+
"Wait about a minute, then open Work and the ✦ on an initiative the report covers"
|
|
51
|
+
],
|
|
52
|
+
"see": "The ✦ lists up to 6 questions such as 'CFO asks: What does a slip of the cutover cost?', each quoting the report, with the smallest fix as its next step"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"v": "0.778.0",
|
|
59
|
+
"at": "2026-11-24T14:17:30.065Z",
|
|
60
|
+
"f": 4,
|
|
61
|
+
"prs": [
|
|
62
|
+
{
|
|
63
|
+
"n": 1745,
|
|
64
|
+
"t": "Every live initiative gets an expected outcome and a check date",
|
|
65
|
+
"s": "Every live initiative gets an expected outcome and a check date",
|
|
66
|
+
"k": "new",
|
|
67
|
+
"h": "Every live initiative gets an expected outcome and a check date",
|
|
68
|
+
"try": {
|
|
69
|
+
"steps": [
|
|
70
|
+
"Open Work and open an initiative that had no expected outcome",
|
|
71
|
+
"Press its ✦ and find Expected outcome",
|
|
72
|
+
"Press Undo on it if it is wrong"
|
|
73
|
+
],
|
|
74
|
+
"see": "The initiative shows an expected outcome and a check date that PMOS drafted, with the line it came from, and Undo takes it back",
|
|
75
|
+
"open": "/premium-board.html"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
36
80
|
{
|
|
37
81
|
"v": "0.777.0",
|
|
38
82
|
"at": "2026-11-24T14:02:27.034Z",
|
|
@@ -404,32 +448,6 @@
|
|
|
404
448
|
}
|
|
405
449
|
}
|
|
406
450
|
]
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
"v": "0.759.0",
|
|
410
|
-
"at": "2026-11-24T02:32:35.299Z",
|
|
411
|
-
"f": 4,
|
|
412
|
-
"prs": [
|
|
413
|
-
{
|
|
414
|
-
"n": 1710,
|
|
415
|
-
"t": "Workflows stage panel follows the picked workspace; a removed pick never opens on a 404",
|
|
416
|
-
"s": "Workflows stage panel follows the picked workspace; a removed pick never opens on a 404",
|
|
417
|
-
"k": "fix"
|
|
418
|
-
}
|
|
419
|
-
]
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
"v": "0.758.0",
|
|
423
|
-
"at": "2026-11-24T02:19:59.803Z",
|
|
424
|
-
"f": 4,
|
|
425
|
-
"prs": [
|
|
426
|
-
{
|
|
427
|
-
"n": 1708,
|
|
428
|
-
"t": "A resumed chat's answer comes back to the chat panel",
|
|
429
|
-
"s": "A resumed chat's answer comes back to the chat panel",
|
|
430
|
-
"k": "fix"
|
|
431
|
-
}
|
|
432
|
-
]
|
|
433
451
|
}
|
|
434
452
|
]
|
|
435
453
|
}
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T15:18:35Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T15:18:35Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T15:18:35Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,48 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.779.0",
|
|
4
|
+
"at": "2026-11-24T15:18:38.678Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1743,
|
|
9
|
+
"t": "PMOS reads each report draft as the CFO, engineer and sceptic, questions under the ✦",
|
|
10
|
+
"s": "PMOS reads each report draft as the CFO, engineer and sceptic, questions under the ✦",
|
|
11
|
+
"k": "new",
|
|
12
|
+
"h": "PMOS reads each report draft as the CFO, engineer and sceptic, questions under the ✦",
|
|
13
|
+
"try": {
|
|
14
|
+
"steps": [
|
|
15
|
+
"Open Library and draft a report (or ask the chat: draft the weekly report)",
|
|
16
|
+
"Wait about a minute, then open Work and the ✦ on an initiative the report covers"
|
|
17
|
+
],
|
|
18
|
+
"see": "The ✦ lists up to 6 questions such as 'CFO asks: What does a slip of the cutover cost?', each quoting the report, with the smallest fix as its next step"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"v": "0.778.0",
|
|
25
|
+
"at": "2026-11-24T14:17:30.065Z",
|
|
26
|
+
"f": 4,
|
|
27
|
+
"prs": [
|
|
28
|
+
{
|
|
29
|
+
"n": 1745,
|
|
30
|
+
"t": "Every live initiative gets an expected outcome and a check date",
|
|
31
|
+
"s": "Every live initiative gets an expected outcome and a check date",
|
|
32
|
+
"k": "new",
|
|
33
|
+
"h": "Every live initiative gets an expected outcome and a check date",
|
|
34
|
+
"try": {
|
|
35
|
+
"steps": [
|
|
36
|
+
"Open Work and open an initiative that had no expected outcome",
|
|
37
|
+
"Press its ✦ and find Expected outcome",
|
|
38
|
+
"Press Undo on it if it is wrong"
|
|
39
|
+
],
|
|
40
|
+
"see": "The initiative shows an expected outcome and a check date that PMOS drafted, with the line it came from, and Undo takes it back",
|
|
41
|
+
"open": "/premium-board.html"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
2
46
|
{
|
|
3
47
|
"v": "0.777.0",
|
|
4
48
|
"at": "2026-11-24T14:02:27.034Z",
|
|
@@ -115,6 +115,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
|
|
|
115
115
|
| [New dates, done and tidy names](claude-proposes.md) | Each morning, and when a date passes | The tasks of the initiative, and the evidence that work happened | The initiative's ✦ | `PMOS_PROPOSE=off` |
|
|
116
116
|
| [Grill](claude-proposes.md) | Before an initiative leaves a stage, when a forecast turns at risk, when scope or dates move a lot, and once a month on running work with late work. Also when you write "grill this" in the initiative's chat. | The initiative, your stored research, your meeting notes and the decisions that stand | "PMOS grilled it" under the initiative's ✦ | Settings › Checks: Off. `PMOS_GRILL=off` |
|
|
117
117
|
| [You decided this before](claude-proposes.md) | You add an initiative that repeats an earlier decision | `DECISIONS.md`, the decision records, the PM journal, `planning/out-of-scope/` and the initiative records | The initiative's ✦ | `pmos ai off past-repeat` |
|
|
118
|
+
| [Report readers](claude-proposes.md) | A report draft is written | The draft, read as the CFO, the engineering lead and the sceptic | The ✦ of each initiative the question quotes | `pmos ai off report-readers` |
|
|
118
119
|
| [Initiative descriptions](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's first Problem or Why paragraph, or the record's own first paragraph | "Description" under the initiative's ✦ | `pmos ai off descriptions`. `PMOS_DESCRIPTIONS=off` |
|
|
119
120
|
| [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. When a check date passes: the verdict, from the goal's reading or one short run. | The PRD's success criteria, or the anchored key result. For a verdict: the goal's reading, or the lines the run cites | "Expected outcome" under the initiative's ✦. A verdict is recorded with Undo. Your move when PMOS cannot tell. | `pmos ai off outcomes`. `PMOS_OUTCOMES=off` |
|
|
120
121
|
| [Metric drafts](claude-proposes.md) | A product with no North Star, the first 14 days of a quarter, a program with no goal, and an initiative that gets a PRD | The last 8 weeks of real readings | The page of that product, program or initiative | `PMOS_METRIC_DRAFT=off` |
|
|
@@ -164,7 +165,7 @@ When you ask an agent session to do a piece of work, it can finish it, including
|
|
|
164
165
|
- `pmos ai log [<job>]`: the last audit lines. Each dropped proposal shows why.
|
|
165
166
|
- `pmos ai off [<job>]` and `pmos ai on [<job>]`: turn every AI job, or one job, off or on. `PMOS_AI=off` in the environment wins over the setting.
|
|
166
167
|
|
|
167
|
-
The AI jobs are `past-repeat`, `decision-memory`, `outcomes`, `descriptions`, `drift`, `rehearse`, `next-prompt`, `sharpen-prompt`, `idle-lab` and `live-round` (`pmos ai off live-round` stops new live rounds; one that runs ends by itself). The switch also covers each job in the queue by its queue name: `schedules`, `proactive`, `prepare`, `day`, `refresh`, `reports`, `meeting-prewarm`, `driver`, `goal-loops`, `finder`, `coredocs`, `milestones`, `propose`, `grill`, `metric-drafts`, `impact`, `metric-reads`, `forecast`, `report-design`, `report-structure`, `team`, `scan` and `idle-lab`. `pmos ai off` with no job stops all of them. Git sync uses no model, so the switch does not stop it. A background run cannot change the switch.
|
|
168
|
+
The AI jobs are `past-repeat`, `report-readers`, `decision-memory`, `outcomes`, `descriptions`, `drift`, `rehearse`, `next-prompt`, `sharpen-prompt`, `idle-lab` and `live-round` (`pmos ai off live-round` stops new live rounds; one that runs ends by itself). The switch also covers each job in the queue by its queue name: `schedules`, `proactive`, `prepare`, `day`, `refresh`, `reports`, `meeting-prewarm`, `driver`, `goal-loops`, `finder`, `coredocs`, `milestones`, `propose`, `grill`, `metric-drafts`, `impact`, `metric-reads`, `forecast`, `report-design`, `report-structure`, `team`, `scan` and `idle-lab`. `pmos ai off` with no job stops all of them. Git sync uses no model, so the switch does not stop it. A background run cannot change the switch.
|
|
168
169
|
|
|
169
170
|
## The team of role agents
|
|
170
171
|
|
|
@@ -240,7 +241,7 @@ What each part does:
|
|
|
240
241
|
- **What the canvas can do.** The prototype runs in a sandboxed frame. It cannot reach PMOS. The canvas talks to it only to show a screen, point, pin, play and apply your edits.
|
|
241
242
|
- **Your prototype rules.** After a version renders and before it opens, PMOS checks it against your prototype rules: no device or browser frame, no instructions on the screen, no sample copy, and each rule PMOS learns from your corrections. When a correction is true of every prototype (for example "no device frame"), the chat adds it as a rule (`pmos lab rule add`). PMOS keeps a rule only when it fails a bad example and passes a good one, so a button such as "See the week" is never read as an instruction. A change to one version ("make the alert orange") or a taste ("calmer") never becomes a rule. A version that breaks a rule gets one fix run, given only the lines that broke it. You see only the fixed version, with one quiet line: "PMOS fixed 3 things before showing you this." When the fix does not reach a rule, the version still opens and the line names the rule it breaks. When nothing was fixed, there is no line. Settings › Prototype rules lists the rules with Undo.
|
|
242
243
|
- **The design critic.** After the prototype rules, a separate read-only session reads the version's desk and phone screenshots and its page against every standing design rule of your product. Each rule is a named check: each numbered principle in your design principles and each rule in your `design-rules.json`. A finding must name the rule it breaks, so the critic reports broken rules, not taste. Its findings go into the same one fix run. After the fix it reads only those rules again, so "PMOS fixed n things" is never claimed unchecked. A critic that cannot run never holds the version. `pmos lab critic` runs it on any screenshots, and `PMOS_CRITIC=off` turns it off.
|
|
243
|
-
- **The sceptical reviewer.** Before you share a document, the chat's agent runs `pmos critic <file>`: a separate read-only session reads it as a sceptical reviewer and lists at most 3 hard questions. Each names its lens, quotes the document and gives the smallest fix; a question whose quote is not in the document is dropped. For a report or an update that goes to leadership, it runs `pmos critic <file> --as all`: the same pass reads it as the CFO (cost, return, the cost of a slip), the engineering lead (can it be built as written, what it waits on, who builds it) and the sceptic, at most 2 questions each. `pmos critic stats` shows how many you called real, for each reader, and the gaps that repeat across documents.
|
|
244
|
+
- **The sceptical reviewer.** Before you share a document, the chat's agent runs `pmos critic <file>`: a separate read-only session reads it as a sceptical reviewer and lists at most 3 hard questions. Each names its lens, quotes the document and gives the smallest fix; a question whose quote is not in the document is dropped. For a report or an update that goes to leadership, it runs `pmos critic <file> --as all`: the same pass reads it as the CFO (cost, return, the cost of a slip), the engineering lead (can it be built as written, what it waits on, who builds it) and the sceptic, at most 2 questions each. `pmos critic stats` shows how many you called real, for each reader, and the gaps that repeat across documents. PMOS also does this by itself for every report draft: once a draft is written, the same pass reads it as all three readers, and each question that quotes an initiative's part of the report shows under that initiative's ✦ as "CFO asks: …", with the smallest fix as its next step (✓ adds it as a task, ✕ drops it). The same text is read once. `pmos ai off report-readers` stops it.
|
|
244
245
|
- **No time limit.** A version takes as long as the ask needs. While PMOS makes it, the Viewer shows what it is doing now (for example "Building screen 3 of 7"), the steps done, a progress bar and the time so far, with a Stop press. A run that writes nothing for 10 minutes is stuck: PMOS stops it. A version that does not render, that is stuck or that you stop is "not made" with the reason, and the chat says so. The Viewer still opens it: it says why and shows the version it was made from. While a version is being made, a new ask on the same initiative waits: PMOS says what is running.
|
|
245
246
|
- **Lessons.** Each change sentence, ✓ and ✕ is a Lessons line of the experiment (`pmos artefacts show`). Each version that rendered is a Specimens line. The one you keep is the kept specimen.
|
|
246
247
|
- **The grill runs after the session, not during it.** When you keep a version, the grill runs once on the kept specimen, as the Review step. Its findings wait under the ✦ (D60 as amended on 2026-11-17).
|
package/workspace/guide/cli.md
CHANGED
|
@@ -170,6 +170,7 @@ PMOS's background run files proposals with these commands. The server pins the i
|
|
|
170
170
|
- `pmos propose done --json <file|->`: a task that looks done, with the evidence.
|
|
171
171
|
- `pmos propose name --json <file|->`: tidy names.
|
|
172
172
|
- `pmos propose verdict --json <file|->`: whether an initiative's expected outcome worked, once its check date has passed, with cited evidence. Only the outcome check run can file it. `cant-tell` files nothing, and the check stays with you.
|
|
173
|
+
- `pmos propose outcome --json <file|->`: an expected outcome for an initiative that has none, with cited claims and an optional check date. Only PMOS's outcome-draft run can file it, and only while the record has no outcome. PMOS applies it, and Undo takes it back.
|
|
173
174
|
- `pmos propose status`: what is open, kept and dropped.
|
|
174
175
|
- `pmos propose loose <link|merge|finish|start> --json <file|->`: the clean-up of the work that is not in an initiative. Only the clean-up run can file these, and that run files nothing else. `pmos propose loose status` shows what is open and kept.
|
|
175
176
|
|
|
@@ -369,6 +370,7 @@ Run them in the product's repository, or pass `--root <dir>`.
|
|
|
369
370
|
- `pmos outcomes test <id> --test "<text>" [--method data-count|fake-door|concierge|other] [--result planned|holds|fails|unclear] [--evidence "<text>"]` records the smallest test that could kill a ranked bet before it is built, and what the test showed. A result other than `planned` needs evidence. When the bet already has a named test, `--test` can be left out.
|
|
370
371
|
- `pmos outcomes tests [--count]` lists the ranked bets with no smallest test, the tests that wait for a result, and the results. `--count` prints the number of bets with a result in the last 14 days.
|
|
371
372
|
- `pmos outcomes rate [--days <n>]` shows how many outcome checks came due in the last n days (30 by default) and at least 2 days ago, how many got a verdict within 2 days of their check date, and how many of those PMOS recorded by itself. The last line is that percent. It changes nothing.
|
|
373
|
+
- `pmos outcomes coverage` shows how many live initiatives (not cancelled, paused or on hold) name an expected outcome and how many also have a check date. The last line is the percent with both. It changes nothing.
|
|
372
374
|
- `pmos outcomes live --where <place> --version <version>` records the version a place runs now, for example after a deploy. When a record says `shipped_in: "<version>"` and `measured_on: "<place>"`, and that place still runs an older version, its outcome check shows as blocked with the step to fix it. PMOS does not ask for a verdict until the place runs the change.
|
|
373
375
|
- When you record `didnt-work`, the initiative shows **At risk** on every page, with the check as the reason. PMOS compares the evidence with the kill condition and files one next step under the initiative's ✦. If the evidence meets the kill condition, PMOS suggests that you stop the initiative. If this is the second check that did not work, it suggests a new experiment. Otherwise it suggests one more round with a new check date. Work's Next column asks you the same question. Nothing happens until you press ✓. Undo reverses the step.
|
|
374
376
|
- `pmos outcomes propose` also reads the experiment's hypothesis. When the hypothesis names a different KR from the initiative's anchor, the draft tells you.
|
|
@@ -875,6 +877,7 @@ The benchmark needs a signed-in agent CLI. It never pushes and never opens a pul
|
|
|
875
877
|
- `pmos jira criteria-ask <initiative> [KEY …]` says yes to them. Tickets assigned to you get the criteria in Jira; the others go to the draft for their owners.
|
|
876
878
|
- `pmos jira criteria-asks [--direct|--draft|--health]` lists the criteria asks that wait for Jira, prints the draft by owner, or prints the health number.
|
|
877
879
|
- `pmos jira criteria-done <ask id>` or `--refused "<why>"` records the answer for one criteria ask.
|
|
880
|
+
- `pmos jira criteria-reach [--count]`: how many open tickets get acceptance criteria, from the done test and from the initiative's files.
|
|
878
881
|
- `pmos jira criteria <initiative>`: the done-test checks each ticket carries as acceptance criteria, and the checks on no ticket
|
|
879
882
|
- `pmos jira digest [--since <YYYY-MM-DD or time>]`: what moved in the tracker since the last working day, who moved it, the moved tickets with no task in PMOS, and what is worth a question (blocked, reopened, nobody assigned, stuck, not in the last read). It reads only the stored Jira reads. The daily Jira read also asks Jira for every status change in the projects PMOS reads, so a ticket no initiative or task names is in the digest too, under "Not in PMOS yet".
|
|
880
883
|
|
|
@@ -120,7 +120,7 @@ An "off" switch accepts `off`, `0`, `false` or `no` unless the row says a differ
|
|
|
120
120
|
|---|---|---|---|
|
|
121
121
|
| `PMOS_HEADLESS` | `off` sends every background job back to a terminal pane. | on | — |
|
|
122
122
|
| `PMOS_AI` | `off` turns every AI job off (the kill switch of [what agents may do](agent-capabilities.md)). | on | `pmos ai off` (the `ai.on` setting) |
|
|
123
|
-
| `PMOS_AI_<JOB>` | `off` turns one AI job off. The names are `PMOS_AI_PAST_REPEAT`, `PMOS_AI_DECISION_MEMORY`, `PMOS_AI_OUTCOMES`, `PMOS_AI_DESCRIPTIONS`, `PMOS_AI_DRIFT`, `PMOS_AI_REHEARSE`, `PMOS_AI_NEXT_PROMPT`, `PMOS_AI_SHARPEN_PROMPT` and `PMOS_AI_IDLE_LAB`. | on | `pmos ai off <job>` (the `ai.off` setting) |
|
|
123
|
+
| `PMOS_AI_<JOB>` | `off` turns one AI job off. The names are `PMOS_AI_PAST_REPEAT`, `PMOS_AI_REPORT_READERS`, `PMOS_AI_DECISION_MEMORY`, `PMOS_AI_OUTCOMES`, `PMOS_AI_DESCRIPTIONS`, `PMOS_AI_DRIFT`, `PMOS_AI_REHEARSE`, `PMOS_AI_NEXT_PROMPT`, `PMOS_AI_SHARPEN_PROMPT` and `PMOS_AI_IDLE_LAB`. | on | `pmos ai off <job>` (the `ai.off` setting) |
|
|
124
124
|
| `PMOS_CRITIC` | `off` stops the design critic and the sceptical reviewer: no critic reads a prototype version before it opens, and `pmos lab critic` and `pmos critic` refuse. The prototype rules still run. | on | — |
|
|
125
125
|
| `PMOS_AUTONOMY` | `off` stops every change PMOS applies by itself (D106) and every goal loop; proposals still wait for your ✓. | on | `pmos ai off` |
|
|
126
126
|
| `PMOS_BUILD_SANDBOX` | `docker` or `podman` runs `pmos build check` in a container with no network (the image is `check.image` in `pmos/factory.json`). Without it the check runs in the worktree, and only you can run it. | off | — |
|
|
@@ -106,7 +106,7 @@ function create(deps) {
|
|
|
106
106
|
const row = (deps.rowOf && deps.rowOf(w, ini)) || {};
|
|
107
107
|
const lines = PR.readLines(PR.ledgerFile(dir)), P = PR.fold(lines), kept = PR.keptIds(P);
|
|
108
108
|
// the learning edge (OS evaluation T1): the last 3 reasons the PM gave this job on this initiative, ✕ why and ✎ rewrites
|
|
109
|
-
const lessons = PR.lessonsOf(lines, { ini, match: (p) => p.group === 'grill' && p.type !== 'past' && p.type !== 'decision', n: 3, wide: true });
|
|
109
|
+
const lessons = PR.lessonsOf(lines, { ini, match: (p) => p.group === 'grill' && p.type !== 'past' && p.type !== 'decision' && p.type !== 'reader', n: 3, wide: true });
|
|
110
110
|
const mine = [...P.props.values()].filter((p) => p.ini === ini && p.group === 'grill');
|
|
111
111
|
const dropped = mine.filter((p) => P.drops.has(PR.sigOf(p))).slice(0, 20).map((p) => one(p.title, 120));
|
|
112
112
|
const open = mine.filter((p) => !P.drops.has(PR.sigOf(p)) && !kept.has(p.id)).slice(0, 20).map((p) => one(p.title, 120));
|
|
@@ -45,6 +45,9 @@ const LEDGERS = Object.freeze({
|
|
|
45
45
|
'<runtime>/grill-runs.jsonl': { concept: 'grill-spend', owner: 'lib/grill.js', readers: [
|
|
46
46
|
r('lib/bg-queue.js', 'grill-runs.jsonl', 'the spend limit that holds step 5'),
|
|
47
47
|
r('lib/routes-grill.js', null, "Settings › PMOS's checks: this month's spend")] },
|
|
48
|
+
'<runtime>/spec-critic.jsonl': { concept: 'critic-runs', owner: 'lib/spec-critic.js', readers: [
|
|
49
|
+
r('lib/critic-cli.js', 'SC.stats', '`pmos critic stats` and `pmos critic show`: each pass, its readers and the PM\'s real or noise labels'),
|
|
50
|
+
r('lib/report-readers.js', 'SC.latest', 'a report draft whose text was already read is not read again')] },
|
|
48
51
|
'<runtime>/goal-loops.jsonl': { concept: 'goal-loops', owner: 'lib/goal-loop.js', readers: [
|
|
49
52
|
r('lib/loop-cli.js', null, '`pmos loop status`: each goal, its round and its state')] },
|
|
50
53
|
'<state>/autonomy.jsonl': { concept: 'autonomy', owner: 'lib/autonomy.js', readers: [
|
|
@@ -167,6 +170,7 @@ const JOBS = Object.freeze([
|
|
|
167
170
|
q('live-round', 'lib/live-round.js', [props], [props], 'step 1: the PM\'s ✓ or `pmos lab round` starts it at once; three runs, each file proven before it shows; it also adds Specimens and Lessons lines (lib/artefacts.js)'),
|
|
168
171
|
q('meeting-prewarm', 'lib/live-round-meeting.js', ['<runtime>/idle-lab/meeting-prewarm.jsonl'], [props, 'calendar', '<runtime>/meeting-material.jsonl'], 'round 1 itself is filed by lib/live-round.js (W1)'),
|
|
169
172
|
ai('past-repeat', 'lib/past-repeat.js', [props], ['repo:DECISIONS.md']),
|
|
173
|
+
ai('report-readers', 'lib/report-readers.js', [props, '<runtime>/spec-critic.jsonl'], ['report drafts']), // report-reader-review: each report draft read as the CFO, the engineer and the sceptic
|
|
170
174
|
ai('decision-memory', 'lib/decision-memory.js', [props], ['repo:DECISIONS.md']),
|
|
171
175
|
ai('outcomes', 'lib/outcome-props.js', [props, '<state>/outcome-runs.jsonl'], ['initiative records', 'repo:planning/runs/outcome_checks.jsonl', '<state>/metric-reads.jsonl']),
|
|
172
176
|
ai('descriptions', 'lib/description-props.js', [props], ['initiative records']),
|
|
@@ -75,6 +75,7 @@ const JOBS = Object.freeze([
|
|
|
75
75
|
{ job: 'grill', label: 'Grill' },
|
|
76
76
|
{ job: 'past-repeat', label: 'You decided this before' },
|
|
77
77
|
{ job: 'decision-memory', label: 'Decision memory' },
|
|
78
|
+
{ job: 'report-readers', label: 'Report readers' },
|
|
78
79
|
{ job: 'descriptions', label: 'Descriptions' },
|
|
79
80
|
{ job: 'outcomes', label: 'Expected outcomes' },
|
|
80
81
|
{ job: 'idle-lab', label: 'Idle lab' },
|
|
@@ -82,10 +83,10 @@ const JOBS = Object.freeze([
|
|
|
82
83
|
]);
|
|
83
84
|
const GROUP_JOB = { found: 'found-elsewhere', dates: 'dates', status: 'looks-done', names: 'names', description: 'descriptions', outcome: 'outcomes',
|
|
84
85
|
prototyped: 'idle-lab', improved: 'idle-lab', scanned: 'idle-lab' };
|
|
85
|
-
/** The ✦ job of a proposal { group, type }: a grill finding of type past or
|
|
86
|
+
/** The ✦ job of a proposal { group, type }: a grill finding of type past, decision or reader is its own job. null: not a ✦ job. */
|
|
86
87
|
function jobOf(p) {
|
|
87
88
|
if (!p) return null;
|
|
88
|
-
if (p.group === 'grill') return p.type === 'past' ? 'past-repeat' : p.type === 'decision' ? 'decision-memory' : 'grill';
|
|
89
|
+
if (p.group === 'grill') return p.type === 'past' ? 'past-repeat' : p.type === 'decision' ? 'decision-memory' : p.type === 'reader' ? 'report-readers' : 'grill';
|
|
89
90
|
// the live round (lib/live-round.js): its ✦ ask, and a round it made (data.live), are its own job, apart from the idle lab
|
|
90
91
|
if (p.group === 'live' || ((p.group === 'prototyped' || p.group === 'improved') && p.data && p.data.live)) return 'live-round';
|
|
91
92
|
return GROUP_JOB[p.group] || null;
|
|
@@ -37,9 +37,17 @@
|
|
|
37
37
|
* scan `blocked`) is not due: it is never judged and starts no run. The pass logs one `[outcome-blocked]` line when a check becomes blocked
|
|
38
38
|
* (per check and version pair) and one when it clears, so the health number and its dates can be read from the server log.
|
|
39
39
|
*
|
|
40
|
+
* KEPT BUT NEVER WRITTEN (outcome-drafts-land). A kept outcome or date ✦ whose keep wrote nothing, on a record that still lacks it
|
|
41
|
+
* (lostKeeps), is filed once more under its `again` id by the daily pass, so the auto-keep writes it now.
|
|
42
|
+
*
|
|
43
|
+
* NOTHING TO CITE (outcome-drafts-land). Every tick in the hours the PM allows, an initiative that has no PRD line, hypothesis, record line or
|
|
44
|
+
* KR line to draft from gets ONE propose run (deps.startDraft → lib/proposal-runs.js why `outcome-draft`, the run kind the outcome check
|
|
45
|
+
* uses), once per initiative ever, and only once that product's outcome drafts passed the guard's replay. The run files `pmos propose outcome` (lib/propose-cli.js): cited and quote-checked, class B with Undo.
|
|
46
|
+
*
|
|
40
47
|
* deps: { workspaces() → [w], isLead(w), stateDirFor(w), boardOf(w, id) → board id | null, runtime() → the per-user state folder, open(now),
|
|
41
48
|
* env, every (ms, its own timer), mayRun(), warn(what, err),
|
|
42
|
-
* recordsDir(w)? → the goal records folder, startRun(w, { ini, board, it, why, now })? → { ok, run } | { ok: false, held?, error }
|
|
49
|
+
* recordsDir(w)? → the goal records folder, startRun(w, { ini, board, it, why, now })? → { ok, run } | { ok: false, held?, error },
|
|
50
|
+
startDraft(w, { ini, board, it, now })? → { ok, run } | { ok: false, held?, error } }
|
|
43
51
|
*/
|
|
44
52
|
const crypto = require('crypto');
|
|
45
53
|
const fs = require('fs');
|
|
@@ -58,9 +66,11 @@ const typeOf = (d) => (d.data.kind === 'undated' ? 'date' : d.data.kind === 'ref
|
|
|
58
66
|
const J = require('./outcome-judge.js');
|
|
59
67
|
const RUNS = 'outcome-runs.jsonl'; // <state>/outcome-runs.jsonl: one line per outcome run started { ini, horizon, run, at }
|
|
60
68
|
const RUNS_PER_PASS = 1; // a backlog of due checks starts one run per pass (the machine runs at most 2 at once)
|
|
69
|
+
const DRAFT = 'draft'; // the outcome-runs.jsonl horizon of a draft run (outcome-drafts-land): one per initiative, ever
|
|
70
|
+
const DRAFT_TAG = '[outcome-draft]';
|
|
61
71
|
|
|
62
72
|
/** The proposals line a draft becomes. */
|
|
63
|
-
function lineOf(d, board, run) {
|
|
73
|
+
function lineOf(d, board, run, { again = false } = {}) {
|
|
64
74
|
const type = typeOf(d), ini = d.data.initiative;
|
|
65
75
|
const sources = d.claims.flatMap((c) => c.sources).map((s) => ({ label: s.label, ref: s.ref }));
|
|
66
76
|
if (type === 'verdict' || type === 'source') {
|
|
@@ -82,7 +92,27 @@ function lineOf(d, board, run) {
|
|
|
82
92
|
const c = PR.clean('outcome', type, { title: type === 'date' ? 'A date to check the outcome' : 'What should change once it ships', why: d.say, sources,
|
|
83
93
|
items: [{ id: 'outcome', title: d.data.metric, due: d.data.horizon }], data: { metric: d.data.metric, horizon: d.data.horizon } });
|
|
84
94
|
if (c.error) return null;
|
|
85
|
-
return { kind: 'propose', ini, board, run, id: PR.idOf(ini, 'outcome', type, ''), ...c.prop };
|
|
95
|
+
return { kind: 'propose', ini, board, run, id: PR.idOf(ini, 'outcome', type, again ? 'again' : ''), ...c.prop };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The outcome drafts that were kept but never written (outcome-drafts-land: on idpf, 10 auto-keeps of 8 and 22 Nov wrote nothing, the
|
|
99
|
+
* agent:auto actor bug fixed in #1715). A keep that is not undone, holds an outcome new/date ✦ and wrote no `outcome` line, on a record that
|
|
100
|
+
* still lacks what it proposed. Such a ✦ is filed once more under its `again` id, so the auto-keep writes it now. → Set of ✦ ids */
|
|
101
|
+
function lostKeeps(F, S) {
|
|
102
|
+
const has = new Map((S.subjects || []).map((it) => [it.id, it]));
|
|
103
|
+
const out = new Set();
|
|
104
|
+
for (const k of F.kept || []) {
|
|
105
|
+
if (F.undone.has(k.batch) || (k.wrote || []).some((w) => w && w.op === 'outcome')) continue;
|
|
106
|
+
for (const id of k.ids || []) {
|
|
107
|
+
const p = F.props.get(id);
|
|
108
|
+
if (!p || p.group !== 'outcome' || (p.type !== 'new' && p.type !== 'date')) continue;
|
|
109
|
+
const it = has.get(p.ini);
|
|
110
|
+
if (it && (p.type === 'new' ? !it.metric : !it.horizon)) out.add(id);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// a later keep of the same ✦ that did write takes it off
|
|
114
|
+
for (const k of F.kept || []) if (!F.undone.has(k.batch) && (k.wrote || []).some((w) => w && w.op === 'outcome')) for (const id of k.ids || []) out.delete(id);
|
|
115
|
+
return out;
|
|
86
116
|
}
|
|
87
117
|
|
|
88
118
|
/** One product's replay cases: its own drafts must all pass, and an initiative with nothing to cite gets no draft. */
|
|
@@ -103,7 +133,7 @@ function create(deps) {
|
|
|
103
133
|
const dir = deps.stateDirFor(w); if (!dir) return { ws: w.id, filed: 0, why: 'no state folder' };
|
|
104
134
|
const rt = deps.runtime && deps.runtime();
|
|
105
135
|
const S = ST.testScan(w.root, { today: localDay(now) });
|
|
106
|
-
const F = PR.read(dir), kept = PR.keptIds(F);
|
|
136
|
+
const F = PR.read(dir), kept = PR.keptIds(F), lost = lostKeeps(F, S);
|
|
107
137
|
// a record that has its outcome now: its open draft goes (zero is silence)
|
|
108
138
|
const has = new Map(S.subjects.map((it) => [it.id, it]));
|
|
109
139
|
for (const p of F.props.values()) {
|
|
@@ -117,11 +147,13 @@ function create(deps) {
|
|
|
117
147
|
const fresh = [];
|
|
118
148
|
for (const d of D) {
|
|
119
149
|
const board = deps.boardOf(w, d.data.initiative); if (!board) continue;
|
|
120
|
-
|
|
150
|
+
let l = lineOf(d, board, ''); if (!l) continue;
|
|
151
|
+
const again = lost.has(l.id);
|
|
152
|
+
if (again) { l = lineOf(d, board, '', { again: true }); if (!l) continue; } // kept before but never written: once more (lostKeeps)
|
|
121
153
|
const prev = F.props.get(l.id);
|
|
122
154
|
if (kept.has(l.id)) continue;
|
|
123
155
|
if (prev && (F.drops.has(PR.sigOf(prev)) || (prev.type === l.type && prev.data && prev.data.metric === l.data.metric && prev.data.test === l.data.test))) continue; // dropped for good, or filed already (a default date that moves a day is not news)
|
|
124
|
-
fresh.push({ d, board });
|
|
156
|
+
fresh.push({ d, board, again });
|
|
125
157
|
}
|
|
126
158
|
if (!fresh.length) return { ws: w.id, filed: 0 };
|
|
127
159
|
const AG = guardLib(); if (!AG) return { ws: w.id, filed: 0, why: 'the shared guard is not installed' };
|
|
@@ -132,10 +164,40 @@ function create(deps) {
|
|
|
132
164
|
}
|
|
133
165
|
const byId = new Map(fresh.map((x) => [x.d.id, x]));
|
|
134
166
|
const r = await AG.file({ job: O.JOB, version, run, root: w.root, stateDir: rt, refDir: dir, settingsDir: rt, env: deps.env || process.env, max: PER_DAY }, fresh.map((x) => x.d),
|
|
135
|
-
async (acc) => { for (const p of acc) { const x = byId.get(p.id); const l = x && lineOf(x.d, x.board, run); if (l) PR.append(dir, { by: 'agent:outcomes' }, l); } });
|
|
167
|
+
async (acc) => { for (const p of acc) { const x = byId.get(p.id); const l = x && lineOf(x.d, x.board, run, { again: x.again }); if (l) { PR.append(dir, { by: 'agent:outcomes' }, l); log(`${DRAFT_TAG} ${w.id} ${l.ini} filed ${l.type}${x.again ? ' again (kept before, never written)' : ''}`); } } });
|
|
136
168
|
return { ws: w.id, filed: (r.filed || []).length, held: !!r.held, off: r.off || null };
|
|
137
169
|
}
|
|
138
170
|
|
|
171
|
+
/** The initiatives with nothing to cite (lib/outcomes.js drafts `ask`, outcome-drafts-land): ONE propose run each (deps.startDraft →
|
|
172
|
+
* lib/proposal-runs.js why `outcome-draft`, the run kind the outcome check uses), which reads the record and its sources and files
|
|
173
|
+
* `pmos propose outcome`. Once per initiative, ever (<state>/outcome-runs.jsonl, horizon `draft`); at most RUNS_PER_PASS a pass; nothing
|
|
174
|
+
* while the outcomes switch is off. → { ws, runs } */
|
|
175
|
+
async function draftPass(w, { now = Date.now() } = {}) {
|
|
176
|
+
const dir = deps.stateDirFor(w); if (!dir || !deps.startDraft) return { ws: w.id, runs: 0 };
|
|
177
|
+
const S = O.scan(w.root, { today: localDay(now) });
|
|
178
|
+
const ask = O.drafts(S).ask;
|
|
179
|
+
if (!ask.length) return { ws: w.id, runs: 0 };
|
|
180
|
+
const AG = guardLib(), rt = deps.runtime && deps.runtime();
|
|
181
|
+
if (!AG || off(deps.env) || AG.off(O.JOB, { env: deps.env || process.env, settingsDir: rt })) return { ws: w.id, runs: 0, off: true };
|
|
182
|
+
// only a product whose outcome drafts already passed the guard's replay (runProduct): a new or scratch product starts no run first
|
|
183
|
+
if (!AG.ready(rt, O.JOB, versionOf(w))) return { ws: w.id, runs: 0, why: 'the outcome drafts have not passed the replay here yet' };
|
|
184
|
+
const started = runsOf(dir);
|
|
185
|
+
let runs = 0;
|
|
186
|
+
for (const a of ask) {
|
|
187
|
+
if (runs >= RUNS_PER_PASS) break;
|
|
188
|
+
if (started.has(a.id + '|' + DRAFT)) continue;
|
|
189
|
+
const board = deps.boardOf(w, a.id); if (!board) continue;
|
|
190
|
+
const it = S.subjects.find((x) => x.id === a.id) || a;
|
|
191
|
+
let r = null;
|
|
192
|
+
try { r = deps.startDraft(w, { ini: a.id, board, it, now }); } catch (e) { warn('outcome draft run ' + w.id, e); r = null; }
|
|
193
|
+
if (!r || !r.ok) { if (r && r.held) break; continue; }
|
|
194
|
+
try { fs.mkdirSync(dir, { recursive: true }); fs.appendFileSync(path.join(dir, RUNS), JSON.stringify({ ini: a.id, horizon: DRAFT, run: r.run || null, at: new Date(now).toISOString() }) + '\n'); } catch (e) { warn('outcome runs ledger', e); }
|
|
195
|
+
log(`${DRAFT_TAG} ${w.id} ${a.id} run ${r.run || ''} started: nothing to cite`);
|
|
196
|
+
runs++;
|
|
197
|
+
}
|
|
198
|
+
return { ws: w.id, runs };
|
|
199
|
+
}
|
|
200
|
+
|
|
139
201
|
/** A refuted outcome's next step (launch simulation W2): filed at the tick after the PM's verdict, not once a day. Quiet hours do not
|
|
140
202
|
* hold it back: the PM just recorded the verdict. One ✦ per check; a ✦ the PM kept or dropped is not filed again. */
|
|
141
203
|
async function refutedPass(w, { now = Date.now() } = {}) {
|
|
@@ -278,6 +340,7 @@ function create(deps) {
|
|
|
278
340
|
for (const w of deps.workspaces()) {
|
|
279
341
|
try { if (deps.isLead && !deps.isLead(w)) continue; } catch { continue; }
|
|
280
342
|
try { out.push(await duePass(w, { now })); } catch (e) { warn('outcomes due ' + w.id, e); }
|
|
343
|
+
try { out.push(await draftPass(w, { now })); } catch (e) { warn('outcomes draft ' + w.id, e); }
|
|
281
344
|
}
|
|
282
345
|
} finally { busy = false; }
|
|
283
346
|
return out;
|
|
@@ -303,7 +366,7 @@ function create(deps) {
|
|
|
303
366
|
const t = setInterval(() => { try { if (deps.mayRun && !deps.mayRun()) return; } catch { /* no lock: run */ } tick({}).catch((e) => warn('outcomes tick', e)); }, deps.every);
|
|
304
367
|
if (t.unref) t.unref();
|
|
305
368
|
}
|
|
306
|
-
return { tick, runProduct, refutedPass, duePass };
|
|
369
|
+
return { tick, runProduct, refutedPass, duePass, draftPass };
|
|
307
370
|
}
|
|
308
371
|
|
|
309
372
|
/** The outcome runs started, as `ini|horizon` keys (<state>/outcome-runs.jsonl). */
|
|
@@ -370,4 +433,4 @@ function waiting(root, stateDir, { today } = {}) {
|
|
|
370
433
|
return out;
|
|
371
434
|
}
|
|
372
435
|
|
|
373
|
-
module.exports = { create, cases, lineOf, off, waiting, runsOf, silentDraft, SILENT_AFTER, PER_DAY, RUNS };
|
|
436
|
+
module.exports = { create, cases, lineOf, lostKeeps, off, waiting, runsOf, silentDraft, SILENT_AFTER, PER_DAY, RUNS, DRAFT, DRAFT_TAG };
|
|
@@ -32,7 +32,7 @@ const { execFileSync } = require('child_process');
|
|
|
32
32
|
const O = require('./outcomes.js');
|
|
33
33
|
const ST = require('./smallest-test.js');
|
|
34
34
|
|
|
35
|
-
const COMMANDS = { outcomes: ['list', 'propose', 'declare', 'record', 'live', 'test', 'tests', 'rate'] };
|
|
35
|
+
const COMMANDS = { outcomes: ['list', 'propose', 'declare', 'record', 'live', 'test', 'tests', 'rate', 'coverage'] };
|
|
36
36
|
const USAGE = [
|
|
37
37
|
'usage: pmos outcomes list|propose|declare|record|live|test|tests — every initiative has an expected outcome and a date to check it',
|
|
38
38
|
' pmos outcomes list [--json] checks due, outcomes with no date, initiatives with no outcome; reads only',
|
|
@@ -44,6 +44,7 @@ const USAGE = [
|
|
|
44
44
|
' the smallest test that could kill a ranked bet, and what it showed',
|
|
45
45
|
' pmos outcomes tests [--count] [--json] ranked bets with no test, tests waiting for a result, results; --count: results in 14 days',
|
|
46
46
|
' pmos outcomes rate [--days <n>] [--json] checks due in the last n days (30) that got a verdict within 2 days, and how many PMOS did',
|
|
47
|
+
' pmos outcomes coverage [--json] live initiatives with an expected outcome and a check date; the percent is the last line',
|
|
47
48
|
'Run it in the product\'s repository, or pass --root <dir>. Show each ✦ to the PM and write only after a yes.',
|
|
48
49
|
];
|
|
49
50
|
/* `pmos outcomes rate` (initiative outcome-checks-finish): the bet's own number. A check counts when its date fell in the last `days` days
|
|
@@ -103,7 +104,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
|
|
|
103
104
|
if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
|
|
104
105
|
if (!COMMANDS.outcomes.includes(sub)) { say(`unknown outcomes command "${sub}". Use one of: ${COMMANDS.outcomes.join(', ')}`); return 2; }
|
|
105
106
|
const { pos, flags } = parse(args.slice(1));
|
|
106
|
-
const allowed = { list: ['json', 'root'], propose: ['json', 'root', 'max'], declare: ['json', 'root', 'metric', 'horizon'], record: ['json', 'root', 'evidence'], live: ['json', 'root', 'where', 'version'], test: ['json', 'root', 'test', 'method', 'result', 'evidence'], tests: ['json', 'root', 'count'], rate: ['json', 'root', 'days'] }[sub];
|
|
107
|
+
const allowed = { list: ['json', 'root'], propose: ['json', 'root', 'max'], declare: ['json', 'root', 'metric', 'horizon'], record: ['json', 'root', 'evidence'], live: ['json', 'root', 'where', 'version'], test: ['json', 'root', 'test', 'method', 'result', 'evidence'], tests: ['json', 'root', 'count'], rate: ['json', 'root', 'days'], coverage: ['json', 'root'] }[sub];
|
|
107
108
|
for (const k of Object.keys(flags)) if (!allowed.includes(k)) { say(`✗ --${k} is not an option of pmos outcomes ${sub}`); return 2; }
|
|
108
109
|
const root = path.resolve(flags.root || repoRoot(cwd));
|
|
109
110
|
const today = O.todayOf(now);
|
|
@@ -127,6 +128,17 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
|
|
|
127
128
|
return 0;
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
if (sub === 'coverage') {
|
|
132
|
+
// outcome-drafts-land: the share of live initiatives with an outcome and a check date (its done-test number)
|
|
133
|
+
if (pos.length) return fail('pmos outcomes coverage takes no argument', 2);
|
|
134
|
+
const c = O.coverageOf(O.scan(root, { today }));
|
|
135
|
+
if (flags.json) { say(JSON.stringify({ ok: true, ...c })); return 0; }
|
|
136
|
+
say(`${c.live} live initiatives · ${c.withOutcome} name an expected outcome · ${c.withBoth} have both an outcome and a check date`);
|
|
137
|
+
if (c.without.length) say(' without: ' + c.without.slice(0, 20).join(', ') + (c.without.length > 20 ? ` … and ${c.without.length - 20} more` : ''));
|
|
138
|
+
say(c.pct == null ? 'none live' : c.pct + '%');
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
130
142
|
if (sub === 'rate') {
|
|
131
143
|
if (pos.length) return fail('pmos outcomes rate takes no argument', 2);
|
|
132
144
|
const days = flags.days === undefined ? RATE_DAYS : Number(flags.days);
|
|
@@ -95,6 +95,8 @@ function liveChecks(rows) {
|
|
|
95
95
|
const reopened = (it, row) => !!(it.horizon && it.horizon > String(row.horizon || row.date || String(row.at || '').slice(0, 10)));
|
|
96
96
|
|
|
97
97
|
const STOPPED = new Set(['paused', 'cancelled', 'canceled', 'stopped', 'dropped', 'archived', 'killed']);
|
|
98
|
+
// the record's own status line counts too (outcome-drafts-land: idpf asked 3 cancelled records for an outcome); on hold and deferred are paused
|
|
99
|
+
const STOPPED_STATUS = new Set([...STOPPED, 'on-hold', 'on hold', 'onhold', 'deferred']);
|
|
98
100
|
function workGroup(root) { try { return require('./initiative-rows.js').workGroupOf(root) || {}; } catch { return {}; } }
|
|
99
101
|
|
|
100
102
|
/** Every subject of the outcome rule in this repository, read from the records and ledgers (no derivation, no git). */
|
|
@@ -129,8 +131,8 @@ function scan(root, { today = todayOf() } = {}) {
|
|
|
129
131
|
if (!ID_RE.test(id) || deleted.has(id)) continue;
|
|
130
132
|
const lane = (fm.lane && fm.lane.value) || (fm.type && fm.type.value !== 'Initiative' ? fm.type.value : '') || 'feature';
|
|
131
133
|
if (groups[lane] && groups[lane] !== 'work') continue; // a document lane is a file, not a bet (D86)
|
|
132
|
-
const st = life.get(id) ||
|
|
133
|
-
if (STOPPED.has(st)) continue;
|
|
134
|
+
const st = life.get(id) || '';
|
|
135
|
+
if (STOPPED.has(st) || (!st && fm.status && STOPPED_STATUS.has(String(fm.status.value).trim().toLowerCase()))) continue;
|
|
134
136
|
const it = {
|
|
135
137
|
id, lane, title: (fm.title && fm.title.value) || id, record: rel(root, file), fm, accepted: accepted.has(id),
|
|
136
138
|
anchor: fm.parent_kr ? fm.parent_kr.value : '', metric: fm.outcome_metric ? fm.outcome_metric.value : '',
|
|
@@ -260,14 +262,23 @@ function anchorMetric(root, it) {
|
|
|
260
262
|
const a = String(it.anchor || '').trim();
|
|
261
263
|
// a KR names what should move; a health budget (D59) names only a cap and a review trigger, and a domain names a topic, so neither is cited
|
|
262
264
|
if (!a || /^(domain|health):/.test(a)) return null;
|
|
263
|
-
|
|
265
|
+
// the KR's own line wins over a row that only maps an initiative to it (outcome-drafts-land: idpf drafted "Moves O-C.KR-C4:
|
|
266
|
+
// iam-migration-6.0" from the anchoring table). The full anchor first, then its KR id alone (`KR-C4` in `O-C.KR-C4`).
|
|
267
|
+
const tail = (/(?:^|[.:])(KR-?[A-Za-z]?\d+(?:\.\d+)*)$/i.exec(a) || [])[1] || '';
|
|
268
|
+
const tokens = [a, ...(tail && tail !== a ? [tail] : [])];
|
|
269
|
+
const has = (l, t) => (t === a ? l.includes(t) : new RegExp('(^|[^A-Za-z0-9.-])' + t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?![A-Za-z0-9])').test(l));
|
|
270
|
+
const isRow = (l) => /^\s*\|/.test(l);
|
|
264
271
|
const dirs = [path.join(root, 'planning', 'okrs'), path.join(root, 'pmos', 'planning', 'okrs')];
|
|
272
|
+
const hits = [];
|
|
265
273
|
for (const d of dirs) {
|
|
266
274
|
let fl = []; try { fl = fs.readdirSync(d).filter((x) => x.endsWith('.md')).sort(); } catch { continue; }
|
|
267
275
|
for (const x of fl) {
|
|
268
276
|
const f = path.join(d, x), Ls = linesOf(f) || [];
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
tokens.forEach((token, ti) => Ls.forEach((l, i) => { if (has(l, token) && !/^\s*(type|title|timestamp):/.test(l)) hits.push({ f, Ls, i, token, rank: (isRow(l) ? 2 : 0) + ti }); }));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
hits.sort((p, q) => p.rank - q.rank);
|
|
281
|
+
for (const { f, Ls, i, token } of hits) {
|
|
271
282
|
const text = Ls[i];
|
|
272
283
|
const cells = text.split('|').map((c) => c.trim()).filter(Boolean);
|
|
273
284
|
// the KR's own words, without its list marker, its bold and its id: "- **KR1** — 2,000 …" and "- **KR1 —** 2,000 …" read "2,000 …"
|
|
@@ -277,8 +288,36 @@ function anchorMetric(root, it) {
|
|
|
277
288
|
const m = metricText(String(words || '').replace(/^[:\s—–.-]+/, ''));
|
|
278
289
|
if (m.replace(/[^A-Za-z0-9]/g, '').length < 12) continue;
|
|
279
290
|
return { metric: 'Moves ' + a + ': ' + m, source: src(root, f, i + 1, text, 'Anchor ' + clip(a, 40)) };
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** The record's own words (outcome-drafts-land): the first item under an outcome, success, goal or signal heading in its body, else the
|
|
296
|
+
* "so that …" clause of its description or intent line. → { metric, source } | null */
|
|
297
|
+
const SO_THAT = /\bso that\s+(.{12,}?)(?:[.;]\s|[.;]?$)/i;
|
|
298
|
+
function recordMetric(root, it) {
|
|
299
|
+
if (!it || !it.record) return null;
|
|
300
|
+
const file = path.join(root, it.record), Ls = linesOf(file); if (!Ls) return null;
|
|
301
|
+
let i0 = 0;
|
|
302
|
+
if (/^---\s*$/.test(Ls[0] || '')) { i0 = Ls.findIndex((l, i) => i > 0 && /^---\s*$/.test(l)) + 1; if (i0 <= 0) i0 = Ls.length; }
|
|
303
|
+
for (let i = i0; i < Ls.length; i++) {
|
|
304
|
+
if (!HEADING.test(Ls[i])) continue;
|
|
305
|
+
for (let j = i + 1; j < Ls.length && j < i + 40; j++) {
|
|
306
|
+
const t = Ls[j];
|
|
307
|
+
if (/^#{1,3}\s/.test(t)) break;
|
|
308
|
+
if (!t.trim() || /^\s*(>|\||<!--|```)/.test(t) || /^\s*\*[^*].*\*\s*$/.test(t) || /^\s*(to be written|tbd|todo)\b/i.test(t)) continue;
|
|
309
|
+
const m = metricText(t);
|
|
310
|
+
if (m.replace(/[^A-Za-z0-9]/g, '').length < 12) continue;
|
|
311
|
+
return { metric: m, source: src(root, file, j + 1, t, 'Record: ' + clip(Ls[i].replace(/^#+\s*/, ''), 50)) };
|
|
280
312
|
}
|
|
281
313
|
}
|
|
314
|
+
for (const key of ['description', 'intent']) {
|
|
315
|
+
const e = it.fm && it.fm[key]; if (!e) continue;
|
|
316
|
+
const m = SO_THAT.exec(String(e.value || ''));
|
|
317
|
+
if (!m) continue;
|
|
318
|
+
const said = m[1].replace(/[.;\s]+$/, '');
|
|
319
|
+
return { metric: clip(said.charAt(0).toUpperCase() + said.slice(1), 220), source: src(root, file, e.n, e.text, 'Record: ' + key) };
|
|
320
|
+
}
|
|
282
321
|
return null;
|
|
283
322
|
}
|
|
284
323
|
|
|
@@ -302,7 +341,7 @@ function tasksOf(root) {
|
|
|
302
341
|
}
|
|
303
342
|
|
|
304
343
|
/** The check date to propose: DAYS_AFTER after the last task's due date, never sooner than a week from today. */
|
|
305
|
-
function horizonFor(S, it, tasks) {
|
|
344
|
+
function horizonFor(S, it, tasks = tasksOf(S.root)) {
|
|
306
345
|
const t = taskDue(S.root, it, tasks);
|
|
307
346
|
const floor = addDays(S.today, 7);
|
|
308
347
|
if (t) { const h = addDays(t.due, DAYS_AFTER); return { horizon: h < floor ? floor : h, lastDue: t.due, why: `${DAYS_AFTER} days after its last task is due`, source: t.source }; }
|
|
@@ -340,10 +379,10 @@ function missingDraft(S, it, tasks) {
|
|
|
340
379
|
// the experiment's hypothesis is its predicted outcome (D107): read it beside the anchor, and say when the two name different KRs
|
|
341
380
|
const hyp = experimentField(S.root, it, 'hypothesis');
|
|
342
381
|
const other = hyp ? krMismatch(hyp.text, it.anchor) : null;
|
|
343
|
-
const m = prdMetric(S.root, it) || (hyp && !other ? { metric: metricText(hyp.text), source: hyp.source, hyp: true } : null) || anchorMetric(S.root, it);
|
|
382
|
+
const m = prdMetric(S.root, it) || (hyp && !other ? { metric: metricText(hyp.text), source: hyp.source, hyp: true } : null) || recordMetric(S.root, it) || anchorMetric(S.root, it);
|
|
344
383
|
if (!m) return null; // nothing to cite: the PM names it (proven-only)
|
|
345
384
|
const h = horizonFor(S, it, tasks);
|
|
346
|
-
const said = m.hyp ? 'Its hypothesis' : m.source.label.startsWith('PRD') ? 'Its PRD' : 'Its anchor';
|
|
385
|
+
const said = m.hyp ? 'Its hypothesis' : m.source.label.startsWith('PRD') ? 'Its PRD' : m.source.label.startsWith('Record') ? 'Its record' : 'Its anchor';
|
|
347
386
|
const claims = [claim(`${said} says: ${m.metric}`, [m.source])];
|
|
348
387
|
if (hyp && !m.hyp) claims.push(claim(`Its hypothesis: ${clip(hyp.text, 160)}`, [hyp.source]));
|
|
349
388
|
if (h.source) claims.push(claim(`Its last task is due on ${short(h.lastDue)}`, [h.source]));
|
|
@@ -573,5 +612,25 @@ function undoCheck(root, { initiative, at, by, via }, { now = Date.now() } = {})
|
|
|
573
612
|
} catch (e) { return { ok: false, error: 'the outcome ledger could not be written: ' + String((e && e.message) || e).slice(0, 160) }; }
|
|
574
613
|
}
|
|
575
614
|
|
|
576
|
-
|
|
615
|
+
/** How many live initiatives carry an expected outcome and a check date (outcome-drafts-land: its done-test and health number). → { live,
|
|
616
|
+
* withOutcome, withBoth, pct, without: [id] } */
|
|
617
|
+
function coverageOf(S) {
|
|
618
|
+
const live = S.subjects.filter((it) => !it.accepted || it.metric); // an accepted one with no outcome is too late to declare: not counted
|
|
619
|
+
const withOutcome = live.filter((it) => it.metric), withBoth = withOutcome.filter((it) => it.horizon);
|
|
620
|
+
return { live: live.length, withOutcome: withOutcome.length, withBoth: withBoth.length, pct: live.length ? Math.round((withBoth.length / live.length) * 100) : null,
|
|
621
|
+
without: live.filter((it) => !(it.metric && it.horizon)).map((it) => it.id) };
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (require.main === module) {
|
|
625
|
+
// `node workspace/lib/outcomes.js coverage [--root <dir>]`: the health read of outcome-drafts-land; the percent is the last line
|
|
626
|
+
const a = process.argv.slice(2), at = a.indexOf('--root');
|
|
627
|
+
if (a[0] !== 'coverage') { console.log('usage: node lib/outcomes.js coverage [--root <dir>]'); process.exit(2); }
|
|
628
|
+
let root = at >= 0 && a[at + 1] ? a[at + 1] : process.cwd();
|
|
629
|
+
if (at < 0) { try { root = require('child_process').execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || root; } catch { /* not a git tree */ } }
|
|
630
|
+
const c = coverageOf(scan(root));
|
|
631
|
+
console.log(`${c.live} live initiatives · ${c.withOutcome} name an expected outcome · ${c.withBoth} have both an outcome and a check date`);
|
|
632
|
+
console.log(c.pct == null ? 'none live' : c.pct + '%');
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
module.exports = { VERSION, coverageOf, undoCheck, liveChecks, JOB, DAYS_AFTER, DEFAULT_DAYS, DISPOSITIONS, scan, drafts, prdMetric, anchorMetric, horizonFor, recordCheck, todayOf, short, frontOf,
|
|
577
636
|
experimentField, krMismatch, killMet, anyRefuted, verdictsOf, rowOutcomes, outcomeOfRow, refutedDrafts, setLife, NEXT_WORDS, cmpVersion, recordLive, LIVE, LIVE_TAG };
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* outcome an outcome's check date passed and its goal's own reading did not decide it (lib/outcome-props.js duePass, once per initiative
|
|
13
13
|
* and check date): PMOS reads the initiative's records and files whether it worked with `pmos propose verdict`, each claim cited
|
|
14
14
|
* path:line with its quote, or nothing when it cannot tell (then Your move asks the PM). The verdict is class B: recorded with Undo.
|
|
15
|
+
* outcome-draft an initiative has no expected outcome and nothing PMOS reads by itself cites one (lib/outcome-props.js draftPass, once per
|
|
16
|
+
* initiative, ever; outcome-drafts-land): PMOS reads its record and sources and files `pmos propose outcome`, each claim cited
|
|
17
|
+
* path:line with its quote, or nothing. The ✦ is class B: applied with Undo.
|
|
15
18
|
* check each morning inside the day-check window, once a day per initiative that has a late or at-risk task (devTpRules 1): Claude finds
|
|
16
19
|
* WHY each one slipped (the stored reads, the calendar, meeting notes, chat, Jira status) and files its dates, "looks done" and
|
|
17
20
|
* tidy names. A date that passes shows at once without a run: lib/proposals.js datesOf proposes from the tasks themselves, with
|
|
@@ -45,6 +48,7 @@ const localDay = (ms) => { const d = new Date(ms); return d.getFullYear() + '-'
|
|
|
45
48
|
const WHY = {
|
|
46
49
|
populate: 'The PM just added this initiative. It most likely already lives elsewhere: find it in every connected source and file what you find (Found elsewhere).',
|
|
47
50
|
check: 'The morning check: some tasks are late or at risk. Find why each one slipped and file new dates, "looks done" and tidy names.',
|
|
51
|
+
'outcome-draft': 'It has no expected outcome, and nothing PMOS reads by itself says one. Read its record, its PRD or brief, its tasks and its sources, then file what should change once it ships and, when a source says so, when to check it (`pmos propose outcome`). Cite every claim path:line with that line\'s text. When nothing says what it should change, file nothing.',
|
|
48
52
|
outcome: 'Its outcome check date has passed and its goal\'s own reading did not decide it. Read its records and file whether it worked (`pmos propose verdict`); when you cannot tell, file `cant-tell` with what you read and what was missing.',
|
|
49
53
|
};
|
|
50
54
|
|
|
@@ -54,6 +58,7 @@ function promptOf(skill, o) {
|
|
|
54
58
|
+ `- 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`
|
|
55
59
|
+ `- Its workflow's stages, in order:\n${list((o.stages || []).map((s) => s.key + ' · ' + s.name), 'not known')}\n`
|
|
56
60
|
+ (o.why === 'check' ? `- Its late and at-risk tasks:\n${list(o.tasks, 'none')}\n`
|
|
61
|
+
: o.why === 'outcome-draft' ? `- Its anchor: ${one((o.outcome && o.outcome.anchor) || '', 120) || 'none'}\n- Its record: ${one((o.outcome && o.outcome.record) || '', 200) || 'its initiative record'}\n`
|
|
57
62
|
: o.why === 'outcome' && o.outcome ? `- Its expected outcome: ${one(o.outcome.metric, 400)}\n- Its check date: ${o.outcome.horizon}\n- Its anchor: ${one(o.outcome.anchor, 120) || 'none'}\n- Its record: ${one(o.outcome.record, 200)}\n- Why the goal's reading did not decide it: ${one(o.outcome.why, 300)}\n`
|
|
58
63
|
: `- The material the PM gave and the people named are in its record and its first questions (\`pmos initiative export ${o.ini}\`).\n`)
|
|
59
64
|
+ `- Dropped by the PM (do not file these again unless the evidence is new):\n${list(o.dropped, 'none')}\n`
|
|
@@ -122,7 +127,7 @@ function create(deps) {
|
|
|
122
127
|
active.set(run, { ws, ini, dir, session: null, why });
|
|
123
128
|
let session = null;
|
|
124
129
|
try {
|
|
125
|
-
session = go({ name: (why === 'check' ? 'Task check · ' : why === 'outcome' ? 'Outcome check · ' : 'Looking for · ') + one(row.title || ini, 60), ws, origin: `propose:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
|
|
130
|
+
session = go({ name: (why === 'check' ? 'Task check · ' : why === 'outcome' ? 'Outcome check · ' : why === 'outcome-draft' ? 'Outcome draft · ' : 'Looking for · ') + one(row.title || ini, 60), ws, origin: `propose:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
|
|
126
131
|
env: { PMOS_PROPOSE_FILE: PR.ledgerFile(dir), PMOS_PROPOSE_WS: ws, PMOS_PROPOSE_BOARD: board || '', PMOS_PROPOSE_INI: ini, PMOS_PROPOSE_RUN: run, PMOS_PROPOSE_ROOT: w.root }, onDone: (r) => ended(run, r) });
|
|
127
132
|
} catch (e) { warn('proposal run', e); }
|
|
128
133
|
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs; it looks again in a minute' }; }
|
|
@@ -19,7 +19,7 @@ const fs = require('fs');
|
|
|
19
19
|
const PR = require('./proposals.js');
|
|
20
20
|
const LP = require('./loose-proposals.js');
|
|
21
21
|
|
|
22
|
-
const COMMANDS = { propose: ['look', 'found', 'date', 'done', 'name', 'verdict', 'status', 'loose'] };
|
|
22
|
+
const COMMANDS = { propose: ['look', 'found', 'date', 'done', 'name', 'verdict', 'outcome', 'status', 'loose'] };
|
|
23
23
|
const USAGE = [
|
|
24
24
|
'usage: pmos propose look|found|date|done|name|status — what PMOS proposes on an initiative, under its ✦',
|
|
25
25
|
' pmos propose look <source> --reading | --found <n> --what "<5 documents>" | --none',
|
|
@@ -37,6 +37,9 @@ const USAGE = [
|
|
|
37
37
|
' pmos propose verdict --json <file|-> only in an outcome run: { "disposition": "worked" | "didnt-work" | "cant-tell", "evidence": "<one line>",',
|
|
38
38
|
' "claims": [{ "text", "sources": [{ "label", "ref": "<path:line>", "quote": "<the text on that line>" }] }] } each quote is checked',
|
|
39
39
|
' against its line; a claim that does not match is refused. cant-tell files nothing: the PM is asked.',
|
|
40
|
+
' pmos propose outcome --json <file|-> only in an outcome-draft run: { "metric": "<what should change once it ships>", "horizon"?: "YYYY-MM-DD",',
|
|
41
|
+
' "claims": [{ "text", "sources": [{ "label", "ref": "<path:line>", "quote": "<the text on that line>" }] }] } each quote is checked;',
|
|
42
|
+
' with no horizon PMOS picks the date (30 days after the last task is due, else 90 days on)',
|
|
40
43
|
' pmos propose status',
|
|
41
44
|
' pmos propose loose link --json - { "initiative", "title", "why", "items": [{ "row" }] } rows that belong to one open initiative',
|
|
42
45
|
' pmos propose loose merge --json - { "into": "w:<item>", "why", "items": [{ "row": "c:<chat>" }] } a chat that doubles the PM\'s own item',
|
|
@@ -125,6 +128,41 @@ function verdict(args, { say, stdin, env, file, runId, ini, board, F, line }) {
|
|
|
125
128
|
return 0;
|
|
126
129
|
}
|
|
127
130
|
|
|
131
|
+
/** `pmos propose outcome`: the outcome-draft run's expected outcome for an initiative that has none (initiative outcome-drafts-land). Only
|
|
132
|
+
* in a run started with why `outcome-draft`, only while the record has no outcome, and only when every claim's quote is on its path:line
|
|
133
|
+
* (lib/ai-guard.js check). It files the same outcome/new ✦ the daily pass files (class B: applied with Undo). */
|
|
134
|
+
function outcomeDraft(args, { say, stdin, env, file, runId, ini, board, F, line }) {
|
|
135
|
+
const root = env.PMOS_PROPOSE_ROOT;
|
|
136
|
+
const L = F.looks.get(ini);
|
|
137
|
+
if (!root || !L || L.run !== runId || L.why !== 'outcome-draft') { say('✗ pmos propose outcome is for PMOS\'s outcome-draft run'); return 1; }
|
|
138
|
+
const jsonAt = args.indexOf('--json'), src = jsonAt >= 0 ? args[jsonAt + 1] : null;
|
|
139
|
+
if (!src) { say('usage: pmos propose outcome --json <file|->'); return 2; }
|
|
140
|
+
const r = readJson(src, stdin); if (r.error) { say('✗ ' + r.error); return 1; }
|
|
141
|
+
const b = r.body && typeof r.body === 'object' && !Array.isArray(r.body) ? r.body : {};
|
|
142
|
+
const metric = String(b.metric || '').replace(/\s+/g, ' ').trim();
|
|
143
|
+
if (metric.replace(/[^A-Za-z0-9]/g, '').length < 12 || metric.length > 300) { say('✗ refused: metric says what should change once it ships, in 12 to 300 characters'); return 1; }
|
|
144
|
+
const O = require('./outcomes.js'), AG = require('./ai-guard.js');
|
|
145
|
+
const S = O.scan(root), it = S.subjects.find((x) => x.id === ini);
|
|
146
|
+
if (!it) { say(`✗ refused: ${ini} is not a live initiative here`); return 1; }
|
|
147
|
+
if (it.metric) { say(`✗ refused: ${ini} has its expected outcome already`); return 1; }
|
|
148
|
+
if (!Array.isArray(b.claims) || !b.claims.length) { say('✗ refused: give at least one claim, cited path:line with that line\'s text'); return 1; }
|
|
149
|
+
const c0 = AG.check({ id: 'outcome-new:' + ini, title: 'Expected outcome', say: metric, confidence: 'medium', cls: 'B', claims: b.claims }, { root, stateDir: require('path').dirname(file) });
|
|
150
|
+
if (!c0.ok) { say('✗ refused: ' + c0.errors.join('; ')); return 1; }
|
|
151
|
+
const sources = c0.p.claims.flatMap((c) => c.sources).filter((x) => x.verified).map((x) => ({ label: x.label, ref: x.ref }));
|
|
152
|
+
if (!sources.length) { say('✗ refused: no claim\'s quote matched its line'); return 1; }
|
|
153
|
+
let horizon = String(b.horizon || '').trim(), how = 'a source names it';
|
|
154
|
+
if (horizon && (!/^\d{4}-\d{2}-\d{2}$/.test(horizon) || horizon <= S.today)) { say('✗ refused: horizon is a date after today, YYYY-MM-DD'); return 1; }
|
|
155
|
+
if (!horizon) { const h = O.horizonFor(S, it); horizon = h.horizon; how = h.why; }
|
|
156
|
+
const why = `It had no expected outcome. PMOS read its sources and suggests: "${metric}", checked on ${O.short(horizon)} (${how}). Undo takes it back.`;
|
|
157
|
+
const c = PR.clean('outcome', 'new', { title: 'What should change once it ships', why, sources, items: [{ id: 'outcome', title: metric, due: horizon }], data: { metric, horizon } });
|
|
158
|
+
if (c.error) { say('✗ refused: ' + c.error); return 1; }
|
|
159
|
+
const id = PR.idOf(ini, 'outcome', 'new', 'draft');
|
|
160
|
+
if (F.props.has(id)) { say(`already ${id}: PMOS drafted this initiative's outcome before`); return 0; }
|
|
161
|
+
line({ kind: 'propose', ini, board, run: runId, id, ...c.prop });
|
|
162
|
+
say(`filed ${id} · outcome/new · ${metric}`);
|
|
163
|
+
return 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
128
166
|
async function run(argv, { say = (s) => console.log(s), env = process.env, stdin } = {}) {
|
|
129
167
|
const args = argv[0] === 'propose' ? argv.slice(1) : argv.slice();
|
|
130
168
|
const verb = args[0];
|
|
@@ -158,6 +196,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
|
|
|
158
196
|
const L = F.looks.get(ini);
|
|
159
197
|
if (L && L.run === runId && L.stopped) { say('✗ the PM pressed Stop: file nothing more'); return 1; }
|
|
160
198
|
if (verb === 'verdict') return verdict(args, { say, stdin, env, file, runId, ini, board, F, line });
|
|
199
|
+
if (verb === 'outcome') return outcomeDraft(args, { say, stdin, env, file, runId, ini, board, F, line });
|
|
161
200
|
const type = verb === 'found' ? args[1] : verb === 'date' ? 'stage' : verb === 'done' ? 'done' : 'tidy';
|
|
162
201
|
const jsonAt = args.indexOf('--json'), src = jsonAt >= 0 ? args[jsonAt + 1] : null;
|
|
163
202
|
if (!src) { say(`usage: pmos propose ${verb}${verb === 'found' ? ' <type>' : ''} --json <file|->`); return 2; }
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* report-readers.js — PMOS reads each report draft as the CFO, the engineering lead and the sceptic, by itself, and files their questions
|
|
3
|
+
* under the blue ✦ of the initiatives the report covers (initiative report-reader-review; bet A110 on the A330 critic).
|
|
4
|
+
*
|
|
5
|
+
* WHY. `pmos critic <file> --as all` (lib/spec-critic.js, initiatives spec-critic and review-lenses-cfo-engineer-sceptic) asks a report the
|
|
6
|
+
* questions its readers will ask, but only when the chat is told the PM is about to share it, and only in a terminal. The A110 proof found an
|
|
7
|
+
* unanswered reader question in all 15 reader reviews of 5 real reports. PMOS acts by itself: no run button, the findings are ✦ proposals.
|
|
8
|
+
*
|
|
9
|
+
* WHEN IT RUNS. After every report draft this process writes (lib/report-draft.js onDraftWritten: Draft now, Redraft, a schedule). One
|
|
10
|
+
* read-only session through the spec critic's ask path (kind `ask`), with every reader. The same text is read once: a run on the same file and
|
|
11
|
+
* the same text (spec-critic.jsonl) starts none. Off: Settings `critic.reports` off, PMOS_CRITIC=off, or the AI kill switch for job
|
|
12
|
+
* `report-readers` (PMOS_AI_REPORT_READERS=off, `pmos ai off report-readers`). Wawan said yes to a run on every draft on 2026-11-24.
|
|
13
|
+
*
|
|
14
|
+
* WHAT IT FILES. Each question whose quote sits in one initiative's block of the report (`### Title (id)` under `## Initiatives`, or a Timeline
|
|
15
|
+
* row whose first cell is one block's title) becomes one proposal under that initiative's ✦: lib/proposals.js group `grill`, type `reader`, section `check` (its
|
|
16
|
+
* own ✓, never Keep all). Title "CFO asks: <question>", why the quoted line, next step the smallest fix (✓ adds it as a task). Every proposal
|
|
17
|
+
* passes lib/ai-guard.js first: its quote must be at its `<report>:<line>`. A question that quotes no block stays in the critic ledger only.
|
|
18
|
+
*
|
|
19
|
+
* blockOf(text) PURE → [id | null] per line (index 0 = line 1)
|
|
20
|
+
* lineOf(lines, quote) PURE → the 1-based line the quote starts near, or 0
|
|
21
|
+
* proposalsOf({ text, rel, cadence, questions }) PURE → the guard's proposals, each with data.ini
|
|
22
|
+
* grillProp(p) the lib/proposals.js `propose` fields for one guarded proposal
|
|
23
|
+
* cases() · replayRoot() the replay (a recorded critic answer, never the model)
|
|
24
|
+
* file({ root, rel, cadence, dir, runtime, ask, ws?, board?, env?, guard? }) → Promise<{ filed, dropped, skipped?, off?, held? }>
|
|
25
|
+
* attach(ctxFactory) hook onDraftWritten once; ctx: { workspaceList, stateDirFor, runtimeDir, spawnScheduled|spawnSession, boardOf? }
|
|
26
|
+
* filedCount(dir) reader proposals in a state folder (the health number; `node lib/report-readers.js filed`)
|
|
27
|
+
*/
|
|
28
|
+
const fs = require('fs');
|
|
29
|
+
const path = require('path');
|
|
30
|
+
const crypto = require('crypto');
|
|
31
|
+
const SC = require('./spec-critic.js');
|
|
32
|
+
const G = require('./grill.js');
|
|
33
|
+
const PR = require('./proposals.js');
|
|
34
|
+
|
|
35
|
+
const JOB = 'report-readers';
|
|
36
|
+
const VERSION = '1';
|
|
37
|
+
const MAX = 6;
|
|
38
|
+
const SETTING = 'critic.reports';
|
|
39
|
+
const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
40
|
+
const norm = (s) => String(s == null ? '' : s).toLowerCase().replace(/\s+/g, ' ').trim();
|
|
41
|
+
const hash = (s) => crypto.createHash('sha1').update(String(s)).digest('hex').slice(0, 10);
|
|
42
|
+
const ASKS = { cfo: 'CFO asks', engineer: 'Engineer asks', sceptic: 'Sceptic asks' };
|
|
43
|
+
|
|
44
|
+
/** PURE. The initiative block each line sits in. Outside the blocks, a table row whose first cell is one block's title gets that block. */
|
|
45
|
+
function blockOf(text) {
|
|
46
|
+
const L = String(text || '').split('\n');
|
|
47
|
+
const out = new Array(L.length).fill(null);
|
|
48
|
+
const titles = new Map();
|
|
49
|
+
let inInis = false, cur = null;
|
|
50
|
+
L.forEach((l, i) => {
|
|
51
|
+
if (/^##\s/.test(l)) { inInis = /^##\s+Initiatives\s*$/i.test(l); cur = null; return; }
|
|
52
|
+
const m = inInis && /^###\s+(.+?)\s+\(([A-Za-z0-9._-]{1,80})\)\s*$/.exec(l);
|
|
53
|
+
if (m) { cur = m[2]; titles.set(m[2], m[1].trim()); }
|
|
54
|
+
if (inInis) out[i] = cur;
|
|
55
|
+
});
|
|
56
|
+
// outside the blocks, only a table row whose first cell is one block's title (the Timeline): prose that names a title, such as the
|
|
57
|
+
// headline, may be about something else, so it is never filed on that initiative
|
|
58
|
+
L.forEach((l, i) => {
|
|
59
|
+
if (out[i]) return;
|
|
60
|
+
const m = /^\|\s*([^|]+?)\s*\|/.exec(l);
|
|
61
|
+
if (!m) return;
|
|
62
|
+
const hit = [...titles].filter(([, t]) => norm(t) === norm(m[1]));
|
|
63
|
+
if (hit.length === 1) out[i] = hit[0][0];
|
|
64
|
+
});
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** PURE. The 1-based line a quote sits at (the quote may run over up to 3 lines), or 0. */
|
|
69
|
+
function lineOf(lines, quote) {
|
|
70
|
+
const q = norm(quote);
|
|
71
|
+
if (!q) return 0;
|
|
72
|
+
for (let i = 0; i < lines.length; i++) if (norm(lines[i]).includes(q)) return i + 1;
|
|
73
|
+
for (let i = 0; i < lines.length; i++) if (norm(lines.slice(i, i + 3).join(' ')).includes(q)) return i + 1;
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** PURE. Critic questions → the guard's proposals. rel: the report, repository-relative. */
|
|
78
|
+
function proposalsOf({ text, rel, cadence = '', questions } = {}) {
|
|
79
|
+
const lines = String(text || '').split('\n');
|
|
80
|
+
const blocks = blockOf(text);
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const q of Array.isArray(questions) ? questions : []) {
|
|
83
|
+
if (out.length >= MAX) break;
|
|
84
|
+
if (!q || !q.quote || !q.question) continue;
|
|
85
|
+
const at = lineOf(lines, q.quote);
|
|
86
|
+
const ini = at ? blocks[at - 1] : null;
|
|
87
|
+
if (!ini) continue;
|
|
88
|
+
const reader = ASKS[q.reader] ? q.reader : 'sceptic';
|
|
89
|
+
const key = [cadence, reader, q.lens].join('|');
|
|
90
|
+
out.push({
|
|
91
|
+
id: 'rr-' + hash([ini, key].join('|')),
|
|
92
|
+
title: one(q.question, 140),
|
|
93
|
+
say: one(`"${one(q.quote, 160)}"${q.why ? ' ' + q.why : ''}`, 300),
|
|
94
|
+
confidence: 'medium',
|
|
95
|
+
claims: [{ text: one(q.question, 300), sources: [{ label: one(`${path.basename(String(rel || 'report'))} · ${q.lens}`, 80), ref: `${rel}:${at}`, quote: q.quote }] }],
|
|
96
|
+
data: { ini, reader, lens: one(q.lens, 40), key, next: one(q.fix || 'Answer it in the report before it is sent', 140) },
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The lib/proposals.js `propose` fields for one guarded proposal (group grill, type reader). */
|
|
103
|
+
function grillProp(p) {
|
|
104
|
+
const d = p.data || {};
|
|
105
|
+
const src = (p.claims[0] && p.claims[0].sources[0]) || {};
|
|
106
|
+
return {
|
|
107
|
+
id: G.idOf(d.ini, 'reader', d.key), group: 'grill', type: 'reader', section: 'check',
|
|
108
|
+
title: one((ASKS[d.reader] || 'Sceptic asks') + ': ' + p.title, 200),
|
|
109
|
+
why: one(p.say + ' Next: ' + d.next, 460),
|
|
110
|
+
sources: [{ label: one(src.label || 'the report', 80), ref: one(src.ref, 500) }],
|
|
111
|
+
items: [], data: { angle: 'reader', reader: d.reader, lens: d.lens, next: d.next, rank: d.reader === 'sceptic' ? 4 : 3 },
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* The replay: a recorded critic answer on a fixture report. A question in a block is filed; one that quotes the headline is not. */
|
|
116
|
+
const FIXTURE_REL = 'planning/reports/weekly/2026-11-20.md';
|
|
117
|
+
const FIXTURE = ['---', 'type: Reference', 'title: "Weekly report 2026-11-20"', '---', '', '## Headline', '', 'Sign-in work is on track for the March cutover.', '',
|
|
118
|
+
'## Initiatives', '', '### Move sign-in to the new provider (ciam-cutover)', '', 'Stage: Build · On track · 4 of 9', '',
|
|
119
|
+
'Cutover planned for 15 or 30 March 2026, load tests to follow.', ''].join('\n');
|
|
120
|
+
const RECORDED = [
|
|
121
|
+
{ reader: 'cfo', lens: 'cost-of-delay', question: 'What does a slip of the cutover cost?', quote: 'Cutover planned for 15 or 30 March 2026', why: 'No cost is named.', fix: 'Add the cost of a two-week slip next to the date' },
|
|
122
|
+
{ reader: 'sceptic', lens: 'evidence', question: 'What says it is on track?', quote: 'Sign-in work is on track for the March cutover', why: '', fix: 'Name the reading' },
|
|
123
|
+
];
|
|
124
|
+
let fixtureRoot = null;
|
|
125
|
+
function replayRoot() {
|
|
126
|
+
if (fixtureRoot && fs.existsSync(fixtureRoot)) return fixtureRoot;
|
|
127
|
+
fixtureRoot = fs.mkdtempSync(path.join(require('os').tmpdir(), 'pmos-report-readers-replay-'));
|
|
128
|
+
const p = path.join(fixtureRoot, FIXTURE_REL);
|
|
129
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
130
|
+
fs.writeFileSync(p, FIXTURE);
|
|
131
|
+
return fixtureRoot;
|
|
132
|
+
}
|
|
133
|
+
function cases() {
|
|
134
|
+
return [{ name: 'a reader question in an initiative block is filed; one outside every block is not', run: async () => proposalsOf({ text: FIXTURE, rel: FIXTURE_REL, cadence: 'weekly', questions: RECORDED }),
|
|
135
|
+
expect: { filed: 1, cites: [FIXTURE_REL] } }];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function guardOf() { try { return require('./ai-guard.js'); } catch { return null; } }
|
|
139
|
+
function settingOff(runtime) {
|
|
140
|
+
if (!runtime) return false;
|
|
141
|
+
try { return require('./settings-store.js').get(runtime, SETTING) === 'off'; } catch { return false; }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** One reader review of one report draft. dir: the workspace's PMOS state folder (proposals.jsonl); runtime: the per-user folder. */
|
|
145
|
+
async function file({ root, rel, cadence = '', dir, runtime, ask, ws = '', board = '', env = process.env, guard = guardOf(), now = Date.now() } = {}) {
|
|
146
|
+
if (SC.off(env)) return { filed: [], dropped: [], off: 'the critic is off (PMOS_CRITIC=off)' };
|
|
147
|
+
if (settingOff(runtime)) return { filed: [], dropped: [], off: `Settings ${SETTING} is off` };
|
|
148
|
+
if (!guard) return { filed: [], dropped: [], off: 'the AI guardrail (lib/ai-guard.js) is not installed' };
|
|
149
|
+
if (!root || !rel || !dir) return { filed: [], dropped: [], off: 'no report or no PMOS state folder' };
|
|
150
|
+
const gdir = runtime || dir;
|
|
151
|
+
const stop = guard.off(JOB, { env, settingsDir: runtime || null });
|
|
152
|
+
if (stop) return { filed: [], dropped: [], off: stop };
|
|
153
|
+
const abs = path.resolve(root, rel);
|
|
154
|
+
let raw = '';
|
|
155
|
+
try { raw = fs.readFileSync(abs, 'utf8'); } catch { return { filed: [], dropped: [], off: 'the report could not be read' }; }
|
|
156
|
+
const text = SC.textOf(raw, abs);
|
|
157
|
+
const prev = runtime ? SC.latest(runtime, abs) : null;
|
|
158
|
+
if (prev && prev.ok && prev.sha === SC.sha(text)) return { filed: [], dropped: [], skipped: 'this text was read already' };
|
|
159
|
+
if (!guard.ready(gdir, JOB, VERSION)) {
|
|
160
|
+
const rp = await guard.replay(JOB, VERSION, cases(), { root: replayRoot(), stateDir: gdir, max: MAX });
|
|
161
|
+
if (!rp.ok) return { filed: [], dropped: [], held: true };
|
|
162
|
+
}
|
|
163
|
+
const K = SC.lensesFor(root, { as: 'all' });
|
|
164
|
+
const r = await SC.critique(ask, { lenses: K.lenses, text: raw, file: abs });
|
|
165
|
+
if (runtime) SC.record(runtime, { from: 'report', ws, file: abs, sha: SC.sha(text), chars: text.length, lenses: r.lenses || [], readers: K.readers,
|
|
166
|
+
ok: r.ok, why: r.why, questions: r.questions, dropped: r.dropped, ms: r.ms });
|
|
167
|
+
if (!r.ok) return { filed: [], dropped: [], off: r.why };
|
|
168
|
+
const props = proposalsOf({ text: raw, rel, cadence, questions: r.questions });
|
|
169
|
+
if (!props.length) return { filed: [], dropped: [], none: true };
|
|
170
|
+
const run = 'rr' + Number(now).toString(36);
|
|
171
|
+
const got = await guard.file({ job: JOB, version: VERSION, run, root, stateDir: gdir, settingsDir: runtime || null, env, max: MAX }, props, async (accepted) => {
|
|
172
|
+
const F = PR.read(dir), kept = PR.keptIds(F);
|
|
173
|
+
for (const p of accepted) {
|
|
174
|
+
const prop = grillProp(p);
|
|
175
|
+
if (F.drops.has(PR.sigOf(prop)) || kept.has(prop.id)) continue;
|
|
176
|
+
PR.append(dir, null, { kind: 'propose', ini: p.data.ini, board: board || '', run, ...prop, at: new Date(now).toISOString() });
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
console.log(`[report-readers] ${rel}: ${got.filed.length} filed, ${got.dropped.length} dropped`);
|
|
180
|
+
return got;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
let attached = false;
|
|
184
|
+
/** server.js calls this once: every draft this process writes gets one reader review, in the background. */
|
|
185
|
+
function attach(ctxFactory) {
|
|
186
|
+
if (attached || typeof ctxFactory !== 'function') return;
|
|
187
|
+
attached = true;
|
|
188
|
+
require('./report-draft.js').onDraftWritten(({ root, cadence, path: rel }) => {
|
|
189
|
+
setImmediate(() => {
|
|
190
|
+
let ctx = null; try { ctx = ctxFactory(); } catch { ctx = null; }
|
|
191
|
+
if (!ctx) return;
|
|
192
|
+
const abs = path.resolve(String(root));
|
|
193
|
+
const list = typeof ctx.workspaceList === 'function' ? ctx.workspaceList() : [];
|
|
194
|
+
const w = list.find((x) => x && x.root && path.resolve(x.root) === abs) || { id: '', root: abs };
|
|
195
|
+
let dir = null; try { dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null; } catch { dir = null; }
|
|
196
|
+
const spawn = ctx.spawnScheduled || ctx.spawnSession;
|
|
197
|
+
if (!dir || typeof spawn !== 'function') return;
|
|
198
|
+
let board = ''; try { board = (ctx.boardOf && ctx.boardOf(w)) || ''; } catch { board = ''; }
|
|
199
|
+
file({ root: abs, rel, cadence, dir, runtime: ctx.runtimeDir || null, ask: SC.askVia(spawn), ws: w.id || '', board })
|
|
200
|
+
.catch((e) => console.log(`[report-readers] ${rel}: not run (${one(e && e.message, 160)})`));
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Reader proposals filed in one state folder: the health number. */
|
|
206
|
+
function filedCount(dir) {
|
|
207
|
+
try { const F = PR.read(dir); return [...F.props.values()].filter((p) => p.group === 'grill' && p.type === 'reader').length; } catch { return 0; }
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
module.exports = { JOB, VERSION, MAX, SETTING, ASKS, blockOf, lineOf, proposalsOf, grillProp, cases, replayRoot, file, attach, filedCount, FIXTURE, FIXTURE_REL, RECORDED };
|
|
211
|
+
|
|
212
|
+
if (require.main === module && process.argv[2] === 'filed') {
|
|
213
|
+
const cwd = process.cwd();
|
|
214
|
+
const dir = [['pmos', 'state'], ['state'], ['.pmos']].map((r) => path.join(cwd, ...r)).find((d) => { try { return fs.statSync(d).isDirectory(); } catch { return false; } });
|
|
215
|
+
console.log(dir ? filedCount(dir) : 0);
|
|
216
|
+
}
|
|
@@ -106,6 +106,9 @@ const DEFS = Object.freeze({
|
|
|
106
106
|
// and the monthly credit cap in US dollars. At the cap Claude pauses. `pmos grill mode|cap` reads and sets them.
|
|
107
107
|
'grill.mode': one('checks', 'computer', ['full', 'exits', 'off'], 'full'),
|
|
108
108
|
'grill.cap': { section: 'checks', scope: 'computer', type: 'dollars', min: 0, max: 500, def: 10 },
|
|
109
|
+
// report-reader-review: PMOS reads each report draft as the CFO, the engineer and the sceptic and files their questions under the ✦
|
|
110
|
+
// (lib/report-readers.js). On by default (Wawan, 2026-11-24: "Yes, on every report draft").
|
|
111
|
+
'critic.reports': one('checks', 'computer', ['on', 'off'], 'on'),
|
|
109
112
|
// Background use with no dollar limit (Wawan 2026-11-17: the runs use the subscription plan). On: the step-5 spend hold never holds
|
|
110
113
|
// (lib/bg-queue.js spendHold); the usage-limit hold a failed run leaves is the brake. `pmos grill cap unlimited` sets it.
|
|
111
114
|
'ai.unlimited': bool('checks', 'computer', false),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.779.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.779.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* pm/grill-words.js — the words and marks every page uses for Claude's checks (Grill and Forecast screens; canvas GrillResult, GrillLenses,
|
|
2
2
|
* FcIntel, FcPhone). Pure: Node can import it.
|
|
3
3
|
*
|
|
4
|
-
* ANGLE { [angle]: { label, icon (a 24-unit path) } }: premortem · redteam · voices · reframe · scope · whatif · decision · past
|
|
4
|
+
* ANGLE { [angle]: { label, icon (a 24-unit path) } }: premortem · redteam · voices · reframe · scope · whatif · decision · past · reader
|
|
5
|
+
* (reader: a report reader's question, lib/report-readers.js; labelled by its reader, "CFO asks")
|
|
5
6
|
* findingOf(p) a grill proposal (lib/grill.js finding) → { angle, label, icon, title, why, next, simulated }
|
|
6
7
|
* the title and why without the angle prefix and the "Next:" tail lib/grill.js writes into them
|
|
7
8
|
* whenWord(iso, now) 'overnight' · 'today' · 'yesterday' · 'on Oct 30'
|
|
@@ -20,6 +21,7 @@ export const ANGLE = Object.freeze({
|
|
|
20
21
|
whatif: { label: 'What-if', icon: 'M4 18c4 0 4-12 8-12s4 12 8 12M4 12c4 0 4-6 8-6' },
|
|
21
22
|
decision: { label: 'Earlier decision', icon: 'M6 3h9l3 3v15H6zM9 9h6M9 13h6M9 17h3' },
|
|
22
23
|
past: { label: 'You decided this before', icon: 'M3 12a9 9 0 1 0 3-6.7M3 4v4h4M12 7v5l3 2' },
|
|
24
|
+
reader: { label: 'A reader asks', icon: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8M4 21c1-4 4-6 8-6s7 2 8 6' },
|
|
23
25
|
});
|
|
24
26
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
25
27
|
|
|
@@ -31,7 +33,9 @@ export function findingOf(p) {
|
|
|
31
33
|
const next = String(d.next || '');
|
|
32
34
|
let why = String((p && p.why) || '');
|
|
33
35
|
if (next && why.endsWith(' Next: ' + next)) why = why.slice(0, -(' Next: ' + next).length);
|
|
34
|
-
|
|
36
|
+
const ASKS = { cfo: 'CFO asks', engineer: 'Engineer asks', sceptic: 'Sceptic asks' };
|
|
37
|
+
const label = angle === 'reader' && ASKS[d.reader] ? ASKS[d.reader] : A.label;
|
|
38
|
+
return { angle, label, icon: A.icon, title: title || label, why, next, simulated: d.simulated || '' };
|
|
35
39
|
}
|
|
36
40
|
const dayKey = (t) => { const d = new Date(t); return d.getFullYear() * 400 + d.getMonth() * 32 + d.getDate(); };
|
|
37
41
|
export function whenWord(iso, now = Date.now()) {
|
|
@@ -17,8 +17,8 @@ export const RO = !!PACK;
|
|
|
17
17
|
|
|
18
18
|
/** What a reader can do. Each is a selector; a press inside a match is let through. */
|
|
19
19
|
export const VIEW_CONTROLS = [
|
|
20
|
-
// the Timeline: the span, the legend behind (i), a column's sort, back to today, the Deliveries lane, the folds, an initiative's name (opens its viewer)
|
|
21
|
-
'#bdLgdBtn', '.tg-chd', '.tg-tback', '.dl-fb', '.dl-dn', '.dl-e[aria-label*="press to open"]', '.bd-fold', '.bd-prdb', 'label.tg-n', 'button.tg-n.ini2',
|
|
20
|
+
// the Timeline: the span, the legend behind (i), a column's sort, back to today, the edge tab that scrolls to a bar off the view, the Deliveries lane, the folds, an initiative's name (opens its viewer)
|
|
21
|
+
'#bdLgdBtn', '.tg-chd', '.tg-tback', '.tg-edge', '.dl-fb', '.dl-dn', '.dl-e[aria-label*="press to open"]', '.bd-fold', '.bd-prdb', 'label.tg-n', 'button.tg-n.ini2',
|
|
22
22
|
// the stage track: the switch between it and the Timeline (the two views a publisher shares), an initiative's name, the Monitor and Evaluate fold
|
|
23
23
|
// (UI grill U2: they live in the View chip with the span, and the menu draws only these two for a reader)
|
|
24
24
|
'#bdView', '#bdViewMenu [data-pv="track"]', '#bdViewMenu [data-pv="time"]', '#bdViewMenu [data-spick]', 'button.bt-nm', '#fold',
|
package/workspace/server.js
CHANGED
|
@@ -2939,6 +2939,9 @@ const reportDesignTick = () => {
|
|
|
2939
2939
|
try { m.sweep(reportDesignCtx()); } catch (e) { warnWriteFail('report design tick', e); }
|
|
2940
2940
|
};
|
|
2941
2941
|
try { require('./lib/routes-report-design.js').attach(reportDesignCtx); } catch { /* a checkout without the module still starts */ }
|
|
2942
|
+
// report-reader-review: every report draft this process writes is read once as the CFO, the engineer and the sceptic; their questions go under the
|
|
2943
|
+
// ✦ of the initiatives the report covers (lib/report-readers.js, through lib/ai-guard.js). The read runs through spawnScheduled (the capacity governor).
|
|
2944
|
+
try { require('./lib/report-readers.js').attach(() => ({ ...reportDesignCtx(), stateDirFor })); } catch { /* a checkout without the module still starts */ }
|
|
2942
2945
|
// report-structure: the structure jobs, the source checks (interactive sessions started like Work's approved steps, STEP_FLAGS) and the draft gate.
|
|
2943
2946
|
// The tick collects check answers and starts the drafts that waited for a failing source (4 hours, then without it).
|
|
2944
2947
|
// agent-orchestrator: the checks of a draft the schedule tick fired, and the tick's retries of them, use spawnScheduled (the capacity governor). A press uses spawnSession.
|
|
@@ -3243,6 +3246,9 @@ const outcomeProps = require('./lib/outcome-props.js').create({
|
|
|
3243
3246
|
// outcome-checks-run-themselves: a due check no reading decides gets one short run that reads the initiative's records (lib/proposal-runs.js)
|
|
3244
3247
|
startRun: (w, o) => proposalRuns.start({ ws: w.id, board: o.board, ini: o.ini, why: 'outcome', press: false, now: o.now,
|
|
3245
3248
|
outcome: { metric: o.it.metric, horizon: o.it.horizon, anchor: o.it.anchor, record: o.it.record, why: o.why } }),
|
|
3249
|
+
// outcome-drafts-land: an initiative with nothing to cite gets one run of the same kind that drafts its outcome (`pmos propose outcome`)
|
|
3250
|
+
startDraft: (w, o) => proposalRuns.start({ ws: w.id, board: o.board, ini: o.ini, why: 'outcome-draft', press: false, now: o.now,
|
|
3251
|
+
outcome: { anchor: o.it.anchor || '', record: o.it.record || '' } }),
|
|
3246
3252
|
env: process.env,
|
|
3247
3253
|
every: TICK_MS,
|
|
3248
3254
|
mayRun: () => { try { return scheduleOwner.mayRun(); } catch { return true; } },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: initiative-propose
|
|
3
3
|
label: "Claude proposes, per initiative"
|
|
4
|
-
description: "One short background run for one initiative. When the initiative was just added, it looks for it in every connected source and files what it finds: the stage the work is really in, its documents and its tasks with their dates. Each morning it finds why late tasks slipped and files new dates, done and tidy names. When an outcome check date passes and no reading decides it, it reads the records and files whether it worked. Everything waits under the initiative's ✦ for the PM's ✓. It writes no task, document or stage and sends nothing."
|
|
4
|
+
description: "One short background run for one initiative. When the initiative was just added, it looks for it in every connected source and files what it finds: the stage the work is really in, its documents and its tasks with their dates. Each morning it finds why late tasks slipped and files new dates, done and tidy names. When an outcome check date passes and no reading decides it, it reads the records and files whether it worked. When an initiative has no expected outcome and nothing cites one, it drafts one from its record and sources. Everything waits under the initiative's ✦ for the PM's ✓. It writes no task, document or stage and sends nothing."
|
|
5
5
|
run: agent
|
|
6
6
|
agent: claude
|
|
7
7
|
output:
|
|
@@ -10,7 +10,7 @@ output:
|
|
|
10
10
|
- Not read
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
/initiative-propose: for ONE initiative, find what the evidence says and file it with `pmos propose`, then stop. The lines after this procedure name the initiative, why this run runs (populate, check or outcome), today, its stages and what the PM dropped.
|
|
13
|
+
/initiative-propose: for ONE initiative, find what the evidence says and file it with `pmos propose`, then stop. The lines after this procedure name the initiative, why this run runs (populate, check, outcome or outcome-draft), today, its stages and what the PM dropped.
|
|
14
14
|
|
|
15
15
|
Rules that always hold:
|
|
16
16
|
1. THE ONLY WRITE is `pmos propose`. You have no Write and no Edit tool. Do not add a task, move a stage or write a document: the PM's ✓ on the page does that. Do not commit and do not push.
|
|
@@ -45,6 +45,12 @@ Procedure when the run is `outcome` (the check date of its expected outcome has
|
|
|
45
45
|
3. File once with `pmos propose verdict --json -`: `{ "disposition": "worked" | "didnt-work" | "cant-tell", "evidence": "<one line: what you found, with the number>", "claims": [{ "text": "<one fact>", "sources": [{ "label": "<what it is>", "ref": "<path:line, from the repository root>", "quote": "<the text on that line, at least 12 characters>" }] }] }`. Each quote is checked against its line; a claim that does not match is refused, and so is the verdict. Claims are optional for `cant-tell`. When `worked` or `didnt-work` is refused because the evidence is only in a connector (not on a line in the repository), file `cant-tell` and name that evidence: do not end the run with nothing filed.
|
|
46
46
|
4. Do not record the check yourself: the server records your verdict with Undo.
|
|
47
47
|
|
|
48
|
+
Procedure when the run is `outcome-draft` (the initiative has no expected outcome, and nothing PMOS reads by itself says one):
|
|
49
|
+
1. Read the record named below, its PRD, brief or done test if it names them, its tasks (`pmos initiative export <id>`), and the stored reads of its sources (`pmos source show <source>`).
|
|
50
|
+
2. Write what should change for its users or its product once it ships, in one sentence, with a number or a direction you can check later (for example "Concurrent sessions per account fall, so one login is no longer shared across several people"). Take it only from what you read: a goal, a reason, a problem the record or its sources state. Do not invent a target number.
|
|
51
|
+
3. File once with `pmos propose outcome --json -`: `{ "metric": "<the sentence>", "horizon": "<YYYY-MM-DD, only when a source names when to check>", "claims": [{ "text": "<one fact>", "sources": [{ "label": "<what it is>", "ref": "<path:line, from the repository root>", "quote": "<the text on that line, at least 12 characters>" }] }] }`. Each quote is checked against its line; a claim that does not match is refused. Leave `horizon` out to let PMOS pick the date. PMOS applies it with Undo.
|
|
52
|
+
4. When nothing you read says what it should change, file nothing and say so under Not found.
|
|
53
|
+
|
|
48
54
|
Output contract: produce EXACTLY these sections in your final message:
|
|
49
55
|
- Filed (the proposal ids and their kinds, or "nothing new")
|
|
50
56
|
- Not found (what you looked for and did not find)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Every live initiative gets an expected outcome and a check date (initiative outcome-drafts-land, done test L1-L8): lost keeps refiled, stopped records left out, the KR line and the record's own words cited, one outcome-draft run for the rest, pmos propose outcome, coverage. Pure checks. No connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"outcome-drafts-land.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"outcome-drafts-land.test.js": 5
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "PMOS reads each report draft as the CFO, the engineer and the sceptic and files their questions under the initiative's ✦ (initiative report-reader-review, bet A110 on the A330 critic): lib/report-readers.js on report-draft.js onDraftWritten, through lib/ai-guard.js; Settings critic.reports. Backend only.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"report-readers.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"report-readers.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|