Personal Agent Bench

Context compaction: what a personal agent forgets, and how to keep what matters

Context compaction is what an agent does when a conversation outgrows its context window. It summarizes the older turns, keeps the recent ones, and carries on from the summary. For a coding session that usually costs a little detail. For a personal agent that runs your inbox and calendar for weeks, it can cost the one instruction you gave it about what not to do.

  • Context compaction rewrites what the model sees on the next turn. In OpenClaw the full history stays on disk; the model works from a summary plus the recent messages.
  • Two widely shared personal agent failures in 2026 involved compaction. An OpenClaw agent lost a "don't act until I say so" instruction, and a Muse user's assistant drifted after 23 compactions while every note was still on disk.
  • Rules that live in files loaded into the system prompt are outside the compacted history. OpenClaw, Letta Code, Linger and Hindsight each have such a layer, with hard size caps.
  • The safer systems save memory before compaction runs and check compacted notes against the original transcript.
  • None of this is a score. The details below come from public repositories at pinned commits as of December 1, 2026.

What context compaction does to a personal agent

Every model has a fixed context window. OpenClaw's compaction docs describe the usual three steps. Older conversation turns are summarized into a compact entry, the summary is saved in the session transcript, and recent messages are kept intact. The same page is clear that "the full conversation history stays on disk. Compaction only changes what the model sees on the next turn."

That last sentence is the whole problem in miniature. Nothing is deleted, yet the agent behaves as if it had forgotten, because it now reasons from a summary someone else wrote.

The summary has a budget. OpenClaw sends at most 160,000 characters of history to the summarizer per request, about 40,000 tokens, and fills that budget in a fixed order. The newest messages go in word for word and take half of it. The user's older messages, "which carry the asks, decisions and corrections," take a quarter, each trimmed to at most 2,000 characters. The oldest messages get a tenth. The summarizer is told not to guess the content of the gaps.

Personal agents hit this harder than coding agents for two reasons. Their sessions run for days or weeks, so compaction happens over and over. And the tasks touch things you can't undo, like sent email, deleted mail and booked appointments.

Two context compaction failures in personal agents

The best-known one happened in February. Summer Yue, who works on safety and alignment at Meta Superintelligence, asked her OpenClaw agent to suggest what to archive or delete in her inbox. "Don't action until I tell you to," she wrote. It started deleting, and she couldn't stop it from her phone. "I had to RUN to my Mac mini like I was defusing a bomb," she posted. In a reply she explained that the setup had worked for weeks on a small test inbox, but her real inbox "was too huge and triggered compaction. During the compaction, it lost my original instruction."

The second is slower and closer to what most users will see. JJ Englert gave Muse his calendars, travel, files and messages. Twenty-nine days in, it was writing his morning briefings from stale notes and reminded him about a meeting that had been cancelled. He had it audit itself and found that "it hadn't lost my data. The notes were all still there." The conversation had been compacted 23 times, "summaries of summaries," and he had also switched to a new model. He caught himself "double-checking the assistant."

The two cases fail in different ways. In the first, one instruction disappeared and the agent acted on the task without its constraint. In the second, nothing disappeared from storage, but each round of summarizing thinned out what the agent was actually working from.

What survives context compaction, and what doesn't

From those two cases and the OpenClaw budget above, three kinds of information are most at risk when history is compacted.

Constraints attached to a task. "Suggest, don't act" is one clause inside a longer request. A summary that keeps "user wants help cleaning the inbox" has kept the task and dropped the rule. OpenClaw's current docs address this directly. Recovery "keeps a bounded copy of the active human request in the summary, including across repeated compactions after its original message leaves the current context" (compaction.md, line 31). Bounded is the important word. A long request can still be trimmed.

Who said what. A summary flattens sources. Something the user said, something the model inferred and something an email claimed can end up in the same sentence. That's why OpenClaw tags memory with an origin class (owner, agent, untrusted or system) and never promotes untrusted or system entries into long-term memory.

Time. "Yesterday" in a summary written a week ago points at the wrong day. JJ Englert's stale briefings and the cancelled meeting are both time errors. The fact had been true once.

What survives well is the recent tail, because it's kept word for word, and anything that never lived in the conversation in the first place.

Keep rules out of the compacted history

The most reliable way to protect an instruction from compaction is to put it somewhere compaction doesn't summarize. All four systems we compared have a layer of memory that is loaded into the prompt from storage, outside the conversation, and all of them cap its size.

SystemWhat is loaded outside the conversationSize limit
OpenClawWorkspace files such as AGENTS.md, USER.md and MEMORY.md, injected into the system prompt20,000 characters per file, 60,000 in total
Letta CodeMarkdown at the root of the memory repository, compiled into the system prompt from committed versions only65,536 characters in total, 20,000 per file, two folders deep
LingerA user profile on every turn, and a summary index of the agent's memory on the first message of a session and the first message after compactionProfile of about 4 to 5 KB
HindsightNo always-loaded layer in the API; its OpenClaw plugin recalls memories before each turn by defaultRecall budget of 4,096 tokens

OpenClaw injects its workspace files into the system prompt's Project Context, and compaction summarizes conversation turns. An instruction written into AGENTS.md is in a different place from one typed into the chat. Letta Code adds a rule worth copying. Edits to core memory "take effect only after they are committed, and only in later system prompts" (maintaining-core-memory), so a half-written edit never reaches the model.

Linger is the only one of the four that names compaction in its memory schedule. Its docs list recall on "first message of a new session, first message after compaction" (wiki-and-memory.md), so the memory index comes back right after the summary replaces the history.

Hermes Agent takes the small end of this. Its two memory files are capped at 2,200 and 1,375 characters, read once when a session starts, and never auto-compacted.

The practical advice for anyone running a personal agent follows from the table. If a rule matters, such as "never send without asking" or "never delete mail," write it into the agent's instruction or memory file. Don't rely on having said it once in chat.

Save memory before context compaction runs

The second defence is timing. If the agent writes down what matters before the history is summarized, the summary losing it matters less.

OpenClaw can run a silent memory flush before compaction, a turn that saves durable context to a workspace memory file. The flush disables provider-side compaction so the memory extraction "sees the unsummarized history." It's optional, and a failed flush doesn't stop compaction.

Hindsight's OpenClaw plugin retains every turn by default, so facts are extracted long before any summary is written. When retention is set to run every few turns instead, the turns since the last retain are flushed when a session ends.

Letta Code runs a background reflection pass that edits memory files. By default it runs every 25 steps, and one of its other trigger settings is a compaction event, which ties reflection to the moment history gets summarized.

Linger extracts session facts from the original messages, in batches of up to 3,000 characters, so what it stores is built from the raw text.

Check compacted notes against the transcript

The third defence is distrust. A compacted summary and a memory note are both claims, and the original transcript is the evidence.

Anthropic's November 2026 post The components of agent memory shows why this matters. Claude was playing Pokémon with a memory note that had the wrong location for a PokéCenter. During a dreaming pass, a step that rereads logs between sessions, "Claude checked the note against the session transcript, caught its error, and rewrote it."

Linger builds the same distrust into retrieval. A read of original text returns an error if the raw snapshot is missing, and "a summary page never stands in for the original" (memory README). Letta Code writes the sources for each memory change into its git commits, so a wrong note can be traced back to the message it came from.

JJ Englert landed on the same fix by hand. After the audit, his new rules for the assistant were to verify things live instead of trusting old notes, check the source, and grade itself every night on what he had to correct.

A context compaction checklist for personal agent builders

If you build or configure a personal agent, these are the checks that follow from the cases and the code above.

  1. Put standing rules, especially anything about sending, deleting or paying, in a file that is loaded into the system prompt. Keep that layer under a hard size cap so it never crowds out the conversation.
  2. Carry the active user request, including its constraints, through every compaction. OpenClaw does this with a bounded copy; check how long a request your system keeps.
  3. Save memory before compacting. A flush or retain step that sees the unsummarized history is cheap insurance.
  4. Re-attach memory right after compaction, the way Linger attaches its summary index to the first message after it.
  5. Keep the full transcript and make it searchable, and treat a summary as a pointer back to it.
  6. Re-check time-sensitive facts against a live source before acting on them. A compacted "tomorrow" is the most common stale fact.

We test personal agents like Muse and Instinct on everyday errands, and the results are published with intervals and task counts. The checklist above comes from public code and public incidents, and none of it is a test result.

FAQ

What is context compaction? Context compaction is how an agent keeps a long conversation inside its model's context window. It replaces the older part of the history with a summary and keeps the recent messages as they were, so the agent can continue the same session.

Does context compaction delete the conversation? Not in OpenClaw. Its docs say the full history stays on disk and compaction only changes what the model sees on the next turn. Other systems differ, so check whether the transcript is kept and whether the agent can search it.

Is context compaction the same as agent memory? No. Compaction rewrites the conversation the model is reading right now. Memory is what the agent stores separately and loads back, such as a user profile, memory files or extracted facts. Good systems save memory before compacting so the two don't depend on each other.

How do I stop an agent from forgetting an instruction after compaction? Write the instruction into the agent's instruction or memory file instead of only saying it in chat. In OpenClaw that means AGENTS.md or MEMORY.md, which are injected into the system prompt and sit outside the turns that compaction summarizes.

Can I control what a compaction keeps? In OpenClaw, yes. If context feels stale after compaction, its docs suggest /compact Focus on <topic> to guide the summary, or turning on the memory flush so notes survive.

Fitz Zhang

Fitz Zhang, Engineer, Personal Agent Bench

Builds the v2 record-and-replay exam on Personal Agent Bench. Previously a frontend engineer at ByteDance and Tencent Docs.

medium.com/@591763389 · x.com/zcl_2014