Feature Request: Native Subagent System (spawn_subagents / chain_subagents)
Resolved 💬 2 comments Opened Jan 2, 2026 by elchapita43 Closed Jan 2, 2026
Summary
I've implemented a native subagent system for Codex CLI that allows the main agent to delegate tasks to parallel workers with isolated context windows.
Problem
Currently, when Codex needs to explore a codebase, it fills its own context window with raw file contents. This leads to:
- Context exhaustion during exploration
- Need for aggressive auto-compaction
- Loss of important details when compacting
Issue #2604 (219+ upvotes) requests this feature.
Solution Implemented
I built a working implementation with:
spawn_subagents: Parallel execution (up to 24 agents)chain_subagents: Sequential execution with{{previous_output}}templating- Context isolation per subagent
- Read-only "explore" mode with restricted tools
- Hardcoded gpt-5.1-codex-mini for subagents
- Transcript persistence for resume capability
Implementation
- Fork with working code: https://github.com/elchapita43/codex/tree/subagentsv2
- New files:
core/src/subagents.rs,core/src/tools/handlers/subagents.rs,core/src/tools/policy.rs - Docs:
docs/subagents.md
Request
Would the team be interested in reviewing this for potential merge? Happy to adapt the implementation to fit your roadmap and coding standards.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗