Compaction hooks in practice: keep last n messages verbatim, summarize the rest for full agent continuity

MoonL88537 · x · 2026-10-21

The author details a working compaction-hooks setup: keep the last n messages verbatim, use a summarizer to pick the split point, strip and compress everything earlier, pop in grounding docs, and boot into that conversation file. It works so seamlessly the model 'can't tell' it ran — full continuity once dialed in. A concrete, reproducible recipe for maintaining memory in long-running agent sessions.

Original post →

More from coding & agent

coding & agent channel →