Hacking Subagents Into Codex CLI — Brian John, Betterup
Nov 24, 2025 · 13:39
Brian John, Principal Full Stack Engineer at Betterup, explains how to hack subagents into OpenAI's Codex CLI by using a 72-line wrapper script that launches child Codex processes as subagents, enabling context management without polluting the main agent's window. He details the minimum sandbox permissions required—workspaceright on both parent and child, plus disabling the rollout recorder—and notes that security risk is low per Meta's Rule of 2, though not zero. The wrapper uses file-based communication to avoid repetitive permission prompts, and subagents are defined in an agents.md file with configurable reasoning effort. John demonstrates a word counter and file writer agent, noting that Codex runs subagents serially and slower than Claude Code (e.g., 40 seconds for a simple task, up to 20 minutes for large codebases), but considers this acceptable for Codex's unattended design.