Harness Engineering | June 8, 2026 | 7 min read

Compaction vs. Preservation

Session Bridge preserves the decisions, corrections, and artifacts that compaction throws away in agent harnesses.

-- views

The Problem I Kept Hitting

In April, I told my agent something important: "I'm looking for a thinking partner, not something that is always saying yes to me." I wanted it to push back. Challenge my assumptions. Say "I think this part has a problem" instead of "great idea!"

It worked. For that session. The agent adjusted immediately. Became sharper, more honest, more useful.

Next session? Back to agreeing with everything I said.

Not because it was ignoring me. Because it had forgotten I ever said it. The correction I gave, a behavioral rule learned mid-session, was gone. Compacted away. Compressed into something like "user gave feedback about communication style" without preserving what the feedback actually was.

This kept happening. Not with facts. Facts are easy to persist. But with everything else: corrections, behavioral rules, concepts I'd learn, ideas we'd discuss, insights, great quotes. The things that make an agent feel like yours over time. Every session reset wiped the slate.

I was running daily 4-hour sessions with my agent, Cal, over months. A single afternoon session? Compaction works fine. But when you're building a relationship with an agent across weeks, when it's learning your preferences, your workflows, your corrections, your ideas, your discoveries, compression becomes destruction.

The longer you use any agent, the more this matters. And nobody was talking about it. I was constantly worried about capturing. Did I remember to save that insight? Did that correction stick? Will it still know tomorrow what I taught it today?

The Distinction

Here's what I realized:

Compaction asks: "What can I forget?"
Preservation asks: "What must I keep?"

They sound like opposites. They're actually orthogonal problems being solved by the same tool. And that's the bug.

Compaction is an intra-session compression tool. It summarizes your conversation to free up tokens so the session can continue. It's good at that. It keeps you running.

But it was never designed to be a cross-session knowledge system. It was never designed to answer: "What did the agent learn this week that it needs to remember next week?"

When compaction is the only tool you have, everything gets compressed. Decisions get flattened into summaries. Artifacts lose their paths and context. Behavioral corrections, the "I told you not to do that" moments, get reduced to a line that says "user gave feedback" without preserving what the feedback was.

The result: your agent starts fresh every session. Not technically. It has a summary. But practically, it's lost the signal.

What I Built

Layer 1: Handoff (Lossless Preservation)

The first thing I built was Handoff. A structured snapshot that fires before a session ends.

Before the session resets, the agent captures not a summary, but a categorized extraction of everything that happened. At its core, every session produces knowledge about three things:

  • What the agent is. Its own personality, behavioral rules, how it should act.
  • What the agent knows about me. My preferences, my schedule, my patterns.
  • The work that we do together. Decisions, artifacts, concepts, progress.

These map to extraction categories, like:

  1. Active context. What's in progress, what's next, what's blocked.
  2. Decisions & changes made. Architectural choices, approach changes, and why.
  3. Artifacts created. Files built or modified, with full paths.
  4. Knowledge discovered. New concepts, insights, technical learnings.
  5. Feedback for Cal. Corrections, behavioral rules, confirmed approaches.

That fifth category is the key. When I said "thinking partner, not yes-machine," the agent didn't just log it. It updated its own personality file with a new "Critical Assessment" section, a permanent behavioral rule that fires every session going forward. I never said "go update your personality file." The handoff skill routes behavioral corrections to the right place automatically.

Real examples of this working:

  • "Thinking partner, not yes-machine" → routed to the agent's personality file as a permanent behavioral rule. I never said "go update your personality file." The handoff recognized this as a correction to how the agent is, and routed it there. Still active today.
  • Isha's school drop-off and pickup logistics → routed to both the user profile AND as a proactive rule: "flag calendar conflicts with drop-off (8:15-8:45) and pickup (12:15-12:35) on Mon/Tue/Wed." The agent now checks this every morning brief without being asked.
  • "The Trust Spectrum" as a framework → routed to a standalone concept note in my knowledge base. Not buried in a daily log. Findable, linkable, buildable. A concept that emerged from conversation, automatically preserved as its own artifact.

Over months, my agent learned hundreds of things. Concepts, behaviors, preferences, rules. And I never had to worry about any of them being lost. The handoff skill captures the signal and routes it to where it belongs.

Handoff alone is more powerful than compaction for cross-session continuity, because nothing gets thrown away. The question shifts from "what fits in the summary?" to "what category does this belong to?"

Layer 2: Session Bridge (Automatic Preservation + Routing)

With Handoff, you still have to ask. "Save everything to the logs please." That's a manual trigger. It works, but it means I'm still thinking about preservation. I'm still the one deciding when to capture.

Session Bridge removes even that step. It fires automatically, at 80-85% context usage, on session end, or on topic switch. You don't think about it. The preservation just happens.

That's the feeling I was after: not having to worry anymore about capturing. Every new concept, every new idea, every behavioral change. I stopped thinking about whether it would survive the session. It just does.

Session Bridge extends Handoff by routing context to the right permanent location:

What Where It Goes Why
Decisions + reasoning Project decision logs Retrievable by project, not buried chronologically
Artifacts created Referenced with full paths Future sessions can load specific files
Knowledge + insights Topic-specific memory Organized by domain, not by date
Behavioral corrections Long-term memory / personality Agent personality persists across sessions
Active WIP Handoff summary Next session knows exactly where to start

Future sessions load only what's relevant rather than parsing one growing blob.

The progression:

Compaction (lossy, automatic, forgets)
    → Handoff (lossless, manual trigger, preserves)
        → Session Bridge (lossless, automatic, preserves + routes)

Why Both Layers

  • Handoff without routing = lossless but unorganized (a journal with no index)
  • Routing without handoff = organized but lossy (an index to a book you threw away)
  • Session Bridge (both) = lossless AND organized. Nothing lost, everything findable.

Without Session Bridge, any downstream memory system can only work with what survived compaction. With it, you have the full history. Every decision, every correction, every dead end. Available for synthesis.

What the Community Said

I submitted Session Bridge as a feature proposal to both Anthropic's Claude Code and OpenAI's Codex. Not only did people validate the core idea, they extended it.

"Append-only, not rolling summary"

"Treat the handoff artifact as an append-only log, one entry per session, not a rolling summary. Each session appends its structured snapshot; the next session loads the last N entries and decides what's still relevant. This avoids the 'lossy re-summarization' failure mode where a summary of a summary gradually drifts from the original decisions."

Kyle Carriedo

This is how I'd already built it. Each session appends to daily logs, never re-summarizes them. A separate consolidation process synthesizes long-term memory from the raw logs without overwriting them. Kyle arrived at the same pattern independently. That tells me the design is right.

"Preserve behavioral rules, not just facts"

"The behavioral digest component specifically preserves corrections and behavioral rules across compaction events, user feedback, gate conditions, things the model learned mid-session, so they survive as active context in the next session, not buried in a flat summary."

Junaid, creator of Cozempic (context management for Claude Code)

My "Feedback for Cal" category exists precisely for this. I built what my use cases demanded. Junaid confirmed what I'd found: getting corrections to the right permanent location is the harder part. His team built Cozempic for checkpoints. Session Bridge handles routing. Everyone will build the framework that fits their system.

"Team knowledge vs. temporary run state"

"I'd be interested in deciding which discoveries are stored as team knowledge vs temporary run state. Otherwise, some preserved context can still become stale."

Taylor Dolezal, Head of Ecosystem at CNCF

A fascinating extension. Session Bridge is single-agent, single-user. In team settings, you need to distinguish project-level facts from task-level context, and preserved knowledge needs re-validation over time. That's the open frontier.

Implications Beyond Preservation

Session Bridge doesn't just fix cross-session continuity. It unlocks capabilities that compaction alone cannot:

  • Structured routing, not a flat dump. Context goes to the right location, not a growing file with no organization principle. Future sessions load only what's relevant.
  • Cross-session, not just next-session. Resuming works for the immediately next session. Session Bridge builds persistent knowledge accessible from any future session. Days or weeks later. The file system becomes long-term memory with structure.
  • Enables downstream memory systems. Session Bridge produces the raw corpus that makes everything else powerful. Memory consolidation. Nightly synthesis. Dreaming. All of it only works as well as the raw material it has access to. Without Session Bridge, it gets whatever survived compaction. With it, it gets the full history.
Session Bridge (preserves) → Daily Logs (accumulate) → Memory Consolidation (synthesizes)

Session Bridge is a feature proposal that is open today at both OpenAI's Codex and Anthropic's Claude Code. The reference implementation is running in production (github.com/monbishnoi/cal). And the community is building toward the same destination from different angles: compaction and preservation are different problems being conflated as one.

Preservation is not the same as compression.

So, the core question remains simple:

When your agent's session ends, what survives?

If the answer is "a summary," you're compacting, not preserving. And your agent will forget the things that matter most.

If the technical architecture interests you (trigger timing, pre-compression hooks, mid-tool-loop safety), heart this post or comment on the Codex or Claude Code issue.

github.com/monbishnoi/cal, Session Bridge reference implementation
Claude Code Issue #62903, Feature proposal
Codex Issue #24810, Feature proposal