What is the best open-source memory system for AI agents?
The best open-source AI repos for long-term memory for AI agents right now are Claude Mem, Hindsight and TencentDB Agent Memory. Claude-Mem is the most starred plug-in memory for coding agents; Hindsight is a general agent memory you call from code; ai-memory and Obsidian Mind keep memory as markdown files you can read and edit.
Comparison
| Repo | What it does | Stars | Start here |
|---|---|---|---|
| Claude Mem | Claude-Mem is a persistent memory system that captures what coding agents do in a session, compresses it with AI, and injects relevant context back into later sessions. | 101,511 | Carry Claude Code project context into new sessions |
| Hindsight | Hindsight is an open-source agent memory system focused on agents that learn, not just recall chat history. | 53,493 | Add long-term memory to an existing chatbot in two lines |
| TencentDB Agent Memory | A team-level memory server for AI agents that stores chat memory, skills, wiki pages, and code graphs, and shares them across agents and frameworks. | 29,677 | Give Claude Code and Codex one shared memory server |
| AI Memory | ai-memory is a Rust tool that gives AI coding agents a shared long-term memory, stored as a git-backed markdown wiki, so work can be handed off between agent CLIs and machines. | 12,634 | Hand off a half-finished task from Claude Code to Codex |
| Obsidian Mind | Obsidian Mind is an Obsidian vault template that gives AI coding agents persistent memory through hooks, slash commands and optional local QMD semantic search, built for Claude Code with hooks for Codex CLI and Gemini CLI. | 5,373 | Give your coding agent a memory that compounds |
| Agent Memory | agent-memory is a Python runtime that gives AI agents long-term memory stored as plain Markdown files, with local ranked retrieval and a sleep-time consolidation layer, and Claude Code and Codex share one store. | 4,732 | Share one memory of decisions across Claude Code and Codex |
| Context Mode | Context Mode is an MCP server and hook set for AI coding agents that keeps raw tool output out of the context window, persists session memory in SQLite, and routes work across many clients. | 31,762 | Keep large tool output out of Claude Code's context |
| Lemmalog | Lemmalog is a Rust Datalog engine that gives LLM agents a deductive memory, exposed as an MCP server, a headless CLI, a REPL and an agent skill. | 341 | Give Claude Code a persistent, queryable memory |
When to pick which
Claude Mem
Claude-Mem is a persistent memory system that captures what coding agents do in a session, compresses it with AI, and injects relevant context back into later sessions.
Best for: Developers who run Claude Code, Codex, OpenCode, or OpenClaw on the same projects over many sessions and lose context between them.
Needs: Node.js 20.0.0 or higher; Claude Code with plugin support, or a supported agent host such as OpenCode or T3 Code; A claude-mem sign-in or your own memory provider key, if you do not use the installer's local option; Bun and uv, which the README says are auto-installed if missing
Start here: Carry Claude Code project context into new sessions
- In Claude Code, run /plugin marketplace add thedotmack/claude-mem
- Run /plugin install claude-mem
- Restart Claude Code
- Start a new session in the same project and check that context from the previous session appears
Hindsight
Hindsight is an open-source agent memory system focused on agents that learn, not just recall chat history. You store facts with retain, fetch them with recall, and get a reasoned answer over memory with reflect, organized in memory banks. It runs as a Docker container, with Docker Compose, from pip or on Kubernetes with Helm, has Python, Node.js and Go clients, and an LLM wrapper that adds memory to an existing OpenAI or Anthropic client in two lines.
Best for: Developers building assistants or agents that should remember users and past work across sessions.
Needs: Docker, pip or Kubernetes; An LLM API key (OpenAI in the quick start); Python, Node.js or Go for the client
Start here: Add long-term memory to an existing chatbot in two lines
- Start a Hindsight server, for example with the Docker command from the README on ports 8888 and 9999
- Install the wrapper: pip install hindsight-litellm
- Import it with from hindsight_litellm import wrap_openai and wrap your OpenAI client, passing a bank_id per user and hindsight_api_url for a self-hosted server (http://localhost:8888)
- Call client.chat.completions.create as before; use wrap_anthropic() for the Anthropic SDK
TencentDB Agent Memory
A team-level memory server for AI agents that stores chat memory, skills, wiki pages, and code graphs, and shares them across agents and frameworks.
Best for: Developers and small teams who run several AI coding agents and want them to share project context, skills, and code knowledge.
Needs: Git and a bash-compatible shell; Two sets of LLM API parameters for the memory group and the proxy group, filled into .env; A local machine that can run the three services (memory-core, memory-hub, proxy); An agent client that accepts a custom base URL, such as Claude Code or Codex
Start here: Give Claude Code and Codex one shared memory server
- Run git clone https://github.com/TencentCloud/TencentDB-Agent-Memory.git and then cd TencentDB-Agent-Memory/deploy/global-images
- Run cp .env.example .env, then open .env and fill in the two sets of LLM parameters (memory group and proxy group)
- Run ./start-all.sh and wait for it to finish; it prints a one-liner to paste into Claude
- Open http://localhost:8125 to confirm the panel loads
AI Memory
ai-memory is a Rust tool that gives AI coding agents a shared long-term memory, stored as a git-backed markdown wiki, so work can be handed off between agent CLIs and machines.
Best for: Developers who switch between AI coding agents or machines and want the next agent to resume without re-explaining the project.
Needs: A Linux or macOS machine (native Windows is experimental; WSL2 is supported); At least one supported coding agent CLI installed, such as Claude Code or Codex; A terminal with curl and sh available
Start here: Hand off a half-finished task from Claude Code to Codex
- Run curl -fsSL https://github.com/akitaonrails/ai-memory/releases/latest/download/install.sh | sh
- Run ai-memory setup
- Quit Claude Code in the project directory
- Run ai-memory run codex from the same directory
Obsidian Mind
Obsidian Mind is an Obsidian vault template that gives AI coding agents persistent memory through hooks, slash commands and optional local QMD semantic search, built for Claude Code with hooks for Codex CLI and Gemini CLI.
Best for: Developers and engineering managers who want their coding agent to remember goals, people, decisions and wins across sessions.
Needs: Obsidian; Node.js for ShardMind and QMD; Claude Code, Codex CLI or Gemini CLI
Start here: Give your coding agent a memory that compounds
- Install the vault manager: npm install -g shardmind
- Create a fresh folder and enter it: mkdir my-vault && cd my-vault
- Run shardmind install github:breferrari/obsidian-mind and answer the wizard (name, organization, agents, QMD)
- Open the folder as a vault in Obsidian so you can read what the agent writes
Agent Memory
agent-memory is a Python runtime that gives AI agents long-term memory stored as plain Markdown files, with local ranked retrieval and a sleep-time consolidation layer, and Claude Code and Codex share one store.
Best for: Developers who use Claude Code or Codex across many sessions and want decisions and context to carry over without an API key.
Needs: Python environment able to install the agent-memory package, as described in the README; Claude Code or Codex CLI installed on the machine; A store directory set as AGENT_MEMORY_STORE; Shell access to run the mem commands
Start here: Share one memory of decisions across Claude Code and Codex
- Run the setup step described in the README so the host agents use the shared store at AGENT_MEMORY_STORE.
- Run mem recall "why files instead of a database" to see the ranked L0 list of matching memories.
- Run mem context "why files instead of a database" to get the top hits expanded in one call.
- Open the same question in Codex and check that it returns the same memory paths.
Context Mode
Context Mode is an MCP server and hook set for AI coding agents that keeps raw tool output out of the context window, persists session memory in SQLite, and routes work across many clients.
Best for: Developers who use AI coding agents on large codebases and notice their context window filling up during long sessions.
Needs: Claude Code v1.0.33+ for the plugin install, or Node.js >= 22.5 (or Bun) for the Gemini CLI setup; An existing AI coding agent session in a project you want to work on
Start here: Keep large tool output out of Claude Code's context
- Run /plugin marketplace add mksglu/context-mode in Claude Code.
- Run /plugin install context-mode@context-mode.
- Restart Claude Code or run /reload-plugins.
- Run /context-mode:ctx-doctor and confirm all checks show [x].
Lemmalog
Lemmalog is a Rust Datalog engine that gives LLM agents a deductive memory, exposed as an MCP server, a headless CLI, a REPL and an agent skill.
Best for: Developers who run Claude Code or another MCP-capable agent on long tasks and want its facts and derived conclusions kept in a queryable, provenance-tracked store.
Needs: Rust toolchain with cargo, and a clone of the lemmalog repo; Claude Code (or Kimi CLI) installed if you want MCP tools; A writable path for the memory snapshot, for example /tmp/lemmalog.snapshot or the default ~/.lemmalog/memory.snap
Start here: Give Claude Code a persistent, queryable memory
- Run cargo build --release in the repo to produce the lemmalog-cli binary used by later steps.
- Run cargo build --release --features mcp.
- Run claude mcp add lemmalog -- $(pwd)/target/release/lemmalog-mcp.
- Optionally register with persistence: claude mcp add lemmalog --env LEMMALOG_MCP_PATH=/tmp/lemmalog.snapshot -- $(pwd)/target/release/lemmalog-mcp.
Use cases for long-term memory for AI agents
- Carry Claude Code project context into new sessions
- Find past decisions and bug fixes before you repeat them
- Give Codex threads in T3 Code shared project memory
- Add long-term memory to an existing chatbot in two lines
- Store, search and reason over agent memory with retain, recall and reflect
- Self-host the Hindsight memory server
- Give Claude Code and Codex one shared memory server
- Index an existing repo so agents check impact before editing
- Turn product docs into a wiki that all dev agents can read
- Hand off a half-finished task from Claude Code to Codex
- Resume a project on another machine with the same memory
- Share project knowledge across a team on one server
- Give your coding agent a memory that compounds
- Run a daily standup and brain dump with your agent
- Add offline semantic search to the vault
- Share one memory of decisions across Claude Code and Codex
- Recover why a past decision was made and what it said then
- Correct a stale memory without losing its history
- Keep large tool output out of Claude Code's context
- Count or summarize code with one script, not many reads
- Pick up a coding task after the chat compacts
- Give Claude Code a persistent, queryable memory
- Turn Claude Code into a disciplined investigator
- Feed facts into memory from scripts and cron
Questions
What is the best open-source memory system for AI agents?
The best open-source AI repos for long-term memory for AI agents right now are Claude Mem, Hindsight and TencentDB Agent Memory. Claude-Mem is the most starred plug-in memory for coding agents; Hindsight is a general agent memory you call from code; ai-memory and Obsidian Mind keep memory as markdown files you can read and edit.
Which repo for long-term memory for AI agents is easiest to start with?
Hindsight: its starter use case "Add long-term memory to an existing chatbot in two lines" is rated Beginner and takes about 20 minutes.
How do I get started with Claude Mem?
In Claude Code, run /plugin marketplace add thedotmack/claude-mem; Run /plugin install claude-mem; Restart Claude Code. Full steps and a copy-paste agent prompt: https://dedupedai.com/use-cases/thedotmack-claude-mem/resume-claude-code-project-context/
Are these long-term memory for AI agents repos free?
They are open-source projects on GitHub (check each license; some, like fair-code projects, limit commercial use). Some also sell a hosted version or need a paid model API key; the requirements for each repo are listed on this page.
How is this list of long-term memory for AI agents repos chosen?
Deduped tracks the hottest AI repos on GitHub and writes step-by-step use cases from each README. For this page we picked the repos that do this job, ordered by fit and then GitHub stars. Repos we only inferred from a short README, or that we do not index, are left out. The page is rebuilt with the site; stars are as of the last build in 2026.
More answers
- Best open-source AI repos for running LLMs locally
- Best open-source AI repos for AI coding agents
- Best open-source AI repos for skills and workflows for coding agents
- Best open-source AI repos for browser automation with AI agents
- Best open-source AI repos for web scraping for LLMs and RAG
- Best open-source AI repos for RAG and chatting with your documents
- Best open-source AI repos for voice, speech-to-text and text-to-speech
- Best open-source AI repos for AI video editing and generation
- Best open-source AI repos for AI image generation and editing
- Best open-source AI repos for UI design with AI coding agents
- Best open-source AI repos for MCP servers
- Best open-source AI repos for 3D modeling and CAD with AI
- Best open-source AI repos for research with AI agents
- Best open-source AI repos for running several coding agents in parallel
- Best open-source AI repos for LLM gateways and model routers
- Best open-source AI repos for AI workflow automation
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them free