diff --git a/.claude/skills/verify-open-pstack/features/README.md b/.claude/skills/verify-open-pstack/features/README.md index 9b164034..f2cdefee 100644 --- a/.claude/skills/verify-open-pstack/features/README.md +++ b/.claude/skills/verify-open-pstack/features/README.md @@ -35,7 +35,7 @@ The feature documents below define sub-features, user entry points, driving inst - `catalog.md`: the generated model catalog and native agents, read by a parent resolving roles from a model sheet. - `shipped-tools.md`: watch, plan checks, audit, statechart, and evidence logging. - `assets.md`: manifest-declared installed assets on actual consuming harnesses. -- `t3.md`: a T3 Code parent dispatching a role through `delegate_task` (`t3:dispatch`), on a run-owned disposable T3 server. +- `t3.md`: a T3 Code parent dispatching Claude and Muse roles through `delegate_task` (`t3:dispatch`) and running `/setup-pstack` (`t3:setup`), on a run-owned disposable T3 server. - `grok.md`: a Grok parent's native and runner lanes and agent visibility (`grok:dispatch`), and setup writing the Grok sheet (`grok:setup`), over ACP. - `hooks.md`: the SessionStart hook's context reaching a new session (`hook:startup`), and the Windows runner beside it. - `recipes.ts`: the headless cases and machine-checked assertions for every selectable feature. A named feature without one fails the run as `missing-recipe` before any session starts. A recipe proves a lookup or a read with a fixture value the model cannot derive from the prompt, such as a per-run `crypto.randomUUID()` marker, compared in the structured result. A command's text can show which tool the parent called, but it never proves what that tool read or produced, so do not add command-text or tool-output pattern checks for that. diff --git a/.claude/skills/verify-open-pstack/features/recipes.ts b/.claude/skills/verify-open-pstack/features/recipes.ts index f183f3ff..cc2f1d4c 100644 --- a/.claude/skills/verify-open-pstack/features/recipes.ts +++ b/.claude/skills/verify-open-pstack/features/recipes.ts @@ -24,6 +24,7 @@ export interface Case { /** Claude refuses Write into its own config folder in dontAsk mode even with --add-dir; setup must write there. */ claudePermission?: 'bypassPermissions'; prepare?(fixture: Fixture): Promise; + t3Instances?(fixture: Fixture): Promise>; prompt(fixture: Fixture): string; assert(record: SessionRecord, fixture: Fixture): Promise; } @@ -856,29 +857,168 @@ const startupHook: Case = { }, }; -const T3_ROLE = 'bug-fix', T3_LANE = { provider: 'claudeAgent', model: 'claude-haiku-5-5', effort: 'low' }; +export interface T3Snapshot { + inheritedProviderInstanceId: string; + providers: { providerInstanceId: string; driverKind: string; canRunChildTask: boolean; canRunCrossProviderChildTask: boolean; constraints: string[]; + models: { id: string; options?: { id: string; values: string[] }[] }[] }[]; +} +export interface T3Pick { instance: string; options: Record; qualifying: string[] } +const T3_EFFORT_OPTIONS = ['effort', 'reasoningEffort', 'thought_level']; + +export function t3Pick(snapshot: T3Snapshot, lane: { driverKind: string; model: string; effort: string }): T3Pick | undefined { + const inherited = snapshot.providers.find(p => p.providerInstanceId === snapshot.inheritedProviderInstanceId)?.driverKind; + const qualifying = snapshot.providers.flatMap(p => { + if (p.driverKind !== lane.driverKind || !p.canRunChildTask || p.constraints.length || (p.driverKind !== inherited && !p.canRunCrossProviderChildTask)) return []; + const model = p.models.find(m => m.id === lane.model); + if (!model) return []; + if (lane.effort === 'default') return [{ instance: p.providerInstanceId, options: {} }]; + const option = model.options?.find(o => T3_EFFORT_OPTIONS.includes(o.id)); + return option?.values.includes(lane.effort) ? [{ instance: p.providerInstanceId, options: { [option.id]: lane.effort } }] : []; + }); + const pick = qualifying.find(q => q.instance === snapshot.inheritedProviderInstanceId) ?? qualifying[0]; + return pick && { ...pick, qualifying: qualifying.map(q => q.instance) }; +} + +function t3Snapshot(record: SessionRecord): T3Snapshot { + const results = record.tools.filter(t => t.name === 'mcp__t3-code__orchestrator_capabilities' && !t.failed).map(t => parseJson(t.result) as T3Snapshot | undefined) + .filter((s): s is T3Snapshot => Array.isArray(s?.providers)); + if (!results.length) throw new Error('capabilities-not-read'); + const models = (id: string) => [...new Map(results.flatMap(s => s.providers.find(p => p.providerInstanceId === id)?.models ?? []).map(m => [m.id, m])).values()]; + return { ...results[0]!, providers: results[0]!.providers.map(p => ({ ...p, models: models(p.providerInstanceId) })) }; +} + +export async function operatorT3Instances(drivers: string[]): Promise> { + const settings = JSON.parse(await readFile(join(homedir(), '.t3/userdata/settings.json'), 'utf8')); + const instances: Record = {}; + for (const driver of drivers) { + const enabled = Object.entries(settings.providerInstances ?? {}).filter(([, v]) => v?.driver === driver && v.enabled === true); + if (!enabled.length) throw new Error(`t3-instance-missing:${driver}`); + for (const [id, v] of enabled) { + instances[id] = { driver, enabled: true, ...typeof v.config?.binaryPath === 'string' ? { config: { binaryPath: v.config.binaryPath } } : {} }; + } + } + return instances; +} + +function settled(response: Record | undefined): void { + if (response?.status !== 'completed' || response.workState !== 'result_available' || response.hasPendingChildRuns !== false || + response.hasPendingQuestion !== false || response.pendingApproval !== null) throw new Error(`delegate-not-settled:${response?.status}`); +} + +const T3_LANES = [ + { role: 'bug-fix', provider: 'claude', driverKind: 'claudeAgent', model: 'claude-haiku-5-5', effort: 'low', option: 'effort' }, + { role: 'judgment and prose', provider: 'muse', driverKind: 'muse', model: 'muse-spark-1.3', effort: 'low', option: 'reasoningEffort' }, +] as const; const t3Dispatch: Case = { id: 'dispatch', + t3Instances: () => operatorT3Instances(['muse']), async prepare(f) { - await files(f.dir, { 'marker.txt': `${crypto.randomUUID()}\n`, 'pstack-models.md': sheetText([[T3_ROLE, [`claude:${T3_LANE.model}@${T3_LANE.effort}`]]]) }); + await files(f.dir, { 'pstack-models.md': sheetText(T3_LANES.map(lane => [lane.role, [`${lane.provider}:${lane.model}@${lane.effort}`]])), + ...Object.fromEntries(T3_LANES.map((_, index) => [`marker-${index + 1}.txt`, `${crypto.randomUUID()}\n`])) }); }, - prompt: f => `${invoke(f.harness, 'poteto-mode', `Dispatch exactly one lane for the ${T3_ROLE} role and nothing else. For this task the pstack model sheet is ${join(f.dir, 'pstack-models.md')}; use it in place of any configured sheet. The lane's whole task: "Read ${join(f.dir, 'marker.txt')} and reply with its exact contents. Do not edit files." Wait for the lane's result, then reply with it.`)} ${rules(f.dir)}`, + prompt: f => `${invoke(f.harness, 'poteto-mode', `Dispatch exactly one lane for each of these roles, in this order, and nothing else: ${T3_LANES.map(lane => JSON.stringify(lane.role)).join(', ')}. For this task the pstack model sheet is ${join(f.dir, 'pstack-models.md')}; use it in place of any configured sheet. Lane N's whole task: "Read ${join(f.dir, 'marker-N.txt')} and reply with its exact contents. Do not edit files." Wait for every lane's result, then reply with each result.`)} ${rules(f.dir)}`, async assert(record, f) { if (!record.skills.includes(join(f.location, 'skills/poteto-mode'))) throw new Error('skill-not-loaded-from-candidate:pstack:poteto-mode'); - const calls = record.tools.filter(t => t.name === 'mcp__t3-code__delegate_task' && !t.failed); - if (calls.length !== 1) throw new Error(`delegate-task-calls:${calls.length}`); - const { input, result } = calls[0]!, target = input.target ?? {}; - if (target.providerInstanceId !== T3_LANE.provider || target.model !== T3_LANE.model || !Bun.deepEquals(target.options, { effort: T3_LANE.effort })) throw new Error('delegate-request-mismatch'); - const response = parseJson(result) as Record | undefined; - if (response?.providerInstanceId !== T3_LANE.provider || response.model !== T3_LANE.model || - !Bun.deepEquals(response.options, [{ id: 'effort', value: T3_LANE.effort }])) throw new Error('delegate-response-mismatch'); - if (response.status !== 'completed' || response.workState !== 'result_available' || response.hasPendingChildRuns !== false || - response.hasPendingQuestion !== false || response.pendingApproval !== null) throw new Error(`delegate-not-settled:${response.status}`); - const marker = (await readFile(join(f.dir, 'marker.txt'), 'utf8')).trim(); - if (typeof response.summary !== 'string' || !response.summary.includes(marker)) throw new Error('marker-missing'); + const calls = record.tools.filter(t => t.name === 'mcp__t3-code__delegate_task'); + if (calls.length !== T3_LANES.length) throw new Error(`delegate-task-calls:${calls.length}`); + const snapshot = t3Snapshot(record), assertions = ['skill-loaded-from-candidate'], exchanges: unknown[] = []; + for (const [index, lane] of T3_LANES.entries()) { + const call = calls.find(c => c.input.target?.model === lane.model); + if (!call) throw new Error(`delegate-lane-missing:${lane.provider}`); + const target = call.input.target, response = parseJson(call.result) as Record | undefined; + const instance = lane.driverKind === 'muse' ? t3Pick(snapshot, lane)?.instance : lane.driverKind; + if (!instance || instance === 'codex') throw new Error(`instance-rule:${lane.provider}`); + if (target.providerInstanceId !== instance || !Bun.deepEquals(target.options, { [lane.option]: lane.effort })) throw new Error(`delegate-request-mismatch:${lane.provider}`); + if (response?.providerInstanceId !== instance || response.model !== lane.model || + !Bun.deepEquals(response.options, [{ id: lane.option, value: lane.effort }])) throw new Error(`delegate-response-mismatch:${lane.provider}`); + settled(response); + const marker = (await readFile(join(f.dir, `marker-${index + 1}.txt`), 'utf8')).trim(); + if (typeof response.summary !== 'string' || !response.summary.includes(marker)) throw new Error(`marker-missing:${lane.provider}`); + assertions.push(`delegate:${instance}:${lane.model}:${lane.option}=${lane.effort}`, ...lane.driverKind === 'muse' ? [`instance-rule:${lane.provider}`] : []); + exchanges.push({ request: call.input, response }); + } const exchange = join(f.dir, 'delegate-task.json'); - await writeFile(exchange, JSON.stringify({ request: input, response }, null, 2)); - return { assertions: ['skill-loaded-from-candidate', 'delegate-request', 'delegate-settled', 'marker-returned'], files: [exchange, join(f.dir, 'pstack-models.md')] }; + await writeFile(exchange, JSON.stringify(exchanges, null, 2)); + return { assertions: [...assertions, 'delegates-settled', 'markers-returned'], files: [exchange, join(f.dir, 'pstack-models.md')] }; + }, +}; + +const T3_SETUP_NATIVE = { model: 'claude-haiku-5-5', effort: 'low' }, T3_SETUP_RUNNER = { provider: 'codex', model: 'gpt-6-luna', effort: 'low' }; +const T3_SETUP_RUNNER_ROLE = 'judgment and prose'; +const t3SetupRoles = (defaults: Map): [string, string[]][] => [...defaults].map(([role, lanes]) => [role, lanes.map(lane => !lane.includes(':') ? lane + : role === T3_SETUP_RUNNER_ROLE ? `${T3_SETUP_RUNNER.provider}:${T3_SETUP_RUNNER.model}@${T3_SETUP_RUNNER.effort}` : `claude:${T3_SETUP_NATIVE.model}@${T3_SETUP_NATIVE.effort}`)]); +const IMPORT = /^@\S*pstack-models\.md$/; +function expandShellVars(command: string): string { + const vars = new Map([['HOME', homedir()]]); + const ref = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g; + const sub = (text: string): string => text.replace(ref, (match, braced, bare) => vars.get(braced ?? bare) ?? match); + const assign = /(?:^|[\n;&])\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=('[^']*'|"[^"]*"|[^\s;&|]+)/g; + for (const [, name, raw] of command.matchAll(assign)) { + const quoted = raw!.startsWith("'") && raw!.endsWith("'") ? 'single' : raw!.startsWith('"') && raw!.endsWith('"') ? 'double' : 'none'; + const body = quoted === 'none' ? raw! : raw!.slice(1, -1); + const expanded = quoted === 'single' ? body : sub(body); + vars.set(name!, quoted === 'none' && expanded.startsWith('~/') ? homedir() + expanded.slice(1) : expanded); + } + return sub(command); +} +export function sheetWrite(tool: SessionRecord['tools'][number], sheet: string): boolean { + if (['Write', 'Edit', 'MultiEdit'].includes(tool.name)) return tool.input.file_path === sheet; + if (tool.name !== 'Bash' || typeof tool.input.command !== 'string') return false; + const command = expandShellVars(tool.input.command); + const target = `['"]?(?:${[sheet, sheet.replace(homedir(), '~')].map(path => path.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})['"]?`; + return new RegExp(`(?:>>?|\\btee(?: -a)?)\\s*${target}(?:\\s|$|[;&|])`).test(command) || + new RegExp(`\\b(?:cp|mv|install)\\b[^;&|\\n]*\\s${target}\\s*(?:$|[;&|\\n])`).test(command); +} +const t3Setup: Case = { + id: 'configure', + t3Instances: async () => ({ codex: { driver: 'codex', enabled: false } }), + async prepare(f) { + await git(f, 'init', '-q', '-b', 'main'); + const roles = t3SetupRoles((await readCatalog(f.location)).defaults); + if (!roles.some(([role]) => role === T3_SETUP_RUNNER_ROLE)) throw new Error(`catalog-role-missing:${T3_SETUP_RUNNER_ROLE}`); + await writeFile(join(f.configHome, 'pstack-models.md'), sheetText(roles) + `${BOUNDED_SETTING}\n`); + }, + prompt: f => `${invoke(f.harness, 'setup-pstack', `Use these answers and ask nothing else. Keep every role assignment and every family's current effort. Put every probe's prompt, output and receipt file under ${join(f.dir, 'probes')}/ and every smoke-test file under ${join(f.dir, 'smoke')}/. I confirm every write. Write the setup report to ${join(f.dir, 'result.md')}.`)} Do not push, post, or contact GitHub. This is a headless session that ends at your first final reply and stops any background work still running, so run every command and subagent in the foreground, even where the skill says to use the background, and finish all work before you reply.`, + async assert(record, f) { + if (!record.skills.includes(join(f.location, 'skills/setup-pstack'))) throw new Error('skill-not-loaded-from-candidate:pstack:setup-pstack'); + const sheet = join(f.configHome, 'pstack-models.md'), assertions = ['skill-loaded-from-candidate', await written(record, sheet)]; + const capabilities = record.tools.findIndex(t => t.name === 'mcp__t3-code__orchestrator_capabilities' && !t.failed); + const delegates = record.tools.filter(t => t.name === 'mcp__t3-code__delegate_task'); + const probe = delegates.find(t => t.input.target?.providerInstanceId === 'claudeAgent' && t.input.target?.model === T3_SETUP_NATIVE.model); + if (!probe || !Bun.deepEquals(probe.input.target.options, { effort: T3_SETUP_NATIVE.effort })) throw new Error('t3-probe-missing'); + settled(parseJson(probe.result) as Record | undefined); + if (delegates.some(t => t.input.target?.model === T3_SETUP_RUNNER.model)) throw new Error('runner-family-on-t3'); + const runners = record.tools.filter(t => t.name === 'Bash' && typeof t.input.command === 'string' && t.input.command.includes('pstack-runner')); + if (runners.some(t => /--provider[ =]['"]?claude\b/.test(t.input.command))) throw new Error('runner-used-for-claude'); + const probesDir = join(f.dir, 'probes'); + const probeEntries = (await readdir(probesDir).catch(() => [])).filter(name => name.endsWith('.json')); + let receiptPath: string | undefined, receipt: Record | undefined; + for (const name of probeEntries) { + const candidate = join(probesDir, name), parsed = parseJson(await readFile(candidate, 'utf8')) as Record | undefined; + if (parsed?.status === 'complete' && parsed.parent === 'claude' && parsed.provider === T3_SETUP_RUNNER.provider && + parsed.model === T3_SETUP_RUNNER.model && parsed.effort === T3_SETUP_RUNNER.effort && parsed.mode === 'read-only' && + parsed.modelEvidence === 'pinned-argv' && Date.parse(parsed.startedAt) >= record.started) { + receiptPath = candidate; receipt = parsed; break; + } + } + const flags = ['--parent claude', `--provider ${T3_SETUP_RUNNER.provider}`, `--model ${T3_SETUP_RUNNER.model}`, `--effort ${T3_SETUP_RUNNER.effort}`, '--mode read-only']; + const runner = runners.find(t => !t.failed && flags.every(flag => t.input.command.includes(flag)) && + (t.input.command.includes(probesDir) || (receiptPath !== undefined && t.input.command.includes(basename(receiptPath))))); + if (!runner) throw new Error('runner-probe-missing'); + const at = record.tools.indexOf.bind(record.tools); + if (capabilities < 0 || capabilities > Math.min(at(probe), at(runner))) throw new Error('capabilities-not-read-before-probes'); + if (!receiptPath || !receipt) throw new Error('runner-receipt-mismatch'); + const write = record.tools.findIndex(t => sheetWrite(t, sheet)); + if (write < 0) throw new Error('sheet-write-not-found'); + if (write < Math.max(at(probe), at(runner)) || (await lstat(sheet)).mtimeMs < Date.parse(receipt.completedAt)) throw new Error('sheet-written-before-probes'); + const text = await readFile(sheet, 'utf8'); + const expected = t3SetupRoles((await readCatalog(f.location)).defaults).map(([role, lanes]) => `${role}: ${lanes.join(', ')}`).sort(); + if (!Bun.deepEquals(roleLines(text).sort(), expected) || !Bun.deepEquals(settingLines(text), [BOUNDED_SETTING])) throw new Error('t3-setup-sheet-mismatch'); + marked(text); + const imports = (await readFile(join(f.configHome, 'CLAUDE.md'), 'utf8')).split('\n').filter(line => IMPORT.test(line.trim())); + if (imports.length !== 1) throw new Error(`import-lines:${imports.length}`); + return { assertions: [...assertions, 'capabilities-before-probes', `t3-probe:claudeAgent:${T3_SETUP_NATIVE.model}:effort=${T3_SETUP_NATIVE.effort}`, + `runner-probe:${T3_SETUP_RUNNER.provider}:${T3_SETUP_RUNNER.model}@${T3_SETUP_RUNNER.effort}`, 'sheet-after-probes', 'sheet-exact', 'one-import'], files: [sheet, receiptPath] }; }, }; @@ -960,6 +1100,7 @@ const grokSetup: Case = { export function recipe(feature: string, harness: Harness, routes: string[] = []): Case[] { if (harness === 't3') { if (feature === 'dispatch') return [t3Dispatch]; + if (feature === 'setup') return [t3Setup]; throw new Error(`missing-recipe:${harness}/${feature}`); } if (harness === 'grok') { diff --git a/.claude/skills/verify-open-pstack/features/runner.md b/.claude/skills/verify-open-pstack/features/runner.md index bec3d3d5..b104deff 100644 --- a/.claude/skills/verify-open-pstack/features/runner.md +++ b/.claude/skills/verify-open-pstack/features/runner.md @@ -26,4 +26,4 @@ From Codex the recipe adds the `linked-worktree-writer` case: one `claude:opus@m From Claude the recipe adds the `full-access-writer` case. Its fixture sheet puts `feature, refactoring` on `codex:gpt-6.2-sol@xhigh` and holds the line `codex writer sandbox: full-access`. The prompt names the sheet, the role and the lane's paths, never the runner flag. The child writes a per-run nonce to `.agents/result.json` in its cwd, and adds a second nonce that it reads from the DOM headless Chrome dumps for a fixture page (Playwright's Chromium when Chrome is absent). The page file holds that nonce only base64-encoded. The case asserts the receipt is `complete` for that route and cwd, records `writerSandbox: "full-access"` and carries `--sandbox danger-full-access` in its argv, and that the `.agents/` result written this session holds both nonces. Its counterpart, `bounded-writer`, uses the same dispatch from a fixture sheet that puts `feature, refactoring` on `codex:gpt-6.2-sol@low` and has no setting line. The child writes a per-run nonce to the plain file `result.json` in its cwd, which `workspace-write` allows; it uses no browser and no `.agents/` path. The case asserts the receipt is `complete` for that route and cwd, records `writerSandbox: "bounded"`, carries `--sandbox workspace-write` and never `danger-full-access` in its argv, and that `result.json` written this session holds the nonce. Docker is not exercised. Route overrides do not change these cases. -The `writers` feature is reachable when a path under `plugins/pstack/skills/poteto-mode/scripts/runner/providers/` changes, and runs only when named. Its recipe has one writer case each for `devin:swe-2@medium` and `dsh:deepseek-flash@low`, whose sheets hold no setting line, and for `opencode:opencode/deepseek-v4.1-flash-free@low`, `agy:gemini-3.8-flash@low`, `cursor:composer-2.5@default` and `amp:smart@default`, whose sheets hold ` writer sandbox: full-access`. Each fixture sheet puts `feature, refactoring` on that descriptor, and the prompt names the sheet, the role and the lane's paths, never the runner flag. The lane's cwd is a linked worktree of a run-owned repository. The child runs a Python command that writes the SHA-256 of a per-run nonce to `result.txt`; the case asserts the receipt is `complete` for that route, cwd and writer sandbox, and that `result.txt`, written this session, holds the hash, which the model cannot produce without running the command. `muse-writer` runs the same task with launcher arguments that name `--writer-sandbox full-access`, because no Muse family is registered for a sheet to name. `muse-reader` runs a read-only `muse:muse-spark-1.3@low` lane that must reply with a per-run marker from a fixture file, with a `pinned-argv` receipt. Each provider's cases also form the feature `writers:`, such as `writers:amp` or `writers:muse` (both Muse cases), and a change to that provider's adapter, tests or fixtures under `runner/providers/` reaches only that feature, while any other path there reaches the whole `writers` set. +The `writers` feature is reachable when a path under `plugins/pstack/skills/poteto-mode/scripts/runner/providers/` changes, and runs only when named. Its recipe has one writer case each for `devin:swe-2@medium` and `dsh:deepseek-flash@low`, whose sheets hold no setting line, and for `opencode:opencode/deepseek-v4.1-flash-free@low`, `agy:gemini-3.8-flash@low`, `cursor:composer-2.5@default` and `amp:smart@default`, whose sheets hold ` writer sandbox: full-access`. Each fixture sheet puts `feature, refactoring` on that descriptor, and the prompt names the sheet, the role and the lane's paths, never the runner flag. The lane's cwd is a linked worktree of a run-owned repository. The child runs a Python command that writes the SHA-256 of a per-run nonce to `result.txt`; the case asserts the receipt is `complete` for that route, cwd and writer sandbox, and that `result.txt`, written this session, holds the hash, which the model cannot produce without running the command. `muse-writer` runs the same task on the unregistered `muse-spark-1.3`, with launcher arguments that name `--writer-sandbox full-access` instead of a sheet. `muse-reader` runs a read-only `muse:muse-spark-1.3@low` lane that must reply with a per-run marker from a fixture file, with a `pinned-argv` receipt. Each provider's cases also form the feature `writers:`, such as `writers:amp` or `writers:muse` (both Muse cases), and a change to that provider's adapter, tests or fixtures under `runner/providers/` reaches only that feature, while any other path there reaches the whole `writers` set. diff --git a/.claude/skills/verify-open-pstack/features/t3.md b/.claude/skills/verify-open-pstack/features/t3.md index 0d7e0333..3cb100f5 100644 --- a/.claude/skills/verify-open-pstack/features/t3.md +++ b/.claude/skills/verify-open-pstack/features/t3.md @@ -1,21 +1,54 @@ -# T3 parent dispatch +# T3 parent dispatch and setup ## Sub-features -`t3:dispatch`: a T3 Code parent running the installed `poteto-mode` routes a role whose provider T3 offers through T3's `delegate_task`, with the model and effort from the model sheet, and judges the result by the T3 host completion rules in `provider-dispatch.md`. Select it for a change to `provider-dispatch.md`, `codex-tools.md`, `setup-pstack/SKILL.md` or `recipes.ts`. A path that reaches it never adds it to every run; name it with `--feature t3:dispatch`. +`t3:dispatch`: a T3 Code parent running the installed `poteto-mode` routes each role whose provider T3 offers through T3's `delegate_task`, on the instance and effort option that the T3 host instance rule in `provider-dispatch.md` picks, and judges each result by that section's completion rules. One lane is Claude and one is an unregistered Muse model on T3's `muse` driver. + +`t3:setup`: a T3 Code parent runs the installed `/setup-pstack` over a fixture sheet. It probes the T3-routed family through `delegate_task` and the Codex family through the runner, and writes the sheet only after both probes pass. + +Select both for a change to `provider-dispatch.md`, `codex-tools.md`, `setup-pstack/SKILL.md`, `recipes.ts`, `harness.ts` or `doctor.ts`. A path that reaches them never adds them to every run; name them with `--feature t3:dispatch --feature t3:setup`. ## How to get to it (user POV) -Start a T3 Code thread on the Claude provider with the candidate plugin loaded, and ask `poteto-mode` to dispatch one role from a model sheet. +Start a T3 Code thread on the Claude provider with the candidate plugin loaded. Ask `poteto-mode` to dispatch roles from a model sheet, or run `/setup-pstack`. ## Driving it with verify-open-pstack -The `t3` transport runs a disposable T3 server from the operator's installed service binary, `~/.t3/runtime/versions//t3`, which `~/.t3/runtime/service-state.json` names. The server's base directory and project live in the run root. Its `userdata/settings.json` sets the `claudeAgent` provider's `launchArgs` to the same session-only `--plugin-dir /plugins/pstack --settings '{"enabledPlugins":{"pstack@open-pstack":false}}'` the Claude harness uses, so the parent and every Claude child it delegates to load the candidate. Each case adds the fixture as a project, runs its prompt with `t3 thread start --provider claudeAgent --model claude-sonnet-5-5 --wait --json`, and stops the server. +The `t3` transport runs a disposable T3 server from the operator's installed service binary, `~/.t3/runtime/versions//t3`, which `~/.t3/runtime/service-state.json` names. The server's base directory and project live in the run root. Its `userdata/settings.json` sets the `claudeAgent` provider's `launchArgs` to the same session-only `--plugin-dir /plugins/pstack --settings '{"enabledPlugins":{"pstack@open-pstack":false}}'` the Claude harness uses, so the parent and every Claude child it delegates to load the candidate. A case adds more provider instances to those settings: + +- `dispatch` copies each enabled `muse` instance from the operator's `~/.t3/userdata/settings.json`, such as `muse_pool`, with only its driver, `enabled: true` and `config.binaryPath`. The base `muse` instance stays off by default, so the server has a disabled `muse` beside an enabled pool. The enabled `codex` instance also lists Muse models. The run stops with `t3-instance-missing:muse` when the operator has no enabled Muse instance. +- `setup` turns the `codex` instance off, so the Codex family takes the standalone route through the runner with `--parent claude`. + +Each case adds the fixture as a project, runs its prompt with `t3 thread start --provider claudeAgent --model claude-sonnet-5-5 --wait --json`, and stops the server. The transport hashes the operator's `~/.t3/userdata/settings.json` before and after each case and fails the run on any change (`t3-operator-settings-unchanged`). ## Gotchas -`t3 thread show --json` carries neither tool calls nor options, so the transport reads the parent's Claude transcript. The run-owned `statev2.sqlite` maps the T3 thread to its Claude session id (`nativeThreadRef.nativeId`), and the transcript is `/projects//.jsonl`. That transcript and the delegated child's stay in the operator's Claude projects folder; the verifier copies the parent's into the run root. The operator's T3 service, settings and data are never touched. +`t3 thread show --json` carries neither tool calls nor options, so the transport reads the parent's Claude transcript. The run-owned `statev2.sqlite` maps the T3 thread to its Claude session id (`nativeThreadRef.nativeId`), and the transcript is `/projects//.jsonl`. That transcript and the delegated children's stay in the operator's Claude projects folder; the verifier copies the parent's into the run root. The operator's T3 service, settings and data are never touched. + +`orchestrator_capabilities` lists a provider's models only for a search, so the `dispatch` case merges the models of every capability call in the transcript before it applies the instance rule. + +The T3 Claude runtime uses the operator's real Claude config home. `setup` is a setup feature, so the run snapshots `pstack-models.md` and `CLAUDE.md` there first, and restores and checks their bytes after the case. ## Headless -The `dispatch` case writes a fixture sheet whose `bug-fix` role is `claude:claude-haiku-5-5@low` and a `marker.txt` holding a per-run `crypto.randomUUID()` that the prompt never contains. It asserts the transcript's `Base directory for this skill` line for `poteto-mode` is the candidate plugin path; exactly one `delegate_task` call has `target.providerInstanceId` `claudeAgent`, `target.model` `claude-haiku-5-5` and `target.options` `{"effort":"low"}`; its result names the same provider, model and effort and is settled (`completed`, `result_available`, no pending child runs, question or approval); and its summary holds the marker. The request and response are retained as `delegate-task.json`. The model's prose is never read. +The `dispatch` case writes a fixture sheet whose `bug-fix` role is Haiku 5.5 at `low` and whose `judgment and prose` role is `muse-spark-1.3` at `low`, plus one `marker-N.txt` per lane holding a per-run `crypto.randomUUID()` that the prompt never contains. It asserts: + +- the transcript's `Base directory for this skill` line for `poteto-mode` is the candidate plugin path; +- exactly two `delegate_task` calls ran; +- the Claude lane's request and response name `claudeAgent`, `claude-haiku-5-5` and the option `effort` at `low`; +- the Muse lane's instance equals the pure `t3Pick` applied to the parent's own capability results, is never `codex`, and the request and response carry the option `reasoningEffort` at `low` (`instance-rule:muse`); +- each response is settled (`completed`, `result_available`, no pending child runs, question or approval), and its summary holds its lane's marker. + +The requests and responses are retained as `delegate-task.json`. + +The `setup` case runs `git init` in the fixture directory. It writes a fixture sheet into the snapshotted config home: the role defaults with every non-alias lane on Haiku 5.5 at `low`, `judgment and prose` on `gpt-6-luna` at `low`, the `# defaults: 3` line and `codex writer sandbox: bounded`. That makes the run a qualifying rerun, so setup asks nothing. The prompt puts probe files under `probes/` and smoke-test files under `smoke/` in the fixture directory. It asserts: + +- the transcript's `Base directory for this skill` line for `setup-pstack` is the candidate plugin path; +- `orchestrator_capabilities` ran before both probes; +- a settled `delegate_task` probe ran on `claudeAgent` with `claude-haiku-5-5` and `{"effort":"low"}`; +- a `pstack-runner` call ran with `--parent claude --provider codex --model gpt-6-luna --effort low --mode read-only`, and its receipt under `probes/` is `complete` with `pinned-argv` evidence; +- no runner call named `--provider claude`, and no `delegate_task` call named `gpt-6-luna`; +- the first tool call that writes the sheet comes after both probes, and the sheet's mtime is at or after the runner receipt's `completedAt`; +- the sheet holds exactly the fixture's roles, the one setting line and the `# defaults: 3` line, and `CLAUDE.md` holds exactly one import line for the sheet. + +The model's prose is never read. diff --git a/.claude/skills/verify-open-pstack/scripts/core.test.ts b/.claude/skills/verify-open-pstack/scripts/core.test.ts index dae63e53..115ee90b 100644 --- a/.claude/skills/verify-open-pstack/scripts/core.test.ts +++ b/.claude/skills/verify-open-pstack/scripts/core.test.ts @@ -64,18 +64,18 @@ describe('registry and ownership', () => { expect(s.features).toContain('claude:agent-preload:poteto-agent'); expect(s.features).not.toContain('codex:agent-preload:poteto-agent'); }); - test('only the T3 dispatch surfaces reach t3:dispatch, and self-test never adds a T3 session', () => { - const reach = (filename: string) => classify([{ filename }], registry).features.includes('t3:dispatch'); + test('only the T3 surfaces reach t3:dispatch and t3:setup, and self-test never adds a T3 session', () => { + const reach = (filename: string) => classify([{ filename }], registry).features.filter(f => f.startsWith('t3:')); for (const filename of ['plugins/pstack/skills/poteto-mode/references/provider-dispatch.md', 'plugins/pstack/skills/poteto-mode/references/codex-tools.md', 'plugins/pstack/skills/setup-pstack/SKILL.md', '.claude/skills/verify-open-pstack/features/recipes.ts', - '.claude/skills/verify-open-pstack/scripts/harness.ts', '.claude/skills/verify-open-pstack/scripts/doctor.ts']) expect(reach(filename)).toBe(true); + '.claude/skills/verify-open-pstack/scripts/harness.ts', '.claude/skills/verify-open-pstack/scripts/doctor.ts']) expect(reach(filename)).toEqual(['t3:dispatch', 't3:setup']); for (const filename of ['plugins/pstack/skills/poteto-mode/references/model-catalog.md', 'plugins/pstack/skills/poteto-mode/SKILL.md', - 'plugins/pstack/hooks/hooks.json', '.claude/skills/verify-open-pstack/scripts/verify.ts']) expect(reach(filename)).toBe(false); + 'plugins/pstack/hooks/hooks.json', '.claude/skills/verify-open-pstack/scripts/verify.ts']) expect(reach(filename)).toEqual([]); const r = receipt(true); expect(requiredHarnesses(r)).toEqual(['claude', 'codex']); - r.runFeatures = ['t3:dispatch']; + r.runFeatures = ['t3:dispatch', 't3:setup']; expect(requiredHarnesses(r)).toEqual(['claude', 'codex', 't3']); - expect(requiredFeatures(r, 't3')).toEqual(['dispatch']); + expect(requiredFeatures(r, 't3')).toEqual(['dispatch', 'setup']); }); test('every runtime ownership permits naming both Grok features; assets, version-only manifests and non-runtime paths do not', () => { const reach = (file: ChangedFile) => classify([file], registry).features.filter(f => f.startsWith('grok:')); @@ -244,7 +244,7 @@ describe('registry and ownership', () => { const path = '.claude/skills/verify-open-pstack/features/recipes.ts'; const expected = [...both('catalog', 'setup', 'runner', 'shipped-tools', 'shipped-tools:watch-pr', 'hook:startup', 'project-skill', 'writers', ...WRITER_PROVIDERS.map(provider => `writers:${provider}`), - ...registry.skills.map(skill => `skill-invocation:${skill}`)), 'claude:agent-preload:poteto-agent', 'grok:dispatch', 'grok:setup', 't3:dispatch'].sort(); + ...registry.skills.map(skill => `skill-invocation:${skill}`)), 'claude:agent-preload:poteto-agent', 'grok:dispatch', 'grok:setup', 't3:dispatch', 't3:setup'].sort(); for (const file of [{ filename: path }, { filename: 'docs/moved.md', previous_filename: path }]) { const s = classify([file], registry); expect(s.features).toEqual(expected); diff --git a/.claude/skills/verify-open-pstack/scripts/core.ts b/.claude/skills/verify-open-pstack/scripts/core.ts index b3d9d951..d162928f 100644 --- a/.claude/skills/verify-open-pstack/scripts/core.ts +++ b/.claude/skills/verify-open-pstack/scripts/core.ts @@ -17,7 +17,7 @@ export function matches(path: string, pattern: string): boolean { return pattern.endsWith('/**') ? path.startsWith(pattern.slice(0, -2)) : path === pattern; } -const T3_DISPATCH_PATHS = [ +const T3_PATHS = [ 'plugins/pstack/skills/poteto-mode/references/provider-dispatch.md', 'plugins/pstack/skills/poteto-mode/references/codex-tools.md', 'plugins/pstack/skills/setup-pstack/SKILL.md', '.claude/skills/verify-open-pstack/features/recipes.ts', '.claude/skills/verify-open-pstack/scripts/harness.ts', '.claude/skills/verify-open-pstack/scripts/doctor.ts', @@ -43,7 +43,7 @@ export function classify(files: ChangedFile[], registry: Registry): Selection { if (path !== 'plugins/pstack/assets/logo.png') throw new Error(`Unmapped asset consumer: ${path}`); features.add('codex:assets:codex'); covered = true; } - if (T3_DISPATCH_PATHS.includes(path)) features.add('t3:dispatch'); + if (T3_PATHS.includes(path)) ['t3:dispatch', 't3:setup'].forEach(f => features.add(f)); const sharedRecipe = path === '.claude/skills/verify-open-pstack/features/recipes.ts'; if (sharedRecipe) both('catalog', 'writers', ...WRITER_PROVIDERS.map(provider => `writers:${provider}`), 'shipped-tools:watch-pr'); const catalog = registry.catalog.some(p => matches(path, p)); diff --git a/.claude/skills/verify-open-pstack/scripts/harness.test.ts b/.claude/skills/verify-open-pstack/scripts/harness.test.ts index f6a4adb6..5182892a 100644 --- a/.claude/skills/verify-open-pstack/scripts/harness.test.ts +++ b/.claude/skills/verify-open-pstack/scripts/harness.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { doctor } from './doctor.ts'; import { linkCodexAuth } from './isolation.ts'; -import { codexInstallation, launch, MacDriver, parseSession, verifyCodexEnabled } from './harness.ts'; +import { codexInstallation, launch, MacDriver, parseSession, t3Settings, verifyCodexEnabled } from './harness.ts'; import { verifyProjectDoctor } from '../features/recipes.ts'; import { newReceipt } from './core.ts'; import { sourceDigest } from './provenance.ts'; @@ -64,6 +64,12 @@ describe('isolated harness boundaries', () => { } } }); + test('T3 server settings keep the candidate Claude provider over any instance a case adds', () => { + const claudeAgent = { driver: 'claudeAgent', config: { launchArgs: `--plugin-dir '/c/plugins/pstack' --settings '{"enabledPlugins":{"pstack@open-pstack":false}}'` } }; + expect(t3Settings('/c/plugins/pstack', {})).toEqual({ providerInstances: { claudeAgent } }); + const muse_pool = { driver: 'muse', enabled: true, config: { binaryPath: '/bin/muse-t3' } }, codex = { driver: 'codex', enabled: false }; + expect(t3Settings('/c/plugins/pstack', { muse_pool, codex, claudeAgent: { driver: 'claudeAgent' } })).toEqual({ providerInstances: { muse_pool, codex, claudeAgent } }); + }); test('candidate environment requires the real operator identity', () => { const previous = { HOME: process.env.HOME, USER: process.env.USER, LOGNAME: process.env.LOGNAME }; try { diff --git a/.claude/skills/verify-open-pstack/scripts/harness.ts b/.claude/skills/verify-open-pstack/scripts/harness.ts index 86b0c562..a5397f01 100644 --- a/.claude/skills/verify-open-pstack/scripts/harness.ts +++ b/.claude/skills/verify-open-pstack/scripts/harness.ts @@ -3,7 +3,7 @@ import { copyFile, mkdir, open, readdir, readFile, realpath, stat, writeFile } f import { basename, join } from 'node:path'; import { CLAUDE_TOOLS, recipe, type Fixture } from '../features/recipes.ts'; import { requiredFeatures, requiredHarnesses } from './core.ts'; -import { command, grokHome, isolatedEnv, retainedFile, save, session, treeHash, type Command, type Session } from './io.ts'; +import { command, grokHome, isolatedEnv, retainedFile, save, session, sha256, treeHash, type Command, type Session } from './io.ts'; import { doctor, t3Binary } from './doctor.ts'; import { grokSession, parseGrok } from './grok.ts'; import { assertCodexAuth, linkCodexAuth, linkMuseConfig, removeCodexHome, restoreSetup, snapshotSetup, type SetupSnapshot } from './isolation.ts'; @@ -12,6 +12,11 @@ import { publishable } from './verify.ts'; import { REPO, type Driver, type Harness, type Installation, type Observation, type Receipt, type SessionRecord } from './types.ts'; const T3_PARENT_MODEL = 'claude-sonnet-5-5'; +const T3_OPERATOR_SETTINGS = (): string => join(process.env.HOME!, '.t3/userdata/settings.json'); +export function t3Settings(location: string, instances: Record): { providerInstances: Record } { + return { providerInstances: { ...instances, claudeAgent: { driver: 'claudeAgent', + config: { launchArgs: `--plugin-dir '${location}' --settings '{"enabledPlugins":{"pstack@open-pstack":false}}'` } } } }; +} const setupFeature = (feature: string): boolean => feature === 'setup' || feature === 'skill-invocation:setup-pstack'; export function launch(harness: Exclude, workspace: string, options: { cwd: string; addDirs: string[]; codexSandbox?: 'danger-full-access'; claudePermission?: 'bypassPermissions' }): string[] { const addDirs = options.addDirs.flatMap(dir => ['--add-dir', dir]); @@ -150,11 +155,10 @@ export class MacDriver implements Driver { await copyFile(join(sessions, name), copy); return readFile(copy, 'utf8'); } - private async t3Thread(location: string, project: string, base: string, env: Record, prompt: string, out: { thread: string; stderr: string; transcript: string }): Promise { + private async t3Thread(location: string, project: string, base: string, env: Record, prompt: string, instances: Record, out: { thread: string; stderr: string; transcript: string }): Promise { const bin = await t3Binary(); await mkdir(join(base, 'userdata'), { recursive: true, mode: 0o700 }); - await writeFile(join(base, 'userdata/settings.json'), JSON.stringify({ providerInstances: { claudeAgent: { driver: 'claudeAgent', - config: { launchArgs: `--plugin-dir '${location}' --settings '{"enabledPlugins":{"pstack@open-pstack":false}}'` } } } })); + await writeFile(join(base, 'userdata/settings.json'), JSON.stringify(t3Settings(location, instances))); const listener = Bun.listen({ hostname: '127.0.0.1', port: 0, socket: { data() {} } }), port = listener.port; listener.stop(true); const log = await open(join(base, 'serve.log'), 'wx', 0o600); @@ -209,7 +213,11 @@ export class MacDriver implements Driver { let exitCode = 0, native: string[] = []; if (harness === 'grok') ({ exitCode, files: native } = await grokSession({ location: installation.location, tree: installation.treeHash, cwd, env, prompt: c.prompt(fixture), transcript: stdout, stderr, prefix: join(records, c.id) })); - else if (harness === 't3') await this.t3Thread(installation.location, cwd, join(home, 'server', `${slug}.${c.id}`), env, c.prompt(fixture), { thread, stderr, transcript: stdout }); + else if (harness === 't3') { + const operatorSettings = sha256(await readFile(T3_OPERATOR_SETTINGS())); + await this.t3Thread(installation.location, cwd, join(home, 'server', `${slug}.${c.id}`), env, c.prompt(fixture), await c.t3Instances?.(fixture) ?? {}, { thread, stderr, transcript: stdout }); + if (sha256(await readFile(T3_OPERATOR_SETTINGS())) !== operatorSettings) throw new Error(`${harness}/${feature}/${c.id}: t3-operator-settings-changed`); + } else exitCode = await this.record(launch(harness, workspace, { cwd, addDirs: cwd === dir ? [] : [dir], codexSandbox: c.codexSandbox, claudePermission: c.claudePermission }), { cwd, env, input: sessionInput(harness, c.prompt(fixture)), stdout, stderr }); evidence.push(stdout, ...harness === 't3' ? [thread] : [], ...native, ...(await stat(stderr)).size ? [stderr] : []); @@ -221,7 +229,7 @@ export class MacDriver implements Driver { record = harness === 'grok' ? parseGrok(text, exitCode, started, await readFile(join(records, `${c.id}.tool_definitions.json`), 'utf8'), await readFile(join(records, `${c.id}.chat_history.jsonl`), 'utf8')) : parseSession(harness, text, exitCode, started, rollout); result = await c.assert(record, fixture); } catch (error) { throw new Error(`${harness}/${feature}/${c.id}: ${error instanceof Error ? error.message : String(error)}`); } - assertions.push(...['exit-0', ...result.assertions].map(id => `${c.id}:${id}`)); + assertions.push(...['exit-0', ...result.assertions, ...harness === 't3' ? ['t3-operator-settings-unchanged'] : []].map(id => `${c.id}:${id}`)); for (const file of result.files) { const copy = join(records, `${c.id}.${basename(file)}`); await copyFile(file, copy); evidence.push(copy); diff --git a/.claude/skills/verify-open-pstack/scripts/t3.test.ts b/.claude/skills/verify-open-pstack/scripts/t3.test.ts new file mode 100644 index 00000000..aa3035fe --- /dev/null +++ b/.claude/skills/verify-open-pstack/scripts/t3.test.ts @@ -0,0 +1,135 @@ +import { afterEach, describe, expect, test } from 'bun:test'; +import { mkdir, mkdtemp, realpath, rm, writeFile } from 'node:fs/promises'; +import { homedir, tmpdir } from 'node:os'; +import { join, resolve } from 'node:path'; +import { recipe, sheetWrite, t3Pick, type Fixture, type T3Snapshot } from '../features/recipes.ts'; +import { command } from './io.ts'; +import type { SessionRecord } from './types.ts'; + +const roots: string[] = []; +afterEach(async () => { for (const root of roots.splice(0)) await rm(root, { recursive: true, force: true }); }); + +type Provider = T3Snapshot['providers'][number]; +const provider = (providerInstanceId: string, driverKind: string, models: Provider['models'], extra: Partial = {}): Provider => + ({ providerInstanceId, driverKind, canRunChildTask: true, canRunCrossProviderChildTask: true, constraints: [], models, ...extra }); +const efforts = (id: string, values: string[]) => [{ id, values }]; +const spark = { id: 'muse-spark-1.3', options: efforts('reasoningEffort', ['minimal', 'low', 'medium', 'high', 'xhigh', 'max']) }; +const neon = { id: 'gemini-neon', options: efforts('thought_level', ['low', 'medium', 'high', 'xhigh']) }; +const haiku = { id: 'claude-haiku-5-5', options: efforts('effort', ['low', 'medium', 'high', 'xhigh', 'max', 'ultrathink']) }; +const snapshot = (inheritedProviderInstanceId: string, providers: Provider[]): T3Snapshot => ({ inheritedProviderInstanceId, providers }); +const studio = snapshot('claudeAgent', [ + provider('codex', 'codex', [{ ...spark, options: [...spark.options, { id: 'cyberAccessProgram', values: ['standard'] }] }, { id: 'gemini-neon-low', options: efforts('reasoningEffort', ['low']) }]), + provider('claudeAgent', 'claudeAgent', [haiku]), + provider('antigravity', 'antigravity', [], { canRunChildTask: false, canRunCrossProviderChildTask: false, constraints: ['Provider instance is disabled.'] }), + provider('antigravity_pool', 'antigravity', [neon]), + provider('antigravity_helium', 'antigravity', [neon]), + provider('muse', 'muse', [], { canRunChildTask: false, canRunCrossProviderChildTask: false, constraints: ['Provider instance is disabled.'] }), + provider('muse_pool', 'muse', [spark]), +]); + +describe('t3Pick', () => { + test.each([ + ['muse lane on the enabled pool beside a disabled muse, never codex', studio, { driverKind: 'muse', model: 'muse-spark-1.3', effort: 'low' }, + { instance: 'muse_pool', options: { reasoningEffort: 'low' }, qualifying: ['muse_pool'] }], + ['first of two enabled Antigravity pools, with thought_level', studio, { driverKind: 'antigravity', model: 'gemini-neon', effort: 'high' }, + { instance: 'antigravity_pool', options: { thought_level: 'high' }, qualifying: ['antigravity_pool', 'antigravity_helium'] }], + ['inherited instance over an earlier qualifying one', snapshot('antigravity_helium', studio.providers), { driverKind: 'antigravity', model: 'gemini-neon', effort: 'low' }, + { instance: 'antigravity_helium', options: { thought_level: 'low' }, qualifying: ['antigravity_pool', 'antigravity_helium'] }], + ['claudeAgent effort option', studio, { driverKind: 'claudeAgent', model: 'claude-haiku-5-5', effort: 'max' }, + { instance: 'claudeAgent', options: { effort: 'max' }, qualifying: ['claudeAgent'] }], + ['default passes no options on any listed model', studio, { driverKind: 'muse', model: 'muse-spark-1.3', effort: 'default' }, + { instance: 'muse_pool', options: {}, qualifying: ['muse_pool'] }], + ])('%s', (_name, snap, lane, expected) => expect(t3Pick(snap, lane)).toEqual(expected)); + + test.each([ + ['ultrathink does not list ultra', studio, { driverKind: 'claudeAgent', model: 'claude-haiku-5-5', effort: 'ultra' }], + ['an effort the option omits', studio, { driverKind: 'muse', model: 'muse-spark-1.3', effort: 'ultra' }], + ['a CLI model that carries the effort lives only on codex', studio, { driverKind: 'antigravity', model: 'gemini-neon-low', effort: 'low' }], + ['a cross-provider instance that cannot run cross-provider children', + snapshot('claudeAgent', [provider('claudeAgent', 'claudeAgent', []), provider('muse_pool', 'muse', [spark], { canRunCrossProviderChildTask: false })]), + { driverKind: 'muse', model: 'muse-spark-1.3', effort: 'low' }], + ['a muse lane when only codex lists the model', snapshot('claudeAgent', [studio.providers[0]!]), { driverKind: 'muse', model: 'muse-spark-1.3', effort: 'low' }], + ])('no instance: %s', (_name, snap, lane) => expect(t3Pick(snap, lane)).toBeUndefined()); +}); + +describe('sheetWrite', () => { + const sheet = join(homedir(), '.claude/pstack-models.md'); + test.each([ + ['Write tool', { name: 'Write', input: { file_path: sheet } }, true], + ['Edit tool on another file', { name: 'Edit', input: { file_path: `${sheet}.bak` } }, false], + ['heredoc redirect', { name: 'Bash', input: { command: `cat > ${sheet} <<'EOF'\nx\nEOF` } }, true], + ['tilde redirect', { name: 'Bash', input: { command: 'printf x > ~/.claude/pstack-models.md' } }, true], + ['copy into the sheet', { name: 'Bash', input: { command: `cp /tmp/render.md "${sheet}"` } }, true], + ['copy via shell home variable', { name: 'Bash', input: { command: `S=/tmp/setup\nH=${homedir()}\ncp $S/snapshots/pstack-models.md.before $H/.claude/pstack-models.md && cp $S/snapshots/CLAUDE.md.before $H/.claude/CLAUDE.md` } }, true], + ['copy via H=$HOME variable', { name: 'Bash', input: { command: 'H=$HOME\ncp /tmp/render.md $H/.claude/pstack-models.md' } }, true], + ['copy via braced config dir variable', { name: 'Bash', input: { command: `C="${join(homedir(), '.claude')}"; cp /tmp/render.md "\${C}/pstack-models.md"` } }, true], + ['snapshot copy out via shell home variable', { name: 'Bash', input: { command: `S=/tmp/setup\nH=${homedir()}\ncp -p $H/.claude/pstack-models.md $S/snapshots/pstack-models.md.before` } }, false], + ['snapshot copy out of the sheet', { name: 'Bash', input: { command: `cp ${sheet} /tmp/snapshot.md` } }, false], + ['read with stderr redirected', { name: 'Bash', input: { command: `cat ${sheet} 2>/dev/null` } }, false], + ])('%s', (_name, tool, expected) => expect(sheetWrite({ id: 't', parent: null, failed: false, ...tool }, sheet)).toBe(expected)); +}); + +test('t3:setup accepts a runner probe whose command stores probes dir in a shell variable', async () => { + const dir = await realpath(await mkdtemp(join(tmpdir(), 'pstack-t3-setup-'))); roots.push(dir); + const workspace = resolve(import.meta.dir, '../../../..'), location = join(workspace, 'plugins/pstack'); + const configHome = join(dir, 'claude-home'); + await mkdir(join(dir, 'probes'), { recursive: true }); + await mkdir(configHome, { recursive: true }); + await writeFile(join(configHome, 'CLAUDE.md'), '@~/.claude/pstack-models.md\n'); + const f: Fixture = { harness: 't3', dir, workspace, location, configHome, run: command }; + const setup = recipe('setup', 't3')[0]!; + await setup.prepare!(f); + const started = Date.now() - 5000, completedAt = new Date(Date.now() - 2000).toISOString(); + const sheet = join(configHome, 'pstack-models.md'); + await writeFile(join(dir, 'probes/luna-low.receipt.json'), JSON.stringify({ + status: 'complete', parent: 'claude', provider: 'codex', model: 'gpt-6-luna', effort: 'low', + mode: 'read-only', modelEvidence: 'pinned-argv', startedAt: new Date(started + 500).toISOString(), completedAt, + })); + const record: SessionRecord = { + harness: 't3', exitCode: 0, started, commands: [], context: [], skills: [join(location, 'skills/setup-pstack')], + tools: [ + { name: 'mcp__t3-code__orchestrator_capabilities', id: 't1', input: {}, parent: null, failed: false }, + { name: 'mcp__t3-code__delegate_task', id: 't2', input: { target: { providerInstanceId: 'claudeAgent', model: 'claude-haiku-5-5', options: { effort: 'low' } } }, + result: JSON.stringify({ status: 'completed', workState: 'result_available', hasPendingChildRuns: false, hasPendingQuestion: false, pendingApproval: null }), parent: null, failed: false }, + { name: 'Bash', id: 't3', input: { command: `B=${dir}; R=${join(location, 'skills/poteto-mode/scripts/runner/pstack-runner')}; "$R" --parent claude --provider codex --model gpt-6-luna --effort low --mode read-only --receipt "$B/probes/luna-low.receipt.json"` }, + parent: null, failed: false }, + { name: 'Write', id: 't4', input: { file_path: sheet }, parent: null, failed: false }, + ], + }; + await writeFile(sheet, await Bun.file(sheet).text()); + expect((await setup.assert(record, f)).assertions).toContain('runner-probe:codex:gpt-6-luna@low'); + + const withFailedCodex: SessionRecord = { + ...record, + tools: [ + ...record.tools.slice(0, 2), + { name: 'mcp__t3-code__delegate_task', id: 't2b', input: { target: { providerInstanceId: 'codex', model: 'gpt-6-luna', options: { reasoningEffort: 'low' } } }, + result: 'OrchestratorMcpFailure provider disabled', parent: null, failed: true }, + ...record.tools.slice(2), + ], + }; + await expect(setup.assert(withFailedCodex, f)).rejects.toThrow('runner-family-on-t3'); +}); + +test('t3:dispatch rejects a failed wrong-instance muse delegate_task before retry', async () => { + const dir = await realpath(await mkdtemp(join(tmpdir(), 'pstack-t3-dispatch-'))); roots.push(dir); + const workspace = resolve(import.meta.dir, '../../../..'), location = join(workspace, 'plugins/pstack'); + const f: Fixture = { harness: 't3', dir, workspace, location, configHome: dir, run: command }; + const dispatch = recipe('dispatch', 't3')[0]!; + await dispatch.prepare!(f); + const m1 = (await Bun.file(join(dir, 'marker-1.txt')).text()).trim(); + const m2 = (await Bun.file(join(dir, 'marker-2.txt')).text()).trim(); + const record: SessionRecord = { + harness: 't3', exitCode: 0, started: Date.now() - 5000, commands: [], context: [], skills: [join(location, 'skills/poteto-mode')], + tools: [ + { name: 'mcp__t3-code__orchestrator_capabilities', id: 'c1', input: {}, result: JSON.stringify(studio), parent: null, failed: false }, + { name: 'mcp__t3-code__delegate_task', id: 'd0', input: { target: { providerInstanceId: 'muse', model: 'muse-spark-1.3', options: { reasoningEffort: 'low' } } }, + result: 'OrchestratorMcpFailure provider disabled', parent: null, failed: true }, + { name: 'mcp__t3-code__delegate_task', id: 'd1', input: { target: { providerInstanceId: 'claudeAgent', model: 'claude-haiku-5-5', options: { effort: 'low' } } }, + result: JSON.stringify({ providerInstanceId: 'claudeAgent', model: 'claude-haiku-5-5', options: [{ id: 'effort', value: 'low' }], status: 'completed', workState: 'result_available', hasPendingChildRuns: false, hasPendingQuestion: false, pendingApproval: null, summary: m1 }), parent: null, failed: false }, + { name: 'mcp__t3-code__delegate_task', id: 'd2', input: { target: { providerInstanceId: 'muse_pool', model: 'muse-spark-1.3', options: { reasoningEffort: 'low' } } }, + result: JSON.stringify({ providerInstanceId: 'muse_pool', model: 'muse-spark-1.3', options: [{ id: 'reasoningEffort', value: 'low' }], status: 'completed', workState: 'result_available', hasPendingChildRuns: false, hasPendingQuestion: false, pendingApproval: null, summary: m2 }), parent: null, failed: false }, + ], + }; + await expect(dispatch.assert(record, f)).rejects.toThrow('delegate-task-calls:3'); +}); diff --git a/CHANGES.md b/CHANGES.md index 734b7aa4..ef973b25 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,12 @@ This port applies the Cursor → Claude Code substitutions in skill bodies. Earl ## Unreleased +**T3 instance and effort option from the snapshot (#311, #283).** On a T3 parent, a lane's T3 instance and effort option now come from `orchestrator_capabilities`, not from a fixed list. A candidate instance has the lane's `driverKind`, can run a child task, has no constraints, and lists the resolved model. The model's option named `effort`, `reasoningEffort` or `thought_level` must list the requested effort, and the request passes that option alone. The inherited instance wins when it qualifies, and otherwise the first qualifying instance in snapshot order does, so two enabled Antigravity pools no longer block a lane. Antigravity lanes pass the catalog model ID with `thought_level`, never the CLI model that carries the effort. Muse lanes now run on T3's `muse` driver, such as an enabled `muse_pool` beside a disabled `muse`, and never on the `codex` instance that also lists Muse models. An unregistered pair also runs on the T3 route. + +**T3 tools (#311).** In a T3 session, pstack uses T3's `pull_request_*`, `ci_logs` and `ci_rerun` for pull request work, `watch_pull_request` for wakes, `schedule_task` in place of `/loop`, `html_preview` and `html_render` for inline visuals, and `preview_*` for a browser check the user asks for. A merge loop still runs `watch-pr`. + +**T3 live gate covers setup and Muse (#280, #311).** The `verify-open-pstack` T3 transport adds a `t3:setup` case that runs `/setup-pstack` on a disposable T3 server and checks the T3 and runner probes, the write order and the operator's T3 settings. `t3:dispatch` adds a Muse lane on a copy of the operator's enabled Muse instance. + **Sync to Cursor pstack 0.15.50 (#310).** Open Pstack tracks Cursor pstack 0.15.50 at `43fc4fd50d73f4f32cca95cf8563a4c7b24b80c9`. Nine upstream commits since 0.15.36 touch pstack, and all nine are applied with the port adaptations in `UPSTREAM.md`. `/reframe` teaches the expert words for what you are building and runs only when typed. `/statechart` also checks a Lean 4 proof pinned to Lean `v4.34.1` and draws its lemma graph and proof tree. `how`, `why`, `reflect` and `architect` are now one file each: `how` starts one read-only subagent, `why` cites the record, `reflect` reads the transcript itself, and `architect` sketches two shapes or runs `arena`. They stay model-invocable. Poteto-mode's new `worker.md` holds the rules every started agent reads first. The Orchestrate playbook and the plan checker are retired. The principles and many skill texts are shorter. **Nine role defaults (#310).** The first-run sheet has nine roles: `feature, refactoring` and `swarm workers` on Opus at `high`; `bug-fix`, `perf-issue` and `hillclimb` on Sol at `xhigh`; `judgment and prose` on Gemini at `high`; `arena runners` on Gemini, Astra and Fable; `arena cross-judge pool` on Gemini, Fable and Astra; and `interrogate reviewers` on Sol, Gemini and Opus. Opus now defaults to `high` and Fable to `medium`. The `hardest tasks`, `how explorer`, `how explainer`, `why investigators, synthesizer`, `reflect tooling, judgment, divergent, synthesizer` and `architect runners` roles are retired, and setup drops their rows. Per-spawn raising stops at `xhigh`, panel seats keep their configured effort, and an effort the operator configured above `xhigh` stays as configured. diff --git a/plugins/pstack/skills/poteto-mode/references/codex-tools.md b/plugins/pstack/skills/poteto-mode/references/codex-tools.md index a10198eb..f79025f2 100644 --- a/plugins/pstack/skills/poteto-mode/references/codex-tools.md +++ b/plugins/pstack/skills/poteto-mode/references/codex-tools.md @@ -1,6 +1,6 @@ # Codex tool mapping for pstack -pstack skills retain Claude Code tool language (`Skill`, `Agent`, `AskUserQuestion`) in shared prose. On Codex the files are the same; only those tool names resolve differently. Model execution is not translated here. Read [`provider-dispatch.md`](provider-dispatch.md) for the parent-owned Claude/Codex/Grok route table and provider-qualified descriptors. In a T3 Code session under either app, its [T3 host](provider-dispatch.md#t3-host) section routes each lane. This file's subagent, background, and wait mappings apply only to a lane it gives the standalone route. +pstack skills retain Claude Code tool language (`Skill`, `Agent`, `AskUserQuestion`) in shared prose. On Codex the files are the same; only those tool names resolve differently. Model execution is not translated here. Read [`provider-dispatch.md`](provider-dispatch.md) for the parent-owned Claude/Codex/Grok route table and provider-qualified descriptors. In a T3 Code session under either app, its [T3 host](provider-dispatch.md#t3-host) section routes each lane. This file's subagent, background, and wait mappings apply only to a lane it gives the standalone route. In a T3 session, the [T3 tools](provider-dispatch.md#t3-tools) table maps pull request, CI, scheduling, visual and browser actions to T3's tools. ## Harness config homes @@ -124,7 +124,7 @@ Some triggers name skills that ship with Claude Code, not pstack. They do not ex | `run` (drive a CLI/TUI to see a change work) | Run the app yourself via `shell` and observe the real output. | | `verify` (drive a UI to confirm a fix) | Drive the UI with whatever automation you have, or hand the user a concrete manual check. Do not claim done without observing the artifact. | | `plugin-dev:skill-development` (Claude's SKILL.md authoring guidance) | Follow your platform's skill-authoring guidance; the `writing-skills` skill if present. Keep `name` + `description` frontmatter and progressive disclosure. | -| `loop` (recurring/self-paced re-invocation, used by `babysit`) | Codex has no `loop` skill. Re-run the step yourself on a cadence, or use a Codex scheduled task if available. | +| `loop` (recurring/self-paced re-invocation, used by `babysit`) | Codex has no `loop` skill. Re-run the step yourself on a cadence, or use a Codex scheduled task if available. In a T3 session, use `schedule_task` as [T3 tools](provider-dispatch.md#t3-tools) says. | ## Vendored scripts diff --git a/plugins/pstack/skills/poteto-mode/references/provider-dispatch.md b/plugins/pstack/skills/poteto-mode/references/provider-dispatch.md index 1685fd6e..97310405 100644 --- a/plugins/pstack/skills/poteto-mode/references/provider-dispatch.md +++ b/plugins/pstack/skills/poteto-mode/references/provider-dispatch.md @@ -14,7 +14,7 @@ The allowed effort universe is exactly `low`, `medium`, `high`, `xhigh`, `max`, A rolling alias, such as `opus`, names a family whose CLI resolves it to the latest available family revision. A runner receipt keeps the requested alias in `model` and the concrete provider-reported revision in `reportedModel`; verification accepts only a revision of the matching family, as the catalog's rolling-alias table gives it. -A descriptor whose `(provider, model)` matches no matrix row, kept predecessor, or rolling-alias revision is an unregistered pair. It runs unchanged on an external route and on Codex's native route. A Claude-native route needs a generated agent, so an unregistered Claude model on a Claude Code parent is a dropout. An unregistered Grok model on a Grok parent uses the runner like every explicit Grok descriptor. Never guess a replacement. +A descriptor whose `(provider, model)` matches no matrix row, kept predecessor, or rolling-alias revision is an unregistered pair. It runs unchanged on an external route, on Codex's native route, and on the [T3 route](#t3-host), where the model's T3 effort option must list the requested effort. A Claude-native route needs a generated agent, so an unregistered Claude model on a Claude Code parent is a dropout. An unregistered Grok model on a Grok parent uses the runner like every explicit Grok descriptor. Never guess a replacement. ## Read-time normalization @@ -40,7 +40,7 @@ A T3 Code parent records two facts once, before fan-out: the orchestration harne Read `orchestrator_capabilities` once per parent run and keep the snapshot. Route each normalized descriptor in this order: -1. T3 route: call `delegate_task` when T3 lists a provider for the descriptor's provider with `canRunChildTask`, no constraints, `canRunCrossProviderChildTask` when it is not the parent's provider, and the resolved model with the requested effort. Match the descriptor's provider to T3's `driverKind` with this table: +1. T3 route: call `delegate_task` when the instance rule below picks a T3 provider instance for the lane. Match the descriptor's provider to T3's `driverKind` with this table: | Pstack provider | T3 `driverKind` | | --- | --- | @@ -50,14 +50,24 @@ Read `orchestrator_capabilities` once per parent run and keep the snapshot. Rout | `grok` | `grok` | | `opencode` | `opencode` | | `agy` | `antigravity` | + | `muse` | `muse` | A provider missing from the table has no T3 driver and takes the standalone route. 2. Standalone route: any other lane takes the route a standalone parent of the same runtime gives it in the [route table](model-catalog.md#routes): the runtime's native subagent for its own provider, and otherwise the external runner with `--parent` set to the runtime. 3. A lane neither route can run is a named dropout. Never lower the effort or pick another model. +Pick the instance and the effort option from the snapshot, never from a fixed list of instance names or option keys: + +- A candidate is a provider whose `driverKind` is the lane's row in the table, with `canRunChildTask: true` and empty `constraints`. When its `driverKind` differs from that of the `inheritedProviderInstanceId` instance, it also needs `canRunCrossProviderChildTask: true`. +- Match only by `driverKind`. The `codex` instance also lists Claude, Gemini and Muse models, and Muse rejects every call made through the Codex driver. +- A candidate must list the resolved model ID in its `models`. That ID is the normalized descriptor's model, or the revision a rolling alias resolves to. Never use the CLI model that the catalog's effort-in-the-model-ID table gives for an effort. +- The model's effort option is the entry in its `options` whose `id` is `effort`, `reasoningEffort` or `thought_level`. A candidate qualifies only when that option's `values` list the requested effort exactly. A value of `ultrathink` does not list `ultra`. Effort `default` qualifies on any candidate that lists the model. +- Use the `inheritedProviderInstanceId` instance when it qualifies. Otherwise use the first qualifying instance in snapshot order. Record every qualifying instance in the lane's T3 result record. +- With no qualifying instance, the lane takes the standalone route. + On the T3 route: -- Set `target.providerInstanceId` to the provider's `providerInstanceId` and `target.model` to a concrete model ID. Put the effort in the model's effort option: `{"effort": ""}` on `claudeAgent`, `{"reasoningEffort": ""}` on `codex`. Effort `default` passes `options: {}`, which clears inherited settings. A family whose effort is in its CLI model passes that CLI model and no effort option. Use `mode: "wait"` when this turn needs the result, and `mode: "async"` otherwise. +- Set `target.providerInstanceId` to the picked instance and `target.model` to the resolved model ID. Set `target.options` to the effort option alone, keyed by its `id`: `{"effort": ""}` on `claudeAgent`, `{"reasoningEffort": ""}` on `codex` or `muse`, and `{"thought_level": ""}` on `antigravity`. Pass no other option. Effort `default` passes `options: {}`, which clears inherited settings. Use `mode: "wait"` when this turn needs the result, and `mode: "async"` otherwise. - `inherit-parent` and `auto` call `delegate_task` with no `target`, so the child inherits the parent's provider, model, and options. Record the parent selection from the snapshot's `inheritedProviderInstanceId`, `inheritedModel`, and `inheritedOptions`. - A rolling alias such as `opus` resolves only among that provider's models, from the `orchestrator_capabilities` search `claude-`; the unfiltered list omits models, so search before treating a model as missing. Keep only IDs that match the alias's versioned-predecessor form in the catalog's [rolling-alias table](model-catalog.md#kept-predecessors-and-normalization), and take the highest revision, compared number by number. A suffix that is not digits and hyphens, such as `-high`, is not a revision. A registered exact pin stays exact. - A writer that needs its own checkout uses `isolation: "worktree"`. T3 creates it from the parent's commit and leaves uncommitted edits out, so give the child a committed base or explicit fixture inputs in its task. Never commit unrelated changes for it, and never create a child checkout in the shell. @@ -68,12 +78,27 @@ Keep one T3 result record per lane: the capability snapshot, the normalized desc A T3 lane completes only when all of these hold: -1. The response's task, provider, model, and effort match the request, compared on the normalized required settings only. `inherit-parent` matches the recorded parent selection, and `default` matches empty options. +1. The response's task, provider, model, and effort match the request, compared on the normalized required settings only. The response's options hold the request's effort option as `{"id": "", "value": ""}`. `inherit-parent` matches the recorded parent selection, and `default` matches empty options. 2. The response reports `status: "completed"`, `workState: "result_available"`, `hasPendingChildRuns: false`, `hasPendingQuestion: false`, and `pendingApproval: null`. 3. The summary is nonempty, and every artifact the calling skill requires exists. A `wait` timeout means the child is still running: follow T3's `next`, and never poll or replace it. A failed, cancelled, interrupted, or mismatched task is a named dropout. +### T3 tools + +A T3 session uses T3's own tools for these pstack actions: + +| pstack action | T3 tool | +| --- | --- | +| Open, list, read, update, review, reply on, or merge a pull request | `pull_request_create`, `pull_request_list`, `pull_request_read`, `pull_request_update`, `pull_request_review`, `pull_request_respond`, `pull_request_merge` | +| Read or rerun a pull request's CI checks | `ci_logs`, `ci_rerun` | +| Wake on a pull request's comments or checks | `watch_pull_request`, then `unwatch_pull_request` when the work ends | +| Recurring wakeups that `/loop` gives on Claude Code | `schedule_task`, bound to the current thread, then `delete_scheduled_task` when the loop ends | +| An inline visual in `/ketchup` or `/statechart` | `html_preview`, then `html_render` | +| Browser verification, only when the user asks for it | `preview_*`. Close the tab before replying. | + +`watch_pull_request` only adds wakes. A merge loop, such as babysit's step 6 or shipping, still runs `watch-pr` and acts on its verdicts. `watch_pull_request` and `unwatch_pull_request` exist only on top-level T3 threads. + ## Native lanes Native dispatch avoids a second CLI startup and its base context. diff --git a/plugins/pstack/skills/setup-pstack/SKILL.md b/plugins/pstack/skills/setup-pstack/SKILL.md index a8d58c51..933091a5 100644 --- a/plugins/pstack/skills/setup-pstack/SKILL.md +++ b/plugins/pstack/skills/setup-pstack/SKILL.md @@ -83,7 +83,7 @@ Probe only the selected `provider:model@effort` pair of each assigned family. Ru If a Grok probe fails because the host cannot enforce its bounded sandbox, see [Host and parent prerequisites](../poteto-mode/references/provider-dispatch.md#host-and-parent-prerequisites); keep the active configuration unchanged. -Find the family's provider in the [route table](../poteto-mode/references/model-catalog.md#routes). A native-only route gets a native one-turn probe: on Claude Code, the family's `pstack--` agent; on Codex, `spawn_agent` with the descriptor's model and `reasoning_effort`. On Grok, `inherit-parent` and `auto` get a `spawn_subagent` probe with `subagent_type: pstack:poteto-agent`, and the parent records any Grok `[subagents.models]`, role, or persona override for that type. An external route gets one `pstack-runner` call with a tiny read-only probe prompt and `--parent` set to the parent running this skill. On a Grok parent every explicit descriptor, including every Grok descriptor, takes that call. The runner's preflight checks the CLI, the login and the model, and its receipt is the result. A T3 route gets one `delegate_task` probe, and its T3 result record must meet T3 host's completion rules. +Find the family's provider in the [route table](../poteto-mode/references/model-catalog.md#routes). A native-only route gets a native one-turn probe: on Claude Code, the family's `pstack--` agent; on Codex, `spawn_agent` with the descriptor's model and `reasoning_effort`. On Grok, `inherit-parent` and `auto` get a `spawn_subagent` probe with `subagent_type: pstack:poteto-agent`, and the parent records any Grok `[subagents.models]`, role, or persona override for that type. An external route gets one `pstack-runner` call with a tiny read-only probe prompt and `--parent` set to the parent running this skill. On a Grok parent every explicit descriptor, including every Grok descriptor, takes that call. The runner's preflight checks the CLI, the login and the model, and its receipt is the result. A T3 route gets one `delegate_task` probe on the instance, model and effort option that T3 host's instance rule picks, and its T3 result record must meet T3 host's completion rules. Use a tiny read-only probe that returns a unique marker. For each family that an external writer role uses on a provider whose writer needs a `full-access` setting line, also run one `isolated-write` probe in a disposable linked worktree, with `--writer-sandbox full-access`, that creates a small program and runs it; it passes only when the program's output file holds the expected marker. A login-status command alone proves credentials, not that the requested model and effort flags run. Record native, external, and T3 results separately. Never call the external launcher for a Claude or Codex parent's own provider.