Give Your AI Agents Persistent, Queryable Memory
Stop cramming entire knowledge bases into context.
Query specific memory on-demand with sub-millisecond latency.
Get Started · Documentation · MCP Tools
Every conversation, your AI agent starts from scratch. You copy-paste context, repeat instructions, and watch tokens burn. Knowledge gets lost between sessions.
┌─────────────────────────────────────────────────────────────────┐
│ │
│ Before: Load everything → 🔥 Token explosion │
│ │
│ After: Query what you need → ⚡ Sub-ms response │
│ │
└─────────────────────────────────────────────────────────────────┘
Agent Memory is an MCP server that gives AI agents persistent, structured memory. Instead of stuffing context, agents query specific knowledge on-demand.
Agent Memory is the high-speed memory layer for AI agents—persistent, permissioned, and enforceable—so your agents remember the right things, at the right time, without bloating context.
What makes it different:
One command. That's it.
npx agent-memory@latest mcp
Add to your MCP client config:
claude_desktop_config.jsonConfig file location:
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Linux | ~/.config/claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "agent-memory@latest", "mcp"]
}
}
}
.cursor/mcp.json{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "agent-memory@latest", "mcp"]
}
}
}
settings.json{
"mcp.servers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "agent-memory@latest", "mcp"]
}
}
}
Restart your client. Done.
┌─────────────────────────────────────┐
│ HIERARCHICAL SCOPES │
└─────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────┐
│ GLOBAL │
│ └── Security best practices, universal patterns │
│ │ │
│ ├── ORGANIZATION │
│ │ └── Team standards, shared tooling │
│ │ │ │
│ │ ├── PROJECT │
│ │ │ └── Architecture decisions, code style │
│ │ │ │ │
│ │ │ └── SESSION │
│ │ │ └── Current working context │
│ │ │ │
└──────┴───────┴───────────────────────────────────────────────┘
Queries inherit up the chain
| Type | Purpose | Example |
|---|---|---|
| 🔧 Tools | Command registry — CLI, APIs, scripts | {"name": "test-coverage", "command": "npm run test:cov"} |
| 📏 Guidelines | Rules & standards — code style, security | {"name": "no-any", "content": "Never use 'any' type"} |
| 💡 Knowledge | Facts & decisions — architecture, gotchas | {"title": "Auth", "content": "Using JWT with RS256"} |
Built for speed. SQLite WAL mode + intelligent caching.
| Operation | Throughput | p99 Latency |
|---|---|---|
| Simple query | 4.5M ops/sec | < 0.3ms |
| Scoped + inheritance | 3.6M ops/sec | < 0.4ms |
| Full-text search | 3.5M ops/sec | < 0.4ms |
| Semantic search | 3.1M ops/sec | < 0.5ms |
| Smart Search | Multi-Agent Ready | Production Grade |
|---|---|---|
| Semantic search (OpenAI/local) | File locking | Version history |
| Full-text search (FTS5) | Conflict detection | Query caching |
| Hybrid search | Per-agent permissions | Rate limiting |
Runtime enforcement via pre/post tool call checks. Hooks intercept MCP tool execution and validate against critical guidelines.
┌─────────────────────────────────────────────────────────────────┐
│ Agent tries to edit file │
│ ↓ │
│ PreToolUse hook fires → Checks critical guidelines │
│ ↓ │
│ Violation? → ❌ BLOCKED with explanation │
│ Clean? → ✅ Proceed with edit │
└─────────────────────────────────────────────────────────────────┘
| Hook | Trigger | Purpose |
|---|---|---|
| PreToolUse | Before Edit/Write/Bash | Block unsafe actions before execution |
| Stop | Session end attempt | Enforce memory review workflow |
| UserPromptSubmit | User sends message | Parse !am commands for session control |
| SessionEnd | Session terminates | Auto-ingest transcript to memory |
Install hooks for Claude Code:
npx agent-memory hook install --ide claude --project-path .
Agent guidelines for interacting with the MCP server. Rules teach AI assistants the memory workflow — synced directly to your IDE.
# Sync to Claude Code (writes to ~/.claude/CLAUDE.md)
npm run sync-rules -- --ide claude
# Sync to Cursor (writes .mdc files to .cursor/rules/)
npm run sync-rules -- --ide cursor
# Watch mode — auto-sync on changes
npm run sync-rules:watch
What gets synced:
| Rule File | Content |
|---|---|
auto-memory-core.md | Essential workflow (query → store → tag) |
auto-memory-reference.md | All 50 MCP tools with parameters |
auto-memory-examples.md | Real-world usage patterns |
auto-memory-strategies.md | Optimization and best practices |
# MCP Server (default) — Claude Desktop, Cursor, etc.
npx agent-memory mcp
# REST API — Custom integrations
AGENT_MEMORY_REST_ENABLED=true AGENT_MEMORY_REST_API_KEY=secret npx agent-memory rest
# Both simultaneously
AGENT_MEMORY_REST_ENABLED=true AGENT_MEMORY_REST_API_KEY=secret npx agent-memory both
| Endpoint | Description |
|---|---|
GET /health | Health check |
POST /v1/query | Search memory |
POST /v1/context | Get aggregated context |
# Where to store data (default: ~/.agent-memory for npm installs, ./data for development)
AGENT_MEMORY_DATA_DIR=~/.agent-memory
# Enable semantic search (optional)
AGENT_MEMORY_OPENAI_API_KEY=sk-...
# REST API (disabled by default)
AGENT_MEMORY_REST_ENABLED=true
AGENT_MEMORY_REST_API_KEY=your-secret
# Single-agent mode (skip permissions)
AGENT_MEMORY_PERMISSIONS_MODE=permissive
→ Full configuration reference
| Resource | Description |
|---|---|
| Quickstart | Get running in 2 minutes |
| First Workflow | Full setup guide |
| MCP Tools | All 50 tools documented |
| Hooks Guide | IDE hooks for enforcement |
| Rules Sync | Sync guidelines to IDEs |
| IDE Setup | Claude, Cursor, VS Code |
| Troubleshooting | Common issues |
| Feature | Status |
|---|---|
| macOS | ✅ Supported |
| Windows | 📝 Documented |
| Linux | 📝 Documented |
| Claude Code hooks | ✅ Supported |
| Cursor hooks | 🚧 In development |
| VS Code hooks | 🚧 In development |
| Other IDE hooks | 📋 Planned |
| Task manager (status, assignment, priorities) | 📋 Planned |
git clone https://github.com/anthropics/agent-memory.git
cd agent-memory
npm install
npm run build
npm run validate # lint + typecheck + tests
MIT — see LICENSE
Built for the AI-native era
TypeScript
99.2%
Give Your AI Agents Persistent, Queryable Memory
Stop cramming entire knowledge bases into context.
Query specific memory on-demand with sub-millisecond latency.
Get Started · Documentation · MCP Tools
Every conversation, your AI agent starts from scratch. You copy-paste context, repeat instructions, and watch tokens burn. Knowledge gets lost between sessions.
┌─────────────────────────────────────────────────────────────────┐
│ │
│ Before: Load everything → 🔥 Token explosion │
│ │
│ After: Query what you need → ⚡ Sub-ms response │
│ │
└─────────────────────────────────────────────────────────────────┘
Agent Memory is an MCP server that gives AI agents persistent, structured memory. Instead of stuffing context, agents query specific knowledge on-demand.
Agent Memory is the high-speed memory layer for AI agents—persistent, permissioned, and enforceable—so your agents remember the right things, at the right time, without bloating context.
What makes it different:
One command. That's it.
npx agent-memory@latest mcp
Add to your MCP client config:
claude_desktop_config.jsonConfig file location:
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Linux | ~/.config/claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "agent-memory@latest", "mcp"]
}
}
}
.cursor/mcp.json{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "agent-memory@latest", "mcp"]
}
}
}
settings.json{
"mcp.servers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "agent-memory@latest", "mcp"]
}
}
}
Restart your client. Done.
┌─────────────────────────────────────┐
│ HIERARCHICAL SCOPES │
└─────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────┐
│ GLOBAL │
│ └── Security best practices, universal patterns │
│ │ │
│ ├── ORGANIZATION │
│ │ └── Team standards, shared tooling │
│ │ │ │
│ │ ├── PROJECT │
│ │ │ └── Architecture decisions, code style │
│ │ │ │ │
│ │ │ └── SESSION │
│ │ │ └── Current working context │
│ │ │ │
└──────┴───────┴───────────────────────────────────────────────┘
Queries inherit up the chain
| Type | Purpose | Example |
|---|---|---|
| 🔧 Tools | Command registry — CLI, APIs, scripts | {"name": "test-coverage", "command": "npm run test:cov"} |
| 📏 Guidelines | Rules & standards — code style, security | {"name": "no-any", "content": "Never use 'any' type"} |
| 💡 Knowledge | Facts & decisions — architecture, gotchas | {"title": "Auth", "content": "Using JWT with RS256"} |
Built for speed. SQLite WAL mode + intelligent caching.
| Operation | Throughput | p99 Latency |
|---|---|---|
| Simple query | 4.5M ops/sec | < 0.3ms |
| Scoped + inheritance | 3.6M ops/sec | < 0.4ms |
| Full-text search | 3.5M ops/sec | < 0.4ms |
| Semantic search | 3.1M ops/sec | < 0.5ms |
| Smart Search | Multi-Agent Ready | Production Grade |
|---|---|---|
| Semantic search (OpenAI/local) | File locking | Version history |
| Full-text search (FTS5) | Conflict detection | Query caching |
| Hybrid search | Per-agent permissions | Rate limiting |
Runtime enforcement via pre/post tool call checks. Hooks intercept MCP tool execution and validate against critical guidelines.
┌─────────────────────────────────────────────────────────────────┐
│ Agent tries to edit file │
│ ↓ │
│ PreToolUse hook fires → Checks critical guidelines │
│ ↓ │
│ Violation? → ❌ BLOCKED with explanation │
│ Clean? → ✅ Proceed with edit │
└─────────────────────────────────────────────────────────────────┘
| Hook | Trigger | Purpose |
|---|---|---|
| PreToolUse | Before Edit/Write/Bash | Block unsafe actions before execution |
| Stop | Session end attempt | Enforce memory review workflow |
| UserPromptSubmit | User sends message | Parse !am commands for session control |
| SessionEnd | Session terminates | Auto-ingest transcript to memory |
Install hooks for Claude Code:
npx agent-memory hook install --ide claude --project-path .
Agent guidelines for interacting with the MCP server. Rules teach AI assistants the memory workflow — synced directly to your IDE.
# Sync to Claude Code (writes to ~/.claude/CLAUDE.md)
npm run sync-rules -- --ide claude
# Sync to Cursor (writes .mdc files to .cursor/rules/)
npm run sync-rules -- --ide cursor
# Watch mode — auto-sync on changes
npm run sync-rules:watch
What gets synced:
| Rule File | Content |
|---|---|
auto-memory-core.md | Essential workflow (query → store → tag) |
auto-memory-reference.md | All 50 MCP tools with parameters |
auto-memory-examples.md | Real-world usage patterns |
auto-memory-strategies.md | Optimization and best practices |
# MCP Server (default) — Claude Desktop, Cursor, etc.
npx agent-memory mcp
# REST API — Custom integrations
AGENT_MEMORY_REST_ENABLED=true AGENT_MEMORY_REST_API_KEY=secret npx agent-memory rest
# Both simultaneously
AGENT_MEMORY_REST_ENABLED=true AGENT_MEMORY_REST_API_KEY=secret npx agent-memory both
| Endpoint | Description |
|---|---|
GET /health | Health check |
POST /v1/query | Search memory |
POST /v1/context | Get aggregated context |
# Where to store data (default: ~/.agent-memory for npm installs, ./data for development)
AGENT_MEMORY_DATA_DIR=~/.agent-memory
# Enable semantic search (optional)
AGENT_MEMORY_OPENAI_API_KEY=sk-...
# REST API (disabled by default)
AGENT_MEMORY_REST_ENABLED=true
AGENT_MEMORY_REST_API_KEY=your-secret
# Single-agent mode (skip permissions)
AGENT_MEMORY_PERMISSIONS_MODE=permissive
→ Full configuration reference
| Resource | Description |
|---|---|
| Quickstart | Get running in 2 minutes |
| First Workflow | Full setup guide |
| MCP Tools | All 50 tools documented |
| Hooks Guide | IDE hooks for enforcement |
| Rules Sync | Sync guidelines to IDEs |
| IDE Setup | Claude, Cursor, VS Code |
| Troubleshooting | Common issues |
| Feature | Status |
|---|---|
| macOS | ✅ Supported |
| Windows | 📝 Documented |
| Linux | 📝 Documented |
| Claude Code hooks | ✅ Supported |
| Cursor hooks | 🚧 In development |
| VS Code hooks | 🚧 In development |
| Other IDE hooks | 📋 Planned |
| Task manager (status, assignment, priorities) | 📋 Planned |
git clone https://github.com/anthropics/agent-memory.git
cd agent-memory
npm install
npm run build
npm run validate # lint + typecheck + tests
MIT — see LICENSE
Built for the AI-native era
TypeScript
99.2%