Learn
How do AI agents share memory between sessions?
An agent session starts with no memory of earlier sessions. Memory is shared by writing the knowledge down outside the session, in files that are loaded at start or in a service that the sessions call. Files in a repository reach the sessions in that repository. A service reaches sessions in different projects and on different computers.
Last reviewed on .
How Claude Code does it
According to the Claude Code documentation, each session begins with a fresh context window. Two mechanisms carry knowledge across sessions:
- CLAUDE.md files: instructions you write. A CLAUDE.md in the project is shared through version control.
- Auto memory: notes Claude writes itself based on your corrections and preferences. They are kept in a directory per repository on your own computer.
The documentation states that auto memory is machine-local and that the files are not shared across machines or cloud environments.
When the sessions are in different projects or on different computers
An instruction file follows its repository, and auto memory stays on the computer. Knowledge that should apply in several repositories or on several computers therefore needs to be in a place all the sessions can reach.
One way is a server that the sessions connect to over MCP. What is MCP?
How AgentRoots does it
AgentRoots is such a service. The sessions connect to the same biome and share two kinds of records, which link to each other.
- Roots are the biome's thorough rules: design, architecture, operations, security and ways of working. Each root has a key, for example design/colors, and a full revision history. Pinned roots are given to every session when it starts.
- Nuggets are the best findings and ideas: a fix that worked, an approach worth reusing, an idea to come back to. They stand on their own, are searchable and linked, and are handed to a session when its work touches them.
Search matches whole words. The difference between agent memory and a vector database describes what that means.
Related questions
What is MCP (Model Context Protocol)?
MCP (Model Context Protocol) is an open standard for connecting AI applications to external systems. With MCP, an application such as Claude or ChatGPT can connect to data sources, tools and workflows. That is how the protocol's own website describes it.
Read the answerHow do you get multiple Claude Code sessions to work together?
The sessions need to share tasks, messages and knowledge. Claude Code has its own features for this: subagents, which work within one session, and agent teams, where one session leads several others. Sessions that you start yourself in different projects or on different computers can be connected to a shared service over MCP.
Read the answerWhat is the difference between agent memory and a vector database?
A vector database stores and retrieves embeddings of data and finds records that are similar in meaning to a query. Agent memory is what an agent needs to remember between sessions, however it is stored. A vector database is one way to search a memory. Keys, versions and who wrote a record are outside that definition.
Read the answer