@alizain/doublecheck 2.2.0 → 2.4.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/README.md +17 -14
- package/dist/cli.mjs +38 -9
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,23 +69,26 @@ missing token / checks / image abort loudly up front.
|
|
|
69
69
|
npm install -g @alizain/doublecheck # installs the `doublecheck` command; or, from a clone: pnpm install
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
Guests boot from an image with both agent CLIs baked in
|
|
73
|
-
needs
|
|
74
|
-
`ghcr.io/alizain/doublecheck-guest:<its own version
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
Guests boot from an image with both agent CLIs baked in, and no install
|
|
73
|
+
needs an image step. An installed release resolves
|
|
74
|
+
`ghcr.io/alizain/doublecheck-guest:<its own version>`; a clone resolves the
|
|
75
|
+
nearest release tag reachable from its checkout (`git describe`), so `git
|
|
76
|
+
pull` bringing a new tag is also the image update. Either way the runner
|
|
77
|
+
pulls the image on first use (~1 GB, once per version — the release workflow
|
|
78
|
+
publishes it for amd64+arm64 alongside the npm package).
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
newer agent CLIs):
|
|
80
|
+
The locally built image is only for iterating on `Dockerfile.guest` itself
|
|
81
|
+
(needs a running Docker daemon), opted into explicitly:
|
|
81
82
|
|
|
82
83
|
```bash
|
|
83
84
|
./scripts/build-guest-image.sh
|
|
85
|
+
DOUBLECHECK_GUEST_IMAGE=doublecheck-guest:latest pnpm doublecheck check …
|
|
84
86
|
```
|
|
85
87
|
|
|
86
|
-
`DOUBLECHECK_GUEST_IMAGE=<ref>`
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
`DOUBLECHECK_GUEST_IMAGE=<ref>` works for any install — the named ref must
|
|
89
|
+
already be in the microsandbox cache (it is never pulled); useful offline or
|
|
90
|
+
for custom guest images. A clone with no reachable release tag (e.g. a
|
|
91
|
+
shallow clone) falls back to the locally built image.
|
|
89
92
|
|
|
90
93
|
## Usage
|
|
91
94
|
|
|
@@ -95,7 +98,7 @@ CLAUDE_CODE_OAUTH_TOKEN=... doublecheck check \
|
|
|
95
98
|
--checks-dir DIR # repeatable; default: $TARGET/.agents/checks
|
|
96
99
|
--context FILE # run brief: intent, nuances, sanctioned exceptions, scope
|
|
97
100
|
--agent NAME # claude (default) or codex
|
|
98
|
-
--model MODEL # default per agent: claude haiku, codex gpt-5.
|
|
101
|
+
--model MODEL # default per agent: claude haiku, codex gpt-5.6-sol
|
|
99
102
|
--parallel N # default: 4 concurrent guests
|
|
100
103
|
--output DIR # default: $TARGET/.doublecheck
|
|
101
104
|
--check NAME # repeatable; default: every check in the checks dirs
|
|
@@ -134,7 +137,7 @@ CLAUDE_CODE_OAUTH_TOKEN=... doublecheck mine \
|
|
|
134
137
|
--projects DIR # default: ~/.claude/projects
|
|
135
138
|
--catalog DIR # default: ~/.doublecheck/catalog
|
|
136
139
|
--agent NAME # claude (default) or codex
|
|
137
|
-
--model MODEL # default per agent: claude opus, codex gpt-5.
|
|
140
|
+
--model MODEL # default per agent: claude opus, codex gpt-5.6-sol
|
|
138
141
|
# (a bad-model mine pollutes a durable asset)
|
|
139
142
|
--parallel N # default: 4
|
|
140
143
|
--min-turns N # default: 2
|
|
@@ -161,7 +164,7 @@ The facts of the agent's world, so you can decide how to author checks:
|
|
|
161
164
|
- `--agent claude` (default): `claude -p` (model from `--model`, default
|
|
162
165
|
haiku) with the pinned toolkit Task (it can spawn subagents), Bash,
|
|
163
166
|
Read, Write, Edit, Glob, Grep, WebSearch, WebFetch.
|
|
164
|
-
- `--agent codex`: `codex exec` (default model gpt-5.
|
|
167
|
+
- `--agent codex`: `codex exec` (default model gpt-5.6-sol, reasoning effort
|
|
165
168
|
pinned to xhigh in the staged guest config) with codex's own toolset:
|
|
166
169
|
shell, apply_patch, plan/todo, subagent spawning (multi_agent), and
|
|
167
170
|
server-side web search. The staged config disables codex's ambient
|
package/dist/cli.mjs
CHANGED
|
@@ -4,6 +4,8 @@ import { basename, dirname, join, resolve } from "node:path";
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { appendFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import PQueue from "p-queue";
|
|
7
|
+
import { execFileSync } from "node:child_process";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
7
9
|
import { createHash } from "node:crypto";
|
|
8
10
|
|
|
9
11
|
//#region src/contract.ts
|
|
@@ -243,8 +245,8 @@ const AGENT_CLIS = {
|
|
|
243
245
|
codex: {
|
|
244
246
|
name: "codex",
|
|
245
247
|
defaultModel: {
|
|
246
|
-
check: "gpt-5.
|
|
247
|
-
mine: "gpt-5.
|
|
248
|
+
check: "gpt-5.6-sol",
|
|
249
|
+
mine: "gpt-5.6-sol"
|
|
248
250
|
},
|
|
249
251
|
writeToolPhrase: null,
|
|
250
252
|
egressDomains: ["chatgpt.com", "openai.com"],
|
|
@@ -297,23 +299,49 @@ const GUEST_IMAGE_REPO = "ghcr.io/alizain/doublecheck-guest";
|
|
|
297
299
|
const LOCAL_GUEST_IMAGE = "doublecheck-guest:latest";
|
|
298
300
|
const DEV_VERSION = "0.0.0-development";
|
|
299
301
|
const GUEST_MEMORY_MIB = 2048;
|
|
300
|
-
function decideGuestImage(version, override) {
|
|
302
|
+
function decideGuestImage(version, override, checkoutReleaseVersion) {
|
|
301
303
|
if (override) return {
|
|
302
304
|
ref: override,
|
|
303
305
|
pullPolicy: "never"
|
|
304
306
|
};
|
|
305
|
-
|
|
307
|
+
const release = version === "0.0.0-development" ? checkoutReleaseVersion : version;
|
|
308
|
+
if (!release) return {
|
|
306
309
|
ref: LOCAL_GUEST_IMAGE,
|
|
307
310
|
pullPolicy: "never"
|
|
308
311
|
};
|
|
309
312
|
return {
|
|
310
|
-
ref: `${GUEST_IMAGE_REPO}:${
|
|
313
|
+
ref: `${GUEST_IMAGE_REPO}:${release}`,
|
|
311
314
|
pullPolicy: "if-missing"
|
|
312
315
|
};
|
|
313
316
|
}
|
|
314
317
|
function packageVersion() {
|
|
315
318
|
return JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8")).version;
|
|
316
319
|
}
|
|
320
|
+
function checkoutReleaseVersion() {
|
|
321
|
+
try {
|
|
322
|
+
return execFileSync("git", [
|
|
323
|
+
"-C",
|
|
324
|
+
packageRoot(),
|
|
325
|
+
"describe",
|
|
326
|
+
"--tags",
|
|
327
|
+
"--abbrev=0",
|
|
328
|
+
"--match",
|
|
329
|
+
"v[0-9]*"
|
|
330
|
+
], {
|
|
331
|
+
encoding: "utf-8",
|
|
332
|
+
stdio: [
|
|
333
|
+
"ignore",
|
|
334
|
+
"pipe",
|
|
335
|
+
"ignore"
|
|
336
|
+
]
|
|
337
|
+
}).trim().slice(1);
|
|
338
|
+
} catch {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function packageRoot() {
|
|
343
|
+
return fileURLToPath(new URL("..", import.meta.url));
|
|
344
|
+
}
|
|
317
345
|
function feedLines(carry, chunk) {
|
|
318
346
|
const parts = (carry + chunk).split("\n");
|
|
319
347
|
const rest = parts.pop() ?? "";
|
|
@@ -341,7 +369,8 @@ function decideOutcome(exitCode, report, workdir) {
|
|
|
341
369
|
async function runAgent(opts) {
|
|
342
370
|
const microsandbox = await import("microsandbox");
|
|
343
371
|
const name = `doublecheck-${basename(opts.workdir)}`;
|
|
344
|
-
const
|
|
372
|
+
const version = packageVersion();
|
|
373
|
+
const image = decideGuestImage(version, process.env.DOUBLECHECK_GUEST_IMAGE, version === "0.0.0-development" ? checkoutReleaseVersion() : null);
|
|
345
374
|
const network = opts.network;
|
|
346
375
|
const policy = network === "all" ? microsandbox.NetworkPolicy.allowAll() : microsandbox.NetworkPolicy.builder().defaultDeny().egress((rb) => {
|
|
347
376
|
let rules = rb;
|
|
@@ -360,7 +389,7 @@ async function runAgent(opts) {
|
|
|
360
389
|
return p;
|
|
361
390
|
}).network((nb) => nb.policy(policy)).create();
|
|
362
391
|
} catch (e) {
|
|
363
|
-
if (image.pullPolicy === "never" && String(e).includes("not cached")) throw new Error(`guest image ${image.ref} is not in the microsandbox cache —
|
|
392
|
+
if (image.pullPolicy === "never" && String(e).includes("not cached")) throw new Error(`guest image ${image.ref} is not in the microsandbox cache — it is never pulled; scripts/build-guest-image.sh builds and side-loads ${LOCAL_GUEST_IMAGE} (${String(e)})`);
|
|
364
393
|
if (image.pullPolicy === "if-missing") throw new Error(`guest ${image.ref} failed to boot — if this is a pull failure, check network access to ghcr.io and that the package is public; a locally built image can be forced with DOUBLECHECK_GUEST_IMAGE=doublecheck-guest:latest (${String(e)})`);
|
|
365
394
|
throw e;
|
|
366
395
|
}
|
|
@@ -701,7 +730,7 @@ function parsePositiveInt(flag) {
|
|
|
701
730
|
}
|
|
702
731
|
const collect = (v, prev) => [...prev, v];
|
|
703
732
|
const program = new Command().name("doublecheck").description("Run self-authored LLM code-inspectors (checks) against a target tree, one sandboxed agent per check");
|
|
704
|
-
program.command("check").option("--target <dir>", "tree under inspection, mounted read-only", process.cwd()).option("--checks-dir <dir>", "checks directory (repeatable; default: $TARGET/.agents/checks)", collect, []).option("--context <file>", "run-context file spliced into every inspector's prompt (intent, nuances, sanctioned exceptions, scope)").option("--agent <name>", "agent CLI that runs the inspectors: claude or codex", "claude").option("--model <model>", "model for the inspector agents (default per agent: claude haiku, codex gpt-5.
|
|
733
|
+
program.command("check").option("--target <dir>", "tree under inspection, mounted read-only", process.cwd()).option("--checks-dir <dir>", "checks directory (repeatable; default: $TARGET/.agents/checks)", collect, []).option("--context <file>", "run-context file spliced into every inspector's prompt (intent, nuances, sanctioned exceptions, scope)").option("--agent <name>", "agent CLI that runs the inspectors: claude or codex", "claude").option("--model <model>", "model for the inspector agents (default per agent: claude haiku, codex gpt-5.6-sol)").option("--parallel <n>", "max concurrent checks", parsePositiveInt("--parallel"), 4).option("--output <dir>", "reports root (default: $TARGET/.doublecheck)").option("--check <name>", "run only this check (repeatable)", collect, []).option("--save-jsonl", "persist each inspector's raw stream-json beside its report (audit trail)").action(async (opts) => {
|
|
705
734
|
const target = resolve(opts.target);
|
|
706
735
|
if (!await runChecks({
|
|
707
736
|
target,
|
|
@@ -715,7 +744,7 @@ program.command("check").option("--target <dir>", "tree under inspection, mounte
|
|
|
715
744
|
saveJsonl: !!opts.saveJsonl
|
|
716
745
|
})) process.exitCode = 1;
|
|
717
746
|
});
|
|
718
|
-
program.command("mine").option("--projects <dir>", "Claude Code transcripts root", join(homedir(), ".claude", "projects")).option("--catalog <dir>", "observation catalog root", join(homedir(), ".doublecheck", "catalog")).option("--agent <name>", "agent CLI that runs the miners: claude or codex", "claude").option("--model <model>", "model for the mining agents (default per agent: claude opus, codex gpt-5.
|
|
747
|
+
program.command("mine").option("--projects <dir>", "Claude Code transcripts root", join(homedir(), ".claude", "projects")).option("--catalog <dir>", "observation catalog root", join(homedir(), ".doublecheck", "catalog")).option("--agent <name>", "agent CLI that runs the miners: claude or codex", "claude").option("--model <model>", "model for the mining agents (default per agent: claude opus, codex gpt-5.6-sol — a bad-model mine pollutes a durable asset)").option("--parallel <n>", "max concurrent miners", parsePositiveInt("--parallel"), 4).option("--min-turns <n>", "min genuine human turns for a real conversation", parsePositiveInt("--min-turns"), 2).option("--limit <n>", "mine at most N pending units", parsePositiveInt("--limit")).option("--dry-run", "list what would be mined without booting anything").action(async (opts) => {
|
|
719
748
|
if (!await runMine({
|
|
720
749
|
projects: resolve(opts.projects),
|
|
721
750
|
catalog: resolve(opts.catalog),
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":["GUEST_HOME"],"sources":["../src/contract.ts","../src/claude.ts","../src/codex.ts","../src/agent-cli.ts","../src/runner.ts","../src/check.ts","../src/transcript.ts","../src/catalog.ts","../src/mine.ts","../src/cli.ts"],"sourcesContent":["// The agent contract: what the harness stages for the agent and what the\n// agent must leave behind. Any adapter (claude, codex) runs under this same\n// contract, which is what keeps the harness CLI-agnostic. The one per-agent\n// piece is `writeTool`: the phrase naming how THIS agent creates a file\n// (claude has a literal Write tool; codex is just told to create the file —\n// naming a tool it doesn't have would invite it to distrust its brief).\n\n// Staged into the scratch workdir before boot; the rw bind mount delivers it.\nexport const PROMPT_FILE = \"prompt.txt\"\n// The agent writes its findings here (relative to its cwd); the host reads it\n// back after exit. Missing report = failure.\nexport const REPORT_FILE = \"report.md\"\n\n// Weak models reliably skip a report contract stated once at the prompt's\n// tail unless it leads with the stakes and orders the file created first\n// (measured: haiku went from ~50% to 3/3 with this wording). Two hard-won\n// additions (2026-07-05, all three cutover inspectors lost their reports):\n// the path is ABSOLUTE — agents cd into the inspected tree to run git, and a\n// relative ./report.md then lands in the read-only mount — and the\n// create-first order is repeated near the top of the prompt (see\n// firstActionLine), because on long prompts the tail alone loses its grip.\nfunction reportContract(\n\tactivity: string,\n\tdeliverable: string,\n\tworkdir: string,\n\twriteTool: string | null,\n): string {\n\tconst tool = writeTool ? ` ${writeTool}` : \"\"\n\treturn `## Report — the only output that counts\n\nYour final chat reply is discarded. The only thing read back is the file \\`${workdir}/${REPORT_FILE}\\` — if it does not exist when you exit, this run FAILS. Always use that absolute path: if you \\`cd\\` elsewhere (into the inspected tree, say), a relative \\`./${REPORT_FILE}\\` lands in the wrong place, or in a read-only mount where the write fails.\n\nSo: create \\`${workdir}/${REPORT_FILE}\\`${tool} BEFORE you start ${activity} (a title line is enough), and update it as you work. The final state of the file when you finish is ${deliverable}.`\n}\n\nfunction firstActionLine(workdir: string, writeTool: string | null): string {\n\tconst tool = writeTool ? ` ${writeTool}` : \"\"\n\treturn `Your FIRST action, before anything else: create \\`${workdir}/${REPORT_FILE}\\`${tool} (a title line is enough). The full report contract is at the end of this prompt.`\n}\n\n// Environment preamble + optional run context + check body + report\n// contract. Checks are timeless standards; everything run-specific (intent,\n// sanctioned exceptions, scope) arrives in the operator's run context — the\n// harness knows nothing about git.\nexport function composePrompt(opts: {\n\tcheckBody: string\n\ttarget: string\n\tworkdir: string\n\trunContext: string | null\n\twriteTool: string | null\n}): string {\n\tconst contextSection = opts.runContext\n\t\t? `## Run context (from the operator)\n\nThe operator's brief for this run: the intent behind the work under review, known nuances, sanctioned exceptions, and possibly a Scope naming exactly what is under review. Judge requestedness against it — what the brief explicitly sanctions is not a finding. If it names a Scope, the Scope defines the change under review: findings must concern that change, and the rest of the tree is reference for judgment — with one exception. For concepts the scoped change retires or renames, surviving references anywhere in the tree are reportable findings: the Scope bounds what counts as the change, not where survivors may hide.\n\n${opts.runContext}\n\n---\n\n`\n\t\t: \"\"\n\treturn `## Environment\n\nYou are a code inspector running inside a sandboxed microVM with full permissions and unrestricted internet access.\n\n- The code under inspection is mounted read-only at \\`${opts.target}\\`. You cannot modify it — inspect, don't fix.\n- \\`git\\` and \\`rg\\` are installed.\n- Your current working directory is a writable scratch workspace: \\`${opts.workdir}\\`.\n\n${firstActionLine(opts.workdir, opts.writeTool)}\n\n## Inspection discipline\n\nMeasured on real runs: inspectors that skip these rules produce reports whose verdicts are right but whose evidence is partly fabricated — which is worse than no report.\n\n- Before inspecting, enumerate what is under review (the Run context's Scope list if one is given; otherwise your own enumeration of the target) and keep a ledger as you work: **examined** (content actually opened), **name-only**, **not examined**. End your report with that ledger, with a one-line reason for anything not examined.\n- Use verification verbs — \"verified\", \"confirmed\", \"checked\", \"read\", \"diffed\", \"grepped\", \"spot-checked\" — ONLY for actions you actually performed in this session on content you actually opened. Everything else must be labeled as inference: \"assumed identical by generation — not opened.\"\n- Never truncate output you will base a claim on — no \\`| head\\` / \\`| tail\\` on a diff or search you intend to cite. Examine files one at a time instead.\n\n---\n\n${contextSection}${opts.checkBody}\n\n---\n\n${reportContract(\"inspecting\", \"the check's report\", opts.workdir, opts.writeTool)}\n\nEvery single line of your report will be read in full by the operator's agent — nothing is skimmed, so every line costs attention. Verify each finding against the actual code before writing it down. A report that says \"no findings\" is a perfectly good report; an unverified finding is not.`\n}\n\n// The mining prompt: digest of one conversation + what counts as a durable\n// preference observation + the block format the catalog accumulates.\nexport function composeMinePrompt(\n\tdigest: string,\n\tworkdir: string,\n\twriteTool: string | null,\n): string {\n\treturn `## Environment\n\nYou are running inside a sandboxed microVM with no network access. The machine's Claude Code transcripts are mounted read-only at their real paths; your current working directory is a writable scratch workspace: \\`${workdir}\\`.\n\n${firstActionLine(workdir, writeTool)}\n\n## Task\n\nYou are mining ONE Claude Code conversation for the operator's durable preferences — how they want engineering done, in any conversation, not what they wanted built in this one.\n\nBelow is the conversation digest: every genuine human turn, numbered, in order. When a turn is a terse correction or interruption (\"no\", \"stop\", \"don't\", \"why did you…\", \"[Request interrupted]\"), recover its context: the \"# source:\" header names the full session transcript — Grep that turn's text in it to find its line, then Read the assistant turns IMMEDIATELY BEFORE it with offset/limit. The preference lives in the contrast between what the assistant did and what the operator demanded. NEVER read a transcript whole — some are tens of MB.\n\n---\n\n${digest}\n\n---\n\n## What counts as an observation (strict)\n\nA durable preference, backed by a verbatim quote from the digest or transcript:\n\n- **kind: code** — how code should be written/structured/shaped (\"no silent fallbacks\", \"reuse the existing helper instead of hand-rolling\").\n- **kind: workflow** — how work should proceed (\"verify before claiming done\", \"ask before making scope decisions\").\n- **kind: style** — how prose/output/docs should read.\n\nExclude task-of-the-moment directives with no durable signal (\"add a tab to home.tsx\", \"kill the dev server\"). Exclude anything you cannot quote. Be conservative: a weak or speculative observation is worse than none.\n\n## Observation format\n\nThe report is observation blocks and NOTHING else — no title, no preamble, no summary or conclusion sections. One block per observation:\n\n## <kebab-case-name>\n- **observation:** <one sentence: the durable preference>\n- **kind:** code | workflow | style\n- **evidence:** \"<verbatim quote>\" — turn <N>\n\nFor **code** observations that an LLM reviewer could check against a diff or file tree (a concrete change could flip PASS↔FAIL), and ONLY for those — never on workflow or style blocks — ALSO add:\n\n- **pass/fail:** PASS when <…>; FAIL when <…>\n- **why-LLM:** <why a deterministic linter cannot enforce this>\n- **scope:** diff-only | needs-tree\n\nIf the conversation carries no durable preference signal, the report is exactly these two lines and nothing more:\n\nNo durable preference signal.\n<one sentence: what the conversation was about instead>\n\n${reportContract(\"mining\", \"the mined observations\", workdir, writeTool)}`\n}\n","import { PROMPT_FILE } from \"./contract.ts\"\nimport type { AgentSpec } from \"./runner.ts\"\n\nconst GUEST_HOME = \"/root\"\n\n// The claude adapter: produce the AgentSpec that runs `claude -p` in the guest.\nexport function claudeAgent(opts: {\n\ttoken: string\n\tmodel: string\n\tworkdir: string\n}): AgentSpec {\n\treturn {\n\t\t// Headless claude -p cannot answer permission prompts, so in \"default\"\n\t\t// mode every tool is auto-denied and the agent produces nothing. The\n\t\t// microVM is the safety boundary here, so bypass the per-tool gate;\n\t\t// IS_SANDBOX=1 is what lets that run as root without claude's refusal.\n\t\tcommand:\n\t\t\t\"claude -p --no-session-persistence \" +\n\t\t\t\"--dangerously-skip-permissions \" +\n\t\t\t// --verbose is required by claude -p with stream-json output; it only\n\t\t\t// widens what lands on stdout, which describeStreamLine already labels.\n\t\t\t\"--output-format stream-json --verbose \" +\n\t\t\t// Not a permission gate — a contract guard. The default headless tool\n\t\t\t// set omits Glob/Grep and includes harness tools (ReportFindings,\n\t\t\t// TaskCreate, …) that hijack the report: haiku \"reports findings\"\n\t\t\t// through them and never writes report.md (verified live). This pins\n\t\t\t// the inspector's full toolkit and nothing else.\n\t\t\t`--tools Task Bash Read Write Edit Glob Grep WebSearch WebFetch < ${PROMPT_FILE}`,\n\t\tenv: {\n\t\t\tHOME: GUEST_HOME,\n\t\t\tIS_SANDBOX: \"1\",\n\t\t\tGIT_OPTIONAL_LOCKS: \"0\",\n\t\t\tANTHROPIC_MODEL: opts.model,\n\t\t\tCLAUDE_CODE_OAUTH_TOKEN: opts.token,\n\t\t},\n\t\t// Minimal trust-accepted entry keyed to the guest cwd so headless claude\n\t\t// skips the trust prompt. Deliberately NOT a copy of any host .claude.json.\n\t\tfiles: [\n\t\t\t{\n\t\t\t\tpath: `${GUEST_HOME}/.claude.json`,\n\t\t\t\tcontent: `${JSON.stringify(\n\t\t\t\t\t{ projects: { [opts.workdir]: { hasTrustDialogAccepted: true } } },\n\t\t\t\t\tnull,\n\t\t\t\t\t\"\\t\",\n\t\t\t\t)}\\n`,\n\t\t\t},\n\t\t],\n\t}\n}\n\ninterface StreamLine {\n\ttype?: string\n\tsubtype?: string\n\tmessage?: { content?: Array<{ type?: string; text?: string; name?: string }> }\n\tduration_ms?: number\n}\n\n// One human-readable label per stream-json stdout line; null for lines that\n// aren't claude's JSON (dropped from the progress stream).\nexport function describeClaudeStreamLine(line: string): string | null {\n\tlet obj: StreamLine\n\ttry {\n\t\tobj = JSON.parse(line) as StreamLine\n\t} catch {\n\t\treturn null\n\t}\n\tconst label = (obj.type ?? \"\") + (obj.subtype ? `:${obj.subtype}` : \"\")\n\t// A once-per-second heartbeat with no content — pure noise in the stream.\n\tif (label === \"system:thinking_tokens\") return null\n\tlet detail = \"\"\n\tif (obj.type === \"assistant\") {\n\t\tconst content = obj.message?.content ?? []\n\t\tconst tools = content\n\t\t\t.filter((b) => b.type === \"tool_use\" && b.name)\n\t\t\t.map((b) => b.name)\n\t\tconst chars = content.reduce((n, b) => n + (b.text?.length ?? 0), 0)\n\t\tdetail = tools.length ? ` ${tools.join(\",\")}` : ` ${chars} chars`\n\t} else if (obj.type === \"result\") {\n\t\tdetail = ` ${obj.subtype}, ${((obj.duration_ms ?? 0) / 1000).toFixed(1)}s`\n\t}\n\treturn `[${label}]${detail}`\n}\n","import { PROMPT_FILE } from \"./contract.ts\"\nimport type { AgentSpec } from \"./runner.ts\"\n\nconst GUEST_HOME = \"/root\"\n\n// Guest-only codex config — deliberately NOT a copy of any host config.toml\n// (which carries MCP API keys, personality, plugins, a trust table). Each key\n// is load-bearing:\n// - model rides here rather than as a `-m` flag so nothing operator-supplied\n// is ever interpolated into the guest's bash command string.\n// - approval_policy/sandbox_mode double the bypass flag on the command line;\n// either alone is a documented trust-prompt suppressor, some builds leak\n// with only one (openai/codex#14547).\n// - model_reasoning_effort: operator decision — plan billing is flat-rate,\n// so there is no haiku-style cost gradient to encode in a cheaper setting.\n// - web_search is a server-side tool (the guest never fetches pages itself);\n// \"live\" pins it rather than relying on the full-access auto-upgrade.\n// - project_doc_max_bytes = 0 disables all AGENTS.md loading: the piped\n// prompt is the agent's only input.\n// - features.plugins/apps = false stop codex's boot-time marketplace clone\n// and apps fetch (verified live): under restricted egress they hang, and\n// under any egress they inject tools (e.g. a git-push skill) the contract\n// never sanctioned.\nfunction guestConfig(model: string): string {\n\treturn `model = \"${model}\"\napproval_policy = \"never\"\nsandbox_mode = \"danger-full-access\"\nmodel_reasoning_effort = \"xhigh\"\nweb_search = \"live\"\nproject_doc_max_bytes = 0\ncli_auth_credentials_store = \"file\"\n\n[features]\nplugins = false\napps = false\n`\n}\n\n// The codex adapter: produce the AgentSpec that runs `codex exec` in the guest.\nexport function codexAgent(opts: {\n\t// Byte-for-byte content of the operator's ~/.codex/auth.json; staleness is\n\t// the caller's preflight (a guest-side token refresh would rotate the\n\t// single-use refresh token and poison the host session).\n\tauthJson: string\n\tmodel: string\n\tworkdir: string\n}): AgentSpec {\n\treturn {\n\t\t// Headless codex cannot answer approval prompts, and its own bwrap\n\t\t// sandbox needs user namespaces the guest may not grant — the microVM is\n\t\t// the safety boundary, so bypass both (OpenAI's documented container\n\t\t// guidance). --ephemeral writes no session rollout files;\n\t\t// --skip-git-repo-check because the scratch cwd is not a git repo.\n\t\tcommand:\n\t\t\t\"codex exec --json --skip-git-repo-check \" +\n\t\t\t\"--dangerously-bypass-approvals-and-sandbox --ephemeral \" +\n\t\t\t`- < ${PROMPT_FILE}`,\n\t\tenv: {\n\t\t\t// CODEX_HOME defaults to $HOME/.codex, where both staged files land.\n\t\t\tHOME: GUEST_HOME,\n\t\t\tGIT_OPTIONAL_LOCKS: \"0\",\n\t\t},\n\t\tfiles: [\n\t\t\t{ path: `${GUEST_HOME}/.codex/auth.json`, content: opts.authJson },\n\t\t\t{\n\t\t\t\tpath: `${GUEST_HOME}/.codex/config.toml`,\n\t\t\t\tcontent: guestConfig(opts.model),\n\t\t\t},\n\t\t],\n\t}\n}\n\n// The freshness window for a staged ChatGPT-auth auth.json. Codex refreshes\n// tokens when last_refresh is ~8 days old (or on a 401), refresh tokens are\n// single-use, and a refresh performed INSIDE a guest rotates the token family\n// — the host's copy then dies with \"refresh token was already used\" (forced\n// re-login). 7 days leaves a day of margin below codex's own threshold.\nexport const CODEX_AUTH_MAX_AGE_DAYS = 7\n\ninterface CodexAuth {\n\ttokens?: { refresh_token?: string }\n\tlast_refresh?: string\n\tOPENAI_API_KEY?: string\n}\n\n// Pure preflight: throw (with the operator's next action) unless this\n// auth.json is safe to stage into guests. An api-key-mode auth.json (no\n// tokens, an OPENAI_API_KEY field) carries no refresh semantics, so no\n// staleness guard applies.\nexport function validateCodexAuth(content: string, now: Date, where: string): void {\n\tlet auth: CodexAuth\n\ttry {\n\t\tauth = JSON.parse(content) as CodexAuth\n\t} catch {\n\t\tthrow new Error(`${where} is not valid JSON — run \\`codex login\\` on the host`)\n\t}\n\tif (auth.tokens?.refresh_token) {\n\t\tconst ageDays = (now.getTime() - Date.parse(auth.last_refresh ?? \"\")) / 86_400_000\n\t\tif (!(ageDays <= CODEX_AUTH_MAX_AGE_DAYS)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${where} tokens were last refreshed over ${CODEX_AUTH_MAX_AGE_DAYS} days ago (codex refreshes at ~8 days, and a refresh inside a guest would rotate the single-use refresh token and poison this host's session) — run any codex command on the host to refresh, then retry`,\n\t\t\t)\n\t\t}\n\t\treturn\n\t}\n\tif (auth.OPENAI_API_KEY) return\n\tthrow new Error(\n\t\t`${where} has neither ChatGPT tokens nor an API key — run \\`codex login\\` on the host`,\n\t)\n}\n\ninterface CodexStreamLine {\n\ttype?: string\n\titem?: {\n\t\ttype?: string\n\t\ttext?: string\n\t\tcommand?: string\n\t\tchanges?: Array<{ path?: string }>\n\t}\n\tusage?: { input_tokens?: number; output_tokens?: number }\n\terror?: { message?: string }\n\tmessage?: string\n}\n\nconst clip = (s: string, max = 60): string => (s.length > max ? `${s.slice(0, max)}…` : s)\n\n// One human-readable label per --json stdout line; null for lines that aren't\n// codex's JSON (dropped from the progress stream). Event taxonomy:\n// thread.started / turn.started / turn.completed / turn.failed /\n// item.{started,updated,completed} (item.type = agent_message,\n// command_execution, file_change, reasoning, web_search, todo_list,\n// mcp_tool_call, error) / error.\nexport function describeCodexStreamLine(line: string): string | null {\n\tlet obj: CodexStreamLine\n\ttry {\n\t\tobj = JSON.parse(line) as CodexStreamLine\n\t} catch {\n\t\treturn null\n\t}\n\tconst item = obj.item\n\tconst label = (obj.type ?? \"\") + (item?.type ? `:${item.type}` : \"\")\n\tlet detail = \"\"\n\tif (item?.type === \"agent_message\") {\n\t\tdetail = ` ${item.text?.length ?? 0} chars`\n\t} else if (item?.type === \"command_execution\" && item.command) {\n\t\tdetail = ` ${clip(item.command)}`\n\t} else if (item?.type === \"file_change\") {\n\t\tdetail = ` ${(item.changes ?? []).length} file(s)`\n\t} else if (obj.type === \"turn.completed\") {\n\t\tdetail = ` ${obj.usage?.input_tokens ?? 0} in, ${obj.usage?.output_tokens ?? 0} out tokens`\n\t} else if (obj.type === \"turn.failed\") {\n\t\tdetail = ` ${clip(obj.error?.message ?? \"\")}`\n\t} else if (obj.type === \"error\") {\n\t\tdetail = ` ${clip(obj.message ?? \"\")}`\n\t}\n\treturn `[${label}]${detail}`\n}\n","import { readFileSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport { join } from \"node:path\"\nimport { claudeAgent, describeClaudeStreamLine } from \"./claude.ts\"\nimport { codexAgent, describeCodexStreamLine, validateCodexAuth } from \"./codex.ts\"\nimport type { AgentSpec } from \"./runner.ts\"\n\n// The agent CLI: the brand of agent (claude, codex) the operator picks with\n// --agent, and everything the workflows need from it. Not to be confused with\n// the harness (doublecheck's own mechanics) or an agent (one running\n// inspector instance, described by an AgentSpec).\nexport interface AgentCli {\n\tname: string\n\t// Applied only when --model is absent.\n\tdefaultModel: { check: string; mine: string }\n\t// The phrase the report contract uses to tell this agent how to create a\n\t// file; null when the prompt should just say \"create <path>\".\n\twriteToolPhrase: string | null\n\t// Domain suffixes for restricted-egress workflows (mine): the CLI's own\n\t// API endpoints, so the only reachable destination is the service the\n\t// agent already sends its context to.\n\tegressDomains: string[]\n\t// Host-side preflight: the secret material staged into every guest, or an\n\t// actionable error. Runs once per invocation, before any guest boots.\n\tcredentials(): string\n\tagent(opts: { credentials: string; model: string; workdir: string }): AgentSpec\n\tdescribeStreamLine(line: string): string | null\n}\n\nconst claude: AgentCli = {\n\tname: \"claude\",\n\tdefaultModel: { check: \"haiku\", mine: \"opus\" },\n\twriteToolPhrase: \"with the Write tool\",\n\tegressDomains: [\"anthropic.com\"],\n\tcredentials: () => {\n\t\tconst token = process.env.CLAUDE_CODE_OAUTH_TOKEN\n\t\tif (!token) {\n\t\t\tthrow new Error(\n\t\t\t\t\"CLAUDE_CODE_OAUTH_TOKEN is required in the environment (it is injected into each agent's sandbox)\",\n\t\t\t)\n\t\t}\n\t\treturn token\n\t},\n\tagent: ({ credentials, model, workdir }) =>\n\t\tclaudeAgent({ token: credentials, model, workdir }),\n\tdescribeStreamLine: describeClaudeStreamLine,\n}\n\nconst codex: AgentCli = {\n\tname: \"codex\",\n\t// No haiku-style cheap default: plan billing is flat-rate, and the staged\n\t// guest config already pins xhigh reasoning effort (operator decision).\n\tdefaultModel: { check: \"gpt-5.5\", mine: \"gpt-5.5\" },\n\twriteToolPhrase: null,\n\t// ChatGPT-plan inference lives at chatgpt.com/backend-api/codex; the\n\t// openai.com suffix covers auth.openai.com, where a 401-forced token\n\t// refresh would have to go.\n\tegressDomains: [\"chatgpt.com\", \"openai.com\"],\n\tcredentials: () => {\n\t\tconst authPath = join(homedir(), \".codex\", \"auth.json\")\n\t\tlet content: string\n\t\ttry {\n\t\t\tcontent = readFileSync(authPath, \"utf-8\")\n\t\t} catch {\n\t\t\tthrow new Error(`no readable ${authPath} — run \\`codex login\\` on the host`)\n\t\t}\n\t\tvalidateCodexAuth(content, new Date(), authPath)\n\t\treturn content\n\t},\n\tagent: ({ credentials, model, workdir }) =>\n\t\tcodexAgent({ authJson: credentials, model, workdir }),\n\tdescribeStreamLine: describeCodexStreamLine,\n}\n\nconst AGENT_CLIS: Record<string, AgentCli> = { claude, codex }\n\nexport function resolveAgentCli(name: string): AgentCli {\n\tconst cli = AGENT_CLIS[name]\n\tif (!cli) {\n\t\tthrow new Error(\n\t\t\t`unknown agent \"${name}\" (have: ${Object.keys(AGENT_CLIS).join(\", \")})`,\n\t\t)\n\t}\n\treturn cli\n}\n\n// One resolved, preflighted agent selection, shared by every unit of a run.\nexport interface AgentRun {\n\tcli: AgentCli\n\tcredentials: string\n\tmodel: string\n}\n\n// Resolve --agent/--model into what a workflow's units consume: the CLI, its\n// preflighted credentials, and the model (explicit flag, else the CLI's\n// default for this workflow).\nexport function resolveAgentRun(\n\tname: string,\n\tmodel: string | undefined,\n\tworkflow: \"check\" | \"mine\",\n): AgentRun {\n\tconst cli = resolveAgentCli(name)\n\treturn {\n\t\tcli,\n\t\tcredentials: cli.credentials(),\n\t\tmodel: model ?? cli.defaultModel[workflow],\n\t}\n}\n\n// The per-unit progress sink both workflow shells hang on runAgent: guest\n// stderr passes through as `[label] ! line`, stdout is the agent CLI's JSON\n// stream, labelled by its describeStreamLine (non-JSON lines dropped).\nexport function progressSink(\n\tlabel: string,\n\tdescribe: (line: string) => string | null,\n): (kind: \"stdout\" | \"stderr\", line: string) => void {\n\treturn (kind, line) => {\n\t\tif (kind === \"stderr\") {\n\t\t\tprocess.stderr.write(`[${label}] ! ${line}\\n`)\n\t\t\treturn\n\t\t}\n\t\tconst described = describe(line)\n\t\tif (described) process.stderr.write(`[${label}] ${described}\\n`)\n\t}\n}\n","import { existsSync, readFileSync } from \"node:fs\"\nimport { basename, join } from \"node:path\"\nimport type { ExecEvent } from \"microsandbox\"\nimport { REPORT_FILE } from \"./contract.ts\"\n\n// microsandbox exports its fluent builders as value-only consts; recover their\n// instance types via a type-only import (erased at build) so the native module\n// only loads behind the `await import` in runAgent.\ntype MountBuilder = InstanceType<typeof import(\"microsandbox\").MountBuilder>\ntype PatchBuilder = InstanceType<typeof import(\"microsandbox\").PatchBuilder>\ntype ExecOptionsBuilder = InstanceType<typeof import(\"microsandbox\").ExecOptionsBuilder>\n// The SDK types `.network(cb)` as `(b: any) => any`, and we call the JS-shim\n// `.policy(...)`, absent from the native builder's types.\n// biome-ignore lint/suspicious/noExplicitAny: SDK types this builder callback as any\ntype NetworkBuilder = any\n\n// The guest image (Dockerfile.guest): node 24 slim + git/ripgrep/curl/wget +\n// both agent CLIs baked in. Released versions pull the multi-arch image the\n// release workflow pushed to ghcr (tag = the package's own version, so CLI\n// and image always match); a dev tree (version 0.0.0-development) uses the\n// locally built image side-loaded by ./scripts/build-guest-image.sh, which\n// exists nowhere else — hence pullPolicy \"never\": a cache miss means \"run the\n// build script\", not \"try a registry\".\nconst GUEST_IMAGE_REPO = \"ghcr.io/alizain/doublecheck-guest\"\nconst LOCAL_GUEST_IMAGE = \"doublecheck-guest:latest\"\nexport const DEV_VERSION = \"0.0.0-development\"\nconst GUEST_MEMORY_MIB = 2048\n\nexport interface GuestImage {\n\tref: string\n\tpullPolicy: \"never\" | \"if-missing\"\n}\n\n// Pure: which image this doublecheck runs its guests from. An override (the\n// DOUBLECHECK_GUEST_IMAGE env var) is operator-managed: it must already be in\n// the msb cache, so it is never pulled.\nexport function decideGuestImage(version: string, override?: string): GuestImage {\n\tif (override) return { ref: override, pullPolicy: \"never\" }\n\tif (version === DEV_VERSION) return { ref: LOCAL_GUEST_IMAGE, pullPolicy: \"never\" }\n\treturn { ref: `${GUEST_IMAGE_REPO}:${version}`, pullPolicy: \"if-missing\" }\n}\n\n// Read at runtime, not import time: the dist bundle is built BEFORE\n// semantic-release stamps the real version into the published package.json,\n// so baking the version in at build time would pin every install to\n// 0.0.0-development. Works from both src/ (tsx) and dist/ (bundle) — each\n// sits one level below the package root.\nfunction packageVersion(): string {\n\tconst pkg = JSON.parse(\n\t\treadFileSync(new URL(\"../package.json\", import.meta.url), \"utf-8\"),\n\t) as { version: string }\n\treturn pkg.version\n}\n\n// Staged into the guest before boot (e.g. claude's trust-accepted config).\nexport interface GuestFile {\n\tpath: string\n\tcontent: string\n}\n\n// What it takes to run one agent in a booted guest: a bash command executed in\n// the scratch cwd that must leave REPORT_FILE there, the env it needs, and\n// files staged into the guest. Plain data — adapters produce it, this runner\n// consumes it, tests fake it.\nexport interface AgentSpec {\n\tcommand: string\n\tenv: Record<string, string>\n\tfiles: GuestFile[]\n}\n\nexport type AgentOutcome =\n\t| { ok: true; report: string }\n\t| { ok: false; reason: string; partialReport: string | null }\n\n// Pure line buffering: fold a chunk into the carry, emit complete non-blank\n// lines, keep the unterminated tail.\nexport function feedLines(\n\tcarry: string,\n\tchunk: string,\n): { lines: string[]; carry: string } {\n\tconst parts = (carry + chunk).split(\"\\n\")\n\tconst rest = parts.pop() ?? \"\"\n\treturn { lines: parts.filter((l) => l.trim()), carry: rest }\n}\n\n// Pure outcome decision: what the exec left behind → what it means.\nexport function decideOutcome(\n\texitCode: number | null,\n\treport: string | null,\n\tworkdir: string,\n): AgentOutcome {\n\tif (exitCode !== 0) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: `agent process exited ${exitCode}`,\n\t\t\tpartialReport: report,\n\t\t}\n\t}\n\tif (report === null) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: `agent exited 0 but wrote no ${REPORT_FILE} (work dir: ${workdir})`,\n\t\t\tpartialReport: null,\n\t\t}\n\t}\n\treturn { ok: true, report }\n}\n\nexport interface RunAgentOpts {\n\t// Host dir the agent inspects, bind-mounted READ-ONLY at its real host\n\t// path: the target for `check`, the transcripts corpus for `mine`.\n\tmount: string\n\t// Scratch dir with PROMPT_FILE already inside; bind-mounted rw as the guest\n\t// cwd at its identical host path, so the agent's report lands back on the host.\n\tworkdir: string\n\tspec: AgentSpec\n\t// \"all\" for checks (inspectors may research); a domain-suffix allowlist for\n\t// miners: the personal corpus is mounted, so egress is pinned to the agent\n\t// CLI's own API domains — the only reachable destination is the service\n\t// the agent already sends its context to. NetworkPolicy.none() is not an\n\t// option here — it kills DNS entirely and the adapter can't reach its own\n\t// model API (measured: claude retries ~180s then exits 1).\n\tnetwork: \"all\" | { onlyDomains: string[] }\n\tonLine: (kind: \"stdout\" | \"stderr\", line: string) => void\n}\n\n// Boot a guest (ro mount + scratch rw as cwd), exec the agent command, stream\n// its output line-by-line, read the report back off the scratch dir, tear\n// down. Agent-level failures (exit ≠ 0, no report) return ok:false;\n// harness-level failures (image missing, boot error) throw.\nexport async function runAgent(opts: RunAgentOpts): Promise<AgentOutcome> {\n\tconst microsandbox = await import(\"microsandbox\")\n\tconst name = `doublecheck-${basename(opts.workdir)}`\n\tconst image = decideGuestImage(packageVersion(), process.env.DOUBLECHECK_GUEST_IMAGE)\n\tconst network = opts.network\n\tconst policy =\n\t\tnetwork === \"all\"\n\t\t\t? microsandbox.NetworkPolicy.allowAll()\n\t\t\t: microsandbox.NetworkPolicy.builder()\n\t\t\t\t\t.defaultDeny()\n\t\t\t\t\t.egress((rb) => {\n\t\t\t\t\t\tlet rules = rb\n\t\t\t\t\t\tfor (const domain of network.onlyDomains) {\n\t\t\t\t\t\t\trules = rules.allow((d) => d.domainSuffix(domain))\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn rules\n\t\t\t\t\t})\n\t\t\t\t\t.build()\n\tlet sandbox: InstanceType<typeof microsandbox.Sandbox> | null = null\n\ttry {\n\t\ttry {\n\t\t\tsandbox = await microsandbox.Sandbox.builder(name)\n\t\t\t\t.image(image.ref)\n\t\t\t\t.memory(GUEST_MEMORY_MIB)\n\t\t\t\t.pullPolicy(image.pullPolicy)\n\t\t\t\t.replace()\n\t\t\t\t.workdir(opts.workdir)\n\t\t\t\t.envs(opts.spec.env)\n\t\t\t\t.volume(opts.mount, (mb: MountBuilder) => mb.bind(opts.mount).readonly())\n\t\t\t\t.volume(opts.workdir, (mb: MountBuilder) => mb.bind(opts.workdir))\n\t\t\t\t.patch((pb: PatchBuilder) => {\n\t\t\t\t\tlet p = pb\n\t\t\t\t\tfor (const f of opts.spec.files) {\n\t\t\t\t\t\tp = p.text(f.path, f.content, { mode: 0o600, replace: true })\n\t\t\t\t\t}\n\t\t\t\t\treturn p\n\t\t\t\t})\n\t\t\t\t.network((nb: NetworkBuilder) => nb.policy(policy))\n\t\t\t\t.create()\n\t\t} catch (e) {\n\t\t\tif (image.pullPolicy === \"never\" && String(e).includes(\"not cached\")) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`guest image ${image.ref} is not in the microsandbox cache — run scripts/build-guest-image.sh (${String(e)})`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (image.pullPolicy === \"if-missing\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`guest ${image.ref} failed to boot — if this is a pull failure, check network access to ghcr.io and that the package is public; a locally built image can be forced with DOUBLECHECK_GUEST_IMAGE=doublecheck-guest:latest (${String(e)})`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\n\t\tconst handle = await sandbox.execStreamWith(\"bash\", (e: ExecOptionsBuilder) =>\n\t\t\te.args([\"-c\", opts.spec.command]),\n\t\t)\n\n\t\tconst carry: Record<\"stdout\" | \"stderr\", string> = { stdout: \"\", stderr: \"\" }\n\t\tlet exitCode: number | null = null\n\t\tfor (;;) {\n\t\t\tconst ev: ExecEvent | null = await handle.recv()\n\t\t\tif (ev === null) break\n\t\t\tif (ev.kind === \"stdout\" || ev.kind === \"stderr\") {\n\t\t\t\tconst fed = feedLines(carry[ev.kind], Buffer.from(ev.data).toString())\n\t\t\t\tcarry[ev.kind] = fed.carry\n\t\t\t\tfor (const line of fed.lines) opts.onLine(ev.kind, line)\n\t\t\t} else if (ev.kind === \"exited\") exitCode = ev.code\n\t\t}\n\t\tfor (const kind of [\"stdout\", \"stderr\"] as const) {\n\t\t\tif (carry[kind].trim()) opts.onLine(kind, carry[kind])\n\t\t}\n\n\t\tconst reportPath = join(opts.workdir, REPORT_FILE)\n\t\tconst report = existsSync(reportPath) ? readFileSync(reportPath, \"utf-8\") : null\n\t\treturn decideOutcome(exitCode, report, opts.workdir)\n\t} finally {\n\t\tif (sandbox) {\n\t\t\ttry {\n\t\t\t\tawait sandbox.stop()\n\t\t\t} catch (e) {\n\t\t\t\topts.onLine(\"stderr\", `sandbox stop failed: ${String(e)}`)\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait microsandbox.Sandbox.remove(name)\n\t\t\t} catch (e) {\n\t\t\t\topts.onLine(\"stderr\", `sandbox remove failed: ${String(e)}`)\n\t\t\t}\n\t\t}\n\t}\n}\n","import {\n\tappendFileSync,\n\tmkdirSync,\n\tmkdtempSync,\n\treaddirSync,\n\treadFileSync,\n\twriteFileSync,\n} from \"node:fs\"\nimport { tmpdir } from \"node:os\"\nimport { join } from \"node:path\"\nimport PQueue from \"p-queue\"\nimport { type AgentRun, progressSink, resolveAgentRun } from \"./agent-cli.ts\"\nimport { composePrompt, PROMPT_FILE, REPORT_FILE } from \"./contract.ts\"\nimport { runAgent } from \"./runner.ts\"\n\n// A check is a plain markdown file — no frontmatter, no schema. The body is\n// the inspector's instructions; the name is the filename minus .md. Checks\n// come from one or more --checks-dir directories (default:\n// $TARGET/.agents/checks).\nexport interface Check {\n\tname: string\n\tbody: string\n}\n\n// Pure selection: `only` (from repeated --check flags) filters, in the order\n// named; naming a check that doesn't exist is an error, not an empty run.\nexport function selectChecks(all: Check[], only: string[], where: string): Check[] {\n\tif (all.length === 0) throw new Error(`no checks (*.md) in ${where}`)\n\tif (only.length === 0) return all\n\tconst byName = new Map(all.map((c) => [c.name, c]))\n\treturn only.map((name) => {\n\t\tconst check = byName.get(name)\n\t\tif (!check) {\n\t\t\tconst have = all.map((c) => c.name).join(\", \")\n\t\t\tthrow new Error(`no check named \"${name}\" in ${where} (have: ${have})`)\n\t\t}\n\t\treturn check\n\t})\n}\n\n// Shell: read every check file from every checks dir, then select purely.\n// A missing dir is an error; the same check name in two dirs is an error —\n// no precedence rules, rename one.\nexport function discoverChecks(dirs: string[], only: string[]): Check[] {\n\tconst all: Array<Check & { dir: string }> = []\n\tfor (const dir of dirs) {\n\t\tlet entries: string[]\n\t\ttry {\n\t\t\tentries = readdirSync(dir)\n\t\t} catch {\n\t\t\tthrow new Error(`no checks directory at ${dir}`)\n\t\t}\n\t\tfor (const f of entries.filter((e) => e.endsWith(\".md\")).sort()) {\n\t\t\tconst name = f.slice(0, -\".md\".length)\n\t\t\tconst clash = all.find((c) => c.name === name)\n\t\t\tif (clash) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`check \"${name}\" exists in both ${clash.dir} and ${dir} — rename one`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tall.push({ name, body: readFileSync(join(dir, f), \"utf-8\"), dir })\n\t\t}\n\t}\n\tconst checks = all\n\t\t.map(({ name, body }) => ({ name, body }))\n\t\t.sort((a, b) => a.name.localeCompare(b.name))\n\treturn selectChecks(checks, only, dirs.join(\", \"))\n}\n\nexport interface CheckWorkflowOpts {\n\ttarget: string\n\tchecksDirs: string[]\n\tcontextFile: string | null\n\tagent: string\n\t// Absent = the agent CLI's default for checks.\n\tmodel?: string\n\tparallel: number\n\toutput: string\n\tonly: string[]\n\tsaveJsonl: boolean\n}\n\n// fs-safe local timestamp, one dir per run shared by all its checks:\n// 2026-07-05-143000\nexport function runTimestamp(d: Date): string {\n\tconst p = (n: number) => String(n).padStart(2, \"0\")\n\treturn `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`\n}\n\n// The report written when the agent failed: the failure is the report, plus\n// whatever partial report the agent managed to leave.\nexport function failureReport(reason: string, partialReport: string | null): string {\n\tconst partial = partialReport\n\t\t? `\\n---\\n\\nPartial ${REPORT_FILE} left by the agent:\\n\\n${partialReport}`\n\t\t: \"\"\n\treturn `# CHECK FAILED\\n\\n${reason}\\n${partial}`\n}\n\nasync function runOneCheck(\n\tcheck: Check,\n\topts: CheckWorkflowOpts,\n\trun: AgentRun,\n\trunContext: string | null,\n\toutDir: string,\n): Promise<boolean> {\n\tconst workdir = mkdtempSync(join(tmpdir(), `doublecheck-${check.name}-`))\n\twriteFileSync(\n\t\tjoin(workdir, PROMPT_FILE),\n\t\tcomposePrompt({\n\t\t\tcheckBody: check.body,\n\t\t\ttarget: opts.target,\n\t\t\tworkdir,\n\t\t\trunContext,\n\t\t\twriteTool: run.cli.writeToolPhrase,\n\t\t}),\n\t)\n\tconst spec = run.cli.agent({\n\t\tcredentials: run.credentials,\n\t\tmodel: run.model,\n\t\tworkdir,\n\t})\n\t// The report is the verdict; with --save-jsonl the raw stream is kept\n\t// beside it so a run can be audited after the ephemeral guest is gone\n\t// (which files the inspector read, what it skipped, whether report claims\n\t// trace to actual observations).\n\tconst sink = progressSink(check.name, run.cli.describeStreamLine)\n\tlet onLine = sink\n\tif (opts.saveJsonl) {\n\t\tconst streamPath = join(outDir, `${check.name}.stream.jsonl`)\n\t\tonLine = (kind, line) => {\n\t\t\tif (kind === \"stdout\") appendFileSync(streamPath, `${line}\\n`)\n\t\t\tsink(kind, line)\n\t\t}\n\t}\n\tconst outcome = await runAgent({\n\t\tmount: opts.target,\n\t\tworkdir,\n\t\tspec,\n\t\tnetwork: \"all\",\n\t\tonLine,\n\t})\n\tconst reportPath = join(outDir, `${check.name}.md`)\n\tif (outcome.ok) {\n\t\twriteFileSync(reportPath, outcome.report)\n\t\tprocess.stderr.write(`[${check.name}] report: ${reportPath}\\n`)\n\t\treturn true\n\t}\n\twriteFileSync(reportPath, failureReport(outcome.reason, outcome.partialReport))\n\tprocess.stderr.write(`[${check.name}] FAILED (${outcome.reason}): ${reportPath}\\n`)\n\treturn false\n}\n\n// The check workflow: one sandboxed agent per check, at most `parallel`\n// guests at once. Returns true only when every check produced a report; agent\n// failures still write a failure-record report and flip the run to false.\nexport async function runChecks(opts: CheckWorkflowOpts): Promise<boolean> {\n\tconst run = resolveAgentRun(opts.agent, opts.model, \"check\")\n\tconst checks = discoverChecks(opts.checksDirs, opts.only)\n\tlet runContext: string | null = null\n\tif (opts.contextFile) {\n\t\ttry {\n\t\t\trunContext = readFileSync(opts.contextFile, \"utf-8\")\n\t\t} catch (e) {\n\t\t\tthrow new Error(\n\t\t\t\t`--context file not readable: ${opts.contextFile} (${String(e)})`,\n\t\t\t)\n\t\t}\n\t}\n\tconst outDir = join(opts.output, runTimestamp(new Date()))\n\tmkdirSync(outDir, { recursive: true })\n\tprocess.stderr.write(\n\t\t`${checks.length} check(s) against ${opts.target} (agent ${run.cli.name}, model ${run.model}, parallel ${opts.parallel})\\n`,\n\t)\n\tconst queue = new PQueue({ concurrency: opts.parallel })\n\tconst results = await Promise.all(\n\t\tchecks.map((check) =>\n\t\t\tqueue.add(() => runOneCheck(check, opts, run, runContext, outDir)),\n\t\t),\n\t)\n\treturn results.every((ok) => ok === true)\n}\n","// Claude Code transcript (.jsonl) → the genuine human turns → a flat digest.\n// Port of the June-2026 jq extraction, verified against the same corpus: a\n// \"genuine human turn\" is type:user, not meta, not sidechain, text content\n// only — which excludes the three things that are also type:user in the JSONL\n// (tool_results, slash-command stdout wrappers, injected system-reminders).\n\n// Per-turn char cap in the digest; the mining agent greps the source jsonl\n// for full text when it needs context around a turn.\nconst TURN_CHAR_CAP = 2000\n\ninterface RawLine {\n\ttype?: string\n\tisMeta?: boolean\n\tisSidechain?: boolean\n\tmessage?: { content?: unknown }\n}\n\nconst NON_HUMAN_TEXT =\n\t/^\\s*<command-name>|<local-command-stdout>|^\\s*<local-command|^\\s*<system-reminder>|Caveat: The messages below/\n\n// Throws on an unparseable line — the caller decides what an unreadable\n// transcript means for its run (mine counts and reports them, visibly).\nexport function humanTurns(jsonl: string): string[] {\n\tconst turns: string[] = []\n\tfor (const line of jsonl.split(\"\\n\")) {\n\t\tif (!line.trim()) continue\n\t\tconst raw = JSON.parse(line) as RawLine\n\t\tif (raw.type !== \"user\" || raw.isMeta || raw.isSidechain) continue\n\t\tconst content = raw.message?.content\n\t\tconst text =\n\t\t\ttypeof content === \"string\"\n\t\t\t\t? content\n\t\t\t\t: Array.isArray(content)\n\t\t\t\t\t? content\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t(item): item is { type: \"text\"; text: string } =>\n\t\t\t\t\t\t\t\t\ttypeof item === \"object\" &&\n\t\t\t\t\t\t\t\t\titem !== null &&\n\t\t\t\t\t\t\t\t\t(item as { type?: string }).type === \"text\" &&\n\t\t\t\t\t\t\t\t\ttypeof (item as { text?: unknown }).text === \"string\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map((item) => item.text)\n\t\t\t\t\t\t\t.join(\"\\n\")\n\t\t\t\t\t: \"\"\n\t\tif (!text) continue\n\t\tif (NON_HUMAN_TEXT.test(text)) continue\n\t\tturns.push(text.replace(/[\\n\\r]+/g, \" ⏎ \").slice(0, TURN_CHAR_CAP))\n\t}\n\treturn turns\n}\n\nexport interface DigestMeta {\n\tsource: string\n\tproject: string\n\tsession: string\n}\n\nexport function renderDigest(meta: DigestMeta, turns: string[]): string {\n\tconst numbered = turns\n\t\t.map((t, i) => `${String(i + 1).padStart(3, \" \")} | ${t}`)\n\t\t.join(\"\\n\")\n\treturn `# source: ${meta.source}\n# project: ${meta.project}\n# session: ${meta.session}\n# human_turns: ${turns.length}\n# To understand WHY a terse turn or interruption happened, grep its text in the\n# source file above and read the assistant turn(s) immediately before it.\n\n${numbered}\n`\n}\n","import { createHash } from \"node:crypto\"\nimport { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\"\nimport { basename, join } from \"node:path\"\nimport { humanTurns, renderDigest } from \"./transcript.ts\"\n\n// One minable unit = one top-level transcript $PROJECTS/<project>/<session>.jsonl.\n// Its catalog home mirrors that path: $CATALOG/<project>/<session>/observations.md.\nexport interface Unit {\n\tproject: string\n\tsession: string\n\tjsonlPath: string\n}\n\nexport function enumerateUnits(projectsDir: string): Unit[] {\n\tlet projects: string[]\n\ttry {\n\t\tprojects = readdirSync(projectsDir).sort()\n\t} catch {\n\t\tthrow new Error(`no transcripts directory at ${projectsDir}`)\n\t}\n\tconst units: Unit[] = []\n\tfor (const project of projects) {\n\t\tconst dir = join(projectsDir, project)\n\t\tif (!statSync(dir).isDirectory()) continue\n\t\tfor (const f of readdirSync(dir).sort()) {\n\t\t\tif (!f.endsWith(\".jsonl\")) continue\n\t\t\tunits.push({\n\t\t\t\tproject,\n\t\t\t\tsession: basename(f, \".jsonl\"),\n\t\t\t\tjsonlPath: join(dir, f),\n\t\t\t})\n\t\t}\n\t}\n\treturn units\n}\n\nexport function observationsPath(catalogDir: string, unit: Unit): string {\n\treturn join(catalogDir, unit.project, unit.session, \"observations.md\")\n}\n\nexport type UnitStatus =\n\t// hash matches the recorded source_sha256 — skipped without parsing\n\t| { kind: \"mined\" }\n\t| { kind: \"below-threshold\"; turns: number }\n\t| {\n\t\t\tkind: \"pending\"\n\t\t\treason: \"new\" | \"changed\"\n\t\t\tturns: number\n\t\t\tdigest: string\n\t\t\tsourceSha256: string\n\t }\n\t// transcript has an unparseable line; reported visibly, never mined\n\t| { kind: \"unreadable\"; error: string }\n\n// Pure decision core: everything already read, nothing left but judgment.\nexport function decideUnitStatus(input: {\n\tunit: Unit\n\tjsonl: Buffer\n\trecordedSha256: string | null\n\tminTurns: number\n}): UnitStatus {\n\tconst sourceSha256 = createHash(\"sha256\").update(input.jsonl).digest(\"hex\")\n\tif (input.recordedSha256 === sourceSha256) return { kind: \"mined\" }\n\tlet turns: string[]\n\ttry {\n\t\tturns = humanTurns(input.jsonl.toString(\"utf-8\"))\n\t} catch (e) {\n\t\treturn { kind: \"unreadable\", error: String(e) }\n\t}\n\tif (turns.length < input.minTurns)\n\t\treturn { kind: \"below-threshold\", turns: turns.length }\n\treturn {\n\t\tkind: \"pending\",\n\t\treason: input.recordedSha256 === null ? \"new\" : \"changed\",\n\t\tturns: turns.length,\n\t\tdigest: renderDigest(\n\t\t\t{\n\t\t\t\tsource: input.unit.jsonlPath,\n\t\t\t\tproject: input.unit.project,\n\t\t\t\tsession: input.unit.session,\n\t\t\t},\n\t\t\tturns,\n\t\t),\n\t\tsourceSha256,\n\t}\n}\n\n// Shell: read the unit's inputs, then decide purely.\nexport function unitStatus(unit: Unit, catalogDir: string, minTurns: number): UnitStatus {\n\tconst obsPath = observationsPath(catalogDir, unit)\n\treturn decideUnitStatus({\n\t\tunit,\n\t\tjsonl: readFileSync(unit.jsonlPath),\n\t\trecordedSha256: existsSync(obsPath)\n\t\t\t? readSourceSha256(readFileSync(obsPath, \"utf-8\"))\n\t\t\t: null,\n\t\tminTurns,\n\t})\n}\n\nexport interface ObservationsMeta {\n\tsource: string\n\tsourceSha256: string\n\tminedAt: string\n\tmodel: string\n\thumanTurns: number\n}\n\n// The host composes the final file: frontmatter it alone can vouch for, then\n// the agent's report verbatim.\nexport function composeObservationsFile(meta: ObservationsMeta, body: string): string {\n\treturn `---\nsource: ${meta.source}\nsource_sha256: ${meta.sourceSha256}\nmined_at: ${meta.minedAt}\nmodel: ${meta.model}\nhuman_turns: ${meta.humanTurns}\n---\n\n${body.trimEnd()}\n`\n}\n\nexport function readSourceSha256(observationsMd: string): string | null {\n\treturn observationsMd.match(/^source_sha256: ([0-9a-f]{64})$/m)?.[1] ?? null\n}\n","import { mkdirSync, mkdtempSync, writeFileSync } from \"node:fs\"\nimport { tmpdir } from \"node:os\"\nimport { dirname, join } from \"node:path\"\nimport PQueue from \"p-queue\"\nimport {\n\ttype AgentRun,\n\tprogressSink,\n\tresolveAgentCli,\n\tresolveAgentRun,\n} from \"./agent-cli.ts\"\nimport {\n\tcomposeObservationsFile,\n\tenumerateUnits,\n\tobservationsPath,\n\ttype Unit,\n\ttype UnitStatus,\n\tunitStatus,\n} from \"./catalog.ts\"\nimport { composeMinePrompt, PROMPT_FILE } from \"./contract.ts\"\nimport { runAgent } from \"./runner.ts\"\n\nexport interface MineOpts {\n\tprojects: string\n\tcatalog: string\n\tagent: string\n\t// Absent = the agent CLI's default for mining.\n\tmodel?: string\n\tparallel: number\n\tminTurns: number\n\tlimit?: number\n\tdryRun: boolean\n}\n\nexport interface Pending {\n\tunit: Unit\n\tstatus: Extract<UnitStatus, { kind: \"pending\" }>\n}\n\n// What one mine invocation will and won't do, decided purely from the\n// per-unit statuses.\nexport interface MinePlan {\n\ttodo: Pending[]\n\tpendingTotal: number\n\tmined: number\n\tbelowThreshold: number\n\tunreadable: { unit: Unit; error: string }[]\n}\n\nexport function planMine(\n\tentries: { unit: Unit; status: UnitStatus }[],\n\tlimit?: number,\n): MinePlan {\n\tconst pending = entries.filter((e): e is Pending => e.status.kind === \"pending\")\n\treturn {\n\t\ttodo: limit ? pending.slice(0, limit) : pending,\n\t\tpendingTotal: pending.length,\n\t\tmined: entries.filter((e) => e.status.kind === \"mined\").length,\n\t\tbelowThreshold: entries.filter((e) => e.status.kind === \"below-threshold\").length,\n\t\tunreadable: entries.flatMap((e) =>\n\t\t\te.status.kind === \"unreadable\"\n\t\t\t\t? [{ unit: e.unit, error: e.status.error }]\n\t\t\t\t: [],\n\t\t),\n\t}\n}\n\nexport function summarizeMinePlan(plan: MinePlan, minTurns: number): string {\n\tconst total =\n\t\tplan.pendingTotal + plan.mined + plan.belowThreshold + plan.unreadable.length\n\tconst limited =\n\t\tplan.todo.length !== plan.pendingTotal ? ` (mining ${plan.todo.length})` : \"\"\n\treturn `${total} transcripts: ${plan.pendingTotal} pending${limited}, ${plan.mined} mined, ${plan.belowThreshold} below ${minTurns} turns, ${plan.unreadable.length} unreadable`\n}\n\nexport function dryRunRow({ unit, status }: Pending): string {\n\treturn `${status.reason.padEnd(7)} ${status.turns.toString().padStart(4)} turns ${unit.project}/${unit.session}`\n}\n\nasync function mineOneUnit(\n\t{ unit, status }: Pending,\n\topts: MineOpts,\n\trun: AgentRun,\n): Promise<boolean> {\n\tconst tag = unit.session.slice(0, 8)\n\tconst workdir = mkdtempSync(join(tmpdir(), `doublecheck-mine-${tag}-`))\n\twriteFileSync(\n\t\tjoin(workdir, PROMPT_FILE),\n\t\tcomposeMinePrompt(status.digest, workdir, run.cli.writeToolPhrase),\n\t)\n\tconst spec = run.cli.agent({\n\t\tcredentials: run.credentials,\n\t\tmodel: run.model,\n\t\tworkdir,\n\t})\n\tprocess.stderr.write(\n\t\t`[${tag}] mining ${unit.project}/${unit.session} (${status.turns} turns, ${status.reason})\\n`,\n\t)\n\tconst outcome = await runAgent({\n\t\tmount: opts.projects,\n\t\tworkdir,\n\t\tspec,\n\t\tnetwork: { onlyDomains: run.cli.egressDomains },\n\t\tonLine: progressSink(tag, run.cli.describeStreamLine),\n\t})\n\t// A failed mine writes NOTHING — the catalog is a durable asset; the next\n\t// run retries this unit because no hash gets recorded.\n\tif (!outcome.ok) {\n\t\tprocess.stderr.write(`[${tag}] FAILED (${outcome.reason})\\n`)\n\t\treturn false\n\t}\n\tconst obsPath = observationsPath(opts.catalog, unit)\n\tmkdirSync(dirname(obsPath), { recursive: true })\n\twriteFileSync(\n\t\tobsPath,\n\t\tcomposeObservationsFile(\n\t\t\t{\n\t\t\t\tsource: unit.jsonlPath,\n\t\t\t\tsourceSha256: status.sourceSha256,\n\t\t\t\tminedAt: new Date().toISOString(),\n\t\t\t\tmodel: run.model,\n\t\t\t\thumanTurns: status.turns,\n\t\t\t},\n\t\t\toutcome.report,\n\t\t),\n\t)\n\tprocess.stderr.write(`[${tag}] observations: ${obsPath}\\n`)\n\treturn true\n}\n\n// The mine workflow shell: gather statuses (I/O), plan purely, then either\n// print the plan (dry-run) or run one sandboxed agent per pending unit.\n// Returns true when nothing it attempted failed.\nexport async function runMine(opts: MineOpts): Promise<boolean> {\n\t// Validate the agent name before the dry-run/nothing-pending short-circuits\n\t// so a bad --agent errors on every invocation; the credentials preflight\n\t// stays below them (a dry run must not require credentials).\n\tresolveAgentCli(opts.agent)\n\tconst entries = enumerateUnits(opts.projects).map((unit) => ({\n\t\tunit,\n\t\tstatus: unitStatus(unit, opts.catalog, opts.minTurns),\n\t}))\n\tconst plan = planMine(entries, opts.limit)\n\tfor (const { unit, error } of plan.unreadable) {\n\t\tprocess.stderr.write(`UNREADABLE ${unit.project}/${unit.session}: ${error}\\n`)\n\t}\n\tprocess.stderr.write(`${summarizeMinePlan(plan, opts.minTurns)}\\n`)\n\n\tif (opts.dryRun) {\n\t\tfor (const pending of plan.todo) console.log(dryRunRow(pending))\n\t\treturn true\n\t}\n\tif (plan.todo.length === 0) return true\n\n\tconst run = resolveAgentRun(opts.agent, opts.model, \"mine\")\n\tconst queue = new PQueue({ concurrency: opts.parallel })\n\tconst results = await Promise.all(\n\t\tplan.todo.map((p) => queue.add(() => mineOneUnit(p, opts, run))),\n\t)\n\tconst failed = results.filter((ok) => ok !== true).length\n\tprocess.stderr.write(\n\t\t`mined ${results.length - failed}/${results.length}${failed ? `, ${failed} FAILED` : \"\"}\\n`,\n\t)\n\treturn failed === 0\n}\n","#!/usr/bin/env node\nimport { homedir } from \"node:os\"\nimport { join, resolve } from \"node:path\"\nimport { Command } from \"commander\"\nimport { runChecks } from \"./check.ts\"\nimport { runMine } from \"./mine.ts\"\n\nfunction parsePositiveInt(flag: string) {\n\treturn (v: string): number => {\n\t\tconst n = Number.parseInt(v, 10)\n\t\tif (!Number.isInteger(n) || n < 1)\n\t\t\tthrow new Error(`${flag} must be a positive integer, got \"${v}\"`)\n\t\treturn n\n\t}\n}\n\nconst collect = (v: string, prev: string[]): string[] => [...prev, v]\n\nconst program = new Command()\n\t.name(\"doublecheck\")\n\t.description(\n\t\t\"Run self-authored LLM code-inspectors (checks) against a target tree, one sandboxed agent per check\",\n\t)\n\nprogram\n\t.command(\"check\")\n\t.option(\"--target <dir>\", \"tree under inspection, mounted read-only\", process.cwd())\n\t.option(\n\t\t\"--checks-dir <dir>\",\n\t\t\"checks directory (repeatable; default: $TARGET/.agents/checks)\",\n\t\tcollect,\n\t\t[] as string[],\n\t)\n\t.option(\n\t\t\"--context <file>\",\n\t\t\"run-context file spliced into every inspector's prompt (intent, nuances, sanctioned exceptions, scope)\",\n\t)\n\t.option(\n\t\t\"--agent <name>\",\n\t\t\"agent CLI that runs the inspectors: claude or codex\",\n\t\t\"claude\",\n\t)\n\t.option(\n\t\t\"--model <model>\",\n\t\t\"model for the inspector agents (default per agent: claude haiku, codex gpt-5.5)\",\n\t)\n\t.option(\"--parallel <n>\", \"max concurrent checks\", parsePositiveInt(\"--parallel\"), 4)\n\t.option(\"--output <dir>\", \"reports root (default: $TARGET/.doublecheck)\")\n\t.option(\"--check <name>\", \"run only this check (repeatable)\", collect, [] as string[])\n\t.option(\n\t\t\"--save-jsonl\",\n\t\t\"persist each inspector's raw stream-json beside its report (audit trail)\",\n\t)\n\t.action(async (opts) => {\n\t\tconst target = resolve(opts.target)\n\t\tconst checksDirs: string[] =\n\t\t\topts.checksDir.length > 0\n\t\t\t\t? opts.checksDir.map((d: string) => resolve(d))\n\t\t\t\t: [join(target, \".agents\", \"checks\")]\n\t\tconst ok = await runChecks({\n\t\t\ttarget,\n\t\t\tchecksDirs,\n\t\t\tcontextFile: opts.context ? resolve(opts.context) : null,\n\t\t\tagent: opts.agent,\n\t\t\tmodel: opts.model,\n\t\t\tparallel: opts.parallel,\n\t\t\toutput: opts.output ? resolve(opts.output) : join(target, \".doublecheck\"),\n\t\t\tonly: opts.check,\n\t\t\tsaveJsonl: !!opts.saveJsonl,\n\t\t})\n\t\tif (!ok) process.exitCode = 1\n\t})\n\nprogram\n\t.command(\"mine\")\n\t.option(\n\t\t\"--projects <dir>\",\n\t\t\"Claude Code transcripts root\",\n\t\tjoin(homedir(), \".claude\", \"projects\"),\n\t)\n\t.option(\n\t\t\"--catalog <dir>\",\n\t\t\"observation catalog root\",\n\t\tjoin(homedir(), \".doublecheck\", \"catalog\"),\n\t)\n\t.option(\"--agent <name>\", \"agent CLI that runs the miners: claude or codex\", \"claude\")\n\t.option(\n\t\t\"--model <model>\",\n\t\t\"model for the mining agents (default per agent: claude opus, codex gpt-5.5 — a bad-model mine pollutes a durable asset)\",\n\t)\n\t.option(\"--parallel <n>\", \"max concurrent miners\", parsePositiveInt(\"--parallel\"), 4)\n\t.option(\n\t\t\"--min-turns <n>\",\n\t\t\"min genuine human turns for a real conversation\",\n\t\tparsePositiveInt(\"--min-turns\"),\n\t\t2,\n\t)\n\t.option(\"--limit <n>\", \"mine at most N pending units\", parsePositiveInt(\"--limit\"))\n\t.option(\"--dry-run\", \"list what would be mined without booting anything\")\n\t.action(async (opts) => {\n\t\tconst ok = await runMine({\n\t\t\tprojects: resolve(opts.projects),\n\t\t\tcatalog: resolve(opts.catalog),\n\t\t\tagent: opts.agent,\n\t\t\tmodel: opts.model,\n\t\t\tparallel: opts.parallel,\n\t\t\tminTurns: opts.minTurns,\n\t\t\tlimit: opts.limit,\n\t\t\tdryRun: !!opts.dryRun,\n\t\t})\n\t\tif (!ok) process.exitCode = 1\n\t})\n\nprogram.parseAsync().catch((e: unknown) => {\n\tconsole.error(e instanceof Error ? e.message : String(e))\n\tprocess.exit(1)\n})\n"],"mappings":";;;;;;;;;AAQA,MAAa,cAAc;AAG3B,MAAa,cAAc;AAU3B,SAAS,eACR,UACA,aACA,SACA,WACS;CACT,MAAM,OAAO,YAAY,IAAI,cAAc;CAC3C,OAAO;;6EAEqE,QAAQ,GAAG,YAAY,iKAAiK,YAAY;;eAElQ,QAAQ,GAAG,YAAY,IAAI,KAAK,oBAAoB,SAAS,uGAAuG,YAAY;AAC/L;AAEA,SAAS,gBAAgB,SAAiB,WAAkC;CAC3E,MAAM,OAAO,YAAY,IAAI,cAAc;CAC3C,OAAO,qDAAqD,QAAQ,GAAG,YAAY,IAAI,KAAK;AAC7F;AAMA,SAAgB,cAAc,MAMnB;CACV,MAAM,iBAAiB,KAAK,aACzB;;;;EAIF,KAAK,WAAW;;;;IAKd;CACH,OAAO;;;;wDAIgD,KAAK,OAAO;;s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ACD,CAAC,CACA,OAAO,eAAe,gCAAgC,iBAAiB,SAAS,CAAC,CAAC,CAClF,OAAO,aAAa,mDAAmD,CAAC,CACxE,OAAO,OAAO,SAAS;CAWvB,IAAI,CAAC,MAVY,QAAQ;EACxB,UAAU,QAAQ,KAAK,QAAQ;EAC/B,SAAS,QAAQ,KAAK,OAAO;EAC7B,OAAO,KAAK;EACZ,OAAO,KAAK;EACZ,UAAU,KAAK;EACf,UAAU,KAAK;EACf,OAAO,KAAK;EACZ,QAAQ,CAAC,CAAC,KAAK;CAChB,CAAC,GACQ,QAAQ,WAAW;AAC7B,CAAC;AAEF,QAAQ,WAAW,CAAC,CAAC,OAAO,MAAe;CAC1C,QAAQ,MAAM,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;CACxD,QAAQ,KAAK,CAAC;AACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["GUEST_HOME"],"sources":["../src/contract.ts","../src/claude.ts","../src/codex.ts","../src/agent-cli.ts","../src/runner.ts","../src/check.ts","../src/transcript.ts","../src/catalog.ts","../src/mine.ts","../src/cli.ts"],"sourcesContent":["// The agent contract: what the harness stages for the agent and what the\n// agent must leave behind. Any adapter (claude, codex) runs under this same\n// contract, which is what keeps the harness CLI-agnostic. The one per-agent\n// piece is `writeTool`: the phrase naming how THIS agent creates a file\n// (claude has a literal Write tool; codex is just told to create the file —\n// naming a tool it doesn't have would invite it to distrust its brief).\n\n// Staged into the scratch workdir before boot; the rw bind mount delivers it.\nexport const PROMPT_FILE = \"prompt.txt\"\n// The agent writes its findings here (relative to its cwd); the host reads it\n// back after exit. Missing report = failure.\nexport const REPORT_FILE = \"report.md\"\n\n// Weak models reliably skip a report contract stated once at the prompt's\n// tail unless it leads with the stakes and orders the file created first\n// (measured: haiku went from ~50% to 3/3 with this wording). Two hard-won\n// additions (2026-07-05, all three cutover inspectors lost their reports):\n// the path is ABSOLUTE — agents cd into the inspected tree to run git, and a\n// relative ./report.md then lands in the read-only mount — and the\n// create-first order is repeated near the top of the prompt (see\n// firstActionLine), because on long prompts the tail alone loses its grip.\nfunction reportContract(\n\tactivity: string,\n\tdeliverable: string,\n\tworkdir: string,\n\twriteTool: string | null,\n): string {\n\tconst tool = writeTool ? ` ${writeTool}` : \"\"\n\treturn `## Report — the only output that counts\n\nYour final chat reply is discarded. The only thing read back is the file \\`${workdir}/${REPORT_FILE}\\` — if it does not exist when you exit, this run FAILS. Always use that absolute path: if you \\`cd\\` elsewhere (into the inspected tree, say), a relative \\`./${REPORT_FILE}\\` lands in the wrong place, or in a read-only mount where the write fails.\n\nSo: create \\`${workdir}/${REPORT_FILE}\\`${tool} BEFORE you start ${activity} (a title line is enough), and update it as you work. The final state of the file when you finish is ${deliverable}.`\n}\n\nfunction firstActionLine(workdir: string, writeTool: string | null): string {\n\tconst tool = writeTool ? ` ${writeTool}` : \"\"\n\treturn `Your FIRST action, before anything else: create \\`${workdir}/${REPORT_FILE}\\`${tool} (a title line is enough). The full report contract is at the end of this prompt.`\n}\n\n// Environment preamble + optional run context + check body + report\n// contract. Checks are timeless standards; everything run-specific (intent,\n// sanctioned exceptions, scope) arrives in the operator's run context — the\n// harness knows nothing about git.\nexport function composePrompt(opts: {\n\tcheckBody: string\n\ttarget: string\n\tworkdir: string\n\trunContext: string | null\n\twriteTool: string | null\n}): string {\n\tconst contextSection = opts.runContext\n\t\t? `## Run context (from the operator)\n\nThe operator's brief for this run: the intent behind the work under review, known nuances, sanctioned exceptions, and possibly a Scope naming exactly what is under review. Judge requestedness against it — what the brief explicitly sanctions is not a finding. If it names a Scope, the Scope defines the change under review: findings must concern that change, and the rest of the tree is reference for judgment — with one exception. For concepts the scoped change retires or renames, surviving references anywhere in the tree are reportable findings: the Scope bounds what counts as the change, not where survivors may hide.\n\n${opts.runContext}\n\n---\n\n`\n\t\t: \"\"\n\treturn `## Environment\n\nYou are a code inspector running inside a sandboxed microVM with full permissions and unrestricted internet access.\n\n- The code under inspection is mounted read-only at \\`${opts.target}\\`. You cannot modify it — inspect, don't fix.\n- \\`git\\` and \\`rg\\` are installed.\n- Your current working directory is a writable scratch workspace: \\`${opts.workdir}\\`.\n\n${firstActionLine(opts.workdir, opts.writeTool)}\n\n## Inspection discipline\n\nMeasured on real runs: inspectors that skip these rules produce reports whose verdicts are right but whose evidence is partly fabricated — which is worse than no report.\n\n- Before inspecting, enumerate what is under review (the Run context's Scope list if one is given; otherwise your own enumeration of the target) and keep a ledger as you work: **examined** (content actually opened), **name-only**, **not examined**. End your report with that ledger, with a one-line reason for anything not examined.\n- Use verification verbs — \"verified\", \"confirmed\", \"checked\", \"read\", \"diffed\", \"grepped\", \"spot-checked\" — ONLY for actions you actually performed in this session on content you actually opened. Everything else must be labeled as inference: \"assumed identical by generation — not opened.\"\n- Never truncate output you will base a claim on — no \\`| head\\` / \\`| tail\\` on a diff or search you intend to cite. Examine files one at a time instead.\n\n---\n\n${contextSection}${opts.checkBody}\n\n---\n\n${reportContract(\"inspecting\", \"the check's report\", opts.workdir, opts.writeTool)}\n\nEvery single line of your report will be read in full by the operator's agent — nothing is skimmed, so every line costs attention. Verify each finding against the actual code before writing it down. A report that says \"no findings\" is a perfectly good report; an unverified finding is not.`\n}\n\n// The mining prompt: digest of one conversation + what counts as a durable\n// preference observation + the block format the catalog accumulates.\nexport function composeMinePrompt(\n\tdigest: string,\n\tworkdir: string,\n\twriteTool: string | null,\n): string {\n\treturn `## Environment\n\nYou are running inside a sandboxed microVM with no network access. The machine's Claude Code transcripts are mounted read-only at their real paths; your current working directory is a writable scratch workspace: \\`${workdir}\\`.\n\n${firstActionLine(workdir, writeTool)}\n\n## Task\n\nYou are mining ONE Claude Code conversation for the operator's durable preferences — how they want engineering done, in any conversation, not what they wanted built in this one.\n\nBelow is the conversation digest: every genuine human turn, numbered, in order. When a turn is a terse correction or interruption (\"no\", \"stop\", \"don't\", \"why did you…\", \"[Request interrupted]\"), recover its context: the \"# source:\" header names the full session transcript — Grep that turn's text in it to find its line, then Read the assistant turns IMMEDIATELY BEFORE it with offset/limit. The preference lives in the contrast between what the assistant did and what the operator demanded. NEVER read a transcript whole — some are tens of MB.\n\n---\n\n${digest}\n\n---\n\n## What counts as an observation (strict)\n\nA durable preference, backed by a verbatim quote from the digest or transcript:\n\n- **kind: code** — how code should be written/structured/shaped (\"no silent fallbacks\", \"reuse the existing helper instead of hand-rolling\").\n- **kind: workflow** — how work should proceed (\"verify before claiming done\", \"ask before making scope decisions\").\n- **kind: style** — how prose/output/docs should read.\n\nExclude task-of-the-moment directives with no durable signal (\"add a tab to home.tsx\", \"kill the dev server\"). Exclude anything you cannot quote. Be conservative: a weak or speculative observation is worse than none.\n\n## Observation format\n\nThe report is observation blocks and NOTHING else — no title, no preamble, no summary or conclusion sections. One block per observation:\n\n## <kebab-case-name>\n- **observation:** <one sentence: the durable preference>\n- **kind:** code | workflow | style\n- **evidence:** \"<verbatim quote>\" — turn <N>\n\nFor **code** observations that an LLM reviewer could check against a diff or file tree (a concrete change could flip PASS↔FAIL), and ONLY for those — never on workflow or style blocks — ALSO add:\n\n- **pass/fail:** PASS when <…>; FAIL when <…>\n- **why-LLM:** <why a deterministic linter cannot enforce this>\n- **scope:** diff-only | needs-tree\n\nIf the conversation carries no durable preference signal, the report is exactly these two lines and nothing more:\n\nNo durable preference signal.\n<one sentence: what the conversation was about instead>\n\n${reportContract(\"mining\", \"the mined observations\", workdir, writeTool)}`\n}\n","import { PROMPT_FILE } from \"./contract.ts\"\nimport type { AgentSpec } from \"./runner.ts\"\n\nconst GUEST_HOME = \"/root\"\n\n// The claude adapter: produce the AgentSpec that runs `claude -p` in the guest.\nexport function claudeAgent(opts: {\n\ttoken: string\n\tmodel: string\n\tworkdir: string\n}): AgentSpec {\n\treturn {\n\t\t// Headless claude -p cannot answer permission prompts, so in \"default\"\n\t\t// mode every tool is auto-denied and the agent produces nothing. The\n\t\t// microVM is the safety boundary here, so bypass the per-tool gate;\n\t\t// IS_SANDBOX=1 is what lets that run as root without claude's refusal.\n\t\tcommand:\n\t\t\t\"claude -p --no-session-persistence \" +\n\t\t\t\"--dangerously-skip-permissions \" +\n\t\t\t// --verbose is required by claude -p with stream-json output; it only\n\t\t\t// widens what lands on stdout, which describeStreamLine already labels.\n\t\t\t\"--output-format stream-json --verbose \" +\n\t\t\t// Not a permission gate — a contract guard. The default headless tool\n\t\t\t// set omits Glob/Grep and includes harness tools (ReportFindings,\n\t\t\t// TaskCreate, …) that hijack the report: haiku \"reports findings\"\n\t\t\t// through them and never writes report.md (verified live). This pins\n\t\t\t// the inspector's full toolkit and nothing else.\n\t\t\t`--tools Task Bash Read Write Edit Glob Grep WebSearch WebFetch < ${PROMPT_FILE}`,\n\t\tenv: {\n\t\t\tHOME: GUEST_HOME,\n\t\t\tIS_SANDBOX: \"1\",\n\t\t\tGIT_OPTIONAL_LOCKS: \"0\",\n\t\t\tANTHROPIC_MODEL: opts.model,\n\t\t\tCLAUDE_CODE_OAUTH_TOKEN: opts.token,\n\t\t},\n\t\t// Minimal trust-accepted entry keyed to the guest cwd so headless claude\n\t\t// skips the trust prompt. Deliberately NOT a copy of any host .claude.json.\n\t\tfiles: [\n\t\t\t{\n\t\t\t\tpath: `${GUEST_HOME}/.claude.json`,\n\t\t\t\tcontent: `${JSON.stringify(\n\t\t\t\t\t{ projects: { [opts.workdir]: { hasTrustDialogAccepted: true } } },\n\t\t\t\t\tnull,\n\t\t\t\t\t\"\\t\",\n\t\t\t\t)}\\n`,\n\t\t\t},\n\t\t],\n\t}\n}\n\ninterface StreamLine {\n\ttype?: string\n\tsubtype?: string\n\tmessage?: { content?: Array<{ type?: string; text?: string; name?: string }> }\n\tduration_ms?: number\n}\n\n// One human-readable label per stream-json stdout line; null for lines that\n// aren't claude's JSON (dropped from the progress stream).\nexport function describeClaudeStreamLine(line: string): string | null {\n\tlet obj: StreamLine\n\ttry {\n\t\tobj = JSON.parse(line) as StreamLine\n\t} catch {\n\t\treturn null\n\t}\n\tconst label = (obj.type ?? \"\") + (obj.subtype ? `:${obj.subtype}` : \"\")\n\t// A once-per-second heartbeat with no content — pure noise in the stream.\n\tif (label === \"system:thinking_tokens\") return null\n\tlet detail = \"\"\n\tif (obj.type === \"assistant\") {\n\t\tconst content = obj.message?.content ?? []\n\t\tconst tools = content\n\t\t\t.filter((b) => b.type === \"tool_use\" && b.name)\n\t\t\t.map((b) => b.name)\n\t\tconst chars = content.reduce((n, b) => n + (b.text?.length ?? 0), 0)\n\t\tdetail = tools.length ? ` ${tools.join(\",\")}` : ` ${chars} chars`\n\t} else if (obj.type === \"result\") {\n\t\tdetail = ` ${obj.subtype}, ${((obj.duration_ms ?? 0) / 1000).toFixed(1)}s`\n\t}\n\treturn `[${label}]${detail}`\n}\n","import { PROMPT_FILE } from \"./contract.ts\"\nimport type { AgentSpec } from \"./runner.ts\"\n\nconst GUEST_HOME = \"/root\"\n\n// Guest-only codex config — deliberately NOT a copy of any host config.toml\n// (which carries MCP API keys, personality, plugins, a trust table). Each key\n// is load-bearing:\n// - model rides here rather than as a `-m` flag so nothing operator-supplied\n// is ever interpolated into the guest's bash command string.\n// - approval_policy/sandbox_mode double the bypass flag on the command line;\n// either alone is a documented trust-prompt suppressor, some builds leak\n// with only one (openai/codex#14547).\n// - model_reasoning_effort: operator decision — plan billing is flat-rate,\n// so there is no haiku-style cost gradient to encode in a cheaper setting.\n// - web_search is a server-side tool (the guest never fetches pages itself);\n// \"live\" pins it rather than relying on the full-access auto-upgrade.\n// - project_doc_max_bytes = 0 disables all AGENTS.md loading: the piped\n// prompt is the agent's only input.\n// - features.plugins/apps = false stop codex's boot-time marketplace clone\n// and apps fetch (verified live): under restricted egress they hang, and\n// under any egress they inject tools (e.g. a git-push skill) the contract\n// never sanctioned.\nfunction guestConfig(model: string): string {\n\treturn `model = \"${model}\"\napproval_policy = \"never\"\nsandbox_mode = \"danger-full-access\"\nmodel_reasoning_effort = \"xhigh\"\nweb_search = \"live\"\nproject_doc_max_bytes = 0\ncli_auth_credentials_store = \"file\"\n\n[features]\nplugins = false\napps = false\n`\n}\n\n// The codex adapter: produce the AgentSpec that runs `codex exec` in the guest.\nexport function codexAgent(opts: {\n\t// Byte-for-byte content of the operator's ~/.codex/auth.json; staleness is\n\t// the caller's preflight (a guest-side token refresh would rotate the\n\t// single-use refresh token and poison the host session).\n\tauthJson: string\n\tmodel: string\n\tworkdir: string\n}): AgentSpec {\n\treturn {\n\t\t// Headless codex cannot answer approval prompts, and its own bwrap\n\t\t// sandbox needs user namespaces the guest may not grant — the microVM is\n\t\t// the safety boundary, so bypass both (OpenAI's documented container\n\t\t// guidance). --ephemeral writes no session rollout files;\n\t\t// --skip-git-repo-check because the scratch cwd is not a git repo.\n\t\tcommand:\n\t\t\t\"codex exec --json --skip-git-repo-check \" +\n\t\t\t\"--dangerously-bypass-approvals-and-sandbox --ephemeral \" +\n\t\t\t`- < ${PROMPT_FILE}`,\n\t\tenv: {\n\t\t\t// CODEX_HOME defaults to $HOME/.codex, where both staged files land.\n\t\t\tHOME: GUEST_HOME,\n\t\t\tGIT_OPTIONAL_LOCKS: \"0\",\n\t\t},\n\t\tfiles: [\n\t\t\t{ path: `${GUEST_HOME}/.codex/auth.json`, content: opts.authJson },\n\t\t\t{\n\t\t\t\tpath: `${GUEST_HOME}/.codex/config.toml`,\n\t\t\t\tcontent: guestConfig(opts.model),\n\t\t\t},\n\t\t],\n\t}\n}\n\n// The freshness window for a staged ChatGPT-auth auth.json. Codex refreshes\n// tokens when last_refresh is ~8 days old (or on a 401), refresh tokens are\n// single-use, and a refresh performed INSIDE a guest rotates the token family\n// — the host's copy then dies with \"refresh token was already used\" (forced\n// re-login). 7 days leaves a day of margin below codex's own threshold.\nexport const CODEX_AUTH_MAX_AGE_DAYS = 7\n\ninterface CodexAuth {\n\ttokens?: { refresh_token?: string }\n\tlast_refresh?: string\n\tOPENAI_API_KEY?: string\n}\n\n// Pure preflight: throw (with the operator's next action) unless this\n// auth.json is safe to stage into guests. An api-key-mode auth.json (no\n// tokens, an OPENAI_API_KEY field) carries no refresh semantics, so no\n// staleness guard applies.\nexport function validateCodexAuth(content: string, now: Date, where: string): void {\n\tlet auth: CodexAuth\n\ttry {\n\t\tauth = JSON.parse(content) as CodexAuth\n\t} catch {\n\t\tthrow new Error(`${where} is not valid JSON — run \\`codex login\\` on the host`)\n\t}\n\tif (auth.tokens?.refresh_token) {\n\t\tconst ageDays = (now.getTime() - Date.parse(auth.last_refresh ?? \"\")) / 86_400_000\n\t\tif (!(ageDays <= CODEX_AUTH_MAX_AGE_DAYS)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${where} tokens were last refreshed over ${CODEX_AUTH_MAX_AGE_DAYS} days ago (codex refreshes at ~8 days, and a refresh inside a guest would rotate the single-use refresh token and poison this host's session) — run any codex command on the host to refresh, then retry`,\n\t\t\t)\n\t\t}\n\t\treturn\n\t}\n\tif (auth.OPENAI_API_KEY) return\n\tthrow new Error(\n\t\t`${where} has neither ChatGPT tokens nor an API key — run \\`codex login\\` on the host`,\n\t)\n}\n\ninterface CodexStreamLine {\n\ttype?: string\n\titem?: {\n\t\ttype?: string\n\t\ttext?: string\n\t\tcommand?: string\n\t\tchanges?: Array<{ path?: string }>\n\t}\n\tusage?: { input_tokens?: number; output_tokens?: number }\n\terror?: { message?: string }\n\tmessage?: string\n}\n\nconst clip = (s: string, max = 60): string => (s.length > max ? `${s.slice(0, max)}…` : s)\n\n// One human-readable label per --json stdout line; null for lines that aren't\n// codex's JSON (dropped from the progress stream). Event taxonomy:\n// thread.started / turn.started / turn.completed / turn.failed /\n// item.{started,updated,completed} (item.type = agent_message,\n// command_execution, file_change, reasoning, web_search, todo_list,\n// mcp_tool_call, error) / error.\nexport function describeCodexStreamLine(line: string): string | null {\n\tlet obj: CodexStreamLine\n\ttry {\n\t\tobj = JSON.parse(line) as CodexStreamLine\n\t} catch {\n\t\treturn null\n\t}\n\tconst item = obj.item\n\tconst label = (obj.type ?? \"\") + (item?.type ? `:${item.type}` : \"\")\n\tlet detail = \"\"\n\tif (item?.type === \"agent_message\") {\n\t\tdetail = ` ${item.text?.length ?? 0} chars`\n\t} else if (item?.type === \"command_execution\" && item.command) {\n\t\tdetail = ` ${clip(item.command)}`\n\t} else if (item?.type === \"file_change\") {\n\t\tdetail = ` ${(item.changes ?? []).length} file(s)`\n\t} else if (obj.type === \"turn.completed\") {\n\t\tdetail = ` ${obj.usage?.input_tokens ?? 0} in, ${obj.usage?.output_tokens ?? 0} out tokens`\n\t} else if (obj.type === \"turn.failed\") {\n\t\tdetail = ` ${clip(obj.error?.message ?? \"\")}`\n\t} else if (obj.type === \"error\") {\n\t\tdetail = ` ${clip(obj.message ?? \"\")}`\n\t}\n\treturn `[${label}]${detail}`\n}\n","import { readFileSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport { join } from \"node:path\"\nimport { claudeAgent, describeClaudeStreamLine } from \"./claude.ts\"\nimport { codexAgent, describeCodexStreamLine, validateCodexAuth } from \"./codex.ts\"\nimport type { AgentSpec } from \"./runner.ts\"\n\n// The agent CLI: the brand of agent (claude, codex) the operator picks with\n// --agent, and everything the workflows need from it. Not to be confused with\n// the harness (doublecheck's own mechanics) or an agent (one running\n// inspector instance, described by an AgentSpec).\nexport interface AgentCli {\n\tname: string\n\t// Applied only when --model is absent.\n\tdefaultModel: { check: string; mine: string }\n\t// The phrase the report contract uses to tell this agent how to create a\n\t// file; null when the prompt should just say \"create <path>\".\n\twriteToolPhrase: string | null\n\t// Domain suffixes for restricted-egress workflows (mine): the CLI's own\n\t// API endpoints, so the only reachable destination is the service the\n\t// agent already sends its context to.\n\tegressDomains: string[]\n\t// Host-side preflight: the secret material staged into every guest, or an\n\t// actionable error. Runs once per invocation, before any guest boots.\n\tcredentials(): string\n\tagent(opts: { credentials: string; model: string; workdir: string }): AgentSpec\n\tdescribeStreamLine(line: string): string | null\n}\n\nconst claude: AgentCli = {\n\tname: \"claude\",\n\tdefaultModel: { check: \"haiku\", mine: \"opus\" },\n\twriteToolPhrase: \"with the Write tool\",\n\tegressDomains: [\"anthropic.com\"],\n\tcredentials: () => {\n\t\tconst token = process.env.CLAUDE_CODE_OAUTH_TOKEN\n\t\tif (!token) {\n\t\t\tthrow new Error(\n\t\t\t\t\"CLAUDE_CODE_OAUTH_TOKEN is required in the environment (it is injected into each agent's sandbox)\",\n\t\t\t)\n\t\t}\n\t\treturn token\n\t},\n\tagent: ({ credentials, model, workdir }) =>\n\t\tclaudeAgent({ token: credentials, model, workdir }),\n\tdescribeStreamLine: describeClaudeStreamLine,\n}\n\nconst codex: AgentCli = {\n\tname: \"codex\",\n\t// No haiku-style cheap default: plan billing is flat-rate, and the staged\n\t// guest config already pins xhigh reasoning effort (operator decision).\n\tdefaultModel: { check: \"gpt-5.6-sol\", mine: \"gpt-5.6-sol\" },\n\twriteToolPhrase: null,\n\t// ChatGPT-plan inference lives at chatgpt.com/backend-api/codex; the\n\t// openai.com suffix covers auth.openai.com, where a 401-forced token\n\t// refresh would have to go.\n\tegressDomains: [\"chatgpt.com\", \"openai.com\"],\n\tcredentials: () => {\n\t\tconst authPath = join(homedir(), \".codex\", \"auth.json\")\n\t\tlet content: string\n\t\ttry {\n\t\t\tcontent = readFileSync(authPath, \"utf-8\")\n\t\t} catch {\n\t\t\tthrow new Error(`no readable ${authPath} — run \\`codex login\\` on the host`)\n\t\t}\n\t\tvalidateCodexAuth(content, new Date(), authPath)\n\t\treturn content\n\t},\n\tagent: ({ credentials, model, workdir }) =>\n\t\tcodexAgent({ authJson: credentials, model, workdir }),\n\tdescribeStreamLine: describeCodexStreamLine,\n}\n\nconst AGENT_CLIS: Record<string, AgentCli> = { claude, codex }\n\nexport function resolveAgentCli(name: string): AgentCli {\n\tconst cli = AGENT_CLIS[name]\n\tif (!cli) {\n\t\tthrow new Error(\n\t\t\t`unknown agent \"${name}\" (have: ${Object.keys(AGENT_CLIS).join(\", \")})`,\n\t\t)\n\t}\n\treturn cli\n}\n\n// One resolved, preflighted agent selection, shared by every unit of a run.\nexport interface AgentRun {\n\tcli: AgentCli\n\tcredentials: string\n\tmodel: string\n}\n\n// Resolve --agent/--model into what a workflow's units consume: the CLI, its\n// preflighted credentials, and the model (explicit flag, else the CLI's\n// default for this workflow).\nexport function resolveAgentRun(\n\tname: string,\n\tmodel: string | undefined,\n\tworkflow: \"check\" | \"mine\",\n): AgentRun {\n\tconst cli = resolveAgentCli(name)\n\treturn {\n\t\tcli,\n\t\tcredentials: cli.credentials(),\n\t\tmodel: model ?? cli.defaultModel[workflow],\n\t}\n}\n\n// The per-unit progress sink both workflow shells hang on runAgent: guest\n// stderr passes through as `[label] ! line`, stdout is the agent CLI's JSON\n// stream, labelled by its describeStreamLine (non-JSON lines dropped).\nexport function progressSink(\n\tlabel: string,\n\tdescribe: (line: string) => string | null,\n): (kind: \"stdout\" | \"stderr\", line: string) => void {\n\treturn (kind, line) => {\n\t\tif (kind === \"stderr\") {\n\t\t\tprocess.stderr.write(`[${label}] ! ${line}\\n`)\n\t\t\treturn\n\t\t}\n\t\tconst described = describe(line)\n\t\tif (described) process.stderr.write(`[${label}] ${described}\\n`)\n\t}\n}\n","import { execFileSync } from \"node:child_process\"\nimport { existsSync, readFileSync } from \"node:fs\"\nimport { basename, join } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport type { ExecEvent } from \"microsandbox\"\nimport { REPORT_FILE } from \"./contract.ts\"\n\n// microsandbox exports its fluent builders as value-only consts; recover their\n// instance types via a type-only import (erased at build) so the native module\n// only loads behind the `await import` in runAgent.\ntype MountBuilder = InstanceType<typeof import(\"microsandbox\").MountBuilder>\ntype PatchBuilder = InstanceType<typeof import(\"microsandbox\").PatchBuilder>\ntype ExecOptionsBuilder = InstanceType<typeof import(\"microsandbox\").ExecOptionsBuilder>\n// The SDK types `.network(cb)` as `(b: any) => any`, and we call the JS-shim\n// `.policy(...)`, absent from the native builder's types.\n// biome-ignore lint/suspicious/noExplicitAny: SDK types this builder callback as any\ntype NetworkBuilder = any\n\n// The guest image (Dockerfile.guest): node 24 slim + git/ripgrep/curl/wget +\n// both agent CLIs baked in. Every install pulls the multi-arch image the\n// release workflow pushed to ghcr: an installed release uses its own package\n// version as the tag, and a dev tree (version 0.0.0-development) resolves the\n// nearest release tag reachable from its checkout — so `git pull` bringing a\n// new tag IS the image update, and versioned tags keep the msb cache correct\n// forever. The locally built doublecheck-guest:latest is only for iterating\n// on the image itself, opted into via DOUBLECHECK_GUEST_IMAGE (or as the\n// fallback when the tree has no release tags at all, e.g. a shallow clone) —\n// it exists nowhere else, hence pullPolicy \"never\": a cache miss there means\n// \"run scripts/build-guest-image.sh\", not \"try a registry\".\nconst GUEST_IMAGE_REPO = \"ghcr.io/alizain/doublecheck-guest\"\nconst LOCAL_GUEST_IMAGE = \"doublecheck-guest:latest\"\nexport const DEV_VERSION = \"0.0.0-development\"\nconst GUEST_MEMORY_MIB = 2048\n\nexport interface GuestImage {\n\tref: string\n\tpullPolicy: \"never\" | \"if-missing\"\n}\n\n// Pure: which image this doublecheck runs its guests from. An override (the\n// DOUBLECHECK_GUEST_IMAGE env var) is operator-managed: it must already be in\n// the msb cache, so it is never pulled. `checkoutReleaseVersion` is the dev\n// tree's git-derived release version (null outside a tagged checkout).\nexport function decideGuestImage(\n\tversion: string,\n\toverride?: string,\n\tcheckoutReleaseVersion?: string | null,\n): GuestImage {\n\tif (override) return { ref: override, pullPolicy: \"never\" }\n\tconst release = version === DEV_VERSION ? checkoutReleaseVersion : version\n\tif (!release) return { ref: LOCAL_GUEST_IMAGE, pullPolicy: \"never\" }\n\treturn { ref: `${GUEST_IMAGE_REPO}:${release}`, pullPolicy: \"if-missing\" }\n}\n\n// Read at runtime, not import time: the dist bundle is built BEFORE\n// semantic-release stamps the real version into the published package.json,\n// so baking the version in at build time would pin every install to\n// 0.0.0-development. Works from both src/ (tsx) and dist/ (bundle) — each\n// sits one level below the package root.\nfunction packageVersion(): string {\n\tconst pkg = JSON.parse(\n\t\treadFileSync(new URL(\"../package.json\", import.meta.url), \"utf-8\"),\n\t) as { version: string }\n\treturn pkg.version\n}\n\n// The dev tree's release version: the nearest v* tag reachable from the\n// checkout, i.e. the release whose image matches this ancestry. Null when\n// there is no tag to be found (not a git repo, shallow clone, git absent) —\n// a legitimate state whose designed meaning is \"use the locally built image\".\nfunction checkoutReleaseVersion(): string | null {\n\ttry {\n\t\tconst tag = execFileSync(\n\t\t\t\"git\",\n\t\t\t[\n\t\t\t\t\"-C\",\n\t\t\t\tpackageRoot(),\n\t\t\t\t\"describe\",\n\t\t\t\t\"--tags\",\n\t\t\t\t\"--abbrev=0\",\n\t\t\t\t\"--match\",\n\t\t\t\t\"v[0-9]*\",\n\t\t\t],\n\t\t\t{ encoding: \"utf-8\", stdio: [\"ignore\", \"pipe\", \"ignore\"] },\n\t\t).trim()\n\t\treturn tag.slice(1)\n\t} catch {\n\t\treturn null\n\t}\n}\n\nfunction packageRoot(): string {\n\treturn fileURLToPath(new URL(\"..\", import.meta.url))\n}\n\n// Staged into the guest before boot (e.g. claude's trust-accepted config).\nexport interface GuestFile {\n\tpath: string\n\tcontent: string\n}\n\n// What it takes to run one agent in a booted guest: a bash command executed in\n// the scratch cwd that must leave REPORT_FILE there, the env it needs, and\n// files staged into the guest. Plain data — adapters produce it, this runner\n// consumes it, tests fake it.\nexport interface AgentSpec {\n\tcommand: string\n\tenv: Record<string, string>\n\tfiles: GuestFile[]\n}\n\nexport type AgentOutcome =\n\t| { ok: true; report: string }\n\t| { ok: false; reason: string; partialReport: string | null }\n\n// Pure line buffering: fold a chunk into the carry, emit complete non-blank\n// lines, keep the unterminated tail.\nexport function feedLines(\n\tcarry: string,\n\tchunk: string,\n): { lines: string[]; carry: string } {\n\tconst parts = (carry + chunk).split(\"\\n\")\n\tconst rest = parts.pop() ?? \"\"\n\treturn { lines: parts.filter((l) => l.trim()), carry: rest }\n}\n\n// Pure outcome decision: what the exec left behind → what it means.\nexport function decideOutcome(\n\texitCode: number | null,\n\treport: string | null,\n\tworkdir: string,\n): AgentOutcome {\n\tif (exitCode !== 0) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: `agent process exited ${exitCode}`,\n\t\t\tpartialReport: report,\n\t\t}\n\t}\n\tif (report === null) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: `agent exited 0 but wrote no ${REPORT_FILE} (work dir: ${workdir})`,\n\t\t\tpartialReport: null,\n\t\t}\n\t}\n\treturn { ok: true, report }\n}\n\nexport interface RunAgentOpts {\n\t// Host dir the agent inspects, bind-mounted READ-ONLY at its real host\n\t// path: the target for `check`, the transcripts corpus for `mine`.\n\tmount: string\n\t// Scratch dir with PROMPT_FILE already inside; bind-mounted rw as the guest\n\t// cwd at its identical host path, so the agent's report lands back on the host.\n\tworkdir: string\n\tspec: AgentSpec\n\t// \"all\" for checks (inspectors may research); a domain-suffix allowlist for\n\t// miners: the personal corpus is mounted, so egress is pinned to the agent\n\t// CLI's own API domains — the only reachable destination is the service\n\t// the agent already sends its context to. NetworkPolicy.none() is not an\n\t// option here — it kills DNS entirely and the adapter can't reach its own\n\t// model API (measured: claude retries ~180s then exits 1).\n\tnetwork: \"all\" | { onlyDomains: string[] }\n\tonLine: (kind: \"stdout\" | \"stderr\", line: string) => void\n}\n\n// Boot a guest (ro mount + scratch rw as cwd), exec the agent command, stream\n// its output line-by-line, read the report back off the scratch dir, tear\n// down. Agent-level failures (exit ≠ 0, no report) return ok:false;\n// harness-level failures (image missing, boot error) throw.\nexport async function runAgent(opts: RunAgentOpts): Promise<AgentOutcome> {\n\tconst microsandbox = await import(\"microsandbox\")\n\tconst name = `doublecheck-${basename(opts.workdir)}`\n\tconst version = packageVersion()\n\tconst image = decideGuestImage(\n\t\tversion,\n\t\tprocess.env.DOUBLECHECK_GUEST_IMAGE,\n\t\tversion === DEV_VERSION ? checkoutReleaseVersion() : null,\n\t)\n\tconst network = opts.network\n\tconst policy =\n\t\tnetwork === \"all\"\n\t\t\t? microsandbox.NetworkPolicy.allowAll()\n\t\t\t: microsandbox.NetworkPolicy.builder()\n\t\t\t\t\t.defaultDeny()\n\t\t\t\t\t.egress((rb) => {\n\t\t\t\t\t\tlet rules = rb\n\t\t\t\t\t\tfor (const domain of network.onlyDomains) {\n\t\t\t\t\t\t\trules = rules.allow((d) => d.domainSuffix(domain))\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn rules\n\t\t\t\t\t})\n\t\t\t\t\t.build()\n\tlet sandbox: InstanceType<typeof microsandbox.Sandbox> | null = null\n\ttry {\n\t\ttry {\n\t\t\tsandbox = await microsandbox.Sandbox.builder(name)\n\t\t\t\t.image(image.ref)\n\t\t\t\t.memory(GUEST_MEMORY_MIB)\n\t\t\t\t.pullPolicy(image.pullPolicy)\n\t\t\t\t.replace()\n\t\t\t\t.workdir(opts.workdir)\n\t\t\t\t.envs(opts.spec.env)\n\t\t\t\t.volume(opts.mount, (mb: MountBuilder) => mb.bind(opts.mount).readonly())\n\t\t\t\t.volume(opts.workdir, (mb: MountBuilder) => mb.bind(opts.workdir))\n\t\t\t\t.patch((pb: PatchBuilder) => {\n\t\t\t\t\tlet p = pb\n\t\t\t\t\tfor (const f of opts.spec.files) {\n\t\t\t\t\t\tp = p.text(f.path, f.content, { mode: 0o600, replace: true })\n\t\t\t\t\t}\n\t\t\t\t\treturn p\n\t\t\t\t})\n\t\t\t\t.network((nb: NetworkBuilder) => nb.policy(policy))\n\t\t\t\t.create()\n\t\t} catch (e) {\n\t\t\tif (image.pullPolicy === \"never\" && String(e).includes(\"not cached\")) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`guest image ${image.ref} is not in the microsandbox cache — it is never pulled; scripts/build-guest-image.sh builds and side-loads ${LOCAL_GUEST_IMAGE} (${String(e)})`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (image.pullPolicy === \"if-missing\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`guest ${image.ref} failed to boot — if this is a pull failure, check network access to ghcr.io and that the package is public; a locally built image can be forced with DOUBLECHECK_GUEST_IMAGE=doublecheck-guest:latest (${String(e)})`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\n\t\tconst handle = await sandbox.execStreamWith(\"bash\", (e: ExecOptionsBuilder) =>\n\t\t\te.args([\"-c\", opts.spec.command]),\n\t\t)\n\n\t\tconst carry: Record<\"stdout\" | \"stderr\", string> = { stdout: \"\", stderr: \"\" }\n\t\tlet exitCode: number | null = null\n\t\tfor (;;) {\n\t\t\tconst ev: ExecEvent | null = await handle.recv()\n\t\t\tif (ev === null) break\n\t\t\tif (ev.kind === \"stdout\" || ev.kind === \"stderr\") {\n\t\t\t\tconst fed = feedLines(carry[ev.kind], Buffer.from(ev.data).toString())\n\t\t\t\tcarry[ev.kind] = fed.carry\n\t\t\t\tfor (const line of fed.lines) opts.onLine(ev.kind, line)\n\t\t\t} else if (ev.kind === \"exited\") exitCode = ev.code\n\t\t}\n\t\tfor (const kind of [\"stdout\", \"stderr\"] as const) {\n\t\t\tif (carry[kind].trim()) opts.onLine(kind, carry[kind])\n\t\t}\n\n\t\tconst reportPath = join(opts.workdir, REPORT_FILE)\n\t\tconst report = existsSync(reportPath) ? readFileSync(reportPath, \"utf-8\") : null\n\t\treturn decideOutcome(exitCode, report, opts.workdir)\n\t} finally {\n\t\tif (sandbox) {\n\t\t\ttry {\n\t\t\t\tawait sandbox.stop()\n\t\t\t} catch (e) {\n\t\t\t\topts.onLine(\"stderr\", `sandbox stop failed: ${String(e)}`)\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait microsandbox.Sandbox.remove(name)\n\t\t\t} catch (e) {\n\t\t\t\topts.onLine(\"stderr\", `sandbox remove failed: ${String(e)}`)\n\t\t\t}\n\t\t}\n\t}\n}\n","import {\n\tappendFileSync,\n\tmkdirSync,\n\tmkdtempSync,\n\treaddirSync,\n\treadFileSync,\n\twriteFileSync,\n} from \"node:fs\"\nimport { tmpdir } from \"node:os\"\nimport { join } from \"node:path\"\nimport PQueue from \"p-queue\"\nimport { type AgentRun, progressSink, resolveAgentRun } from \"./agent-cli.ts\"\nimport { composePrompt, PROMPT_FILE, REPORT_FILE } from \"./contract.ts\"\nimport { runAgent } from \"./runner.ts\"\n\n// A check is a plain markdown file — no frontmatter, no schema. The body is\n// the inspector's instructions; the name is the filename minus .md. Checks\n// come from one or more --checks-dir directories (default:\n// $TARGET/.agents/checks).\nexport interface Check {\n\tname: string\n\tbody: string\n}\n\n// Pure selection: `only` (from repeated --check flags) filters, in the order\n// named; naming a check that doesn't exist is an error, not an empty run.\nexport function selectChecks(all: Check[], only: string[], where: string): Check[] {\n\tif (all.length === 0) throw new Error(`no checks (*.md) in ${where}`)\n\tif (only.length === 0) return all\n\tconst byName = new Map(all.map((c) => [c.name, c]))\n\treturn only.map((name) => {\n\t\tconst check = byName.get(name)\n\t\tif (!check) {\n\t\t\tconst have = all.map((c) => c.name).join(\", \")\n\t\t\tthrow new Error(`no check named \"${name}\" in ${where} (have: ${have})`)\n\t\t}\n\t\treturn check\n\t})\n}\n\n// Shell: read every check file from every checks dir, then select purely.\n// A missing dir is an error; the same check name in two dirs is an error —\n// no precedence rules, rename one.\nexport function discoverChecks(dirs: string[], only: string[]): Check[] {\n\tconst all: Array<Check & { dir: string }> = []\n\tfor (const dir of dirs) {\n\t\tlet entries: string[]\n\t\ttry {\n\t\t\tentries = readdirSync(dir)\n\t\t} catch {\n\t\t\tthrow new Error(`no checks directory at ${dir}`)\n\t\t}\n\t\tfor (const f of entries.filter((e) => e.endsWith(\".md\")).sort()) {\n\t\t\tconst name = f.slice(0, -\".md\".length)\n\t\t\tconst clash = all.find((c) => c.name === name)\n\t\t\tif (clash) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`check \"${name}\" exists in both ${clash.dir} and ${dir} — rename one`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tall.push({ name, body: readFileSync(join(dir, f), \"utf-8\"), dir })\n\t\t}\n\t}\n\tconst checks = all\n\t\t.map(({ name, body }) => ({ name, body }))\n\t\t.sort((a, b) => a.name.localeCompare(b.name))\n\treturn selectChecks(checks, only, dirs.join(\", \"))\n}\n\nexport interface CheckWorkflowOpts {\n\ttarget: string\n\tchecksDirs: string[]\n\tcontextFile: string | null\n\tagent: string\n\t// Absent = the agent CLI's default for checks.\n\tmodel?: string\n\tparallel: number\n\toutput: string\n\tonly: string[]\n\tsaveJsonl: boolean\n}\n\n// fs-safe local timestamp, one dir per run shared by all its checks:\n// 2026-07-05-143000\nexport function runTimestamp(d: Date): string {\n\tconst p = (n: number) => String(n).padStart(2, \"0\")\n\treturn `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`\n}\n\n// The report written when the agent failed: the failure is the report, plus\n// whatever partial report the agent managed to leave.\nexport function failureReport(reason: string, partialReport: string | null): string {\n\tconst partial = partialReport\n\t\t? `\\n---\\n\\nPartial ${REPORT_FILE} left by the agent:\\n\\n${partialReport}`\n\t\t: \"\"\n\treturn `# CHECK FAILED\\n\\n${reason}\\n${partial}`\n}\n\nasync function runOneCheck(\n\tcheck: Check,\n\topts: CheckWorkflowOpts,\n\trun: AgentRun,\n\trunContext: string | null,\n\toutDir: string,\n): Promise<boolean> {\n\tconst workdir = mkdtempSync(join(tmpdir(), `doublecheck-${check.name}-`))\n\twriteFileSync(\n\t\tjoin(workdir, PROMPT_FILE),\n\t\tcomposePrompt({\n\t\t\tcheckBody: check.body,\n\t\t\ttarget: opts.target,\n\t\t\tworkdir,\n\t\t\trunContext,\n\t\t\twriteTool: run.cli.writeToolPhrase,\n\t\t}),\n\t)\n\tconst spec = run.cli.agent({\n\t\tcredentials: run.credentials,\n\t\tmodel: run.model,\n\t\tworkdir,\n\t})\n\t// The report is the verdict; with --save-jsonl the raw stream is kept\n\t// beside it so a run can be audited after the ephemeral guest is gone\n\t// (which files the inspector read, what it skipped, whether report claims\n\t// trace to actual observations).\n\tconst sink = progressSink(check.name, run.cli.describeStreamLine)\n\tlet onLine = sink\n\tif (opts.saveJsonl) {\n\t\tconst streamPath = join(outDir, `${check.name}.stream.jsonl`)\n\t\tonLine = (kind, line) => {\n\t\t\tif (kind === \"stdout\") appendFileSync(streamPath, `${line}\\n`)\n\t\t\tsink(kind, line)\n\t\t}\n\t}\n\tconst outcome = await runAgent({\n\t\tmount: opts.target,\n\t\tworkdir,\n\t\tspec,\n\t\tnetwork: \"all\",\n\t\tonLine,\n\t})\n\tconst reportPath = join(outDir, `${check.name}.md`)\n\tif (outcome.ok) {\n\t\twriteFileSync(reportPath, outcome.report)\n\t\tprocess.stderr.write(`[${check.name}] report: ${reportPath}\\n`)\n\t\treturn true\n\t}\n\twriteFileSync(reportPath, failureReport(outcome.reason, outcome.partialReport))\n\tprocess.stderr.write(`[${check.name}] FAILED (${outcome.reason}): ${reportPath}\\n`)\n\treturn false\n}\n\n// The check workflow: one sandboxed agent per check, at most `parallel`\n// guests at once. Returns true only when every check produced a report; agent\n// failures still write a failure-record report and flip the run to false.\nexport async function runChecks(opts: CheckWorkflowOpts): Promise<boolean> {\n\tconst run = resolveAgentRun(opts.agent, opts.model, \"check\")\n\tconst checks = discoverChecks(opts.checksDirs, opts.only)\n\tlet runContext: string | null = null\n\tif (opts.contextFile) {\n\t\ttry {\n\t\t\trunContext = readFileSync(opts.contextFile, \"utf-8\")\n\t\t} catch (e) {\n\t\t\tthrow new Error(\n\t\t\t\t`--context file not readable: ${opts.contextFile} (${String(e)})`,\n\t\t\t)\n\t\t}\n\t}\n\tconst outDir = join(opts.output, runTimestamp(new Date()))\n\tmkdirSync(outDir, { recursive: true })\n\tprocess.stderr.write(\n\t\t`${checks.length} check(s) against ${opts.target} (agent ${run.cli.name}, model ${run.model}, parallel ${opts.parallel})\\n`,\n\t)\n\tconst queue = new PQueue({ concurrency: opts.parallel })\n\tconst results = await Promise.all(\n\t\tchecks.map((check) =>\n\t\t\tqueue.add(() => runOneCheck(check, opts, run, runContext, outDir)),\n\t\t),\n\t)\n\treturn results.every((ok) => ok === true)\n}\n","// Claude Code transcript (.jsonl) → the genuine human turns → a flat digest.\n// Port of the June-2026 jq extraction, verified against the same corpus: a\n// \"genuine human turn\" is type:user, not meta, not sidechain, text content\n// only — which excludes the three things that are also type:user in the JSONL\n// (tool_results, slash-command stdout wrappers, injected system-reminders).\n\n// Per-turn char cap in the digest; the mining agent greps the source jsonl\n// for full text when it needs context around a turn.\nconst TURN_CHAR_CAP = 2000\n\ninterface RawLine {\n\ttype?: string\n\tisMeta?: boolean\n\tisSidechain?: boolean\n\tmessage?: { content?: unknown }\n}\n\nconst NON_HUMAN_TEXT =\n\t/^\\s*<command-name>|<local-command-stdout>|^\\s*<local-command|^\\s*<system-reminder>|Caveat: The messages below/\n\n// Throws on an unparseable line — the caller decides what an unreadable\n// transcript means for its run (mine counts and reports them, visibly).\nexport function humanTurns(jsonl: string): string[] {\n\tconst turns: string[] = []\n\tfor (const line of jsonl.split(\"\\n\")) {\n\t\tif (!line.trim()) continue\n\t\tconst raw = JSON.parse(line) as RawLine\n\t\tif (raw.type !== \"user\" || raw.isMeta || raw.isSidechain) continue\n\t\tconst content = raw.message?.content\n\t\tconst text =\n\t\t\ttypeof content === \"string\"\n\t\t\t\t? content\n\t\t\t\t: Array.isArray(content)\n\t\t\t\t\t? content\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t(item): item is { type: \"text\"; text: string } =>\n\t\t\t\t\t\t\t\t\ttypeof item === \"object\" &&\n\t\t\t\t\t\t\t\t\titem !== null &&\n\t\t\t\t\t\t\t\t\t(item as { type?: string }).type === \"text\" &&\n\t\t\t\t\t\t\t\t\ttypeof (item as { text?: unknown }).text === \"string\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map((item) => item.text)\n\t\t\t\t\t\t\t.join(\"\\n\")\n\t\t\t\t\t: \"\"\n\t\tif (!text) continue\n\t\tif (NON_HUMAN_TEXT.test(text)) continue\n\t\tturns.push(text.replace(/[\\n\\r]+/g, \" ⏎ \").slice(0, TURN_CHAR_CAP))\n\t}\n\treturn turns\n}\n\nexport interface DigestMeta {\n\tsource: string\n\tproject: string\n\tsession: string\n}\n\nexport function renderDigest(meta: DigestMeta, turns: string[]): string {\n\tconst numbered = turns\n\t\t.map((t, i) => `${String(i + 1).padStart(3, \" \")} | ${t}`)\n\t\t.join(\"\\n\")\n\treturn `# source: ${meta.source}\n# project: ${meta.project}\n# session: ${meta.session}\n# human_turns: ${turns.length}\n# To understand WHY a terse turn or interruption happened, grep its text in the\n# source file above and read the assistant turn(s) immediately before it.\n\n${numbered}\n`\n}\n","import { createHash } from \"node:crypto\"\nimport { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\"\nimport { basename, join } from \"node:path\"\nimport { humanTurns, renderDigest } from \"./transcript.ts\"\n\n// One minable unit = one top-level transcript $PROJECTS/<project>/<session>.jsonl.\n// Its catalog home mirrors that path: $CATALOG/<project>/<session>/observations.md.\nexport interface Unit {\n\tproject: string\n\tsession: string\n\tjsonlPath: string\n}\n\nexport function enumerateUnits(projectsDir: string): Unit[] {\n\tlet projects: string[]\n\ttry {\n\t\tprojects = readdirSync(projectsDir).sort()\n\t} catch {\n\t\tthrow new Error(`no transcripts directory at ${projectsDir}`)\n\t}\n\tconst units: Unit[] = []\n\tfor (const project of projects) {\n\t\tconst dir = join(projectsDir, project)\n\t\tif (!statSync(dir).isDirectory()) continue\n\t\tfor (const f of readdirSync(dir).sort()) {\n\t\t\tif (!f.endsWith(\".jsonl\")) continue\n\t\t\tunits.push({\n\t\t\t\tproject,\n\t\t\t\tsession: basename(f, \".jsonl\"),\n\t\t\t\tjsonlPath: join(dir, f),\n\t\t\t})\n\t\t}\n\t}\n\treturn units\n}\n\nexport function observationsPath(catalogDir: string, unit: Unit): string {\n\treturn join(catalogDir, unit.project, unit.session, \"observations.md\")\n}\n\nexport type UnitStatus =\n\t// hash matches the recorded source_sha256 — skipped without parsing\n\t| { kind: \"mined\" }\n\t| { kind: \"below-threshold\"; turns: number }\n\t| {\n\t\t\tkind: \"pending\"\n\t\t\treason: \"new\" | \"changed\"\n\t\t\tturns: number\n\t\t\tdigest: string\n\t\t\tsourceSha256: string\n\t }\n\t// transcript has an unparseable line; reported visibly, never mined\n\t| { kind: \"unreadable\"; error: string }\n\n// Pure decision core: everything already read, nothing left but judgment.\nexport function decideUnitStatus(input: {\n\tunit: Unit\n\tjsonl: Buffer\n\trecordedSha256: string | null\n\tminTurns: number\n}): UnitStatus {\n\tconst sourceSha256 = createHash(\"sha256\").update(input.jsonl).digest(\"hex\")\n\tif (input.recordedSha256 === sourceSha256) return { kind: \"mined\" }\n\tlet turns: string[]\n\ttry {\n\t\tturns = humanTurns(input.jsonl.toString(\"utf-8\"))\n\t} catch (e) {\n\t\treturn { kind: \"unreadable\", error: String(e) }\n\t}\n\tif (turns.length < input.minTurns)\n\t\treturn { kind: \"below-threshold\", turns: turns.length }\n\treturn {\n\t\tkind: \"pending\",\n\t\treason: input.recordedSha256 === null ? \"new\" : \"changed\",\n\t\tturns: turns.length,\n\t\tdigest: renderDigest(\n\t\t\t{\n\t\t\t\tsource: input.unit.jsonlPath,\n\t\t\t\tproject: input.unit.project,\n\t\t\t\tsession: input.unit.session,\n\t\t\t},\n\t\t\tturns,\n\t\t),\n\t\tsourceSha256,\n\t}\n}\n\n// Shell: read the unit's inputs, then decide purely.\nexport function unitStatus(unit: Unit, catalogDir: string, minTurns: number): UnitStatus {\n\tconst obsPath = observationsPath(catalogDir, unit)\n\treturn decideUnitStatus({\n\t\tunit,\n\t\tjsonl: readFileSync(unit.jsonlPath),\n\t\trecordedSha256: existsSync(obsPath)\n\t\t\t? readSourceSha256(readFileSync(obsPath, \"utf-8\"))\n\t\t\t: null,\n\t\tminTurns,\n\t})\n}\n\nexport interface ObservationsMeta {\n\tsource: string\n\tsourceSha256: string\n\tminedAt: string\n\tmodel: string\n\thumanTurns: number\n}\n\n// The host composes the final file: frontmatter it alone can vouch for, then\n// the agent's report verbatim.\nexport function composeObservationsFile(meta: ObservationsMeta, body: string): string {\n\treturn `---\nsource: ${meta.source}\nsource_sha256: ${meta.sourceSha256}\nmined_at: ${meta.minedAt}\nmodel: ${meta.model}\nhuman_turns: ${meta.humanTurns}\n---\n\n${body.trimEnd()}\n`\n}\n\nexport function readSourceSha256(observationsMd: string): string | null {\n\treturn observationsMd.match(/^source_sha256: ([0-9a-f]{64})$/m)?.[1] ?? null\n}\n","import { mkdirSync, mkdtempSync, writeFileSync } from \"node:fs\"\nimport { tmpdir } from \"node:os\"\nimport { dirname, join } from \"node:path\"\nimport PQueue from \"p-queue\"\nimport {\n\ttype AgentRun,\n\tprogressSink,\n\tresolveAgentCli,\n\tresolveAgentRun,\n} from \"./agent-cli.ts\"\nimport {\n\tcomposeObservationsFile,\n\tenumerateUnits,\n\tobservationsPath,\n\ttype Unit,\n\ttype UnitStatus,\n\tunitStatus,\n} from \"./catalog.ts\"\nimport { composeMinePrompt, PROMPT_FILE } from \"./contract.ts\"\nimport { runAgent } from \"./runner.ts\"\n\nexport interface MineOpts {\n\tprojects: string\n\tcatalog: string\n\tagent: string\n\t// Absent = the agent CLI's default for mining.\n\tmodel?: string\n\tparallel: number\n\tminTurns: number\n\tlimit?: number\n\tdryRun: boolean\n}\n\nexport interface Pending {\n\tunit: Unit\n\tstatus: Extract<UnitStatus, { kind: \"pending\" }>\n}\n\n// What one mine invocation will and won't do, decided purely from the\n// per-unit statuses.\nexport interface MinePlan {\n\ttodo: Pending[]\n\tpendingTotal: number\n\tmined: number\n\tbelowThreshold: number\n\tunreadable: { unit: Unit; error: string }[]\n}\n\nexport function planMine(\n\tentries: { unit: Unit; status: UnitStatus }[],\n\tlimit?: number,\n): MinePlan {\n\tconst pending = entries.filter((e): e is Pending => e.status.kind === \"pending\")\n\treturn {\n\t\ttodo: limit ? pending.slice(0, limit) : pending,\n\t\tpendingTotal: pending.length,\n\t\tmined: entries.filter((e) => e.status.kind === \"mined\").length,\n\t\tbelowThreshold: entries.filter((e) => e.status.kind === \"below-threshold\").length,\n\t\tunreadable: entries.flatMap((e) =>\n\t\t\te.status.kind === \"unreadable\"\n\t\t\t\t? [{ unit: e.unit, error: e.status.error }]\n\t\t\t\t: [],\n\t\t),\n\t}\n}\n\nexport function summarizeMinePlan(plan: MinePlan, minTurns: number): string {\n\tconst total =\n\t\tplan.pendingTotal + plan.mined + plan.belowThreshold + plan.unreadable.length\n\tconst limited =\n\t\tplan.todo.length !== plan.pendingTotal ? ` (mining ${plan.todo.length})` : \"\"\n\treturn `${total} transcripts: ${plan.pendingTotal} pending${limited}, ${plan.mined} mined, ${plan.belowThreshold} below ${minTurns} turns, ${plan.unreadable.length} unreadable`\n}\n\nexport function dryRunRow({ unit, status }: Pending): string {\n\treturn `${status.reason.padEnd(7)} ${status.turns.toString().padStart(4)} turns ${unit.project}/${unit.session}`\n}\n\nasync function mineOneUnit(\n\t{ unit, status }: Pending,\n\topts: MineOpts,\n\trun: AgentRun,\n): Promise<boolean> {\n\tconst tag = unit.session.slice(0, 8)\n\tconst workdir = mkdtempSync(join(tmpdir(), `doublecheck-mine-${tag}-`))\n\twriteFileSync(\n\t\tjoin(workdir, PROMPT_FILE),\n\t\tcomposeMinePrompt(status.digest, workdir, run.cli.writeToolPhrase),\n\t)\n\tconst spec = run.cli.agent({\n\t\tcredentials: run.credentials,\n\t\tmodel: run.model,\n\t\tworkdir,\n\t})\n\tprocess.stderr.write(\n\t\t`[${tag}] mining ${unit.project}/${unit.session} (${status.turns} turns, ${status.reason})\\n`,\n\t)\n\tconst outcome = await runAgent({\n\t\tmount: opts.projects,\n\t\tworkdir,\n\t\tspec,\n\t\tnetwork: { onlyDomains: run.cli.egressDomains },\n\t\tonLine: progressSink(tag, run.cli.describeStreamLine),\n\t})\n\t// A failed mine writes NOTHING — the catalog is a durable asset; the next\n\t// run retries this unit because no hash gets recorded.\n\tif (!outcome.ok) {\n\t\tprocess.stderr.write(`[${tag}] FAILED (${outcome.reason})\\n`)\n\t\treturn false\n\t}\n\tconst obsPath = observationsPath(opts.catalog, unit)\n\tmkdirSync(dirname(obsPath), { recursive: true })\n\twriteFileSync(\n\t\tobsPath,\n\t\tcomposeObservationsFile(\n\t\t\t{\n\t\t\t\tsource: unit.jsonlPath,\n\t\t\t\tsourceSha256: status.sourceSha256,\n\t\t\t\tminedAt: new Date().toISOString(),\n\t\t\t\tmodel: run.model,\n\t\t\t\thumanTurns: status.turns,\n\t\t\t},\n\t\t\toutcome.report,\n\t\t),\n\t)\n\tprocess.stderr.write(`[${tag}] observations: ${obsPath}\\n`)\n\treturn true\n}\n\n// The mine workflow shell: gather statuses (I/O), plan purely, then either\n// print the plan (dry-run) or run one sandboxed agent per pending unit.\n// Returns true when nothing it attempted failed.\nexport async function runMine(opts: MineOpts): Promise<boolean> {\n\t// Validate the agent name before the dry-run/nothing-pending short-circuits\n\t// so a bad --agent errors on every invocation; the credentials preflight\n\t// stays below them (a dry run must not require credentials).\n\tresolveAgentCli(opts.agent)\n\tconst entries = enumerateUnits(opts.projects).map((unit) => ({\n\t\tunit,\n\t\tstatus: unitStatus(unit, opts.catalog, opts.minTurns),\n\t}))\n\tconst plan = planMine(entries, opts.limit)\n\tfor (const { unit, error } of plan.unreadable) {\n\t\tprocess.stderr.write(`UNREADABLE ${unit.project}/${unit.session}: ${error}\\n`)\n\t}\n\tprocess.stderr.write(`${summarizeMinePlan(plan, opts.minTurns)}\\n`)\n\n\tif (opts.dryRun) {\n\t\tfor (const pending of plan.todo) console.log(dryRunRow(pending))\n\t\treturn true\n\t}\n\tif (plan.todo.length === 0) return true\n\n\tconst run = resolveAgentRun(opts.agent, opts.model, \"mine\")\n\tconst queue = new PQueue({ concurrency: opts.parallel })\n\tconst results = await Promise.all(\n\t\tplan.todo.map((p) => queue.add(() => mineOneUnit(p, opts, run))),\n\t)\n\tconst failed = results.filter((ok) => ok !== true).length\n\tprocess.stderr.write(\n\t\t`mined ${results.length - failed}/${results.length}${failed ? `, ${failed} FAILED` : \"\"}\\n`,\n\t)\n\treturn failed === 0\n}\n","#!/usr/bin/env node\nimport { homedir } from \"node:os\"\nimport { join, resolve } from \"node:path\"\nimport { Command } from \"commander\"\nimport { runChecks } from \"./check.ts\"\nimport { runMine } from \"./mine.ts\"\n\nfunction parsePositiveInt(flag: string) {\n\treturn (v: string): number => {\n\t\tconst n = Number.parseInt(v, 10)\n\t\tif (!Number.isInteger(n) || n < 1)\n\t\t\tthrow new Error(`${flag} must be a positive integer, got \"${v}\"`)\n\t\treturn n\n\t}\n}\n\nconst collect = (v: string, prev: string[]): string[] => [...prev, v]\n\nconst program = new Command()\n\t.name(\"doublecheck\")\n\t.description(\n\t\t\"Run self-authored LLM code-inspectors (checks) against a target tree, one sandboxed agent per check\",\n\t)\n\nprogram\n\t.command(\"check\")\n\t.option(\"--target <dir>\", \"tree under inspection, mounted read-only\", process.cwd())\n\t.option(\n\t\t\"--checks-dir <dir>\",\n\t\t\"checks directory (repeatable; default: $TARGET/.agents/checks)\",\n\t\tcollect,\n\t\t[] as string[],\n\t)\n\t.option(\n\t\t\"--context <file>\",\n\t\t\"run-context file spliced into every inspector's prompt (intent, nuances, sanctioned exceptions, scope)\",\n\t)\n\t.option(\n\t\t\"--agent <name>\",\n\t\t\"agent CLI that runs the inspectors: claude or codex\",\n\t\t\"claude\",\n\t)\n\t.option(\n\t\t\"--model <model>\",\n\t\t\"model for the inspector agents (default per agent: claude haiku, codex gpt-5.6-sol)\",\n\t)\n\t.option(\"--parallel <n>\", \"max concurrent checks\", parsePositiveInt(\"--parallel\"), 4)\n\t.option(\"--output <dir>\", \"reports root (default: $TARGET/.doublecheck)\")\n\t.option(\"--check <name>\", \"run only this check (repeatable)\", collect, [] as string[])\n\t.option(\n\t\t\"--save-jsonl\",\n\t\t\"persist each inspector's raw stream-json beside its report (audit trail)\",\n\t)\n\t.action(async (opts) => {\n\t\tconst target = resolve(opts.target)\n\t\tconst checksDirs: string[] =\n\t\t\topts.checksDir.length > 0\n\t\t\t\t? opts.checksDir.map((d: string) => resolve(d))\n\t\t\t\t: [join(target, \".agents\", \"checks\")]\n\t\tconst ok = await runChecks({\n\t\t\ttarget,\n\t\t\tchecksDirs,\n\t\t\tcontextFile: opts.context ? resolve(opts.context) : null,\n\t\t\tagent: opts.agent,\n\t\t\tmodel: opts.model,\n\t\t\tparallel: opts.parallel,\n\t\t\toutput: opts.output ? resolve(opts.output) : join(target, \".doublecheck\"),\n\t\t\tonly: opts.check,\n\t\t\tsaveJsonl: !!opts.saveJsonl,\n\t\t})\n\t\tif (!ok) process.exitCode = 1\n\t})\n\nprogram\n\t.command(\"mine\")\n\t.option(\n\t\t\"--projects <dir>\",\n\t\t\"Claude Code transcripts root\",\n\t\tjoin(homedir(), \".claude\", \"projects\"),\n\t)\n\t.option(\n\t\t\"--catalog <dir>\",\n\t\t\"observation catalog root\",\n\t\tjoin(homedir(), \".doublecheck\", \"catalog\"),\n\t)\n\t.option(\"--agent <name>\", \"agent CLI that runs the miners: claude or codex\", \"claude\")\n\t.option(\n\t\t\"--model <model>\",\n\t\t\"model for the mining agents (default per agent: claude opus, codex gpt-5.6-sol — a bad-model mine pollutes a durable asset)\",\n\t)\n\t.option(\"--parallel <n>\", \"max concurrent miners\", parsePositiveInt(\"--parallel\"), 4)\n\t.option(\n\t\t\"--min-turns <n>\",\n\t\t\"min genuine human turns for a real conversation\",\n\t\tparsePositiveInt(\"--min-turns\"),\n\t\t2,\n\t)\n\t.option(\"--limit <n>\", \"mine at most N pending units\", parsePositiveInt(\"--limit\"))\n\t.option(\"--dry-run\", \"list what would be mined without booting anything\")\n\t.action(async (opts) => {\n\t\tconst ok = await runMine({\n\t\t\tprojects: resolve(opts.projects),\n\t\t\tcatalog: resolve(opts.catalog),\n\t\t\tagent: opts.agent,\n\t\t\tmodel: opts.model,\n\t\t\tparallel: opts.parallel,\n\t\t\tminTurns: opts.minTurns,\n\t\t\tlimit: opts.limit,\n\t\t\tdryRun: !!opts.dryRun,\n\t\t})\n\t\tif (!ok) process.exitCode = 1\n\t})\n\nprogram.parseAsync().catch((e: unknown) => {\n\tconsole.error(e instanceof Error ? e.message : String(e))\n\tprocess.exit(1)\n})\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,cAAc;AAG3B,M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CAChB,CAAC,GACQ,QAAQ,WAAW;AAC7B,CAAC;AAEF,QAAQ,WAAW,CAAC,CAAC,OAAO,MAAe;CAC1C,QAAQ,MAAM,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;CACxD,QAAQ,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alizain/doublecheck",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Run self-authored LLM code-inspectors against a project — one sandboxed microVM agent per check, one markdown report each",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.5.1",
|