create-pmos 0.577.0 → 0.579.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 +27 -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 +26 -0
- package/workspace/guide/agent-capabilities.md +11 -1
- package/workspace/guide/cli.md +9 -0
- package/workspace/guide/settings-and-switches.md +3 -0
- package/workspace/lib/bg-queue.js +17 -2
- package/workspace/lib/grill-cli.js +10 -1
- package/workspace/lib/headless.js +10 -2
- package/workspace/lib/improve-cli.js +69 -0
- package/workspace/lib/improve-loop.js +453 -0
- package/workspace/lib/improve-runs.js +219 -0
- package/workspace/lib/job-graph.js +9 -0
- package/workspace/lib/lab-present.js +24 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/routes-autonomy.js +7 -2
- package/workspace/lib/routes-lab.js +12 -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/cozy-lab.js +9 -3
- package/workspace/public/pm/cozy-present.css +33 -0
- package/workspace/public/pm/cozy-present.js +74 -0
- package/workspace/public/premium-present.html +21 -0
- package/workspace/run-tests.js +27 -3
- package/workspace/server.js +16 -1
- package/workspace/test-lists/improve-loop-engine.json +11 -0
- package/workspace/test-lists/live-round-present.json +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.579.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,32 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.579.0",
|
|
38
|
+
"at": "2026-11-17T02:01:31.178Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1312,
|
|
43
|
+
"t": "Present a prototype round on a shared screen (live round W3)",
|
|
44
|
+
"s": "Present a prototype round on a shared screen (live round W3)",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.578.0",
|
|
51
|
+
"at": "2026-11-17T01:49:28.275Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1311,
|
|
56
|
+
"t": "The always-on self-improvement loop engine (W3) and its cloud heartbeat playbook (W4)",
|
|
57
|
+
"s": "The always-on self-improvement loop engine (W3) and its cloud heartbeat playbook (W4)",
|
|
58
|
+
"k": "new"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.577.0",
|
|
38
64
|
"at": "2026-11-17T01:37:16.629Z",
|
|
@@ -278,32 +304,6 @@
|
|
|
278
304
|
"k": "fix"
|
|
279
305
|
}
|
|
280
306
|
]
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"v": "0.559.0",
|
|
284
|
-
"at": "2026-11-11T02:38:19.186Z",
|
|
285
|
-
"f": 4,
|
|
286
|
-
"prs": [
|
|
287
|
-
{
|
|
288
|
-
"n": 1288,
|
|
289
|
-
"t": "Retire board and portfolio documents and the product page Documents tab",
|
|
290
|
-
"s": "Retire board and portfolio documents and the product page Documents tab",
|
|
291
|
-
"k": "new"
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"v": "0.558.0",
|
|
297
|
-
"at": "2026-11-11T02:24:57.842Z",
|
|
298
|
-
"f": 4,
|
|
299
|
-
"prs": [
|
|
300
|
-
{
|
|
301
|
-
"n": 1287,
|
|
302
|
-
"t": "Pick the kind of work on a new initiative",
|
|
303
|
-
"s": "Pick the kind of work on a new initiative",
|
|
304
|
-
"k": "new"
|
|
305
|
-
}
|
|
306
|
-
]
|
|
307
307
|
}
|
|
308
308
|
]
|
|
309
309
|
}
|
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-17T02:01:28Z"}
|
|
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-17T02:01:28Z"}
|
|
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-17T02:01:28Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.579.0",
|
|
4
|
+
"at": "2026-11-17T02:01:31.178Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1312,
|
|
9
|
+
"t": "Present a prototype round on a shared screen (live round W3)",
|
|
10
|
+
"s": "Present a prototype round on a shared screen (live round W3)",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.578.0",
|
|
17
|
+
"at": "2026-11-17T01:49:28.275Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1311,
|
|
22
|
+
"t": "The always-on self-improvement loop engine (W3) and its cloud heartbeat playbook (W4)",
|
|
23
|
+
"s": "The always-on self-improvement loop engine (W3) and its cloud heartbeat playbook (W4)",
|
|
24
|
+
"k": "new"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.577.0",
|
|
4
30
|
"at": "2026-11-17T01:37:16.629Z",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "What PMOS does behind the scenes, and what stays yours"
|
|
4
4
|
description: "Every job PMOS runs by itself, what agents apply by themselves with Undo (D106), long-running goals, the team of role agents, the idle lab, and the PM-only acts."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-17
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# What PMOS does behind the scenes
|
|
@@ -216,6 +216,16 @@ A column with no source is left out, with one line that says why. PMOS is still
|
|
|
216
216
|
|
|
217
217
|
Each prototype opens in a sandboxed frame. It cannot reach PMOS or your data.
|
|
218
218
|
|
|
219
|
+
### Present a round
|
|
220
|
+
|
|
221
|
+
To show a round to other people, press ⤢ (Present this round) in the compare view's header. A new tab opens with the round's frames side by side, the initiative's name and the round number. Nothing else shows: no ✓ or ✕, no History, no menus. Share that tab on the call, or put it on the screen in the room.
|
|
222
|
+
|
|
223
|
+
- To fill the screen with one frame, tap it, or press its key: 1 to 3, or A to C.
|
|
224
|
+
- In a full-screen frame, you can use the prototype. The arrow keys go to the next or the earlier frame.
|
|
225
|
+
- To show all the frames again, press Esc or ⤡ in the corner. Esc works only when the focus is not in the prototype, so ⤡ is always there.
|
|
226
|
+
|
|
227
|
+
On a phone, the frames show one under the other. Present mode keeps and drops nothing: go back to the compare view to do that.
|
|
228
|
+
|
|
219
229
|
### Intelligence › Lab
|
|
220
230
|
|
|
221
231
|
The Lab shows only once there is something to show. Top to bottom:
|
package/workspace/guide/cli.md
CHANGED
|
@@ -171,6 +171,7 @@ Set when PMOS grills, and how much it may spend, with these commands (or in **Se
|
|
|
171
171
|
|
|
172
172
|
- `pmos grill mode [full|exits|off]`: when PMOS grills by itself. `exits` grills only before a stage ends. `PMOS_GRILL=off` turns it off on this computer.
|
|
173
173
|
- `pmos grill cap [<dollars>]`: the monthly credit cap, in US dollars (10 by default).
|
|
174
|
+
- `pmos grill cap unlimited`: no dollar limit for background work, because the runs use your plan. PMOS still backs off when the plan's usage limit is hit. Any number turns the cap back on.
|
|
174
175
|
- `pmos grill spend`: what this month spent, each run's cost, and whether PMOS paused.
|
|
175
176
|
|
|
176
177
|
PMOS's grill run files with these commands, which refuse outside that run:
|
|
@@ -205,6 +206,14 @@ PMOS's grill run files with these commands, which refuse outside that run:
|
|
|
205
206
|
- `pmos loop resume <id> --note "<your answer>"` answers a loop that waits for you.
|
|
206
207
|
- `pmos loop stop <id>` stops a goal. `pmos ai off goal-loops` stops every goal loop.
|
|
207
208
|
|
|
209
|
+
### pmos improve: the improvement loop
|
|
210
|
+
|
|
211
|
+
PMOS looks for problems that repeat in a product (your Undos and ✕ reasons, reverts, CI failures, missed outcomes) and learns from them while you are away. A lesson goes into the product's memory with Undo. A change to a skill, an agent rule or a gate is only proposed under ✦.
|
|
212
|
+
|
|
213
|
+
- `pmos improve help` lists the commands. `pmos improve status`: what the loop found, and what it kept, reverted, tried or waits on.
|
|
214
|
+
- `pmos ai off improve`: stops the loop on this computer.
|
|
215
|
+
- Inside an improvement run only: `pmos improve lesson --text "<a short fact>"` and `pmos improve propose --text "<what to change and why>"`.
|
|
216
|
+
|
|
208
217
|
### pmos team: the role agents
|
|
209
218
|
|
|
210
219
|
- `pmos team roles`: each role, what it owns, what wakes it, its class and its daily budget.
|
|
@@ -101,6 +101,8 @@ An "off" switch accepts `off`, `0`, `false` or `no` unless the row says a differ
|
|
|
101
101
|
| `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 | — |
|
|
102
102
|
| `PMOS_FACTORY_GH_TOKEN` | The factory's own GitHub token, when `pmos/factory.json` names it in `identity.token_env`. The name must start with `PMOS_FACTORY_`. PMOS gives it to gh for its own calls and removes it from every agent run. Never put it in a file. | not set: your gh login | — |
|
|
103
103
|
| `PMOS_VERIFY` | `off` stops the verifier that checks each merged pull request. | on | `pmos ai off verify` |
|
|
104
|
+
| `PMOS_IMPROVE` | `off` stops the improvement loop (learning from problems that repeat). `1` turns it on for a scratch server. | on | `pmos ai off improve` |
|
|
105
|
+
| `PMOS_IMPROVE_STAGE` | A number from 0 to 4 that you set to start a stage of the improvement loop before its exit test passes. The loop never sets it. | none | — |
|
|
104
106
|
| `PMOS_VERIFY_CHANGES` | `off` stops the check of the changes PMOS made by itself. A failed check sends that kind of change back to asking. | on | `pmos ai off verify` |
|
|
105
107
|
| `PMOS_SIGNALS` | `off` stops the hourly harvest of improvement signals (feedback, Undo, reverts, verifier failures) into the signals ledger. | on | `PMOS_SIGNALS=off` |
|
|
106
108
|
| `PMOS_CHECK_REF`, `PMOS_CHECK_DIR` | Set by PMOS for one check run only. They name the change it checks and the ledger it writes to. Do not set them yourself. | — | — |
|
|
@@ -262,6 +264,7 @@ PMOS sets these in the environment of a terminal session or a background run. Do
|
|
|
262
264
|
| `PMOS_SHARE_PARENT` | The process id of the workspace server, so the share server stops with it. | none | — |
|
|
263
265
|
| `PMOS_AI_RUN` | Set inside an AI run, so the run cannot change its own switch. | none | — |
|
|
264
266
|
| `PMOS_VERIFY_RUN` | Set inside a verifier run: the one run its verdict may be recorded for, never the builder's own session. | none | — |
|
|
267
|
+
| `PMOS_IMPROVE_RUN`, `PMOS_IMPROVE_WS`, `PMOS_IMPROVE_AREA`, `PMOS_IMPROVE_STATE`, `PMOS_IMPROVE_ROOT` | Set inside an improvement run: its run, workspace, area, state folder and product folder. Its only writes are `pmos improve lesson` and `pmos improve propose`. | none | — |
|
|
265
268
|
| `PMOS_REVIEW_RUN` | Set inside a pre-merge review run: the one work item and commit (`<item>@<sha>`) its verdict may be recorded for. Never the Builder's run. | none | — |
|
|
266
269
|
| `PMOS_BUILD_DIR` | The folder where `pmos build claim` makes each work item's worktree, outside the repository. | `~/.pmos/build` | — |
|
|
267
270
|
| `PMOS_CHECK` | Set to `1` inside each product check that `pmos build check` and `pmos build propose` run in a work item's worktree, with no network. A check can read it. | none | — |
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
* job runs even when the PM never stepped away, so a once-a-day job still runs once a day.
|
|
28
28
|
* hours quiet hours hold step 5. Steps 2 to 4 keep the hours rules they have today (each job's own window).
|
|
29
29
|
* spend Settings › Claude's checks spend limit (grill.cap, the month's spend from grill-runs.jsonl). At the limit step 5 holds.
|
|
30
|
+
* The PM may set background use to unlimited (Settings ai.unlimited, `pmos grill cap unlimited`; Wawan 2026-11-17: the runs use
|
|
31
|
+
* the subscription plan): then spendHold() never holds, and the usage-limit hold (lib/orchestrator-quota.js) is the brake.
|
|
30
32
|
* Steps 2 to 4 are not held: grill holds its own runs at the cap, and the rest run on the PM's plan, not on credits.
|
|
31
33
|
* capacity CAP (3) background runs at once (lib/orchestrator-spawn.js running(): the Driver's runs, the scheduled runs and the
|
|
32
34
|
* PM's working chat sessions). At the limit step 5 holds. Steps 2 to 4 start their runs through orchestrator-spawn,
|
|
@@ -82,6 +84,7 @@ const JOBS = Object.freeze([
|
|
|
82
84
|
{ id: 'report-structure', step: 4, label: 'Report structure' },
|
|
83
85
|
{ id: 'team', step: 4, label: 'Role agents' },
|
|
84
86
|
{ id: 'scan', step: 5, label: 'Horizon scan' },
|
|
87
|
+
{ id: 'improve', step: 5, label: 'Improvement loop' }, // improve-loop-engine: lessons from repeated problems (lib/improve-runs.js)
|
|
85
88
|
{ id: 'idle-lab', step: 5, label: 'Idle lab' },
|
|
86
89
|
]);
|
|
87
90
|
const BY_ID = new Map(JOBS.map((j) => [j.id, j]));
|
|
@@ -93,6 +96,18 @@ const hhmmMs = (now, hhmm) => {
|
|
|
93
96
|
const d = new Date(now); d.setHours(+m[1], +m[2], 0, 0); return d.getTime();
|
|
94
97
|
};
|
|
95
98
|
|
|
99
|
+
/** PURE. The spend hold for step 5: no hold when background use is unlimited or the month's spend is under the cap. */
|
|
100
|
+
function spendHold({ unlimited = false, ok = true, cap = null } = {}) {
|
|
101
|
+
if (unlimited || ok) return { atCap: false };
|
|
102
|
+
return { atCap: true, why: `this month's spend is at the $${cap} limit in Settings › PMOS's checks` };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Background use set to unlimited in Settings (ai.unlimited) in this state folder. */
|
|
106
|
+
function unlimitedIn(stateDir) {
|
|
107
|
+
if (!stateDir) return false;
|
|
108
|
+
try { return require('./settings-store.js').get(stateDir, 'ai.unlimited') === true; } catch { return false; }
|
|
109
|
+
}
|
|
110
|
+
|
|
96
111
|
/** PURE. The turn of every job this tick. `offOf(id)` → null | reason; spend: { atCap, why? } | null; workEnd: '18:00' (the day-check
|
|
97
112
|
* end), for the last-hour rule. Each row's idle is true when the PM has been away idleLimit or more, or in the last hour of the day. */
|
|
98
113
|
function plan({ jobs = JOBS, now = Date.now(), idleMs = 0, idleLimit = 30 * 60 * 1000, quiet = false, running = 0, cap = CAP, offOf = () => null, spend = null, workEnd = null } = {}) {
|
|
@@ -221,7 +236,7 @@ function create(host = {}) {
|
|
|
221
236
|
const rows = plan({
|
|
222
237
|
jobs, now, idleMs: idle(now), idleLimit: host.idleLimit, quiet: !!(host.quiet && call(() => host.quiet(now), false)),
|
|
223
238
|
running: host.running ? call(() => host.running(), 0) : 0, offOf: (id) => (host.offOf ? call(() => host.offOf(id), null) : null),
|
|
224
|
-
spend: host.spend ? call(() => host.spend(now), null) : null, workEnd: host.workEnd ? call(() => host.workEnd(), null) : null,
|
|
239
|
+
spend: unlimitedIn(host.stateDir) ? spendHold({ unlimited: true }) : host.spend ? call(() => host.spend(now), null) : null, workEnd: host.workEnd ? call(() => host.workEnd(), null) : null,
|
|
225
240
|
});
|
|
226
241
|
for (const r of rows) {
|
|
227
242
|
noteTurn(now, r);
|
|
@@ -240,4 +255,4 @@ function create(host = {}) {
|
|
|
240
255
|
};
|
|
241
256
|
}
|
|
242
257
|
|
|
243
|
-
module.exports = { CAP, STEPS, JOBS, plan, holderOf, initiativeOfOrigin, jobOfOrigin, create };
|
|
258
|
+
module.exports = { CAP, STEPS, JOBS, plan, spendHold, unlimitedIn, holderOf, initiativeOfOrigin, jobOfOrigin, create };
|
|
@@ -30,7 +30,7 @@ const USAGE = [
|
|
|
30
30
|
' pmos grill find decision --json - { "decision": "D79", "quote": "<its words>", "plan": { "label", "ref": "<path>:<line>", "quote": "<the plan\'s words>" },',
|
|
31
31
|
' "conflict": "<one line>", "recommend": "keep|change|drop", "next": "<one next step>", "confidence": "high|medium" }',
|
|
32
32
|
' pmos grill mode [full|exits|off] when PMOS grills by itself',
|
|
33
|
-
' pmos grill cap [<dollars
|
|
33
|
+
' pmos grill cap [<dollars>|unlimited] the monthly credit cap; at the cap PMOS pauses; unlimited: no dollar limit',
|
|
34
34
|
' pmos grill spend what this month spent',
|
|
35
35
|
'Every finding carries its source and a next step. It waits for the PM\'s ✓. Nothing is sent.',
|
|
36
36
|
];
|
|
@@ -69,6 +69,15 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
|
|
|
69
69
|
return 0;
|
|
70
70
|
}
|
|
71
71
|
const key = 'grill.' + verb, val = args[1];
|
|
72
|
+
// Wawan 2026-11-17: background use may be unlimited, because the runs use the subscription plan. `cap unlimited` turns the dollar limit
|
|
73
|
+
// off (Settings ai.unlimited); any number turns it back on at that cap.
|
|
74
|
+
if (verb === 'cap' && val !== undefined && !inRun) {
|
|
75
|
+
const unl = /^(unlimited|none|off)$/i.test(String(val));
|
|
76
|
+
const u = SS.set(dir, 'ai.unlimited', unl);
|
|
77
|
+
if (!u.ok) { say('✗ ' + u.error); return 1; }
|
|
78
|
+
if (unl) { say('background use: unlimited (the usage-limit hold is the brake)'); return 0; }
|
|
79
|
+
}
|
|
80
|
+
if (verb === 'cap' && val === undefined && SS.get(dir, 'ai.unlimited') === true) { say('grill.cap: unlimited'); return 0; }
|
|
72
81
|
if (val === undefined) { say(`${key}: ${SS.get(dir, key)}${verb === 'mode' && G.off(env) ? ' (PMOS_GRILL=off wins: off)' : ''}`); return 0; }
|
|
73
82
|
if (inRun) { say('✗ a grill run never changes its own mode or cap'); return 1; }
|
|
74
83
|
const v = verb === 'cap' ? Number(val) : val;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (initiative workspace-headless-jobs; PM decision 2026-10-11: keep Jev, no direct Claude API, background
|
|
4
4
|
* jobs that need no human run headless).
|
|
5
5
|
*
|
|
6
|
-
* kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | 'propose' | 'metric-draft' | 'grill' | 'impact' | 'verify' | 'review' | 'metric-read' | 'lab-proto' | 'lab-scan' | 'team' | null (null: open a pane, as before)
|
|
6
|
+
* kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | 'propose' | 'metric-draft' | 'grill' | 'impact' | 'verify' | 'review' | 'improve' | 'metric-read' | 'lab-proto' | 'lab-scan' | 'team' | null (null: open a pane, as before)
|
|
7
7
|
* argsFor(kind, { modelArgs, addDirs, writePaths }) → the argv after `claude` (writePaths: the one render file a report-design job may write;
|
|
8
8
|
* for the skill kind, the folders the run may write in, from skillWriteDirs)
|
|
9
9
|
* skillWriteDirs(skill, { root, scratch }) → the absolute folders a background skill run may write in: its scratch folder and the state folders its skill writes
|
|
@@ -130,6 +130,9 @@ const VERIFY_ORIGINS = Object.freeze(['verify:']);
|
|
|
130
130
|
// factory-premerge-reviewer: the independent review of a factory pull request before it merges by itself (origin `factory-review:<item>:<token>`,
|
|
131
131
|
// lib/factory-review.js). Read-only; its only write is `pmos build reviewed`, pinned by PMOS_REVIEW_RUN to one item and commit. Never the Builder's run.
|
|
132
132
|
const REVIEW_ORIGINS = Object.freeze(['factory-review:']);
|
|
133
|
+
// improve-loop-engine: the improvement loop's run in a product (origin `improve:<ws>:<area>:<token>`, lib/improve-runs.js). Its only writes are
|
|
134
|
+
// `pmos improve lesson` (a curated-memory entry with Undo) and `pmos improve propose` (a class C ✦), pinned by PMOS_IMPROVE_RUN and PMOS_IMPROVE_AREA to that area and run.
|
|
135
|
+
const IMPROVE_ORIGINS = Object.freeze(['improve:']);
|
|
133
136
|
// batch 16 item 6: Claude reads the goals with their recipes (origin `metric-read:<ws>:<run>`, lib/metric-read-runs.js). Its only write is
|
|
134
137
|
// `pmos metrics reading`, pinned by the server to that run and those goals.
|
|
135
138
|
const METRIC_READ_ORIGINS = Object.freeze(['metric-read:']);
|
|
@@ -219,6 +222,10 @@ const TOOLS = Object.freeze({
|
|
|
219
222
|
// The pre-merge review run (lib/factory-review.js): read and search, git only to read, and the one verb that records the verdict for the item
|
|
220
223
|
// and commit PMOS_REVIEW_RUN pins. It reads the diff, which is untrusted text, so it holds nothing that sends: no gh, no push, no web, no Write.
|
|
221
224
|
review: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(git show *)', 'Bash(git log *)', 'Bash(git diff *)', 'Bash(pmos build reviewed *)', 'Bash(date *)']),
|
|
225
|
+
// The improvement loop's product run (lib/improve-runs.js): read and search the product and its records, and its two writes. No Write, no
|
|
226
|
+
// Edit, no web, nothing that sends: a skill or harness change is only ever proposed.
|
|
227
|
+
improve: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(git log *)', 'Bash(git show *)', 'Bash(pmos improve lesson *)', 'Bash(pmos improve propose *)',
|
|
228
|
+
'Bash(pmos improve status)', 'Bash(pmos initiative export *)', 'Bash(pmos initiative list *)', 'Bash(date *)']),
|
|
222
229
|
// The reading run (lib/metric-read-runs.js): read and search, and the one verb that files a reading. The PM's analytics and Jira are read through
|
|
223
230
|
// the PM's own connectors only where the PM's settings allow it. No Write, no Edit, no web fetch, nothing that sends.
|
|
224
231
|
'metric-read': Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos metrics reading *)', 'Bash(pmos source show *)', 'Bash(pmos source status *)', 'Bash(date *)']),
|
|
@@ -364,6 +371,7 @@ function kindFor({ agent, origin, skill, env } = {}) {
|
|
|
364
371
|
if (IMPACT_ORIGINS.some((p) => o.startsWith(p))) return 'impact';
|
|
365
372
|
if (VERIFY_ORIGINS.some((p) => o.startsWith(p))) return 'verify';
|
|
366
373
|
if (REVIEW_ORIGINS.some((p) => o.startsWith(p))) return 'review';
|
|
374
|
+
if (IMPROVE_ORIGINS.some((p) => o.startsWith(p))) return 'improve';
|
|
367
375
|
if (METRIC_READ_ORIGINS.some((p) => o.startsWith(p))) return 'metric-read';
|
|
368
376
|
if (LAB_PROTO_ORIGINS.some((p) => o.startsWith(p))) return 'lab-proto';
|
|
369
377
|
if (TEAM_ORIGINS.some((p) => o.startsWith(p))) return 'team';
|
|
@@ -661,7 +669,7 @@ const RUN_ENV = Object.freeze(['PMOS_SCAN_FILE', 'PMOS_SCAN_ORIGIN', 'PMOS_SCAN_
|
|
|
661
669
|
'PMOS_METRIC_READ_FILE', 'PMOS_METRIC_READ_RECORDS', 'PMOS_METRIC_READ_DRAFTS', 'PMOS_METRIC_READ_WS', 'PMOS_METRIC_READ_RUN', 'PMOS_METRIC_READ_RIDS', 'PMOS_METRIC_READ_TEST',
|
|
662
670
|
'PMOS_PROPOSE_FILE', 'PMOS_PROPOSE_WS', 'PMOS_PROPOSE_BOARD', 'PMOS_PROPOSE_INI', 'PMOS_PROPOSE_RUN',
|
|
663
671
|
'PMOS_GRILL_FILE', 'PMOS_GRILL_LOG', 'PMOS_GRILL_WS', 'PMOS_GRILL_BOARD', 'PMOS_GRILL_INI', 'PMOS_GRILL_RUN', 'PMOS_GRILL_BUDGET',
|
|
664
|
-
'PMOS_IMPACT_FILE', 'PMOS_IMPACT_RUN', 'PMOS_VERIFY_RUN', 'PMOS_REVIEW_RUN', 'PMOS_CHECK_REF', 'PMOS_CHECK_DIR', 'PMOS_MS_REVIEW_FILE', 'PMOS_MS_REVIEW_RUN', 'PMOS_MS_REVIEW_PROGRAM',
|
|
672
|
+
'PMOS_IMPACT_FILE', 'PMOS_IMPACT_RUN', 'PMOS_VERIFY_RUN', 'PMOS_REVIEW_RUN', 'PMOS_IMPROVE_RUN', 'PMOS_IMPROVE_WS', 'PMOS_IMPROVE_AREA', 'PMOS_IMPROVE_STATE', 'PMOS_IMPROVE_ROOT', 'PMOS_CHECK_REF', 'PMOS_CHECK_DIR', 'PMOS_MS_REVIEW_FILE', 'PMOS_MS_REVIEW_RUN', 'PMOS_MS_REVIEW_PROGRAM',
|
|
665
673
|
'PMOS_TEAM_FILE', 'PMOS_TEAM_ROOT', 'PMOS_TEAM_WS', 'PMOS_TEAM_ROLE', 'PMOS_TEAM_RUN', 'PMOS_TEAM_INI', 'PMOS_TEAM_MODE',
|
|
666
674
|
'PMOS_LAB_RUN', 'PMOS_LAB_KIND', 'PMOS_LAB_PENDING', 'PMOS_LAB_INI', 'PMOS_LAB_BUDGET', 'PMOS_LAB_PAGES', 'PMOS_LAB_SPECIMENS']);
|
|
667
675
|
function runEnvOf(extra) {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* improve-cli.js — `pmos improve …`: the self-improvement loop in this product (initiative improve-loop-engine).
|
|
3
|
+
*
|
|
4
|
+
* pmos improve status [--json] the stage, what the loop found (top areas), and kept / reverted / tried / waiting
|
|
5
|
+
* pmos improve help
|
|
6
|
+
* INSIDE AN IMPROVEMENT RUN only (the server pins PMOS_IMPROVE_RUN, _WS, _AREA, _STATE, _ROOT; nothing here takes them as arguments):
|
|
7
|
+
* pmos improve lesson --text "<a short fact, as what to do>" the run's one lesson: a curated-memory entry, 30-day stale date, with Undo
|
|
8
|
+
* pmos improve propose --text "<what to change and why>" [--ini <initiative>] a skill or harness change: a class C ✦, never applied
|
|
9
|
+
* PMOS itself runs the same loop with `node scripts/improve.js` in the PMOS repository.
|
|
10
|
+
*/
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const IR = require('./improve-runs.js');
|
|
13
|
+
const L = require('./improve-loop.js');
|
|
14
|
+
|
|
15
|
+
const USAGE = [
|
|
16
|
+
'pmos improve status [--json] what the improvement loop found here, and what it kept, reverted, tried or waits on',
|
|
17
|
+
'Inside an improvement run only:',
|
|
18
|
+
' pmos improve lesson --text "…" record the run\'s one lesson (curated memory, with Undo)',
|
|
19
|
+
' pmos improve propose --text "…" propose a skill or harness change (a ✦ for the PM; never applied)',
|
|
20
|
+
];
|
|
21
|
+
const COMMANDS = Object.freeze({ improve: ['status', 'lesson', 'propose', 'help'] });
|
|
22
|
+
|
|
23
|
+
function parse(args) {
|
|
24
|
+
const pos = [], flags = {};
|
|
25
|
+
for (let i = 0; i < args.length; i++) {
|
|
26
|
+
const a = args[i];
|
|
27
|
+
if (a.startsWith('--')) { const k = a.slice(2); flags[k] = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : true; } else pos.push(a);
|
|
28
|
+
}
|
|
29
|
+
return { pos, flags };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function run(argv, { say = (s) => console.log(s), env = process.env, cwd = process.cwd(), now = Date.now() } = {}) {
|
|
33
|
+
const args = argv[0] === 'improve' ? argv.slice(1) : argv.slice();
|
|
34
|
+
const verb = args[0];
|
|
35
|
+
if (!verb || ['help', '--help', '-h'].includes(verb)) { for (const l of USAGE) say(l); return verb ? 0 : 1; }
|
|
36
|
+
if (!COMMANDS.improve.includes(verb)) { say(`unknown improve command "${verb}" — one of ${COMMANDS.improve.join(', ')}`); return 2; }
|
|
37
|
+
const { flags } = parse(args.slice(1));
|
|
38
|
+
const json = !!flags.json;
|
|
39
|
+
const inRun = !!env.PMOS_IMPROVE_RUN;
|
|
40
|
+
const pin = { stateDir: env.PMOS_IMPROVE_STATE, root: env.PMOS_IMPROVE_ROOT, ws: env.PMOS_IMPROVE_WS, area: env.PMOS_IMPROVE_AREA, run: env.PMOS_IMPROVE_RUN };
|
|
41
|
+
|
|
42
|
+
if (verb === 'lesson' || verb === 'propose') {
|
|
43
|
+
if (!inRun) { say(`✗ pmos improve ${verb} runs only inside an improvement run, which PMOS starts`); return 1; }
|
|
44
|
+
if (typeof flags.text !== 'string') { say(`✗ pmos improve ${verb} needs --text "…"`); return 2; }
|
|
45
|
+
const r = verb === 'lesson' ? IR.lesson({ ...pin, text: flags.text, now, env }) : IR.propose({ ...pin, text: flags.text, ini: typeof flags.ini === 'string' ? flags.ini : null, now });
|
|
46
|
+
if (!r.ok) { say('✗ ' + r.error); return 1; }
|
|
47
|
+
say(verb === 'lesson' ? (r.applied ? `learned (${r.ref}); the PM can undo it` : `the lesson waits for the PM: ${r.why}`) : (r.id ? `proposed under ✦ (${r.id})` : 'proposed: it waits for the PM'));
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
// status: this folder's product
|
|
51
|
+
const root = pin.root || cwd;
|
|
52
|
+
const sd = pin.stateDir || require('./driver.js').stateDirOf(root, { create: false });
|
|
53
|
+
if (IR.isSelf(root)) { say('This is PMOS itself: run `node scripts/improve.js status`.'); return 0; }
|
|
54
|
+
if (!sd) { say('no PMOS state folder here'); return 1; }
|
|
55
|
+
const sigs = (() => { try { const S = require('./signals.js'); return S.readSignals(S.productFile(sd)) || []; } catch { return require('fs').existsSync(path.join(sd, IR.SIGNALS)) ? require('fs').readFileSync(path.join(sd, IR.SIGNALS), 'utf8').split('\n').filter(Boolean).map((l) => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean) : []; } })();
|
|
56
|
+
const lines = require('fs').existsSync(path.join(sd, IR.LEDGER)) ? require('fs').readFileSync(path.join(sd, IR.LEDGER), 'utf8').split('\n').filter(Boolean).map((l) => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean) : [];
|
|
57
|
+
const ranked = L.rank(L.scout(sigs, { now }));
|
|
58
|
+
const d = L.digest(L.fold(lines), { now, signals: sigs, ranked });
|
|
59
|
+
const o = { signals: sigs.length, top: ranked.slice(0, 8).map((c) => ({ area: c.area, score: c.score, eligible: c.eligible, why: c.why })), digest: d, off: IR.off(env) };
|
|
60
|
+
if (json) { say(JSON.stringify({ ok: true, ...o })); return 0; }
|
|
61
|
+
const rows = (k, xs) => `${k}: ${xs.length ? xs.map((x) => `${x.area}${x.why ? ' (' + x.why + ')' : ''}`).join('; ') : 'none'}`;
|
|
62
|
+
say(`${o.signals} signals.${o.off ? ' The loop is off on this computer.' : ''}`);
|
|
63
|
+
for (const c of o.top) say(` ${c.eligible ? '•' : '·'} ${c.area} ${c.score}${c.why ? ' — ' + c.why : ''}`);
|
|
64
|
+
say(rows('Kept', d.kept)); say(rows('Reverted', d.reverted)); say(rows('Tried', d.tried)); say(rows('Waiting', d.waiting));
|
|
65
|
+
if (d.watermelon) say('Signal check: ' + d.watermelon);
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = { run, COMMANDS, USAGE };
|