Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

agentmemory — Persistent memory for AI coding agents

Your coding agent remembers everything. No more re-explaining. Built on iii engine
Persistent memory for Claude Code, Cursor, Gemini CLI, Codex CLI, Hermes, OpenClaw, pi, OpenCode, and any MCP client.

rohitg00/agentmemory | Trendshift

Star History Chart

Design doc: 1200 stars / 172 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 version CI License Stars

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

agentmemory demo

Quick StartBenchmarksvs CompetitorsAgentsHow It WorksMCPVieweriii ConsolePowered by iiiConfigAPI


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
6 hooks + MCP + skills
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
Any agent
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)

SystemR@5R@10MRR
agentmemory95.2%98.6%88.2%
BM25-only fallback86.2%94.6%71.5%

Token Savings

ApproachTokens/yrCost/yr
Paste full context19.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

agentmemorymem0 (53K ⭐)Letta / MemGPT (22K ⭐)Built-in (CLAUDE.md)
TypeMemory engine + MCP serverMemory layer APIFull agent runtimeStatic file
Retrieval R@595.2%68.5% (LoCoMo)83.2% (LoCoMo)N/A (grep)
Auto-capture12 hooks (zero manual effort)Manual add() callsAgent self-editsManual editing
SearchBM25 + Vector + Graph (RRF fusion)Vector + GraphVector (archival)Loads everything into context
Multi-agentMCP + REST + leases + signalsAPI (no coordination)Within Letta runtime onlyPer-agent files
Framework lock-inNone (any MCP client)NoneHigh (must use Letta)Per-agent format
External depsNone (SQLite + iii-engine)Qdrant / pgvectorPostgres + vector DBNone
Memory lifecycle4-tier consolidation + decay + auto-forgetPassive extractionAgent-managedManual pruning
Token efficiency~1,900 tokens/session ($10/yr)Varies by integrationCore memory in context22K+ tokens at 240 obs
Real-time viewerYes (port 3113)Cloud dashboardCloud dashboardNo
Self-hostedYes (default)OptionalOptionalYes

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.

Codex CLI (Codex plugin platform)

# 1. start the memory server in a separate terminal npx @agentmemory/agentmemory # 2. register the agentmemory marketplace and install the plugin codex plugin marketplace add rohitg00/agentmemory codex plugin install agentmemory

The Codex plugin ships from the same plugin/ directory as the Claude Code plugin. It registers:

  • @agentmemory/mcp as an MCP server (all 51 tools when AGENTMEMORY_TOOLS=all)
  • 6 lifecycle hooks: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, Stop
  • 4 skills: /recall, /remember, /session-history, /forget

Codex's hook engine injects CLAUDE_PLUGIN_ROOT into hook subprocesses (per codex-rs/hooks/src/engine/discovery.rs), so the same hook scripts work across both hosts without duplication. Subagent / SessionEnd / Notification / TaskCompleted / PostToolUseFailure events are Claude-Code-only and are not registered for Codex.

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 51 memory tools:

{
  "mcpServers": {
    "agentmemory": {
      "command": "npx",
      "args": ["-y", "@agentmemory/mcp"],
      "env": {
        "AGENTMEMORY_URL": "http://localhost:3111"
      }
    }
  }
}

Restart OpenClaw. Verify with `curl http://localhost:3111/agentmemory/health`. Open http://localhost:3113 for the real-time viewer. For deeper memory-slot integration, copy `integrations/openclaw` to `~/.openclaw/extensions/agentmemory` and enable `plugins.slots.memory = "agentmemory"` in `~/.openclaw/openclaw.json`.

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 51 memory tools:

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

memory:
  provider: agentmemory

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/agentmemory.

Full guide: integrations/hermes/

Other agents

Start the memory server: npx @agentmemory/agentmemory

The agentmemory entry is the same MCP server block across every host that uses the mcpServers shape (Cursor, Claude Desktop, Cline, Roo Code, Windsurf, Gemini CLI, OpenClaw):

"agentmemory": { "command": "npx", "args": ["-y", "@agentmemory/mcp"], "env": { "AGENTMEMORY_URL": "http://localhost:3111" } }

Merge this entry into the existing mcpServers object in the host's config file — don't replace the file. If the file already has other servers, add agentmemory next to them as another key inside mcpServers. If mcpServers is missing entirely, paste the block inside { "mcpServers": { ... } }.

AgentConfig fileNotes
Cursor~/.cursor/mcp.jsonMerge into mcpServers. One-click deeplink also available on the website.
Claude Desktopclaude_desktop_config.json (Application Support)Merge into mcpServers. Restart Claude Desktop after editing.
Cline / Roo Code / Kilo CodeCline MCP settings (Settings UI → MCP Servers → Edit)Same mcpServers block.
Windsurf~/.codeium/windsurf/mcp_config.jsonSame mcpServers block.
Gemini CLI~/.gemini/settings.jsongemini mcp add agentmemory npx -y @agentmemory/mcp --scope user (auto-merges).
OpenClawOpenClaw MCP configSame mcpServers block, or use the deeper memory plugin.
Codex CLI (MCP only).codex/config.tomlTOML shape: codex mcp add agentmemory -- npx -y @agentmemory/mcp, or add [mcp_servers.agentmemory] manually.
Codex CLI (full plugin)Codex plugin marketplacecodex plugin marketplace add rohitg00/agentmemory then codex plugin install agentmemory. Registers MCP + 6 lifecycle hooks (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, Stop) + 4 skills.
OpenCodeopencode.jsonDifferent shape — top-level mcp key, command as array: {"mcp": {"agentmemory": {"type": "local", "command": ["npx", "-y", "@agentmemory/mcp"], "enabled": true}}}.
pi~/.pi/agent/extensions/agentmemoryCopy integrations/pi and restart pi.
Hermes Agent~/.hermes/config.yamlUse the deeper memory provider plugin with memory.provider: agentmemory.
GooseGoose MCP settings UISame mcpServers block.
Aidern/aTalk to the REST API directly: curl -X POST http://localhost:3111/agentmemory/smart-search -d '{"query": "auth"}'.
Any agent (32+)n/anpx skillkit install agentmemory auto-detects the host and merges.

Sandboxed MCP clients (Flatpak / Snap / restrictive containers) that can't reach the host's localhost: also set "AGENTMEMORY_FORCE_PROXY": "1" in the env block, and point AGENTMEMORY_URL at a route the sandbox can actually reach (e.g. your LAN IP). See #234 for the diagnostic walkthrough.

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. agentmemory currently pins iii-engine to v0.11.2v0.11.6 introduces a new sandbox-everything-via-iii worker add model that agentmemory hasn't been refactored for yet. Pin lifts once the refactor lands. Override with AGENTMEMORY_III_VERSION=<version> if you've migrated to the sandbox model manually.

  • macOS arm64: mkdir -p ~/.local/bin && curl -fsSL https://github.com/iii-hq/iii/releases/download/iii/v0.11.2/iii-aarch64-apple-darwin.tar.gz | tar -xz -C ~/.local/bin && chmod +x ~/.local/bin/iii
  • macOS x64: swap aarch64-apple-darwin for x86_64-apple-darwin
  • Linux x64: swap for x86_64-unknown-linux-gnu
  • Linux arm64: swap for aarch64-unknown-linux-gnu
  • Windows: download iii-x86_64-pc-windows-msvc.zip from iii-hq/iii releases v0.11.2, extract iii.exe, add to PATH

Or use Docker (the bundled docker-compose.yml pulls iiidev/iii:0.11.2). 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/tag/iii%2Fv0.11.2 in your browser # (we pin to v0.11.2 until agentmemory refactors for the new sandbox # model that engine v0.11.6+ requires) # 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 # Should print: 0.11.2 # 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:

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

Note: there is no cargo install iii-engineiii 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
Scale200-line capUnlimited
SearchLoads everything into contextBM25 + vector + graph (top-K only)
Token cost22K+ at 240 observations~1,900 tokens (92% less)
Cross-agentPer-agent filesMCP + REST (any agent)
CoordinationNoneLeases, signals, actions, routines
ObservabilityRead files manuallyReal-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

Stop / SessionEnd hook fires
  -> Summarize session
  -> Knowledge graph extraction (if GRAPH_EXTRACTION_ENABLED=true)
  -> Slot reflection (if SLOT_REFLECT_ENABLED=true)

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.

TierWhatAnalogy
WorkingRaw observations from tool useShort-term memory
EpisodicCompressed session summaries"What happened"
SemanticExtracted facts and patterns"What I know"
ProceduralWorkflows 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

HookCaptures
SessionStartProject path, session ID
UserPromptSubmitUser prompts (privacy-filtered)
PreToolUseFile access patterns + enriched context
PostToolUseTool name, input, output
PostToolUseFailureError context
PreCompactRe-injects memory before compaction
SubagentStart/StopSub-agent lifecycle
StopEnd-of-session summary
SessionEndSession complete marker

Key Capabilities

CapabilityDescription
Automatic captureEvery tool use recorded via hooks — zero manual effort
Semantic searchBM25 + vector + knowledge graph with RRF fusion
Memory evolutionVersioning, supersession, relationship graphs
Auto-forgettingTTL expiry, contradiction detection, importance eviction
Privacy firstAPI keys, secrets, <private> tags stripped before storage
Self-healingCircuit breaker, provider fallback chain, health monitoring
Claude bridgeBi-directional sync with MEMORY.md
Knowledge graphEntity extraction + BFS traversal
Team memoryNamespaced shared + private across team members
Citation provenanceTrace any memory back to source observations
Git snapshotsVersion, rollback, and diff memory state

Triple-stream retrieval combining three signals:

StreamWhat it doesWhen
BM25Stemmed keyword matching with synonym expansionAlways on
VectorCosine similarity over dense embeddingsEmbedding provider configured
GraphKnowledge graph traversal via entity matchingEntities 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
ProviderModelCostNotes
Local (recommended)all-MiniLM-L6-v2FreeOffline, +8pp recall over BM25-only
Geminitext-embedding-004Free tier1500 RPM
OpenAItext-embedding-3-small$0.02/1MHighest quality
Voyage AIvoyage-code-3PaidOptimized for code
Cohereembed-english-v3.0Free trialGeneral purpose
OpenRouterAny modelVariesMulti-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)
ToolDescription
memory_recallSearch past observations
memory_compress_fileCompress markdown files while preserving structure
memory_saveSave an insight, decision, or pattern
memory_patternsDetect recurring patterns
memory_smart_searchHybrid semantic + keyword search
memory_file_historyPast observations about specific files
memory_sessionsList recent sessions
memory_timelineChronological observations
memory_profileProject profile (concepts, files, patterns)
memory_exportExport all memory data
memory_relationsQuery relationship graph
Extended tools (50 total — set AGENTMEMORY_TOOLS=all)
ToolDescription
memory_patternsDetect recurring patterns
memory_timelineChronological observations
memory_relationsQuery relationship graph
memory_graph_queryKnowledge graph traversal
memory_consolidateRun 4-tier consolidation
memory_claude_bridge_syncSync with MEMORY.md
memory_team_shareShare with team members
memory_team_feedRecent shared items
memory_auditAudit trail of operations
memory_governance_deleteDelete with audit trail
memory_snapshot_createGit-versioned snapshot
memory_action_createCreate work items with dependencies
memory_action_updateUpdate action status
memory_frontierUnblocked actions ranked by priority
memory_nextSingle most important next action
memory_leaseExclusive action leases (multi-agent)
memory_routine_runInstantiate workflow routines
memory_signal_sendInter-agent messaging
memory_signal_readRead messages with receipts
memory_checkpointExternal condition gates
memory_mesh_syncP2P sync between instances
memory_sentinel_createEvent-driven watchers
memory_sentinel_triggerFire sentinels externally
memory_sketch_createEphemeral action graphs
memory_sketch_promotePromote to permanent
memory_crystallizeCompact action chains
memory_diagnoseHealth checks
memory_healAuto-fix stuck state
memory_facet_tagDimension:value tags
memory_facet_queryQuery by facet tags
memory_verifyTrace provenance

6 Resources · 3 Prompts · 4 Skills

TypeNameDescription
Resourceagentmemory://statusHealth, session count, memory count
Resourceagentmemory://project/{name}/profilePer-project intelligence
Resourceagentmemory://memories/latestLatest 10 active memories
Resourceagentmemory://graph/statsKnowledge graph statistics
Promptrecall_contextSearch + return context messages
Promptsession_handoffHandoff data between agents
Promptdetect_patternsAnalyze recurring patterns
Skill/recallSearch memory
Skill/rememberSave to long-term memory
Skill/session-historyRecent session summaries
Skill/forgetDelete 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, Roo Code, Windsurf, Gemini CLI):

{ "mcpServers": { "agentmemory": { "command": "npx", "args": ["-y", "@agentmemory/mcp"], "env": { "AGENTMEMORY_URL": "http://localhost:3111" } } } }

Merge the agentmemory entry into your host's existing mcpServers object rather than replacing the file. For sandboxed clients that can't reach the host's localhost, add "AGENTMEMORY_FORCE_PROXY": "1" to the env block and set AGENTMEMORY_URL to a route the sandbox can reach.

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

The viewer at :3113 shows what your agent remembered. The iii console shows what your agent did — every memory op as an OpenTelemetry trace, every KV entry editable, every function invocable, every stream tappable. Two windows on the same memory: one product-shaped, one engine-shaped.

Watch a memory_smart_search fire and see the BM25 scan → embedding lookup → RRF fusion → reranker as a waterfall. Edit a stuck consolidation timer in the KV browser. Replay a PostToolUse hook with a tweaked payload. Pin the WebSocket stream and watch observations land live.

agentmemory ships this for free because every function, trigger, state scope, and stream is an iii primitive — nothing custom, nothing to instrument.

iii console Workers page — connected workers including agentmemory instances with live function counts and runtime metadata
Workers page: every connected worker — including agentmemory itself — with PID, function count, runtime, and last-seen.

Already installed. The console ships with iii — no separate installer.

Launch alongside agentmemory:

# agentmemory viewer holds port 3113, so run the console on 3114. # Engine REST (3111), WebSocket (3112), and bridge (49134) defaults match agentmemory. iii console --port 3114

Then open http://localhost:3114. Add --enable-flow for the experimental architecture-graph page.

Override engine endpoints only if you've moved them:

iii console --port 3114 \ --engine-port 3111 \ --ws-port 3112 \ --bridge-port 49134

What you can do from the console:

PageUse it to
WorkersSee every connected worker and its live metrics — including the agentmemory worker itself.
FunctionsInvoke any of agentmemory's functions directly with a JSON payload — handy for testing memory.recall, memory.consolidate, graph.query without wiring a client.
TriggersReplay HTTP, cron, event, and state triggers — fire the consolidation cron manually, retry an HTTP route, emit a state change.
StatesKV browser with full CRUD — sessions, memory slots, lifecycle timers, embeddings index — edit values in place.
StreamsLive WebSocket monitor for memory writes, hook events, and observation updates as they flow through iii streams.
QueuesDurable queue topics + dead-letter management. Replay or drop failed embedding / compression jobs.
TracesOpenTelemetry waterfall / flame / service-breakdown views. Filter by trace_id to see exactly which functions, DB calls, and embedding requests a single memory.search produced.
LogsStructured OTEL logs filtered and correlated to trace/span IDs.
ConfigRuntime configuration — see exactly which workers, providers, and ports your engine is running with.
Flow(Optional, --enable-flow) Interactive architecture graph of every worker, trigger, and stream.

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.


Powered by iii

agentmemory is already a running iii instance. Functions, triggers, KV state, streams, OTEL traces — all of it is iii primitives. You didn't install Postgres, Redis, Express, pm2, or Prometheus, because iii replaces them.

That means one more command extends agentmemory with an entire new capability.

Extend agentmemory with one command

iii worker add iii-pubsub # fan memory writes out to every connected instance iii worker add iii-cron # scheduled consolidation, decay sweeps, snapshot rotation iii worker add iii-queue # durable retries for embedding + compression jobs iii worker add iii-observability # OTEL traces on every memory op (default on) iii worker add iii-sandbox # run recalled code inside an isolated microVM iii worker add iii-database # swap in a SQL-backed state adapter iii worker add mcp # generic MCP host alongside the agentmemory MCP

Each iii worker add registers new functions and triggers into the same engine agentmemory is already running on. The viewer and console pick them up immediately — no reload, no new integration, no new container.

iii worker addWhat you get on top of agentmemory
iii-pubsubMulti-instance memory: every remember fans out, every search reads the union
iii-cronScheduled lifecycle — nightly consolidation, weekly snapshots, decay on a fixed clock
iii-queueDurable retries: failed embedding + compression jobs survive restart, no lost observations
iii-observabilityOTEL traces, metrics, logs on every function — wired in iii-config.yaml from day one
iii-sandboxCode that came out of memory_recall runs inside a throwaway VM, not your shell
iii-databaseSQL-backed state adapter when you outgrow the in-memory KV defaults
mcpStand up extra MCP servers next to agentmemory's, share the same engine

Full registry: workers.iii.dev. Every worker there composes through the same primitives agentmemory uses — and the agentmemory you already have is one of them.

What iii replaces

Traditional stackagentmemory uses
Express.js / Fastifyiii HTTP Triggers
SQLite / Postgres + pgvectoriii KV State + in-memory vector index
SSE / Socket.ioiii Streams (WebSocket)
pm2 / systemdiii engine worker supervision
Prometheus / Grafanaiii OTEL + health monitor
Custom plugin systemsiii worker add <name>

118 source files · ~21,800 LOC · 800 tests · 123 functions · 34 KV scopes — all on three primitives. No agentmemory plugin install. The plugin system is iii itself.


Configuration

LLM Providers

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

ProviderConfigNotes
No-op (default)No config neededLLM-backed compress/summarize is DISABLED. Synthetic BM25 compression + recall still work. See AGENTMEMORY_ALLOW_AGENT_SDK below if you used to rely on the Claude-subscription fallback.
Anthropic APIANTHROPIC_API_KEYPer-token billing
MiniMaxMINIMAX_API_KEYAnthropic-compatible
GeminiGEMINI_API_KEYAlso enables embeddings
OpenRouterOPENROUTER_API_KEYAny model
Claude subscription fallbackAGENTMEMORY_ALLOW_AGENT_SDK=trueOpt-in only. Spawns @anthropic-ai/claude-agent-sdk sessions — used to cause unbounded Stop-hook recursion (#149 follow-up) so it is no longer the default.

Environment Variables

Create ~/.agentmemory/.env:

# LLM provider (pick one — default is the no-op provider: no LLM calls) # ANTHROPIC_API_KEY=sk-ant-... # ANTHROPIC_BASE_URL=... # Optional: Anthropic-compatible proxy / Azure # GEMINI_API_KEY=... # OPENROUTER_API_KEY=... # MINIMAX_API_KEY=... # Opt-in Claude-subscription fallback (spawns @anthropic-ai/claude-agent-sdk); # leave OFF unless you understand the Stop-hook recursion risk (#149 follow-up): # AGENTMEMORY_ALLOW_AGENT_SDK=true # Embedding provider (auto-detected, or override) # EMBEDDING_PROVIDER=local # VOYAGE_API_KEY=... # OPENAI_API_KEY=sk-... # OPENAI_BASE_URL=https://api.openai.com # Override for Azure / vLLM / LM Studio / proxies # OPENAI_EMBEDDING_MODEL=text-embedding-3-small # OPENAI_EMBEDDING_DIMENSIONS=1536 # Required when the model is not in the known-models table # 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
MethodPathDescription
GET/agentmemory/healthHealth check (always public)
POST/agentmemory/session/startStart session + get context
POST/agentmemory/session/endEnd session
POST/agentmemory/observeCapture observation
POST/agentmemory/smart-searchHybrid search
POST/agentmemory/contextGenerate context
POST/agentmemory/rememberSave to long-term memory
POST/agentmemory/forgetDelete observations
POST/agentmemory/enrichFile context + memories + bugs
GET/agentmemory/profileProject profile
GET/agentmemory/exportExport all data
POST/agentmemory/importImport from JSON
POST/agentmemory/graph/queryKnowledge graph query
POST/agentmemory/team/shareShare with team
GET/agentmemory/auditAudit trail

Full endpoint list: src/triggers/api.ts


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

关于 About

#1 Persistent memory for AI coding agents based on real-world benchmarks
agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryopenclaw

语言 Languages

TypeScript82.2%
HTML8.9%
JavaScript6.8%
CSS1.5%
Python0.6%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
292
Total Commits
峰值: 93次/周
Less
More

核心贡献者 Contributors