@zostaff: This paper completely changed how I think about session compaction: Model the DAG -> Snapshot -> Branch -> Trim structu…
Summary
A paper presents a structural approach to session compaction, modeling chat history as a DAG with snapshots and branches to trim bloat while preserving meaning, achieving a mean 20% token cut in coding sessions.
View Cached Full Text
Cached at: 08/05/26, 04:26 PM
This paper completely changed how I think about session compaction:
Model the DAG -> Snapshot -> Branch -> Trim structurally -> Keep verbatim
Here is the 5-step blueprint:
Model the DAG: Session history is not a linear log but version-controlled state, a directed acyclic graph with snapshots and branches.
Snapshot: Accumulated understanding, architectural maps, trade-offs, codebase conventions, is captured as named state instead of drowning at window overflow.
Branch: A snapshot is reused across independent parallel sessions, context forked with lineage tracking preserved.
Trim structurally: A three-pass algorithm strips mechanical bloat, raw tool outputs, base64 images, metadata, not meaning.
Keep verbatim: Every user message and assistant response stays word for word, the trimming is structurally lossless.
The key insight: Native autocompaction crushes 98 percent of a session’s accumulated state into a short summary, and every bit of understanding earned across the session is lost.
Across 76 real coding sessions this gave a mean 20 percent token cut and up to 86 on heavy ones, while mixed sessions break even within 10 turns under prompt caching.
Read this, then check the article below.
Similar Articles
Is anyone working on conversation compaction?
The author discusses using recursive summaries in their chat app 'harness' to manage context but observes model degradation with Qwen Flash Next after many messages, questioning if conversation compaction pollutes model coherence.
@dair_ai: A great read if you an AI dev. Current context compactors retain 17% of the standing rules users give them. Session Con…
A new paper introduces COMPINT, an evaluation suite showing that context compactors silently drop session constraints, retaining only 17% on average. A simple SC-aware extractor recovers over 90% retention without modifying the compactor or model.
StateComp: Learning When to Compress History in Long Horizon Agents
StateComp is a framework that compresses historical interactions in long-horizon agents based on the current state, reducing token usage by 52.27% and achieving a 12.67× speedup in representation extraction while maintaining task performance.
A flat MEMORY.md broke in 2 weeks (30.9 KB bloat, 100% of coding rules evicted). How we built 4-layer local agent memory without a vector DB—and where 5 major labs converge and split
A post-mortem of a flat MEMORY.md that bloated to 30.9 KB and evicted all coding invariants in two weeks, presenting a 4-layer local agent memory design (role-aware budgets, deterministic decay, dual-speed writes, BM25 wiki search, taint quarantine) in the open-source agy-hq project, plus a comparison of how 5 major labs handle cross-session memory.
@zostaff: This paper completely changed how I think about self-evolving codebases: Backlog -> Ideate -> Triage -> Execute -> Poli…
This paper presents a six-phase blueprint for self-evolving codebases using LLMs, emphasizing convergence toward a specification rather than metrics.