freshcrate
Skin:/
Home > RAG & Memory > agentmemory

agentmemory

Persistent memory for AI coding agents

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

Persistent memory for AI coding agents

README

agentmemory โ€” Persistent memory for AI coding agents

Your coding agent remembers everything. No more re-explaining.
Persistent memory for Claude Code, Cursor, Gemini CLI, OpenCode, and any MCP client.

Design doc: 825 stars / 110 forks on the gist The gist extends Karpathy's LLM Wiki pattern with confidence scoring, lifecycle, knowledge graphs, and hybrid search.
agentmemory is the implementation.

npm versionCILicenseStars 95.2% retrieval R@5 92% fewer tokens 51 MCP tools 12 auto hooks 0 external DBs 654 tests passing

agentmemory demo

Quick Start โ€ข Benchmarks โ€ข vs Competitors โ€ข Agents โ€ข How It Works โ€ข MCP โ€ข Viewer โ€ข iii Console โ€ข Config โ€ข API


Works with every agent

agentmemory works with any agent that supports hooks, MCP, or REST API. All agents share the same memory server.

Claude Code
Claude Code
12 hooks + MCP + skills
OpenClaw
OpenClaw
MCP + plugin
Hermes
Hermes
MCP + plugin
Cursor
Cursor
MCP server
Gemini CLI
Gemini CLI
MCP server
OpenCode
OpenCode
MCP server
Codex CLI
Codex CLI
MCP server
Cline
Cline
MCP server
Goose
Goose
MCP server
Kilo Code
Kilo Code
MCP server
Aider
Aider
REST API
Claude Desktop
Claude Desktop
MCP server
Windsurf
Windsurf
MCP server
Roo Code
Roo Code
MCP server
Claude SDK
Claude SDK
AgentSDKProvider
REST API Works with any agent that speaks MCP or HTTP. One server, memories shared across all of them.


You explain the same architecture every session. You re-discover the same bugs. You re-teach the same preferences. Built-in memory (CLAUDE.md, .cursorrules) caps out at 200 lines and goes stale. agentmemory fixes this. It silently captures what your agent does, compresses it into searchable memory, and injects the right context when the next session starts. One command. Works across agents.

What changes: Session 1 you set up JWT auth. Session 2 you ask for rate limiting. The agent already knows your auth uses jose middleware in src/middleware/auth.ts, your tests cover token validation, and you chose jose over jsonwebtoken for Edge compatibility. No re-explaining. No copy-pasting. The agent just knows.

npx @agentmemory/agentmemory

New in v0.9.0 โ€” Landing site at agent-memory.dev, filesystem connector (@agentmemory/fs-watcher), standalone MCP now proxies to the running server so hooks and the viewer agree, audit policy codified across every delete path, health stops flagging memory_critical on tiny Node processes. Full notes in CHANGELOG.md.


Benchmarks

Retrieval Accuracy

LongMemEval-S (ICLR 2025, 500 questions)

System R@5 R@10 MRR
agentmemory 95.2% 98.6% 88.2%
BM25-only fallback 86.2% 94.6% 71.5%

Token Savings

Approach Tokens/yr Cost/yr
Paste full context 19.5M+ Impossible (exceeds window)
LLM-summarized ~650K ~$500
agentmemory ~170K ~$10
agentmemory + local embeddings ~170K $0

Embedding model: all-MiniLM-L6-v2 (local, free, no API key). Full reports: benchmark/LONGMEMEVAL.md, benchmark/QUALITY.md, benchmark/SCALE.md. Competitor comparison: benchmark/COMPARISON.md โ€” agentmemory vs mem0, Letta, Khoj, claude-mem, Hippo.


vs Competitors

agentmemory mem0 (53K โญ) Letta / MemGPT (22K โญ) Built-in (CLAUDE.md)
Type Memory engine + MCP server Memory layer API Full agent runtime Static file
Retrieval R@5 95.2% 68.5% (LoCoMo) 83.2% (LoCoMo) N/A (grep)
Auto-capture 12 hooks (zero manual effort) Manual add() calls Agent self-edits Manual editing
Search BM25 + Vector + Graph (RRF fusion) Vector + Graph Vector (archival) Loads everything into context
Multi-agent MCP + REST + leases + signals API (no coordination) Within Letta runtime only Per-agent files
Framework lock-in None (any MCP client) None High (must use Letta) Per-agent format
External deps None (SQLite + iii-engine) Qdrant / pgvector Postgres + vector DB None
Memory lifecycle 4-tier consolidation + decay + auto-forget Passive extraction Agent-managed Manual pruning
Token efficiency ~1,900 tokens/session ($10/yr) Varies by integration Core memory in context 22K+ tokens at 240 obs
Real-time viewer Yes (port 3113) Cloud dashboard Cloud dashboard No
Self-hosted Yes (default) Optional Optional Yes

Quick Start

Compatibility: this release targets stable iii-sdk ^0.11.0 and iii-engine v0.11.x.

Try it in 30 seconds

# Terminal 1: start the server
npx @agentmemory/agentmemory

# Terminal 2: seed sample data and see recall in action
npx @agentmemory/agentmemory demo

demo seeds 3 realistic sessions (JWT auth, N+1 query fix, rate limiting) and runs semantic searches against them. You'll see it find "N+1 query fix" when you search "database performance optimization" โ€” keyword matching can't do that.

Open http://localhost:3113 to watch the memory build live.

Session Replay

Every session agentmemory records is replayable. Open the viewer, pick the Replay tab, and scrub through the timeline: prompts, tool calls, tool results, and responses render as discrete events with play/pause, speed control (0.5ร—โ€“4ร—), and keyboard shortcuts (space to toggle, arrows to step).

Already have older Claude Code JSONL transcripts you want to bring in?

# Import everything under the default ~/.claude/projects
npx @agentmemory/agentmemory import-jsonl

# Or import a single file
npx @agentmemory/agentmemory import-jsonl ~/.claude/projects/-my-project/abc123.jsonl

Imported sessions show up in the Replay picker alongside native ones. Under the hood each entry routes through the mem::replay::load, mem::replay::sessions, and mem::replay::import-jsonl iii functions โ€” no side-channel servers.

Upgrade / Maintenance

Use the maintenance command when you intentionally want to update your local runtime:

npx @agentmemory/agentmemory upgrade

Warning: this command mutates the current workspace/runtime. It can update JavaScript dependencies, may run cargo install iii-engine --force, and may pull Docker images.

Implementation details live in src/cli.ts (see runUpgrade around the src/cli.ts:544-595 region).

Claude Code (one block, paste it)

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` โ€” the plugin registers all 12 hooks, 4 skills, AND auto-wires the `@agentmemory/mcp` stdio server via its `.mcp.json`, so you get 51 MCP tools (memory_smart_search, memory_save, memory_sessions, memory_governance_delete, etc.) without any extra config step. Verify with `curl http://localhost:3111/agentmemory/health`. The real-time viewer is at http://localhost:3113.
OpenClaw (paste this prompt)
Install agentmemory for OpenClaw. Run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server on localhost:3111. Then add this to my OpenClaw MCP config so agentmemory is available with all 50 memory tools:

{
  "mcpServers": {
    "agentmemory": {
      "command": "npx",
      "args": ["-y", "@agentmemory/mcp"]
    }
  }
}

Restart OpenClaw. Verify with `curl http://localhost:3111/agentmemory/health`. Open http://localhost:3113 for the real-time viewer. For deeper 4-hook gateway integration, see integrations/openclaw in the agentmemory repo.

Full guide: integrations/openclaw/

Hermes Agent (paste this prompt)
Install agentmemory for Hermes. Run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server on localhost:3111. Then add this to ~/.hermes/config.yaml so Hermes can use agentmemory as an MCP server with all 50 memory tools:

mcp_servers:
  agentmemory:
    command: npx
    args: ["-y", "@agentmemory/mcp"]

Verify with `curl http://localhost:3111/agentmemory/health`. Open http://localhost:3113 for the real-time viewer. For deeper 6-hook memory provider integration (pre-LLM context injection, turn capture, MEMORY.md mirroring, system prompt block), copy integrations/hermes from the agentmemory repo to ~/.hermes/plugins/memory/agentmemory.

Full guide: integrations/hermes/

Other agents

Start the memory server: npx @agentmemory/agentmemory

Then add the MCP config for your agent:

Agent Setup
Cursor Add to ~/.cursor/mcp.json: {"mcpServers": {"agentmemory": {"command": "npx", "args": ["-y", "@agentmemory/mcp"]}}}
OpenClaw Add to MCP config: {"mcpServers": {"agentmemory": {"command": "npx", "args": ["-y", "@agentmemory/mcp"]}}} or use the gateway plugin
Gemini CLI gemini mcp add agentmemory -- npx -y @agentmemory/mcp
Codex CLI Add to .codex/config.yaml: mcp_servers: {agentmemory: {command: npx, args: ["-y", "@agentmemory/mcp"]}}
OpenCode Add to opencode.json: {"mcp": {"agentmemory": {"type": "local", "command": ["npx", "-y", "@agentmemory/mcp"], "enabled": true}}}
Hermes Agent Add to ~/.hermes/config.yaml or use the memory provider plugin
Cline / Goose / Kilo Code Add MCP server in settings
Claude Desktop Add to claude_desktop_config.json: {"mcpServers": {"agentmemory": {"command": "npx", "args": ["-y", "@agentmemory/mcp"]}}}
Aider REST API: curl -X POST http://localhost:3111/agentmemory/smart-search -d '{"query": "auth"}'
Any agent (32+) npx skillkit install agentmemory

From source

git clone https://github.com/rohitg00/agentmemory.git && cd agentmemory
npm install && npm run build && npm start

This starts agentmemory with a local iii-engine if iii is already installed, or falls back to Docker Compose if Docker is available. REST, streams, and the viewer bind to 127.0.0.1 by default.

Install iii-engine manually:

  • macOS / Linux: curl -fsSL https://install.iii.dev/iii/main/install.sh | sh
  • Windows: download iii-x86_64-pc-windows-msvc.zip from iii-hq/iii releases, extract iii.exe, add to PATH

Or use Docker (the bundled docker-compose.yml pulls iiidev/iii:latest). Full docs: iii.dev/docs.

Windows

agentmemory runs on Windows 10/11, but the Node.js package alone isn't enough โ€” you also need the iii-engine runtime (a separate native binary) as a background process. The official upstream installer is a sh script and there is no PowerShell installer or scoop/winget package today, so Windows users have two paths:

Option A โ€” Prebuilt Windows binary (recommended):

# 1. Open https://github.com/iii-hq/iii/releases/latest in your browser
# 2. Download iii-x86_64-pc-windows-msvc.zip
#    (or iii-aarch64-pc-windows-msvc.zip if you're on an ARM machine)
# 3. Extract iii.exe somewhere on PATH, or place it at:
#    %USERPROFILE%\.local\bin\iii.exe
#    (agentmemory checks that location automatically)
# 4. Verify:
iii --version

# 5. Then run agentmemory as usual:
npx -y @agentmemory/agentmemory

Option B โ€” Docker Desktop:

# 1. Install Docker Desktop for Windows
# 2. Start Docker Desktop and make sure the engine is running
# 3. Run agentmemory โ€” it will auto-start the bundled compose file:
npx -y @agentmemory/agentmemory

Option C โ€” standalone MCP only (no engine): if you only need the MCP tools for your agent and don't need the REST API, viewer, or cron jobs, skip the engine entirely:

npx -y @agentmemory/agentmemory mcp
# or via the shim package:
npx -y @agentmemory/mcp

Diagnostics for Windows: if npx @agentmemory/agentmemory fails, re-run with --verbose to see the actual engine stderr. Common failure modes:

Symptom Fix
iii-engine process started then did not become ready within 15s Engine crashed on startup โ€” re-run with --verbose, check stderr
Could not start iii-engine Neither iii.exe nor Docker is installed. See Option A or B above
Port conflict netstat -ano | findstr :3111 to see what's bound, then kill it or use --port <N>
Docker fallback skipped even though Docker is installed Make sure Docker Desktop is actually running (system tray icon)

Note: there is no cargo install iii-engine โ€” iii is not published to crates.io. The only supported install methods are the prebuilt binary above, the upstream sh install script (macOS/Linux only), and the Docker image.


Why agentmemory

Every coding agent forgets everything when the session ends. You waste the first 5 minutes of every session re-explaining your stack. agentmemory runs in the background and eliminates that entirely.

Session 1: "Add auth to the API"
  Agent writes code, runs tests, fixes bugs
  agentmemory silently captures every tool use
  Session ends -> observations compressed into structured memory

Session 2: "Now add rate limiting"
  Agent already knows:
    - Auth uses JWT middleware in src/middleware/auth.ts
    - Tests in test/auth.test.ts cover token validation
    - You chose jose over jsonwebtoken for Edge compatibility
  Zero re-explaining. Starts working immediately.

vs built-in agent memory

Every AI coding agent ships with built-in memory โ€” Claude Code has MEMORY.md, Cursor has notepads, Cline has memory bank. These work like sticky notes. agentmemory is the searchable database behind the sticky notes.

Built-in (CLAUDE.md) agentmemory
Scale 200-line cap Unlimited
Search Loads everything into context BM25 + vector + graph (top-K only)
Token cost 22K+ at 240 observations ~1,900 tokens (92% less)
Cross-agent Per-agent files MCP + REST (any agent)
Coordination None Leases, signals, actions, routines
Observability Read files manually Real-time viewer on :3113

How It Works

Memory Pipeline

PostToolUse hook fires
  -> SHA-256 dedup (5min window)
  -> Privacy filter (strip secrets, API keys)
  -> Store raw observation
  -> LLM compress -> structured facts + concepts + narrative
  -> Vector embedding (6 providers + local)
  -> Index in BM25 + vector + knowledge graph

SessionStart hook fires
  -> Load project profile (top concepts, files, patterns)
  -> Hybrid search (BM25 + vector + graph)
  -> Token budget (default: 2000 tokens)
  -> Inject into conversation

4-Tier Memory Consolidation

Inspired by how human brains process memory โ€” not unlike sleep consolidation.

Tier What Analogy
Working Raw observations from tool use Short-term memory
Episodic Compressed session summaries "What happened"
Semantic Extracted facts and patterns "What I know"
Procedural Workflows and decision patterns "How to do it"

Memories decay over time (Ebbinghaus curve). Frequently accessed memories strengthen. Stale memories auto-evict. Contradictions are detected and resolved.

What Gets Captured

Hook Captures
SessionStart Project path, session ID
UserPromptSubmit User prompts (privacy-filtered)
PreToolUse File access patterns + enriched context
PostToolUse Tool name, input, output
PostToolUseFailure Error context
PreCompact Re-injects memory before compaction
SubagentStart/Stop Sub-agent lifecycle
Stop End-of-session summary
SessionEnd Session complete marker

Key Capabilities

Capability Description
Automatic capture Every tool use recorded via hooks โ€” zero manual effort
Semantic search BM25 + vector + knowledge graph with RRF fusion
Memory evolution Versioning, supersession, relationship graphs
Auto-forgetting TTL expiry, contradiction detection, importance eviction
Privacy first API keys, secrets, <private> tags stripped before storage
Self-healing Circuit breaker, provider fallback chain, health monitoring
Claude bridge Bi-directional sync with MEMORY.md
Knowledge graph Entity extraction + BFS traversal
Team memory Namespaced shared + private across team members
Citation provenance Trace any memory back to source observations
Git snapshots Version, rollback, and diff memory state

Triple-stream retrieval combining three signals:

Stream What it does When
BM25 Stemmed keyword matching with synonym expansion Always on
Vector Cosine similarity over dense embeddings Embedding provider configured
Graph Knowledge graph traversal via entity matching Entities detected in query

Fused with Reciprocal Rank Fusion (RRF, k=60) and session-diversified (max 3 results per session).

Embedding providers

agentmemory auto-detects your provider. For best results, install local embeddings (free):

npm install @xenova/transformers
Provider Model Cost Notes
Local (recommended) all-MiniLM-L6-v2 Free Offline, +8pp recall over BM25-only
Gemini text-embedding-004 Free tier 1500 RPM
OpenAI text-embedding-3-small $0.02/1M Highest quality
Voyage AI voyage-code-3 Paid Optimized for code
Cohere embed-english-v3.0 Free trial General purpose
OpenRouter Any model Varies Multi-model proxy

MCP Server

51 tools, 6 resources, 3 prompts, and 4 skills โ€” the most comprehensive MCP memory toolkit for any agent.

50 Tools

Core tools (always available)
Tool Description
memory_recall Search past observations
memory_compress_file Compress markdown files while preserving structure
memory_save Save an insight, decision, or pattern
memory_patterns Detect recurring patterns
memory_smart_search Hybrid semantic + keyword search
memory_file_history Past observations about specific files
memory_sessions List recent sessions
memory_timeline Chronological observations
memory_profile Project profile (concepts, files, patterns)
memory_export Export all memory data
memory_relations Query relationship graph
Extended tools (50 total โ€” set AGENTMEMORY_TOOLS=all)
Tool Description
memory_patterns Detect recurring patterns
memory_timeline Chronological observations
memory_relations Query relationship graph
memory_graph_query Knowledge graph traversal
memory_consolidate Run 4-tier consolidation
memory_claude_bridge_sync Sync with MEMORY.md
memory_team_share Share with team members
memory_team_feed Recent shared items
memory_audit Audit trail of operations
memory_governance_delete Delete with audit trail
memory_snapshot_create Git-versioned snapshot
memory_action_create Create work items with dependencies
memory_action_update Update action status
memory_frontier Unblocked actions ranked by priority
memory_next Single most important next action
memory_lease Exclusive action leases (multi-agent)
memory_routine_run Instantiate workflow routines
memory_signal_send Inter-agent messaging
memory_signal_read Read messages with receipts
memory_checkpoint External condition gates
memory_mesh_sync P2P sync between instances
memory_sentinel_create Event-driven watchers
memory_sentinel_trigger Fire sentinels externally
memory_sketch_create Ephemeral action graphs
memory_sketch_promote Promote to permanent
memory_crystallize Compact action chains
memory_diagnose Health checks
memory_heal Auto-fix stuck state
memory_facet_tag Dimension:value tags
memory_facet_query Query by facet tags
memory_verify Trace provenance

6 Resources ยท 3 Prompts ยท 4 Skills

Type Name Description
Resource agentmemory://status Health, session count, memory count
Resource agentmemory://project/{name}/profile Per-project intelligence
Resource agentmemory://memories/latest Latest 10 active memories
Resource agentmemory://graph/stats Knowledge graph statistics
Prompt recall_context Search + return context messages
Prompt session_handoff Handoff data between agents
Prompt detect_patterns Analyze recurring patterns
Skill /recall Search memory
Skill /remember Save to long-term memory
Skill /session-history Recent session summaries
Skill /forget Delete observations/sessions

Standalone MCP

Run without the full server โ€” for any MCP client. Either of these works:

npx -y @agentmemory/agentmemory mcp   # canonical (always available)
npx -y @agentmemory/mcp                # shim package alias

Or add to your agent's MCP config:

Most agents (Cursor, Claude Desktop, Cline, etc.):

{
  "mcpServers": {
    "agentmemory": {
      "command": "npx",
      "args": ["-y", "@agentmemory/mcp"]
    }
  }
}

OpenCode (opencode.json):

{
  "mcp": {
    "agentmemory": {
      "type": "local",
      "command": ["npx", "-y", "@agentmemory/mcp"],
      "enabled": true
    }
  }
}

Real-Time Viewer

Auto-starts on port 3113. Live observation stream, session explorer, memory browser, knowledge graph visualization, and health dashboard.

open http://localhost:3113

The viewer server binds to 127.0.0.1 by default. The REST-served /agentmemory/viewer endpoint follows the normal AGENTMEMORY_SECRET bearer-token rules. CSP headers use a per-response script nonce and disable inline handler attributes (script-src-attr 'none').

iii console โ€” trace-level engine inspection

agentmemory runs on the iii engine, so the official iii console gives you OpenTelemetry traces, the raw key/value state store, the stream monitor, and a direct function invoker for every piece of memory machinery. Use it to watch a memory.search call hit BM25 โ†’ embeddings โ†’ reranker in real time, replay a hook invocation, or poke individual functions without going through MCP.

iii console dashboard โ€” system counters, application flow, registered triggers, live WebSocket status
Dashboard: functions, triggers, workers, streams, live flow graph. Screenshot from iii.dev/docs/console.

Install once:

curl -fsSL https://install.iii.dev/console/main/install.sh | sh

Launch alongside agentmemory:

# The agentmemory viewer already holds port 3113, so run the console on 3114.
iii-console --port 3114 --engine-port 3111 --ws-port 3112

Then open http://localhost:3114.

What you can do from the console:

Page Use it to
Functions Invoke any of agentmemory's ~33 functions directly with a JSON payload โ€” handy for testing memory.recall, memory.consolidate, graph.query without wiring a client.
Triggers Replay HTTP triggers (the agentmemory REST endpoints), fire the consolidation cron manually, or emit queue events.
States Browse the KV store โ€” sessions, memory slots, lifecycle timers, embeddings index โ€” and edit values in place.
Streams Watch live memory writes, hook events, and observation updates as they flow through iii's WebSocket stream.
Traces OpenTelemetry waterfall / flame / service-breakdown views. Filter by trace_id to see exactly which functions, DB calls, and embedding requests a single memory.search produced.
Logs Structured OTEL logs correlated to trace/span IDs.

iii console trace waterfall view showing per-span duration
Traces: waterfall / flame / service breakdown for every memory operation.

Traces are already on:

iii-config.yaml ships with the iii-observability worker enabled (exporter: memory, sampling_ratio: 1.0, metrics + logs). No extra config needed โ€” the moment agentmemory starts, every memory operation emits a trace span and a structured log the console can read.

If you want to export to Jaeger/Honeycomb/Grafana Tempo instead, change exporter: memory to exporter: otlp and set the collector endpoint per iii's observability docs.

Heads-up: no auth is enforced on the console itself โ€” keep it bound to 127.0.0.1 (the default) and never expose it publicly.


Configuration

LLM Providers

agentmemory auto-detects from your environment. No API key needed if you have a Claude subscription.

Provider Config Notes
Claude subscription (default) No config needed Uses @anthropic-ai/claude-agent-sdk
Anthropic API ANTHROPIC_API_KEY Per-token billing
MiniMax MINIMAX_API_KEY Anthropic-compatible
Gemini GEMINI_API_KEY Also enables embeddings
OpenRouter OPENROUTER_API_KEY Any model

Environment Variables

Create ~/.agentmemory/.env:

# LLM provider (pick one, or leave empty for Claude subscription)
# ANTHROPIC_API_KEY=sk-ant-...
# GEMINI_API_KEY=...
# OPENROUTER_API_KEY=...

# Embedding provider (auto-detected, or override)
# EMBEDDING_PROVIDER=local
# VOYAGE_API_KEY=...

# Search tuning
# BM25_WEIGHT=0.4
# VECTOR_WEIGHT=0.6
# TOKEN_BUDGET=2000

# Auth
# AGENTMEMORY_SECRET=your-secret

# Ports (defaults: 3111 API, 3113 viewer)
# III_REST_PORT=3111

# Features
# AGENTMEMORY_AUTO_COMPRESS=false  # OFF by default (#138). When on,
                                   # every PostToolUse hook calls your
                                   # LLM provider to compress the
                                   # observation โ€” expect significant
                                   # token spend on active sessions.
# AGENTMEMORY_SLOTS=false          # OFF by default. Editable pinned
                                   # memory slots โ€” persona,
                                   # user_preferences, tool_guidelines,
                                   # project_context, guidance,
                                   # pending_items, session_patterns,
                                   # self_notes. Size-limited; agent
                                   # edits via memory_slot_* tools.
                                   # Pinned slots addressable for
                                   # SessionStart injection.
# AGENTMEMORY_REFLECT=false        # OFF by default. Requires SLOTS=on.
                                   # Stop hook fires mem::slot-reflect:
                                   # scans recent observations, auto-
                                   # appends TODOs to pending_items,
                                   # counts patterns in
                                   # session_patterns, records touched
                                   # files in project_context. Fire-
                                   # and-forget; does not block.
# AGENTMEMORY_INJECT_CONTEXT=false # OFF by default (#143). When on:
                                   # - SessionStart may inject ~1-2K
                                   #   chars of project context into
                                   #   the first turn of each session
                                   #   (this is what actually reaches
                                   #   the model โ€” Claude Code treats
                                   #   SessionStart stdout as context)
                                   # - PreToolUse fires /agentmemory/enrich
                                   #   on every file-touching tool call
                                   #   (resource cleanup, not a token
                                   #   fix โ€” PreToolUse stdout is debug
                                   #   log only per Claude Code docs)
                                   # Observations are still captured via
                                   # PostToolUse regardless of this flag.
# GRAPH_EXTRACTION_ENABLED=false
# CONSOLIDATION_ENABLED=true
# LESSON_DECAY_ENABLED=true
# OBSIDIAN_AUTO_EXPORT=false
# AGENTMEMORY_EXPORT_ROOT=~/.agentmemory
# CLAUDE_MEMORY_BRIDGE=false
# SNAPSHOT_ENABLED=false

# Team
# TEAM_ID=
# USER_ID=
# TEAM_MODE=private

# Tool visibility: "core" (8 tools) or "all" (51 tools)
# AGENTMEMORY_TOOLS=core

API

107 endpoints on port 3111. The REST API binds to 127.0.0.1 by default. Protected endpoints require Authorization: Bearer <secret> when AGENTMEMORY_SECRET is set, and mesh sync endpoints require AGENTMEMORY_SECRET on both peers.

Key endpoints
Method Path Description
GET /agentmemory/health Health check (always public)
POST /agentmemory/session/start Start session + get context
POST /agentmemory/session/end End session
POST /agentmemory/observe Capture observation
POST /agentmemory/smart-search Hybrid search
POST /agentmemory/context Generate context
POST /agentmemory/remember Save to long-term memory
POST /agentmemory/forget Delete observations
POST /agentmemory/enrich File context + memories + bugs
GET /agentmemory/profile Project profile
GET /agentmemory/export Export all data
POST /agentmemory/import Import from JSON
POST /agentmemory/graph/query Knowledge graph query
POST /agentmemory/team/share Share with team
GET /agentmemory/audit Audit trail

Full endpoint list: src/triggers/api.ts


Architecture

Built on iii-engine's three primitives โ€” no Express, no Postgres, no Redis.

118 source files ยท ~21,800 LOC ยท 800 tests ยท 123 functions ยท 34 KV scopes

What iii-engine replaces
Traditional stack agentmemory uses
Express.js / Fastify iii HTTP Triggers
SQLite / Postgres + pgvector iii KV State + in-memory vector index
SSE / Socket.io iii Streams (WebSocket)
pm2 / systemd iii-engine worker management
Prometheus / Grafana iii OTEL + health monitor

Development

npm run dev               # Hot reload
npm run build             # Production build
npm test                  # 800 tests (~1.7s)
npm run test:integration  # API tests (requires running services)

Prerequisites: Node.js >= 20, iii-engine or Docker

License

Apache-2.0

Release History

VersionChangesUrgencyDate
v0.9.26Hotfix on top of v0.9.25. Closes [#797](https://github.com/rohitg00/agentmemory/issues/797). ## Fixed - **First boot crash: `TypeError: Cannot read properties of undefined (reading 'v')`** (#797). The sharded index load path checked `manifest.value !== null` before forwarding, but some iii-state adapters return `undefined` (not `null`) for a missing key. `loadManifestData(undefined)` then crashed on `undefined.v`. Now treats both null + undefined + non-object values as 'no manifest' and falls High6/3/2026
v0.9.22 Stability + ecosystem wave. Three install-broken bugs (`npm install` ERESOLVE, non-OpenAI base URLs, broken Claude bridge path) closed. Six runtime bugs from active users fixed end-to-end. Three new agent integrations (Qwen Code, Antigravity, Kiro). New `AGENT_ID` scope for multi-agent setups. Port mapping documented. ### Fixed - **`npm install` ERESOLVE on fresh install** ([PR #649](https://github.com/rohitg00/agentmemory/pull/649), closes [#631](https://github.com/rohitg00/agentmemory/issueHigh5/26/2026
v0.9.21## [0.9.21] โ€” 2026-05-19 Quality + integration wave. Headline: native OpenCode plugin with full Claude Code hook parity ([#237](https://github.com/rohitg00/agentmemory/pull/237) by [@cl0ckt0wer](https://github.com/cl0ckt0wer)). Ten more PRs alongside: `memory_recall` returning the wrong shape, env-file `AGENTMEMORY_DROP_STALE_INDEX` silently ignored, hook scripts crashing on Windows usernames with spaces, viewer search inputs interrupting CJK IME composition, large sessions silently failing at High5/19/2026
v0.9.16Two waves: (1) DevEx polish on top of v0.9.15 โ€” 5-port ready panel, iii console install, interactive global-install prompt, onboarding now actually wires the agents you select, MCP reworded as opt-in. (2) Marketing site refresh โ€” new AS FEATURED IN bar (AlphaSignal ยท Agentic AI Foundation ยท Trendshift) + Agents/Compare/CommandCenter/Hero updated for the v0.9.15 surface. ## Added - **5-port ready panel** (#410). Single clack note replaces the old single-line ready hint. Lists REST / Viewer / StHigh5/15/2026
v0.9.5 Bug-fix patch focused on **search recall correctness** and **plugin compatibility**. Pins `iii-engine` to v0.11.2 because v0.11.6 introduces a new sandbox-everything-via-`iii worker add` model that agentmemory hasn't been refactored for yet โ€” pin lifts once that refactor lands. Adds a hard guard against silent vector-index corruption, fixes BM25 indexing for memories saved via `memory_save`, and lands four Hermes plugin fixes that make the memory provider actually usable end-to-end. If you've High5/9/2026
v0.9.4Bug-fix patch. Fixes a silent gap where the knowledge graph never auto-populated despite `GRAPH_EXTRACTION_ENABLED=true`, and adds a doctor check that detects when Claude Code fails to load plugin hooks. ## Fixed - **`mem::graph-extract` now auto-fires at session end.** When `GRAPH_EXTRACTION_ENABLED=true`, the function was registered and the REST endpoint was live, but no internal caller invoked it โ€” the graph KV stayed empty unless users manually `POST`ed to `/agentmemory/graph/extract`. `evHigh4/29/2026
v0.9.3## [0.9.3] โ€” 2026-04-24 Developer-experience patch. Every disabled feature flag is now visible in the viewer, the CLI, and REST error responses, so devs no longer hit empty tabs wondering whether the install is broken or just opt-in. Adds a `doctor` command that diagnoses the whole stack in one shot and a first-run hero in the viewer that points at the magical-moment `demo` command. ### Added - **`agentmemory doctor` command.** Runs 10 diagnostic checks in one shot: server reachability, healtHigh4/24/2026
v0.9.2Safety + import-pipeline patch. Kills the infinite Stop-hook recursion loop that burned Claude Pro tokens on unkeyed installs, repairs every empty viewer tab after `import-jsonl`, derives lessons and crystals automatically from imported sessions, and opens up OpenAI-compatible embedding endpoints. ## Contributors - **@Edison-A-N** โ€” #186: `OPENAI_BASE_URL` + `OPENAI_EMBEDDING_MODEL` env vars (unlocks Azure / vLLM / LM Studio for embeddings). - **@Tanmay-008** and **@tanmaishi** โ€” #111 / #179 fHigh4/22/2026
v0.9.1Trust-the-CLI patch. Three bugs that surfaced in real testing of v0.9.0: the dashboard viewer showed zeros for half its cards, `import-jsonl` crashed on anything but a perfect response, and `upgrade` hard-aborted on a cargo registry that never had the crate. ### Fixed - **Viewer dashboard list endpoints** (#172). `GET /agentmemory/semantic` and `GET /agentmemory/procedural` were never registered, and `GET /agentmemory/relations` returned 405 because only the POST trigger existed. The dashboardHigh4/20/2026
v0.9.0Visibility + correctness release. Landing site, filesystem connector, MCP standalone now actually talks to the running server, health logic stops crying wolf, audit trail closes its last gap, and every memory path has a clear policy. ## Highlights - **Website** โ€” Next.js 16 App Router landing page at [`website/`](https://github.com/rohitg00/agentmemory/tree/v0.9.0/website). Lamborghini-inspired dark canvas, live GitHub stars pill, agents marquee with real brand logos, command-center tab showcasHigh4/18/2026
v0.8.12Release 0.8.12High4/16/2026
v0.8.11## What's Fixed `node dist/index.mjs` crashed on startup after the iii-sdk v0.11 migration (#116) merged: ``` SyntaxError: The requested module 'iii-sdk' does not provide an export named 'getContext' ``` iii-sdk v0.11 dropped `getContext()` entirely. 32 `src/functions/*.ts` files still imported and called it. The bug was invisible to CI (tests mock iii-sdk) and build (tsdown doesn't type-check). ### Changes - **`src/logger.ts`** โ€” new thin stderr shim with `.info/.warn/.error` replacing `geHigh4/15/2026
v0.8.10**Behavior change**: the PreToolUse and SessionStart hooks no longer run enrichment by default. SessionStart saves ~1-2K input tokens per session you start (the only path that was actually reaching the model, per the [Claude Code hook docs](https://code.claude.com/docs/en/hooks.md)). PreToolUse stops spawning a Node process and POSTing to \`/agentmemory/enrich\` on every file-touching tool call โ€” a pure resource cleanup, not a token fix. If you were relying on either path, set \`AGENTMEMORY_INJEHigh4/15/2026
v0.8.9Two UX fixes for the Claude Code plugin install path, reported in [#139](https://github.com/rohitg00/agentmemory/issues/139) by [@stefanfaur](https://github.com/stefanfaur). ## Fixed - **Claude Code plugin now auto-wires the MCP server** ([#139](https://github.com/rohitg00/agentmemory/issues/139)) โ€” new `plugin/.mcp.json` declares the `@agentmemory/mcp` stdio server so `/plugin install agentmemory@agentmemory` auto-starts it when the plugin is enabled. No extra config step, no separate installHigh4/14/2026
v0.8.8**Behavior change**: per-observation LLM compression is now opt-in. If you were relying on LLM-generated summaries, set \`AGENTMEMORY_AUTO_COMPRESS=true\` in \`~/.agentmemory/.env\` and restart. ## Fixed - **Stop silently burning Claude API tokens on every tool invocation** ([#138](https://github.com/rohitg00/agentmemory/issues/138), thanks [@olcor1](https://github.com/olcor1)) โ€” the old \`mem::observe\` path fired \`mem::compress\` unconditionally on every PostToolUse hook, which called ClaudMedium4/14/2026
v0.8.7Brown-paper-bag fix for [#136](https://github.com/rohitg00/agentmemory/issues/136), reported by [@stefano-medapps](https://github.com/stefano-medapps). If you hit \`Failed to read config file '/app/config.yaml': Is a directory\` on a fresh \`npx @agentmemory/agentmemory\`, this release fixes it. ## What broke The 0.8.6 tarball shipped \`docker-compose.yml\` but not \`iii-config.docker.yaml\`, even though the compose file mounts \`./iii-config.docker.yaml:/app/config.yaml:ro\`. Docker resolMedium4/14/2026
v0.8.6Finishes the #120 story: a dedicated standalone package for `npx`, minus the name-collision problem. ## Changed - **Standalone MCP shim is now `@agentmemory/mcp`** โ€” 0.8.5 tried to publish it as unscoped `agentmemory-mcp`, but npm's name-similarity policy rejects that name because of an unrelated third-party package called `agent-memory-mcp`. The shim now lives under the scope we already own, so `npx -y @agentmemory/mcp` works on the live registry. All README snippets, the OpenClaw and Hermes High4/13/2026
v0.8.5Compatibility fix for stricter JSON-RPC clients, plus a spec cleanup CodeRabbit caught during review. ## Fixed - **MCP server works with Codex CLI and any strict JSON-RPC 2.0 client** ([#129](https://github.com/rohitg00/agentmemory/issues/129)) โ€” the stdio transport was responding to JSON-RPC **notifications** (messages without an `id` field, e.g. `notifications/initialized`), which violates JSON-RPC 2.0 ยง4.1 and caused stricter clients like Codex CLI v0.120.0 to close the transport with "TranMedium4/13/2026
v0.8.2## Security Release This release ships **6 security fixes** addressing vulnerabilities in default deployments. **Users on v0.8.1 should upgrade immediately.** ### Fixed CVEs | Severity | Issue | |---|---| | ๐Ÿ”ด CRITICAL | Stored XSS in real-time viewer (inline `onclick=` + `script-src 'unsafe-inline'`) | | ๐Ÿ”ด CRITICAL | `curl \| sh` remote shell execution in CLI startup | | ๐ŸŸ  HIGH | Default `0.0.0.0` binding exposed memory store on LAN | | ๐ŸŸ  HIGH | Unauthenticated mesh sync endpoints | | ๐ŸŸก Medium4/12/2026
v0.8.1## Bug Fixes - **Viewer not found via npx (#109)**: Build now copies `index.html` to `dist/viewer/`. Path resolution covers npx, tsx dev, and repo root deployments. ## New - **Hermes Agent memory provider plugin**: Full `MemoryProvider` ABC implementation at `integrations/hermes/`. SSRF-safe URL validation, non-blocking `sync_turn`, context injection on `on_pre_compress`. - **12 agents in README**: Added OpenClaw (345K stars), Codex CLI (62K), Cline (59K), Aider (42K), Goose (33K), Kilo Code High4/9/2026
v0.8.0## New Features ### Viewer dark mode Toggle in the header โ€” persists to localStorage, respects `prefers-color-scheme`. All canvas graph colors (grid, labels, tooltips, node pills) adapt correctly. Thanks to the editorial design system already using CSS custom properties, the entire viewer switches cleanly. ### MiniMax LLM provider (#103) New provider for MiniMax's Anthropic-compatible API. Uses raw `fetch` to bypass SDK `x-stainless-*` headers that MiniMax rejects with 403. Configure with `MINMedium4/9/2026
v0.7.9## Bug Fix - **skills path**: Changed from `../skills/` to `./skills/` in plugin.json. Claude Code resolves paths relative to the plugin root, not relative to plugin.json. (Thanks @chendonghui1) Closes #94 **Full Changelog**: https://github.com/rohitg00/agentmemory/compare/v0.7.8...v0.7.9High4/8/2026
v0.7.8## Bug Fixes - **hooks.json format** (#100): Each event entry now uses the correct nested `{ hooks: [{ type, command }] }` format. Claude Code expects hooks wrapped in an array, not flat `{ type, command }` at the top level. - **skills validation** (#94): Changed from explicit file path array to directory reference `["../skills/"]` matching the convention used by working plugins. Plugin install should now work cleanly: ``` /plugin marketplace add rohitg00/agentmemory /plugin install agentmemorMedium4/8/2026
v0.7.7## Bug Fix Fixes `/plugin install agentmemory` failing with validation errors (#94). **Root cause**: `plugin.json` had three schema violations: - `author` was a string โ€” must be an object `{name, url}` - `hooks` was a file path โ€” must be omitted (auto-loaded by convention from `hooks/hooks.json`) - `skills` was a directory string โ€” must be an array of explicit paths Users can now install cleanly: ``` /plugin marketplace add rohitg00/agentmemory /plugin install agentmemory ``` Closes #94 **FMedium4/7/2026
v0.7.6## New Features ### Cross-encoder reranking (#90) Opt-in rerank step after hybrid search via `RERANK_ENABLED=true`. Uses `@xenova/transformers` MiniLM-L-6-v2 cross-encoder on top-20 candidates. Graceful fallback when model unavailable. ### Working memory / context window (#58) Core memory system with pinned facts (always included in context) + automatic paging of archival memories. 5 new functions: `mem::core-add`, `mem::core-remove`, `mem::core-list`, `mem::working-context`, `mem::auto-page`.Medium4/7/2026
v0.7.5## Fixes This release fixes all installation bugs reported by users trying to set up agentmemory for the first time. ### npm install fails (ERESOLVE) `@anthropic-ai/claude-agent-sdk@0.2.56` requires `zod@^4.0.0` as a peer dependency, but agentmemory had `zod@^3.23.0`. Updated to `zod@^4.0.0`. ### Docker: "Config file not found: /app/config.yaml" `docker-compose.yml` was missing the config mount. Added `./iii-config.yaml:/app/config.yaml:ro` volume. ### Docker: engine unreachable after contaiMedium4/7/2026
v0.7.4## What's New ### Reflect โ€” higher-order insight synthesis (#89) The headline feature competitors like Hindsight charge for. `memory_reflect` traverses the knowledge graph, groups related memories by concept clusters, and synthesizes higher-order insights via LLM. ```bash # Trigger via MCP memory_reflect # Or REST POST /agentmemory/reflect ``` **How it works:** 1. Finds high-degree concept nodes in the knowledge graph 2. BFS clusters related concepts (depth=2) 3. Gathers semantic memories, Medium4/6/2026
v0.7.3## Fixes - **#84** Fixed `CrystallizableAction` type error that broke `tsc --noEmit` - **#85** Added `files` field to package.json โ€” npm package reduced from 40MB to 11.6MB - **#92** Updated README function table โ€” all 89 mem:: functions documented in categorized table - Fixed `mem::temporal-graph` (nonexistent) โ†’ `temporal-graph-extract` + `temporal-query` - Updated stale test/stats counts across README and AGENTS.md ## Tests - **#86** 22 tests for lessons (save, recall, list, strengthen, decaMedium4/6/2026
v0.7.2## What's New ### Zero-config startup ```bash npx @agentmemory/agentmemory ``` Auto-installs iii-engine if missing (interactive prompt), starts the engine, runs the worker. ### Viewer updates - Lessons tab with search, confidence gauges, reinforcement counts, source badges - Lessons + Crystals stat cards on dashboard ### Install methods for iii-engine - `curl -fsSL https://install.iii.dev/iii/main/install.sh | sh` - `cargo install iii-engine` - Docker: `docker pull iiidev/iii:latest` InstallMedium4/5/2026
v0.7.1Scoped package name to `@agentmemory/agentmemory` for npm publishing. Install: `npm install @agentmemory/agentmemory` No code changes from v0.7.0 โ€” package.json name + repository fields updated.Medium4/5/2026
v0.7.0## What's New Five DX improvements based on competitive research against Mem0, Engram, CodeMem, and 30+ agent memory tools: ### `npx agentmemory` zero-config startup CLI bootstrap auto-detects and starts iii-engine (tries `iii` binary, falls back to Docker). No manual engine setup required. ### Simplified MCP surface (7 core tools) `AGENTMEMORY_TOOLS=all` unlocks all 41 tools. Default shows only: save, recall, consolidate, smart_search, sessions, diagnose, lesson_save. ### First-class lessonMedium4/4/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

hippo-memoryBiologically-inspired memory for AI agents. Decay, retrieval strengthening, consolidation. Zero dependencies.v1.22.0
engineering-notebookCapture and summarize Claude Code sessions into searchable, browsable engineering journals with a web UI and automated daily entries.main@2026-06-02
showcaseShowcase delivers a modern developer portfolio built with TypeScript and React, focusing on interactivity and clean architecture for a seamless user experience.main@2026-06-02
rp1Ready Player One - stop prompting; start shippingv0.7.10
taleThe Sovereign AI Platformโ€‹ โ€” Local AI models, agents, skills, and automations โ€” on your own infrastructure, connected to your datav0.2.81

More from rohitg00

ai-engineering-from-scratchLearn it. Build it. Ship it for others.
kubectl-mcp-serverPublished in CNCF Landscape: A MCP server for Kubernetes.

More in RAG & Memory

vllmA high-throughput and memory-efficient inference and serving engine for LLMs
spiceaiA portable accelerated SQL query, search, and LLM-inference engine, written in Rust, for data-grounded AI apps and agents.
awesome-opensource-aiCurated list of the best truly open-source AI projects, models, tools, and infrastructure.
antflyNo description