PAACE: A Plan-Aware Automated Agent Context Engineering Framework
- Authors: Kamer Ali Yuksel
- Categories: cs.AI, cs.CL, cs.LG, cs.MA
- Published: 2025-12-22
- arXiv: Abstract | PDF
Abstract
Large Language Model (LLM) agents are increasingly deployed in complex, multi-step workflows involving planning, tool use, reflection, and interaction with external knowledge systems. These workflows generate rapidly expanding contexts that must be curated, transformed, and compressed to maintain fidelity, avoid attention dilution, and reduce inference cost. Prior work on summarization and query-aware compression largely ignores the multi-step, plan-aware nature of agentic reasoning. In this work, we introduce PAACE (Plan-Aware Automated Context Engineering), a unified framework for optimizing the evolving state of LLM agents through next-k-task relevance modeling, plan-structure analysis, instruction co-refinement, and function-preserving compression. PAACE comprises (1) PAACE-Syn, a large-scale generator of synthetic agent workflows annotated with stepwise compression supervision, and (2) PAACE-FT, a family of distilled, plan-aware compressors trained from successful teacher demonstrations. Experiments on long-horizon benchmarks (AppWorld, OfficeBench, and 8-Objective QA) demonstrate that PAACE consistently improves agent correctness while substantially reducing context load. On AppWorld, PAACE achieves higher accuracy than all baselines while lowering peak context and cumulative dependency. On OfficeBench and multi-hop QA, PAACE improves both accuracy and F1, achieving fewer steps, lower peak tokens, and reduced attention dependency. Distilled PAACE-FT retains 97 percent of the teacher's performance while reducing inference cost by over an order of magnitude, enabling practical deployment of plan-aware compression with compact models.
Chinese Abstract:
As large language model (LLM) agents are increasingly deployed in complex, multi-step workflows that involve planning, tool use, reflection, and interaction with external knowledge systems, they continuously generate large, rapidly evolving contexts during reasoning. Without careful management and compression, these contexts can lead to attention dilution, loss of key information, and excessive inference cost. Existing summarization and “query-aware compression” methods mostly treat context as static text and largely ignore the information needs of multi-step reasoning—specifically, what the agent will need to do next (the plan structure and upcoming tasks). PAACE (Plan-Aware Automated Context Engineering) proposes a unified, agent-oriented framework for context optimization: it continuously reconstructs and manages the agent's internal state through next-k-task relevance modeling, plan-structure analysis, co-refinement of instructions and plans, and function-preserving context compression. Specifically, PAACE has two parts: (1) PAACE-Syn: a large-scale synthetic agent workflow generation and annotation system that produces supervision for each step on “how to compress context,” providing data for training plan-aware compression models; (2) PAACE-FT: a family of distilled, plan-aware compression models that learn context pruning and reconstruction strategies from successful demonstrations by a stronger teacher model. Experiments on several long-horizon benchmarks (AppWorld, OfficeBench, and 8-Objective QA) show that PAACE consistently improves agent correctness while significantly reducing context load and dependency-chain length. On AppWorld, PAACE achieves accuracy better than all baselines while lowering peak context length and cumulative dependency; on OfficeBench and multi-hop QA, PAACE improves both accuracy and F1 while reducing steps, peak token count, and attention dependency. The distilled PAACE-FT retains about 97% of the teacher's performance while reducing inference cost by more than an order of magnitude, making it possible to deploy “plan-aware compression” with smaller models in real systems.
Deep Analysis
💡 What is this paper studying?
You can think of the paper's approach like this:
“Give the agent a dedicated context-organization assistant that can read the plan—and it isn't based on hand-written rules but learned from many successful cases.”
The approach has three steps:
1) First, generate many training samples for “long-horizon tasks.”
- The paper synthesizes a variety of complex tasks—multi-app office workflows, web operations, long-document processing, retrieval-augmented multi-hop QA, and so on—each with a clear “plan decomposition” (steps 1, 2, 3…).
- For each task, the agent first runs once with “no compression” to produce a “reference answer.” This represents “what the result looks like if I keep everything.”
2) Use a large model as a teacher to explore “what can be deleted and how to summarize it.”
- Then the agent runs the same task again, but before each step it hands the current context to a “large teacher model” for compression:
- The teacher sees the current context plus what the next few steps will do (e.g., the next step reads a table, and the step after that generates a report).
- Using a natural-language compression prompt, the teacher rewrites/prunes the context into a shorter version that keeps only what is useful for the next few steps. (For example, keep the table structure and key fields, and drop useless logs.)
- The agent then acts using only this compressed context.
- After the task finishes, compare the answer produced by the compressed run with the answer from the original full-context run:
- Compute text similarity with embeddings and require it to be high enough.
- Use a separate judge model to check whether the compressed answer got worse.
- Also check that the compression ratio is real (it can't be no compression, and it can't compress to nothing).
- Only when “the compressed result is almost as good” does the full execution trajectory count as a valid demonstration: it shows that “at these steps, this content can be safely deleted/rewritten.” These demonstrations record how the teacher compressed under a given context plus a given upcoming plan.
3) Distill the large model's compression experience into a smaller model.
- The previous stage collects many demonstrations: (the plan for the next few steps + current context) → the teacher's compressed context.
- Use a medium-sized open-source model as the student and train it to produce compression results close to the teacher's under the same inputs.
- After training, there is no need to call the expensive large model in deployment:
- At each step, the student model looks at “all current context + the plan for the next few steps” and automatically produces a shorter summary with enough information for subsequent steps.
- The agent continues the task with this compressed context.
4) How is effectiveness verified?
- They run comparative experiments on several existing long-horizon benchmarks:
- Against no compression at all, to see whether it can reduce tokens while maintaining or even improving accuracy.
- Against simple methods such as “keep only the most recent turns,” “select history via vector retrieval,” “pure summarization compression,” and ACon, to see which is more accurate and more compute-efficient.
- The results show:
- PAACE makes context substantially shorter while maintaining or even slightly improving accuracy.
- This indicates that these “plan-aware, multi-step context-organization strategies” have indeed learned effective patterns rather than blindly deleting content.
Put more intuitively:
- The paper does not change the large model itself. Instead, it trains a small “plan-reading context organizer” that, at each step, repackages history, tool results, instructions, and so on into a compact state that is most useful for the next few steps.
- The small model is reliable because it imitates the behavior of an expensive large model that, across many tasks, “compresses without dropping the ball.”
🎯 What important thing did they find?
The value of this paper is not a new model architecture. Rather, it turns “how long-horizon agents manage context” from a pile of scattered tricks into a learnable, evaluable systems-engineering process.
1) From “hand-assembled context” to “a learnable policy” Many agent implementations today rely on rules: keep the most recent turns and delete older ones, or crudely summarize history. But in genuinely complex settings—cross-app, cross-document, multi-round retrieval, many tool calls—these rules often either miss information or leave so much information that the model “can't keep up.”
The key points of PAACE are:
- It treats context directly as a state that needs “policy optimization,” not as a string to be assembled ad hoc.
- It learns the policy by comparing whether the final result is preserved before and after compression, rather than relying on hand-written rules or local heuristics. This gives context management a clear objective (same result + shorter context) and a data source (synthetic workflows + teacher demonstrations), much like policy learning in reinforcement learning.
2) Compression that looks at the plan for the next few steps solves multi-step dependency problems. Most existing compression methods consider only “what question needs to be answered next” and ignore what will be needed two or three steps later. The result is:
- The current question can be answered, but the information may be insufficient for later tool calls, complex operations, or reflection steps. PAACE emphasizes next-k: when compressing, it considers the work of the next several steps together, including cross-step dependencies (e.g., this field looks useless now but will be used for aggregation two steps later). This significantly reduces the risk of “key intermediate state disappearing” in long workflows.
3) Large-scale synthesis + distillation yields a cost-effective intelligent compressor. Calling a very large model at every step to decide “what to keep and how to rewrite it” works well but costs a fortune. PAACE's two-stage approach:
- First, offline, it uses a large model + evolved prompts to explore, across many tasks, demonstrations of “which compression style is both short and lossless.”
- Then it trains a 4B-class student model to imitate this behavior. That means the extra inference cost in real deployment is small while gaining context-organization judgment close to the large model's, making frequent invocation in real systems feasible.
4) Experiments show compression can enhance, not just save. Notably, on some benchmarks PAACE's accuracy is even higher than no compression:
- This suggests long context not only fails to help but causes attention dilution and reasoning confusion.
- Selectively deleting irrelevant, outdated, or conflicting information lets the model continue reasoning from a “clean state,” which is actually more stable. This helps clear up a misconception: a longer context window does not equal better performance; if content is poorly organized, a large context can even be harmful.
5) Implications for future research and industrial deployment
- For researchers: PAACE provides a pipeline for generating synthetic workflow data, automatically filtering for “function-preserving compression,” and distilling compression policies; it can be reused in other environments.
- For engineering deployment: it offers a pluggable “context engineering module” idea for agent platforms—you can treat the compressor as an independent component and optimize token cost and stability without changing the backbone model.
- For future directions: it reminds us that making agents reliably execute very long workflows requires not only a strong model but also careful design of “plan-aware state representations” and “learnable context-management logic.”
🌍 How does this affect us?
From a practical application perspective, this work may have several main impacts:
1) Making long-horizon agents more “operable”
- Deploying complex agents in real enterprises or products often runs into two problems:
- Cost: multi-round tool calls plus large documents and logs send token costs soaring.
- Stability: the longer the context, the more easily the model “gets lost,” forgets key constraints, or is distracted by old information.
- PAACE provides a reusable module: without changing the backbone model, a small trained compressor can significantly reduce context length while maintaining task correctness or even improving it slightly. This directly eases the cost-stability tension and makes many “feasible in theory but too expensive” scenarios more realistic.
2) Improving reliability in complex task execution
- In office automation, data analysis, operations orchestration, and similar settings, tasks often span many steps, tools, and documents. If information from earlier steps in a long workflow is wrongly deleted or buried in noise, later decisions can easily go wrong.
- By compressing with an eye on the plan for the next few steps, PAACE emphasizes keeping the information needed for cross-step dependencies. This means:
- Report fields, key parameters, dependency chains, and the like are more likely to be preserved correctly.
- Redundant logs, stale intermediate results, and irrelevant old instructions are more likely to be cleaned up.
- This helps build more reliable large-scale automation workflows, such as automated report generation, automated experiment pipelines, and complex project-management assistants.
3) Making “context engineering” an independent engineering practice
- In the past, most discussion focused on prompt engineering and RAG, overlooking how to continuously maintain a clean, consistent agent state in long, multi-turn, multi-tool workflows.
- This paper defines context engineering clearly and provides an end-to-end, learnable implementation paradigm:
- It learns policies from synthetic data generation + teacher demonstrations instead of relying on product engineers writing lots of ad hoc rules for each project.
- This will encourage future agent system designs to include independent “Context Manager / Context Engineer” modules and roles, similar to today's “retrieval modules” and “vector database engineering.”
4) A double-edged sword for security and compliance
- Upside:
- Shorter, clearer context improves auditability and creates room for later security checks and policy filtering.
- By controlling the compression policy, compliance- and security-related instructions can be prioritized, improving safety.
- Downside:
- If the compression policy does not account for safety signals, it may accidentally delete safety instructions, risk warnings, or provenance information, leaving the agent without necessary constraints in later steps.
- Therefore, in high-risk settings, PAACE is better suited as an “efficiency layer” than as a “safety layer” and should be combined with dedicated safety policies and human oversight. Overall, it provides a more controllable context entry point, which actually gives safety mechanisms a clearer attachment point.
5) Advancing the open-source ecosystem and toolchain
- In the paper, the teacher is a large model, but a 4B open-source student can reach 97% of the performance—a friendly result for the open-source community:
- It shows that with the right data and methods, a small model can perform close to a large model on a specific subtask (context engineering).
- In the future, dedicated, plug-and-play open-source “PAACE-like compressor” models may emerge and integrate directly into various agent frameworks.
In short, PAACE will not make agents dramatically “smarter” overnight, but it hits a very real pain point: how to let long-horizon, multi-tool agents run credibly at limited cost. Its idea of “plan-aware context engineering” is very likely to become a standard part of future real-world agent system architectures.
📋 Professional Summary
Research Methods
The paper proposes PAACE, a “plan-aware” context engineering framework. Its core methodology can be summarized in three layers:
1) Formalizing “context management” as a policy-learning problem
- It treats a multi-step agent's state as a context Ct that evolves over time, rather than a traditional implicit model state.
- Context consists of the system prompt P, the user's initial instruction I0, the plan Π=[τ1…τn], prior thoughts H0:t, tool results O0:t, retrieved documents R0:t, long-term memory M, and so on.
- It defines a compression mapping: (\tilde{C}t = f(Ct, \Pi_{t:t+k})), where f is a “plan-aware” compression policy explicitly conditioned on “the next step through the next k steps” (next-k tasks).
- Rather than hand-specifying rules (e.g., explicit graph structures or information-theoretic formulas), it indirectly learns what content to keep, rewrite, or discard by asking whether the result remains correct.
2) Two-stage framework: PAACE-Syn + PAACE-FT
PAACE-Syn: a synthetic data generation system
- It randomly samples long-horizon tasks W=(I0, Π, {τi}, φ) from multiple domains: document workflows, multi-app operations (AppWorld), retrieval + multi-hop QA, and so on.
- For each workflow, it runs twice: a) No compression: full context Cfull^t → baseline answer (\hat{y}{full}). b) With a “teacher compressor”: at each step t, a large model + natural-language compression prompt produces a compressed context (\tilde{C}t), and the agent acts only on (\tilde{C}t) → compressed answer (\hat{y}_{comp}).
- Filtering criteria: • Use a fixed embedding model to compute cosine similarity s=cos(embed((\hat{y}{full})), embed((\hat{y}{comp}))), requiring s≥θ (e.g., 0.85). • Use a judge LLM to compare the two answers (better/worse + rationale); discard if the compressed answer is judged worse. • The per-step compression ratio rt=|(\tilde{C}t)|/|C_t| must lie in (0,1), and the compressed result must be non-empty.
- Keep only “successful trajectories”: entire multi-step executions in which compression does not harm the final result.
- Build supervision samples from these trajectories: input is (the next k-step plan Π{t:t+k} + current context Ct), and output is the teacher's compressed context (\tilde{C}_t).
Meta-learning of the teacher compression policy
- The teacher is really just a large model + a natural-language prompt p; model weights do not change, and compression behavior is optimized through prompt evolution.
- Maintain a set of prompt variants {p_i} and evaluate them in parallel on many workflows, recording success rate, semantic similarity, compression ratio, and other metrics.
- Evolve the prompts: select, mutate, and replace based on composite scores, forming a steady-state black-box optimization process.
- The result is a set of “effective and stable” compression prompts; the compressed trajectories they generate are used for distillation.
PAACE-FT: the distilled student compressor
- Choose a small-to-medium open-source LLM (e.g., Qwen3-4B-Instruct) as the student model.
- Training objective: given input (Π{t:t+k}, Ct), autoregressively generate the teacher's compressed context (\tilde{C}_t).
- The loss is standard causal language modeling loss: cross-entropy is computed only on the target compressed text y=(\tilde{C}_t), and the input part x is not included in the loss.
- No complex mechanisms such as RL or preference optimization are added; it is simple supervised distillation.
3) Online inference and experimental evaluation design
- In actual deployment, only the student compressor is used:
- The agent/planner first obtains the plan Π=(τ1…τn).
- At each step t, feed the student model (current context Ct + next k-step tasks Π{t:t+k}) to get compressed context (\tilde{C}_t).
- The agent executes τt based on (\tilde{C}t), then updates to C_{t+1}.
- Repeat until the task ends and output the final answer.
- Experimental baselines and metrics:
- Keep the backbone, tool interface, and inference configuration fixed; change only the “context management policy.”
- Compare with No Compression, FIFO, vector-retrieval history selection, LLMLingua, simple prompt summarization, ACon, and others.
- On the three long-horizon benchmarks AppWorld, OfficeBench, and 8-Objective QA, measure: • Accuracy Acc / EM / F1; • Steps; • Peak context length Peak; • Cumulative dependency Dep=\Sigmat |Ct| (an estimate of total attention cost).
- Ablation: vary k in next-k (1/2/3), and restrict the compressor to “delete only, no rewriting,” to observe performance changes. Overall, the method uses a large model + synthetic long workflows + strict filtering to learn a “plan-aware context compression policy,” then distills it into a small model that is called frequently in real agents, substantially reducing context length and attention burden while preserving result quality.
Key Findings
- It introduces “context engineering,” a broader concept than prompt engineering / RAG. The core is continuous, multi-step-plan-oriented state compression and reconstruction, rather than one-shot prompt design or single-round retrieval.
- It builds PAACE-Syn, a large-scale synthetic workflow generation and auto-annotation system that generates about 1.2 million long-horizon trajectories (about 9.5 billion tokens) and provides contrastive supervision at each step: “teacher compression vs. full context.”
- Using semantic similarity + LLM judging + compression-ratio constraints, it filters for “function-preserving” compression trajectories, which are used to train the student model PAACE-FT for plan-aware context compression.
- Experiments show that on AppWorld, OfficeBench, and 8-Objective QA, while reducing context length and cumulative dependency (attention cost), PAACE not only avoids hurting task performance but in some settings exceeds no compression and various strong baselines (including ACon UTCO).
- The distilled student PAACE-FT retains 97–98% of the teacher's compression performance while cutting compression inference cost by an order of magnitude; in real deployment, extra per-step latency is <8%, while total input tokens are reduced by 35–60%.
- Ablations show that a moderate next-k planning horizon (k=2 for tool tasks, k=3 for multi-hop QA) is clearly better than looking only one step ahead (k=1); if rewriting is forbidden and only deletion is allowed, long-horizon task failure rates rise, showing that “implicit instruction reconstruction” and structured summarization are critical to robustness.
- An empirical finding: plan-aware compression is not just token saving but a form of “regularization”—by removing redundant and conflicting information, it actually improves agent stability and mitigates “attention dilution” and instruction drift under long contexts.
Limitations
- The theoretical side is fairly “engineering-oriented”: although it mentions concepts such as task graphs and information preservation, the current implementation does not build explicit task graphs or information-theoretic objectives. Instead, it makes decisions through empirical, non-differentiable black-box optimization and result comparison, lacking formal guarantees.
- Supervision depends entirely on the LLM teacher and LLM judge: embedding similarity + LLM judgment cannot guarantee semantic equivalence, especially in safety, compliance, and exact-number settings, where there is a risk of “looks about right but is actually wrong.”
- It is validated only on a few representative long-horizon benchmarks: although these cover app operations, office automation, and multi-hop QA, real enterprise settings are often more complex and diverse. PAACE's current compression policy is clearly “environment/task-specific,” and cross-domain transfer has not been systematically evaluated.
- It implicitly depends on the quality of the plan Π: when the plan is unavailable or badly misaligned with real needs, next-k conditioning may still work but degrade; the paper only says “degradation is smooth” and lacks a more detailed analysis of edge cases.
- It does not currently treat safety/alignment as a primary objective: compression may delete safety-related instructions, audit information, or provenance notes, so directly applying it to high-risk domains (healthcare, finance, legal, etc.) carries risks and requires an additional safety layer and human review.
- It does not provide a systematic error analysis: for example, typical PAACE failure modes, which types of chains are prone to over-compression or instruction drift, and fine-grained differences from methods such as ACon. The paper mainly reports macro metrics, which is somewhat insufficient for developers trying to build intuition.
- It lacks systematic exploration of system design questions such as “compression frequency, granularity, and location”: for example, whether compression is needed at every step and which step types are more suitable for compression. The current setup is fairly fixed, and these issues are not fully discussed.
Future Work Directions
Future work could extend in several directions:
1) Stronger formalization and verifiability
- Extend the current “empirical metrics” (embedding similarity + LLM judging) into optional formal verification:
- For specific domains (e.g., code, SQL, table operations), introduce executable checks (unit tests, constraint checks) to confirm that compression does not change executable results.
- Use symbolic reasoning or constraint solvers to verify whether key constraints are preserved in the compressed context.
- Explicitly model task graphs and causal dependencies as graph structures, visualize and analyze information flow on the graph, and further guide the design and tuning of compression policies.
2) Cross-domain and cross-environment generalization
- Currently, PAACE is clearly trained for specific benchmarks and task types. Future work could:
- Generate PAACE-Syn-style synthetic data in more real, diverse environments (code collaboration, data-analysis pipelines, complex enterprise processes).
- Explore “domain-adaptive” compressors: for example, lightly fine-tune with a small number of domain-specific trajectories so a general compressor quickly adapts to a new environment.
3) Combining with memory systems and architecture-level methods
- Combine PAACE with architectures such as MemAgent and hierarchical memory:
- PAACE handles the pruning and rewriting of the “working memory” part.
- Long-term memory and vector stores handle storage of raw information and details, which can be pulled back when needed.
- Explore collaboration with architecture-level long-context models such as Compressive Transformer and GoA: perform compression and filtering at both the internal and external layers to further reduce attention burden.
4) More fine-grained, controllable compression policies
- Add “compression style/policy control”:
- For example, expose switches for more conservative (fidelity-first) vs. more aggressive (cost-first), or biased toward preserving instructions vs. preserving data.
- Support different compression strengths and rewriting policies for different content types (logs, tool outputs, user instructions, plans).
- Study how end users or systems engineers can influence PAACE's behavior through simple configuration or natural-language “compression policies.”
5) Error-mode and interpretability analysis
- Systematically collect PAACE failure cases and identify typical patterns (e.g., missing implicit constraints, accidentally deleting intermediate variables, oversimplifying instruction rewrites).
- Improve the interpretability of compression: have the compressor provide rationales for “keep/delete/rewrite” to facilitate debugging and human review.
6) Compression frequency and scheduling policies
- Explore policy learning for “when to compress and how much” in long workflows:
- For example, compress once after a large block of tool output but not during short dialogue turns.
- Learned scheduling: dynamically decide whether to invoke PAACE based on context length, remaining plan steps, and so on.
Overall Assessment
Overall, PAACE's main contribution is “methodology and systems engineering”:
- It does not try to solve long-context problems directly with a new model architecture. Instead, it designs a learnable compression and reconstruction framework around “the context state of a multi-step agent,” elevating context engineering to a first-class citizen.
- Methodologically, PAACE cleverly uses synthetic workflows + a large teacher model + prompt evolution + strict result filtering to extract high-quality supervision, then trains a small model with simple supervised distillation. This pipeline is pragmatic and deployable in engineering terms.
- The experimental results are fairly robust across multiple benchmarks: on one hand, they show that “simply enlarging the context window” is not enough to solve long-horizon reasoning; on the other, they show that “plan-aware context compression” can significantly reduce token cost and attention load without sacrificing—or even while improving—performance.
- The main limitations are insufficient theoretical guarantees, dependence on an LLM teacher and judge, and strong environment/task specificity. But as a systems- and engineering-oriented work, these shortcomings are understandable and leave room for future work.
Overall assessment: PAACE provides a critical but previously overlooked module for building genuinely usable long-horizon LLM agents—systematic context engineering. It shows that “learning a plan-aware context compression policy” is not only feasible but can deliver real performance and cost benefits, making it a highly inspiring direction in current agent research.
Generated by Citeo - arXiv RSS subscription with AI summarization