跪拜 Guibai
← Back to the summary

Codex Sub-Agents Slash Task Costs to $0.61 by Separating Planning from Execution

Codex Sub-Agent Division of Labor in Practice: Sol as Strategist, Luna as Brick Carrier — Single Task Cost Down to $0.61

Let's start with a counter-intuitive data point: on the DeepSWE (Software Engineering Capability Evaluation) leaderboard, gpt-5.6-luna tops the chart with a single-task cost of $0.61, while more expensive models like Claude Opus 5 and GPT-5.6 cost several times more but score lower. It's not that expensive models can't perform; it's that they are used in the wrong place — having a senior architect carry bricks isn't impossible, just too expensive.

Over the past few days, the Codex sub-Agent solution has been going viral on Twitter. Its essence boils down to one sentence: Let the expensive model handle only planning and decision-making, and throw the dirty work of execution to cheap models running in parallel. Someone did the math: using this setup, a ChatGPT Plus subscription can deliver 20 times the output of a Pro subscription. I configured a version myself and migrated it to my own content pipeline. This post covers the configuration steps, pitfalls, and migration thinking all at once.

Why Your Quota Is Always Running Out

Conclusion first: Running out of quota is not a usage volume problem; it's two structural problems — the expensive model does too much dirty work, and long conversations suffer from "chronic poisoning."

Pain Point 1: Making Sol Do Everything Is Like Making an Architect Carry Bricks

Anyone who has used Codex knows that GPT-5.6 (Sol) is indeed strong at reasoning, but the bill is unbearable. Running a slightly complex development task visibly drains the quota. Facing a large number of development tasks, Sol's quota simply isn't enough — it runs out before you're halfway through.

And are cheap models really incapable? The DeepSWE data already answers this: on a large number of execution-type tasks, Luna's cost-effectiveness crushes all competitors — spending one-tenth the money for the same or even better work.

Pain Point 2: Context Rot — Long Conversations Are Silently Dumbing Down

When you stuff everything into a single conversation — requirement discussions, code exploration, test logs, error stacks — the model's effective attention gets gradually diluted. It starts forgetting previous agreements, repeating mistakes, and hallucinating more and more.

OpenAI officially calls this phenomenon Context Rot:

Context pollution: useful information gets buried under noisy intermediate output. Context rot: performance degrades as the chat fills up with less relevant details.

Key sentence: You are working on an increasingly messy desk, important documents buried under scrap paper — the model is the same; the more you stuff in, the more it forgets.

Core Idea: The Brain Thinks, the Hands and Feet Do

Conclusion first: The main Agent is the brain, sub-Agents are the hands and feet; the brain doesn't do manual labor, and the hands and feet don't make major decisions.

The division of labor in one sentence: Sol (GPT-5.6) stays in the main thread as the strategist, responsible for solution design; Luna (GPT-5.6-luna) is configured as a sub-Agent to act as the brick carrier, responsible for parallel execution.

Role Model Does What Cost
Strategist (Main Agent) gpt-5.6 Breaks down requirements, defines solutions, integrates reports Expensive, but only touches key decisions
Brick Carrier (Sub-Agent) gpt-5.6-luna Explores code, runs tests, makes summaries, fixes small bugs $0.61/task, parallelizable

Why does this setup save money? Because the bulk of an LLM's cost isn't in "thinking," it's in "token volume." Moving high-token, low-judgment tasks like exploration and testing to a cheap model, while keeping the expensive model only for low-token, high-judgment planning, naturally brings the bill down.

Three Steps to Configure Your First Sub-Agent

Conclusion first: Configuration requires no coding — one TOML file + one invocation call, running in 5 minutes.

Step 1: Enable Max Reasoning Effort

Go to Codex's Settings → Configuration → Available reasoning efforts and check Max. Without enabling this option, the later model_reasoning_effort = "max" configuration will not take effect.

Step 2: Create the Sub-Agent Configuration File

Enter this prompt directly in the Codex conversation; it will automatically create the file:

Please create a global custom sub-agent at ~/.codex/agents/luna-worker.toml.
Configuration requirements:
- Agent name: luna_worker
- Model: gpt-5.6-luna
- Reasoning effort: max
- Positioning: Quickly complete clearly bounded, repeatable small tasks
- Working method: Strictly adhere to the task scope, work independently, verify results when feasible, and concisely report results, relevant file paths, and notes

After execution, you will get a file similar to this (path: ~/.codex/agents/luna-worker.toml):

name = "luna_worker"
description = "Fast worker for clear, narrowly scoped, and repeatable tasks."
developer_instructions = """
Handle the assigned task strictly within its stated scope.
Work independently and use appropriate tools when needed.
Verify the result when practical.
Do not make unrelated changes.
Return a concise summary containing the result, relevant file paths, verification performed, and any important caveats.
"""
model = "gpt-5.6-luna"
model_reasoning_effort = "max"

Step 3: Start Using

From now on, invoke it in the Codex conversation like this:

Please use the luna_worker sub-agent to complete the following task: Check all TypeScript files in the src/ directory for circular dependencies in imports. Wait for the sub-agent to finish, then summarize the results.

Sol receives the instruction → dispatches Luna to do the work → Luna finishes and reports back → Sol integrates and gives you the final answer. The whole process, you only see Sol's final reply; the dirty work runs in parallel in the background.

Advanced: Build Your Agent Team

Conclusion first: Not just one sub-Agent — you can configure multiple Agents with different responsibilities, collaborating in parallel like a team, each with independent context that doesn't interfere with others.

The "Code Review Trio" from the official documentation:

Agent Model Responsibility Sandbox
pr_explorer (Code Explorer) gpt-5.6-luna / medium Read-only tracking of real execution paths, gather evidence before proposing changes read-only
reviewer (Code Reviewer) gpt-5.6-terra / high Prioritize finding correctness, security, behavioral regressions, missing tests read-only
docs_researcher (Docs Researcher) gpt-5.6-luna / medium Use docs MCP to verify API and framework behavior read-only

Three Agents run in parallel, and the main Agent summarizes at the end. The same applies to frontend debugging scenarios: one Agent reproduces the bug using a browser, one read-only tracks the code path, and the last makes minimal fixes after the problem is clear — especially suitable for investigating UI regressions and cross-component interaction bugs.

How to Choose Models and Reasoning Effort: A Quick Reference Table

Conclusion first: The money-saving trick is — most execution-type sub-Agents only need luna + medium; only deep-reasoning review tasks require high / max.

Scenario Model Reasoning Effort
Explore code, run tests, summarize gpt-5.6-luna medium
Write code, make specific fixes gpt-5.6-luna max
Code review, solution design gpt-5.6-terra high
Main Agent final decision gpt-5.6 max

5 Practical Pitfalls to Avoid

Conclusion first: Sub-Agents are not a silver bullet; using them in the wrong scenario makes things more expensive. These 5 points are distilled from official docs and real-world testing.

  1. Sub-Agents are suited for "read more, write less": Best for read-only tasks like exploration, testing, and summarization; multiple Agents modifying code simultaneously can cause conflicts.
  2. A good sub-Agent is "narrow and paranoid": Each does only one thing; the more specific the instructions, the better. Don't let it "check if there are problems elsewhere" — it will go off track.
  3. Sub-Agents consume more Tokens: Each has independent context and tool calls, so token usage is higher than a single Agent; but the quality improvement for complex tasks is worth the cost.
  4. Sandbox permissions must be tightly controlled: Set read-only sub-Agents to sandbox_mode = "read-only"; only grant workspace-write to those that explicitly need write permissions.
  5. Use /agent to manage threads: In the CLI, you can view and switch between active sub-Agent threads to see their progress in real-time.

Applying to Your Own Pipeline: How Content Production Adapts

Conclusion first: This routing logic of "expensive model plans, cheap model executes" isn't just for Codex — your content pipeline and multi-platform operations workflows can use it too.

I made three migrations in my own WeChat Official Account / Juejin / Zhihu content pipeline:

Context Rot is worth remembering for anyone building pipelines: the longer the conversation, the more you must be wary of "it seems to be working normally." If you find the Agent starting to repeat mistakes and forget agreements, don't blame it first; check if your context is too overloaded.

Summary

The core mental model boils down to one sentence: The main Agent is the brain, sub-Agents are the hands and feet. The brain should not do manual labor.

The expensive model is responsible for thinking, the cheap model for doing, and short contexts prevent dumbing down — this combination isn't tool-specific. Codex can use it, your WorkBuddy workstation can use it, any LLM application can use it.


How do you usually handle the problem of "long conversations getting dumber"? Do you push through stubbornly, or decisively start a new session? Share your Context Rot experiences in the comments. The next post is planned to be "Agent Tool Runaway Report: A Single SQL Locks the Database for 4 Hours, a Callback Triggers Unauthorized Payout" — about the bottom-line design of Agent permission governance. Stay tuned.