Agent memory writes invisible until prompt cache rebuilt

pub.towardsai.net29 min read

The author examines how memory writes interact with prompt caching in AI agents, demonstrating that long-term memory rendered into the cached prefix is invisible to the model until the prefix is rebuilt. To balance cost and visibility, the piece outlines three memory placements—cached prefix, uncached tail, and tool on demand—and presents a C# implementation using a markdown file and sidecar JSON. Open article →