feat(codex): carve the three mutually exclusive modes into sections

Review/Challenge/Consult mode bodies (34.7KB where at most one ever runs)
load on demand: skeleton 81.0KB -> 55.2KB, union 1.04x the monolith. The mode
dispatch, filesystem boundary, and a new always-loaded 'Synthesis
recommendation (REQUIRED) — all modes' block stay skeleton-side (the AUQ
per-skill pins pass unchanged); the plan-file report + exit gate render after
the last section pointer per the gateAfterStop pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-25 16:36:02 +00:00
co-authored by Claude Fable 5
parent 3a78bf7c1d
commit 87589961a4
13 changed files with 1184 additions and 1044 deletions
+23 -9
View File
@@ -473,17 +473,31 @@ describeIfSelected('Codex skill E2E', ['codex-review'], () => {
run('git', ['add', 'user_controller.rb']);
run('git', ['commit', '-m', 'add vulnerable controller']);
// Extract only the review-relevant section from codex SKILL.md (~120 lines vs 1075).
// Full SKILL.md is 55KB / ~14K tokens — takes 8 Read calls to consume, exhausting turns.
// Extract only the review-relevant content (CLAUDE.md: "extract, don't copy").
// The codex skill is carved (T9): the skeleton carries setup + dispatch and
// STOP-points to codex/sections/*-mode.md. Build the fixture from the
// skeleton's setup slices plus the review-mode section body, SKIPPING the
// Section index and STOP pointers — their install paths don't exist in this
// temp fixture dir and would burn agent turns on failed Reads.
const full = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
const startMarker = '# /codex — Multi-AI Second Opinion';
const endMarker = '## Plan File Review Report';
const start = full.indexOf(startMarker);
const end = full.indexOf(endMarker, start);
const reviewSection = full.slice(
start >= 0 ? start : 0,
end > start ? end : undefined,
const introStart = full.indexOf('# /codex — Multi-AI Second Opinion');
const introEnd = full.indexOf('## Section index', introStart);
const stepsStart = full.indexOf('## Step 0.4', introStart);
const stepsEnd = full.indexOf('> **STOP.**', stepsStart);
expect(introStart).toBeGreaterThan(-1);
expect(introEnd).toBeGreaterThan(introStart);
expect(stepsStart).toBeGreaterThan(introEnd);
expect(stepsEnd).toBeGreaterThan(stepsStart);
const reviewMode = fs.readFileSync(
path.join(ROOT, 'codex', 'sections', 'review-mode.md'),
'utf-8',
);
expect(reviewMode).toContain('## Step 2A: Review Mode'); // non-empty, right section
const reviewSection = [
full.slice(introStart, introEnd),
full.slice(stepsStart, stepsEnd),
reviewMode,
].join('\n');
fs.writeFileSync(path.join(codexDir, 'codex-SKILL.md'), reviewSection);
});