You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for persistent long-term memory (Mem0, Zep, etc.) #221
Is your feature request related to a problem? Please describe.
I'm always frustrated when the agent treats every new task or session like it's seeing the project for the first time. Even in the same codebase, it constantly has to re-analyze the project structure, re-learn naming conventions, and figure out the correct terminal commands to run. It’s a waste of time and tokens for the agent to "rediscover" my coding style and project architecture every single time I ask it to do something.
Describe the solution you'd like
I want Zoo Code to integrate with a long-term memory provider like Mem0 or Zep.
The agent should be able to store and retrieve "metadata" about the project and my workflow, such as:
Naming Conventions: If the project uses camelCase for variables and kebab-case for files, the agent should remember that forever after the first analysis.
Terminal Workflow: It should remember which commands (e.g., specific test runners or build scripts) actually work for this project so it stops guessing.
Coding Style: It should remember my preferences (e.g., functional vs. OOP, specific library preferences) across sessions.
Instead of a full re-scan, the agent should first query its memory to get a "briefing" on how I work and how this project is structured.
Describe alternatives you've considered
Manual .roorules: This is high-maintenance. I have to manually write down everything the agent should know.
Large System Prompts: Expensive and slow. It eats up the context window and the agent eventually forgets the top of the prompt anyway.
Additional context
The goal is to move away from the agent having to "start from zero" every time the context is cleared or a new session begins. Tools like Mem0 are designed specifically to handle this kind of persistent user/project profiling.
Thanks for opening this. I agree this is a valuable direction.
Zoo Code already persists task/session metadata, but we do not yet have a strong mechanism for cross-task semantic recall: remembering stable workspace conventions, preferred workflows, and reusable lessons across sessions.
My bias would be to keep the first implementation narrow:
local-first and opt-in
memory scoped to global and/or workspace
explicit create/search/delete flows first
retrieval at task startup or session handoff
I also think it would be better to build on the existing persistence and embedding/vector infrastructure rather than introduce a completely separate memory stack on day one. The harder part here is likely memory lifecycle and hygiene, not storage alone.
A few design questions seem important early:
what scope model we want for v1
how memory should be retrieved/injected without turning into prompt bloat
what metadata each memory should carry
how users inspect, edit, and delete stale memories
whether automatic extraction belongs in v1 or should come later
If there’s interest, a good next step would be aligning on a small v1 design before discussing external providers like Mem0 or Zep.
@edelauna. I agree that starting narrow and focusing on memory lifecycle makes sense, but I'd love some clarification on the technical architecture of the local-first approach.
Mem0 and Zep are definitely not just simple files. They are highly sophisticated, purpose-built memory engines for AI that combine both RAG and Knowledge Graphs to intelligently manage context, entity extraction, and memory decay.
If we build on the existing infrastructure for a local system first, how exactly will it work under the hood? Are we talking about storing simple JSON/text files in a workspace folder, or leveraging a local database/vector store to handle the embeddings and search?
I just want to understand how we plan to reliably replicate that cross-task semantic recall locally.
I was thinking a simple memory.md or something to start. Then once the mechanics are wired in we can extend that to more technical endpoints/providers.
I’ve been digging deep into this and it turns our memory is not one-size-fits-all. There are different types of memory profiles under the hood, for example:
Episodic / Behavioral Memory (Developer Quirks): This is highly dynamic, user-specific, and behavioral. Example: "This developer always writes functional components instead of class components," or "The local environment requires pnpm test:unit rather than standard npm test."
Semantic / Structural Memory (Codebase Architecture): This is relatively static, deeply interconnected system data. Example: "The authentication layer lives under /src/lib/auth and relies on a Redis sidecar for JWT blacklisting."
Because these profiles are so distinct, I'm implementing a multi-provider approach wrapped in a unified abstraction layer, using a structured memory.json that follows Anthropic's memory schema rather than unstructured markdown.
Here is exactly how I'm structuring the architecture on my fork:
1. The Storage Layer & Cross-Dev Syncing
Instead of throwing a loose text file into the workspace, using a structured JSON schema allows the agent to parse, query, and update entities with strict deterministic boundaries. By writing this memory.json directly into the repo root, we get cross-developer memory for free via Git. When one dev maps out a complex project quirk and commits it, the entire engineering team’s agent instantly inherits that architectural context.
2. Dual-Pathway Ingestion Pipeline
To keep execution fast and clean, I’ve separated how memory is actually saved into two distinct pathways:
The Implicit Way (Asynchronous Background Worker): This runs out-of-band so it doesn't block the user. A smaller, cost-optimized model (or the same model running on a background thread) evaluates conversation logs turn-by-turn or session-by-session. It distills the messy chat history down into cold, hard facts to update the memory.json file asynchronously.
The Explicit Way (Agentic Tool-Calling): The runtime LLM is explicitly provisioned with memory-mutation tools. If the agent encounters a specific error, fixes it, and realizes, "Oh, this is an undocumented architectural dependency," it can proactively invoke a tool to write that rule directly into long-term memory.
3. Mitigating Prompt Bloat (The Lifecycle)
Dumping the entire memory file into the system prompt on every turn is a massive waste of tokens and degrades attention performance.
To solve this, memory is strictly pull-based. The system only hydrates a lightweight, top-level context briefing at the absolute start of a session. Beyond that initial bootstrap, the memory tools are completely abstracted; the agent has to intentionally invoke a tool to query its long-term store only when it recognizes it needs historical context for a specific task.
This setup gives us a zero-dependency, local-first foundation that scales. It works out of the box via Git, keeps our context windows lean, and allows us to easily swap in dedicated graph or vector backends (like Mem0 or Zep) down the road without rewriting the core agent loop.
Activity
edelauna commentedon May 21, 2026
Thanks for opening this. I agree this is a valuable direction.
Zoo Code already persists task/session metadata, but we do not yet have a strong mechanism for cross-task semantic recall: remembering stable workspace conventions, preferred workflows, and reusable lessons across sessions.
My bias would be to keep the first implementation narrow:
globaland/orworkspaceI also think it would be better to build on the existing persistence and embedding/vector infrastructure rather than introduce a completely separate memory stack on day one. The harder part here is likely memory lifecycle and hygiene, not storage alone.
A few design questions seem important early:
If there’s interest, a good next step would be aligning on a small v1 design before discussing external providers like Mem0 or Zep.
aquiveal commentedon May 21, 2026
@edelauna. I agree that starting narrow and focusing on memory lifecycle makes sense, but I'd love some clarification on the technical architecture of the local-first approach.
Mem0 and Zep are definitely not just simple files. They are highly sophisticated, purpose-built memory engines for AI that combine both RAG and Knowledge Graphs to intelligently manage context, entity extraction, and memory decay.
If we build on the existing infrastructure for a local system first, how exactly will it work under the hood? Are we talking about storing simple JSON/text files in a workspace folder, or leveraging a local database/vector store to handle the embeddings and search?
I just want to understand how we plan to reliably replicate that cross-task semantic recall locally.
edelauna commentedon May 21, 2026
I was thinking a simple memory.md or something to start. Then once the mechanics are wired in we can extend that to more technical endpoints/providers.
aquiveal commentedon Jun 2, 2026
I’ve been digging deep into this and it turns our memory is not one-size-fits-all. There are different types of memory profiles under the hood, for example:
pnpm test:unitrather than standardnpm test."/src/lib/authand relies on a Redis sidecar for JWT blacklisting."Because these profiles are so distinct, I'm implementing a multi-provider approach wrapped in a unified abstraction layer, using a structured
memory.jsonthat follows Anthropic's memory schema rather than unstructured markdown.Here is exactly how I'm structuring the architecture on my fork:
1. The Storage Layer & Cross-Dev Syncing
Instead of throwing a loose text file into the workspace, using a structured JSON schema allows the agent to parse, query, and update entities with strict deterministic boundaries. By writing this
memory.jsondirectly into the repo root, we get cross-developer memory for free via Git. When one dev maps out a complex project quirk and commits it, the entire engineering team’s agent instantly inherits that architectural context.2. Dual-Pathway Ingestion Pipeline
To keep execution fast and clean, I’ve separated how memory is actually saved into two distinct pathways:
memory.jsonfile asynchronously.3. Mitigating Prompt Bloat (The Lifecycle)
Dumping the entire memory file into the system prompt on every turn is a massive waste of tokens and degrades attention performance.
To solve this, memory is strictly pull-based. The system only hydrates a lightweight, top-level context briefing at the absolute start of a session. Beyond that initial bootstrap, the memory tools are completely abstracted; the agent has to intentionally invoke a tool to query its long-term store only when it recognizes it needs historical context for a specific task.
This setup gives us a zero-dependency, local-first foundation that scales. It works out of the box via Git, keeps our context windows lean, and allows us to easily swap in dedicated graph or vector backends (like Mem0 or Zep) down the road without rewriting the core agent loop.