@oathe/oathe 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  **Auto save across your harnesses.**
4
4
 
5
- ![Claude Code hits its usage limit mid-fix; Codex opens in the same repo and Oathe resumes the task — progress, effect receipt, and verification target intact.](assets/oathe-hero.svg)
5
+ [![CI](https://github.com/oathe-ai/oathe/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/oathe-ai/oathe/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE) [![Discord](https://img.shields.io/badge/discord-join-5865F2?logo=discord&logoColor=white)](https://discord.gg/sjrdWEj4W8)
6
+
7
+ ![oathe claude: the session opens on the board, the agent claims the task and works — until the model's usage limit cuts it off.](assets/claude-splash.png)
8
+
9
+ ![oathe codex: the next session greets the same board — the task still claimed, completion not asserted, last progress on the row — and Codex picks up in the same workspace.](assets/resume-splash.png)
6
10
 
7
11
  You're mid-refactor in Claude Code when it hits a usage limit. What if you could open Codex and it picks up the same task checkpointed, what's done, what's left, and a test that decides whether it's finished. No copy and paste, no re-explaining, and the new agent doesn't have to take the old agent's word for anything because models are getting too good at being wrong AND confident.
8
12
 
@@ -10,7 +14,6 @@ That's oathe.
10
14
 
11
15
  Below is exactly how much of it works today, because a reliability project that overstates its own status would be a joke.
12
16
 
13
- [![CI](https://github.com/oathe-ai/oathe/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/oathe-ai/oathe/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
14
17
 
15
18
  ## What gets saved
16
19
 
@@ -101,11 +104,6 @@ technical reference: [docs/PACKAGE.md](docs/PACKAGE.md).
101
104
 
102
105
  A small runtime plus a Postgres schema that carries the invariants. The database is deliberately "load-bearing": the rules that keep work safe (one current attempt per task, receipts before effects, verification before settlement) are enforced where no caller can route around them. Harness adapters are thin; our substrate is strict.
103
106
 
104
- ## Community
105
-
106
- Questions, feedback, and show-and-tell: [Discord](https://discord.gg/sjrdWEj4W8) ·
107
- [GitHub Discussions](https://github.com/oathe-ai/oathe/discussions)
108
-
109
107
  ## Contributing
110
108
 
111
109
  Start with [CONTRIBUTING.md](CONTRIBUTING.md). Substantial changes begin with a design issue. The most valuable first contribution is a reproducible failure-and-recovery scenario — if we claim a failure mode is handled, the repository should prove it.
Binary file
Binary file
package/bin/oathe.mjs CHANGED
@@ -58,17 +58,30 @@ const handlers = {
58
58
  async init() {
59
59
  const { runInit } = await import('../src/init.mjs');
60
60
  const result = await runInit({});
61
- process.stdout.write('harness census:\n');
62
- for (const c of result.census) {
63
- process.stdout.write(` ${c.name.padEnd(8)} ${c.installed ? 'onboarded' : 'not installed — skipped'}\n`);
64
- }
61
+ const tty = process.stdout.isTTY === true;
62
+ const B = tty ? '\x1b[1m' : '';
63
+ const D = tty ? '\x1b[2m' : '';
64
+ const G = tty ? '\x1b[32m' : '';
65
+ const R = tty ? '\x1b[0m' : '';
66
+ const ok = `${G}✓${R}`;
65
67
  const s = result.substrate;
66
- process.stdout.write(`substrate: db up, ddl ${s.ddl_applied}/${s.ddl_expected} applied `
67
- + `(source: ${s.ddl_source}), yield cause ${s.yield_cause_registered ? 'registered' : 'MISSING'}\n`);
68
- process.stdout.write(`principal: ${result.principal.principal_id} (${result.principal.role})\n`);
69
- for (const a of result.actions) {
70
- process.stdout.write(` ${a.harness.padEnd(8)} ${a.action}\n`);
68
+ const lines = ['', ` ${B}⚡ Oathe is up${R}`, ''];
69
+ lines.push(` ${ok} ${B}substrate${R} ${D}db up · ${s.ddl_applied}/${s.ddl_expected} schema applied · verification lane ready${R}`);
70
+ if (!s.yield_cause_registered) {
71
+ lines.push(` ${B}! yield cause MISSING${R} — run \`oathe doctor\` before claiming work`);
72
+ }
73
+ for (const c of result.census) {
74
+ const wired = result.actions.filter((a) => a.harness === c.name).length;
75
+ lines.push(c.installed
76
+ ? ` ${ok} ${B}${c.name.padEnd(9)}${R} ${D}onboarded (${wired} surface${wired === 1 ? '' : 's'} wired, reversible)${R}`
77
+ : ` ${D}– ${c.name.padEnd(9)} not installed — skipped${R}`);
71
78
  }
79
+ lines.push(` ${ok} ${B}you${R} ${D}${result.principal.principal_id}${R}`);
80
+ lines.push('');
81
+ lines.push(` Next: ${B}oathe claude${R} ${D}(or codex)${R} in any project — the board rides every session.`);
82
+ lines.push(` Claim before you build: ${B}oathe claim <task> "what done means"${R}`);
83
+ lines.push('');
84
+ process.stdout.write(`${lines.join('\n')}\n`);
72
85
  summary('init', 'ok');
73
86
  },
74
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oathe/oathe",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Auto save and verified completion for AI coding agents \u2014 a durable local task board that outlives any one session. D0 preview.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oathe",
3
3
  "displayName": "Oathe",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "description": "Claims are speech acts: your session opens on this folder's board, records progress as statements, and yields what it cannot finish. Horizons move only by deliberate acts \u2014 never by session liveness.",
6
6
  "author": {
7
7
  "name": "Oathe"
@@ -4,8 +4,58 @@
4
4
  // and everything plugin-side asks ONE predicate before touching the substrate. Named once here:
5
5
  // the launcher writes the block, the hooks and the server read it.
6
6
 
7
+ import fs from 'node:fs';
8
+ import path from 'node:path';
9
+
7
10
  export const LAUNCHED_HARNESS_ENV = 'OATHE_LAUNCHED_HARNESS';
8
11
 
12
+ // The env marker crosses the cage boundary for harnesses that pass their environment to MCP
13
+ // children (Claude Code). Codex builds MCP child environments from its own config, so the
14
+ // marker dies at that boundary — the SESSION MARKER FILE is the harness-agnostic transport:
15
+ // the launcher writes <oatheHome>/launched/<workspace>.<pid>.json while it supervises, the
16
+ // gate honors any marker for its workspace whose supervisor is still alive, and teardown
17
+ // (or the supervisor dying) retires it. Stale markers fail the liveness probe and are inert.
18
+
19
+ export function sessionMarkerPath(oatheHome, workspace, pid = process.pid) {
20
+ return path.join(oatheHome, 'launched', `${workspace}.${pid}.json`);
21
+ }
22
+
23
+ /** @returns {string} the marker file path (hand it to clearSessionMarker at teardown).
24
+ * `wiring` is the launchSessionEnv block: harnesses that strip the environment on the way
25
+ * to their MCP children (Codex) get it back from here, identity included. */
26
+ export function writeSessionMarker({ oatheHome, workspace, harness, cwd, wiring = {}, pid = process.pid }) {
27
+ const file = sessionMarkerPath(oatheHome, workspace, pid);
28
+ fs.mkdirSync(path.dirname(file), { recursive: true });
29
+ fs.writeFileSync(file, `${JSON.stringify({
30
+ harness, supervisor_pid: pid, cwd, wiring, started_at: new Date().toISOString(),
31
+ })}\n`);
32
+ return file;
33
+ }
34
+
35
+ export function clearSessionMarker(file) {
36
+ fs.rmSync(file, { force: true });
37
+ }
38
+
39
+ /** The full LIVE launch marker for this workspace ({harness, wiring, …}), or null.
40
+ * Dead and unreadable markers are retired on sight. */
41
+ export function liveSessionMarker({ oatheHome, workspace }) {
42
+ const dir = path.join(oatheHome, 'launched');
43
+ let names;
44
+ try { names = fs.readdirSync(dir); } catch { return null; }
45
+ for (const name of names) {
46
+ if (!name.startsWith(`${workspace}.`) || !name.endsWith('.json')) continue;
47
+ const file = path.join(dir, name);
48
+ try {
49
+ const marker = JSON.parse(fs.readFileSync(file, 'utf8'));
50
+ process.kill(marker.supervisor_pid, 0); // throws when the supervisor is gone
51
+ return marker;
52
+ } catch {
53
+ fs.rmSync(file, { force: true }); // stale or unreadable: retire it
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+
9
59
  /** The harness ('claude' | 'codex') that launched this session, or null when unlaunched. */
10
60
  export function launchedHarness(env = process.env) {
11
61
  const value = String(env[LAUNCHED_HARNESS_ENV] ?? '').trim();
package/src/launch.mjs CHANGED
@@ -16,7 +16,7 @@ import { FencedBlock, FENCE_STYLES } from './blocks.mjs';
16
16
  import { sha256Hex } from './manifest.mjs';
17
17
  import { workspaceRef } from './workspace.mjs';
18
18
  import { SessionHost } from './session-host.mjs';
19
- import { launchSessionEnv } from './launch-env.mjs';
19
+ import { launchSessionEnv, writeSessionMarker, clearSessionMarker } from './launch-env.mjs';
20
20
 
21
21
  export class LaunchError extends Error {
22
22
  constructor(code, message, details = {}) {
@@ -157,6 +157,10 @@ export async function runHarness({
157
157
 
158
158
  const unit = `oathe-${Date.now().toString(36)}-${process.pid}`;
159
159
  const extra = launchSessionEnv({ config, identity, cwd, harness });
160
+ // The env block above dies at Codex's MCP spawn boundary; the marker file is the
161
+ // harness-agnostic copy of the same wiring, retired in the finally below.
162
+ const marker = writeSessionMarker({
163
+ oatheHome: paths.oatheHome, workspace, harness, cwd, wiring: extra });
160
164
  const cage = spawnCaged({
161
165
  unit,
162
166
  env: curatedEnv(env, { hermetic, extra }),
@@ -182,6 +186,7 @@ export async function runHarness({
182
186
  if (exitCode === 0) await host.stop({ exitCode });
183
187
  else await host.stopSilently(); // a non-zero exit was not a clean goodbye — leave the absence
184
188
  } finally {
189
+ clearSessionMarker(marker);
185
190
  await substrate.close();
186
191
  }
187
192
  const teardown = await cage.teardownProvenEmpty();
@@ -15,7 +15,7 @@ import { pathToFileURL } from 'node:url';
15
15
  import crypto from 'node:crypto';
16
16
 
17
17
  import { standardPlan, verificationTaskId, verificationObjective, isVerificationTask } from '../plans.mjs';
18
- import { launchedHarness } from '../launch-env.mjs';
18
+ import { launchedHarness, liveSessionMarker } from '../launch-env.mjs';
19
19
 
20
20
  export const PROTOCOL_VERSION = '2025-06-18';
21
21
  export const SERVER_NAME = 'oathe-tools';
@@ -416,8 +416,8 @@ export async function handleToolCall(params, tools) {
416
416
  * OATHE_NOT_LAUNCHED refusal — loud to the model (a called tool must answer), inert to the
417
417
  * substrate (an unlaunched session never touches the board).
418
418
  */
419
- export function withLaunchGate(tools, env = process.env) {
420
- if (launchedHarness(env)) return tools;
419
+ export function withLaunchGate(tools, env = process.env, { launched = false } = {}) {
420
+ if (launchedHarness(env) || launched) return tools;
421
421
  const refuse = async () => {
422
422
  throw new OatheToolError('OATHE_NOT_LAUNCHED',
423
423
  'this session was not launched through oathe, so the board is not bound to it — start the '
@@ -461,7 +461,20 @@ export async function main(env = process.env) {
461
461
  const { Substrate } = await import('../substrate.mjs');
462
462
  const { buildPaths } = await import('../paths.mjs');
463
463
  const { workspaceRef } = await import('../workspace.mjs');
464
- const paths = buildPaths(env);
464
+ let paths = buildPaths(env);
465
+ // Codex builds MCP child environments from its own config, so the launcher's env block
466
+ // never crosses that boundary. A live session marker for this cwd's workspace is the
467
+ // harness-agnostic transport: adopt its recorded wiring (identity included) and re-derive.
468
+ let markerLaunched = false;
469
+ if (!env.OATHE_LAUNCHED_HARNESS) {
470
+ const marker = liveSessionMarker({
471
+ oatheHome: paths.oatheHome, workspace: workspaceRef(process.cwd()) });
472
+ if (marker) {
473
+ env = { ...env, ...marker.wiring, OATHE_LAUNCHED_HARNESS: marker.harness };
474
+ paths = buildPaths(env);
475
+ markerLaunched = true;
476
+ }
477
+ }
465
478
  const { OatheConfig } = await import('../config.mjs');
466
479
  const config = new OatheConfig({ env, cwd: env.OATHE_WORKSPACE_DIR || process.cwd() });
467
480
  const substrate = new Substrate({ database: config.get('db'), paths, env, config });
@@ -500,7 +513,7 @@ export async function main(env = process.env) {
500
513
  return (await successorPromise).pickup(o);
501
514
  },
502
515
  });
503
- const served = withLaunchGate(tools, env);
516
+ const served = withLaunchGate(tools, env, { launched: markerLaunched });
504
517
  const rl = readline.createInterface({ input: process.stdin });
505
518
  rl.on('line', async (line) => {
506
519
  const s = line.trim();
@@ -1,92 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 856" font-family="Menlo, 'SF Mono', Consolas, 'Liberation Mono', 'DejaVu Sans Mono', monospace" font-size="13">
2
- <style>text { white-space: pre; }</style>
3
- <defs>
4
- <clipPath id="winTop"><rect x="0" y="0" width="900" height="468" rx="10"/></clipPath>
5
- <clipPath id="winBot"><rect x="0" y="492" width="900" height="364" rx="10"/></clipPath>
6
- </defs>
7
-
8
- <!-- ===== Top window: Claude Code ===== -->
9
- <g clip-path="url(#winTop)">
10
- <rect x="0" y="0" width="900" height="468" fill="#111214"/>
11
- <rect x="0" y="0" width="900" height="32" fill="#1b1c20"/>
12
- </g>
13
- <rect x="0.5" y="0.5" width="899" height="467" rx="10" fill="none" stroke="#2a2c33"/>
14
- <circle cx="22" cy="16" r="6" fill="#ff5f57"/>
15
- <circle cx="42" cy="16" r="6" fill="#febc2e"/>
16
- <circle cx="62" cy="16" r="6" fill="#28c840"/>
17
- <text x="450" y="21" text-anchor="middle" fill="#8b8f98">checkout-service — claude</text>
18
-
19
- <!-- Claude Code pixel mascot -->
20
- <g fill="#d97757">
21
- <rect x="24" y="48" width="40" height="32"/>
22
- <rect x="26" y="80" width="5" height="8"/>
23
- <rect x="37" y="80" width="5" height="8"/>
24
- <rect x="48" y="80" width="5" height="8"/>
25
- <rect x="59" y="80" width="5" height="8"/>
26
- </g>
27
- <rect x="36" y="56" width="4" height="12" fill="#2a1a12"/>
28
- <rect x="50" y="56" width="4" height="12" fill="#2a1a12"/>
29
-
30
- <g xml:space="preserve" fill="#d6d8dd">
31
- <text x="76" y="60"><tspan font-weight="bold" fill="#e8eaef">Claude Code</tspan><tspan fill="#8b8f98"> v2.1.239</tspan></text>
32
- <text x="76" y="80" fill="#8b8f98">Fable 5 with xhigh effort · Claude Max</text>
33
- <text x="76" y="100" fill="#8b8f98">~/checkout-service</text>
34
-
35
- <text x="24" y="136"><tspan fill="#8b8f98">&gt; </tspan><tspan fill="#e8eaef">Customers get double-charged on checkout retries — find and fix it.</tspan></text>
36
-
37
- <text x="24" y="172"><tspan fill="#4ec97a">● </tspan><tspan>capturePayment omits the order's idempotency key, so a retried request opens a</tspan></text>
38
- <text x="24" y="192"><tspan> second charge. I'll thread it through the gateway call.</tspan></text>
39
-
40
- <text x="24" y="220"><tspan fill="#4ec97a">● </tspan><tspan font-weight="bold" fill="#e8eaef">Read</tspan><tspan fill="#6cb6ff">(src/capturePayment.ts, gateway.ts)</tspan></text>
41
- <text x="24" y="240" fill="#8b8f98"> ⎿ Read 2 files</text>
42
-
43
- <text x="24" y="268"><tspan fill="#4ec97a">● </tspan><tspan font-weight="bold" fill="#e8eaef">Update</tspan><tspan fill="#6cb6ff">(src/capturePayment.ts)</tspan></text>
44
- <text x="24" y="288" fill="#8b8f98"> ⎿ Added 1 line, removed 1 line</text>
45
-
46
- <text x="24" y="312" fill="#8b8f98"> 22 const res = await gateway.charge({</text>
47
- <rect x="12" y="320" width="876" height="20" fill="#3b1517"/>
48
- <text x="24" y="334"><tspan fill="#8b8f98"> 23 </tspan><tspan fill="#f47067">- source: order.token,</tspan></text>
49
- <rect x="12" y="340" width="876" height="20" fill="#13351d"/>
50
- <text x="24" y="354"><tspan fill="#8b8f98"> 23 </tspan><tspan fill="#7ee787">+ source: order.token, idempotencyKey: order.idempotencyKey,</tspan></text>
51
- <text x="24" y="374" fill="#8b8f98"> 24 })</text>
52
-
53
- <text x="24" y="402"><tspan fill="#4ec97a">● </tspan><tspan font-weight="bold" fill="#e8eaef">Bash</tspan><tspan fill="#6cb6ff">(node --test test/payment.idempotency.test.js)</tspan></text>
54
- <text x="24" y="422" fill="#8b8f98"> ⎿ Running verification…</text>
55
-
56
- <text x="24" y="450"><tspan fill="#e5a44c">⚠ Claude usage limit reached · resets 1:00 AM · run /upgrade to raise your limit</tspan></text>
57
- </g>
58
-
59
- <!-- ===== Bottom window: Codex ===== -->
60
- <g clip-path="url(#winBot)">
61
- <rect x="0" y="492" width="900" height="364" fill="#111214"/>
62
- <rect x="0" y="492" width="900" height="32" fill="#1b1c20"/>
63
- </g>
64
- <rect x="0.5" y="492.5" width="899" height="363" rx="10" fill="none" stroke="#2a2c33"/>
65
- <circle cx="22" cy="508" r="6" fill="#ff5f57"/>
66
- <circle cx="42" cy="508" r="6" fill="#febc2e"/>
67
- <circle cx="62" cy="508" r="6" fill="#28c840"/>
68
- <text x="450" y="513" text-anchor="middle" fill="#8b8f98">checkout-service — codex</text>
69
-
70
- <g xml:space="preserve" fill="#d6d8dd">
71
- <text x="24" y="552" fill="#8b8f98">(base) dev@macbook-pro checkout-service % <tspan font-weight="bold" fill="#e8eaef">codex</tspan></text>
72
-
73
- <rect x="20" y="564" width="420" height="52" rx="6" fill="none" stroke="#3a3f4b"/>
74
- <text x="34" y="586"><tspan font-weight="bold" fill="#e8eaef">&gt;_ OpenAI Codex</tspan><tspan fill="#8b8f98"> model: gpt-5.6</tspan></text>
75
- <text x="34" y="606" fill="#8b8f98"> directory: ~/checkout-service</text>
76
-
77
- <text x="24" y="642"><tspan fill="#4ec97a">● </tspan><tspan font-weight="bold" fill="#e8eaef">oathe</tspan><tspan fill="#8b8f98"> · unfinished work found — </tspan><tspan fill="#e8eaef">handoff from claude-code</tspan></text>
78
- <text x="24" y="668"><tspan fill="#8b8f98"> work </tspan><tspan>prevent duplicate charge on checkout retry</tspan></text>
79
- <text x="24" y="688"><tspan fill="#8b8f98"> progress </tspan><tspan>idempotency guard implemented in capturePayment.ts</tspan></text>
80
- <text x="24" y="708"><tspan fill="#8b8f98"> effects </tspan><tspan fill="#6cb6ff">charge ch_4821</tspan><tspan> already recorded — </tspan><tspan fill="#4ec97a">will not repeat</tspan></text>
81
- <text x="24" y="728"><tspan fill="#8b8f98"> verify </tspan><tspan fill="#6cb6ff">payment-idempotency</tspan><tspan> contract</tspan></text>
82
- <text x="24" y="748"><tspan fill="#8b8f98"> next </tspan><tspan>run verification</tspan></text>
83
-
84
- <rect x="238" y="768" width="44" height="22" rx="5" fill="#1d3b28" stroke="#2ea55f"/>
85
- <text x="24" y="783"><tspan fill="#4ec97a">❯ </tspan><tspan fill="#e8eaef">Resume this work?</tspan></text>
86
- <text x="248" y="783" fill="#7ee787">Yes</text>
87
- <text x="296" y="783" fill="#8b8f98">No</text>
88
-
89
- <text x="24" y="815"><tspan fill="#4ec97a">● </tspan><tspan>Resuming open oathe claim</tspan></text>
90
- <text x="24" y="839"><tspan fill="#4ec97a">● </tspan><tspan>Running <tspan fill="#6cb6ff">payment-idempotency</tspan> contract…</tspan></text>
91
- </g>
92
- </svg>