← Latest papers
💻 computer science

Tessera: Lossless-First, Vendor-Free Session Compression for Long-Horizon Agent Harnesses

Tessera is a vendor-free, lossless-first session compression proxy that reduces token costs and latency for long-horizon LLM agents by employing a three-tier memory system to deterministically rewrite conversation history while preserving verifiable access to original data via the Model Context Protocol.

Original authors: Mohammad Mosafer

Published 2026-09-14
📖 8 min read🧠 Deep dive

Original authors: Mohammad Mosafer

Original paper licensed under CC BY 4.0 (https://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

In the world of artificial intelligence, a specific kind of software called an agent acts as a digital worker. These agents do not just chat; they perform tasks by using tools, reading files, and running commands. To do this, they rely on a large language model, a powerful computer program that understands and generates human language. However, these models have a memory limit. Every time the agent takes a step, it must send the entire history of its conversation back to the model so the model knows what has happened so far. As a session grows longer, involving dozens of files and hundreds of commands, this history becomes massive. Sending it all every time is slow and expensive.

To solve this, engineers have tried two main tricks. The first is to simply cut off the oldest parts of the conversation, keeping only the most recent messages. This saves space but risks deleting important facts, like a password or a file location, that the agent might need later. The second trick is to ask the model to summarize the old parts into a shorter story. This is also risky because the summary might miss a crucial detail or invent a new one, and there is no way to check if the summary is accurate. Both methods force a choice between saving money and keeping the truth.

A researcher named Mohammad Mosafer has proposed a different approach that refuses to make that choice. He built a system called Tessera, which acts as a smart middleman between the agent and the model. Instead of deleting old information or rewriting it into a summary, Tessera compresses the conversation by finding and removing exact copies and near-duplicates. It keeps the original text safe in a separate storage area and replaces the repeated parts in the main conversation with tiny, precise pointers. If the agent needs to see the old text again, it can ask for it, and the system retrieves the exact original instantly. This method allows the agent to work with a much shorter conversation history without losing any facts or relying on a specific company's technology.

The core of the problem lies in how these agents work. When an agent runs a command, it gets a result. If it runs the same command again, it often gets the exact same result. In a long session, the agent might read the same log file multiple times or check the same status repeatedly. Because the agent sends the whole history every time, it ends up sending the same large blocks of text over and over. Tessera notices this repetition. It scans the conversation history and identifies when a piece of text is identical to something sent earlier. Instead of sending the full text again, it sends a short marker that says, "This is the same as the text from three steps ago." The model can still read the marker and understand the context, but the amount of data being sent is drastically reduced.

Tessera goes further than just finding exact copies. It also looks for text that is almost the same, such as a log file that has changed by only a few words. When it finds these near-duplicates, it sends a small note describing only the changes, rather than the entire file. It also handles large blocks of data, like long lists of numbers or code, by stripping away unnecessary formatting and keeping only the essential structure. All of this happens without using a large language model to make decisions. The system uses simple, deterministic rules, meaning it will always produce the same result for the same input. This makes the process fast and reliable, adding only a few milliseconds to the time it takes to send a message.

To test if this system actually works, the researcher created a controlled environment. He built a generator that creates fake agent sessions filled with realistic data, such as JSON responses, service logs, and command outputs. Into these sessions, he planted specific, unique facts, like a random code or a specific setting, at random positions. He then ran the sessions through Tessera and measured how many of these planted facts survived in the compressed history. He compared this against other methods that simply cut off old messages or kept only the most recent ones. The results were clear. When the system compressed the conversation to about 29 percent of its original size, it kept 61.8 percent of the facts in the main history. In contrast, the other methods, which were forced to keep the same amount of space, kept only about 26 to 30 percent of the facts.

The system also includes a way to get the missing information back if it is needed. This is called a recall tier. If the agent asks a specific question about an older part of the conversation, the system can search its safe storage of original texts and bring back the exact passage. When this feature is used, the system can recover 99.5 percent of the facts, even though they were not in the main compressed history. This means the agent can work with a tiny, efficient history but still access the full details whenever necessary. The researchers found that this recovery works best when the agent remembers the context of the old event, but it still works well even with vague questions.

The study also looked at how different types of agents behave. Some agents, like those designed to fix software bugs, tend to repeat commands and see the same results often. For these agents, the system found that nearly 15 percent of the conversation was exact duplicates. Other agents, using different models, rarely repeated themselves. The system adapted to both situations, proving that it does not need to be tuned for a specific type of agent to work. It simply removes what is there, whether that is a lot of repetition or very little. The time it takes to compress the data is negligible, adding less than eight milliseconds per request, which is far less than the time it takes for the model to generate a response.

One of the most important findings is that this method does not require giving up on accuracy. Unlike summarization, which can lose details or change meanings, Tessera keeps every original byte of text safe. If a fact is removed from the main view to save space, it is not gone; it is just hidden behind a handle that can be opened at any time. This makes the system fully auditable. An engineer can look at the compressed history and know exactly what was removed and where to find the original. This is a significant shift from current methods, which often rely on the model to guess what is important, a process that is hard to verify.

The researchers tested their system against several other ways of managing memory. They found that simply keeping the most recent messages, a common practice, was the least effective way to keep facts. Even a method that randomly kept messages performed better than cutting off the oldest ones, but it still could not match the precision of Tessera. The key to Tessera's success is that it does not throw away whole messages. Instead, it trims the fat from the inside of the messages, keeping the head and the tail of long texts and replacing the middle with a pointer. This allows the agent to keep the context of the conversation while shedding the bulk of the data.

The study also examined how sensitive the system is to its settings. The researchers adjusted the rules for what counts as a duplicate and how many recent messages are protected from compression. They found that the system is robust. Changing the rules slightly did not cause the performance to crash. The system consistently saved about 70 percent of the data while keeping the vast majority of the important facts. This stability suggests that the system could be used in real-world applications without needing constant adjustment.

In the end, the work demonstrates that it is possible to make agent conversations much shorter without losing the truth. By treating the conversation history as a collection of data that can be compressed and retrieved, rather than a story that must be summarized or cut, the system achieves a level of efficiency that was previously thought to require a trade-off. The agent can run longer, more complex tasks without running out of memory or paying for excessive data transfer. The system remains independent of any specific model provider, meaning it can be used with any tool that speaks the standard language of these agents.

The researchers acknowledge that their test was done with synthetic data, meaning the sessions were generated by a computer rather than recorded from real human use. They plan to test the system on real-world agent trajectories to see how it performs in the wild. They also note that while the current system is excellent at removing redundancy, it does not yet understand the deeper meaning of the conversation. Future versions might add layers that can identify which parts of the conversation are most important based on the task at hand. However, the current system provides a solid foundation. It proves that with careful engineering, we can keep the full record of an agent's work while sending only a fraction of the data, ensuring that no fact is ever truly lost.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →