Use Codex as the Grunt to Save Claude Code's Context
claude-codex-subagent is a Claude Code skill that turns your local codex exec into a worker subagent whose whole job is to save Claude context. The pain point is concrete: every WebFetch, every read of a two-thousand-line file, every screenful of grep chews through the main conversation’s context. A session burns thousands of tokens to get back a single conclusion, all the money goes into hauling bricks, and the conversation itself gets squeezed out. Codex has its own context, network, and sandboxed shell, so you hand it a well-scoped task, it does the dirty work heads-down and passes back only a short answer. On Claude’s side you only pay for “the prompt sent out plus the answer received” — none of the brick-hauling in between enters the main conversation.
That makes the division of labor clear: planning, decisions, verification, and maintaining conversation state stay with Claude; web search, file I/O, long reads, bulk analysis, writing long files, running tests, and doing audits all get thrown to Codex. It doesn’t depend on Node or Python, doesn’t need an MCP server — as long as codex is on your PATH it runs, on mac, Linux, and Windows (git-bash or WSL).
A few key design points. Sandbox is adaptive: the default is --sandbox workspace-write, and when a task needs network access, crosses workspaces, or wants full local permissions it automatically bumps up to --dangerously-bypass-approvals-and-sandbox — no approval dialog pops up, Claude states in one line which mode it picked and why, then just goes. Interruptions are the most annoying thing in a batch task. The thin-forwarding contract: Codex’s stdout is the authoritative return, Claude isn’t allowed to embellish it — one in, one out, no drift. stderr isn’t dumped to /dev/null; openssl rand generates a random name and the thinking stream gets written to /tmp/codex-<rand>.log, so the terminal stays clean when things go well and you can trace back when they don’t. On top of that: reasoning strength is tuned per task category (audits and reviews get high), resume-first uses codex exec resume --last to reuse a session instead of paying twice, parallel bulk dispatch, and structured result classification (success / partial / error handled separately, never silently retried). It ships with 5 built-in personas — reviewer, debugger, auditor, researcher, refactorer — each with a default sandbox and reasoning strength. They’re really just plain markdown with a {{TASK}} placeholder, so if you want to write your own, follow the format and drop it in.
No pretense of originality: this is stitched together from the parts of five predecessor projects I thought got it right. Thin forwarding comes from openai/codex-plugin-cc, stderr-to-temp-log comes from timurkhakhalev’s codex-cli-setup, structured classification comes from shinpr/sub-agents-skills, resume-first comes from skills-directory/skill-codex, and file-based personas come from leonardsellem/codex-subagents-mcp. The adaptive upgrade is the one bit I added myself. Go star all of them if they’re worth it.
Installation is light: after git clone, copy skills/codex-subagent into ~/.claude/skills/ and Claude Code discovers it automatically. The boundaries, stated plainly: it doesn’t replace Read/Edit for small files — when the target is small and specific, using the tools directly is cheaper, and this only pays off when the old approach would burn more than 3k tokens. It’s also not for outsourcing thinking; judgment always stays in Claude’s hands, Codex is just the one doing the work.