@oathe/oathe 0.4.4 → 0.4.5

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.
Files changed (59) hide show
  1. package/.claude-plugin/marketplace.json +18 -2
  2. package/README.md +4 -1
  3. package/bin/oathe.mjs +199 -35
  4. package/docs/PRIVACY.md +26 -4
  5. package/notch/Oathe Notch.app/Contents/Info.plist +1 -1
  6. package/notch/Oathe Notch.app/Contents/MacOS/OatheNotch +0 -0
  7. package/notch/README.md +4 -3
  8. package/package.json +3 -3
  9. package/plugin/.claude-plugin/plugin.json +21 -3
  10. package/plugin/.cursor-plugin/plugin.json +2 -2
  11. package/plugin/hooks/hooks.json +4 -4
  12. package/plugin/hooks/lib.mjs +9 -0
  13. package/plugin/hooks/render-board.mjs +4 -2
  14. package/src/blocks.mjs +10 -1
  15. package/src/board-render.mjs +7 -4
  16. package/src/breach-digest.mjs +75 -10
  17. package/src/config.mjs +18 -0
  18. package/src/context.mjs +1 -1
  19. package/src/device.mjs +106 -0
  20. package/src/doctor.mjs +101 -6
  21. package/src/engine-update.mjs +170 -0
  22. package/src/evidence-discovery.mjs +170 -0
  23. package/src/fence.mjs +3 -3
  24. package/src/harnesses/catalog.mjs +46 -4
  25. package/src/harnesses/claude.mjs +56 -4
  26. package/src/harnesses/codex-rollout.mjs +110 -21
  27. package/src/harnesses/codex.mjs +106 -19
  28. package/src/harnesses/cursor.mjs +31 -18
  29. package/src/harnesses/harness.mjs +82 -13
  30. package/src/harnesses/surfaces.mjs +2 -2
  31. package/src/home.mjs +174 -52
  32. package/src/init.mjs +27 -2
  33. package/src/launch.mjs +7 -9
  34. package/src/launchd.mjs +100 -0
  35. package/src/manifest.mjs +48 -6
  36. package/src/mcp/connection.mjs +73 -7
  37. package/src/mcp/daemon.mjs +123 -0
  38. package/src/mcp/forwarder.mjs +99 -0
  39. package/src/mcp/oathe-tools.mjs +392 -145
  40. package/src/notch-frame.mjs +118 -42
  41. package/src/notch.mjs +34 -68
  42. package/src/oathe-annotator.mjs +10 -10
  43. package/src/pager.mjs +144 -40
  44. package/src/paths.mjs +1 -0
  45. package/src/plans.mjs +44 -5
  46. package/src/registry.mjs +10 -2
  47. package/src/serve.mjs +82 -0
  48. package/src/session-host.mjs +1 -1
  49. package/src/sessions.mjs +39 -8
  50. package/src/shim.mjs +110 -0
  51. package/src/speaker.mjs +24 -5
  52. package/src/statements.mjs +116 -2
  53. package/src/traces.mjs +61 -19
  54. package/src/uninstall.mjs +20 -3
  55. package/src/update.mjs +35 -7
  56. package/src/verifier.mjs +215 -105
  57. package/src/verify-dispatch.mjs +86 -32
  58. package/src/wire.mjs +7 -1
  59. package/plugin/.mcp.json +0 -10
@@ -0,0 +1,170 @@
1
+ // oathe — the engine update as a CLAIM (ruling 2026-09-05, launch/2026-09-05-engines-places-plan.md
2
+ // Leg D). A judgment named an engine out of date; the fix is the engine's OWN updater, run by
3
+ // the machine and recorded like every other act: the update child claims `update:<harness>`
4
+ // (so the glass, `oathe ls` and attention read "updating <Name>" off one fact and a feed
5
+ // restart forgets nothing), states what it runs, runs it into a log, asserts done with the
6
+ // version measured after, settles under the operator seat at the deterministic bar, and
7
+ // re-verifies what the old version failed. A failure is a statement (ref update-failure:<h>),
8
+ // a yield, an amber notice and a typed refusal — never a silent success.
9
+
10
+ import fs from 'node:fs';
11
+ import path from 'node:path';
12
+ import { spawn as nodeSpawn } from 'node:child_process';
13
+
14
+ import { byName, displayFor } from './harnesses/catalog.mjs';
15
+ import { updateTaskId, updateObjective } from './plans.mjs';
16
+ import { updateFailureRef } from './statements.mjs';
17
+ import { emit as wireEmit } from './wire.mjs';
18
+ import { Verifier, completionStatementOf, settleReview } from './verifier.mjs';
19
+ import { Pager } from './pager.mjs';
20
+
21
+ export class EngineUpdateError extends Error {
22
+ constructor(code, message, details = {}) {
23
+ super(message);
24
+ this.code = code;
25
+ this.details = details;
26
+ }
27
+ }
28
+
29
+ /** One process, its output tee'd to a log; resolves on exit with the stderr tail for the record. */
30
+ function runToLog({ spawn, bin, args, env, log }) {
31
+ return new Promise((resolve) => {
32
+ const out = fs.createWriteStream(log, { flags: 'a' });
33
+ out.write(`$ ${[bin, ...args].join(' ')}\n`);
34
+ let tail = '';
35
+ let stdout = '';
36
+ let child;
37
+ try {
38
+ child = spawn(bin, args, { env, stdio: ['ignore', 'pipe', 'pipe'] });
39
+ } catch (error) {
40
+ out.end(); resolve({ status: null, error, tail: error.message, stdout }); return;
41
+ }
42
+ child.stdout.on('data', (d) => { out.write(d); stdout += d; });
43
+ child.stderr.on('data', (d) => { out.write(d); tail = (tail + d).slice(-2000); });
44
+ child.on('error', (error) => { out.end(); resolve({ status: null, error, tail: tail || error.message, stdout }); });
45
+ child.on('close', (status) => { out.end(); resolve({ status, tail: tail.trim().slice(-300), stdout }); });
46
+ });
47
+ }
48
+
49
+ export class EngineUpdate {
50
+ /**
51
+ * @param {{substrate: object, paths: object, workspace: string, config: object, operatorPrincipal: string,
52
+ * manifest: {cliAddressFor: Function}, provider?: object|null, env?: object, spawn?: Function,
53
+ * onStart?: Function}} o onStart({harness, address, before, command, log}) — a caller's line before the run
54
+ */
55
+ constructor({ substrate, paths, workspace, config, operatorPrincipal, manifest, provider = null, env = process.env, spawn = nodeSpawn, onStart = () => {} }) {
56
+ this.substrate = substrate;
57
+ this.paths = paths;
58
+ this.config = config;
59
+ this.manifest = manifest;
60
+ this.env = env;
61
+ this.spawn = spawn;
62
+ this.onStart = onStart;
63
+ this.orgId = config.get('org');
64
+ this.operatorPrincipal = operatorPrincipal;
65
+ // The verification lane's own actor: its tools speak as the system seat, its runtime
66
+ // settles, and it re-verifies — one object, one close().
67
+ this.verifier = new Verifier({
68
+ substrate, paths, workspace, config, operatorPrincipal, provider, env,
69
+ addressFor: (engine) => manifest.cliAddressFor(engine),
70
+ });
71
+ }
72
+
73
+ /**
74
+ * @param {{harness: string, thenVerify?: boolean, task?: string|null}} o
75
+ * @returns {Promise<{harness: string, address: string, before: string, after: string, update_task: string,
76
+ * log: string, reverified: Array<{task_id: string, verdict?: string, error?: string}>}>}
77
+ */
78
+ async run({ harness, thenVerify = false, task = null }) {
79
+ const adapter = this.#adapter(harness);
80
+ const address = this.manifest.cliAddressFor(harness); // the recorded address or a refusal — never a PATH guess
81
+ if (address === null) {
82
+ throw new EngineUpdateError('OATHE_ENGINE_MISSING',
83
+ `the '${harness}' CLI: no address was recorded for it — run oathe init to record where it is`, { harness });
84
+ }
85
+ const name = displayFor(harness) ?? harness;
86
+ const updateTask = updateTaskId(harness);
87
+ fs.mkdirSync(this.paths.logsDir, { recursive: true });
88
+ const log = path.join(this.paths.logsDir, `update-${harness}.log`);
89
+ fs.writeFileSync(log, '');
90
+ const before = await this.#version(address, adapter);
91
+ const [bin, args] = adapter.install.update(address);
92
+ const command = [bin, ...args].join(' ');
93
+
94
+ const tools = this.verifier.tools;
95
+ await tools.oathe_claim({ task_id: updateTask, objective: updateObjective(harness, address) });
96
+ await wireEmit(this.substrate, { kind: 'engine_update_started', task_id: updateTask, via: name });
97
+ await tools.oathe_statement({ task_id: updateTask, proposition: `updating ${name} (${before}) via ${command}`, evidence_ref: `log:${log}` });
98
+ this.onStart({ harness, address, before, command, log });
99
+
100
+ const run = await runToLog({ spawn: this.spawn, bin, args, env: this.env, log });
101
+ if (run.status !== 0) {
102
+ const tail = run.tail || `exit ${run.status}`;
103
+ const proposition = `update of ${harness} failed: ${tail}`;
104
+ try {
105
+ await tools.oathe_statement({ task_id: updateTask, proposition, evidence_ref: updateFailureRef(harness) });
106
+ await tools.oathe_yield({ task_id: updateTask, note: `${name}'s updater refused — read ${log}, fix the cause, and update again` });
107
+ } catch { /* best-effort release — the primary failure must surface either way */ }
108
+ await wireEmit(this.substrate, { kind: 'engine_update_failed', task_id: updateTask, via: `${name}: ${tail}` });
109
+ throw new EngineUpdateError('OATHE_ENGINE_UPDATE_FAILED',
110
+ `${command} exited ${run.status ?? 'without running'}: ${tail} — log: ${log}`, { harness, address, status: run.status, log });
111
+ }
112
+
113
+ const after = await this.#version(address, adapter);
114
+ const evidenceRef = `version:${after}`;
115
+ const done = await tools.oathe_done({ task_id: updateTask, proposition: `updated ${name}: ${before} → ${after}`, evidence_ref: evidenceRef });
116
+ // The update's own review settles under the OPERATOR seat at the deterministic bar — the
117
+ // same close a judgment's verify: task gets (src/verifier.mjs settleReview).
118
+ await settleReview({
119
+ runtime: await this.verifier.runtime(), seat: this.operatorPrincipal, orgId: this.orgId, taskId: updateTask,
120
+ plan: await this.verifier.planOf(updateTask),
121
+ stmt: await completionStatementOf({ substrate: this.substrate, orgId: this.orgId, taskId: updateTask }),
122
+ evidenceRefs: [evidenceRef], tracePath: `statement:${done.statement_id}`,
123
+ });
124
+ await wireEmit(this.substrate, { kind: 'engine_updated', task_id: updateTask, via: name });
125
+
126
+ const reverified = thenVerify ? await this.#reverify({ harness, task }) : [];
127
+ return { harness, address, before, after, update_task: updateTask, log, reverified };
128
+ }
129
+
130
+ /** Every stall this engine's old version caused (the pager's own reading), or the one task named — judged again by the updated engine. */
131
+ async #reverify({ harness, task }) {
132
+ const targets = task ? [task]
133
+ : (await new Pager({ client: this.substrate, identity: { orgId: this.orgId }, config: this.config }).breaches())
134
+ .filter((b) => b.kind === 'stalled' && b.engine === harness && b.cause === 'outdated' && !b.busy)
135
+ .map((b) => b.task_id);
136
+ const out = [];
137
+ for (const taskId of targets) {
138
+ try {
139
+ const v = await this.verifier.verify({ taskId, engine: harness });
140
+ out.push({ task_id: taskId, verdict: v.verdict });
141
+ } catch (e) {
142
+ out.push({ task_id: taskId, error: `[${e?.code ?? 'error'}] ${String(e?.message ?? e).slice(0, 200)}` });
143
+ }
144
+ }
145
+ return out;
146
+ }
147
+
148
+ #adapter(harness) {
149
+ let adapter;
150
+ try { adapter = byName(harness); } catch (e) { throw new EngineUpdateError('OATHE_ENGINE_UNKNOWN', e.message, { harness }); }
151
+ if (typeof adapter.install?.update !== 'function') {
152
+ throw new EngineUpdateError('OATHE_ENGINE_UPDATE_UNSUPPORTED',
153
+ `'${harness}' declares no in-place updater (src/harnesses/${harness}.mjs install.update) — update it the way you installed it`, { harness });
154
+ }
155
+ return adapter;
156
+ }
157
+
158
+ /** The CLI's version, measured (`<address> <versionArgs>`); 'unknown' when it will not say. */
159
+ async #version(address, adapter) {
160
+ const scratch = path.join(this.paths.logsDir, `.version-${path.basename(address)}.log`);
161
+ const run = await runToLog({ spawn: this.spawn, bin: address, args: adapter.install.versionArgs, env: this.env, log: scratch });
162
+ try { fs.rmSync(scratch, { force: true }); } catch { /* a scratch file */ }
163
+ const line = String(run.stdout ?? '').trim().split('\n')[0];
164
+ return run.status === 0 && line ? line : 'unknown';
165
+ }
166
+
167
+ async close() {
168
+ await this.verifier.close();
169
+ }
170
+ }
@@ -0,0 +1,170 @@
1
+ // oathe — evidence discovery: the read-time half of the evidence rails. The substrate's
2
+ // tool results echo each claim's UUID into whatever transcript the harness keeps, so the
3
+ // record self-fingerprints — a claim's evidence can be FOUND from the record alone, with no
4
+ // dependence on hooks, registration, or the speaker having known its session (the ChatGPT
5
+ // desktop class of false rejection, live 2026-08-31 and 2026-09-04: the work sat on disk
6
+ // while the verifier judged an empty record).
7
+ //
8
+ // Two rails, kept apart on purpose: trace-link statements stay the act-time ATTRIBUTION rail
9
+ // (board, notch, reclaim bundle — cheap, per act); discovery is the read-time EVIDENCE rail.
10
+ // gather() serves their union — the record's own word leads, discovery only ever adds.
11
+ //
12
+ // Membership is PERFORMANCE, never mention: a discovered file must project to a trajectory
13
+ // whose claim intervals name the task (an investigator's transcript contains the UUID; only
14
+ // the worker's contains the acts). The verifier's own transcript claims `verify:<task>`,
15
+ // never the task, so the judge's record stays out of the evidence it judges — the same line
16
+ // LINKABLE draws (src/wire.mjs).
17
+
18
+ import { traceStores, byName, transcriptFor } from './harnesses/catalog.mjs';
19
+ import { projectAnnotated } from './oathe-annotator.mjs';
20
+ import { claimIntervals } from './atif.mjs';
21
+ import { taskTraceLinksSql, TRACE_SUBJECT_PREFIX } from './statements.mjs';
22
+ import { TraceContractError } from './traces.mjs';
23
+
24
+ // Design constants, not tunables — no consumer has a story for turning them (founder ruling
25
+ // 2026-09-01: no speculative config). The skew absorbs clock drift between the substrate's
26
+ // claimed_at and the store's mtimes; the cap bounds one gather's disk read.
27
+ const CLAIM_CLOCK_SKEW_MS = 5 * 60_000;
28
+ const DISCOVERY_MAX_FILES = 4000;
29
+
30
+ async function defaultStoresFor({ home }) {
31
+ const stores = [];
32
+ for (const name of traceStores()) {
33
+ const { traces } = byName(name);
34
+ stores.push(await traces.store({ home }));
35
+ }
36
+ return stores;
37
+ }
38
+
39
+ export class EvidenceDiscovery {
40
+ /**
41
+ * @param {{client: {query: Function}, orgId: string, home?: string,
42
+ * storesFor?: ({home}) => Promise<object[]>, maxFiles?: number}} o
43
+ * client/orgId read the record; home roots the stores; storesFor and maxFiles are seams.
44
+ */
45
+ constructor({ client, orgId, home = undefined, storesFor = defaultStoresFor, maxFiles = DISCOVERY_MAX_FILES, project = projectAnnotated }) {
46
+ this.project = project; // the projector seam (tests inject a failing one)
47
+ this.client = client;
48
+ this.orgId = orgId;
49
+ this.home = home;
50
+ this.storesFor = storesFor;
51
+ this.maxFiles = maxFiles;
52
+ }
53
+
54
+ /**
55
+ * Project ONE file, and let nothing die untyped: a TraceContractError (a torn line, an
56
+ * unreadable file) passes through as the record's own refusal; anything else the projector
57
+ * throws becomes TRACE_PROJECTION_FAILED naming the file and the cause — the verifier's stall
58
+ * note reads a file and a reason, never a stack (Greptile round 3 on PR #37, 2026-09-06).
59
+ */
60
+ async #project(file) {
61
+ try {
62
+ return await this.project(file, { home: this.home });
63
+ } catch (e) {
64
+ if (e instanceof TraceContractError) throw e;
65
+ throw new TraceContractError('TRACE_PROJECTION_FAILED',
66
+ `${file} could not be projected: ${String(e?.message ?? e)}`, { file, cause: e?.code ?? e?.name ?? 'error' });
67
+ }
68
+ }
69
+
70
+ /** The task's recorded trace links, resolved to the files the sessions actually write. */
71
+ async #linked(taskId) {
72
+ const { rows } = await this.client.query(taskTraceLinksSql(), [this.orgId, taskId]);
73
+ const paths = [];
74
+ const seen = new Set();
75
+ for (const row of rows) {
76
+ const sessionId = row.subject_ref.slice(TRACE_SUBJECT_PREFIX.length);
77
+ for (const ref of row.evidence_refs) {
78
+ const file = transcriptFor({ sessionId, reportedPath: ref, home: this.home });
79
+ if (seen.has(file)) continue;
80
+ seen.add(file);
81
+ paths.push(file);
82
+ }
83
+ }
84
+ return paths;
85
+ }
86
+
87
+ /**
88
+ * Does the record ATTEST attribution at all? A store-less surface (cursor) links with
89
+ * empty evidence — that is attribution without a transcript, and it keeps the claim
90
+ * judgeable; a task with no link and no discovery hit has an empty record instead.
91
+ */
92
+ async hasAttribution(taskId) {
93
+ const { rows } = await this.client.query(taskTraceLinksSql(), [this.orgId, taskId]);
94
+ return rows.length > 0;
95
+ }
96
+
97
+ /** Every claim ever taken on the task — the needles, and the window's opening. */
98
+ async #claims(taskId) {
99
+ const { rows } = await this.client.query(
100
+ `SELECT work_claim_id, claimed_at FROM cell.work_claim
101
+ WHERE org_id = $1 AND task_id = $2 ORDER BY claimed_at`,
102
+ [this.orgId, taskId]);
103
+ return rows;
104
+ }
105
+
106
+ /**
107
+ * The whole evidence read for one task: recorded links ∪ fingerprint discovery, projected,
108
+ * performance-confirmed (discovered only), deterministically ordered — linked first in the
109
+ * record's own order, then discovered by store order and path. `unreadable` names every
110
+ * store file in the window the byte scan could not read (by path and cause): reported, never
111
+ * a stall — a file that cannot be read cannot be known to be this task's, and an unrelated
112
+ * one must never block the task's own evidence (Greptile on PR #37, 2026-09-04). A file that
113
+ * DOES name the claim and cannot project still refuses typed: that one may be the evidence.
114
+ * @returns {Promise<{traces: Array<{path: string, trajectory: object, via: 'linked'|'discovered'}>,
115
+ * unreadable: Array<{path: string, code: string, message: string}>}>}
116
+ */
117
+ async read({ taskId }) {
118
+ const linked = await this.#linked(taskId);
119
+ const claims = await this.#claims(taskId);
120
+ const traces = [];
121
+ const unreadable = [];
122
+ for (const file of linked) {
123
+ traces.push({ path: file, trajectory: await this.#project(file), via: 'linked' });
124
+ }
125
+ if (claims.length === 0) return { traces, unreadable };
126
+
127
+ const sinceMs = Date.parse(claims[0].claimed_at) - CLAIM_CLOCK_SKEW_MS;
128
+ const needles = claims.map((c) => c.work_claim_id);
129
+ const linkedSet = new Set(linked);
130
+ for (const store of await this.storesFor({ home: this.home })) {
131
+ let candidates;
132
+ try {
133
+ candidates = store.evidenceFiles({ sinceMs });
134
+ } catch (e) {
135
+ // A store that cannot be enumerated (its root vanished or unreadable mid-walk) is
136
+ // reported like an unreadable file — the other stores still serve; never a stall.
137
+ unreadable.push({ path: `${store.harness} store`, code: e?.code ?? 'ENUMERATION_FAILED', message: String(e?.message ?? e) });
138
+ continue;
139
+ }
140
+ if (candidates.length > this.maxFiles) {
141
+ throw new TraceContractError('TRACE_DISCOVERY_OVERFLOW',
142
+ `the ${store.harness} store holds ${candidates.length} files in this claim's window `
143
+ + `(cap ${this.maxFiles}) — refusing a partial scan; narrow the window or thin the store`,
144
+ { harness: store.harness, candidates: candidates.length });
145
+ }
146
+ for (const file of candidates) {
147
+ if (linkedSet.has(file)) continue;
148
+ let names;
149
+ try {
150
+ names = needles.some((needle) => store.contains(file, needle));
151
+ } catch (e) {
152
+ if (!(e instanceof TraceContractError)) throw e;
153
+ unreadable.push({ path: file, code: e.code, message: e.message });
154
+ continue;
155
+ }
156
+ if (!names) continue;
157
+ // The projector, not the byte scan, decides membership: performing, never mentioning.
158
+ const trajectory = await this.#project(file);
159
+ if (!claimIntervals(trajectory).some((i) => i.task_id === taskId)) continue;
160
+ traces.push({ path: file, trajectory, via: 'discovered' });
161
+ }
162
+ }
163
+ return { traces, unreadable };
164
+ }
165
+
166
+ /** The evidence alone — read() for a caller that has no use for the unreadable list. */
167
+ async gather({ taskId }) {
168
+ return (await this.read({ taskId })).traces;
169
+ }
170
+ }
package/src/fence.mjs CHANGED
@@ -39,9 +39,9 @@ export function globalFenceBody() {
39
39
  '',
40
40
  wrap(`Every session on this machine has an Oathe board. ${SPEECH_ACT_RULE} Where a session opens `
41
41
  + 'on a project folder, that folder\'s board loads with it. A session with no project folder '
42
- + '(ChatGPT desktop runs from a staging directory) sees the machine-wide board, and a task '
43
- + 'claimed there is homeless until a real folder claims it — which adopts it onto that '
44
- + 'folder\'s board. `continue <task>` picks work back up.'),
42
+ + '(ChatGPT desktop runs from a staging directory) sees the machine-wide board; work claimed '
43
+ + 'there lives in the app until a folder picks it up, and every place that picked it up keeps '
44
+ + 'seeing it. `continue <task>` picks work back up.'),
45
45
  ].join('\n');
46
46
  }
47
47
 
@@ -82,9 +82,51 @@ export function capabilityTable() {
82
82
  synthetic: C.isSyntheticWorkspaceDir !== Harness.isSyntheticWorkspaceDir,
83
83
  install: C.install !== null,
84
84
  docs: C.docs.length > 0,
85
+ attestation: C.attestation,
86
+ mcpToolTimeout: C.mcpToolTimeout !== null,
85
87
  }]));
86
88
  }
87
89
 
90
+ /**
91
+ * Attestation by SURFACE name (the speaker's `surface`, as the adapters name it): which
92
+ * adapter owns the surface and whether its sessions register through hooks. `null` for a
93
+ * surface nobody owns — the claim gate refuses those.
94
+ * @returns {{harness: string, attestation: 'hooks'|'hookless'}|null}
95
+ */
96
+ export function attestationFor(surface) {
97
+ if (!surface) return null;
98
+ for (const C of HARNESS_CLASSES) {
99
+ const declared = C.attestation?.[surface];
100
+ if (declared) return { harness: C.harnessName, attestation: declared };
101
+ }
102
+ return null;
103
+ }
104
+
105
+ /**
106
+ * Where work lives (ruling 2026-09-05), asked by SURFACE name: the word a place wears on every
107
+ * surface (`surfaces.display`), and whether the app recorded on an act is a place the glass can
108
+ * resume INTO by opening it (`surfaces.resumable` — the desktop app IS where the work lives; a
109
+ * terminal is not). Adapter facts; no literal outside src/harnesses/.
110
+ */
111
+ export function displayFor(surface) {
112
+ if (!surface) return null;
113
+ for (const C of HARNESS_CLASSES) {
114
+ const word = C.surfaces?.display?.[surface];
115
+ if (word) return word;
116
+ }
117
+ return null;
118
+ }
119
+
120
+ export function appResumable(surface) {
121
+ if (!surface) return false;
122
+ return HARNESS_CLASSES.some((C) => C.surfaces?.resumable?.includes(surface) ?? false);
123
+ }
124
+
125
+ /** Can the glass update this harness's CLI in place? The adapter declares `install.update` (ruling 2026-09-05). */
126
+ export function updatable(name) {
127
+ return typeof HARNESS_CLASSES.find((C) => C.harnessName === name)?.install?.update === 'function';
128
+ }
129
+
88
130
  /** [name, envVar] pairs for every adapter that documents a project-dir env var. */
89
131
  export function projectDirEnvVars() {
90
132
  return HARNESS_CLASSES.filter((C) => C.projectDirEnvVar !== null)
@@ -173,13 +215,13 @@ export function transcriptFor({ sessionId, reportedPath, home } = {}) {
173
215
  }
174
216
 
175
217
  /** Instantiate every adapter whose wiring exists — the init/uninstall roster. */
176
- export function buildWireable({ home, envPath, paths, exec }) {
177
- return HARNESS_CLASSES.filter((C) => C.wiring !== null).map((C) => new C({ home, envPath, paths, exec }));
218
+ export function buildWireable({ home, envPath, paths, exec, config = null }) {
219
+ return HARNESS_CLASSES.filter((C) => C.wiring !== null).map((C) => new C({ home, envPath, paths, exec, config }));
178
220
  }
179
221
 
180
222
  /** Instantiate every adapter — detection sweeps (the picker census) see them all. */
181
- export function buildAll({ home, envPath, paths, exec }) {
182
- return HARNESS_CLASSES.map((C) => new C({ home, envPath, paths, exec }));
223
+ export function buildAll({ home, envPath, paths, exec, config = null }) {
224
+ return HARNESS_CLASSES.map((C) => new C({ home, envPath, paths, exec, config }));
183
225
  }
184
226
 
185
227
  /** The detect-only surfaces as the picker prints them: detected + the manual steps. */
@@ -18,6 +18,7 @@ const claudeToolUses = (entries) => entries
18
18
  .flatMap((r) => r.message.content.filter((p) => p.type === 'tool_use'));
19
19
  import { JsonEntries } from '../blocks.mjs';
20
20
  import { sha256Hex } from '../manifest.mjs';
21
+ import { shimPath } from '../shim.mjs';
21
22
 
22
23
  export class ClaudeHarness extends Harness {
23
24
  static harnessName = 'claude';
@@ -37,13 +38,24 @@ export class ClaudeHarness extends Harness {
37
38
  static surfaces = Object.freeze({
38
39
  ownsExec: (exec) => path.basename(exec) === 'claude',
39
40
  name: () => 'claude',
41
+ display: Object.freeze({ claude: 'Claude Code' }),
42
+ resumable: Object.freeze([]), // a folder's session — the folder is the place, never the terminal
40
43
  });
41
- static install = Object.freeze({ npm: '@anthropic-ai/claude-code', bin: 'claude', versionArgs: ['--version'] });
44
+ static attestation = Object.freeze({ claude: 'hooks' });
45
+ // The blocking exchange needs no budget written here: Claude Code's per-tool wall clock
46
+ // defaults to about 28 hours (claude-code/mcp.md, pinned) and a stdio call is only aborted
47
+ // after 30 idle minutes — the wait's progress ticks reset that clock. What Claude Code DOES
48
+ // do is move a call past two minutes to a background task and deliver the verdict as its
49
+ // notification; that is the client's behaviour, disclosed on oathe_done, not a knob here.
50
+ static mcpToolTimeout = null;
51
+ // `claude update` — Claude Code's own in-place updater (claude-code docs, pinned).
52
+ static install = Object.freeze({ npm: '@anthropic-ai/claude-code', bin: 'claude', versionArgs: ['--version'], update: (address) => [address, ['update']] });
42
53
  // Non-interactive auth: ANTHROPIC_API_KEY (claude-code/headless.md, pinned 2026-08-29).
43
54
  static headless = Object.freeze({
44
55
  auth: ['ANTHROPIC_API_KEY'],
45
56
  command: (prompt, model = null) => ['claude', ['-p', prompt, '--output-format', 'json', ...(model ? ['--model', model] : [])]],
46
57
  extract: (stdout) => ClaudeHarness.extractJsonResult(stdout),
58
+ diagnose: () => null, // its failure words are unmeasured — stated; an unrecognized death stays a plain stall
47
59
  });
48
60
  static traces = Object.freeze({
49
61
  store: ({ home } = {}) => new ClaudeTraceStore({ home, harness: this.harnessName }),
@@ -106,6 +118,11 @@ export class ClaudeHarness extends Harness {
106
118
  ];
107
119
  }
108
120
 
121
+ /** Where the CLI's user scope lives — sign-in state, per-project state, and user MCP entries. */
122
+ get userConfigPath() {
123
+ return path.join(this.home, '.claude.json');
124
+ }
125
+
109
126
  get registryDir() {
110
127
  return path.join(this.configHome, 'plugins');
111
128
  }
@@ -140,11 +157,17 @@ export class ClaudeHarness extends Harness {
140
157
  return result;
141
158
  }
142
159
 
160
+ /** The user-scope MCP entry as the CLI's file records it, or null. */
161
+ #mcpEntry() {
162
+ return this.#readRegistry(this.userConfigPath)?.mcpServers?.oathe ?? null;
163
+ }
164
+
143
165
  /** What init writes — from the owned entries and the registry the CLI materializes into. */
144
166
  describe() {
145
167
  return [
146
168
  `${this.settingsPath}: owns ${this.#ownedEntries().map((e) => e.path.join('.')).join(' and ')}`,
147
- `\`claude plugin install oathe@oathe\` — the Oathe plugin (board at session start, auto-save hooks, the oathe_* MCP tools), recorded in ${this.installedFile}`,
169
+ `\`claude plugin install oathe@oathe\` — the Oathe plugin (board at session start, auto-save hooks), recorded in ${this.installedFile}`,
170
+ `${this.userConfigPath}: mcpServers.oathe → ${shimPath(this.home)} mcp (user scope, via \`claude mcp add\` — the oathe_* tools in every session, GUI-launched included)`,
148
171
  ];
149
172
  }
150
173
 
@@ -198,20 +221,49 @@ export class ClaudeHarness extends Harness {
198
221
  kind: 'cli-managed',
199
222
  detail: {
200
223
  id: 'plugin-install',
201
- proof: 'oathe@oathe',
224
+ proofs: ['oathe@oathe'],
202
225
  undo: [['plugin', 'uninstall', 'oathe@oathe'], ['plugin', 'marketplace', 'remove', 'oathe']],
203
226
  },
204
227
  blockVersion: version,
205
228
  sha256: sha256Hex('oathe@oathe'),
206
229
  });
230
+
231
+ // THE CONNECTION IS AN ADDRESS, not plugin cargo (connection-lane plan, 2026-09-04): the
232
+ // plugin is cached by copy and can never carry a machine path, so its bare `oathe` server
233
+ // died on every GUI PATH. The user-scope entry the CLI writes into ~/.claude.json points
234
+ // at the shim; a stale entry (bare, or an older address) is removed and re-added.
235
+ const shim = shimPath(this.home);
236
+ const entry = this.#mcpEntry();
237
+ const mcpCurrent = entry !== null && entry.command === shim
238
+ && JSON.stringify(entry.args ?? []) === JSON.stringify(['mcp']);
239
+ if (!mcpCurrent) {
240
+ manifest.backupOnce(this.userConfigPath);
241
+ if (entry !== null) this.#cli(['mcp', 'remove', 'oathe', '-s', 'user']);
242
+ this.#cli(['mcp', 'add', '-s', 'user', 'oathe', '--', shim, 'mcp']);
243
+ if (this.#mcpEntry()?.command !== shim) {
244
+ throw new HarnessOnboardError('CLAUDE_VERIFICATION_FAILED',
245
+ 'verification failed: `claude mcp add` reported success but '
246
+ + `${this.userConfigPath} does not carry the shim-addressed oathe entry — refusing `
247
+ + 'to record an install that cannot be proven');
248
+ }
249
+ }
250
+ manifest.upsert({
251
+ harness: this.name,
252
+ file: this.userConfigPath,
253
+ kind: 'cli-managed',
254
+ detail: { id: 'mcp-server', command: shim, undo: [['mcp', 'remove', 'oathe', '-s', 'user']] },
255
+ blockVersion: version,
256
+ sha256: sha256Hex(shim),
257
+ });
207
258
  return [
208
259
  { action: 'settings-owned-paths', file: this.settingsPath, changed },
209
260
  { action: materialized ? 'plugin-installed' : 'plugin-already-current', file: this.installedFile },
261
+ { action: mcpCurrent ? 'mcp-already-current' : 'mcp-user-entry', file: this.userConfigPath },
210
262
  ];
211
263
  }
212
264
 
213
265
  offboard({ manifest }) {
214
- const rows = manifest.removeWhere((r) => r.harness === this.name);
266
+ const rows = this.takeWiringRows(manifest);
215
267
  const actions = [];
216
268
  for (const row of rows.filter((r) => r.kind === 'cli-managed')) {
217
269
  for (const undo of row.detail?.undo ?? []) {