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
/**
* The outside voice's record (GST-4140): which provider and model read the diff, its family, and whether that read counts as
* second-model coverage. gstack-review-dispatch collect records it on the outside voice's output event and refuses a
* same-family read, verify prints it as OUTSIDE_VOICE_RECORD:, and gstack-ship-receipt write binds it as the receipt's
* outside_voice. A same-family fallback is one voice, never outside coverage; missing coverage is recorded as unavailable or
* skipped and never blocks.
*/
import { familyConflict, modelFamily, type ModelFamily } from './outside-voice-runner';
/** The reason verify records a completed outside read whose model family was never recorded: not proven second-model coverage. */
export const UNPROVEN_FAMILY = 'the outside read recorded no recognizable model family, so it is not proven second-model coverage';
/** The reason verify records a completed outside read with no recognized native family to compare it to: not proven a second family. */
export const UNPROVEN_NATIVE = 'the outside read recorded no recognizable native model family (collect --native-model), so it is not proven a second family';
export const OUTSIDE_VOICE_STATUSES = ['completed', 'unavailable', 'skipped'] as const;
export type OutsideVoiceStatus = typeof OUTSIDE_VOICE_STATUSES[number];
export interface OutsideVoiceRecord { status: OutsideVoiceStatus; provider: string; model: string; family: ModelFamily | string; native_family?: ModelFamily | string; reason?: string }
/** Who read: recorded on a collected outside voice's output event; `reported` is a closing OUTSIDE_STATUS other than completed (unverified). */
export interface OutsideProvenance { provider: string; model: string; family: ModelFamily | string; native_model?: string; native_family?: ModelFamily | string; reported?: string }
/** The reason verify records a read whose own closing line said it is not a completed review (GST-4148): findings still merge, coverage is missing. */
export const unverifiedRead = (status: string) => `the outside voice's closing line reported OUTSIDE_STATUS: ${status}, so its read is missing coverage, never a completed review`;
/**
* A model id's family: lib/outside-voice-runner.ts's rules on the whole id, then on its last path segment (a router prefix such as
* `openrouter/anthropic/claude-…` keeps Claude's family); `unknown` otherwise. A bare provider prefix never names a family: a router
* (`bedrock/anthropic.claude-…`) would read as a second family.
*/
export function familyOf(model: string | undefined | null): string {
const id = (model ?? '').trim().toLowerCase();
const own = modelFamily(id);
return own !== 'unknown' ? own : modelFamily(id.split('/').at(-1));
}
/**
* The reply's closing `OUTSIDE_STATUS: <status> provider=<p> model=<m> …` line (bin/gstack-outside-voice prints it last); undefined
* when the last non-empty line is anything else, so a status line quoted inside the review text never counts.
*/
export function parseOutsideStatus(text: string): { status: string; provider?: string; model?: string } | undefined {
const line = text.replace(/\r\n/g, '\n').split('\n').map(l => l.trim()).filter(Boolean).at(-1);
if (!line?.startsWith('OUTSIDE_STATUS: ')) return undefined;
const [status = '', ...rest] = line.slice('OUTSIDE_STATUS: '.length).split(/\s+/);
const kv = Object.fromEntries(rest.map(p => p.split('=')).filter(p => p.length === 2 && p[1]) as [string, string][]);
return { status, provider: kv.provider, model: kv.model && kv.model !== 'unknown' ? kv.model : undefined };
}
/**
* The provenance collect records, from its flags or else the reply's closing OUTSIDE_STATUS line; undefined when neither is there.
* The family always comes from the model id (familyOf), never from a printed `family=`; a model that names none is `unknown`.
*/
export function outsideProvenance(o: { model?: string; provider?: string; nativeModel?: string; output: string }): OutsideProvenance | undefined {
const status = parseOutsideStatus(o.output);
if (!o.model && !o.provider && !status) return undefined;
const model = o.model ?? status?.model ?? 'unknown';
const family = familyOf(model);
const native = o.nativeModel ? familyOf(o.nativeModel) : undefined;
return { provider: o.provider ?? status?.provider ?? 'unknown', model, family, ...(o.nativeModel ? { native_model: o.nativeModel, native_family: native } : {}), ...(status && status.status !== 'completed' ? { reported: status.status } : {}) };
}
/** Why a read with this provenance is not outside coverage: the same family as the lane's native model. undefined when it may count. */
export function sameFamily(p: OutsideProvenance): string | undefined {
if (!p.native_model || p.family === 'unknown' || !p.native_family || p.native_family === 'unknown') return undefined;
return p.family === p.native_family ? (familyConflict(p.model, p.native_model) ?? `outside ${p.model} and native ${p.native_model} are both ${p.family}`) : undefined;
}
/**
* Why a read by `model` is not proven second-model coverage: its family is unrecognized or not the model's own, the native family is
* missing or unrecognized, or the two are the same. undefined only for a recognized family beside a different recognized native family.
*/
export function unprovenCoverage(r: { model: string; family: string; native_family?: string }): string | undefined {
if (r.family === 'unknown' || familyOf(r.model) !== r.family) return UNPROVEN_FAMILY;
if (!r.native_family || r.native_family === 'unknown') return UNPROVEN_NATIVE;
return r.native_family === r.family ? `the outside read by ${r.model} is the ${r.family} family, the same as the lane's native family: a same-family fallback is never outside coverage` : undefined;
}
/** The receipt-side check: a completed record needs a recognized family and a different recognized native_family; every record needs a known status. */
export function outsideVoiceProblem(r: unknown): string | undefined {
if (!r || typeof r !== 'object' || Array.isArray(r)) return 'outside_voice must be an object { status, provider, model, family }';
const v = r as Record<string, unknown>;
if (!(OUTSIDE_VOICE_STATUSES as readonly unknown[]).includes(v.status)) return `outside_voice.status must be one of ${OUTSIDE_VOICE_STATUSES.join(', ')}, got ${JSON.stringify(v.status)}`;
for (const k of ['provider', 'model', 'family'] as const) if (typeof v[k] !== 'string' || !v[k]) return `outside_voice.${k} must be a non-empty string`;
if (v.status !== 'completed') return undefined;
const why = unprovenCoverage({ model: String(v.model), family: String(v.family), native_family: typeof v.native_family === 'string' ? v.native_family : undefined });
return why && `outside_voice records a completed read by ${v.model} (family ${v.family}, native_family ${typeof v.native_family === 'string' ? v.native_family : 'none'}), but ${why}; record it as unavailable`;
}