@zostaff: This paper completely changed how I think about session compaction: Model the DAG -> Snapshot -> Branch -> Trim structu…

X AI KOLs Timeline Papers

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.

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.
Original Article
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?

Reddit r/LocalLLaMA

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.

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

Reddit r/AI_Agents

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.