Apply to my task
arXiv:2512.12716 ★ 71 Dec 14, 2025

CoDA: Separating the Planner's and the Executor's Contexts

Key result

The model fails at step 3-4 of a complex task, not because of the window limit but because of "context explosion." Every tool call (search, database) adds 2,000-4,000 tokens of raw data; by the fourth step the context is bloated to 12,000 tokens, critical facts get lost in the middle and reasoning degrades. CoDA lets you run multi-step tasks without degradation: the model stays focused at every stage. The trick: architectural separation into two isolated contexts. The Planner sees only short results (50-100 tokens), while the Executor works in a temporary, ephemeral space with the raw data (4,000 tokens) and returns a compressed summary. The raw data vanishes once the subtask is done, and the strategic context stays compact: 500 tokens instead of 12,000+.

01

TL;DR

CoDA is a way of working with LLMs where a single model operates in two modes with isolated contexts: the Planner breaks the task into steps in a clean strategic context, and the Executor carries out each step in a temporary workspace and returns only a short result. The raw, lengthy tool outputs (search, databases) never make it into the Planner's context.

Models break down on complex multi-step tasks because of "context explosion": every tool call adds 2,000-4,000 tokens of raw data, by the 3rd or 4th call the context is bloated to the limit, important information gets lost in the middle, and reasoning degrades. You can't simply delete the long outputs after using them: the model was trained on the full history, so trimming creates a gap between training and use, and coherence breaks.

CoDA solves this with architectural separation. The Planner sees: {task, (subtask₁ → result₁), (subtask₂ → result₂)}. The Executor for subtask₃ works in an ephemeral context: {subtask₃} → search → 4,000 tokens of documents → summarization → short result₃. That result₃ (50-100 tokens) goes back to the Planner. The raw 4,000 tokens vanish once the subtask is done. The strategic context stays compact at every stage.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

MODE 1: PLANNER (strategic context):
Input: {task, history of short results}
Output: the next subtask OR the final answer

MODE 2: EXECUTOR (isolated temporary context):
Step 1: Receive a subtask → initialize a clean context
Step 2: Call tools (search, API) → get raw data
Step 3: Summarize the key information → create a short result
Step 4: Return the result to the Planner → delete the temporary context

LOOP: Planner → Executor → Planner → ...
       until the final answer is reached

One model, two isolated contexts. The raw, lengthy data lives only in the Executor's temporary space.

03

Example in Action

Task: You're preparing an investor pitch for a new delivery service. You need data on 4 questions: the size of the US delivery market in 2024, competitors' average order value, the most-requested features in reviews, and logistics trends. Each search returns 3,000+ tokens of articles, reviews and reports.

Prompt for the Planner (main chat):

You are a strategist. Break the task into subtasks. 
For each subtask, I'll do the work in a separate space 
and return ONLY a short result to you (3-5 sentences).

Task: {your pitch task}

Once you have all the results, put together the final answer.

Format:
SUBTASK 1: [what to find]
SUBTASK 2: [what to find]
...

Workflow: 1. The Planner outputs a list of subtasks 2. For each subtask, you open a new chat (the Executor):

Find: [subtask 1]

Run the search, study the results, and give a SHORT SUMMARY 
(3-5 sentences with the key numbers and facts).

3. The Executor runs the search → gets long articles → summarizes 4. **You copy only the short summary** into the main chat for the Planner 5. Repeat for the remaining subtasks 6. The Planner sees only 4 compact summaries → assembles the final answer **Result:** Planner context: ~500 tokens (4 short summaries of 100 tokens each). Without CoDA it would be ~12,000+ tokens (4 subtasks × 3,000 tokens of raw data) → the model would drown, lose focus and mix up facts. --- ## Why It Works LLMs **degrade on long contexts** not because of the window limit but because of **"lost in the middle"**: information in the middle of a long sequence becomes unavailable for reasoning. After 3-4 tool calls (3,000 tokens each), the context balloons to 10,000-12,000 tokens, critical facts get lost, and the model hallucinates or ignores key data. LLMs are **excellent at focused summarization**: give them one document + a clear task → you get a dense summary. And they're excellent at **planning** in a compact space: give them a task + short facts → they'll build a strategy. CoDA gets **strength through separation**: the Executor works with a narrow focus (one subtask, one chunk of data, one summary), and its context never exceeds 4,000-5,000 tokens. The Planner works in a clean strategic space (short summaries only), and its context grows linearly and slowly (100 tokens per subtask vs. 3,000 in a monolithic agent). **Control knobs:** - **Result compression level**: ask the Executor for "2-3 sentences" to save tokens or a "detailed paragraph" for complex subtasks - **Summarization criteria**: specify exactly what to extract (numbers, facts, opinions) → the Executor filters out the noise - **Number of subtasks**: don't split simple tasks; use it for 3+ step processes where each step generates lots of data - **Explicit isolation**: give the Executor the phrase "ignore everything except this subtask" → sharpens focus --- ## Prompt Template ### For the Planner (main chat):
You are a strategist. Your task: {task}.

Break it into subtasks. For each subtask, I'll do the work 
in a separate, isolated space and return ONLY 
a short result to you (3-5 sentences).

You see only:
- The original task
- Short results of completed subtasks

Format:
SUBTASK 1: [a specific action]
SUBTASK 2: [a specific action]
...

Once I return all the results, put together the final answer.

**What to fill in:** - `{task}`: your complex multi-step task (analysis, research, data gathering) --- ### For the Executor (a separate chat for each subtask):
Subtask: {subtask}

Do the following:
1. Find/analyze the information you need
2. Study the results in detail
3. Give a SHORT SUMMARY: 3-5 sentences with the key 
   facts/numbers/insights

Ignore everything except this subtask. Focus on a compressed, 
dense result.

**What to fill in:** - `{subtask}`: one subtask from the Planner's list --- ### Workflow: 1. Run the Planner → get the list of subtasks 2. For each subtask: new chat → Executor prompt → short summary 3. Copy the summary into the Planner's chat: `RESULT 1: [summary]` 4. Repeat for every subtask 5. The Planner assembles the final answer --- 🚀 **Quick start**: paste this into the chat:
Here's a CoDA template for tackling a complex task by separating 
contexts. Adapt it to my task: [your task]. 

Create for me:
1. A prompt for the Planner (main chat)
2. A template for the Executor (subtasks)
3. Workflow instructions

[paste both templates above]

The LLM will ask about the specifics of your task (how many steps, what data to collect, what output format), because it needs to tune the level of detail in the results and the summarization criteria to your context. It'll take the context-isolation pattern and adapt it to your specific task. --- ## Limitations > ⚠️ **Workflow overhead:** It requires switching between chats and **discipline**: you have to copy only the short results and never mix contexts. For simple tasks (1-2 steps) it's overkill and the overhead doesn't pay off. > ⚠️ **Summarization is critical:** If the Executor summarizes poorly (drops a key fact), the Planner will make decisions on incomplete data. You need to state explicitly **what** to extract from the raw data. > ⚠️ **Not for tasks with cumulative context:** If each next step critically depends on **all the details** of the previous ones (for example, writing code step by step where each line affects the next), isolation hurts. CoDA is for tasks you can **decompose**, where subtask results are **independent or loosely coupled**. --- ## How They Studied It A team from Alibaba and Georgia Tech ran into a classic problem: LLM agents do great on simple tasks but **break on complex multi-hop questions** that need 4-5 rounds of search and reasoning. The hypothesis was simple: the issue isn't the model's ability to reason, it's that **the context fills up with junk**. They trained CoDA with **reinforcement learning (PECO)**, a technique where the model learns from outcomes: right answer → reward, wrong answer → penalty. The key training trick: **one reward for the whole trajectory** (Planner + all Executor calls), but **the gradient is computed separately** for each mode based on its isolated context. It's like teaching one person to be both a strategist and an executor, but training each skill in its own conditions. They compared CoDA against monolithic agents (the whole history in one context) on the **HotpotQA** and **2WikiMultihopQA** benchmarks, datasets with complex questions like "Who directed the movie starring the actor born in the same city as...". Result: **+6% accuracy** over the best baselines. But the most interesting part is the **long-context stress test**. The researchers artificially inflated each search output (adding irrelevant text) from 1,000 to 4,000-6,000 tokens. The monolithic agents **collapsed**: accuracy dropped from ~70% to ~30-40%. CoDA **stayed stable**, dipping only 2-3%. Why? Because the Executor summarized even the bloated documents into a short result, and the Planner **never saw** that junk. The researchers' conclusion: the problem isn't the size of the context window (even 128K-token models break); the problem is **architecture**. If you pile everything up, the model loses the ability to focus. **Context isolation** isn't a crutch; it's a fundamental principle for complex tasks. --- ## Adaptations and Extrapolations ### 🔧 Technique: Single-Responsibility Contexts → sharper focus You can strengthen the CoDA principle with an **explicit role constraint** in each chat:
# Planner chat: add to the system prompt:
You see ONLY short results. If you see raw data 
(long texts, documents), ignore it; it's not meant for you.
Your zone is strategy, not details.

# Executor chat: add to every subtask:
The context of this chat is EPHEMERAL. Once you deliver the result, it will 
be deleted. Work as if this is the only task in the world.

This strengthens isolation: the model **explicitly knows the boundaries** of its role, so there's less temptation to mix levels of abstraction. --- ### 🔧 Technique: Template-Based Results → standardized data handoff When there are many subtasks (5-7 steps), it's easier for the Planner if the results are **structured**:
# For the Executor, add:
Result format:
KEY FACT: [1-2 sentences]
NUMBERS: [specific figures, if any]
TAKEAWAY: [1 sentence]

# The Planner receives:
RESULT 1:
KEY FACT: The US delivery market grew 23% in 2024...
NUMBERS: Market size $45 billion, average order $28
TAKEAWAY: The market is growing, competition is fierce

The template **lowers the cognitive load** on the Planner: the data is easy to scan, compare and use. --- ### 🔧 Extrapolation: CoDA + Chain-of-Thought for the Executor If a subtask is **complex** (for example, competitor analysis with conclusions), give the Executor **room to reason**:
Subtask: {complex subtask}

Steps:
1. GATHER: Find the information
2. REASON: Analyze it step by step (Chain-of-Thought)
3. DISTILL: Compress the reasoning into a short summary (3-5 sentences)

I will see ONLY step 3. Steps 1-2 are for your internal work.

This is a hybrid setup: inside the Executor you get full reasoning (CoT for quality), and only the distillate goes to the Planner (clean context). The best of both worlds.

04

Resources

CoDA: A Context-Decoupled Hierarchical Agent with Reinforcement Learning
Code: github.com/liuxuanzhang718/CoDA
Xuanzhang Liu, Jianglun Feng, Zhuoran Zhuang (Alibaba Group), Pan Li (Georgia Institute of Technology)

Research digest

Key result

The model fails at step 3-4 of a complex task, not because of the window limit but because of "context explosion." Every tool call (search, database) adds 2,000-4,000 tokens of raw data; by the fourth step the context is bloated to 12,000 tokens, critical facts get lost in the middle and reasoning degrades. CoDA lets you run multi-step tasks without degradation: the model stays focused at every stage. The trick: architectural separation into two isolated contexts. The Planner sees only short results (50-100 tokens), while the Executor works in a temporary, ephemeral space with the raw data (4,000 tokens) and returns a compressed summary. The raw data vanishes once the subtask is done, and the strategic context stays compact: 500 tokens instead of 12,000+.

Principle

One model, two modes with isolated contexts. The Planner works in the main chat: it sees the task and the short results and generates the next subtask. For each subtask you open a new chat (the Executor), and the model gets a clean workspace: it runs the search → gets 4,000 tokens of documents → summarizes them to 3-5 sentences → you return the short result to the Planner. The temporary context with the raw data is deleted. The Planner makes decisions on a compact strategic context, the Executor focuses on one subtask: each works in optimal conditions.

Why it works

LLMs suffer from "lost in the middle": information in the middle of a long context (8,000-12,000 tokens) becomes unavailable for reasoning. You can't just delete data once it's used: the model was trained on the full history, and trimming breaks coherence. CoDA gets strength through separation: the Executor summarizes with focus (one subtask, one chunk of data), and the Planner builds strategy on compact facts. The Executor's context never exceeds 4,000-5,000 tokens (one work cycle). The Planner's context grows linearly and slowly: 100 tokens per subtask vs. 3,000 in a monolithic agent. Result: with 5 subtasks a monolithic agent drowns at 15,000 tokens, while CoDA holds at 500-600.

When to apply

For complex multi-step tasks (3+ steps) where every step generates lots of data → market research (searching 5-10 topics), analytics prep (pulling data from different sources), competitive analysis (studying 3-5 players), report writing (aggregating information from databases). Especially when each tool call returns 2,000+ tokens of raw data. NOT suited for tasks with cumulative context: writing code step by step where each line affects the next, or when the result critically depends on every detail of the previous steps.

Mini recipe

1. Launch the Planner in the main chat: `You are a strategist. Break the task into subtasks. For each one, I'll do the work in a separate space and return ONLY a short result (3-5 sentences). Task: {your task}. Once you have all the results, put together the final answer.` 2. Get the list of subtasks from the Planner (SUBTASK 1: find the market size, SUBTASK 2: study the competitors...) 3. For each subtask, open a new chat (the Executor): `Subtask: {subtask from the list}. Run the search/analysis, study the results, give a SHORT SUMMARY: 3-5 sentences with the key facts/numbers. Ignore everything except this subtask.` 4. Copy only the short summary into the Planner's main chat: `RESULT 1: [summary from the Executor]` 5. Repeat for the remaining subtasks: a new chat for each one, short result back to the Planner 6. The Planner assembles the final answer once it has all the results

Examples

[BAD]: `Find me data on 5 topics: the size of the US delivery market, competitors' average order value, popular features, logistics trends, growth forecasts`: everything in one chat; by the third topic the context is bloated to 9,000+ tokens, the model loses focus and mixes up facts from different sources [GOOD]: Main chat (Planner): `You are a strategist. I'm preparing an investor pitch for a delivery service. Break it into subtasks: market size, competitors, features, trends. I'll do each one in a separate space and return a short summary.` → You get the list of subtasks → New chat for subtask 1: `Find the size of the US delivery market in 2024. Give 3-5 sentences with the key numbers` → The Executor searches and summarizes → You copy the summary into the main chat → Repeat for the remaining subtasks → The Planner sees only 5 compact summaries (~500 tokens) and assembles the final pitch

In plain words

In Plain Words: 2512.12716

In Plain Words

CoDA: A Context-Decoupled Hierarchical Agent with Reinforcement Learning

The problem with today's models isn't that they "remember" too little; it's that they drown in their own verbosity. CoDA fixes a fundamental bug: when an AI agent digs through data for a long time, it turns into a sleepy professor buried in paperwork who has forgotten why he came in the first place. It happens because of the lost in the middle effect: the model flat-out ignores important facts if they're tucked away in the middle of a long text. CoDA forcibly splits the "brain" into two isolated zones: one only plans the strategy, while the other does the grunt work in the field without cluttering the boss's head with junk.

Picture a home renovation where you hire a general contractor and a worker. In the usual setup, the contractor hauls the bags himself, crunches the budget and hangs the wallpaper, and ends up with mush in his head: he forgets to buy glue and mixes up the colors. In the CoDA setup, the contractor sits in a clean office and gets only short texts from the worker: "Walls leveled, used 5 bags." The contractor doesn't see the dust, doesn't hear the swearing and has no idea what brand the trowel was, because he doesn't need it to make decisions. He keeps a clear head because his "context" isn't stuffed with nonsense.

Technically, it works through context isolation. The Planner sees only the task tree and short reports, while the Executor gets a "blank slate" every time, handles one specific subtask (say, parsing a huge article) and returns a compressed result. If a regular agent bloats its memory to 12,000 tokens after three Google searches and starts talking nonsense, the CoDA planner gets by on a measly 500 tokens. All the "fat" and noise from the tools gets filtered out at the Executor level and never reaches the strategic center.

This principle is universal for any complex work with LLMs, whether it's writing code, analyzing a market or building a content plan. The method was tested on heavy, data-rich tasks, but it'll rescue any process that takes more than three steps. Instead of feeding the model everything at once, we use hierarchical compression: one part of the system acts as a filter for the other. SEO walls of text and raw logs stay overboard, and only concentrated meaning reaches the decision-making center.

Bottom line: stop trying to cram the entire library into the model at once; it'll get lost in there and start hallucinating. You need delegation and strict filtering. CoDA proves that less really is more. If you want AI to deliver solid results over the long haul, keep its "strategic context" spotless and offload all the dirty work of digesting data to temporary executors. Otherwise your agent will inevitably turn into a confident liar.

ArXiv ID: 2512.12716 | Generated: 2026-01-02 17:02 | Nova Research

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on CoDA: Separating the Planner's and the Executor's Contexts arXiv:2512.12716

Sign in to apply this study New accounts get 50 free credits.