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's no-loss replay. After Step 11 ran (--adversarial-ran), a later full pass on a code or gate diff at standard or full
* depth lists the outside voice again, and the read-only final review of such a diff lists the native adversarial again too, so
* the final head never ships without a second-model read. Main dropped both as "run once per invocation". The change only adds
* readers: asMainBeforeGst4140 checks each added reader is exactly one of these and reads the plan back as main's, so every grid
* frozen to an older main keeps its hash.
* outside: the full pass lists `outside-voice` at the host effort where main listed none, or listed it only as
* `outside-voice (numbers changed)` (read back under that name). A pass 2 whose fix range changes no runtime lines adds no
* outside voice: it plans main's readers and only words its skip line apart.
* adversarial: the read-only final review lists one more `adversarial-native` at full effort, after every reader main listed.
*/
import { expect } from 'bun:test';
import type { PlanInput, ReviewPlan } from '../../lib/review-depth';
export type Gst4140Kind = 'outside' | 'outside+adversarial';
export function asMainBeforeGst4140(input: PlanInput, plan: ReviewPlan): { plan: ReviewPlan; kind?: Gst4140Kind } {
const h = input.history;
const dcls = plan.stepDepth === 'full' ? 'gate' : plan.class;
if (!(plan.mode === 'panel' && plan.next.step === 'full' && plan.stepDepth !== 'light' && h.fullPasses > 0 && input.adversarialRan && (dcls === 'code' || dcls === 'gate'))) return { plan };
const range = !!plan.next.rangeReaders && (h.rangeRuntimeLines ?? 0) > 0;
const final = !!plan.next.readOnly && !range;
const numbersChanged = input.numbers.publishes && input.reviewedNumbers !== undefined && input.reviewedNumbers !== input.numbers.fingerprint;
const added = final || h.rangeRuntimeLines !== 0;
const outside = plan.dispatches.filter(d => d.role === 'outside-voice');
expect([h, outside.map(d => `${d.name}:${d.effort}`)]).toEqual([h, added ? ['outside-voice:host'] : numbersChanged ? ['outside-voice (numbers changed):host'] : []]);
let dispatches = !added ? plan.dispatches : plan.dispatches.flatMap(d => d.role !== 'outside-voice' ? [d] : numbersChanged ? [{ ...d, name: 'outside-voice (numbers changed)' }] : []);
if (final) {
const last = dispatches.map(d => d.role).lastIndexOf('adversarial-native');
expect([h, dispatches.filter(d => d.role === 'adversarial-native').length, dispatches[last]?.effort, dispatches.slice(last + 1).every(d => d.role === 'targeted')]).toEqual([h, 1, 'full', true]);
dispatches = [...dispatches.slice(0, last), ...dispatches.slice(last + 1)];
}
const quiet = 'outside-voice (run once per invocation: the fix range changes no runtime lines)';
const skipped = plan.skipped.filter(s => s !== 'adversarial-native (run once per invocation)' && s !== quiet);
expect([h, plan.skipped.length - skipped.length]).toEqual([h, (range || final ? 0 : 1) + (!added && !numbersChanged ? 1 : 0)]);
const at = skipped.indexOf('targeted (already read this product patch)');
const was = range ? 'outside-voice (run once per invocation)' : 'adversarial-native and outside-voice (run once per invocation)';
return { plan: { ...plan, dispatches, skipped: at < 0 ? [...skipped, was] : [...skipped.slice(0, at), was, ...skipped.slice(at)] }, ...(added ? { kind: final ? 'outside+adversarial' as const : 'outside' as const } : {}) };
}