Fix agent memory loss: keep an append-only event log and let the model query it with SQL

arpit_bhayani · x · 2026-12-04

Arpit Bhayani explains why agents 'forget': summarization and embedding-based ingestion are lossy compression that must decide what matters before the question exists. His fix: store every interaction as a row in an append-only event log, never overwritten, and give the model a read-only SQL tool so relevant rows re-enter the context at query time — e.g. SELECT ... WHERE content LIKE '%deploy payments: success%' ORDER BY ts DESC LIMIT 1 to find the last successful deploy. Compression still happens, but at query time, guided by the current objective. Better models write better queries, and cheaper models make multi-query lookups practical.

Original post →

More from coding & agent

coding & agent channel →