If you hit an
EACCES permission error on macOS or Linux with a system Node install, retry with sudo npm install -g @agentmemory/agentmemory.If you prefer not to install globally, you can use
npx for every command instead. Add -y and @latest to always get the newest version:A bare
npx @agentmemory/agentmemory without @latest may serve a cached older version from ~/.npm/_npx/. Always use @latest with npx, or install globally to avoid stale releases.This creates
~/.agentmemory/.env with every available setting commented out. You do not need to edit this file to get started — Agent Memory runs in zero-LLM mode out of the box.Open
~/.agentmemory/.env in any editor and uncomment one provider key. Agent Memory auto-detects which key is present:# ~/.agentmemory/.env
# Pick one:
ANTHROPIC_API_KEY=sk-ant-...
# OPENAI_API_KEY=sk-...
# GEMINI_API_KEY=...
# OPENROUTER_API_KEY=sk-or-...
No key required. Without an LLM key, Agent Memory still captures observations, indexes them via BM25 keyword search, and recalls context using local embeddings (
all-MiniLM-L6-v2 runs on-device). You only miss LLM-backed summarization and knowledge graph extraction. Most users get valuable recall without a key.# ~/.agentmemory/.env — Ollama example
OPENAI_API_KEY=ollama
OPENAI_BASE_URL=http://localhost:11434/v1
OPENAI_MODEL=qwen2.5-coder:7b
http://localhost:3113 in your browser to watch memories build liveOn the first run, Agent Memory downloads and pins the
iii engine binary into ~/.agentmemory/bin. This takes a few seconds and only happens once. You will see a health confirmation when the server is ready:agentmemory v0.9.x ready
REST API → http://localhost:3111
Viewer → http://localhost:3113
Tools → 53 MCP tools available
Use the
agentmemory connect CLI command to wire Agent Memory into your agent’s MCP config automatically. The command merges the MCP server entry into your agent’s config file without overwriting any existing servers. Claude Code
Cursor
~/.cursor/mcp.json. Restart Cursor after running the command. Other agents
Replace Supported agents:
<agent> with your agent name:claude-code, cursor, copilot-cli, codex, gemini-cli, cline, zed, warp, continue, openclaw, hermes, pi, openhuman, droid, kiro, qwen, antigravitySee Connect Agents for per-agent instructions.After connecting, restart your agent (or run its MCP reload command, e.g.
/mcp in Claude Code) so it picks up the new server. You should see memory_save, memory_smart_search, memory_sessions, and other tools listed.● agentmemory running (pid 12345)
Version 0.9.x
Uptime 2m 14s
REST API http://localhost:3111 ✓ reachable
Viewer http://localhost:3113 ✓ reachable
Memory
Sessions 3 sessions captured
Memories 47 memories stored
Tokens ~1,840 tokens/session (est.)
Connected agents
claude-code ✓ wired (MCP + 12 hooks)
If the server is not reachable, or tools are not showing up in your agent, run
agentmemory doctor — it checks your full setup and suggests fixes.The demo seeds three real-world coding sessions — JWT authentication setup, an N+1 database query fix, and rate limiting middleware — then runs semantic searches against them. Watch it find the “N+1 query fix” session when you search for
"database performance optimization". Keyword matching cannot make that connection. Semantic search can.If you want to run the demo without having the server already running in another terminal, use
--serve:What happens next
From this point on, Agent Memory works automatically in the background. Every time your agent reads a file, runs a command, writes code, or hits an error, Agent Memory captures that as an observation. At the end of each session, it compresses those observations into searchable memories. At the start of the next session, it injects the most relevant context so your agent already knows your project. You do not need to change how you work.Other useful commands
Once the server is running, you have a few more commands at your disposal:agentmemory stop when you want to pause memory capture and free up ports. Use agentmemory remove if you ever want to start fresh — it prompts for confirmation before deleting anything. Use agentmemory upgrade to pull the latest release without reinstalling manually.
Troubleshooting: Run
agentmemory doctor at any time for interactive diagnostics. It checks the server, engine, MCP wiring, port availability, and your config file, then suggests specific fixes. It is the fastest path to resolving any setup issue.