Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@agentmemory/agentmemory

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentmemory/agentmemory

Persistent memory for AI coding agents, powered by iii-engine's three primitives

Source
npmnpm
Version
0.7.5
Version published
Weekly downloads
13K
-33.77%
Maintainers
1
Weekly downloads
 
Created
Source

agentmemory — Persistent memory for AI coding agents

Persistent memory for AI coding agents.
Powered by iii-engine.

agentmemory demo

Quick StartWhyAgentsHow It WorksSearchMemory EvolutionMCPViewerConfigurationAPI

Every AI coding agent has the same blind spot. Session ends, memory vanishes. You re-explain architecture. You re-discover bugs. You re-teach preferences. Built-in memory files like CLAUDE.md and .cursorrules are 200-line sticky notes that overflow and go stale. agentmemory replaces that with a searchable, versioned, cross-agent database — 43 MCP tools, triple-stream retrieval (BM25 + vector + knowledge graph), 4-tier memory consolidation, provenance-tracked citations, and cascading staleness so retired facts never pollute your context again. One instance serves Claude Code, Cursor, Codex, Windsurf, and any MCP client simultaneously. 627 tests. Zero external DB dependencies.

The result is measurable. On 240 real observations across 30 sessions, agentmemory hits 64% Recall@10 and perfect MRR while using 92% fewer tokens than dumping everything into context. When an agent searches "database performance optimization," it finds the N+1 fix you made three weeks ago — something keyword grep literally cannot do. Memories version automatically, supersede each other, propagate staleness to related graph nodes, and sync across agent instances via P2P mesh. Your agents stop repeating mistakes. Your context stays clean. Your sessions start fast.

npx @agentmemory/agentmemory   # installs iii-engine if missing, starts everything

Why agentmemory

AI coding agents forget everything between sessions. You explain the same architecture, re-discover the same patterns, and re-learn the same preferences every time. agentmemory fixes that.

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"
  agentmemory injects context from Session 1:
    - Auth uses JWT middleware in src/middleware/auth.ts
    - Tests in test/auth.test.ts cover token validation
    - Decision: chose jose over jsonwebtoken for Edge compatibility
  Agent starts with full project awareness

No manual notes. No copy-pasting. The agent just knows.

What it gives you

CapabilityWhat it does
Automatic captureEvery tool use, file edit, test run, and error is silently recorded via hooks
LLM compressionRaw observations are compressed into structured facts, concepts, and narratives
Context injectionPast knowledge is injected at session start within a configurable token budget
Semantic searchHybrid BM25 + vector search finds relevant memories even with different wording
Memory evolutionMemories version over time, supersede each other, and form relationship graphs
Project profilesAggregated per-project intelligence: top concepts, files, conventions, common errors
Auto-forgettingTTL expiry, contradiction detection, and importance-based eviction keep memory clean
Privacy firstAPI keys, secrets, and <private> tags are stripped before anything is stored
Self-healingCircuit breaker, provider fallback chain, self-correcting LLM output, health monitoring
Claude Code bridgeBi-directional sync with ~/.claude/projects/*/memory/MEMORY.md
Cross-agent MCPStandalone MCP server for Cursor, Codex, Gemini CLI, Windsurf, any MCP client
Citation provenanceJIT verification traces any memory back to source observations and sessions
Cascading stalenessSuperseded memories auto-flag related graph nodes, edges, and siblings as stale
Knowledge graphEntity extraction + BFS traversal across files, functions, concepts, errors
4-tier memoryWorking → episodic → semantic → procedural consolidation with strength decay
Team memoryNamespaced shared + private memory across team members
GovernanceEdit, delete, bulk-delete, and audit trail for all memory operations
Git snapshotsVersion, rollback, and diff memory state via git commits

How it compares to built-in agent memory

Every AI coding agent now ships with built-in memory — Claude Code has MEMORY.md, Cursor has notepads, Windsurf has Cascade memories, Cline has memory bank. These work like sticky notes: fast, always-on, but fundamentally limited.

agentmemory is the searchable database behind the sticky notes.

Built-in (CLAUDE.md, .cursorrules)agentmemory
Scale200-line cap (MEMORY.md)Unlimited
SearchLoads everything into contextBM25 + vector + graph (returns top-K only)
Token cost22K+ tokens at 240 observations~1,900 tokens (92% less)
At 1K observations80% of memories invisible100% searchable
At 5K observationsExceeds context windowStill ~2K tokens
Cross-session recallOnly within line capFull corpus search
Cross-agentPer-agent files (no sharing)MCP + REST API (any agent)
Multi-agent coordinationImpossibleLeases, signals, actions, routines
Cross-agent syncNoP2P mesh (7 scopes: memories, actions, semantic, procedural, relations, graph)
Memory trustNo verificationCitation chain back to source observations with confidence scores
Semantic searchNo (keyword grep)Yes (Recall@10: 64% vs 56% for grep)
Memory lifecycleManual pruningEbbinghaus decay + tiered eviction
Knowledge graphNoEntity extraction + temporal versioning
ObservabilityRead files manuallyReal-time viewer on :3113

Benchmarks (measured, not projected)

Evaluated on 240 real-world coding observations across 30 sessions with 20 labeled queries:

SystemRecall@10NDCG@10MRRTokens/query
Built-in (grep all into context)55.8%80.3%82.5%19,462
agentmemory BM25 (stemmed + synonyms)55.9%82.7%95.5%1,571
agentmemory + Xenova embeddings64.1%94.9%100.0%1,571

With real embeddings, agentmemory finds "N+1 query fix" when you search "database performance optimization" — something keyword matching literally cannot do.

Full benchmark reports: benchmark/QUALITY.md, benchmark/SCALE.md, benchmark/REAL-EMBEDDINGS.md

Supported Agents

agentmemory works with any agent that supports hooks, MCP, or via its REST API.

Native hook support (zero config)

These agents support hooks natively. agentmemory captures tool usage automatically via its 12 hooks.

AgentIntegrationSetup
Claude Code12 hooks (all types)/plugin install agentmemory or manual hook config
Claude Code SDKAgent SDK providerBuilt-in AgentSDKProvider uses your Claude subscription

MCP support (any MCP-compatible agent)

Any agent that connects to MCP servers can use agentmemory's 43 tools, 6 resources, and 3 prompts. The agent actively queries and saves memory through MCP calls.

AgentHow to connect
Claude DesktopAdd to claude_desktop_config.json MCP servers
CursorAdd MCP server in settings
WindsurfMCP server configuration
Cline / ContinueMCP server configuration
Any MCP clientPoint to http://localhost:3111/agentmemory/mcp/*

REST API (any agent, any language)

Agents without hooks or MCP can integrate via 103 REST endpoints directly. This works with any agent, language, or framework.

POST /agentmemory/observe       # Capture what the agent did
POST /agentmemory/smart-search  # Find relevant memories
POST /agentmemory/context       # Get context for injection
POST /agentmemory/enrich        # Get enriched context (files + memories + bugs)
POST /agentmemory/remember      # Save long-term memory
GET  /agentmemory/profile       # Get project intelligence

Choosing an integration method

Your situationUse
Claude Code userPlugin install (hooks + MCP + skills)
Building a custom agent with Claude SDKAgentSDKProvider (zero config)
Using Cursor, Windsurf, or any MCP clientMCP server (41 tools + 6 resources + 3 prompts)
Building your own agent frameworkREST API (103 endpoints)
Sharing memory across multiple agentsAll agents point to the same iii-engine instance

Quick Start

1. Install the Plugin (Claude Code)

/plugin marketplace add rohitg00/agentmemory
/plugin install agentmemory

All 12 hooks, 4 skills, and MCP server are registered automatically.

2. Start agentmemory

npx @agentmemory/agentmemory

This auto-installs iii-engine if missing, starts it, and runs the worker. One command.

Or from source:

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

3. Verify

curl http://localhost:3111/agentmemory/health

# Real-time viewer (auto-starts on port 3113)
open http://localhost:3113
{
  "status": "healthy",
  "service": "agentmemory",
  "version": "0.7.4",
  "health": {
    "memory": { "heapUsed": 42000000, "heapTotal": 67000000 },
    "cpu": { "percent": 2.1 },
    "eventLoopLagMs": 1.2,
    "status": "healthy"
  },
  "circuitBreaker": { "state": "closed", "failures": 0 }
}

Manual Hook Setup (alternative)

If you prefer not to use the plugin, add hooks directly to ~/.claude/settings.json:

{
  "hooks": {
    "SessionStart": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/session-start.mjs" }],
    "UserPromptSubmit": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/prompt-submit.mjs" }],
    "PreToolUse": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/pre-tool-use.mjs" }],
    "PostToolUse": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/post-tool-use.mjs" }],
    "PostToolUseFailure": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/post-tool-failure.mjs" }],
    "PreCompact": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/pre-compact.mjs" }],
    "SubagentStart": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/subagent-start.mjs" }],
    "SubagentStop": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/subagent-stop.mjs" }],
    "Notification": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/notification.mjs" }],
    "TaskCompleted": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/task-completed.mjs" }],
    "Stop": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/stop.mjs" }],
    "SessionEnd": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/session-end.mjs" }]
  }
}

How It Works

Observation Pipeline

PostToolUse hook fires
  -> Dedup check      SHA-256 hash (5min window, no duplicates)
  -> mem::privacy     Strip secrets, API keys, <private> tags
  -> mem::observe     Store raw observation, push to real-time stream
  -> mem::compress    LLM extracts: type, facts, narrative, concepts, files
                      Validates with Zod, scores quality (0-100)
                      Self-corrects on validation failure (1 retry)
                      Generates vector embedding for semantic search

Context Injection

SessionStart hook fires
  -> mem::context     Load recent sessions for this project
                      Hybrid search (BM25 + vector) across observations
                      Inject project profile (top concepts, files, patterns)
                      Apply token budget (default: 2000 tokens)
  -> stdout           Agent receives context in the conversation

What Gets Captured

HookCaptures
SessionStartProject path, session ID, working directory
UserPromptSubmitUser prompts (privacy-filtered)
PreToolUseFile access patterns + enriched context injection (Read, Write, Edit, Glob, Grep)
PostToolUseTool name, input, output
PostToolUseFailureFailed tool invocations with error context
PreCompactRe-injects memory context before context compaction
SubagentStart/StopSub-agent lifecycle events
NotificationSystem notifications
TaskCompletedTask completion events
StopTriggers end-of-session summary
SessionEndMarks session complete

agentmemory uses triple-stream retrieval combining three signals for maximum recall.

How search works

StreamWhat it doesWhen
BM25Stemmed keyword matching with synonym expansion and binary-search prefix matchingAlways on
VectorCosine similarity over dense embeddings (Xenova, OpenAI, Gemini, Voyage, Cohere, OpenRouter)Any embedding provider configured
GraphKnowledge graph traversal via entity matching and co-occurrence edgesEntities detected in query

All three streams are fused with Reciprocal Rank Fusion (RRF, k=60) and session-diversified (max 3 results per session) to maximize coverage.

BM25 enhancements (v0.6.0): Porter stemmer normalizes word forms ("authentication" ↔ "authenticating"), coding-domain synonyms expand queries ("db" ↔ "database", "perf" ↔ "performance"), and binary-search prefix matching replaces O(n) scans.

Embedding providers

agentmemory auto-detects which provider to use. For best results, install local embeddings (no API key needed):

npm install @xenova/transformers
ProviderModelDimensionsEnv VarNotes
Local (recommended)all-MiniLM-L6-v2384EMBEDDING_PROVIDER=localFree, offline, +8pp recall over BM25-only
Geminitext-embedding-004768GEMINI_API_KEYFree tier (1500 RPM)
OpenAItext-embedding-3-small1536OPENAI_API_KEY$0.02/1M tokens
Voyage AIvoyage-code-31024VOYAGE_API_KEYOptimized for code
Cohereembed-english-v3.01024COHERE_API_KEYFree trial available
OpenRouterAny embedding modelvariesOPENROUTER_API_KEYMulti-model proxy

No embedding provider? BM25-only mode with stemming and synonyms still outperforms built-in memory.

Progressive disclosure

Smart search returns compact results first (title, type, score, timestamp) to save tokens. Expand specific IDs to get full observation details.

# Compact results (50-100 tokens each)
curl -X POST http://localhost:3111/agentmemory/smart-search \
  -d '{"query": "database migration"}'

# Expand specific results (500-1000 tokens each)
curl -X POST http://localhost:3111/agentmemory/smart-search \
  -d '{"expandIds": ["obs_abc123", "obs_def456"]}'

Memory Evolution

Memories in agentmemory are not static. They version, evolve, and form relationships.

Versioning

When you save a memory that's similar to an existing one (Jaccard > 0.7), the old memory is superseded:

v1: "Use Express for API routes"
v2: "Use Fastify instead of Express for API routes" (supersedes v1)
v3: "Use Hono instead of Fastify for Edge API routes" (supersedes v2)

Only the latest version is returned in search results. The full chain is preserved for audit.

Relationships

Memories can be linked: supersedes, extends, derives, contradicts, related. Each relationship carries a confidence score (0-1) computed from co-occurrence, recency, and relation type. Traversal follows these links up to N hops, with optional minConfidence filtering.

Auto-forget

agentmemory automatically cleans itself:

MechanismWhat it does
TTL expiryMemories with forgetAfter date are deleted when expired
Contradiction detectionNear-duplicate memories (Jaccard > 0.9) — older one is demoted
Low-value evictionObservations older than 90 days with importance < 3 are removed
Per-project capProjects are capped at 10,000 observations (lowest importance evicted first)

Run POST /agentmemory/auto-forget?dryRun=true to preview what would be cleaned.

Project profiles

agentmemory aggregates observations into per-project intelligence:

curl "http://localhost:3111/agentmemory/profile?project=/my/project"

Returns top concepts, most-touched files, coding conventions, common errors, and a session count. This profile is automatically injected into session context.

Timeline

Navigate observations chronologically around any anchor point:

curl -X POST http://localhost:3111/agentmemory/timeline \
  -d '{"anchor": "2026-02-15", "before": 5, "after": 5}'

Export / Import

Full data portability:

# Export everything
curl http://localhost:3111/agentmemory/export > backup.json

# Import with merge strategy
curl -X POST http://localhost:3111/agentmemory/import \
  -d '{"exportData": ..., "strategy": "merge"}'

Strategies: merge (combine), replace (overwrite), skip (ignore duplicates).

Self-Evaluation

agentmemory monitors its own health and validates its own output.

Quality scoring

Every LLM compression is scored 0-100 based on structured facts, narrative quality, concept extraction, title quality, and importance range. Scores are tracked per-function and exposed via /health.

Self-correction

When LLM output fails Zod validation, agentmemory retries with a stricter prompt explaining the exact errors. This recovers from malformed JSON, missing fields, and out-of-range values.

Circuit breaker + fallback chain

Primary provider fails
  -> Circuit breaker opens (3 failures in 60s)
  -> Falls back to next provider in FALLBACK_PROVIDERS chain
  -> 30s cooldown -> half-open -> test call -> recovery

Configure with FALLBACK_PROVIDERS=anthropic,gemini,openrouter. When all providers are down, observations are stored raw without compression. No data is lost.

Health monitor

Collects every 30 seconds: heap usage, CPU percentage (delta sampling), event loop lag, connection state. Alerts at warning (80% CPU, 100ms lag) and critical (90% CPU, 500ms lag) thresholds. GET /agentmemory/health returns HTTP 503 when critical.

MCP Server

Tools (38)

ToolDescription
memory_recallSearch past observations by keyword
memory_saveSave an insight, decision, or pattern
memory_file_historyGet past observations about specific files
memory_patternsDetect recurring patterns across sessions
memory_sessionsList recent sessions with status
memory_smart_searchHybrid semantic + keyword search with progressive disclosure
memory_timelineChronological observations around an anchor point
memory_profileProject profile with top concepts, files, patterns
memory_exportExport all memory data as JSON
memory_relationsQuery memory relationship graph (with confidence filtering)
memory_claude_bridge_syncSync memory to/from Claude Code's native MEMORY.md
memory_graph_queryQuery the knowledge graph for entities and relationships
memory_consolidateRun 4-tier memory consolidation pipeline
memory_team_shareShare a memory or observation with team members
memory_team_feedGet recent shared items from all team members
memory_auditView the audit trail of memory operations
memory_governance_deleteDelete specific memories with audit trail
memory_snapshot_createCreate a git-versioned snapshot of memory state
memory_action_createCreate actionable work items with typed dependencies
memory_action_updateUpdate action status, priority, or details
memory_frontierGet unblocked actions ranked by priority and urgency
memory_nextGet the single most important next action
memory_leaseAcquire, release, or renew exclusive action leases
memory_routine_runInstantiate a frozen workflow routine into action chains
memory_signal_sendSend threaded messages between agents
memory_signal_readRead messages for an agent with read receipts
memory_checkpointCreate or resolve external condition gates (CI, approval, deploy)
memory_mesh_syncSync memories and actions with peer instances
memory_sentinel_createCreate event-driven condition watchers
memory_sentinel_triggerExternally fire a sentinel to unblock gated actions
memory_sketch_createCreate ephemeral action graphs for exploratory work
memory_sketch_promotePromote sketch actions to permanent actions
memory_crystallizeLLM-powered compaction of completed action chains
memory_diagnoseHealth checks across all subsystems
memory_healAuto-fix stuck, orphaned, and inconsistent state
memory_facet_tagAttach structured dimension:value tags to targets
memory_facet_queryQuery targets by facet tags with AND/OR logic
memory_verifyTrace a memory's provenance back to source observations and sessions

Resources (6)

URIDescription
agentmemory://statusSession count, memory count, health status
agentmemory://project/{name}/profilePer-project intelligence (concepts, files, conventions)
agentmemory://project/{name}/recentLast 5 session summaries for a project
agentmemory://memories/latestLatest 10 active memories (id, title, type, strength)
agentmemory://graph/statsKnowledge graph node and edge counts by type
agentmemory://team/{id}/profileTeam memory profile with shared concepts and patterns

Prompts (3)

PromptArgumentsDescription
recall_contexttask_descriptionSearches observations + memories, returns context messages
session_handoffsession_idReturns session data + summary for handoff between agents
detect_patternsproject (optional)Analyzes recurring patterns across sessions

Standalone MCP Server

Run agentmemory as a standalone MCP server for any MCP-compatible agent (Cursor, Codex, Gemini CLI, Windsurf):

npx agentmemory-mcp

Or add to your agent's MCP config:

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

The standalone server uses in-memory KV with optional JSON persistence (STANDALONE_PERSIST_PATH).

MCP Endpoints (embedded mode)

GET  /agentmemory/mcp/tools          — List available tools
POST /agentmemory/mcp/call           — Execute a tool
GET  /agentmemory/mcp/resources      — List available resources
POST /agentmemory/mcp/resources/read — Read a resource by URI
GET  /agentmemory/mcp/prompts        — List available prompts
POST /agentmemory/mcp/prompts/get    — Get a prompt with arguments

Skills

Four slash commands for interacting with memory:

SkillUsage
/recallSearch memory for past context (/recall auth middleware)
/rememberSave something to long-term memory (/remember always use jose for JWT)
/session-historyShow recent session summaries
/forgetDelete specific observations or entire sessions

Real-Time Viewer

agentmemory includes a real-time web dashboard that auto-starts on port 3113 (configurable via III_REST_PORT + 2).

  • Live observation stream via WebSocket
  • Session explorer with observation details
  • Memory browser with search and filtering
  • Knowledge graph visualization
  • Health and metrics dashboard

Access at http://localhost:3113 or via GET /agentmemory/viewer on the API port. Protected by AGENTMEMORY_SECRET when set. CSP headers applied to all HTML responses.

Configuration

LLM Providers

agentmemory needs an LLM for compressing observations and generating summaries. It auto-detects from your environment.

ProviderConfigNotes
Claude subscription (default)No config neededUses @anthropic-ai/claude-agent-sdk. Zero cost beyond your Max/Pro plan
Anthropic APIANTHROPIC_API_KEYDirect API access, per-token billing
GeminiGEMINI_API_KEYAlso enables Gemini embeddings (free tier)
OpenRouterOPENROUTER_API_KEYAccess any model through one API

No API key? agentmemory uses your Claude subscription automatically. Zero config.

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 from LLM keys, or override)
# EMBEDDING_PROVIDER=voyage
# VOYAGE_API_KEY=...
# OPENAI_API_KEY=...
# COHERE_API_KEY=...

# Hybrid search weights (default: 0.4 BM25 + 0.6 vector)
# BM25_WEIGHT=0.4
# VECTOR_WEIGHT=0.6

# Provider fallback chain (comma-separated, tried in order)
# FALLBACK_PROVIDERS=anthropic,gemini,openrouter

# Bearer token for API auth
# AGENTMEMORY_SECRET=your-secret-here

# Engine connection
# III_ENGINE_URL=ws://localhost:49134
# III_REST_PORT=3111
# III_STREAMS_PORT=3112
# Viewer runs on III_REST_PORT + 2 (default: 3113)

# Memory tuning
# TOKEN_BUDGET=2000
# MAX_OBS_PER_SESSION=500

# Claude Code Memory Bridge (v0.5.0)
# CLAUDE_MEMORY_BRIDGE=false
# CLAUDE_MEMORY_LINE_BUDGET=200

# Standalone MCP Server (v0.5.0)
# STANDALONE_MCP=false
# STANDALONE_PERSIST_PATH=~/.agentmemory/standalone.json

# Knowledge Graph (v0.5.0)
# GRAPH_EXTRACTION_ENABLED=false
# GRAPH_EXTRACTION_BATCH_SIZE=10

# Consolidation Pipeline (v0.5.0)
# CONSOLIDATION_ENABLED=true
# CONSOLIDATION_DECAY_DAYS=30

# Lesson Decay (v0.7.0)
# LESSON_DECAY_ENABLED=true

# Obsidian Export (v0.7.0)
# OBSIDIAN_AUTO_EXPORT=false

# MCP Tool Visibility (v0.7.0) — "core" (7 tools) or "all" (41 tools)
# AGENTMEMORY_TOOLS=core

# Team Memory (v0.5.0)
# TEAM_ID=
# USER_ID=
# TEAM_MODE=private

# Git Snapshots (v0.5.0)
# SNAPSHOT_ENABLED=false
# SNAPSHOT_INTERVAL=3600
# SNAPSHOT_DIR=~/.agentmemory/snapshots

API

109 endpoints on port 3111 (103 core + 6 MCP protocol). Protected endpoints require Authorization: Bearer <secret> when AGENTMEMORY_SECRET is set. The table below shows a representative subset; see src/triggers/api.ts for the full endpoint list.

MethodPathDescription
GET/agentmemory/healthHealth check with metrics (always public)
GET/agentmemory/livezLiveness probe (always public)
POST/agentmemory/session/startStart session + get context
POST/agentmemory/session/endMark session complete
POST/agentmemory/observeCapture observation
POST/agentmemory/contextGenerate context
POST/agentmemory/searchSearch observations (BM25)
POST/agentmemory/smart-searchHybrid search with progressive disclosure
POST/agentmemory/summarizeGenerate session summary
POST/agentmemory/rememberSave to long-term memory
POST/agentmemory/forgetDelete observations/sessions
POST/agentmemory/consolidateMerge duplicate observations
POST/agentmemory/patternsDetect recurring patterns
POST/agentmemory/generate-rulesGenerate CLAUDE.md rules from patterns
POST/agentmemory/file-contextGet file-specific history
POST/agentmemory/enrichUnified enrichment (file context + memories + bugs)
POST/agentmemory/evictEvict stale memories (?dryRun=true)
POST/agentmemory/migrateImport from SQLite
POST/agentmemory/timelineChronological observations around anchor
POST/agentmemory/relationsCreate memory relationship (with confidence)
POST/agentmemory/evolveEvolve memory (new version)
POST/agentmemory/auto-forgetRun auto-forget (?dryRun=true)
POST/agentmemory/importImport data from JSON
GET/agentmemory/profileProject profile (?project=/path)
GET/agentmemory/exportExport all data as JSON
GET/agentmemory/sessionsList all sessions
GET/agentmemory/observationsSession observations (?sessionId=X)
GET/agentmemory/viewerReal-time web viewer (also at http://localhost:3113)
GET/agentmemory/claude-bridge/readRead Claude Code native MEMORY.md
POST/agentmemory/claude-bridge/syncSync memories to MEMORY.md
POST/agentmemory/graph/queryQuery knowledge graph (BFS traversal)
GET/agentmemory/graph/statsKnowledge graph node/edge counts
POST/agentmemory/graph/extractExtract entities from observations
POST/agentmemory/consolidate-pipelineRun 4-tier consolidation pipeline
POST/agentmemory/team/shareShare memory with team members
GET/agentmemory/team/feedRecent shared items from team
GET/agentmemory/team/profileAggregated team memory profile
GET/agentmemory/auditQuery audit trail (?operation=X&limit=N)
DELETE/agentmemory/governance/memoriesDelete specific memories with audit
POST/agentmemory/governance/bulk-deleteBulk delete by type/date/quality
GET/agentmemory/snapshotsList git snapshots
POST/agentmemory/snapshot/createCreate git-versioned snapshot
POST/agentmemory/snapshot/restoreRestore from snapshot commit
POST/agentmemory/lessonsSave a lesson (returns 201 if created, 200 if strengthened)
GET/agentmemory/lessonsList lessons (?project=X&minConfidence=0.5)
POST/agentmemory/lessons/searchSearch lessons by query
POST/agentmemory/lessons/strengthenReinforce a lesson's confidence
POST/agentmemory/obsidian/exportExport vault as Obsidian Markdown
GET/agentmemory/mcp/toolsList MCP tools
POST/agentmemory/mcp/callExecute MCP tool
GET/agentmemory/mcp/resourcesList MCP resources
POST/agentmemory/mcp/resources/readRead MCP resource by URI
GET/agentmemory/mcp/promptsList MCP prompts
POST/agentmemory/mcp/prompts/getGet MCP prompt with arguments

Plugin Install

/plugin marketplace add rohitg00/agentmemory
/plugin install agentmemory

Restart Claude Code. All 12 hooks, 4 skills, and 43 MCP tools are registered automatically.

Plugin Commands

/plugin install agentmemory          # Install
/plugin disable agentmemory          # Disable without uninstalling
/plugin enable agentmemory           # Re-enable
/plugin uninstall agentmemory        # Remove

Architecture

agentmemory is built on iii-engine's three primitives:

What you'd normally needWhat agentmemory uses
Express.js / Fastifyiii HTTP Triggers
SQLite / Postgres + pgvectoriii KV State + in-memory vector index
SSE / Socket.ioiii Streams (WebSocket)
pm2 / systemdiii-engine worker management
Prometheus / Grafanaiii OTEL + built-in health monitor
Redis (circuit breaker)In-process circuit breaker + fallback chain

113 source files. ~20,000 LOC. 627 tests. Zero external DB dependencies.

Functions (89 mem:: functions)

CategoryFunctionsPurpose
Core Memoryobserve, compress, search, smart-searchCapture, compress, and search observations
context, summarize, remember, forgetBuild context, generate summaries, save/delete memories
file-context, enrich, patterns, generate-rulesFile history, enrichment, pattern detection, rule generation
migrate, export, importSQLite migration, JSON round-trip (v0.3.0–v0.7.2)
Searchexpand-query, sliding-window, graph-retrievalQuery reformulations, context enrichment, entity-based retrieval
retention-score, retention-evictEbbinghaus decay with tiered storage (hot/warm/cold)
Memory Evolutionevolve, auto-forget, evictVersion memories, TTL expiry, importance-based eviction
consolidate, consolidate-pipelineMerge duplicates, 4-tier consolidation (working→episodic→semantic→procedural)
verify, cascade-updateCitation chain provenance, staleness propagation
Knowledge Graphgraph-extract, graph-query, graph-statsLLM entity extraction, BFS traversal, statistics
temporal-graph-extract, temporal-queryTemporal knowledge extraction + point-in-time queries
Relationshipsrelate, get-related, timeline, profileMemory relations, chronological view, project profiles
Claude Bridgeclaude-bridge-read, claude-bridge-syncBi-directional sync with MEMORY.md
Actionsaction-create, action-update, action-get, action-listDependency-aware work items with typed edges
action-edge-createCreate typed edges between actions (requires, unlocks, gated_by)
frontier, nextPriority-ranked unblocked action queue
Leaseslease-acquire, lease-release, lease-renew, lease-cleanupTTL-based atomic agent claims with auto-cleanup
Routinesroutine-create, routine-freeze, routine-list, routine-run, routine-statusFrozen workflow templates instantiated into action chains
Signalssignal-send, signal-read, signal-threads, signal-cleanupThreaded inter-agent messaging with read receipts
Checkpointscheckpoint-create, checkpoint-resolve, checkpoint-list, checkpoint-expireExternal condition gates (CI, approval, deploy)
Meshmesh-register, mesh-sync, mesh-receive, mesh-list, mesh-removeP2P sync between agentmemory instances
Sentinelssentinel-create, sentinel-trigger, sentinel-check, sentinel-cancel, sentinel-list, sentinel-expireEvent-driven condition watchers
Sketchessketch-create, sketch-add, sketch-promote, sketch-discard, sketch-list, sketch-gcEphemeral action graphs with auto-expiry
Crystalscrystallize, auto-crystallize, crystal-list, crystal-getLLM-powered compaction of action chains into digests
Lessonslesson-save, lesson-recall, lesson-list, lesson-strengthen, lesson-decay-sweepConfidence-scored lessons with dedup, reinforcement, and decay
Facetsfacet-tag, facet-untag, facet-query, facet-get, facet-stats, facet-dimensionsMulti-dimensional tagging with AND/OR queries
Diagnosticsdiagnose, healSelf-diagnosis across 8 categories with auto-fix
Flowflow-compressLLM summarization of completed action chains
Branchdetect-worktree, list-worktrees, branch-sessionsGit worktree detection for shared memory
Teamteam-share, team-feed, team-profileNamespaced shared + private team memory
Governancegovernance-delete, governance-bulk, audit-queryDelete with audit trail, bulk operations
Snapshotssnapshot-create, snapshot-list, snapshot-restoreGit-versioned memory state
Exportobsidian-exportObsidian-compatible Markdown with YAML frontmatter + wikilinks

Data Model (34 KV scopes)

ScopeStores
mem:sessionsSession metadata, project, timestamps
mem:obs:{session_id}Compressed observations with embeddings
mem:summariesEnd-of-session summaries
mem:memoriesLong-term memories (versioned, with relationships)
mem:relationsMemory relationship graph
mem:profilesAggregated project profiles
mem:emb:{obs_id}Vector embeddings
mem:index:bm25Persisted BM25 index
mem:metricsPer-function metrics
mem:healthHealth snapshots
mem:configRuntime configuration overrides
mem:confidenceConfidence scores for memories
mem:claude-bridgeClaude Code MEMORY.md bridge state
mem:graph:nodesKnowledge graph entities
mem:graph:edgesKnowledge graph relationships
mem:semanticSemantic memories (consolidated facts)
mem:proceduralProcedural memories (extracted workflows)
mem:team:{id}:sharedTeam shared items
mem:team:{id}:users:{uid}Per-user team state
mem:team:{id}:profileAggregated team profile
mem:auditAudit trail for all operations
mem:actionsDependency-aware work items
mem:action-edgesTyped edges (requires, unlocks, gated_by, etc.)
mem:leasesTTL-based agent work claims
mem:routinesFrozen workflow templates
mem:routine-runsInstantiated routine execution tracking
mem:signalsInter-agent messages with threading
mem:checkpointsExternal condition gates
mem:meshRegistered P2P sync peers
mem:sentinelsEvent-driven condition watchers
mem:sketchesEphemeral action graphs
mem:crystalsCompacted action chain digests
mem:facetsMulti-dimensional tags
mem:lessonsConfidence-scored lessons with decay

Development

npm run dev               # Hot reload
npm run build             # Production build (~425KB)
npm test                  # Unit tests (627 tests, ~1.5s)
npm run test:integration  # API tests (requires running services)

Prerequisites

  • Node.js >= 20
  • iii-engine (curl -fsSL https://install.iii.dev/iii/main/install.sh | sh)

License

Apache-2.0

Keywords

ai

FAQs

Package last updated on 07 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts