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.
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.
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).
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.
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.
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]
# 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.
# 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
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.
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)