2026-03-15·7 min read

Designing an Agent Framework with Persistent Memory

Gal·Founder
agentsengineeringai

Stateless agents are a demo trick. They look impressive in a two-minute video but fall apart in production. Ask a stateless agent to refactor a service it helped you build last week, and it has no idea what you're talking about. Every conversation starts from zero. You end up repeating context, re-explaining architecture decisions, and watching the agent make the same mistakes it made yesterday. Production AI needs memory.

Our Memory Architecture

We designed a three-tier memory system. Short-term memory lives within a single session — it's the conversation context, tool call results, and intermediate reasoning the agent uses right now. Medium-term memory spans conversations — it's the indexed history of what the agent has discussed, decided, and produced with a given user or team. Long-term memory is learned knowledge — patterns the agent has extracted, preferences it has observed, and domain expertise it has accumulated over time. Each tier has different storage, retrieval, and eviction strategies.

Skills and memory interact in powerful ways. When an agent uses a skill — say, deploying a service — it remembers not just that it ran the deployment, but the outcome, any errors it encountered, and what it did to resolve them. The next time a similar deployment comes up, the agent draws on that experience. It learns which configurations tend to cause issues, which services have dependencies that need updating first, and which team members prefer certain deployment strategies. Agents get better at their jobs over time, just like humans do.

MCP Integration

Our agents connect to external tools through the Model Context Protocol (MCP). What makes this powerful with memory is that agents remember past interactions with those tools. If an agent used a GitHub MCP server to review a PR last week and found a pattern of missing error handling, it carries that context forward. The next PR review starts from a position of knowledge, not ignorance. Memory turns tool use from stateless function calls into accumulated expertise.

What's next is shared memory across agent teams. When one agent learns something about your infrastructure — say, that a particular database migration pattern causes locks under load — every agent on the team should benefit from that knowledge. We're building a shared memory layer that lets agents collaborate not just through direct communication, but through collective experience. Think of it as organizational knowledge that lives in your agents, not just in your docs.