← back

Hacking Subagents Into Codex CLI — Brian John, Betterup

6.2K views · Nov 24, 2025 · 13:38 min · Watch on YouTube ↗
Takeaway

You can bolt Claude-Code-style subagents onto Codex CLI with a wrapper-script + file-handoff pattern, but tuning the sandbox permissions is the real engineering challenge.

Summary

  • Brian John (BetterUp) wanted Claude Code-style subagents in OpenAI's Codex CLI to escape single-tool/single-model lock-in.
  • Design: parent Codex session runs a wrapper script that calls `codex exec` as a child, which writes its answer to a file the wrapper reads back — keeping subagent context out of the parent window.
  • Hardest part is sandbox permissions: parent needs `--sandbox workspace`; child needs careful access to OpenAI credentials in the home directory without using `--dangerously-skip-permissions`.
  • Credits Dex Hory's earlier talk on subagent workflows as the inspiration for adopting this pattern on large codebases.
codex-clisubagentscoding-agents
Original description
Subagents are amazing tools for managing context, among other things. But Codex CLI doesn't have them. Let's change that!

Brian John is a Principal Full Stack Engineer with over a decade of experience in technology. He is currently working on using AI to help his R&D team members ship faster and with higher quality.

---
Socials:
- LinkedIn: https://linkedin.com/in/brianjohn
- X (Twitter): https://x.com/brianpjohn
- GitHub: https://github.com/f1sherman
- Website: https://blog.brianjohn.com
- Company: Betterup (https://betterup.com)