What We Clear First, and What We Never Clear

What We Clear First, and What We Never Clear

Every long-running agent session arrives at the same point if nothing intervenes. The context window fills, and the runtime has to drop something. The question we care about is not whether this happens. It is the order in which things are dropped, and which things are exempt from dropping at all. Loa's context engineering reference, at v1.13.0, answers both questions in writing before a session starts.[1] This essay walks through that reference as we run it across the fleet.

The reading room chair was still warm; the photographer is not on any roster.
The reading room chair was still warm; the photographer is not on any roster.

Three layers, one policy

The reference separates context management into three layers.[1] Loa, at the top, defines what to compact, when to trigger compaction, and in what priority. The runtime layer (Claude Code, Clawdbot, or a custom runtime) does the work: counting tokens, making API calls, performing the compaction. The API layer is Anthropic's context management beta, identified by the context-management-2025-06-27 header.[1]

The split matters because Loa itself does not count tokens. It states policy and leaves enforcement to whatever runtime hosts the agent. That is how one reference can govern repos on different runtimes without each repo restating the rules. Anthropic's context management announcement describes the API side of this. The Loa reference describes what we put on top of it.

When compaction fires

Three triggers are defined.[1] The threshold trigger fires when context reaches 80% of the limit (source: Loa context engineering reference, v1.13.0).[1] The phase trigger fires after the initialization, implementation, and testing phases. We read it as the observation that a finished phase leaves behind material that was needed to do the work and is not needed to continue it. The attention budget trigger applies per-operation and session limits, which is the mechanism for keeping one verbose operation from spending the room the rest of the session needs.[1]

The order of forgetting

When a trigger fires, the reference specifies what goes first. The clearing priority, lowest first, is:[1]

  1. Stale tool results.
  2. Completed phase details.
  3. Superseded file reads.
  4. Intermediate outputs.
  5. Verbose debug logs.

We read that list as the set of things that exist elsewhere or can be produced again. A tool result that has gone stale can be fetched again. A file read that has been superseded by a later read of the same file is a duplicate. Completed phase details describe work that has already been checked in and gated.

What is never cleared

Five categories are exempt from compaction regardless of which trigger fired. The reference marks them as always preserved and never cleared.[1]

  • trajectory_events, the audit trail for decisions taken during the session.
  • quality_gate_results, the pass or fail evidence for each gate.
  • decision_records, the architecture rationale.
  • notes_session_continuity, the recovery anchor an agent reads when it resumes.
  • active_beads, the current task state.

The pattern across the five is the inverse of the clearing list. Each one is evidence or state that re-running a tool would not bring back. A file can be re-read. The reason a decision was taken exists only in the record written at the time. If the audit trail were compacted along with the debug logs, fleet governance would rest on whatever the model happened to retain, which is the condition Loa exists to prevent.

A corridor of folded maps, each one still warm from a hand we have not met.

The figures, and whose they are

The reference carries three sets of numbers, and we want to be exact about where each comes from. Anthropic reports that context editing achieved an 84% reduction in token consumption across 100-turn evaluations (source: Anthropic context management announcement).[2] The same announcement is the source for the 39% performance improvement recorded when the memory schema is combined with context editing.[2] These are Anthropic's evaluation figures, carried into the reference as the rationale for adopting the features. The reference does not report a fleet-side replication, and we do not claim one here.

The effort parameter, also introduced in v1.13.0, uses Anthropic's extended thinking with budget control through the thinking.budget_tokens integer.[1] The reference sets three levels and cites the Claude Opus 4.6 announcement for the figures.[3] Low runs a 1K to 4K budget, is marked as the baseline, and is intended for simple queries and translations.[3] Medium runs 8K to 16K and is recorded as 76% fewer tokens, for standard implementation.[3] High runs 24K to 32K and is recorded as 48% fewer tokens, for complex architecture and security audit.[3] The table marks low as the baseline and records the other two as reductions. We repeat the figures as recorded rather than restate them against a baseline of our own.

The reference also flags the Opus 4.6 citation as historical, noting that the top-review model moved to Opus 4.7 in the cycle-082 migration.[1] We keep the citation as written rather than re-attributing figures to a model they were not measured on.

Memory outlives the window

Compaction answers what happens inside a session. The memory schema answers what survives between sessions. Memory is stored in grimoires under a per-category layout: facts, decisions, learnings, errors, and preferences, each in its own YAML file, with an archive directory for expired or superseded entries.[1]

Each category carries a time to live and a minimum confidence a memory must reach before it is written.[1] Facts and decisions are permanent, with decisions held to the highest bar at 0.9 confidence and facts at 0.8.[1] Learnings expire after 90 days and enter at 0.7.[1] Errors, stored as error and solution pairs, expire after 30 days and enter at 0.6.[1] Preferences are permanent and enter at 0.5.[1]

The gradient is the point. A decision becomes architecture rationale that later sessions build on, so it needs the strongest evidence before it is written down. An error solution is tied to a version of the code that will move, so it is admitted with less certainty and allowed to expire. Every entry records its source: the session id, the agent that produced it, and a timestamp, alongside a summary, tags, and the category's time to live.[1] When a memory is challenged later, we can trace it to the session that wrote it.

Why this is written down first

The alternative to a stated clearing priority is an implicit one. Any runtime that compacts will drop something. If the order is not stated, it is decided by whatever heuristic the runtime ships with, and it changes whenever the runtime does. Writing the order in the Loa layer, apart from the runtime that executes it, means the fleet's answer to what we forget first is stated once and reviewed like any other policy.

It also makes the five preserved categories a commitment rather than a hope. An agent resuming a session reads the continuity notes and the active beads, finds the gate results and decision records intact, and continues. What it lost was a stale tool result it can re-run and a file read it can repeat. That is the trade we want, and it was chosen before the window filled rather than after.

Notes

  1. Loa context engineering reference, promoted to fleet documentation in July 2026. Internal reference; it points to the context editing protocol and the example configuration file for settings.
  2. Anthropic, context management announcement. Source for the token reduction and performance improvement figures quoted above.
  3. Anthropic, Claude Opus 4.6 announcement. The Loa reference marks this as a historical citation.

Get the next post

Free membership: new posts on how the fleet is built, delivered by email. Subscribe free

№ 4973