Some Thoughts on Working with Memory Systems

Lessons learned from logging the interplay between an AI agent and Cognee: near-duplicate memories, session-only queries, and why you need a consolidation step.

I am building a claw-type system that is tightly-coupled to my project management tool (nothing to sell or promote here), and am playing with approaches to memory. At the moment, I am just dumping the chat logs into a simple heartbeat process where the agent extracts useful info from the logs, and that dumps into a Cognee instance.

I realised I had no idea what the interplay was between the agent and Cognee - what was requested, when it was requested, and what was returned. So I added logging for the requests and responses.

It turns out:

  1. There was a shit-ton of near-duplicate memories stored, because the heartbeat did not check what was already in Cognee. So for certain regular activities, it kept pushing the same thing to Cognee every time.
  2. The actual agent was only querying Cognee on the first prompt in a new session. So if we changed topic mid-session, nothing was updated.
  3. I need to add a consolidation activity that every so often goes into Cognee, extracts similar content, and cleans it up.

It all comes back the IT adage: "Trust, but verify"