@agentmemory/agentmemory 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,6 +7,13 @@
7
7
  Persistent memory for Claude Code, Cursor, Gemini CLI, OpenCode, and any MCP client.
8
8
  </p>
9
9
 
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/@agentmemory/agentmemory"><img src="https://img.shields.io/npm/v/@agentmemory/agentmemory?color=CB3837&label=npm" alt="npm version" /></a>
12
+ <a href="https://github.com/rohitg00/agentmemory/actions"><img src="https://img.shields.io/github/actions/workflow/status/rohitg00/agentmemory/ci.yml?label=tests" alt="CI" /></a>
13
+ <a href="https://github.com/rohitg00/agentmemory/blob/main/LICENSE"><img src="https://img.shields.io/github/license/rohitg00/agentmemory?color=blue" alt="License" /></a>
14
+ <a href="https://github.com/rohitg00/agentmemory/stargazers"><img src="https://img.shields.io/github/stars/rohitg00/agentmemory?style=flat&color=yellow" alt="Stars" /></a>
15
+ </p>
16
+
10
17
  <p align="center">
11
18
  <img src="assets/demo.gif" alt="agentmemory demo" width="720" />
12
19
  </p>
@@ -14,23 +21,28 @@
14
21
  <p align="center">
15
22
  <a href="#quick-start">Quick Start</a> &bull;
16
23
  <a href="#why-agentmemory">Why</a> &bull;
17
- <a href="#supported-agents">Agents</a> &bull;
24
+ <a href="#benchmarks-measured-not-projected">Benchmarks</a> &bull;
18
25
  <a href="#how-it-works">How It Works</a> &bull;
19
26
  <a href="#search">Search</a> &bull;
20
- <a href="#memory-evolution">Memory Evolution</a> &bull;
21
27
  <a href="#mcp-server">MCP</a> &bull;
22
28
  <a href="#real-time-viewer">Viewer</a> &bull;
23
- <a href="#configuration">Configuration</a> &bull;
29
+ <a href="#configuration">Config</a> &bull;
24
30
  <a href="#api">API</a>
25
31
  </p>
26
32
 
27
33
  ---
28
34
 
29
- 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.
35
+ 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.
30
36
 
31
- **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*.
37
+ **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*.
32
38
 
33
- **95.2% retrieval accuracy** on [LongMemEval](https://arxiv.org/abs/2410.10813) (ICLR 2025). 43 MCP tools. 12 hooks. Real-time viewer. Works with Claude Code, Cursor, Gemini CLI, OpenCode, and any MCP client. 646 tests. Zero external DB dependencies.
39
+ | | |
40
+ |---|---|
41
+ | **95.2% R@5** | [LongMemEval](https://arxiv.org/abs/2410.10813) (ICLR 2025) retrieval accuracy |
42
+ | **92% fewer tokens** | ~1,900 injected vs ~19,000 full context ($10/yr vs $500+/yr) |
43
+ | **43 MCP tools** | Search, remember, forget, actions, leases, signals, mesh sync |
44
+ | **12 hooks** | Captures every tool use automatically, zero manual effort |
45
+ | **0 external deps** | No Postgres, no Redis, no vector DB. Just iii-engine (auto-installed) |
34
46
 
35
47
  ```bash
36
48
  npx @agentmemory/agentmemory # installs iii-engine if missing, starts everything
@@ -38,6 +50,39 @@ npx @agentmemory/agentmemory # installs iii-engine if missing, starts everythi
38
50
 
39
51
  ---
40
52
 
53
+ ## Quick Start
54
+
55
+ ### Claude Code (paste this, the agent does the rest)
56
+
57
+ ```
58
+ Install agentmemory: run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server. Then run `/plugin marketplace add rohitg00/agentmemory` and `/plugin install agentmemory` to register all 12 hooks, 4 skills, and 43 MCP tools. Verify with `curl http://localhost:3111/agentmemory/health`. The real-time viewer is at http://localhost:3113.
59
+ ```
60
+
61
+ That's it. Paste the block above into Claude Code. The agent handles installation, engine startup, plugin registration, and verification.
62
+
63
+ ### Other agents
64
+
65
+ Start the memory server first: `npx @agentmemory/agentmemory`
66
+
67
+ Then add the MCP config for your agent. All agents use the same server, so memories are shared across them.
68
+
69
+ | Agent | Setup |
70
+ |---|---|
71
+ | **OpenClaw** | Add to MCP config: `{"mcpServers": {"agentmemory": {"command": "npx", "args": ["agentmemory-mcp"]}}}` |
72
+ | **Cursor** | Add to `~/.cursor/mcp.json`: `{"mcpServers": {"agentmemory": {"command": "npx", "args": ["agentmemory-mcp"]}}}` |
73
+ | **OpenCode** | Add to `.opencode/config.json`: `{"mcpServers": {"agentmemory": {"command": "npx", "args": ["agentmemory-mcp"]}}}` |
74
+ | **Codex CLI** | Add to `.codex/config.yaml`: `mcp_servers: {agentmemory: {command: npx, args: ["agentmemory-mcp"]}}` |
75
+ | **Gemini CLI** | `gemini mcp add agentmemory -- npx agentmemory-mcp` |
76
+ | **Hermes Agent** | Add to `~/.hermes/config.yaml`: `mcp_servers: {agentmemory: {command: npx, args: ["agentmemory-mcp"]}}` or use the [memory provider plugin](integrations/hermes/) |
77
+ | **Cline** | Add MCP server in Cline settings |
78
+ | **Goose** | Add to `~/.config/goose/config.yaml`: `mcp_servers: {agentmemory: {command: npx, args: ["agentmemory-mcp"]}}` |
79
+ | **Kilo Code** | Add MCP server in Kilo Code settings |
80
+ | **Aider** | Use REST API: `curl -X POST http://localhost:3111/agentmemory/smart-search -d '{"query": "auth"}'` |
81
+ | **Claude Desktop** | Add to `claude_desktop_config.json`: `{"mcpServers": {"agentmemory": {"command": "npx", "args": ["agentmemory-mcp"]}}}` |
82
+ | **Any agent (32+)** | `npx skillkit install agentmemory` |
83
+
84
+ ---
85
+
41
86
  ## Why agentmemory
42
87
 
43
88
  Every coding agent forgets everything when the session ends. You waste the first 5 minutes of every session re-explaining your stack, your conventions, your recent decisions. agentmemory runs in the background and eliminates that entirely.
@@ -82,7 +127,7 @@ Session 2: "Now add rate limiting"
82
127
 
83
128
  ### How it compares to built-in agent memory
84
129
 
85
- 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.
130
+ Every AI coding agent now ships with built-in memory. Claude Code has `MEMORY.md`, Cursor has notepads, Cline has memory bank. These work like sticky notes: fast, always-on, but fundamentally limited.
86
131
 
87
132
  agentmemory is the searchable database behind the sticky notes.
88
133
 
@@ -103,6 +148,33 @@ agentmemory is the searchable database behind the sticky notes.
103
148
  | Knowledge graph | No | Entity extraction + temporal versioning |
104
149
  | Observability | Read files manually | Real-time viewer on :3113 |
105
150
 
151
+ ### What it costs (spoiler: almost nothing)
152
+
153
+ | Approach | Tokens/year | Annual cost | Notes |
154
+ |---|---|---|---|
155
+ | Paste full history into context | 19.5M+ | Impossible | Exceeds context window after ~200 observations |
156
+ | LLM-summarized memory (extraction-based) | ~650K | ~$500/yr | Loses context, summarization is lossy |
157
+ | **agentmemory context injection** | **~170K** | **~$10/yr** | Token-budgeted, only relevant memories injected |
158
+ | agentmemory with local embeddings | ~170K | **$0** | all-MiniLM-L6-v2 runs locally, no API calls |
159
+
160
+ ### How memory flows
161
+
162
+ ```text
163
+ PostToolUse hook fires
164
+ -> SHA-256 dedup (5min window)
165
+ -> Privacy filter (strip secrets, API keys)
166
+ -> Store raw observation
167
+ -> LLM compress -> structured facts + concepts + narrative
168
+ -> Generate vector embedding
169
+ -> Index in BM25 + vector + knowledge graph
170
+
171
+ SessionStart hook fires
172
+ -> Load project profile (top concepts, files, patterns)
173
+ -> Hybrid search (BM25 + vector + graph) for recent context
174
+ -> Apply token budget (default: 2000 tokens)
175
+ -> Inject into conversation via stdout
176
+ ```
177
+
106
178
  ### Benchmarks (measured, not projected)
107
179
 
108
180
  #### LongMemEval-S (ICLR 2025, 500 questions)
@@ -124,7 +196,9 @@ These are retrieval recall scores (not end-to-end QA accuracy). Embedding model:
124
196
  | agentmemory BM25 (stemmed + synonyms) | 55.9% | 82.7% | 95.5% | 1,571 |
125
197
  | agentmemory + Xenova embeddings | **64.1%** | **94.9%** | **100.0%** | **1,571** |
126
198
 
127
- agentmemory finds "N+1 query fix" when you search "database performance optimization" something keyword matching literally cannot do.
199
+ agentmemory finds "N+1 query fix" when you search "database performance optimization". Keyword matching can't do this.
200
+
201
+ > **Methodology note:** All LongMemEval numbers are retrieval recall (`recall_any@K`), not end-to-end QA accuracy. We clearly distinguish these because the LongMemEval leaderboard measures QA accuracy (retrieve + generate + judge). No hyperparameters were tuned on the test set. Full scripts and results are committed and reproducible.
128
202
 
129
203
  Full benchmark reports: [`benchmark/LONGMEMEVAL.md`](benchmark/LONGMEMEVAL.md), [`benchmark/QUALITY.md`](benchmark/QUALITY.md), [`benchmark/SCALE.md`](benchmark/SCALE.md), [`benchmark/REAL-EMBEDDINGS.md`](benchmark/REAL-EMBEDDINGS.md)
130
204
 
@@ -147,11 +221,17 @@ Any agent that connects to MCP servers can use agentmemory's 43 tools, 6 resourc
147
221
 
148
222
  | Agent | How to connect |
149
223
  |---|---|
150
- | **Cursor** | Add MCP server in settings or `~/.cursor/mcp.json` |
224
+ | **OpenClaw** (345K stars) | Add MCP server in settings |
225
+ | **OpenCode** (100K stars) | Add to `.opencode/config.json` MCP servers |
226
+ | **Gemini CLI** (98K stars) | `gemini mcp add agentmemory -- npx agentmemory-mcp` |
227
+ | **Codex CLI** (62K stars) | Add to `.codex/config.yaml` MCP servers |
228
+ | **Cline** (59K stars) | Add MCP server in Cline settings |
229
+ | **Cursor** (1M+ users) | Add MCP server in settings or `~/.cursor/mcp.json` |
230
+ | **Hermes Agent** (33K stars) | MCP config or [memory provider plugin](integrations/hermes/) |
231
+ | **Goose** (33K stars) | Add to `~/.config/goose/config.yaml` MCP servers |
232
+ | **Kilo Code** (1.5M users) | Add MCP server in Kilo Code settings |
233
+ | **Aider** (42K stars) | Use REST API (no MCP) |
151
234
  | **Claude Desktop** | Add to `claude_desktop_config.json` MCP servers |
152
- | **Gemini CLI** | `gemini mcp add agentmemory -- npx agentmemory-mcp` |
153
- | **OpenCode** | Add to `.opencode/config.json` MCP servers |
154
- | **Cline / Continue** | MCP server configuration |
155
235
  | **Any MCP client** | Point to `http://localhost:3111/agentmemory/mcp/*` |
156
236
 
157
237
  ### REST API (any agent, any language)
@@ -173,140 +253,21 @@ GET /agentmemory/profile # Get project intelligence
173
253
  |---|---|
174
254
  | Claude Code user | Plugin install (hooks + MCP + skills) |
175
255
  | Building a custom agent with Claude SDK | AgentSDKProvider (zero config) |
176
- | Using Cursor, Gemini CLI, OpenCode, or any MCP client | MCP server (43 tools + 6 resources + 3 prompts) |
256
+ | OpenClaw, Cursor, Codex, OpenCode, Gemini CLI, Cline, Goose, Kilo Code | MCP server (43 tools + 6 resources + 3 prompts) |
257
+ | Hermes Agent user | [Memory provider plugin](integrations/hermes/) (deeper) or MCP |
177
258
  | Building your own agent framework | REST API (103 endpoints) |
178
- | Sharing memory across multiple agents | All agents point to the same iii-engine instance |
259
+ | Sharing memory across multiple agents | All agents point to the same agentmemory instance |
179
260
 
180
- ## Quick Start
181
-
182
- ### 1. Start agentmemory
183
-
184
- ```bash
185
- npx @agentmemory/agentmemory
186
- ```
187
-
188
- This auto-installs iii-engine if missing, starts it, and runs the worker. One command.
189
-
190
- Or from source:
261
+ ### From source
191
262
 
192
263
  ```bash
193
264
  git clone https://github.com/rohitg00/agentmemory.git && cd agentmemory
194
265
  npm install && npm run build && npm start
195
266
  ```
196
267
 
197
- ### 2. Connect your agent
198
-
199
- **Claude Code (plugin — hooks + MCP + skills):**
200
-
201
- ```bash
202
- /plugin marketplace add rohitg00/agentmemory
203
- /plugin install agentmemory
204
- ```
205
-
206
- All 12 hooks, 4 skills, and MCP server are registered automatically.
207
-
208
- **Cursor / Claude Desktop / Cline / any MCP client:**
209
-
210
- Add to your MCP config (e.g. `~/.cursor/mcp.json`, `claude_desktop_config.json`):
211
-
212
- ```json
213
- {
214
- "mcpServers": {
215
- "agentmemory": {
216
- "command": "npx",
217
- "args": ["agentmemory-mcp"]
218
- }
219
- }
220
- }
221
- ```
222
-
223
- **Gemini CLI:**
224
-
225
- ```bash
226
- gemini mcp add agentmemory -- npx agentmemory-mcp
227
- ```
228
-
229
- **OpenCode:**
230
-
231
- Add to `.opencode/config.json`:
232
-
233
- ```json
234
- {
235
- "mcpServers": {
236
- "agentmemory": {
237
- "command": "npx",
238
- "args": ["agentmemory-mcp"]
239
- }
240
- }
241
- }
242
- ```
243
-
244
- **Any agent via SkillKit (32+ agents supported):**
245
-
246
- ```bash
247
- npx skillkit install agentmemory
248
- ```
249
-
250
- **REST API (any agent, any language):**
251
-
252
- ```bash
253
- curl -X POST http://localhost:3111/agentmemory/remember \
254
- -H "Content-Type: application/json" \
255
- -d '{"content": "Always use jose for JWT on Edge", "type": "preference"}'
256
-
257
- curl -X POST http://localhost:3111/agentmemory/smart-search \
258
- -H "Content-Type: application/json" \
259
- -d '{"query": "JWT authentication"}'
260
- ```
261
-
262
- ### 3. Verify
263
-
264
- ```bash
265
- curl http://localhost:3111/agentmemory/health
266
- open http://localhost:3113 # Real-time viewer
267
- ```
268
-
269
- ```json
270
- {
271
- "status": "healthy",
272
- "service": "agentmemory",
273
- "version": "0.7.7",
274
- "health": {
275
- "memory": { "heapUsed": 42000000, "heapTotal": 67000000 },
276
- "cpu": { "percent": 2.1 },
277
- "eventLoopLagMs": 1.2,
278
- "status": "healthy"
279
- },
280
- "circuitBreaker": { "state": "closed", "failures": 0 }
281
- }
282
- ```
283
-
284
- ### Manual Hook Setup (alternative)
285
-
286
- If you prefer not to use the plugin, add hooks directly to `~/.claude/settings.json`:
287
-
288
- ```json
289
- {
290
- "hooks": {
291
- "SessionStart": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/session-start.mjs" }],
292
- "UserPromptSubmit": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/prompt-submit.mjs" }],
293
- "PreToolUse": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/pre-tool-use.mjs" }],
294
- "PostToolUse": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/post-tool-use.mjs" }],
295
- "PostToolUseFailure": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/post-tool-failure.mjs" }],
296
- "PreCompact": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/pre-compact.mjs" }],
297
- "SubagentStart": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/subagent-start.mjs" }],
298
- "SubagentStop": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/subagent-stop.mjs" }],
299
- "Notification": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/notification.mjs" }],
300
- "TaskCompleted": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/task-completed.mjs" }],
301
- "Stop": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/stop.mjs" }],
302
- "SessionEnd": [{ "type": "command", "command": "node ~/agentmemory/dist/hooks/session-end.mjs" }]
303
- }
304
- }
305
- ```
306
-
307
268
  ## First Steps After Install
308
269
 
309
- Once hooks are installed, memory builds silently. No action needed just use your agent normally.
270
+ Once hooks are installed, memory builds silently. No action needed. Just use your agent normally.
310
271
 
311
272
  ### Session 1: Your agent works as usual
312
273
 
@@ -470,7 +431,7 @@ agentmemory automatically cleans itself:
470
431
  | Mechanism | What it does |
471
432
  |---|---|
472
433
  | **TTL expiry** | Memories with `forgetAfter` date are deleted when expired |
473
- | **Contradiction detection** | Near-duplicate memories (Jaccard > 0.9) older one is demoted |
434
+ | **Contradiction detection** | Near-duplicate memories (Jaccard > 0.9), older one is demoted |
474
435
  | **Low-value eviction** | Observations older than 90 days with importance < 3 are removed |
475
436
  | **Per-project cap** | Projects are capped at 10,000 observations (lowest importance evicted first) |
476
437
 
package/dist/cli.mjs CHANGED
@@ -159,12 +159,12 @@ async function main() {
159
159
  p.intro("agentmemory");
160
160
  if (skipEngine) {
161
161
  p.log.info("Skipping engine check (--no-engine)");
162
- await import("./src-qOdKVNQz.mjs");
162
+ await import("./src-Df36IFVL.mjs");
163
163
  return;
164
164
  }
165
165
  if (await isEngineRunning()) {
166
166
  p.log.success("iii-engine is running");
167
- await import("./src-qOdKVNQz.mjs");
167
+ await import("./src-Df36IFVL.mjs");
168
168
  return;
169
169
  }
170
170
  if (!await startEngine()) {
@@ -192,7 +192,7 @@ async function main() {
192
192
  process.exit(1);
193
193
  }
194
194
  s.stop("iii-engine is ready");
195
- await import("./src-qOdKVNQz.mjs");
195
+ await import("./src-Df36IFVL.mjs");
196
196
  }
197
197
  async function runStatus() {
198
198
  const port = getRestPort();
package/dist/index.mjs CHANGED
@@ -3910,7 +3910,7 @@ function registerAutoForgetFunction(sdk, kv) {
3910
3910
 
3911
3911
  //#endregion
3912
3912
  //#region src/version.ts
3913
- const VERSION = "0.8.0";
3913
+ const VERSION = "0.8.1";
3914
3914
 
3915
3915
  //#endregion
3916
3916
  //#region src/functions/export-import.ts
@@ -4016,7 +4016,8 @@ function registerExportImportFunction(sdk, kv) {
4016
4016
  "0.7.6",
4017
4017
  "0.7.7",
4018
4018
  "0.7.9",
4019
- "0.8.0"
4019
+ "0.8.0",
4020
+ "0.8.1"
4020
4021
  ]).has(importData.version)) return {
4021
4022
  success: false,
4022
4023
  error: `Unsupported export version: ${importData.version}`
@@ -14465,9 +14466,11 @@ function startViewerServer(port, _kv, _sdk, secret, restPort) {
14465
14466
  if (method === "GET" && (pathname === "/" || pathname === "/viewer" || pathname === "/agentmemory/viewer")) {
14466
14467
  const base = dirname(fileURLToPath(import.meta.url));
14467
14468
  const candidates = [
14468
- join(base, "..", "src", "viewer", "index.html"),
14469
+ join(base, "index.html"),
14470
+ join(base, "viewer", "index.html"),
14469
14471
  join(base, "..", "viewer", "index.html"),
14470
- join(base, "viewer", "index.html")
14472
+ join(base, "..", "src", "viewer", "index.html"),
14473
+ join(base, "..", "dist", "viewer", "index.html")
14471
14474
  ];
14472
14475
  for (const p of candidates) try {
14473
14476
  const html = readFileSync(p, "utf-8");