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
@@ -29,6 +29,7 @@ import {
passThroughNonAskUserQuestion,
resolveClaudeBinary,
} from './helpers/agent-sdk-runner';
import { buildSetupGbrainFixture } from './helpers/setup-gbrain-fixture';
const describeE2E = describeE2ETier('periodic');
@@ -166,11 +167,14 @@ describeE2E('/setup-gbrain Path 4 + Step 4.5 Yes → local PGLite for code', ()
process.env.GBRAIN_MCP_TOKEN = 'gbrain_fake_token_for_test';
try {
const skillPath = path.resolve(
import.meta.dir,
'..',
'setup-gbrain',
'SKILL.md',
// Carve-aware fixture (see test/helpers/setup-gbrain-fixture.ts):
// skeleton + brain-init (Step 4 Path 4 body incl. the Step 4d local
// PGLite offer this test says Yes to) + claude-md-persist (Step 8 sits
// on the walked path to Step 10). Non-empty guard inside the builder.
const skillPath = path.join(sandboxHome, 'setup-gbrain-SKILL.md');
fs.writeFileSync(
skillPath,
buildSetupGbrainFixture(['brain-init.md', 'claude-md-persist.md']),
);
const result = await runAgentSdkTest({
systemPrompt: { type: 'preset', preset: 'claude_code' },