The Compaction Cliff in Long-Running AI Agent Memory
This paper identifies the "Compaction Cliff," a phenomenon where standard context compression causes AI agents to lose critical safety rules, and proposes "Knowledge Triage," a framework using type-specific operators to preserve safety fidelity and improve downstream task performance across multiple domains.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine a digital assistant that never forgets. Unlike a human who might lose track of a conversation after an hour, these artificial intelligence agents are designed to run for days, weeks, or even months, constantly learning new facts, remembering past events, and following a long list of rules. To function, they hold all this information in a temporary workspace, much like a person keeping a stack of papers on their desk. However, this workspace has a strict size limit. As the conversation grows and the stack of papers gets too thick, the system must throw some things away to make room for new details. This is where the danger lies. If the system simply throws away the oldest or least obvious papers to save space, it might accidentally discard a critical safety rule, such as "do not prescribe this medication to patients with a specific allergy." The result is an agent that is efficient but dangerously forgetful, potentially giving harmful advice because it lost the very instruction meant to prevent it.
Researchers at the University of Passau in Germany have identified a specific failure pattern they call the "Compaction Cliff." They found that when these long-running agents try to shrink their memory to fit the size limit, they treat all information as if it were equal. A safety rule is summarized and shortened just like a casual observation about the weather. The researchers discovered that this approach is fragile. In their tests, using a popular AI model, the system managed to keep about half of the safety rules after one round of shrinking. But as the process repeated over time, the number of surviving rules plummeted. After just five rounds of compression, only one in ten of the original safety rules remained intact. The agent had effectively climbed a cliff and fallen off, losing the guardrails that kept it safe.
To solve this, the team developed a new method they call "Knowledge Triage." The name comes from the medical practice of sorting patients by urgency, deciding who needs immediate care and who can wait. In this digital version, the system first sorts every piece of information in the agent's memory into one of five distinct categories. Some items are strict safety rules that must never be changed. Others are step-by-step instructions for tasks, which can be rewritten as long as the steps still work. Then there are general beliefs, soft preferences, and records of past events. The crucial insight is that these different types of information do not need to be treated the same way. A safety rule requires perfect preservation, while a memory of a past event can be summarized or even discarded if space is tight.
The researchers built three specific tools to handle these different categories. The first tool, designed for shrinking the memory, locks the safety rules in place so they cannot be altered or deleted, while allowing the less critical information to be compressed or replaced with placeholders. The second tool handles situations where a topic is simply too large to fit, even after shrinking. Instead of chopping the topic in a way that might separate a rule from the situation it applies to, this tool copies the relevant safety rule into every new section it creates, ensuring the rule travels with the information it governs. The third tool manages information that is stored outside the main workspace. When the agent needs to look something up, this tool ensures that any safety rules relevant to the question are brought back first, before the system even considers looking at other, less critical details.
The team tested this approach on a massive collection of real-world agent configurations, pulling nearly 400,000 examples from public software repositories. They found that their new method preserved safety rules far better than the standard tools used in production today. While the best existing methods kept only about half of the rules after a single round of compression, the new system kept nearly all of them. Crucially, the new system's performance stabilized at 96% recall from the second round onward, whereas the old methods had dropped to just 10% by the fifth round. This difference held true across different types of AI models and different ways of organizing the data.
The impact of this improvement was not just about keeping text intact; it changed how the agents behaved in real tasks. In a medical scenario, the new system successfully followed safety guidelines in 97% of cases, significantly outperforming the standard system which failed more often. In retail and airline customer service tests, the agents using the new method completed more tasks correctly than those using the old methods, even when the old methods were given more total space to work with. The researchers concluded that the key to safe, long-running AI is not just having more memory, but knowing how to sort it. By classifying information by its importance and treating safety rules as non-negotiable, they prevented the agent from falling off the compaction cliff, ensuring that the digital assistant remains both capable and safe.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.