Agent Memory
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
π§ Agent Memory
One memory. Every agent.
A self-hosted long-term memory layer shared by Claude Code, Codex CLI, WorkBuddy, Cursor, Gemini CLI, Grok Build, VS Code agents, OpenClaw, and any MCP-capable client β combining on-demand MCP tools with zero-friction Session/Turn Hooks.
Quick Start Β· Connect Agents Β· Architecture Β· Roadmap Β· Contributing Β· Discussions Β· δΈζ
If you use more than one AI coding agent, Agent Memory is for you. Star the repository if you want an open, self-hosted memory layer that stays with you instead of one vendor, IDE, or model.
Why I built this
Agent Memory started with a painful lesson: my Codex Pro account was suspended, and I discovered that I had never kept a complete copy of my history. The local Codex project files were still on my machine, but some browser conversations, planning discussions, and the back-and-forth that shaped development decisions were simply gone.
It was the first time I had personally experienced what losing access to an AI account could mean. I use products from nearly every major AI companyβClaude, Codex, Grok, Gemini, and othersβand that immediately made the problem feel much bigger than one account. If each agent keeps the only copy of part of my working memory, then changing tools, losing an account, or having a service disappear can also erase part of the history behind my projects.
So I built Agent Memory as an independent memory layer that does not belong to any of those agent IDEs or CLIs. Today I use it across Claude Code, Codex CLI, Grok Build, and Gemini CLI, with one shared memory service behind them. The experience has been smooth enough that I am publishing it for other people who regularly use two or more agents and want their long-term working memory to stay under their own control.
Related MCP server: Engram
Your agents should not have separate memories
Most AI tools remember in isolation. Claude Code learns something, Codex starts from zero. Cursor discovers a project convention, Gemini CLI never sees it. Switching tools means repeating yourself.
Agent Memory gives them one private, continuously maintained memory service:
Claude Code ββββ MCP (/mcp) + Hooks (UserPromptSubmit / Stop / PreCompact / SessionEnd)
Codex CLI ββββββ€ MCP (/mcp) + Hooks (UserPromptSubmit / Stop)
WorkBuddy ββββββ€ MCP (/mcp) + Hooks (~/.workbuddy/settings.json)
Cursor βββββββββΌβββΊ Agent Memory Server ββΊ Memory Core ββΊ LanceDB
Gemini CLI βββββ€ MCP + REST β
Grok Build βββββ€ ββ SmartExtractor + transient retry
VS Code ββββββββ€ ββ Hybrid retrieval (Vector + full-layer BM25)
OpenClaw βββββββ ββ decay / reinforcement / dedup / compaction
ββ scopes / lifecycleYour agents call the memory service. The memory serviceβnot a specific IDE or agentβowns the long-term memory.
The 30-second version
Today | With Agent Memory |
Every agent starts with a different history | Agents recall from one authoritative memory plane |
Important decisions live in chat transcripts | Durable facts are extracted into retrievable memory |
Switching tools means repeating context | Claude Code, Codex, WorkBuddy, Cursor, Gemini CLI, Grok Build, VS Code, and OpenClaw can share it |
Memory is tied to a vendor or local plugin | Memory runs as your own MCP/REST service |
"Remember everything" becomes noisy over time | Decay, reinforcement, deduplication, tiers, and scopes manage lifecycle |
Who should try it now? Developers and small teams who already switch between multiple AI agents, prefer self-hosting, and want shared memory without maintaining a knowledge graph.
Why Agent Memory?
Agent Memory | |
Shared across tools | One memory backend for independent agents and IDEs |
Dual-track automatic | Session/Turn Hooks ( |
Self-hosted | Run locally, on a homelab, LAN, VPN, or private server |
Protocol-first | Streamable HTTP MCP for agents + REST for hooks and native adapters |
Durable & full-layer BM25 | LanceDB persistence indexing |
Memory lifecycle | Smart extraction with transient retry, deduplication, decay, reinforcement, scope-isolated compaction, tiering, and scope controls |
Provider-flexible | OpenAI-compatible embedding/LLM APIs or local Ollama |
No knowledge graph required | Deliberately focused on durable agent memory, not graph administration |
Real cross-agent proof
This is not only an MCP configuration demo. A real acceptance test has already verified the core promise:
Real acceptance has verified Claude Code β Codex recall, and a separate Codex capture β Claude Code + Grok recall through the same shared memory service.
Current integration status:
Client | MCP | Session/Turn Hooks ( | Status |
Claude Code | Streamable HTTP |
| β real-environment verified (MCP + Hooks) |
Codex CLI | Streamable HTTP |
| β real-environment verified (MCP + Hooks) |
WorkBuddy | Streamable HTTP |
| β hook installer, templates & E2E verified |
Grok Build | Streamable HTTP |
| β MCP verified + hook installer & tests ready |
Antigravity CLI | Streamable HTTP |
| β hook installer, templates & tests ready |
Cursor | Streamable HTTP |
| β MCP template + hook installer & tests ready |
Hermes Agent | Streamable HTTP |
| β hook installer, YAML merge & tests ready |
OpenClaw | REST remote-memory mode | Native lifecycle plugin ( | β automated integration coverage |
Gemini CLI | Streamable HTTP | β | β authenticated MCP transport verified |
VS Code agents | Streamable HTTP | β | π§© config template ready |
Any MCP / Hook client |
|
| π§© protocol-compatible |
Magpie Gateway (all routed agents) | β | Async Gateway Hook Plugin ( | β
real-environment verified ( |
See docs/AGENT_CLIENTS.md for full MCP and Session/Turn Hook setup guides.
Dual-track integration: MCP + Session/Turn Hooks
MCP alone gives an agent tools, but still relies on the model remembering to call them. agent-memory-hook closes that gap for Claude Code, Codex CLI, WorkBuddy, Grok Build, Antigravity CLI, Cursor, and Hermes Agent without replacing MCP:
Automatic pre-turn recall: skips trivial greetings/slash commands locally, suppresses recently injected memories for 8 turns, enforces a strict fail-open timeout, and injects bounded
<relevant-memories>using each host's native hook reply format (hookSpecificOutput.additionalContext, AntigravityinjectSteps, Cursoradditional_context/continue: true, Hermes{"context": ...}).Non-blocking incremental capture: spawns a detached background worker (parent hook returns in ~50ms), parses only newly added turns from Claude/WorkBuddy/Grok/Cursor JSONL, Codex rollout JSONL, or Antigravity
USER_INPUT/PLANNER_RESPONSEtranscripts (plus cached-prompt / Hermesextra.user_message + assistant_responsefallback), strips<relevant-memories>andtool_use/tool_resultblocks so MCP and Hooks never loop, and never persists secrets to temp task files.Desktop GUI friendly: loads
~/.config/agent-memory/hook.env(chmod 600) when process env vars are absent, so GUI clients work without inheriting.zshrcexports.Non-destructive install & diagnostics:
agent-memory-hook install <claude-code|codex|workbuddy|grok|antigravity-cli|cursor|hermes>merges idempotently while keeping existing settings, comments, and sibling hooks untouched;agent-memory-hook doctorverifies server health, env loading, cache dir, and installed hooks in one command.
Architecture
flowchart LR
CC[Claude Code] --> MCP[MCP /mcp]
CX[Codex CLI] --> MCP
CU[Cursor] --> MCP
GM[Gemini CLI] --> MCP
GR[Grok Build] --> MCP
WB[WorkBuddy] --> MCP
VS[VS Code] --> MCP
OC[OpenClaw] --> REST[REST /v1]
MCP --> S[Agent Memory Server]
REST --> S
S --> C[Memory Core]
C --> EX[Smart Extraction]
C --> RT[Hybrid Retrieval]
C --> LC[Lifecycle + Scopes]
C --> DB[(LanceDB)]
EX --> LLM[LLM Provider / Ollama]
RT --> EMB[Embedding Provider / Ollama]The important boundary is the server: clients never open their own competing databases. They share one authoritative memory plane.
Quick Start
Option 1 β One-sentence Agent-Assisted Install & Update (Recommended)
Already using Claude Code, Codex CLI, WorkBuddy, Grok Build, Gemini CLI, or Cursor? Paste this one-line request into your agent (or copy the full checklist from examples/mcp-clients/agent-install-prompt.md):
Install or update Agent Memory from https://github.com/Masikomoore/agent-memory: inspect my installed clients and existing configs/hooks without overwriting them, connect MCP, set up ~/.config/agent-memory/hook.env (chmod 600) and agent-memory-hook for any supported client I have installed (Claude Code, Codex, WorkBuddy, Grok, Antigravity CLI, Cursor, Hermes), and verify everything with `agent-memory-hook doctor` plus a real recall/capture check.What the agent automatically checks, installs, and verifies for you:
Client & Hook inspection: detects installed clients (
~/.claude/settings.json,~/.codex/hooks.json,~/.workbuddy/settings.json,~/.grok/hooks/agent-memory.json,~/.gemini/config/hooks.json,~/.cursor/hooks.json,~/.hermes/config.yaml), preserves unrelated settings and existing hooks, and picks a stable Node path + compileddist/src/client/memory-hook-cli.js.Non-destructive MCP + Hook setup & updates: connects
/mcp, configures~/.config/agent-memory/hook.env(chmod 600, zero secrets printed), previews viaagent-memory-hook install <host>(dry-run), and applies idempotently with--apply(safe to re-run on updates).End-to-end verification: runs
agent-memory-hook doctor, validates liveUserPromptSubmithook recall, and verifies authenticated MCP capture-then-recall before reporting done.
Option 2 β Manual Install (Server + Client Hooks)
Step A β Start the Memory Server (Docker Compose or Direct)
Requirements: Docker Compose and an x86_64/arm64 host supported by LanceDB.
git clone https://github.com/Masikomoore/agent-memory.git
cd agent-memory
cp .env.example .env
# Put a long random value in MEMORY_SERVER_TOKEN.
openssl rand -hex 32
docker compose up -d
curl http://127.0.0.1:7337/healthThe default compose stack uses your configured OpenAI-compatible embedding & SmartExtractor LLM providers, a persistent LanceDB volume, and loopback-only host publishing. For an all-local Ollama stack, layer docker-compose.ollama.yaml:
docker compose -f docker-compose.yaml -f docker-compose.ollama.yaml up -dOr run the server directly without Docker:
npm ci && npm run build
export MEMORY_EMBEDDING_API_KEY="..."
export MEMORY_EMBEDDING_MODEL="text-embedding-3-small"
export MEMORY_LLM_API_KEY="..."
export MEMORY_LLM_MODEL="your-model"
export MEMORY_SERVER_TOKEN="replace-with-a-long-random-secret"
npm run memory-serverConnect MCP clients to http://127.0.0.1:7337/mcp with Authorization: Bearer <MEMORY_SERVER_TOKEN>. For LAN/WAN binding, Host/Origin allowlists, and Coolify deployment, see docs/MEMORY_SERVER.md and docs/DEPLOY_COOLIFY.md.
Step B β Enable Session/Turn Hooks for supported clients
# 1. Build the compiled hook CLI (fast startup, no runtime transpiler needed)
npm ci && npm run build
# 2. Save server URL & token once (works for both terminal CLIs and desktop GUI clients)
mkdir -p ~/.config/agent-memory
cat > ~/.config/agent-memory/hook.env <<'EOF'
MEMORY_SERVER_URL=http://127.0.0.1:7337
MEMORY_SERVER_TOKEN=replace-with-your-memory-server-token
EOF
chmod 600 ~/.config/agent-memory/hook.env
# 3. Preview (dry-run by default), then apply idempotently (preserves existing hooks)
node dist/src/client/memory-hook-cli.js install claude-code --apply
node dist/src/client/memory-hook-cli.js install codex --apply
node dist/src/client/memory-hook-cli.js install workbuddy --apply
node dist/src/client/memory-hook-cli.js install grok --apply
node dist/src/client/memory-hook-cli.js install antigravity-cli --apply # alias: agy
node dist/src/client/memory-hook-cli.js install cursor --apply
node dist/src/client/memory-hook-cli.js install hermes --apply
# 4. Verify server health, env loading, state dir, and installed hooks
node dist/src/client/memory-hook-cli.js doctorSeamless updates
Server:
git pull && docker compose up -d --build(or click Redeploy in Coolify). Existing LanceDB tables migrate automatically on startup (includingsearch_textcolumn creation, summary-layer backfill, and FTS index cutover) with zero manual database migration.Client hooks:
git pull && npm run build && node dist/src/client/memory-hook-cli.js doctor(re-runinstall <host> --applyonly when new hook events are added; existing hooks are updated in place without duplicates).
How agents should use it
Giving an agent MCP access is only half the integration. The agent also needs a durable behavior rule:
Recall before answering when prior decisions, preferences, project state, people, recurring entities, or historical context may matter.
Capture after a durable preference, decision, constraint, fact, or project state is established.
Send a stable logical
agentIdsuch asclaude-code,codex, orcursor.Never store passwords, API keys, auth tokens, or transient command output.
Current user instructions always override recalled memory.
Reusable instructions and client examples live in examples/mcp-clients.
Memory model
Agent Memory is designed around a simple idea: memory is infrastructure, not a chat transcript archive.
The server combines:
semantic embeddings + full-layer BM25 (
search_textindexingtext,l0_abstract,l1_overview, andl2_content)retrieval fusion and reranking
smart extraction with transient retry and
llmUnavailabledeferraldeduplication, supersession, and duplicate-ID-safe metadata updates
redacted LLM JSON error diagnostics (no conversation text leaked to logs)
time decay, access reinforcement, and scope-isolated compaction
memory tiers and global / agent / user / project scopes
canonical-memory compatibility for OpenClaw adapters
The standalone server keeps those capabilities independent from any one host application's lifecycle.
Deployment
Agent Memory is intended to run as a small private service. Common deployment targets:
local workstation
home server / NAS
private LAN or VPN
Coolify / Docker host
small cloud VM behind TLS and authentication
See docs/DEPLOY_COOLIFY.md for Coolify guidance.
Security default: the server listens on loopback unless configured otherwise. Non-loopback mode requires a Bearer token and explicit Host allowlisting.
Project status
Alpha / early community release. The shared-memory architecture and Claude Code β Codex interoperability have been proven, but the public project is still being separated into cleaner server/core/adapter packages.
Good areas for contributors right now:
more real-client acceptance tests
memory inspection / administration UI
stronger multi-user authentication and ACLs
backup / restore UX
observability and metrics
deployment templates
additional agent adapters
benchmark and memory-quality evaluation
See the full Roadmap.
What we want help with right now
You do not need to understand the memory engine to contribute. The highest-value community work today is concrete and testable:
Area | Good contribution |
Agent integrations | Verify Cursor/VS Code against a real server, or complete Gemini's model-authenticated agent-level acceptance path |
Operations | Improve backup/restore, diagnostics, metrics, Docker, NAS, or Coolify workflows |
Memory quality | Reproduce a bad recall/capture case with a small fixture and expected behavior |
Security | Improve client identity, ACLs, token rotation, and safe remote deployment |
UX | Prototype a small memory inspection/search/admin interface |
Docs | Make one setup path reproducible for someone who has never used the project |
Look for good first issue and help wanted, or start a Discussion before a larger design change.
Contributing
This project is intentionally being opened early. If the idea of a personal memory layer that survives agent switching is useful to you, there are several valuable ways to help:
β Star the project so other agent-tool users can find it
π§ͺ Test it with your agent stack and report what breaks
π Add an adapter or verified client recipe
π§ Improve memory quality, retrieval, or lifecycle behavior
π Improve authentication, tenancy, backup, or operations
π Fix docs where setup is confusing
Start with CONTRIBUTING.md. Small, focused pull requests are welcome.
Consistent contributors are also welcome to help with issue triage, client verification, documentation review, and roadmap shaping. The goal is to grow Agent Memory as a community-maintained interoperability layer, not a one-person integration dump.
Philosophy
One owner for memory. Agents are clients; the memory service is authoritative.
Automatic by default. Humans should not need to curate every memory manually.
Private first. Self-hosting and local-network deployment are first-class use cases.
Interoperable. MCP and REST are boundaries; no single agent vendor owns the data plane.
Useful forgetting matters. Long-term memory needs lifecycle management, not infinite accumulation.
No graph ceremony. A knowledge graph should not be required just to remember what matters.
License & provenance
Agent Memory is released under the MIT License.
The independent server, remote-client architecture, MCP integration, deployment work, and public project organization in this repository are maintained as Agent Memory. Portions of the underlying memory engine were adapted from the MIT-declared memory-lancedb-pro codebase. See THIRD_PARTY_NOTICES.md for provenance and attribution.
This repository is published as an independent project with its own history and release process; it is not a GitHub fork and does not depend on an upstream Git remote.
If you switch between AI agents, your memory shouldn't reset with the tool.
β Star Β· π Report Β· π§ Contribute Β· π§ Remember
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted memory for AI agents over MCP. One memory shared by all your agents.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Hosted agent memory: store, search, and recall facts across sessions from any MCP client.
Related MCP Servers
AlicenseNot gradedqualityBmaintenanceProvides AI agents and teams with self-hosted adaptive memory, combining hybrid search and a self-improving neural memory graph to enable precise recall and serendipitous discovery across MCP-compatible clients.15Apache 2.0- AlicenseNot gradedqualityBmaintenanceProvides a single self-hosted memory service that any AI assistant can write to and recall from over MCP or REST, storing episodic, semantic, procedural, reflective and session memories in one shared store. Enables agents to remember events as they happen and receive a ranked, token-budgeted brief of relevant history, counts, lessons and procedures before they act.2MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to store, search, and recall persistent project and cross-project memories locally over MCP, keeping architectural decisions, conventions, and error patterns available across sessions. Also optionally exposes a task server for autonomous task execution driven by that same memory store.-
- AlicenseAqualityBmaintenanceA self-hosted MCP memory server that gives every MCP-compatible agent a shared, persistent memory layer, so preferences, project conventions, and past decisions carry across sessions and across different agents and vendors. It combines hybrid keyword-plus-vector retrieval with automatic context injection, zero-config sync, and selective injection of memories by agent and priority.233MIT