create-pmos 0.542.0 → 0.544.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 -57
- 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/settings-and-switches.md +2 -1
- package/workspace/lib/claude-signin.js +51 -0
- package/workspace/lib/corrections-memory.js +51 -0
- package/workspace/lib/harness-health.js +1 -1
- package/workspace/lib/headless.js +1 -1
- package/workspace/lib/refresh-run.js +10 -0
- package/workspace/lib/routes-lab.js +1 -0
- package/workspace/lib/routes-meeting-focus.js +1 -1
- package/workspace/lib/routes-proposals.js +2 -0
- package/workspace/lib/source-heal.js +1 -1
- package/workspace/lib/team-runs.js +32 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/server.js +14 -2
- package/workspace/test-lists/claude-signin.json +5 -0
- package/workspace/test-lists/corrections-memory.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.544.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": {
|
|
@@ -32,6 +32,32 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.544.0",
|
|
37
|
+
"at": "2026-11-08T14:45:01.680Z",
|
|
38
|
+
"f": 4,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1272,
|
|
42
|
+
"t": "Claude calls and sign-in advice follow the chosen Claude profile; a session stuck at sign-in ends",
|
|
43
|
+
"s": "Claude calls and sign-in advice follow the chosen Claude profile; a session stuck at sign-in ends",
|
|
44
|
+
"k": "fix"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"v": "0.543.0",
|
|
50
|
+
"at": "2026-11-08T10:18:52.684Z",
|
|
51
|
+
"f": 4,
|
|
52
|
+
"prs": [
|
|
53
|
+
{
|
|
54
|
+
"n": 1271,
|
|
55
|
+
"t": "✕ reasons become memory; each team role reads a notebook of its earlier work",
|
|
56
|
+
"s": "✕ reasons become memory; each team role reads a notebook of its earlier work",
|
|
57
|
+
"k": "new"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
35
61
|
{
|
|
36
62
|
"v": "0.542.0",
|
|
37
63
|
"at": "2026-11-08T06:18:15.279Z",
|
|
@@ -397,62 +423,6 @@
|
|
|
397
423
|
"k": "fix"
|
|
398
424
|
}
|
|
399
425
|
]
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"v": "0.524.0",
|
|
403
|
-
"at": "2026-11-04T08:57:48.087Z",
|
|
404
|
-
"f": 4,
|
|
405
|
-
"prs": [
|
|
406
|
-
{
|
|
407
|
-
"n": 1224,
|
|
408
|
-
"t": "Setup as one conversation, with the fundamentals settled (onboarding B1)",
|
|
409
|
-
"s": "Setup as one conversation, with the fundamentals settled (onboarding B1)",
|
|
410
|
-
"k": "new"
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
"n": 1223,
|
|
414
|
-
"t": "A feature appears when its moment comes (onboarding B3, gradual exposure)",
|
|
415
|
-
"s": "A feature appears when its moment comes (onboarding B3, gradual exposure)",
|
|
416
|
-
"k": "new"
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"n": 1222,
|
|
420
|
-
"t": "After setup, Home shows what it did, the product portrait and the drafted first initiative (onboarding B2)",
|
|
421
|
-
"s": "After setup, Home shows what it did, the product portrait and the drafted first initiative (onboarding B2)",
|
|
422
|
-
"k": "new"
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
"n": 1227,
|
|
426
|
-
"t": "Idle lab screens: ✦ cards, compare view and Intelligence › Lab (build U)",
|
|
427
|
-
"s": "Idle lab screens: ✦ cards, compare view and Intelligence › Lab (build U)",
|
|
428
|
-
"k": "new"
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
"n": 1234,
|
|
432
|
-
"t": "Good morning reads the quarter — goal states, the PM's line, snapshot, goal tags, Yes effect (GM1)",
|
|
433
|
-
"s": "Good morning reads the quarter — goal states, the PM's line, snapshot, goal tags, Yes effect (GM1)",
|
|
434
|
-
"k": "new"
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
"n": 1228,
|
|
438
|
-
"t": "One queue for all background work (idle lab build Q)",
|
|
439
|
-
"s": "One queue for all background work (idle lab build Q)",
|
|
440
|
-
"k": "new"
|
|
441
|
-
}
|
|
442
|
-
]
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
"v": "0.523.0",
|
|
446
|
-
"at": "2026-11-04T08:06:51.586Z",
|
|
447
|
-
"f": 4,
|
|
448
|
-
"prs": [
|
|
449
|
-
{
|
|
450
|
-
"n": 1221,
|
|
451
|
-
"t": "The installed app carries the kit, and ~/PMOS holds one product",
|
|
452
|
-
"s": "The installed app carries the kit, and ~/PMOS holds one product",
|
|
453
|
-
"k": "fix"
|
|
454
|
-
}
|
|
455
|
-
]
|
|
456
426
|
}
|
|
457
427
|
]
|
|
458
428
|
}
|
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-08T14:44:58Z"}
|
|
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-08T14:44:58Z"}
|
|
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-08T14:44:58Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.544.0",
|
|
4
|
+
"at": "2026-11-08T14:45:01.680Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1272,
|
|
9
|
+
"t": "Claude calls and sign-in advice follow the chosen Claude profile; a session stuck at sign-in ends",
|
|
10
|
+
"s": "Claude calls and sign-in advice follow the chosen Claude profile; a session stuck at sign-in ends",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.543.0",
|
|
17
|
+
"at": "2026-11-08T10:18:52.684Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1271,
|
|
22
|
+
"t": "✕ reasons become memory; each team role reads a notebook of its earlier work",
|
|
23
|
+
"s": "✕ reasons become memory; each team role reads a notebook of its earlier work",
|
|
24
|
+
"k": "new"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.542.0",
|
|
4
30
|
"at": "2026-11-08T06:18:15.279Z",
|
|
@@ -118,7 +118,8 @@ An "off" switch accepts `off`, `0`, `false` or `no` unless the row says a differ
|
|
|
118
118
|
| `PMOS_AUTONAME_CMD` | The program that names sessions, in place of `claude`. | `claude` | — |
|
|
119
119
|
| `PMOS_AGENT_HOOKS` | `1` gives a plain Claude session the workspace hooks. | off | — |
|
|
120
120
|
| `PMOS_LEAN_JOBS` | How background runs start. `off` starts every run with all tools, skills and settings. `all` also starts the runs that read your connectors lean. By default a run that reads no connector starts lean, with only its own tools. | lean for runs with no connector | — |
|
|
121
|
-
| `PMOS_RUN_MEMORY` | `off` stops adding the repository's curated memory (what PMOS remembers about you and the product) to each background run. A web run never gets it. | on | — |
|
|
121
|
+
| `PMOS_RUN_MEMORY` | `off` stops adding the repository's curated memory (what PMOS remembers about you and the product) to each background run, and stops each team role's notebook (what became of its earlier work). A web run never gets it. | on | — |
|
|
122
|
+
| `PMOS_CORRECTION_MEMORY` | `off` stops your ✕ reasons from becoming memory. By default a reason of 12 characters or more is remembered as one unconfirmed entry for 30 days, at most 6 at once. | on | — |
|
|
122
123
|
| `PMOS_CLAUDE_HOME` | The one folder where PMOS looks for Claude transcripts. | the Claude config folders | — |
|
|
123
124
|
| `PMOS_HEADLESS_TIMEOUT_MS` | The longest time a background run may take. | 20 minutes | — |
|
|
124
125
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/*
|
|
3
|
+
* lib/claude-signin.js — the command the PM types to sign Claude in again: the one for the Claude profile PMOS runs under.
|
|
4
|
+
*
|
|
5
|
+
* Every background run starts under the PM's chosen Claude profile (prefs.json `claude`, Settings → Claude). The sign-in
|
|
6
|
+
* advice said "run claude" whatever that choice was. On a Mac whose runs use `claude-personal`, that advice signs in the
|
|
7
|
+
* wrong login, and the runs stay signed out (bug 2026-11-08). The advice now names the command of the chosen profile.
|
|
8
|
+
*
|
|
9
|
+
* commandFor(profile, home) → 'claude' | 'claude-personal' | 'CLAUDE_CONFIG_DIR=~/.claude-x claude'
|
|
10
|
+
* profile: the resolved profile (lib/profiles.js shape) or null for Claude's own login.
|
|
11
|
+
* configure({ profile }) the server registers () => profile (setResolver(fn) is the same); the libraries read it through command()
|
|
12
|
+
* command() the command for the profile chosen now ('claude' when nothing is registered or it fails)
|
|
13
|
+
* how() 'Open Terminal, run `<command>`, type /login and sign in.'
|
|
14
|
+
* signedOutWhy() the reason a background run shows when Claude was signed out
|
|
15
|
+
* paneSignedOut(screen) a terminal pane's screen is Claude's sign-in (expired login, login-method picker)
|
|
16
|
+
*/
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const os = require('os');
|
|
19
|
+
|
|
20
|
+
const SAFE = /^[a-zA-Z0-9._-]{1,80}$/;
|
|
21
|
+
const tilde = (p, home) => (home && (p === home || p.startsWith(home + path.sep)) ? '~' + p.slice(home.length) : p);
|
|
22
|
+
|
|
23
|
+
function commandFor(profile, home = os.homedir()) {
|
|
24
|
+
if (!profile || typeof profile !== 'object') return 'claude';
|
|
25
|
+
const d = profile.detected && profile.detected.source;
|
|
26
|
+
// an alias, a shell function or a launcher script: its name is a command the PM can type
|
|
27
|
+
if ((d === 'shell' || d === 'launcher') && SAFE.test(String(profile.id || ''))) return String(profile.id);
|
|
28
|
+
const dir = profile.env && typeof profile.env === 'object' ? profile.env.CLAUDE_CONFIG_DIR : '';
|
|
29
|
+
if (typeof dir === 'string' && dir) {
|
|
30
|
+
const shown = tilde(path.resolve(dir), home);
|
|
31
|
+
return /^[~a-zA-Z0-9._/-]+$/.test(shown) ? `CLAUDE_CONFIG_DIR=${shown} claude` : `CLAUDE_CONFIG_DIR='${shown.replace(/'/g, "'\\''")}' claude`;
|
|
32
|
+
}
|
|
33
|
+
return 'claude';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let resolver = null;
|
|
37
|
+
function setResolver(fn) { resolver = typeof fn === 'function' ? fn : null; }
|
|
38
|
+
/** The server's wiring: configure({ profile: () => profile }) → this module. */
|
|
39
|
+
function configure({ profile } = {}) { setResolver(profile); return module.exports; }
|
|
40
|
+
function command() {
|
|
41
|
+
if (!resolver) return 'claude';
|
|
42
|
+
try { return commandFor(resolver()); } catch { return 'claude'; }
|
|
43
|
+
}
|
|
44
|
+
const how = () => `Open Terminal, run \`${command()}\`, type /login and sign in.`;
|
|
45
|
+
// Claude Code's own sign-in screens in a terminal pane: the expired-login line, and the login-method picker it opens. Narrower than
|
|
46
|
+
// lib/headless.js signedOut(), which reads a run's result: a pane also shows the agent's own words, which may name a login.
|
|
47
|
+
const PANE_RE = /please run \/login|select login method|oauth (?:session|token) (?:has )?expired/i;
|
|
48
|
+
const paneSignedOut = (screen) => PANE_RE.test(String(screen || ''));
|
|
49
|
+
const signedOutWhy = () => `Claude is signed out on this computer. ${how()} PMOS carries on by itself afterwards.`;
|
|
50
|
+
|
|
51
|
+
module.exports = { commandFor, configure, setResolver, command, how, signedOutWhy, paneSignedOut };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* corrections-memory.js — the PM's ✕ reasons become curated memory by themselves (harness + memory evaluation, item 3, PM wawan 2026-11-08).
|
|
3
|
+
*
|
|
4
|
+
* When the PM drops a ✦ proposal or an idle-lab result and gives a reason, that reason is a correction every later run should know.
|
|
5
|
+
* remember() writes it to the repository's D72 memory (scripts/pmos-memory.js, through lib/memory.js) as one short entry:
|
|
6
|
+
* target memory · confidence unconfirmed · by agent:corrections · source <kind>:<ref> · stale_after +30 days
|
|
7
|
+
* so lib/headless.js memoryNote puts it in every background run, marked "(unconfirmed)" until the PM confirms it.
|
|
8
|
+
*
|
|
9
|
+
* BOUNDS. A reason shorter than MIN_WHY characters says nothing to learn from and is skipped. At most KEEP entries by agent:corrections
|
|
10
|
+
* live at once: the oldest is removed first. A full memory is never forced: the write is skipped and the reason stays on the ✕ line.
|
|
11
|
+
* The same text twice is written once. PMOS_CORRECTION_MEMORY=off stops it.
|
|
12
|
+
*
|
|
13
|
+
* remember(root, { what, why, source, env, now }) → { ok, wrote?: bool, why?: string } never throws
|
|
14
|
+
*/
|
|
15
|
+
const DAY = 86400000;
|
|
16
|
+
const BY = 'agent:corrections';
|
|
17
|
+
const MIN_WHY = 12;
|
|
18
|
+
const KEEP = 6;
|
|
19
|
+
const STALE_DAYS = 30;
|
|
20
|
+
const MAX = 200;
|
|
21
|
+
const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
22
|
+
const off = (env) => /^(off|0|false|no)$/i.test(String((env || process.env).PMOS_CORRECTION_MEMORY || '').trim());
|
|
23
|
+
|
|
24
|
+
function textOf(what, why) {
|
|
25
|
+
const head = `The PM dropped ${one(what, 60) || 'a proposal'}: `;
|
|
26
|
+
return one(head + '"' + one(why, MAX - head.length - 2) + '"', MAX);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function remember(root, { what = '', why = '', source = '', env = process.env, now = Date.now() } = {}) {
|
|
30
|
+
try {
|
|
31
|
+
const reason = one(why, 300);
|
|
32
|
+
if (!root || reason.length < MIN_WHY) return { ok: true, wrote: false, why: 'no reason to learn from' };
|
|
33
|
+
if (off(env)) return { ok: true, wrote: false, why: 'PMOS_CORRECTION_MEMORY=off' };
|
|
34
|
+
const c = require('./memory.js').core();
|
|
35
|
+
if (!c.ok) return { ok: true, wrote: false, why: c.error };
|
|
36
|
+
const M = c.core, text = textOf(what, reason);
|
|
37
|
+
const mine = () => M.load(root).state.entries.filter((e) => e.target === 'memory' && e.by === BY).sort((a, b) => String(a.at).localeCompare(String(b.at)));
|
|
38
|
+
let have = mine();
|
|
39
|
+
if (have.some((e) => e.text === text)) return { ok: true, wrote: false, why: 'already remembered' };
|
|
40
|
+
while (have.length >= KEEP) {
|
|
41
|
+
const r = M.write(root, { op: 'remove', target: 'memory', old: have[0].text, by: BY });
|
|
42
|
+
if (!r.ok) break;
|
|
43
|
+
have = mine();
|
|
44
|
+
}
|
|
45
|
+
const r = M.write(root, { op: 'add', target: 'memory', text, by: BY, confidence: 'unconfirmed', source: one(source, 120) || undefined,
|
|
46
|
+
stale_after: new Date(now + STALE_DAYS * DAY).toISOString() });
|
|
47
|
+
return r.ok ? { ok: true, wrote: true } : { ok: true, wrote: false, why: r.error };
|
|
48
|
+
} catch (e) { return { ok: false, wrote: false, why: String((e && e.message) || e).slice(0, 160) }; }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = { BY, MIN_WHY, KEEP, STALE_DAYS, textOf, remember };
|
|
@@ -84,7 +84,7 @@ function of({ now, settings, state = {}, log, briefAt = 0, sessions = [], lastTi
|
|
|
84
84
|
if (signedOut.length) {
|
|
85
85
|
const names = signedOut.map((x) => x.label);
|
|
86
86
|
const list = names.length === 1 ? names[0] : names.slice(0, -1).join(', ') + ' and ' + names[names.length - 1];
|
|
87
|
-
add('bad', 'signedout', `Claude could not sign in at ${hm(Math.max(...signedOut.map((x) => x.at)))}, so ${list} did not refresh. Press Refresh all. If it fails again, open Terminal, run claude and type /login.`);
|
|
87
|
+
add('bad', 'signedout', `Claude could not sign in at ${hm(Math.max(...signedOut.map((x) => x.at)))}, so ${list} did not refresh. Press Refresh all. If it fails again, open Terminal, run ${require('./claude-signin.js').command()} and type /login.`);
|
|
88
88
|
}
|
|
89
89
|
const sync = runs('sync')[0];
|
|
90
90
|
if (set.sources.sync && set.sources.sync.on && sync && sync.result === 'failed') {
|
|
@@ -618,7 +618,7 @@ function outcomeOf(r, { code = null, signal = null, timedOut = false, stopped =
|
|
|
618
618
|
else if (stopped) why = 'Stopped by you.';
|
|
619
619
|
else if (timedOut) why = `Stopped: still running after ${timeoutMin || Math.round(DEFAULT_TIMEOUT_MS / 60000)} minutes.`;
|
|
620
620
|
else if (signal) why = `The process was ended (${signal}).`;
|
|
621
|
-
else if (signedOut(res.text)) why =
|
|
621
|
+
else if (signedOut(res.text)) why = require('./claude-signin.js').signedOutWhy();
|
|
622
622
|
else if (!res.ok) why = `It exited with code ${code} and printed no result${res.text ? ': ' + oneLine(res.text.split('\n').filter(Boolean).pop(), 200) : '.'}`;
|
|
623
623
|
else if (res.isError) why = `The run reported an error${first ? ': ' + oneLine(first, 200) : '.'}`;
|
|
624
624
|
else why = `It exited with code ${code}.`;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* { stateDir, now?, homeWs(), proactive() → { quiet, dayCheck: { start, end, every } }, schedules: { read, write },
|
|
21
21
|
* startSkill(wsId, skill, name, origin) → { ok, session?, error? }, jobs: { [id]: (ws) → { ok, error? } },
|
|
22
22
|
* freshRows(ws) → [freshness row], copyPaths(id, ws) → [path], tell({ source, label, error, ws }), sessionAlive(id) → bool,
|
|
23
|
+
* sessionSignedOut?(id) → bool (its screen shows Claude's sign-in), stopSession?(id),
|
|
23
24
|
* setDayCheckEvery(every), setRepoWatch(on), warn(what, e), leadsDue?(ws) → number of popup leads due,
|
|
24
25
|
* readDirs?(ws) → { runtime, jira } where the stored reads are, for their fingerprint (smart refresh step 1); by default the
|
|
25
26
|
* state folder and the Jira folder copyPaths('jira') names }
|
|
@@ -275,6 +276,15 @@ function create(host) {
|
|
|
275
276
|
for (const [id, st] of Object.entries(state)) {
|
|
276
277
|
for (const [sid, o] of Object.entries(openOf(st))) {
|
|
277
278
|
let alive = true; try { alive = host.sessionAlive(sid); } catch { alive = true; }
|
|
279
|
+
// A terminal session whose Claude is signed out waits at the sign-in screen for ever: Morning brief and Popup leads each sat
|
|
280
|
+
// 6 hours that way (bug 2026-11-08). It ends now as signed out, so the Sources row says how to sign in, and its pane is closed.
|
|
281
|
+
let out = false; if (alive && host.sessionSignedOut) { try { out = !!host.sessionSignedOut(sid); } catch { out = false; } }
|
|
282
|
+
if (out) {
|
|
283
|
+
delete st.open[sid]; st.retry_at = null; changed = true;
|
|
284
|
+
R.append(dir, { source: id, ev: 'end', run: o.run, result: 'failed', took_ms: t - o.at, error: require('./claude-signin.js').signedOutWhy() }, t);
|
|
285
|
+
try { if (host.stopSession) host.stopSession(sid); } catch (e) { warn('stop a signed-out session', e); }
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
278
288
|
if (!alive || t - o.at > LOST_MS) {
|
|
279
289
|
delete st.open[sid]; st.retry_at = null; changed = true;
|
|
280
290
|
R.append(dir, { source: id, ev: 'end', run: o.run, result: 'interrupted', took_ms: t - o.at, error: alive ? 'no end after 6 hours' : 'the session was gone (PMOS restarted, or the session was closed)' }, t);
|
|
@@ -146,6 +146,7 @@ const WRITES = {
|
|
|
146
146
|
const why = typeof body.why === 'string' ? body.why.replace(/\s+/g, ' ').trim().slice(0, 300) : '';
|
|
147
147
|
const batch = PR.newBatch();
|
|
148
148
|
LAB.append(dir, g.actor, { kind: 'drop', id: p.id, batch, ...(why ? { why } : {}) });
|
|
149
|
+
if (why) require('./corrections-memory.js').remember(w.root, { what: 'an idle-lab result', why, source: 'lab:' + p.id });
|
|
149
150
|
ctx.json(res, { ok: true, batch });
|
|
150
151
|
return true;
|
|
151
152
|
},
|
|
@@ -130,7 +130,7 @@ function settleRun(ctx, key, done, now) {
|
|
|
130
130
|
const res = done && done.result;
|
|
131
131
|
if (done && done.stopped) return append(ctx.runtimeDir, key + '.jsonl', { k: 'fail', at, error: 'The run was stopped before it answered.' });
|
|
132
132
|
if (done && done.timedOut) return append(ctx.runtimeDir, key + '.jsonl', { k: 'fail', at, error: 'The companion took too long and was stopped.' });
|
|
133
|
-
if (res && headless.signedOut(res.text)) return append(ctx.runtimeDir, key + '.jsonl', { k: 'fail', at, auth: true, error:
|
|
133
|
+
if (res && headless.signedOut(res.text)) return append(ctx.runtimeDir, key + '.jsonl', { k: 'fail', at, auth: true, error: require('./claude-signin.js').signedOutWhy() });
|
|
134
134
|
if (!res || !res.ok || res.isError) return append(ctx.runtimeDir, key + '.jsonl', { k: 'fail', at, error: 'The companion did not answer (' + ((done && done.note) || 'no result') + ').' });
|
|
135
135
|
const parsed = F.parseCompanion(res.text);
|
|
136
136
|
// a malformed answer is dropped, not shown
|
|
@@ -375,6 +375,8 @@ const WRITES = {
|
|
|
375
375
|
// the PM's reason, when given (the idle lab's ✕ asks for one; Claude learns from it)
|
|
376
376
|
const why = typeof body.why === 'string' ? body.why.replace(/\s+/g, ' ').trim().slice(0, 300) : '';
|
|
377
377
|
PR.append(dirOf(ctx, p.w), g.actor, { kind: 'drop', ini, sig, ...which, ...(facts.length ? { facts } : {}), ...(why ? { why } : {}) });
|
|
378
|
+
// the reason becomes curated memory by itself, so every later run knows it (lib/corrections-memory.js)
|
|
379
|
+
if (why) require('./corrections-memory.js').remember(p.w.root, { what: `a ${(of && (of.group || of.type)) || ''} proposal on ${ini}`.replace(/ +/g, ' '), why, source: 'proposal:' + (which.id || sig) });
|
|
378
380
|
ctx.json(res, { ok: true });
|
|
379
381
|
},
|
|
380
382
|
'/api/proposals/undo': (ctx, res, body, g, p) => {
|
|
@@ -119,7 +119,7 @@ function view(h, name = 'It') {
|
|
|
119
119
|
const tried = n ? `Claude read it again ${n === 1 ? 'once' : n + ' times'} since ${hm(h.attempts[0].at)}${c ? `, and ${c.why}` : ''}.` : '';
|
|
120
120
|
let action = null;
|
|
121
121
|
if (h.state === 'needs-you') {
|
|
122
|
-
if (h.cause === 'claude-signin') action = { label: 'Sign in to Claude', how: '
|
|
122
|
+
if (h.cause === 'claude-signin') action = { label: 'Sign in to Claude', how: require('./claude-signin.js').how(), sec: 'claude' };
|
|
123
123
|
else if (h.cause === 'connector-missing') action = { label: 'Connect ' + name, how: 'Turn on its connector in your Claude connectors.', href: CONNECTORS };
|
|
124
124
|
else if (h.cause === 'sign-in') action = { label: 'Reconnect ' + name, how: 'Sign in to its connector again in your Claude connectors.', href: CONNECTORS };
|
|
125
125
|
else action = { label: 'Read ' + name + ' again', how: h.cause === 'manual' ? 'You chose to read it only when you press ↻.' : 'Claude stopped after ' + n + ' tries.', read: true };
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* lastWriter(F, rel) → the last write line of one artifact, or null
|
|
7
7
|
* dispatch(dir, { kind, target, ws?, board?, facts?, roles?, now }) → { ok, id, roles } | { ok: false, error }
|
|
8
8
|
* status(F, { now }) → { roles: [{ key, name, working: [..], queued: n, today: n, budget }], dispatches: [...], inbox: [...] }
|
|
9
|
-
* promptOf(role, step, o) → the prompt of one role run
|
|
9
|
+
* promptOf(role, step, o) → the prompt of one role run (o.notebook: notebookOf's result, what became of the role's earlier writes)
|
|
10
|
+
* notebookOf(F, role, autonomyLines, { n }) → { lines, kept, total }
|
|
10
11
|
* create(deps) → { tick({ now }), active() }
|
|
11
12
|
*
|
|
12
13
|
* THE LINES (append-only):
|
|
@@ -130,6 +131,28 @@ function status(F, { now = Date.now() } = {}) {
|
|
|
130
131
|
return { roles, dispatches, inbox: [...F.inbox.values()].reverse().slice(0, 20) };
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
/** A role's notebook (harness + memory evaluation, item 5): what became of its earlier writes, read from the team ledger (the Evaluator's
|
|
135
|
+
* verdicts) and the autonomy ledger (the PM's Undo). The changes that were undone or failed come first, then the newest. Pure. */
|
|
136
|
+
function notebookOf(F, key, autoLines = [], { n = 5 } = {}) {
|
|
137
|
+
if (!key || key === 'eval') return { lines: [], kept: 0, total: 0 };
|
|
138
|
+
const applied = [];
|
|
139
|
+
try { for (const j of require('./autonomy.js').fold(autoLines).jobs.values()) if (j.job === 'ai:' + key) applied.push(...j.applied); } catch { /* no ledger: nothing undone */ }
|
|
140
|
+
const seen = new Set(), rows = [];
|
|
141
|
+
for (const w of F.writes.slice().reverse()) {
|
|
142
|
+
if (w.role !== key || seen.has(w.run + '|' + w.rel)) continue;
|
|
143
|
+
seen.add(w.run + '|' + w.rel);
|
|
144
|
+
const t = Date.parse(w.at) || 0;
|
|
145
|
+
const a = applied.filter((x) => x.ref === w.rel && (Date.parse(x.at) || 0) >= t - 60000).sort((x, y) => Date.parse(x.at) - Date.parse(y.at))[0];
|
|
146
|
+
const v = F.verdicts.filter((x) => x.rel === w.rel && x.of && x.of.run === w.run).pop();
|
|
147
|
+
const undone = !!(a && a.undone), failed = !!(v && v.verdict === 'fail');
|
|
148
|
+
const said = [undone ? 'the PM undid it' : 'kept', v ? `the Evaluator ${failed ? 'failed' : 'passed'} it${v.why ? ': ' + one(v.why, 160) : ''}` : ''].filter(Boolean).join('; ');
|
|
149
|
+
rows.push({ bad: undone || failed, undone, line: `${w.rel}${w.ini ? ' (' + w.ini + ')' : ''}: ${said}` });
|
|
150
|
+
}
|
|
151
|
+
const total = rows.length, kept = rows.filter((r) => !r.undone).length;
|
|
152
|
+
const lines = rows.filter((r) => r.bad).concat(rows.filter((r) => !r.bad)).slice(0, n).map((r) => r.line);
|
|
153
|
+
return { lines, kept, total };
|
|
154
|
+
}
|
|
155
|
+
|
|
133
156
|
function promptOf(r, step, o = {}) {
|
|
134
157
|
const ro = T.roleOf(r);
|
|
135
158
|
const list = (a, none) => (a && a.length ? a.map((x) => '- ' + x).join('\n') : '- ' + none);
|
|
@@ -141,7 +164,10 @@ function promptOf(r, step, o = {}) {
|
|
|
141
164
|
const evalPart = ro.key === 'eval'
|
|
142
165
|
? `\nYou are the Evaluator, in a session of your own. Check each artifact below against its rubric or the PRD's done criteria. Read only the artifacts; you do not have, and must not ask for, the transcript of the run that wrote them. For each one: \`pmos team verdict <path> pass|fail "<why, one line>"\`. PMOS refuses a verdict on work the Evaluator itself wrote.\n`
|
|
143
166
|
: '';
|
|
144
|
-
|
|
167
|
+
const nb = o.notebook && o.notebook.lines && o.notebook.lines.length
|
|
168
|
+
? `\nYour notebook: what became of your earlier work. Learn from it, and do not repeat what was undone or failed:\n${list(o.notebook.lines)}\nThe PM kept ${o.notebook.kept} of your last ${o.notebook.total} changes.\n`
|
|
169
|
+
: '';
|
|
170
|
+
return `${skill}You are the ${ro.name} on the PMOS team, under the chief of staff. You own ${ro.what}.\n\nThis run:\n- Run: ${step.id}\n- For: ${target}\n- Why: ${step.trigger === 'dispatch' ? 'the chief of staff dispatched it' : step.trigger + (step.detail ? ' (' + one(step.detail, 160) + ')' : '')}\n- Today: ${T.localDay(o.now || Date.now())}\n\nWhat the roles before you handed over (read these artifacts; they are the handoff):\n${list(o.handoff, 'nothing yet')}\n${evalPart}${nb}\n${mode}\n\nEnd with \`pmos team done "<what you did, in one line>"\`.\n`;
|
|
145
171
|
}
|
|
146
172
|
|
|
147
173
|
/** deps: { workspaces() → [w], stateDirFor(w), inis(w) → [{ ini, board, stage, has }], promptFor(skillId), spawn(spec) → session,
|
|
@@ -167,7 +193,9 @@ function create(deps) {
|
|
|
167
193
|
const mode = auto(dir, ro);
|
|
168
194
|
const dsp = step.dispatch ? F.dispatches.get(step.dispatch) : null;
|
|
169
195
|
const skill = ro.skills.map((s) => { try { return deps.promptFor ? deps.promptFor(s) : null; } catch { return null; } }).find(Boolean) || '';
|
|
170
|
-
|
|
196
|
+
let notebook = null;
|
|
197
|
+
if (!/^(off|0|false|no)$/i.test(String(process.env.PMOS_RUN_MEMORY || '').trim())) { try { notebook = notebookOf(F, ro.key, require('./autonomy.js').read(dir)); } catch (e) { warn('team notebook', e); } }
|
|
198
|
+
const prompt = promptOf(ro.key, step, { mode, handoff: handoffOf(F, step), goal: dsp && dsp.of === 'goal' ? dsp.target : '', skill, notebook, now });
|
|
171
199
|
const { tools, writePaths } = T.toolsOf(ro, { root: w.root, mode });
|
|
172
200
|
const env = { PMOS_TEAM_FILE: file(dir), PMOS_TEAM_ROOT: w.root || '', PMOS_TEAM_WS: w.id || '', PMOS_TEAM_ROLE: ro.key, PMOS_TEAM_RUN: step.id,
|
|
173
201
|
PMOS_TEAM_INI: step.ini || '', PMOS_TEAM_MODE: mode };
|
|
@@ -241,4 +269,4 @@ function create(deps) {
|
|
|
241
269
|
return { tick, ended, active: () => [...active.keys()], stop(run) { const a = active.get(run); if (a && a.session && deps.stop) deps.stop(a.session); } };
|
|
242
270
|
}
|
|
243
271
|
|
|
244
|
-
module.exports = { factsOf, LEDGER, append, read, fold, lastWriter, unchecked, dispatch, status, promptOf, create };
|
|
272
|
+
module.exports = { factsOf, LEDGER, append, read, fold, lastWriter, unchecked, dispatch, status, promptOf, notebookOf, create };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.544.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.544.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
package/workspace/server.js
CHANGED
|
@@ -3258,6 +3258,9 @@ refreshRun = refreshRunLib.create({
|
|
|
3258
3258
|
proactive: () => proSettings(),
|
|
3259
3259
|
schedules: { read: readSchedules, write: writeSchedules },
|
|
3260
3260
|
startSkill: (wsId, skill, name, origin) => startSkillSession(wsId, skill, name, origin),
|
|
3261
|
+
// a terminal session stuck at Claude's sign-in screen (the login it runs under expired): read from its pane, ended by the engine
|
|
3262
|
+
sessionSignedOut: (id) => { const x = sessions.get(String(id || '')); return !!x && !!x.tmux && x.state !== 'exited' && require('./lib/claude-signin.js').paneSignedOut(paneScreen(x)); },
|
|
3263
|
+
stopSession: (id) => { const x = sessions.get(String(id || '')); if (x && x.tmux) tmuxKillSession(x.tmux); },
|
|
3261
3264
|
sessionAlive: (id) => { const x = sessions.get(String(id || '')); return !!x && x.state !== 'exited'; }, sessionOutcome: (id) => { const x = sessions.get(String(id || '')); return (x && x.outcome) || null; },
|
|
3262
3265
|
// popup context slice 3b: how many opened popups have no lead newer than the newest stored read
|
|
3263
3266
|
leadsDue: () => require('./lib/popup-leads.js').due(STATE, { readAt: require('./lib/lead-cli.js').newestRead(STATE) }).length,
|
|
@@ -4468,6 +4471,10 @@ const claudeSetup = require('./lib/claude-readiness').create({
|
|
|
4468
4471
|
envFor: sessionEnvWithProfile,
|
|
4469
4472
|
savePreference: (id) => { const p = readPrefs(); p.claude = id; return writePrefs(p); },
|
|
4470
4473
|
});
|
|
4474
|
+
// The sign-in advice names the command of the Claude profile background runs use (lib/claude-signin.js), never plain `claude` when another is chosen.
|
|
4475
|
+
const claudeSignin = require('./lib/claude-signin.js').configure({
|
|
4476
|
+
profile: () => { const r = resolveProfileForSpawn(defaultProfileFor('claude')); return r.ok ? r.profile : null; },
|
|
4477
|
+
});
|
|
4471
4478
|
claudeSetup.ensureOwn = () => require('./lib/own-profile').ensure(os.homedir(), profilesLib.profilesDir(os.homedir()));
|
|
4472
4479
|
/* Sign-in (bug 2026-11-02): a login that is signed in already is used as it is, with no terminal. Otherwise the sign-in runs
|
|
4473
4480
|
* `claude auth login`, not the full Claude Code screen: it opens the browser and at most asks for a pasted code, so a new user
|
|
@@ -6040,11 +6047,16 @@ function autoNameTick(s, hx) {
|
|
|
6040
6047
|
const fail = () => { s._naming = false; s.nameFail = { at: Date.now(), turns }; };
|
|
6041
6048
|
const cmd = process.env.PMOS_AUTONAME_CMD || 'claude';
|
|
6042
6049
|
if (!process.env.PMOS_AUTONAME_CMD && !commandExists('claude')) return;
|
|
6050
|
+
// Naming runs under the PM's chosen Claude profile like every other background call, never Claude's own login when another is chosen
|
|
6051
|
+
// (bug 2026-11-08: the default login had expired, the chosen claude-personal had not). A chosen profile that cannot be read names nothing.
|
|
6052
|
+
const pres = resolveProfileForSpawn(defaultProfileFor('claude'));
|
|
6053
|
+
if (!pres.ok) return;
|
|
6054
|
+
const nenv = { ...sessionEnv(), ...profileOverlay(pres.profile) };
|
|
6043
6055
|
s._naming = true;
|
|
6044
6056
|
let child, out = '';
|
|
6045
6057
|
try {
|
|
6046
|
-
const run = winCommand.resolve(cmd, { env:
|
|
6047
|
-
child = spawn(run.file, [...run.prefix, ...sessionName.argv()], { cwd: s.cwd || s.root, env:
|
|
6058
|
+
const run = winCommand.resolve(cmd, { env: nenv });
|
|
6059
|
+
child = spawn(run.file, [...run.prefix, ...sessionName.argv()], { cwd: s.cwd || s.root, env: nenv, stdio: ['pipe', 'pipe', 'ignore'] });
|
|
6048
6060
|
} catch { return fail(); }
|
|
6049
6061
|
const timer = setTimeout(() => { try { child.kill('SIGKILL'); } catch { /* gone */ } }, 90000);
|
|
6050
6062
|
child.on('error', () => { clearTimeout(timer); fail(); });
|