Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
/**
* GST-4140: an outside voice from the lane's own model family is one voice, never outside coverage. gstack-review-dispatch collect
* refuses it and records the provider, model and family of every outside read; verify prints OUTSIDE_VOICE_RECORD: for the
* receipt; gstack-ship-receipt write records it as outside_voice and refuses a same-family completed read. Missing coverage
* stays unavailable or skipped and never blocks.
*/
import { afterAll, afterEach, describe, expect, test } from 'bun:test';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { spawnSync } from 'node:child_process';
import { runScriptSync } from '../lib/script-invocation';
import { appendEvent, outsideVoiceRecord, readLedger, verify } from '../lib/review-ledger';
import { familyOf, outsideProvenance, outsideVoiceProblem, parseOutsideStatus, sameFamily, UNPROVEN_FAMILY, UNPROVEN_NATIVE, unverifiedRead } from '../lib/outside-voice-record';
import { validateReceipt } from '../lib/ship-receipt';
const ROOT = path.resolve(import.meta.dir, '..');
const DISPATCH = path.join(ROOT, 'bin', 'gstack-review-dispatch');
const RECEIPT = path.join(ROOT, 'bin', 'gstack-ship-receipt');
const dirs: string[] = [];
afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); });
const tmp = (p: string) => { const d = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), p))); dirs.push(d); return d; };
const dispatch = (args: string[]) => runScriptSync(DISPATCH, args, { cwd: ROOT, encoding: 'utf8', timeout: 60_000 });
const REPLY = 'No blocking issue in the retry path.\nRecommendation: ship because the fix holds\n';
function pass() {
const out = tmp('outside-family-');
const ledger = path.join(out, 'review-ledger.jsonl'), merged = path.join(out, 'merged.jsonl');
const w = (n: string, t: string) => { const f = path.join(out, n); fs.writeFileSync(f, t); return f; };
const file = /file=(\S+)/.exec(dispatch(['render', '--role', 'specialist', '--name', 'testing', '--out', out, '--diff-base', 'a'.repeat(40)]).stdout)?.[1] ?? '';
expect(dispatch(['sent', '--ledger', ledger, '--role', 'specialist', '--name', 'testing', '--sent', file]).status).toBe(0);
const outside = (extra: string[], reply = REPLY) => dispatch(['collect', '--ledger', ledger, '--role', 'outside-voice', '--output', w(`o${Math.random()}.txt`, reply), '--merged', merged, ...extra]);
return { out, ledger, merged, w, outside };
}
let worktree = '';
afterAll(() => { if (worktree) spawnSync('git', ['-C', ROOT, 'worktree', 'remove', '--force', worktree], { encoding: 'utf8', timeout: 60_000 }); });
const gitIn = (cwd: string, args: string[]) => spawnSync('git', ['-C', cwd, ...args], { encoding: 'utf8', timeout: 30_000 }).stdout.trim();
/**
* A clean ledger holding only the outside voice: its brief rendered in a clean checkout of HEAD and sent verbatim, a reply that
* names that checkout's REVIEWED_TREE, then judge. verify prints OUTSIDE_VOICE_RECORD only on a ledger like this.
*/
function cleanVoice(extra: string[], reply = REPLY, tree?: string) {
if (!worktree) {
worktree = path.join(fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'outside-family-wt-'))), 'wt');
const add = spawnSync('git', ['-C', ROOT, 'worktree', 'add', '--detach', worktree, 'HEAD'], { encoding: 'utf8', timeout: 120_000 });
expect(add.status, add.stderr).toBe(0);
}
const out = tmp('outside-clean-');
const ledger = path.join(out, 'review-ledger.jsonl'), merged = path.join(out, 'merged.jsonl'), output = path.join(out, 'outside.txt');
const inTree = (args: string[]) => runScriptSync(DISPATCH, args, { cwd: worktree, encoding: 'utf8', timeout: 60_000 });
const file = /file=(\S+)/.exec(inTree(['render', '--role', 'outside-voice', '--out', out, '--diff-base', gitIn(worktree, ['rev-parse', 'HEAD'])]).stdout)?.[1] ?? '';
expect(dispatch(['sent', '--ledger', ledger, '--role', 'outside-voice', '--sent', file]).status).toBe(0);
fs.writeFileSync(output, `REVIEWED_TREE: ${tree ?? `${gitIn(worktree, ['rev-parse', 'HEAD^{tree}'])} ${worktree}`}\n` + reply);
const c = inTree(['collect', '--ledger', ledger, '--role', 'outside-voice', '--output', output, '--merged', merged, ...extra]);
expect([c.status, c.stdout + c.stderr]).toEqual([0, expect.stringContaining(tree ? 'COLLECT_UNAVAILABLE: reader=outside-voice' : 'COLLECT: reader=outside-voice')]);
expect(dispatch(['judge', '--ledger', ledger, '--merged', merged, '--judged', path.join(out, 'judged.jsonl')]).status).toBe(0);
const saved = path.join(out, 'outside-voice.json');
const v = dispatch(['verify', '--ledger', ledger, '--outside-voice-out', saved]);
expect([v.status, v.stdout]).toEqual([0, expect.stringContaining('VERIFY: clean')]);
const line = v.stdout.split('\n').find(l => l.startsWith('OUTSIDE_VOICE_RECORD:'));
expect(fs.existsSync(saved) ? `OUTSIDE_VOICE_RECORD: ${fs.readFileSync(saved, 'utf8').trim()}` : undefined).toBe(line);
return line;
}
describe('the outside voice record (lib/outside-voice-record.ts)', () => {
// Value: protects=R38/R129's second family: a same-family fallback never reads as outside coverage; fails_when=a Claude reader beside a
// Claude lane, by flag or by its OUTSIDE_STATUS line, passes as cross-family, or a cross-family pair is refused; seam=outsideProvenance, sameFamily
test('flags win over the OUTSIDE_STATUS line; the same family is refused and another family is not', () => {
expect(parseOutsideStatus('x\nOUTSIDE_STATUS: completed provider=codex-cli model=gpt-6.2-astra family=openai pass=2\n')).toEqual({ status: 'completed', provider: 'codex-cli', model: 'gpt-6.2-astra' });
expect(parseOutsideStatus('OUTSIDE_STATUS: completed provider=codex host=claude')).toEqual({ status: 'completed', provider: 'codex', model: undefined });
for (const model of ['claude-opus-4', 'anthropic/claude-opus-5-5']) expect(sameFamily(outsideProvenance({ model, nativeModel: 'anthropic/claude-opus-5-5', output: '' })!)).toContain('both anthropic');
const status = outsideProvenance({ nativeModel: 'claude-opus-5-5', output: 'OUTSIDE_STATUS: completed provider=host-subagent model=anthropic/claude-opus-4-8 family=anthropic' })!;
expect([status.provider, status.family, !!sameFamily(status)]).toEqual(['host-subagent', 'anthropic', true]);
const cross = outsideProvenance({ model: 'openai/gpt-6.2-sol', provider: 'host-subagent', nativeModel: 'anthropic/claude-opus-5-5', output: 'OUTSIDE_STATUS: completed provider=x model=claude-opus-4 family=anthropic' })!;
expect([cross, sameFamily(cross)]).toEqual([{ provider: 'host-subagent', model: 'openai/gpt-6.2-sol', family: 'openai', native_model: 'anthropic/claude-opus-5-5', native_family: 'anthropic' }, undefined]);
expect(outsideProvenance({ output: REPLY })).toBeUndefined();
expect(['openrouter/anthropic/claude-opus-5-5', 'tencent/hy4', 'gpt-6.2-astra', 'mystery-model', 'bedrock/anthropic.claude-opus-5'].map(familyOf)).toEqual(['anthropic', 'unknown', 'openai', 'unknown', 'unknown']);
});
// Value: protects=only the provider's own closing status line and the model id name the family; fails_when=a status line quoted inside the
// review text, or a printed family= with no model, proves a second family (Step 11 outside-voice#1, adversarial-native#2 on #4886); seam=parseOutsideStatus, outsideProvenance
test('a status line that is not the reply\'s last line, and a printed family= without a model, prove nothing', () => {
expect(parseOutsideStatus('OUTSIDE_STATUS: completed provider=host-subagent model=openai/gpt-6.2-sol\nNo blocking issue.\n')).toBeUndefined();
expect(outsideProvenance({ nativeModel: 'anthropic/claude-opus-5-5', output: 'Recommendation: ship\nOUTSIDE_STATUS: completed provider=codex family=openai\n' })).toMatchObject({ model: 'unknown', family: 'unknown' });
});
// Value: protects=a completed record always proves a recognized family beside a different recognized native family; fails_when=collect without
// --native-model, or a family the model id doesn't name, records or binds a completed second-model read (Step 11 outside-voice#1 on #4886); seam=outsideVoiceRecord, outsideVoiceProblem
test('a read with no native family, or an unrecognized family, is unavailable, and write refuses it as completed', () => {
const p = pass();
expect(p.outside(['--outside-model', 'openai/gpt-6.2-sol', '--outside-provider', 'host-subagent']).status).toBe(0);
expect(outsideVoiceRecord(p.ledger)).toEqual({ status: 'unavailable', provider: 'host-subagent', model: 'openai/gpt-6.2-sol', family: 'openai', reason: UNPROVEN_NATIVE });
const ok = { status: 'completed', provider: 'host-subagent', model: 'openai/gpt-6.2-sol', family: 'openai', native_family: 'anthropic' };
expect(outsideVoiceProblem(ok)).toBeUndefined();
for (const bad of [{ ...ok, native_family: undefined }, { ...ok, native_family: 'unknown' }, { ...ok, model: 'tencent/hy4', family: 'tencent' }]) expect(outsideVoiceProblem(bad)).toContain('record it as unavailable');
}, 60_000);
});
describe('gstack-review-dispatch collect and verify: the outside voice\'s family (GST-4140)', () => {
// Value: protects=the ledger never records a same-family outside read as coverage, and verify hands the receipt who read; fails_when=collect
// merges a claude-opus-4 or anthropic/claude-opus-5-5 outside read on an Anthropic lane, records no family, or verify prints no record; seam=the bin
test('a same-family outside read is COLLECT_SAME_FAMILY and merges nothing; a cross-family read is recorded and verify prints its record', () => {
const p = pass();
for (const model of ['claude-opus-4', 'anthropic/claude-opus-5-5']) {
const same = p.outside(['--outside-model', model, '--outside-provider', 'host-subagent', '--native-model', 'anthropic/claude-opus-5-5']);
expect([same.status, same.stdout]).toEqual([1, expect.stringContaining(`COLLECT_SAME_FAMILY: reader=outside-voice model=${model} family=anthropic native=anthropic/claude-opus-5-5`)]);
expect(same.stdout).toContain('a file that holds only the reason, not this reply (--unavailable refuses output that holds findings)');
}
const viaStatus = p.outside(['--native-model', 'claude-opus-5-5'], REPLY + 'OUTSIDE_STATUS: completed provider=host-subagent model=claude-opus-4 family=anthropic\n');
expect([viaStatus.status, viaStatus.stdout]).toEqual([1, expect.stringContaining('COLLECT_SAME_FAMILY')]);
expect(readLedger(p.ledger).filter(e => e.event === 'output' && e.reader === 'outside-voice')).toEqual([]);
const ok = p.outside(['--outside-model', 'openai/gpt-6.2-sol', '--outside-provider', 'host-subagent', '--native-model', 'anthropic/claude-opus-5-5']);
expect([ok.status, ok.stdout]).toEqual([0, expect.stringContaining('COLLECT: reader=outside-voice')]);
const record = { status: 'completed', provider: 'host-subagent', model: 'openai/gpt-6.2-sol', family: 'openai', native_family: 'anthropic' };
expect(outsideVoiceRecord(p.ledger)).toEqual(record as never);
const v = dispatch(['verify', '--ledger', p.ledger]);
expect([v.status, v.stdout]).toEqual([1, expect.stringContaining('OUTSIDE_VOICE_RECORD_WITHHELD: VERIFY is dirty')]);
expect(v.stdout).not.toContain('OUTSIDE_VOICE_RECORD: ');
expect(v.stdout).not.toContain('SAME_FAMILY');
expect(cleanVoice(['--outside-model', 'openai/gpt-6.2-sol', '--outside-provider', 'host-subagent', '--native-model', 'anthropic/claude-opus-5-5'])).toBe(`OUTSIDE_VOICE_RECORD: ${JSON.stringify(record)}`);
}, 120_000);
test('missing coverage is recorded as unavailable with its provenance; a same-family read written into a ledger makes verify dirty; the flags are the outside voice\'s only', () => {
const p = pass();
const lost = p.outside(['--outside-model', 'claude-opus-4', '--native-model', 'anthropic/claude-opus-5-5', '--unavailable', 'no other family online'], 'outside voice failed\n');
expect([lost.status, lost.stdout]).toEqual([0, expect.stringContaining('COLLECT_UNAVAILABLE: reader=outside-voice')]);
expect(outsideVoiceRecord(p.ledger)).toMatchObject({ status: 'unavailable', model: 'claude-opus-4', family: 'anthropic', reason: 'no other family online' });
expect(verify(p.ledger).rows.some(r => r.kind === 'OUTSIDE')).toBe(false);
appendEvent(p.ledger, { event: 'output', reader: 'outside-voice', sha256: 'x', file: null, merged: p.merged, ids: [], review: true, outside: { provider: 'host-subagent', model: 'claude-opus-4', family: 'anthropic', native_model: 'claude-opus-5-5', native_family: 'anthropic' } });
const v = verify(p.ledger);
expect([v.clean, v.rows.find(r => r.kind === 'OUTSIDE')]).toEqual([false, { kind: 'OUTSIDE', reader: 'outside-voice', status: 'SAME_FAMILY', detail: expect.stringContaining('family=anthropic native_family=anthropic') }]);
const spec = dispatch(['collect', '--ledger', p.ledger, '--role', 'specialist', '--name', 'testing', '--output', p.w('s.txt', 'NO FINDINGS\n'), '--merged', p.merged, '--outside-model', 'openai/gpt-6.2-sol']);
expect([spec.status, spec.stderr]).toEqual([2, expect.stringContaining('is not the outside voice')]);
}, 60_000);
});
describe('gstack-ship-receipt write: outside_voice (GST-4140)', () => {
let repo = '', env: NodeJS.ProcessEnv = {};
const setup = () => {
const t = tmp('gstack-receipt-outside-');
repo = path.join(t, 'repo');
fs.mkdirSync(repo);
const gitconfig = path.join(t, 'gitconfig');
fs.writeFileSync(gitconfig, '');
env = { ...process.env, HOME: t, USERPROFILE: t, GSTACK_STATE_ROOT: path.join(t, 'state'), GSTACK_HOME: path.join(t, 'state'), GSTACK_SESSION_KIND: 'attended',
GIT_CONFIG_GLOBAL: gitconfig, GIT_CONFIG_NOSYSTEM: '1', GIT_DIR: undefined, GIT_WORK_TREE: undefined, GIT_INDEX_FILE: undefined };
const git = (...args: string[]) => expect(spawnSync('git', args, { cwd: repo, env, encoding: 'utf8', timeout: 30_000 }).status).toBe(0);
git('init', '-q', '-b', 'main');
fs.writeFileSync(path.join(repo, 'a.txt'), 'a\n');
git('add', 'a.txt');
git('-c', '[email protected]', '-c', 'user.name=Fixture', '-c', 'commit.gpgsign=false', 'commit', '-qm', 'fixture');
git('update-ref', 'refs/remotes/origin/main', 'HEAD');
git('switch', '-q', '-c', 'feat');
return t;
};
const write = (voice: string) => runScriptSync(RECEIPT, ['write', '--base', 'main', '--json', '--outside-voice', voice], { cwd: repo, env, encoding: 'utf8', timeout: 60_000 });
// Value: protects=the receipt names the second-model read and its family, and a same-family completed read never binds; fails_when=write drops
// outside_voice, accepts a same-family or unknown-family completed read, or refuses honest unavailable or skipped coverage; seam=the bin and validateReceipt
test('records a cross-family completed read, explicit unavailable and skipped coverage; refuses a same-family or unrecognized completed read', () => {
const t = setup();
const ok = { status: 'completed', provider: 'host-subagent', model: 'openai/gpt-6.2-sol', family: 'openai', native_family: 'anthropic' };
const w = write(`OUTSIDE_VOICE_RECORD: ${JSON.stringify(ok)}`);
expect(w.status, w.stderr).toBe(0);
expect(JSON.parse(w.stdout).outside_voice).toEqual(ok);
const file = path.join(t, 'verify.txt');
fs.writeFileSync(file, `VERIFY: clean briefs=3 outputs=3 voided=0\nOUTSIDE_VOICE_RECORD: ${JSON.stringify({ status: 'unavailable', provider: 'codex-cli', model: 'unknown', family: 'unknown', reason: 'rate limited' })}\n`);
const lost = write('@' + file);
expect([lost.status, JSON.parse(lost.stdout || '{}').outside_voice?.status]).toEqual([0, 'unavailable']);
const skipped = write(JSON.stringify({ status: 'skipped', provider: 'none', model: 'none', family: 'unknown', reason: 'the review plan listed no outside voice' }));
expect([skipped.status, JSON.parse(skipped.stdout || '{}').outside_voice?.status]).toEqual([0, 'skipped']);
const pretty = path.join(t, 'pretty.json');
fs.writeFileSync(pretty, JSON.stringify(ok, null, 2) + '\n');
const full = path.join(t, 'verify-full.txt');
fs.writeFileSync(full, `OUTPUT outside-voice MATCH sha=abc findings=0\nOUTSIDE_VOICE_RECORD: ${JSON.stringify(ok)}\nVERIFY: clean briefs=1 outputs=1 voided=0\n`);
for (const f of [pretty, full]) {
const r = write('@' + f);
expect([r.status, JSON.parse(r.stdout || '{}').outside_voice], r.stderr).toEqual([0, ok]);
}
const empty = path.join(t, 'empty.txt');
fs.writeFileSync(empty, '');
const withheld = path.join(t, 'withheld.txt');
fs.writeFileSync(withheld, "OUTSIDE_VOICE_RECORD_WITHHELD: VERIFY is dirty, so the outside voice's record does not bind\nVERIFY: dirty briefs=1 outputs=1 voided=0\n");
for (const f of [empty, withheld]) {
const r = write('@' + f);
expect([r.status, r.stderr]).toEqual([2, expect.stringContaining('verify prints it only when VERIFY is clean')]);
}
for (const bad of [{ ...ok, model: 'claude-opus-4', family: 'anthropic' }, { ...ok, model: 'anthropic/claude-opus-5-5', family: 'anthropic' }, { ...ok, family: 'unknown' }, { ...ok, model: 'claude-opus-4' }, { ...ok, native_family: undefined }, { ...ok, model: 'tencent/hy4', family: 'tencent' }]) {
const r = write(JSON.stringify(bad));
expect([bad.model, bad.family, r.status, r.stderr]).toEqual([bad.model, bad.family, 1, expect.stringContaining('RECEIPT_INVALID')]);
}
expect(write('not json').status).toBe(2);
}, 120_000);
// Value: protects=verify's record always binds: a cross-family read whose family was never recorded (the Codex block's
// OUTSIDE_STATUS line names no model) is missing coverage, never a completed read write refuses; fails_when=verify prints a
// record write rejects, or calls an unproven read completed; seam=collect, verify and write end to end
test('verify reports an outside read with no recorded family as unavailable, and write binds that record', () => {
setup();
const line = cleanVoice([], REPLY + 'OUTSIDE_STATUS: completed provider=codex host=claude\n')!;
expect(JSON.parse(line.slice('OUTSIDE_VOICE_RECORD:'.length))).toEqual({ status: 'unavailable', provider: 'codex', model: 'unknown', family: 'unknown', reason: UNPROVEN_FAMILY });
const w = write(line);
expect([w.status, JSON.parse(w.stdout || '{}').outside_voice?.status]).toEqual([0, 'unavailable']);
}, 120_000);
// Value: protects=Step 19's automatic --outside-voice never stops a receipt write; fails_when=a wrong-tree reply's unavailable reason carries
// the checkout's home path into the saved record, and write refuses the receipt as private (p3 outside-voice#1 on #4889); seam=collect, verify and write
test('a wrong-tree outside reply saves an unavailable record without checkout paths, and write accepts it', () => {
const t = setup();
const line = cleanVoice(['--native-model', 'anthropic/claude-opus-5-5'], REPLY, `${'b'.repeat(40)} ${path.join(t, 'elsewhere')}`)!;
const record = JSON.parse(line.slice('OUTSIDE_VOICE_RECORD:'.length));
expect([record.status, record.reason]).toEqual(['unavailable', expect.stringMatching(/^reviewed another tree: reported b{40} <checkout>, expected [0-9a-f]{40} <checkout>$/)]);
const leaked = path.join(t, 'leaked.json');
fs.writeFileSync(leaked, JSON.stringify({ ...record, reason: 'reviewed another tree: reported x /home/fixture-user/elsewhere' }));
expect(write('@' + leaked).status).toBe(1);
const w = write(line);
expect([w.status, JSON.parse(w.stdout || '{}').outside_voice?.reason], w.stderr).toEqual([0, record.reason]);
}, 120_000);
test('a receipt without outside_voice stays valid; validateReceipt rejects a same-family completed record', () => {
const base = { schema_version: 1, head: 'a'.repeat(40), base: 'main' };
expect(validateReceipt(base)).toEqual([]);
expect(validateReceipt({ ...base, outside_voice: { status: 'completed', provider: 'host-subagent', model: 'claude-opus-4', family: 'anthropic', native_family: 'anthropic' } }).map(e => e.code)).toEqual(['RECEIPT_INVALID']);
expect(outsideVoiceProblem({ status: 'unavailable', provider: 'codex-cli', model: 'unknown', family: 'unknown' })).toBeUndefined();
expect(outsideVoiceProblem({ status: 'done', provider: 'x', model: 'y', family: 'z' })).toContain('status must be one of');
});
});
describe('/gstack-ship Step 11: the Codex block\'s closing OUTSIDE_STATUS line (GST-4148)', () => {
const rendered = fs.readFileSync(path.join(ROOT, 'ship/sections/adversarial.md'), 'utf8').split('\n');
const id = rendered.filter(l => l.startsWith('_OUTSIDE_ID='));
const echo = (s: string) => rendered.filter(l => l.includes(`echo "OUTSIDE_STATUS: ${s} provider=codex`));
const statusLine = (model: string, s: 'completed' | 'unverified') => {
const script = [id[0]!.split('"$HOME/.claude/skills/gstack/bin/').join(`"${path.join(ROOT, 'bin')}/`), echo(s)[0]!.replace(/^.*?(echo "[^"]*").*$/, '$1')].join('\n');
const r = spawnSync('bash', ['-c', script], { env: { ...process.env, _CODEX_SEL: model }, encoding: 'utf8', timeout: 60_000 });
expect(r.status, r.stderr).toBe(0);
return r.stdout.trim();
};
// Value: protects=a Codex CLI read in /gstack-ship counts as second-model coverage once collect has the lane's model; fails_when=the
// rendered Codex block's OUTSIDE_STATUS line names no model, so collect records a cross-family Codex read as unavailable, or a
// non-OpenAI Codex model is labelled openai; seam=the rendered ship section, collect and verify end to end
test('both Codex passes print model= and family=, and collect records a Codex read as a completed cross-family review', () => {
expect([id.length, echo('completed').length, echo('unverified').length]).toEqual([2, 2, 2]);
expect(rendered.join('\n')).toContain('Collect the outside voice with `--native-model <your model id>`');
expect(statusLine('gpt-6.2-astra', 'completed')).toBe('OUTSIDE_STATUS: completed provider=codex host=claude model=gpt-6.2-astra family=openai');
expect(parseOutsideStatus(statusLine('gpt-6.2-astra', 'unverified'))).toEqual({ status: 'unverified', provider: 'codex', model: 'gpt-6.2-astra' });
const unverified = cleanVoice(['--native-model', 'anthropic/claude-opus-5-5'], REPLY + statusLine('gpt-6.2-astra', 'unverified') + '\n')!;
expect(JSON.parse(unverified.slice('OUTSIDE_VOICE_RECORD:'.length))).toEqual({ status: 'unavailable', provider: 'codex', model: 'gpt-6.2-astra', family: 'openai', native_family: 'anthropic', reason: unverifiedRead('unverified') });
expect(statusLine('claude-opus-5-5', 'completed')).toEndWith('model=claude-opus-5-5 family=anthropic');
const line = cleanVoice(['--native-model', 'anthropic/claude-opus-5-5'], REPLY + statusLine('gpt-6.2-astra', 'completed') + '\n')!;
expect(JSON.parse(line.slice('OUTSIDE_VOICE_RECORD:'.length))).toEqual({ status: 'completed', provider: 'codex', model: 'gpt-6.2-astra', family: 'openai', native_family: 'anthropic' });
const same = pass().outside(['--native-model', 'anthropic/claude-opus-5-5'], REPLY + statusLine('claude-opus-5-5', 'completed') + '\n');
expect([same.status, same.stdout]).toEqual([1, expect.stringContaining('COLLECT_SAME_FAMILY: reader=outside-voice model=claude-opus-5-5 family=anthropic')]);
}, 120_000);
// Value: protects=Step 19 never binds a stale or unverified record, and a later verify of a ledger with no outside voice (Step 19's
// targeted-only rerun) keeps the earlier record; fails_when=verify --outside-voice-out keeps an older file beside a dirty ledger, writes
// one there, or deletes the record on a ledger with no outside voice (the clean write is checked in cleanVoice); seam=the bin
test('verify --outside-voice-out removes a stale file beside a dirty ledger and leaves it alone on a ledger with no outside voice', () => {
const p = pass();
const alias = dispatch(['verify', '--ledger', p.ledger, '--outside-voice-out', p.ledger]);
expect([alias.status, alias.stderr, fs.statSync(p.ledger).size > 0]).toEqual([2, expect.stringContaining('must name two files other than --ledger'), true]);
const kept = path.join(p.out, 'kept.json');
fs.writeFileSync(kept, '{"earlier":true}\n');
dispatch(['verify', '--ledger', p.ledger, '--outside-voice-out', kept]);
expect(fs.readFileSync(kept, 'utf8')).toBe('{"earlier":true}\n');
expect(p.outside(['--outside-model', 'openai/gpt-6.2-sol', '--outside-provider', 'host-subagent', '--native-model', 'anthropic/claude-opus-5-5']).status).toBe(0);
const file = path.join(p.out, 'outside-voice.json');
fs.writeFileSync(file, '{"stale":true}\n');
const v = dispatch(['verify', '--ledger', p.ledger, '--outside-voice-out', file]);
expect([v.status, v.stdout, fs.existsSync(file)]).toEqual([1, expect.stringContaining('docs/troubleshooting.md#outside-voice-record-withheld'), false]);
}, 60_000);
});