TL;DR
ACE is a framework for improving LLMs by accumulating detailed context instead of compressing it into short instructions. Rather than "rewrite the prompt to be shorter," ACE gradually builds a comprehensive playbook — a structured reference of strategies, common mistakes and proven solutions. The context grows like a knowledge base: new insights are added in small chunks (delta updates), old ones are kept, duplicates are removed.
Existing prompt optimization methods suffer from brevity bias — they drift toward short, generic instructions and lose domain details. Even worse is context collapse: when an LLM rewrites the entire context in one go, it squashes it into a short summary. The researchers watched an 18,282-token context in a baseline method (Dynamic Cheatsheet) collapse to 122 tokens in a single step — accuracy fell from 66.7% to 57.1%, below the 63.7% the agent scored with no adaptation at all. The reason: when rewriting everything, an LLM tends to generalize and simplify, losing specific tactics and edge cases.
ACE fixes this with three roles and incremental updates. The Generator tries to solve the task. The Reflector analyzes what worked and what failed, and extracts concrete lessons. The Curator adds those lessons to the playbook as new bullet points — it doesn't rewrite the whole context, it adds to what's there. Each item is a small unit of knowledge (a strategy, an API quirk, a common mistake) with a unique ID and "helpful/harmful" counters. Periodically the system cleans out duplicates, but details are preserved, not squashed into abstractions.
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
STEP 1 (Generator): Solve the task → reasoning trajectory + code/actions
STEP 2 (Reflector): Analyze the attempt → a list of concrete insights:
- What worked (strategies to repeat)
- Where it went wrong (common problems)
- Root cause analysis (why it happened)
STEP 3 (Curator): Update the playbook → add new bullet points:
- Format: ID + type + content + helpful/harmful counters
- Operations: add new items, update existing ones, remove duplicates
- Result: an expanded playbook for the next taskThe key difference from other methods: Step 3 is not an LLM rewriting the whole context, but lightweight logic that merges small deltas. That makes it possible to process many tasks in parallel and accumulate knowledge without the risk of context collapse.
Example in Action
Task: You're a project manager at a tech company in Chicago. After 3 months of working with various contractors, you've piled up cases: some blew deadlines, some didn't understand the spec, some did a great job. Instead of keeping all this in your head, you want to build a detailed "Working with Contractors" playbook for yourself and your colleagues.
You apply the ACE principle: not a short summary like "be stricter", but a structured reference of concrete strategies.
Prompt:
I'm a project manager working with external contractors (designers, developers, SEO).
I want to build up a detailed playbook — a base of proven strategies and common problems.
PLAYBOOK STRUCTURE:
- Each item is a specific tactic/mistake/rule
- Format: [Type: strategy/mistake/red_flag] — [description]
- Detail beats brevity — you're an LLM, you can handle it; I need completeness
CURRENT PLAYBOOK:
[empty at the start, or paste what you've accumulated]
I'll tell you about a case from work. Your job:
1. Extract SPECIFIC strategies/mistakes/patterns from this case
2. Propose new playbook items (detailed, not generic)
3. Check for duplicates with existing items
4. Output the updated PLAYBOOK
CASE: We worked with Jake, a designer from the studio "Pixel".
On the first call I asked for "a modern website for a startup".
Jake delivered a mockup, but it had a dark theme (we're B2B, we need trust, light colors).
The redo took a week. Next time, with a different designer, I showed
3 competitor references + a moodboard in Figma right away — nailed it on the first try.Result:
The model analyzes the case and adds concrete items to the playbook, like:
- [Strategy] When briefing a designer — skip words like "modern" and send 3-5 reference screenshots
- [Mistake] Describing the style abstractly ("stylish," "minimalist") → the designer will interpret it their own way
- [Red flag] If the designer asks no clarifying questions during the brief → they'll probably deliver the wrong thing
- [Tactic] A moodboard in Figma/Pinterest before kickoff → fewer redos
With the next case (say, a developer didn't clarify the API requirements), the model extends the playbook with new items but keeps the old ones. After 10-20 cases you end up with a detailed knowledge base for working with contractors.
Why It Works
LLMs do better with long, detailed contexts than with short generalizations. The paper argues that, unlike humans, LLMs are more effective with long, detailed contexts and pick out what's relevant on their own at inference time. Humans need brevity to remember things; LLMs need it less. On complex tasks, specific edge cases, API quirks and proven tactics in the context give the model more to work with (the paper notes that simple tasks often do better with short instructions). A short prompt like "be more careful" gives the model no concrete levers — what exactly to check, which mistakes are common, how to handle typical problems.
Incremental updates prevent context collapse. When you ask an LLM to "rewrite the whole prompt," it tends to compress — dropping details, generalizing, losing nuance. That's natural for a language model: it's optimized to generate coherent text, not to preserve every detail. ACE doesn't rewrite, it adds small deltas. The Curator doesn't get "reword the context," it gets "here are 3 new insights — add them as bullet points." The old stays, the new extends it. Deduplication removes repeats, but the details remain.
Splitting the roles raises the quality of each stage. The paper's motivation: it mirrors how people learn (experiment, reflect, consolidate) and avoids overloading a single model with every job; in the experiments, all three roles were played by the same LLM. Our gloss: it's hard to generate and critique yourself at the same time. ACE splits it up: the Generator focuses on solving, the Reflector on analysis (it can run several times to dig deeper), the Curator on structuring. It's like a team: the developer writes the code, the reviewer finds the bugs, the tech writer documents it — everyone does their own job well.
Control knobs for adapting it:
- Number of Reflector rounds (the paper capped it at 5) → more rounds cost more; in the paper's tuning test, 5 rounds did best and 10 did slightly worse.
- Batch size (how many tasks to analyze at once) → 1 in the study; larger batches would be faster but were not tested.
- Deduplication threshold → how similar items have to be to count as duplicates. Stricter = a more compact playbook, looser = more detail (the paper found results fairly stable across settings).
- Warmup → you can start with an empty playbook (online learning) or warm it up on training examples (offline warmup).
Prompt Template
Basic template for accumulating knowledge
I'm working on {area/project}. I want to build a detailed playbook —
a base of proven strategies, common mistakes and edge cases.
PLAYBOOK PRINCIPLES:
- Detail > brevity (you're an LLM, long context is your strength)
- Concrete tactics, not abstract advice
- Format: [Type] — [description]
Types: strategy | mistake | red_flag | edge_case | API_quirk
CURRENT PLAYBOOK:
{paste existing items or leave empty}
---
NEW CASE/TASK:
{describe what happened, what worked/didn't work}
---
TASKS:
1. REFLECTOR MODE: Analyze the case
- What can be extracted? (strategies, mistakes, patterns)
- Why did it happen? (root cause)
- What to do in the future? (concrete actions)
2. CURATOR MODE: Update the playbook
- Propose new items (detailed, with examples)
- Check for duplicates with existing items
- If an item resembles an existing one — clarify the difference or merge them
3. Output the updated PLAYBOOK (all old items + the new ones)What to fill in:
{area/project}— your specialty (marketing, sales, code, hiring, design){existing items}— copy the playbook from the previous response{case}— describe a specific situation: what you did, what happened, where it failed
Multi-turn workflow (simulating ACE in a regular chat)
I want to improve {my prompt/approach to a task} through iterative learning.
Current approach:
{describe your method or paste the prompt}
Let's run a 3-stage loop:
STAGE 1 — GENERATOR:
Try solving this task with the current approach:
{task}
STAGE 2 — REFLECTOR:
Analyze your attempt:
- What worked?
- Where's the mistake/shortcoming?
- Root cause (why did it turn out that way?)
- What concrete strategies can be extracted?
STAGE 3 — CURATOR:
Based on the reflection, propose an updated approach:
- Add new rules/strategies
- Keep what worked
- Remove duplicates
Output the final improved approach for the next iteration.🚀 Quick start — paste into the chat:
Here's the ACE template for accumulating knowledge. Adapt it to my task: {your task}.
Ask me questions to fill in the fields.
[paste the "Basic template for accumulating knowledge" above]The LLM will ask about your field, your first case and what playbook format you need — because structuring knowledge requires understanding the context and the level of detail you want. It'll take the Reflector→Curator pattern from the template and adapt it to your specific task.
Limitations
⚠️ Depends on Reflector quality: If the model can't extract useful insights from a case, the playbook fills up with noise or even harmful advice; the paper names this as ACE's main limitation. The main experiments used DeepSeek-V3.1 for all roles. With weaker models, adding examples of good reflection to the prompt may help (our suggestion).
⚠️ Needs a feedback signal: ACE works well when there's clear feedback — execution success/failure for code, ground truth for tasks. On the finance tasks without ground-truth labels, ACE's gains shrank (online: +3.8 points instead of +7.5) and Dynamic Cheatsheet fell below the baseline; the paper warns both can degrade without reliable feedback. Tasks where the "right answer" is subjective (creative work, writing style) were not tested; we'd expect a smaller effect.
⚠️ Not for every task: Simple tasks (HotPotQA — find a fact in a document, Game of 24 — a fixed strategy) don't need long playbooks. ACE is built for complex domains with lots of edge cases and strategies (agents, specialized analysis, code).
⚠️ Warm-up overhead: The playbook needs several iterations to fill up. In the paper, warming it up offline before online use raised the AppWorld average from 56.1 to 59.5. The paper gives no rule for how many examples to use; in online mode, expect early tasks to benefit less until the context builds up (our expectation).
How They Tested It
The team tested ACE on two kinds of tasks: agents (AppWorld — interacting with APIs, code, an environment) and domain-specific ones (financial analysis with FiNER and Formula). They mainly used DeepSeek-V3.1 (with extra checks in the appendix on GPT-OSS-120B, GPT-5.1 and Llama-3.3-70B) and compared against strong baselines: ICL (many-shot with demonstrations), MIPROv2 (Bayesian prompt optimization), GEPA (genetic prompt search via reflection), and Dynamic Cheatsheet (adaptive agent memory).
They tested in two modes: offline (optimize on train, evaluate on test) and online (update the context on every test example and use it right away).
How they reached their conclusions: On average ACE beat the baselines by 10.6% on agent tasks and 8.6% on finance (the paper's headline figures, with DeepSeek-V3.1). A surprising finding — on the AppWorld leaderboard, ACE with a smaller open-source model, DeepSeek-V3.1, came close to the top production agent IBM CUGA (GPT-4.1) on average (59.4 vs 60.3) and, in the online setting, beat it on the harder test-challenge split (+8.4% TGC). This suggests that a good context can make up for part of the gap with a bigger model.
The second big insight — ACE works without labeled data. On AppWorld agent tasks with execution feedback (the code ran or crashed), ACE improved on the baseline by 14.8 points without ever seeing ground truth. That means the method suits self-improving agents that learn from their own mistakes.
The third — cost and speed. ACE cut adaptation latency by 82.3% compared to GEPA (AppWorld, offline) and 91.5% compared to Dynamic Cheatsheet (FiNER, online), with 75% fewer rollouts than GEPA and 84% lower token cost than Dynamic Cheatsheet. The reason: incremental delta updates are cheaper than rewriting the whole context.
Ablation studies on AppWorld showed: adding the Reflector raised the average from 55.1 to 56.8, multi-epoch adaptation (running over the training data several times) raised it further to 59.4, and offline warmup before online learning lifted online results from 56.1 to 59.5.
Resources
Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models (2025)
Qizheng Zhang, Changran Hu, Shubhangi Upasani, Boyuan Ma, Fenglu Hong, Vamsidhar Kamanuru, Jay Rainton, Chen Wu, Mengmeng Ji, Hanchen Li, Urmish Thakker, James Zou, Kunle Olukotun
Stanford University, SambaNova Systems, UC Berkeley
AppWorld Leaderboard — the agent benchmark where ACE posted its results
Dynamic Cheatsheet paper — ACE's predecessor, adaptive agent memory