feat(setup-gbrain): carve the branch-exclusive install paths into sections

Brain-init (Paths 1/2/3/4 bodies), engine remediation, transcript gate, and
CLAUDE.md persist load on demand — at most one install route ever runs.
Skeleton 75.3KB -> 57.0KB; the Step 1 detect and Step 2 path dispatch stay
always-loaded. New buildSetupGbrainFixture helper gives the periodic E2Es
extract-don't-copy fixtures with a non-empty guard; the voyage-code-3 gate
counts scan the tmpl union (the third init site lives in engine-remediation).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-25 17:03:12 +00:00
co-authored by Claude Fable 5
parent 6bb1996004
commit cdfe2d9074
18 changed files with 1336 additions and 1021 deletions
+10 -1
View File
@@ -7,6 +7,11 @@
// regression guard for the "verify failed → STOP" gate.
//
// Cost: ~$0.30-$0.50 per run. Gate-tier (EVALS=1 EVALS_TIER=gate).
//
// Carve-aware: the Step 4 Path 4 body (collect URL/token, verify, STOP rule)
// lives in setup-gbrain/sections/brain-init.md, so the fixture inlines that
// section into the skeleton via buildSetupGbrainFixture. Step 8 is not needed:
// on a failed verify the skill STOPs before any CLAUDE.md write.
import { test, expect } from 'bun:test';
import { describeE2ETier } from './helpers/e2e-gate';
@@ -15,6 +20,7 @@ import * as os from 'os';
import * as path from 'path';
import * as http from 'http';
import { runAgentSdkTest, passThroughNonAskUserQuestion, resolveClaudeBinary } from './helpers/agent-sdk-runner';
import { buildSetupGbrainFixture } from './helpers/setup-gbrain-fixture';
// Periodic-tier (companion to skill-e2e-setup-gbrain-remote.test.ts).
// Deterministic gate coverage lives in setup-gbrain-path4-structure.test.ts.
@@ -86,7 +92,10 @@ describeE2E('/setup-gbrain Path 4 — bad token STOPs cleanly', () => {
let modelTextOutput = '';
try {
const skillPath = path.resolve(import.meta.dir, '..', 'setup-gbrain', 'SKILL.md');
// Carve-aware fixture: skeleton + brain-init inlined (non-empty guard
// inside the builder). The test drives Steps 4a-4c to the STOP.
const skillPath = path.join(gstackHome, 'setup-gbrain-SKILL.md');
fs.writeFileSync(skillPath, buildSetupGbrainFixture(['brain-init.md']));
const result = await runAgentSdkTest({
systemPrompt: { type: 'preset', preset: 'claude_code' },
userPrompt: