agentmemory: give every coding agent a searchable memory that survives session restarts

agentmemory is a local MCP memory server that auto-captures everything your agent does — zero manual effort — and injects only the relevant context next session. Claude Code gets 12 hooks + 4 skills; Cursor, Cline, and 10+ others connect via MCP. At 240 observations, it uses ~1,900 tokens vs. 22,000+ for CLAUDE.md. Hit #1 GitHub Trending with 11K+ stars.

研究速览

You explain the same architecture every session. You re-discover the same bugs. You re-teach the same preferences. Built-in agent memory — CLAUDE.md, .cursorrules, Cursor notepads — caps out around 200 lines and dumps everything into context whether it's relevant or not. At 240 saved observations, that's 22,000+ tokens per session just for context overhead.
agentmemory fixes this by running a local memory server that silently captures what your agent does, compresses it into searchable memory, and injects only the relevant pieces when the next session starts. One command. Works across Claude Code, Cursor, Cline, Gemini CLI, Codex CLI, and 10+ other agents through a shared MCP server.1
The repo hit #1 GitHub Trending last week and has since climbed past 11,000 stars.2

What problem it actually solves

Every coding agent starts each session from scratch. Ask it to add rate limiting to an API and it doesn't know you built JWT auth yesterday, that you chose jose over jsonwebtoken for Edge compatibility, or that tests live in test/auth.test.ts. You spend the first five minutes re-explaining context.
CLAUDE.md and similar static files get around this partially, but they break down at scale: at 1,000 observations, 80% of entries never fit in a context window and become invisible. The file also requires manual curation — nothing auto-writes it based on actual session activity.
agentmemory replaces the static file with a running server. After Session 1 where you set up JWT auth, Session 2 starts with the agent already knowing your auth stack, your test conventions, and why you made each tradeoff. No copy-pasting. No re-explaining.1

Install in 30 seconds

Start the memory server (one terminal stays open):
npx @agentmemory/agentmemory
That's the full install for most users. Open http://localhost:3113 to watch memory build in real time.
Try the interactive demo first — it seeds three realistic sessions and shows semantic recall in action:
npx @agentmemory/agentmemory demo
Claude Code — paste this single block into Claude:
Install agentmemory: run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server. Then run `/plugin marketplace add rohitg00/agentmemory` and `/plugin install agentmemory` to register all 12 hooks, 4 skills, and 43 MCP tools. Verify with `curl http://localhost:3111/agentmemory/health`.
Cursor / Cline / Claude Desktop — add to your MCP config:
{
  "mcpServers": {
    "agentmemory": {
      "command": "npx",
      "args": ["-y", "agentmemory-mcp"]
    }
  }
}
Gemini CLI:
gemini mcp add agentmemory -- npx -y agentmemory-mcp
Free local embeddings (no API key, +8 percentage points recall over keyword-only search):
npm install @xenova/transformers
Windows note: the server needs the iii-engine runtime. Download iii-x86_64-pc-windows-msvc.zip from the iii-hq/iii releases page, extract iii.exe to your PATH, then run the npx command above. If you'd rather skip the binary, Docker Desktop works as a fallback — agentmemory auto-detects it.1
Prerequisite: Node.js ≥ 20.

Usage examples

Once the server is running, Claude Code exposes four skills you can call directly:
SkillWhat it does
/recall jwt authSemantic search across all past sessions — finds "N+1 query fix" when you type "database performance"
/remember "using jose over jsonwebtoken for Edge compatibility"Saves a durable fact to long-term memory
/session-historySummarizes recent sessions so you can orient quickly
/forgetDeletes specific observations or full sessions
For other agents using MCP, the same operations are available as memory_recall, memory_save, memory_smart_search, and memory_file_history tools — 43 MCP tools total, though the default install exposes only the 7 most useful ones. Set AGENTMEMORY_TOOLS=all in ~/.agentmemory/.env to unlock the full set.1
The passive capture is what makes it useful without any friction. Every tool use fires a hook, gets deduplicated, privacy-filtered (API keys and secrets are stripped), compressed into structured facts, and embedded for search — all without you doing anything.

How it compares to the alternatives

agentmemoryBuilt-in (CLAUDE.md)mem0 (53K ★)
Retrieval R@595.2%N/A (loads all)68.5%
Tokens at 240 observations~1,90022,000+Varies
Auto-capture12 hooks, zero effortManual editingManual add() calls
Cross-agentMCP + RESTPer-agent filesAPI only
Self-hostedYes (default)YesOptional
External dependenciesNone (SQLite + iii-engine)NoneQdrant / pgvector
Benchmarks are from the LongMemEval-S suite (ICLR 2025, 500 questions); the mem0 figure is from LoCoMo, a different benchmark, so the comparison is approximate rather than direct.1

What the community says — and where it falls short

Frank Fu, a product manager at Sider, wrote a thread after the repo's debut day that captured the reception well:
"The developers who figure out how to build great agent-native workflows — not just prompts, but real systems — are going to have a serious competitive advantage in the next 2–3 years."3
The ProductHunt listing describes the token savings claim — 92% fewer tokens on 240 real coding sessions — as its core pitch.4
The honest limitation comes from a Reddit thread where a team running a persistent GTM research agent discovered the flip side of persistent memory:
"Remembering everything can be as bad as forgetting everything. [...] It started over-weighting old objections, treating one enterprise prospect's complaint like a market trend."5
Their fix was splitting memory into durable facts (ICP, pricing, product limits), temporary context (active campaigns, messaging tests), and raw observations (tickets, calls). agentmemory v0.8.2 addresses this architecturally with 4-tier memory consolidation — Working → Episodic → Semantic → Procedural — plus TTL expiry, contradiction detection, and importance-based eviction. But the team's experience is a good reminder that auto-capture is a starting point, not a complete solution. Garbage in, garbage out still applies; you'll want to periodically run /forget to prune low-signal noise.

Skill metadata

  • Repo: github.com/rohitg00/agentmemory
  • NPM package: @agentmemory/agentmemory
  • Current version: v0.8.2
  • License: Apache-2.0
  • Stars: 11,000+
  • Agents supported: Claude Code, Cursor, Cline, Gemini CLI, Codex CLI, OpenCode, Windsurf, Roo Code, Goose, Kilo Code, Aider, Claude Desktop, and any MCP or REST client

围绕这条内容继续补充观点或上下文。

  • 登录后可发表评论。