Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Handoff leftovers: the L3 draft's branch, and this work's scripts (#1071)

Dee1987fa238c00
diff --git a/cli/scripts/handoff-2026-10-08/README.md b/cli/scripts/handoff-2026-10-08/README.md
new file mode 100644
index 000000000..fc75959f1
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/README.md
@@ -0,0 +1,15 @@
+# Scripts from the daemon separation (2026-10-08)
+
+Kept for the next session; see `docs/research/2026-10-08-daemon-separation-handoff.md`. Node on PATH, run from anywhere.
+
+- **`closure.mjs`** measures the core's static import closure (esbuild from `core/main.ts`, every `import()` external): lines, files, and the biggest contributors.
+- **`importers.mjs <cli dir> <regex>`** shows who imports each matching file in that closure, to find the edge that pulls something in.
+- **`mutate*.py <cli dir>`** each flip one wiring point at a time (a call site, a declared rule, an engine branch), run that step's golden, and expect it to fail. That is how each move's golden was shown to catch broken wiring. One script per step: admission, adoption, hooks, identity, runtime, transcripts. `mutate.py` is the first, for launch argv.
+- **`land-direct.sh <worktree> <branch> <pr>`** lands a PR as described in the handoff:
+ - marks it ready;
+ - merges main in when main moved;
+ - waits for every check on the head, `ci/required` included;
+ - then runs `make merge-pr` with the reviewed head and base.
+
+ The worktree may be detached at the PR's head.
+- **`main-health.sh`** runs on each new `origin/main` commit: tsc, `architecture.spec.ts`, and the 100% gates (`test:core`, `test:harnessd`, `test:local-models`, `test:resume`). It prints one line, `MAIN <sha> OK` or `MAIN <sha> FAIL: <gates>`. It expects a detached worktree named `main-health` beside it, with `cli/node_modules` installed. Unset `TMUX` and `TMUX_PANE` first.
diff --git a/cli/scripts/handoff-2026-10-08/closure.mjs b/cli/scripts/handoff-2026-10-08/closure.mjs
new file mode 100644
index 000000000..617b71242
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/closure.mjs
@@ -0,0 +1,22 @@
+// Measure the core's static import closure: esbuild from core/main.ts, every import() external.
+// Usage: node closure.mjs <cli dir> [--list]
+import { createRequire } from 'node:module'
+const { build } = createRequire(process.argv[2] + '/package.json')('esbuild')
+import { readFileSync } from 'node:fs'
+import { join, relative } from 'node:path'
+const cli = process.argv[2]
+const src = join(cli, 'src')
+const result = await build({
+ absWorkingDir: cli, entryPoints: ['src/core/main.ts'], bundle: true, platform: 'node', format: 'esm',
+ packages: 'external', metafile: true, write: false, logLevel: 'error',
+ plugins: [{ name: 'dyn', setup(b) { b.onResolve({ filter: /.*/ }, a => a.kind === 'dynamic-import' ? { path: a.path, external: true } : undefined) } }],
+})
+const files = Object.keys(result.metafile.inputs).filter(f => f.startsWith('src/'))
+let lines = 0
+const per = []
+for (const f of files) { const n = readFileSync(join(cli, f), 'utf8').split('\n').length; lines += n; per.push([f.slice(4), n]) }
+const others = /^(engines\/(opencode|cursor|kilo|devin|hermes|amp|agy|grok|copilot|commandcode|muse|pi)\/|lib\/sessionSearch\/externals\/(opencode|cursor|kilo|devin|hermes|amp|agy|grok|copilot|commandcode|muse|pi)\.ts$|lib\/(hooks|questionPane|legacyScreen|legacyPane|hermesHome|databaseHistory|transcriptReader)\.ts$|engines\/kit\/screen\.ts$|core\/engines\/cursorTasks\.ts$|core\/turns\/agyBackstop\.ts$|core\/transcripts\/databaseHistory\.ts$)/
+const theirs = per.filter(([f]) => others.test(f))
+console.log(JSON.stringify({ lines, files: files.length, theirLines: theirs.reduce((s, [, n]) => s + n, 0), theirFiles: theirs.length }))
+if (process.argv.includes('--list')) for (const [f, n] of per.sort()) console.log(n, f)
+if (process.argv.includes('--theirs')) for (const [f, n] of theirs.sort()) console.log(n, f)
diff --git a/cli/scripts/handoff-2026-10-08/importers.mjs b/cli/scripts/handoff-2026-10-08/importers.mjs
new file mode 100644
index 000000000..e3cb4b793
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/importers.mjs
@@ -0,0 +1,15 @@
+// Who imports each file in the core closure. Usage: node importers.mjs <cli dir> <regex>
+import { createRequire } from 'node:module'
+const { build } = createRequire(process.argv[2] + '/package.json')('esbuild')
+const re = new RegExp(process.argv[3])
+const result = await build({
+ absWorkingDir: process.argv[2], entryPoints: ['src/core/main.ts'], bundle: true, platform: 'node', format: 'esm',
+ packages: 'external', metafile: true, write: false, logLevel: 'error',
+ plugins: [{ name: 'dyn', setup(b) { b.onResolve({ filter: /.*/ }, a => a.kind === 'dynamic-import' ? { path: a.path, external: true } : undefined) } }],
+})
+const by = new Map()
+for (const [file, info] of Object.entries(result.metafile.inputs)) for (const imp of info.imports) {
+ if (!imp.path.startsWith('src/')) continue
+ if (!by.has(imp.path)) by.set(imp.path, new Set()); by.get(imp.path).add(file.slice(4))
+}
+for (const [file, from] of [...by].sort()) if (re.test(file.slice(4))) console.log(file.slice(4), '<-', [...from].join(', '))
diff --git a/cli/scripts/handoff-2026-10-08/land-direct.sh b/cli/scripts/handoff-2026-10-08/land-direct.sh
new file mode 100755
index 000000000..3a347340f
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/land-direct.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# land-direct.sh <worktree> <branch> <pr>: mark ready, wait for ci/required on the head, merge with make merge-pr;
+# when main moved past the head's base, merge main in, push, and go again. Prints MERGED <sha> or why not.
+set -u
+W=$1; B=$2; PR=$3; R=autonomous-ai/openharness
+
+cd "$W" || exit 1
+git fetch -q origin
+# The worktree is on the PR's branch, or on its pushed head (a detached landing worktree); pushes go to the PR's branch.
+[ "$(git branch --show-current)" = "$B" ] || [ "$(git rev-parse HEAD)" = "$(git rev-parse "origin/$B")" ] || { echo "worktree is not on $B"; exit 1; }
+gh pr ready "$PR" --repo $R >/dev/null 2>&1
+for attempt in 1 2 3 4; do
+ git fetch -q origin
+ if ! git merge-base --is-ancestor origin/main HEAD; then
+ git merge -q --no-edit origin/main || { echo "MERGE CONFLICT with main"; git merge --abort; exit 2; }
+ git push -q origin "HEAD:refs/heads/$B" || { echo "PUSH FAILED"; exit 3; }
+ fi
+ head=$(git rev-parse HEAD)
+ [ "$(gh pr view "$PR" --repo $R --json headRefOid --jq .headRefOid)" = "$head" ] || { git push -q origin "HEAD:refs/heads/$B"; sleep 5; }
+ sleep 45
+ # Every check on this head finished, and ci/required among them: a draft run's failed ci/required can sit beside
+ # the ready run's pending checks, and only the finished set says which one stands.
+ s=""
+ for i in $(seq 1 120); do
+ pending=$(gh pr view "$PR" --repo $R --json headRefOid,statusCheckRollup --jq 'select(.headRefOid=="'"$head"'") | [.statusCheckRollup[] | select((.status // "COMPLETED") != "COMPLETED" or ((.state // "") == "PENDING"))] | length' 2>/dev/null)
+ s=$(gh pr view "$PR" --repo $R --json headRefOid,statusCheckRollup --jq 'select(.headRefOid=="'"$head"'") | [.statusCheckRollup[] | select(.name=="ci/required") | (.conclusion // .state // .status)] | if index("SUCCESS") then "SUCCESS" else last end' 2>/dev/null)
+ [ "${pending:-1}" = "0" ] && [ -n "$s" ] && [ "$s" != "null" ] && break
+ sleep 60
+ done
+ case "$s" in SUCCESS) ;; *) echo "CI NOT PASSED on $head: $s"; gh pr checks "$PR" --repo $R 2>&1 | grep -vE "skipping|pass" | head -8; exit 5;; esac
+ git fetch -q origin
+ if ! git merge-base --is-ancestor origin/main "$head"; then echo "main moved during CI; again"; continue; fi
+ out=$(make merge-pr ARGS="$PR --reviewed-head $head --reviewed-base $(git rev-parse origin/main) --merge" 2>&1)
+ state=$(gh pr view "$PR" --repo $R --json state,mergeCommit --jq '"\(.state) \(.mergeCommit.oid // "")"')
+ case "$state" in MERGED*) echo "$state"; exit 0;; esac
+ echo "MERGE REFUSED: $(echo "$out" | tail -2 | tr '\n' ' ')"
+done
+echo "GAVE UP"; exit 7
diff --git a/cli/scripts/handoff-2026-10-08/main-health.sh b/cli/scripts/handoff-2026-10-08/main-health.sh
new file mode 100755
index 000000000..d1819a06d
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/main-health.sh
@@ -0,0 +1,21 @@
+#!/bin/zsh
+# On each new origin/main commit: tsc, architecture, and the 100% gates. One line per commit: MAIN <sha> OK | FAIL: <gates>.
+S=${0:A:h}; W=$S/main-health; unset TMUX TMUX_PANE
+last=$(cat $S/mh-last 2>/dev/null)
+while true; do
+ git -C $W fetch -q origin 2>/dev/null
+ head=$(git -C $W rev-parse --short origin/main)
+ if [[ $head != $last ]]; then
+ git -C $W checkout -q --detach origin/main
+ fails=()
+ (cd $W/cli && npx tsc --noEmit -p . > $S/mh-tsc.log 2>&1) || fails+=(tsc)
+ (cd $W/cli && npx vitest run src/architecture.spec.ts > $S/mh-arch.log 2>&1) || fails+=(architecture)
+ for g in test:core test:harnessd test:local-models test:resume; do
+ (cd $W/cli && npm run -s $g > "$S/mh-$g.log" 2>&1) || (cd $W/cli && npm run -s $g > "$S/mh-$g.log" 2>&1) || fails+=($g)
+ done
+ subject=$(git -C $W log -1 --format=%s | cut -c1-60)
+ if (( ${#fails} )); then echo "MAIN $head FAIL: ${fails[*]} ($subject)"; else echo "MAIN $head OK"; fi
+ last=$head; echo $last > $S/mh-last
+ fi
+ sleep 60
+done
diff --git a/cli/scripts/handoff-2026-10-08/mutate-admission.py b/cli/scripts/handoff-2026-10-08/mutate-admission.py
new file mode 100644
index 000000000..c11fd2cf1
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/mutate-admission.py
@@ -0,0 +1,31 @@
+# Flip one declared rule or call site at a time and check the admission golden fails.
+import subprocess, sys, os
+cli = sys.argv[1]
+C = 'src/engines/hermes/contract.ts'
+H = 'src/hookServer.ts'
+D = 'src/lib/terminalAgentDiscovery.ts'
+K = 'src/engines/kit/storeSource.ts'
+M = [
+ ('hook server: default home only', H, "const homes = await listStoreHomes(HERMES_HOMES, env.HERMES_HOME)", "const homes = [env.HERMES_HOME]"),
+ ('hook server: every source interactive', H, "if (!isInteractiveSource(HERMES_SOURCE, source)) {", "if (false) {"),
+ ('contract: tui not interactive', C, "interactive: ['', 'cli', 'tui'],", "interactive: ['', 'cli'],"),
+ ('contract: no source not interactive', C, "interactive: ['', 'cli', 'tui'],", "interactive: ['cli', 'tui'],"),
+ ('contract: another column', C, "column: 'source',", "column: 'cwd',"),
+ ('contract: no profiles', C, "max: 64,", "max: 0,"),
+ ('contract: another store', C, "store: hermesDbPath,", "store: (home) => join(home, 'state.sqlite'),"),
+ ('contract: profiles folder', C, "profiles: 'profiles',", "profiles: 'profile',"),
+ ('kit: unread row is no row', K, "if (!result.ok) return ''", "if (!result.ok) return null"),
+ ('kit: absent row is a pane own', K, "if (result.rows.length === 0) return null", "if (result.rows.length === 0) return ''"),
+ ('discovery: home not probed', D, "? await (await loadEngine('hermes'))?.probeHermesHome(agent.processIdentity, agent.engine)", "? null"),
+ ('discovery: no probe when unreadable', D, "? await (await loadEngine('hermes'))?.probeHermesHome(agent.processIdentity, agent.engine)", "? await (await loadEngine('hermes'))?.probeHermesHome(agent.processIdentity, agent.engine) ?? null"),
+]
+for name, path, old, new in M:
+ p = os.path.join(cli, path)
+ s = open(p).read()
+ assert s.count(old) == 1, (name, s.count(old))
+ open(p, 'w').write(s.replace(old, new))
+ try:
+ r = subprocess.run(['node', 'node_modules/vitest/vitest.mjs', 'run', 'src/engines/otherAdmission.golden.spec.ts'], cwd=cli, capture_output=True, text=True, env={**os.environ, 'TZ': 'UTC', 'TMPDIR': '/tmp'})
+ print(f"{name:45s} {'FAILS (caught)' if r.returncode else 'PASSES (NOT caught)'}", flush=True)
+ finally:
+ open(p, 'w').write(s)
diff --git a/cli/scripts/handoff-2026-10-08/mutate-adoption.py b/cli/scripts/handoff-2026-10-08/mutate-adoption.py
new file mode 100644
index 000000000..66f2da728
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/mutate-adoption.py
@@ -0,0 +1,25 @@
+# Flip one piece of the adoption wiring at a time and check the adoption golden fails.
+import subprocess, sys, os
+cli = sys.argv[1]
+I = 'src/lib/sessionSearch/externals/index.ts'
+M = [
+ ('owners never asked', I, "owners: async (view) => await (await reader())?.owners?.(view) ?? [],", "owners: async () => [],"),
+ ('busy never answered', I, "busy: async (owner) => await (await reader())?.busy?.(owner) ?? null,", "busy: async () => null,"),
+ ('a new reader per call', I, "provider ??= loadEngine(name)", "provider = loadEngine(name)"),
+ ('kilo reads opencode store', I, "code.opencodeProvider({ engine: 'kilo', dbPath: paths.kiloDb })", "code.opencodeProvider({ engine: 'kilo', dbPath: paths.opencodeDb })"),
+ ('pi loses its moved folder', I, "...(paths.piSessionDir ? { sessionDir: paths.piSessionDir } : {})", ""),
+ ('cursor without its data folder', I, "dataDir: paths.cursorDataDir }", "dataDir: paths.cursorConfigDir }"),
+ ('grok as muse', I, "loaded('grok', 'grok',", "loaded('grok', 'muse',"),
+ ('devin unloaded', I, "loaded('devin', 'devin', (code) => code.devinProvider({ home: paths.devinHome })),", ""),
+ ('agy unloaded', I, "loaded('agy', 'agy', (code) => code.agyProvider({ home: paths.agyHome })),", ""),
+]
+for name, path, old, new in M:
+ p = os.path.join(cli, path)
+ s = open(p).read()
+ assert s.count(old) == 1, (name, s.count(old))
+ open(p, 'w').write(s.replace(old, new))
+ try:
+ r = subprocess.run(['node', 'node_modules/vitest/vitest.mjs', 'run', 'src/engines/otherAdoption.golden.spec.ts'], cwd=cli, capture_output=True, text=True, env={**os.environ, 'TZ': 'UTC', 'TMPDIR': '/tmp'})
+ print(f"{name:45s} {'FAILS (caught)' if r.returncode else 'PASSES (NOT caught)'}", flush=True)
+ finally:
+ open(p, 'w').write(s)
diff --git a/cli/scripts/handoff-2026-10-08/mutate-hooks.py b/cli/scripts/handoff-2026-10-08/mutate-hooks.py
new file mode 100644
index 000000000..b145bedf8
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/mutate-hooks.py
@@ -0,0 +1,28 @@
+# Flip one installer's behavior at a time and check the hooks golden fails. Usage: python3 mutate-hooks.py <cli dir>
+import subprocess, sys, os
+cli = sys.argv[1]
+H = 'src/lib/hooks.ts'
+M = [
+ ('grok: StopFailure dropped', H, "'UserPromptSubmit', 'StopFailure'] as const", "'UserPromptSubmit'] as const"),
+ ('agy: handler timeout', H, "--agy-event ${event}`, timeout: 10 })", "--agy-event ${event}`, timeout: 11 })"),
+ ('copilot: sessionEnd dropped', H, " sessionEnd: [handler('sessionEnd')],\n", ""),
+ ('cursor: failClosed', H, "const canonical: CursorHook = { command: cmd, failClosed: false }", "const canonical: CursorHook = { command: cmd, failClosed: true }"),
+ ('kilo: product name', H, "const product = engine === 'kilo' ? 'Kilo' : 'OpenCode'", "const product = engine === 'kilo' ? 'kilo' : 'OpenCode'"),
+ ('commandcode: PreToolUse dropped', H, "const COMMANDCODE_EVENTS = ['SessionStart', 'PreToolUse', 'Stop'] as const", "const COMMANDCODE_EVENTS = ['SessionStart', 'Stop'] as const"),
+ ('devin: SessionEnd dropped', H, "const DEVIN_EVENTS = ['SessionStart', 'UserPromptSubmit', 'Stop', 'SessionEnd'] as const", "const DEVIN_EVENTS = ['SessionStart', 'UserPromptSubmit', 'Stop'] as const"),
+ ('hermes: block timeout', H, "\\n timeout: 10`)", "\\n timeout: 5`)"),
+ ('pi: turn_end handler', H, 'pi.on("turn_end", async (_event, ctx) => { await register(ctx); });', ''),
+ ('amp: sessions folder mode', H, "mkdirSync(env.AMP_SESSIONS_DIR, { recursive: true, mode: 0o700 })", "mkdirSync(env.AMP_SESSIONS_DIR, { recursive: true, mode: 0o755 })"),
+ ('opencode: version gate', H, "if (opencodeMajorVersion() === 1) {", "if ((opencodeMajorVersion() ?? 0) >= 1) {"),
+ ('loader mapping: kilo runs OpenCode\'s', 'src/core/engines/hooks.ts', "['kilo', (installers) => installers.installKiloPlugin],", "['kilo', (installers) => installers.installOpencodePlugin],"),
+]
+for name, path, old, new in M:
+ p = os.path.join(cli, path)
+ s = open(p).read()
+ assert s.count(old) == 1, (name, s.count(old))
+ open(p, 'w').write(s.replace(old, new))
+ try:
+ r = subprocess.run(['node', 'node_modules/vitest/vitest.mjs', 'run', 'src/engines/otherHooks.golden.spec.ts'], cwd=cli, capture_output=True, text=True)
+ print(f"{name:45s} {'FAILS (caught)' if r.returncode else 'PASSES (NOT caught)'}", flush=True)
+ finally:
+ open(p, 'w').write(s)
diff --git a/cli/scripts/handoff-2026-10-08/mutate-identity.py b/cli/scripts/handoff-2026-10-08/mutate-identity.py
new file mode 100644
index 000000000..b55088e37
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/mutate-identity.py
@@ -0,0 +1,37 @@
+# Flip one lazy call site or declared layout at a time and check the identity golden fails.
+import subprocess, sys, os
+cli = sys.argv[1]
+B = 'src/core/agents/bind.ts'
+R = 'src/lib/sessionRepair.ts'
+M = [
+ ('bind: cursor finder ignored', B, "return cursor && cursor.findCursorTranscript(cursor.cursorDataDir(), sessionId)", "return null"),
+ ('bind: grok cwd lost', B, "return grok && grok.findGrokTranscript(homes.grok, cwd, sessionId)", "return grok && grok.findGrokTranscript(homes.grok, '/', sessionId)"),
+ ('bind: agy finder ignored', B, "return agy && agy.findAgyTranscript(homes.agy, sessionId)", "return null"),
+ ('bind: copilot finder ignored', B, "return copilot && copilot.findCopilotTranscript(homes.copilot, sessionId)", "return null"),
+ ('bind: copilot /resume not followed', B, "const current = await copilot.copilotSessionForPid(homes.copilot, observed.processIdentity.pid)", "const current = null as string | null"),
+ ('repair: muse run ignored', R, "if (!hasRun(lines, muse.museEvent)) return null", ""),
+ ('repair: muse workspace lost', R, "const root = muse.museWorkspaceRoot(lines[0] ?? '')", "const root = null as string | null"),
+ ('repair: hermes default home only', R, "const homes = await listStoreHomes(HERMES_HOMES, env.HERMES_HOME)", "const homes = [env.HERMES_HOME]"),
+ ('repair: copilot lock ignored', R, "const locked = opts?.pid ? await copilot.copilotSessionForPid(env.COPILOT_HOME, opts.pid) : null", "const locked = null as string | null"),
+ ('repair: copilot cwd lost', R, "return copilotDirectoryScan(cwd, startedAtMs, opts, copilot.copilotSessionCwd)", "return copilotDirectoryScan(cwd, startedAtMs, opts, () => null)"),
+ ('repair: agy pid ignored', R, "return opts?.pid ? agySession(opts.pid) : null", "return null"),
+ ('repair: agy transcript lost', R, "const transcriptPath = await agy.findAgyTranscript(env.AGY_HOME, conversationId)", "const transcriptPath = null as string | null"),
+ ('repair: pi folder wrong', R, "const directory = join(env.PI_HOME, 'agent', 'sessions', piSessionFolder(opts.cwd))", "const directory = join(env.PI_HOME, 'agent', 'sessions', piSessionFolder('/'))"),
+ ('contract: agy layout', 'src/engines/agy/contract.ts', "'transcript_full.jsonl')", "'transcript.jsonl')"),
+ ('contract: copilot layout', 'src/engines/copilot/contract.ts', "join(copilotHome, 'session-state', sessionId, 'events.jsonl')", "join(copilotHome, 'session-state', sessionId + '.jsonl')"),
+ ('contract: commandcode slug', 'src/engines/commandcode/contract.ts', "return slugify(cwd) || 'root'", "return slugify(cwd, { decamelize: false }) || 'root'"),
+ ('contract: cursor data dir env ignored', 'src/engines/cursor/contract.ts', "return vars.CURSOR_DATA_DIR?.trim() || env.CURSOR_HOME", "return env.CURSOR_HOME"),
+ ('contract: cursor config XDG ignored', 'src/engines/cursor/contract.ts', "(vars.XDG_CONFIG_HOME?.trim() ? join(vars.XDG_CONFIG_HOME.trim(), 'cursor') : env.CURSOR_HOME)", "env.CURSOR_HOME"),
+ ('contract: hermes store name', 'src/engines/hermes/contract.ts', "return join(home, 'state.db')", "return join(home, 'state.sqlite')"),
+ ('contract: hermes ids narrowed', 'src/engines/hermes/contract.ts', "|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/", ")$/"),
+]
+for name, path, old, new in M:
+ p = os.path.join(cli, path)
+ s = open(p).read()
+ assert s.count(old) == 1, (name, s.count(old))
+ open(p, 'w').write(s.replace(old, new))
+ try:
+ r = subprocess.run(['node', 'node_modules/vitest/vitest.mjs', 'run', 'src/engines/otherIdentity.golden.spec.ts'], cwd=cli, capture_output=True, text=True, env={**os.environ, 'TZ': 'UTC', 'TMPDIR': '/tmp'})
+ print(f"{name:45s} {'FAILS (caught)' if r.returncode else 'PASSES (NOT caught)'}", flush=True)
+ finally:
+ open(p, 'w').write(s)
diff --git a/cli/scripts/handoff-2026-10-08/mutate-runtime.py b/cli/scripts/handoff-2026-10-08/mutate-runtime.py
new file mode 100644
index 000000000..ed0baf973
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/mutate-runtime.py
@@ -0,0 +1,30 @@
+# Flip one engine's runtime-profile reading at a time and check the runtime golden fails.
+import subprocess, sys, os
+cli = sys.argv[1]
+M_ = 'src/lib/runtimeProfileManager.ts'
+E = lambda e: f'src/engines/{e}/runtimeProfile.ts'
+M = [
+ ('pi footer read as grok', M_, "engineNow('pi', 'its pane was read')?.parsePiFooterProfile(paneText)", "engineNow('grok', 'x')?.parseGrokFooterProfile(paneText)"),
+ ('grok footer ignored', M_, "engineNow('grok', 'its pane was read')?.parseGrokFooterProfile(paneText)", "null"),
+ ('agy footer ignored', M_, "engineNow('agy', 'its pane was read')?.parseAgyFooterProfile(paneText)", "null"),
+ ('devin footer ignored', M_, "engineNow('devin', 'its pane was read')?.devinFooterModel(paneText)", "null"),
+ ('hermes status ignored', M_, "engineNow('hermes', 'its pane was read')?.hermesStatusModel(paneText)", "null"),
+ ('commandcode banner ignored', M_, "engineNow('commandcode', 'its pane was read')?.commandcodeBannerModel(paneText)", "null"),
+ ('opencode footer without catalog', M_, "opencode?.opencodeFooterModelId(paneText, this.opencodeCatalogCache?.entries ?? [])", "opencode?.opencodeFooterModelId(paneText, [])"),
+ ('kilo footer without catalog', M_, "?.kiloFooterModelId(paneText, this.kiloCatalogCache?.entries ?? [])", "?.kiloFooterModelId(paneText, [])"),
+ ('hermes config effort', M_, " state.effort = parsed.effort ?? 'auto'\n state.observedAt = Date.now()\n const after = this.selectedModel(session)\n this.wake(session.sessionId)\n if (!silent && this.suppressNotifications === 0 && before !== after && !this.controls.has(session.sessionId)) {\n this.scheduleChanged(session.sessionId)\n }\n return before !== after\n }\n if (session.engine === 'muse') {", " state.effort = 'auto'\n state.observedAt = Date.now()\n const after = this.selectedModel(session)\n this.wake(session.sessionId)\n if (!silent && this.suppressNotifications === 0 && before !== after && !this.controls.has(session.sessionId)) {\n this.scheduleChanged(session.sessionId)\n }\n return before !== after\n }\n if (session.engine === 'muse') {"),
+ ('muse settings ignored', M_, "muse.parseMuseSettings(await readText(join(env.MUSE_CONFIG_DIR, 'settings.json')))", "muse.parseMuseSettings('')"),
+ ('amp session ignored', M_, "amp.parseAmpSession(await readText(join(env.AMP_STATE_DIR, 'session.json')))", "amp.parseAmpSession('')"),
+ ('devin catalog empty', M_, " entries = devin.parseDevinModelsOutput(result.stdout)", " entries = devin.parseDevinModelsOutput('')"),
+ ('cursor footer (manager own code)', M_, "const parsed = footerLines.map(parseCursorFooter).find((item) => item !== null)", "const parsed = null as ReturnType<typeof parseCursorFooter>"),
+]
+for name, path, old, new in M:
+ p = os.path.join(cli, path)
+ s = open(p).read()
+ assert s.count(old) == 1, (name, s.count(old))
+ open(p, 'w').write(s.replace(old, new))
+ try:
+ r = subprocess.run(['node', 'node_modules/vitest/vitest.mjs', 'run', 'src/engines/otherRuntime.golden.spec.ts'], cwd=cli, capture_output=True, text=True)
+ print(f"{name:45s} {'FAILS (caught)' if r.returncode else 'PASSES (NOT caught)'}", flush=True)
+ finally:
+ open(p, 'w').write(s)
diff --git a/cli/scripts/handoff-2026-10-08/mutate-transcripts.py b/cli/scripts/handoff-2026-10-08/mutate-transcripts.py
new file mode 100644
index 000000000..3f949f50d
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/mutate-transcripts.py
@@ -0,0 +1,30 @@
+# Flip one engine's transcript handling at a time and check the transcripts golden fails.
+import subprocess, sys, os
+cli = sys.argv[1]
+I, A, H, L = 'src/core/transcripts/ingest.ts', 'src/core/transcripts/attach.ts', 'src/core/transcripts/history.ts', 'src/core/transcripts/lastTurn.ts'
+ONLY = sys.argv[2:]
+M = [
+ ('ingest: muse lines through pi', I, "normalizer = new muse.MuseNormalizer()", "normalizer = new (engineNow('pi', 'x')!).PiNormalizer('live') as never"),
+ ('ingest: commandcode run error unannounced', I, "const runError = commandcode?.commandCodeRunError(evt.text) ?? null", "const runError = null as string | null"),
+ ('attach: agy idle close skipped', A, "if (historyTurnOpen && capture && agy.agyPaneIdle(capture)) {", "if (false) {"),
+ ('attach: copilot history-open check skipped', A, "if (historyTurnOpen && !copilot.copilotHistoryTurnOpen(lines)) {", "if (false) {"),
+ ('attach: cursor normalizer in history mode', A, ".CursorNormalizer('live', session.sessionId)", ".CursorNormalizer('history' as never, session.sessionId)"),
+ ('attach: pi in replay mode', A, "PiNormalizer('live')", "PiNormalizer('replay' as never)"),
+ ('history: grok replays as raw lines', H, "wholeHistoryPage(engine('grok').grokMessagesToEvents(lines), false).events", "wholeHistoryPage(messagesToEvents(lines), false).events"),
+ ('history: pi window as commandcode', H, "? engine('pi').windowPiLines(lines, { limit, before })", "? (engine('commandcode' as never) as never as { windowCommandCodeLines: typeof windowRawLines }).windowCommandCodeLines(lines, { limit, before })"),
+ ('history: amp export ignored', H, "const messages = await amp.readAmpThread(sessionId)", "const messages = null as Awaited<ReturnType<typeof amp.readAmpThread>>"),
+ ('history: devin window', H, "m.devinMessagesToEvents, m.windowDevinMessages", "m.devinMessagesToEvents, ((rows: never[], o: { limit: number }) => ({ window: rows.slice(-o.limit), hasMore: false, oldestCursor: null })) as never"),
+ ('last turn: hermes via kilo text', L, "return m ? m.lastHermesTurnText(", "return m ? (m as never as { lastHermesTurnText: (rows: never) => null }).lastHermesTurnText(null as never) ?? m.lastHermesTurnText("),
+ ('last turn: muse', L, "lastMuseTurnText(lines) ?? null", "lastMuseTurnText([]) ?? null"),
+]
+for name, path, old, new in M:
+ if ONLY and not any(o in name for o in ONLY): continue
+ p = os.path.join(cli, path)
+ s = open(p).read()
+ assert s.count(old) == 1, (name, s.count(old))
+ open(p, 'w').write(s.replace(old, new))
+ try:
+ r = subprocess.run(['node', 'node_modules/vitest/vitest.mjs', 'run', 'src/engines/otherTranscripts.golden.spec.ts'], cwd=cli, capture_output=True, text=True)
+ print(f"{name:45s} {'FAILS (caught)' if r.returncode else 'PASSES (NOT caught)'}", flush=True)
+ finally:
+ open(p, 'w').write(s)
diff --git a/cli/scripts/handoff-2026-10-08/mutate.py b/cli/scripts/handoff-2026-10-08/mutate.py
new file mode 100644
index 000000000..9570a08a6
--- /dev/null
+++ b/cli/scripts/handoff-2026-10-08/mutate.py
@@ -0,0 +1,33 @@
+# Flip one engine's branch at a time and check the golden fails. Usage: python3 mutate.py <cli dir>
+import subprocess, sys, os
+cli = sys.argv[1]
+M = [
+ ('opencode', 'src/lib/questionPane.ts', " if (engine === 'opencode') {", " if (engine === 'opencode' && false) {"),
+ ('cursor', 'src/lib/questionPane.ts', "if (engine === 'cursor') return", "if (engine === 'cursor' && false) return"),
+ ('kilo', 'src/lib/questionPane.ts', "if (engine === 'kilo') return", "if (engine === 'kilo' && false) return"),
+ ('devin', 'src/lib/questionPane.ts', "if (engine === 'devin') return", "if (engine === 'devin' && false) return"),
+ ('hermes', 'src/lib/questionPane.ts', "if (engine === 'hermes') return", "if (engine === 'hermes' && false) return"),
+ ('amp', 'src/lib/questionPane.ts', "if (engine === 'amp') return", "if (engine === 'amp' && false) return"),
+ ('agy', 'src/lib/questionPane.ts', "if (engine === 'agy') return", "if (engine === 'agy' && false) return"),
+ ('grok', 'src/lib/questionPane.ts', "if (engine === 'grok') return", "if (engine === 'grok' && false) return"),
+ ('copilot', 'src/lib/questionPane.ts', " if (engine === 'copilot') {", " if (engine === 'copilot' && false) {"),
+ ('muse', 'src/lib/questionPane.ts', "if (engine === 'muse') return", "if (engine === 'muse' && false) return"),
+ ('commandcode (into hermes\'s unframing)', 'src/lib/questionPane.ts', "if (engine === 'hermes') return", "if (engine === 'hermes' || engine === 'commandcode') return"),
+ ('pi (pane)', 'src/lib/legacyPane.ts', "engine === 'pi' ? inspectPiPane(capture)", "engine === 'pi' && false ? inspectPiPane(capture)"),
+ ('pi (into agy\'s dialog reader)', 'src/lib/questionPane.ts', "if (engine === 'agy') return", "if (engine === 'agy' || engine === 'pi') return"),
+ ('terminal', 'src/engines/kit/screen.ts', "parseQuestionPane(capture))\n}", "null)\n}"),
+ ('amp walk', 'src/engines/amp/contract.ts', "questionWalk: 'down'", "questionWalk: 'right'"),
+ ('kilo walk', 'src/engines/kilo/contract.ts', "questionWalk: 'right'", "questionWalk: 'down'"),
+ ('opencode walk (row walk ignored)', 'src/lib/questionController.ts', "const walk = WALKS[engine] ?? row.walk", "const walk = WALKS[engine]"),
+ ('devin multi-select submit', 'src/lib/questionController.ts', "return engine === 'devin' ? 'Enter' : 'Tab'", "return 'Tab'"),
+]
+for name, path, old, new in M:
+ p = os.path.join(cli, path)
+ s = open(p).read()
+ assert s.count(old) == 1, (name, s.count(old))
+ open(p, 'w').write(s.replace(old, new))
+ try:
+ r = subprocess.run(['node', 'node_modules/vitest/vitest.mjs', 'run', 'src/engines/otherScreens.golden.spec.ts'], cwd=cli, capture_output=True, text=True)
+ print(f"{name:45s} {'FAILS (caught)' if r.returncode else 'PASSES (NOT caught)'}", flush=True)
+ finally:
+ open(p, 'w').write(s)
diff --git a/docs/research/2026-10-08-daemon-separation-handoff.md b/docs/research/2026-10-08-daemon-separation-handoff.md
index 6970727ba..d95d043c3 100644
--- a/docs/research/2026-10-08-daemon-separation-handoff.md
+++ b/docs/research/2026-10-08-daemon-separation-handoff.md
@@ -183,6 +183,27 @@ Item 3 is merged (#1066), so this can start. Record a golden of what it answers
- **Pane drivers in `runtimeControl.ts`:** the six unreachable ones are left in place (owner
decision).
+## Left on branches and in the repo
+
+- **`claude-recovery/launch-port-l3-wip`** (7078138bf), an unfinished draft of L3's move.
+ - **It does not build,** and it is not for merging as is.
+ - **Its base** is L1's pre-review head, before #1068's held launches, which L3 must reuse.
+ - **Under it,** 699e252e8 is the L3 golden as first recorded. Re-record that from main before the move.
+ - **The draft holds:** a Store port (`services/storeLaunch.ts`, `dsh/launchWire.ts`),
+ `core/agents/dshThrough.ts`, and the Store waits at restore (`core/agents/storeWaits.ts`).
+ - **Use it** as a reference, or start fresh from `docs/design/2026-10-08-launch-port.md`.
+- **`claude-recovery/launch-port-dsh`** (a5b169d80): the same golden, recorded on main before #1068.
+- **`cli/scripts/handoff-2026-10-08/`** holds this work's scripts:
+ - the closure measure;
+ - the importer finder;
+ - the per-step mutation checks for the goldens;
+ - the landing script;
+ - the main-health watch.
+
+ Its README says how to run each.
+- **Not kept:** the validation receipts (`.harness/validation/`, git-ignored). Each PR body carries its
+ receipt's results.
+
## How the work is done here
- **Golden first.**