@agentmemory/agentmemory 0.8.1 → 0.8.6
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 +578 -668
- package/dist/cli.mjs +419 -95
- package/dist/cli.mjs.map +1 -1
- package/dist/docker-compose.yml +5 -5
- package/dist/iii-config.docker.yaml +51 -0
- package/dist/iii-config.yaml +2 -2
- package/dist/index.mjs +408 -186
- package/dist/index.mjs.map +1 -1
- package/dist/{src-Df36IFVL.mjs → src-DjVaT_sI.mjs} +410 -1330
- package/dist/src-DjVaT_sI.mjs.map +1 -0
- package/dist/standalone-C7tRDaiu.mjs +267 -0
- package/dist/standalone-C7tRDaiu.mjs.map +1 -0
- package/dist/standalone.d.mts +22 -1
- package/dist/standalone.d.mts.map +1 -0
- package/dist/standalone.mjs +96 -63
- package/dist/standalone.mjs.map +1 -1
- package/dist/tools-registry-BYzapMJi.mjs +1089 -0
- package/dist/tools-registry-BYzapMJi.mjs.map +1 -0
- package/dist/viewer/index.html +101 -19
- package/docker-compose.yml +5 -5
- package/iii-config.yaml +2 -2
- package/package.json +11 -4
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/src-Df36IFVL.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -8,10 +8,19 @@
|
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
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=
|
|
11
|
+
<a href="https://www.npmjs.com/package/@agentmemory/agentmemory"><img src="https://img.shields.io/npm/v/@agentmemory/agentmemory?color=CB3837&label=npm&style=for-the-badge&logo=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&style=for-the-badge&logo=github" 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&style=for-the-badge" alt="License" /></a>
|
|
14
|
+
<a href="https://github.com/rohitg00/agentmemory/stargazers"><img src="https://img.shields.io/github/stars/rohitg00/agentmemory?style=for-the-badge&color=yellow&logo=github" alt="Stars" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-recall.svg"><img src="assets/tags/stat-recall.svg" alt="95.2% retrieval R@5" height="38" /></picture>
|
|
19
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tokens.svg"><img src="assets/tags/stat-tokens.svg" alt="92% fewer tokens" height="38" /></picture>
|
|
20
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tools.svg"><img src="assets/tags/stat-tools.svg" alt="43 MCP tools" height="38" /></picture>
|
|
21
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-hooks.svg"><img src="assets/tags/stat-hooks.svg" alt="12 auto hooks" height="38" /></picture>
|
|
22
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-deps.svg"><img src="assets/tags/stat-deps.svg" alt="0 external DBs" height="38" /></picture>
|
|
23
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tests.svg"><img src="assets/tags/stat-tests.svg" alt="654 tests passing" height="38" /></picture>
|
|
15
24
|
</p>
|
|
16
25
|
|
|
17
26
|
<p align="center">
|
|
@@ -20,10 +29,10 @@
|
|
|
20
29
|
|
|
21
30
|
<p align="center">
|
|
22
31
|
<a href="#quick-start">Quick Start</a> •
|
|
23
|
-
<a href="#
|
|
24
|
-
<a href="#
|
|
32
|
+
<a href="#benchmarks">Benchmarks</a> •
|
|
33
|
+
<a href="#vs-competitors">vs Competitors</a> •
|
|
34
|
+
<a href="#works-with-every-agent">Agents</a> •
|
|
25
35
|
<a href="#how-it-works">How It Works</a> •
|
|
26
|
-
<a href="#search">Search</a> •
|
|
27
36
|
<a href="#mcp-server">MCP</a> •
|
|
28
37
|
<a href="#real-time-viewer">Viewer</a> •
|
|
29
38
|
<a href="#configuration">Config</a> •
|
|
@@ -32,231 +41,330 @@
|
|
|
32
41
|
|
|
33
42
|
---
|
|
34
43
|
|
|
44
|
+
<h2 id="works-with-every-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-agents.svg"><img src="assets/tags/section-agents.svg" alt="Works with every agent" height="32" /></picture></h2>
|
|
45
|
+
|
|
46
|
+
agentmemory works with any agent that supports hooks, MCP, or REST API. All agents share the same memory server.
|
|
47
|
+
|
|
48
|
+
<table>
|
|
49
|
+
<tr>
|
|
50
|
+
<td align="center" width="12.5%">
|
|
51
|
+
<a href="https://claude.com/product/claude-code"><img src="https://matthiasroder.com/content/images/2026/01/Claude.png?size=120" alt="Claude Code" width="48" height="48" /></a><br/>
|
|
52
|
+
<strong>Claude Code</strong><br/>
|
|
53
|
+
<sub>12 hooks + MCP + skills</sub>
|
|
54
|
+
</td>
|
|
55
|
+
<td align="center" width="12.5%">
|
|
56
|
+
<a href="integrations/openclaw/"><img src="https://github.com/openclaw.png?size=120" alt="OpenClaw" width="48" height="48" /></a><br/>
|
|
57
|
+
<strong>OpenClaw</strong><br/>
|
|
58
|
+
<sub>MCP + <a href="integrations/openclaw/">plugin</a></sub>
|
|
59
|
+
</td>
|
|
60
|
+
<td align="center" width="12.5%">
|
|
61
|
+
<a href="integrations/hermes/"><img src="https://github.com/NousResearch.png?size=120" alt="Hermes" width="48" height="48" /></a><br/>
|
|
62
|
+
<strong>Hermes</strong><br/>
|
|
63
|
+
<sub>MCP + <a href="integrations/hermes/">plugin</a></sub>
|
|
64
|
+
</td>
|
|
65
|
+
<td align="center" width="12.5%">
|
|
66
|
+
<a href="https://cursor.com"><img src="https://www.freelogovectors.net/wp-content/uploads/2025/06/cursor-logo-freelogovectors.net_.png" alt="Cursor" width="48" height="48" /></a><br/>
|
|
67
|
+
<strong>Cursor</strong><br/>
|
|
68
|
+
<sub>MCP server</sub>
|
|
69
|
+
</td>
|
|
70
|
+
<td align="center" width="12.5%">
|
|
71
|
+
<a href="https://github.com/google-gemini/gemini-cli"><img src="https://github.com/google-gemini.png?size=120" alt="Gemini CLI" width="48" height="48" /></a><br/>
|
|
72
|
+
<strong>Gemini CLI</strong><br/>
|
|
73
|
+
<sub>MCP server</sub>
|
|
74
|
+
</td>
|
|
75
|
+
<td align="center" width="12.5%">
|
|
76
|
+
<a href="https://github.com/opencode-ai/opencode"><img src="https://github.com/opencode-ai.png?size=120" alt="OpenCode" width="48" height="48" /></a><br/>
|
|
77
|
+
<strong>OpenCode</strong><br/>
|
|
78
|
+
<sub>MCP server</sub>
|
|
79
|
+
</td>
|
|
80
|
+
<td align="center" width="12.5%">
|
|
81
|
+
<a href="https://github.com/openai/codex"><img src="https://github.com/openai.png?size=120" alt="Codex CLI" width="48" height="48" /></a><br/>
|
|
82
|
+
<strong>Codex CLI</strong><br/>
|
|
83
|
+
<sub>MCP server</sub>
|
|
84
|
+
</td>
|
|
85
|
+
<td align="center" width="12.5%">
|
|
86
|
+
<a href="https://github.com/cline/cline"><img src="https://github.com/cline.png?size=120" alt="Cline" width="48" height="48" /></a><br/>
|
|
87
|
+
<strong>Cline</strong><br/>
|
|
88
|
+
<sub>MCP server</sub>
|
|
89
|
+
</td>
|
|
90
|
+
</tr>
|
|
91
|
+
<tr>
|
|
92
|
+
<td align="center" width="12.5%">
|
|
93
|
+
<a href="https://github.com/block/goose"><img src="https://github.com/block.png?size=120" alt="Goose" width="48" height="48" /></a><br/>
|
|
94
|
+
<strong>Goose</strong><br/>
|
|
95
|
+
<sub>MCP server</sub>
|
|
96
|
+
</td>
|
|
97
|
+
<td align="center" width="12.5%">
|
|
98
|
+
<a href="https://github.com/Kilo-Org/kilocode"><img src="https://github.com/Kilo-Org.png?size=120" alt="Kilo Code" width="48" height="48" /></a><br/>
|
|
99
|
+
<strong>Kilo Code</strong><br/>
|
|
100
|
+
<sub>MCP server</sub>
|
|
101
|
+
</td>
|
|
102
|
+
<td align="center" width="12.5%">
|
|
103
|
+
<a href="https://github.com/Aider-AI/aider"><img src="https://github.com/Aider-AI.png?size=120" alt="Aider" width="48" height="48" /></a><br/>
|
|
104
|
+
<strong>Aider</strong><br/>
|
|
105
|
+
<sub>REST API</sub>
|
|
106
|
+
</td>
|
|
107
|
+
<td align="center" width="12.5%">
|
|
108
|
+
<a href="https://claude.ai/download"><img src="https://github.com/anthropics.png?size=120" alt="Claude Desktop" width="48" height="48" /></a><br/>
|
|
109
|
+
<strong>Claude Desktop</strong><br/>
|
|
110
|
+
<sub>MCP server</sub>
|
|
111
|
+
</td>
|
|
112
|
+
<td align="center" width="12.5%">
|
|
113
|
+
<a href="https://windsurf.com"><img src="https://exafunction.github.io/public/brand/windsurf-black-symbol.svg?size=120" alt="Windsurf" width="48" height="48" /></a><br/>
|
|
114
|
+
<strong>Windsurf</strong><br/>
|
|
115
|
+
<sub>MCP server</sub>
|
|
116
|
+
</td>
|
|
117
|
+
<td align="center" width="12.5%">
|
|
118
|
+
<a href="https://github.com/RooCodeInc/Roo-Code"><img src="https://github.com/RooCodeInc.png?size=120" alt="Roo Code" width="48" height="48" /></a><br/>
|
|
119
|
+
<strong>Roo Code</strong><br/>
|
|
120
|
+
<sub>MCP server</sub>
|
|
121
|
+
</td>
|
|
122
|
+
<td align="center" width="12.5%">
|
|
123
|
+
<a href="https://github.com/anthropics/claude-agent-sdk-typescript"><img src="https://github.com/anthropics.png?size=120" alt="Claude SDK" width="48" height="48" /></a><br/>
|
|
124
|
+
<strong>Claude SDK</strong><br/>
|
|
125
|
+
<sub>AgentSDKProvider</sub>
|
|
126
|
+
</td>
|
|
127
|
+
<td align="center" width="12.5%">
|
|
128
|
+
<img src="https://img.shields.io/badge/109-endpoints-1f6feb?style=flat-square" alt="REST API" width="48" /><br/>
|
|
129
|
+
<strong>Any agent</strong><br/>
|
|
130
|
+
<sub>REST API</sub>
|
|
131
|
+
</td>
|
|
132
|
+
</tr>
|
|
133
|
+
</table>
|
|
134
|
+
|
|
135
|
+
<p align="center">
|
|
136
|
+
<sub>Works with <strong>any</strong> agent that speaks MCP or HTTP. One server, memories shared across all of them.</sub>
|
|
137
|
+
</p>
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
35
141
|
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.
|
|
36
142
|
|
|
37
143
|
**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*.
|
|
38
144
|
|
|
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) |
|
|
46
|
-
|
|
47
145
|
```bash
|
|
48
|
-
npx @agentmemory/agentmemory
|
|
146
|
+
npx @agentmemory/agentmemory
|
|
49
147
|
```
|
|
50
148
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## Quick Start
|
|
149
|
+
> **New in v0.8.2** — Security hardening (default localhost, viewer CSP nonces, mesh auth), `agentmemory demo` command, benchmark comparison vs mem0/Letta/Khoj, OpenClaw gateway plugin, real-time token savings in CLI + viewer.
|
|
54
150
|
|
|
55
|
-
|
|
151
|
+
---
|
|
56
152
|
|
|
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
|
-
```
|
|
153
|
+
<h2 id="benchmarks"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-benchmarks.svg"><img src="assets/tags/section-benchmarks.svg" alt="Benchmarks" height="32" /></picture></h2>
|
|
60
154
|
|
|
61
|
-
|
|
155
|
+
<table>
|
|
156
|
+
<tr>
|
|
157
|
+
<td width="50%">
|
|
62
158
|
|
|
63
|
-
###
|
|
159
|
+
### Retrieval Accuracy
|
|
64
160
|
|
|
65
|
-
|
|
161
|
+
**LongMemEval-S** (ICLR 2025, 500 questions)
|
|
66
162
|
|
|
67
|
-
|
|
163
|
+
| System | R@5 | R@10 | MRR |
|
|
164
|
+
|---|---|---|---|
|
|
165
|
+
| **agentmemory** | **95.2%** | **98.6%** | **88.2%** |
|
|
166
|
+
| BM25-only fallback | 86.2% | 94.6% | 71.5% |
|
|
68
167
|
|
|
69
|
-
|
|
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` |
|
|
168
|
+
</td>
|
|
169
|
+
<td width="50%">
|
|
83
170
|
|
|
84
|
-
|
|
171
|
+
### Token Savings
|
|
85
172
|
|
|
86
|
-
|
|
173
|
+
| Approach | Tokens/yr | Cost/yr |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| Paste full context | 19.5M+ | Impossible (exceeds window) |
|
|
176
|
+
| LLM-summarized | ~650K | ~$500 |
|
|
177
|
+
| **agentmemory** | **~170K** | **~$10** |
|
|
178
|
+
| agentmemory + local embeddings | ~170K | **$0** |
|
|
87
179
|
|
|
88
|
-
|
|
180
|
+
</td>
|
|
181
|
+
</tr>
|
|
182
|
+
</table>
|
|
89
183
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
184
|
+
<p align="center">
|
|
185
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-recall.svg"><img src="assets/tags/stat-recall.svg" alt="95.2% retrieval R@5" height="48" /></picture>
|
|
186
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tokens.svg"><img src="assets/tags/stat-tokens.svg" alt="92% fewer tokens" height="48" /></picture>
|
|
187
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tools.svg"><img src="assets/tags/stat-tools.svg" alt="43 MCP tools" height="48" /></picture>
|
|
188
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-hooks.svg"><img src="assets/tags/stat-hooks.svg" alt="12 auto hooks" height="48" /></picture>
|
|
189
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-deps.svg"><img src="assets/tags/stat-deps.svg" alt="0 external DBs" height="48" /></picture>
|
|
190
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tests.svg"><img src="assets/tags/stat-tests.svg" alt="654 tests passing" height="48" /></picture>
|
|
191
|
+
</p>
|
|
95
192
|
|
|
96
|
-
|
|
97
|
-
Agent already knows:
|
|
98
|
-
- Auth uses JWT middleware in src/middleware/auth.ts
|
|
99
|
-
- Tests in test/auth.test.ts cover token validation
|
|
100
|
-
- You chose jose over jsonwebtoken for Edge compatibility
|
|
101
|
-
- The rate limit discussion from last week's debugging session
|
|
102
|
-
Zero re-explaining. Starts working immediately.
|
|
103
|
-
```
|
|
193
|
+
> Embedding model: `all-MiniLM-L6-v2` (local, free, no API key). Full reports: [`benchmark/LONGMEMEVAL.md`](benchmark/LONGMEMEVAL.md), [`benchmark/QUALITY.md`](benchmark/QUALITY.md), [`benchmark/SCALE.md`](benchmark/SCALE.md). Competitor comparison: [`benchmark/COMPARISON.md`](benchmark/COMPARISON.md) — agentmemory vs mem0, Letta, Khoj, claude-mem, Hippo.
|
|
104
194
|
|
|
105
|
-
|
|
195
|
+
---
|
|
106
196
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
197
|
+
<h2 id="vs-competitors"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-competitors.svg"><img src="assets/tags/section-competitors.svg" alt="vs Competitors" height="32" /></picture></h2>
|
|
198
|
+
|
|
199
|
+
<table>
|
|
200
|
+
<tr>
|
|
201
|
+
<th width="20%"></th>
|
|
202
|
+
<th width="20%">agentmemory</th>
|
|
203
|
+
<th width="20%">mem0 (53K ⭐)</th>
|
|
204
|
+
<th width="20%">Letta / MemGPT (22K ⭐)</th>
|
|
205
|
+
<th width="20%">Built-in (CLAUDE.md)</th>
|
|
206
|
+
</tr>
|
|
207
|
+
<tr>
|
|
208
|
+
<td><strong>Type</strong></td>
|
|
209
|
+
<td>Memory engine + MCP server</td>
|
|
210
|
+
<td>Memory layer API</td>
|
|
211
|
+
<td>Full agent runtime</td>
|
|
212
|
+
<td>Static file</td>
|
|
213
|
+
</tr>
|
|
214
|
+
<tr>
|
|
215
|
+
<td><strong>Retrieval R@5</strong></td>
|
|
216
|
+
<td><strong>95.2%</strong></td>
|
|
217
|
+
<td>68.5% (LoCoMo)</td>
|
|
218
|
+
<td>83.2% (LoCoMo)</td>
|
|
219
|
+
<td>N/A (grep)</td>
|
|
220
|
+
</tr>
|
|
221
|
+
<tr>
|
|
222
|
+
<td><strong>Auto-capture</strong></td>
|
|
223
|
+
<td>12 hooks (zero manual effort)</td>
|
|
224
|
+
<td>Manual <code>add()</code> calls</td>
|
|
225
|
+
<td>Agent self-edits</td>
|
|
226
|
+
<td>Manual editing</td>
|
|
227
|
+
</tr>
|
|
228
|
+
<tr>
|
|
229
|
+
<td><strong>Search</strong></td>
|
|
230
|
+
<td>BM25 + Vector + Graph (RRF fusion)</td>
|
|
231
|
+
<td>Vector + Graph</td>
|
|
232
|
+
<td>Vector (archival)</td>
|
|
233
|
+
<td>Loads everything into context</td>
|
|
234
|
+
</tr>
|
|
235
|
+
<tr>
|
|
236
|
+
<td><strong>Multi-agent</strong></td>
|
|
237
|
+
<td>MCP + REST + leases + signals</td>
|
|
238
|
+
<td>API (no coordination)</td>
|
|
239
|
+
<td>Within Letta runtime only</td>
|
|
240
|
+
<td>Per-agent files</td>
|
|
241
|
+
</tr>
|
|
242
|
+
<tr>
|
|
243
|
+
<td><strong>Framework lock-in</strong></td>
|
|
244
|
+
<td>None (any MCP client)</td>
|
|
245
|
+
<td>None</td>
|
|
246
|
+
<td>High (must use Letta)</td>
|
|
247
|
+
<td>Per-agent format</td>
|
|
248
|
+
</tr>
|
|
249
|
+
<tr>
|
|
250
|
+
<td><strong>External deps</strong></td>
|
|
251
|
+
<td>None (SQLite + iii-engine)</td>
|
|
252
|
+
<td>Qdrant / pgvector</td>
|
|
253
|
+
<td>Postgres + vector DB</td>
|
|
254
|
+
<td>None</td>
|
|
255
|
+
</tr>
|
|
256
|
+
<tr>
|
|
257
|
+
<td><strong>Memory lifecycle</strong></td>
|
|
258
|
+
<td>4-tier consolidation + decay + auto-forget</td>
|
|
259
|
+
<td>Passive extraction</td>
|
|
260
|
+
<td>Agent-managed</td>
|
|
261
|
+
<td>Manual pruning</td>
|
|
262
|
+
</tr>
|
|
263
|
+
<tr>
|
|
264
|
+
<td><strong>Token efficiency</strong></td>
|
|
265
|
+
<td>~1,900 tokens/session ($10/yr)</td>
|
|
266
|
+
<td>Varies by integration</td>
|
|
267
|
+
<td>Core memory in context</td>
|
|
268
|
+
<td>22K+ tokens at 240 obs</td>
|
|
269
|
+
</tr>
|
|
270
|
+
<tr>
|
|
271
|
+
<td><strong>Real-time viewer</strong></td>
|
|
272
|
+
<td>Yes (port 3113)</td>
|
|
273
|
+
<td>Cloud dashboard</td>
|
|
274
|
+
<td>Cloud dashboard</td>
|
|
275
|
+
<td>No</td>
|
|
276
|
+
</tr>
|
|
277
|
+
<tr>
|
|
278
|
+
<td><strong>Self-hosted</strong></td>
|
|
279
|
+
<td>Yes (default)</td>
|
|
280
|
+
<td>Optional</td>
|
|
281
|
+
<td>Optional</td>
|
|
282
|
+
<td>Yes</td>
|
|
283
|
+
</tr>
|
|
284
|
+
</table>
|
|
150
285
|
|
|
151
|
-
|
|
286
|
+
---
|
|
152
287
|
|
|
153
|
-
|
|
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 |
|
|
288
|
+
<h2 id="quick-start"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-quickstart.svg"><img src="assets/tags/section-quickstart.svg" alt="Quick Start" height="32" /></picture></h2>
|
|
159
289
|
|
|
160
|
-
###
|
|
290
|
+
### Try it in 30 seconds
|
|
161
291
|
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
|
|
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
|
|
292
|
+
```bash
|
|
293
|
+
# Terminal 1: start the server
|
|
294
|
+
npx @agentmemory/agentmemory
|
|
170
295
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
-> Hybrid search (BM25 + vector + graph) for recent context
|
|
174
|
-
-> Apply token budget (default: 2000 tokens)
|
|
175
|
-
-> Inject into conversation via stdout
|
|
296
|
+
# Terminal 2: seed sample data and see recall in action
|
|
297
|
+
npx @agentmemory/agentmemory demo
|
|
176
298
|
```
|
|
177
299
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
#### LongMemEval-S (ICLR 2025, 500 questions)
|
|
300
|
+
`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.
|
|
181
301
|
|
|
182
|
-
|
|
302
|
+
Open `http://localhost:3113` to watch the memory build live.
|
|
183
303
|
|
|
184
|
-
|
|
185
|
-
|---|---|---|---|---|
|
|
186
|
-
| **agentmemory BM25+Vector** | **95.2%** | **98.6%** | **87.9%** | **88.2%** |
|
|
187
|
-
| agentmemory BM25-only | 86.2% | 94.6% | 73.0% | 71.5% |
|
|
304
|
+
### Claude Code (one block, paste it)
|
|
188
305
|
|
|
189
|
-
|
|
306
|
+
```
|
|
307
|
+
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.
|
|
308
|
+
```
|
|
190
309
|
|
|
191
|
-
|
|
310
|
+
<details>
|
|
311
|
+
<summary><b>OpenClaw (paste this prompt)</b></summary>
|
|
192
312
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
| Built-in (grep all into context) | 55.8% | 80.3% | 82.5% | 19,462 |
|
|
196
|
-
| agentmemory BM25 (stemmed + synonyms) | 55.9% | 82.7% | 95.5% | 1,571 |
|
|
197
|
-
| agentmemory + Xenova embeddings | **64.1%** | **94.9%** | **100.0%** | **1,571** |
|
|
313
|
+
```
|
|
314
|
+
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 43 memory tools:
|
|
198
315
|
|
|
199
|
-
|
|
316
|
+
{
|
|
317
|
+
"mcpServers": {
|
|
318
|
+
"agentmemory": {
|
|
319
|
+
"command": "npx",
|
|
320
|
+
"args": ["-y", "@agentmemory/mcp"]
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
200
324
|
|
|
201
|
-
|
|
325
|
+
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.
|
|
326
|
+
```
|
|
202
327
|
|
|
203
|
-
Full
|
|
328
|
+
Full guide: [`integrations/openclaw/`](integrations/openclaw/)
|
|
204
329
|
|
|
205
|
-
|
|
330
|
+
</details>
|
|
206
331
|
|
|
207
|
-
|
|
332
|
+
<details>
|
|
333
|
+
<summary><b>Hermes Agent (paste this prompt)</b></summary>
|
|
208
334
|
|
|
209
|
-
|
|
335
|
+
```
|
|
336
|
+
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 43 memory tools:
|
|
210
337
|
|
|
211
|
-
|
|
338
|
+
mcp_servers:
|
|
339
|
+
agentmemory:
|
|
340
|
+
command: npx
|
|
341
|
+
args: ["-y", "@agentmemory/mcp"]
|
|
212
342
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
| **Claude Code** | 12 hooks (all types) | `/plugin install agentmemory` or manual hook config |
|
|
216
|
-
| **Claude Code SDK** | Agent SDK provider | Built-in `AgentSDKProvider` uses your Claude subscription |
|
|
343
|
+
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.
|
|
344
|
+
```
|
|
217
345
|
|
|
218
|
-
|
|
346
|
+
Full guide: [`integrations/hermes/`](integrations/hermes/)
|
|
219
347
|
|
|
220
|
-
|
|
348
|
+
</details>
|
|
221
349
|
|
|
222
|
-
|
|
223
|
-
|---|---|
|
|
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) |
|
|
234
|
-
| **Claude Desktop** | Add to `claude_desktop_config.json` MCP servers |
|
|
235
|
-
| **Any MCP client** | Point to `http://localhost:3111/agentmemory/mcp/*` |
|
|
236
|
-
|
|
237
|
-
### REST API (any agent, any language)
|
|
238
|
-
|
|
239
|
-
Agents without hooks or MCP can integrate via 103 REST endpoints directly. This works with any agent, language, or framework.
|
|
350
|
+
### Other agents
|
|
240
351
|
|
|
241
|
-
|
|
242
|
-
POST /agentmemory/observe # Capture what the agent did
|
|
243
|
-
POST /agentmemory/smart-search # Find relevant memories
|
|
244
|
-
POST /agentmemory/context # Get context for injection
|
|
245
|
-
POST /agentmemory/enrich # Get enriched context (files + memories + bugs)
|
|
246
|
-
POST /agentmemory/remember # Save long-term memory
|
|
247
|
-
GET /agentmemory/profile # Get project intelligence
|
|
248
|
-
```
|
|
352
|
+
Start the memory server: `npx @agentmemory/agentmemory`
|
|
249
353
|
|
|
250
|
-
|
|
354
|
+
Then add the MCP config for your agent:
|
|
251
355
|
|
|
252
|
-
|
|
|
356
|
+
| Agent | Setup |
|
|
253
357
|
|---|---|
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
358
|
+
| **Cursor** | Add to `~/.cursor/mcp.json`: `{"mcpServers": {"agentmemory": {"command": "npx", "args": ["-y", "@agentmemory/mcp"]}}}` |
|
|
359
|
+
| **OpenClaw** | Add to MCP config: `{"mcpServers": {"agentmemory": {"command": "npx", "args": ["-y", "@agentmemory/mcp"]}}}` or use the [gateway plugin](integrations/openclaw/) |
|
|
360
|
+
| **Gemini CLI** | `gemini mcp add agentmemory -- npx -y @agentmemory/mcp` |
|
|
361
|
+
| **Codex CLI** | Add to `.codex/config.yaml`: `mcp_servers: {agentmemory: {command: npx, args: ["-y", "@agentmemory/mcp"]}}` |
|
|
362
|
+
| **OpenCode** | Add to `opencode.json`: `{"mcp": {"agentmemory": {"type": "local", "command": ["npx", "-y", "@agentmemory/mcp"], "enabled": true}}}` |
|
|
363
|
+
| **Hermes Agent** | Add to `~/.hermes/config.yaml` or use the [memory provider plugin](integrations/hermes/) |
|
|
364
|
+
| **Cline / Goose / Kilo Code** | Add MCP server in settings |
|
|
365
|
+
| **Claude Desktop** | Add to `claude_desktop_config.json`: `{"mcpServers": {"agentmemory": {"command": "npx", "args": ["-y", "@agentmemory/mcp"]}}}` |
|
|
366
|
+
| **Aider** | REST API: `curl -X POST http://localhost:3111/agentmemory/smart-search -d '{"query": "auth"}'` |
|
|
367
|
+
| **Any agent (32+)** | `npx skillkit install agentmemory` |
|
|
260
368
|
|
|
261
369
|
### From source
|
|
262
370
|
|
|
@@ -265,375 +373,333 @@ git clone https://github.com/rohitg00/agentmemory.git && cd agentmemory
|
|
|
265
373
|
npm install && npm run build && npm start
|
|
266
374
|
```
|
|
267
375
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
Once hooks are installed, memory builds silently. No action needed. Just use your agent normally.
|
|
271
|
-
|
|
272
|
-
### Session 1: Your agent works as usual
|
|
273
|
-
|
|
274
|
-
```text
|
|
275
|
-
You: "Add JWT auth to the Express API"
|
|
276
|
-
Agent: reads files, writes code, runs tests, fixes errors
|
|
277
|
-
```
|
|
376
|
+
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.
|
|
278
377
|
|
|
279
|
-
|
|
378
|
+
Install `iii-engine` manually:
|
|
280
379
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
"type": "file_edit",
|
|
284
|
-
"title": "Implement JWT middleware with jose",
|
|
285
|
-
"facts": ["Using jose library for Edge compatibility", "JWT tokens expire after 30 days", "Middleware in src/middleware/auth.ts"],
|
|
286
|
-
"concepts": ["jwt", "authentication", "jose", "middleware"],
|
|
287
|
-
"files": ["src/middleware/auth.ts", "src/app/api/auth/route.ts"],
|
|
288
|
-
"importance": 9
|
|
289
|
-
}
|
|
290
|
-
```
|
|
380
|
+
- **macOS / Linux:** `curl -fsSL https://install.iii.dev/iii/main/install.sh | sh`
|
|
381
|
+
- **Windows:** download `iii-x86_64-pc-windows-msvc.zip` from [iii-hq/iii releases](https://github.com/iii-hq/iii/releases/latest), extract `iii.exe`, add to PATH
|
|
291
382
|
|
|
292
|
-
|
|
383
|
+
Or use Docker (the bundled `docker-compose.yml` pulls `iiidev/iii:latest`). Full docs: [iii.dev/docs](https://iii.dev/docs).
|
|
293
384
|
|
|
294
|
-
|
|
385
|
+
### Windows
|
|
295
386
|
|
|
296
|
-
|
|
297
|
-
Agent already knows:
|
|
298
|
-
- Auth uses jose JWT middleware in src/middleware/auth.ts
|
|
299
|
-
- Tests in test/auth.test.ts cover token validation
|
|
300
|
-
- You chose jose over jsonwebtoken for Edge compatibility
|
|
301
|
-
- Rate limiting discussion from last week's debugging session
|
|
302
|
-
```
|
|
387
|
+
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:
|
|
303
388
|
|
|
304
|
-
|
|
389
|
+
**Option A — Prebuilt Windows binary (recommended):**
|
|
305
390
|
|
|
306
|
-
|
|
391
|
+
```powershell
|
|
392
|
+
# 1. Open https://github.com/iii-hq/iii/releases/latest in your browser
|
|
393
|
+
# 2. Download iii-x86_64-pc-windows-msvc.zip
|
|
394
|
+
# (or iii-aarch64-pc-windows-msvc.zip if you're on an ARM machine)
|
|
395
|
+
# 3. Extract iii.exe somewhere on PATH, or place it at:
|
|
396
|
+
# %USERPROFILE%\.local\bin\iii.exe
|
|
397
|
+
# (agentmemory checks that location automatically)
|
|
398
|
+
# 4. Verify:
|
|
399
|
+
iii --version
|
|
307
400
|
|
|
308
|
-
|
|
309
|
-
npx @agentmemory/agentmemory
|
|
310
|
-
curl http://localhost:3111/agentmemory/health
|
|
311
|
-
open http://localhost:3113 # real-time viewer
|
|
401
|
+
# 5. Then run agentmemory as usual:
|
|
402
|
+
npx -y @agentmemory/agentmemory
|
|
312
403
|
```
|
|
313
404
|
|
|
314
|
-
|
|
405
|
+
**Option B — Docker Desktop:**
|
|
315
406
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
PostToolUse hook fires
|
|
322
|
-
-> Dedup check SHA-256 hash (5min window, no duplicates)
|
|
323
|
-
-> mem::privacy Strip secrets, API keys, <private> tags
|
|
324
|
-
-> mem::observe Store raw observation, push to real-time stream
|
|
325
|
-
-> mem::compress LLM extracts: type, facts, narrative, concepts, files
|
|
326
|
-
Validates with Zod, scores quality (0-100)
|
|
327
|
-
Self-corrects on validation failure (1 retry)
|
|
328
|
-
Generates vector embedding for semantic search
|
|
407
|
+
```powershell
|
|
408
|
+
# 1. Install Docker Desktop for Windows
|
|
409
|
+
# 2. Start Docker Desktop and make sure the engine is running
|
|
410
|
+
# 3. Run agentmemory — it will auto-start the bundled compose file:
|
|
411
|
+
npx -y @agentmemory/agentmemory
|
|
329
412
|
```
|
|
330
413
|
|
|
331
|
-
|
|
414
|
+
**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:
|
|
332
415
|
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
Inject project profile (top concepts, files, patterns)
|
|
338
|
-
Apply token budget (default: 2000 tokens)
|
|
339
|
-
-> stdout Agent receives context in the conversation
|
|
416
|
+
```powershell
|
|
417
|
+
npx -y @agentmemory/agentmemory mcp
|
|
418
|
+
# or via the shim package:
|
|
419
|
+
npx -y @agentmemory/mcp
|
|
340
420
|
```
|
|
341
421
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
| Hook | Captures |
|
|
345
|
-
|------|----------|
|
|
346
|
-
| `SessionStart` | Project path, session ID, working directory |
|
|
347
|
-
| `UserPromptSubmit` | User prompts (privacy-filtered) |
|
|
348
|
-
| `PreToolUse` | File access patterns + enriched context injection (Read, Write, Edit, Glob, Grep) |
|
|
349
|
-
| `PostToolUse` | Tool name, input, output |
|
|
350
|
-
| `PostToolUseFailure` | Failed tool invocations with error context |
|
|
351
|
-
| `PreCompact` | Re-injects memory context before context compaction |
|
|
352
|
-
| `SubagentStart/Stop` | Sub-agent lifecycle events |
|
|
353
|
-
| `Notification` | System notifications |
|
|
354
|
-
| `TaskCompleted` | Task completion events |
|
|
355
|
-
| `Stop` | Triggers end-of-session summary |
|
|
356
|
-
| `SessionEnd` | Marks session complete |
|
|
357
|
-
|
|
358
|
-
## Search
|
|
422
|
+
**Diagnostics for Windows:** if `npx @agentmemory/agentmemory` fails, re-run with `--verbose` to see the actual engine stderr. Common failure modes:
|
|
359
423
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
|
365
|
-
|
|
366
|
-
| **BM25** | Stemmed keyword matching with synonym expansion and binary-search prefix matching | Always on |
|
|
367
|
-
| **Vector** | Cosine similarity over dense embeddings (Xenova, OpenAI, Gemini, Voyage, Cohere, OpenRouter) | Any embedding provider configured |
|
|
368
|
-
| **Graph** | Knowledge graph traversal via entity matching and co-occurrence edges | Entities detected in query |
|
|
424
|
+
| Symptom | Fix |
|
|
425
|
+
|---|---|
|
|
426
|
+
| `iii-engine process started` then `did not become ready within 15s` | Engine crashed on startup — re-run with `--verbose`, check stderr |
|
|
427
|
+
| `Could not start iii-engine` | Neither `iii.exe` nor Docker is installed. See Option A or B above |
|
|
428
|
+
| Port conflict | `netstat -ano \| findstr :3111` to see what's bound, then kill it or use `--port <N>` |
|
|
429
|
+
| Docker fallback skipped even though Docker is installed | Make sure Docker Desktop is actually running (system tray icon) |
|
|
369
430
|
|
|
370
|
-
|
|
431
|
+
> 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.
|
|
371
432
|
|
|
372
|
-
|
|
433
|
+
---
|
|
373
434
|
|
|
374
|
-
|
|
435
|
+
<h2 id="why-agentmemory"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-why.svg"><img src="assets/tags/section-why.svg" alt="Why agentmemory" height="32" /></picture></h2>
|
|
375
436
|
|
|
376
|
-
|
|
437
|
+
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.
|
|
377
438
|
|
|
378
|
-
```bash
|
|
379
|
-
npm install @xenova/transformers
|
|
380
439
|
```
|
|
440
|
+
Session 1: "Add auth to the API"
|
|
441
|
+
Agent writes code, runs tests, fixes bugs
|
|
442
|
+
agentmemory silently captures every tool use
|
|
443
|
+
Session ends -> observations compressed into structured memory
|
|
381
444
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
| OpenRouter | Any embedding model | varies | `OPENROUTER_API_KEY` | Multi-model proxy |
|
|
390
|
-
|
|
391
|
-
No embedding provider? BM25-only mode with stemming and synonyms still outperforms built-in memory.
|
|
392
|
-
|
|
393
|
-
### Progressive disclosure
|
|
394
|
-
|
|
395
|
-
Smart search returns compact results first (title, type, score, timestamp) to save tokens. Expand specific IDs to get full observation details.
|
|
445
|
+
Session 2: "Now add rate limiting"
|
|
446
|
+
Agent already knows:
|
|
447
|
+
- Auth uses JWT middleware in src/middleware/auth.ts
|
|
448
|
+
- Tests in test/auth.test.ts cover token validation
|
|
449
|
+
- You chose jose over jsonwebtoken for Edge compatibility
|
|
450
|
+
Zero re-explaining. Starts working immediately.
|
|
451
|
+
```
|
|
396
452
|
|
|
397
|
-
|
|
398
|
-
# Compact results (50-100 tokens each)
|
|
399
|
-
curl -X POST http://localhost:3111/agentmemory/smart-search \
|
|
400
|
-
-d '{"query": "database migration"}'
|
|
453
|
+
### vs built-in agent memory
|
|
401
454
|
|
|
402
|
-
|
|
403
|
-
curl -X POST http://localhost:3111/agentmemory/smart-search \
|
|
404
|
-
-d '{"expandIds": ["obs_abc123", "obs_def456"]}'
|
|
405
|
-
```
|
|
455
|
+
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.
|
|
406
456
|
|
|
407
|
-
|
|
457
|
+
| | Built-in (CLAUDE.md) | agentmemory |
|
|
458
|
+
|---|---|---|
|
|
459
|
+
| Scale | 200-line cap | Unlimited |
|
|
460
|
+
| Search | Loads everything into context | BM25 + vector + graph (top-K only) |
|
|
461
|
+
| Token cost | 22K+ at 240 observations | ~1,900 tokens (92% less) |
|
|
462
|
+
| Cross-agent | Per-agent files | MCP + REST (any agent) |
|
|
463
|
+
| Coordination | None | Leases, signals, actions, routines |
|
|
464
|
+
| Observability | Read files manually | Real-time viewer on :3113 |
|
|
408
465
|
|
|
409
|
-
|
|
466
|
+
---
|
|
410
467
|
|
|
411
|
-
|
|
468
|
+
<h2 id="how-it-works"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-how.svg"><img src="assets/tags/section-how.svg" alt="How It Works" height="32" /></picture></h2>
|
|
412
469
|
|
|
413
|
-
|
|
470
|
+
### Memory Pipeline
|
|
414
471
|
|
|
415
472
|
```
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
473
|
+
PostToolUse hook fires
|
|
474
|
+
-> SHA-256 dedup (5min window)
|
|
475
|
+
-> Privacy filter (strip secrets, API keys)
|
|
476
|
+
-> Store raw observation
|
|
477
|
+
-> LLM compress -> structured facts + concepts + narrative
|
|
478
|
+
-> Vector embedding (6 providers + local)
|
|
479
|
+
-> Index in BM25 + vector + knowledge graph
|
|
420
480
|
|
|
421
|
-
|
|
481
|
+
SessionStart hook fires
|
|
482
|
+
-> Load project profile (top concepts, files, patterns)
|
|
483
|
+
-> Hybrid search (BM25 + vector + graph)
|
|
484
|
+
-> Token budget (default: 2000 tokens)
|
|
485
|
+
-> Inject into conversation
|
|
486
|
+
```
|
|
422
487
|
|
|
423
|
-
###
|
|
488
|
+
### 4-Tier Memory Consolidation
|
|
424
489
|
|
|
425
|
-
|
|
490
|
+
Inspired by how human brains process memory — not unlike sleep consolidation.
|
|
426
491
|
|
|
427
|
-
|
|
492
|
+
| Tier | What | Analogy |
|
|
493
|
+
|------|------|---------|
|
|
494
|
+
| **Working** | Raw observations from tool use | Short-term memory |
|
|
495
|
+
| **Episodic** | Compressed session summaries | "What happened" |
|
|
496
|
+
| **Semantic** | Extracted facts and patterns | "What I know" |
|
|
497
|
+
| **Procedural** | Workflows and decision patterns | "How to do it" |
|
|
428
498
|
|
|
429
|
-
|
|
499
|
+
Memories decay over time (Ebbinghaus curve). Frequently accessed memories strengthen. Stale memories auto-evict. Contradictions are detected and resolved.
|
|
430
500
|
|
|
431
|
-
|
|
432
|
-
|---|---|
|
|
433
|
-
| **TTL expiry** | Memories with `forgetAfter` date are deleted when expired |
|
|
434
|
-
| **Contradiction detection** | Near-duplicate memories (Jaccard > 0.9), older one is demoted |
|
|
435
|
-
| **Low-value eviction** | Observations older than 90 days with importance < 3 are removed |
|
|
436
|
-
| **Per-project cap** | Projects are capped at 10,000 observations (lowest importance evicted first) |
|
|
501
|
+
### What Gets Captured
|
|
437
502
|
|
|
438
|
-
|
|
503
|
+
| Hook | Captures |
|
|
504
|
+
|------|----------|
|
|
505
|
+
| `SessionStart` | Project path, session ID |
|
|
506
|
+
| `UserPromptSubmit` | User prompts (privacy-filtered) |
|
|
507
|
+
| `PreToolUse` | File access patterns + enriched context |
|
|
508
|
+
| `PostToolUse` | Tool name, input, output |
|
|
509
|
+
| `PostToolUseFailure` | Error context |
|
|
510
|
+
| `PreCompact` | Re-injects memory before compaction |
|
|
511
|
+
| `SubagentStart/Stop` | Sub-agent lifecycle |
|
|
512
|
+
| `Stop` | End-of-session summary |
|
|
513
|
+
| `SessionEnd` | Session complete marker |
|
|
439
514
|
|
|
440
|
-
###
|
|
515
|
+
### Key Capabilities
|
|
441
516
|
|
|
442
|
-
|
|
517
|
+
| Capability | Description |
|
|
518
|
+
|---|---|
|
|
519
|
+
| **Automatic capture** | Every tool use recorded via hooks — zero manual effort |
|
|
520
|
+
| **Semantic search** | BM25 + vector + knowledge graph with RRF fusion |
|
|
521
|
+
| **Memory evolution** | Versioning, supersession, relationship graphs |
|
|
522
|
+
| **Auto-forgetting** | TTL expiry, contradiction detection, importance eviction |
|
|
523
|
+
| **Privacy first** | API keys, secrets, `<private>` tags stripped before storage |
|
|
524
|
+
| **Self-healing** | Circuit breaker, provider fallback chain, health monitoring |
|
|
525
|
+
| **Claude bridge** | Bi-directional sync with MEMORY.md |
|
|
526
|
+
| **Knowledge graph** | Entity extraction + BFS traversal |
|
|
527
|
+
| **Team memory** | Namespaced shared + private across team members |
|
|
528
|
+
| **Citation provenance** | Trace any memory back to source observations |
|
|
529
|
+
| **Git snapshots** | Version, rollback, and diff memory state |
|
|
443
530
|
|
|
444
|
-
|
|
445
|
-
curl "http://localhost:3111/agentmemory/profile?project=/my/project"
|
|
446
|
-
```
|
|
531
|
+
---
|
|
447
532
|
|
|
448
|
-
|
|
533
|
+
<h2 id="search"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-search.svg"><img src="assets/tags/section-search.svg" alt="Search" height="32" /></picture></h2>
|
|
449
534
|
|
|
450
|
-
|
|
535
|
+
Triple-stream retrieval combining three signals:
|
|
451
536
|
|
|
452
|
-
|
|
537
|
+
| Stream | What it does | When |
|
|
538
|
+
|---|---|---|
|
|
539
|
+
| **BM25** | Stemmed keyword matching with synonym expansion | Always on |
|
|
540
|
+
| **Vector** | Cosine similarity over dense embeddings | Embedding provider configured |
|
|
541
|
+
| **Graph** | Knowledge graph traversal via entity matching | Entities detected in query |
|
|
453
542
|
|
|
454
|
-
|
|
455
|
-
curl -X POST http://localhost:3111/agentmemory/timeline \
|
|
456
|
-
-d '{"anchor": "2026-02-15", "before": 5, "after": 5}'
|
|
457
|
-
```
|
|
543
|
+
Fused with Reciprocal Rank Fusion (RRF, k=60) and session-diversified (max 3 results per session).
|
|
458
544
|
|
|
459
|
-
###
|
|
545
|
+
### Embedding providers
|
|
460
546
|
|
|
461
|
-
|
|
547
|
+
agentmemory auto-detects your provider. For best results, install local embeddings (free):
|
|
462
548
|
|
|
463
549
|
```bash
|
|
464
|
-
|
|
465
|
-
curl http://localhost:3111/agentmemory/export > backup.json
|
|
466
|
-
|
|
467
|
-
# Import with merge strategy
|
|
468
|
-
curl -X POST http://localhost:3111/agentmemory/import \
|
|
469
|
-
-d '{"exportData": ..., "strategy": "merge"}'
|
|
550
|
+
npm install @xenova/transformers
|
|
470
551
|
```
|
|
471
552
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
553
|
+
| Provider | Model | Cost | Notes |
|
|
554
|
+
|---|---|---|---|
|
|
555
|
+
| **Local (recommended)** | `all-MiniLM-L6-v2` | Free | Offline, +8pp recall over BM25-only |
|
|
556
|
+
| Gemini | `text-embedding-004` | Free tier | 1500 RPM |
|
|
557
|
+
| OpenAI | `text-embedding-3-small` | $0.02/1M | Highest quality |
|
|
558
|
+
| Voyage AI | `voyage-code-3` | Paid | Optimized for code |
|
|
559
|
+
| Cohere | `embed-english-v3.0` | Free trial | General purpose |
|
|
560
|
+
| OpenRouter | Any model | Varies | Multi-model proxy |
|
|
479
561
|
|
|
480
|
-
|
|
562
|
+
---
|
|
481
563
|
|
|
482
|
-
|
|
564
|
+
<h2 id="mcp-server"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-mcp.svg"><img src="assets/tags/section-mcp.svg" alt="MCP Server" height="32" /></picture></h2>
|
|
483
565
|
|
|
484
|
-
|
|
566
|
+
43 tools, 6 resources, 3 prompts, and 4 skills — the most comprehensive MCP memory toolkit for any agent.
|
|
485
567
|
|
|
486
|
-
###
|
|
568
|
+
### 43 Tools
|
|
487
569
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
-> Circuit breaker opens (3 failures in 60s)
|
|
491
|
-
-> Falls back to next provider in FALLBACK_PROVIDERS chain
|
|
492
|
-
-> 30s cooldown -> half-open -> test call -> recovery
|
|
493
|
-
```
|
|
570
|
+
<details>
|
|
571
|
+
<summary>Core tools (always available)</summary>
|
|
494
572
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
573
|
+
| Tool | Description |
|
|
574
|
+
|------|-------------|
|
|
575
|
+
| `memory_recall` | Search past observations |
|
|
576
|
+
| `memory_save` | Save an insight, decision, or pattern |
|
|
577
|
+
| `memory_smart_search` | Hybrid semantic + keyword search |
|
|
578
|
+
| `memory_file_history` | Past observations about specific files |
|
|
579
|
+
| `memory_sessions` | List recent sessions |
|
|
580
|
+
| `memory_profile` | Project profile (concepts, files, patterns) |
|
|
581
|
+
| `memory_export` | Export all memory data |
|
|
500
582
|
|
|
501
|
-
|
|
583
|
+
</details>
|
|
502
584
|
|
|
503
|
-
|
|
585
|
+
<details>
|
|
586
|
+
<summary>Extended tools (43 total — set AGENTMEMORY_TOOLS=all)</summary>
|
|
504
587
|
|
|
505
588
|
| Tool | Description |
|
|
506
589
|
|------|-------------|
|
|
507
|
-
| `
|
|
508
|
-
| `
|
|
509
|
-
| `
|
|
510
|
-
| `
|
|
511
|
-
| `
|
|
512
|
-
| `
|
|
513
|
-
| `
|
|
514
|
-
| `
|
|
515
|
-
| `
|
|
516
|
-
| `
|
|
517
|
-
| `
|
|
518
|
-
| `
|
|
519
|
-
| `
|
|
520
|
-
| `
|
|
521
|
-
| `
|
|
522
|
-
| `
|
|
523
|
-
| `
|
|
524
|
-
| `
|
|
525
|
-
| `
|
|
526
|
-
| `
|
|
527
|
-
| `
|
|
528
|
-
| `
|
|
529
|
-
| `
|
|
530
|
-
| `
|
|
531
|
-
| `
|
|
532
|
-
| `
|
|
533
|
-
| `
|
|
534
|
-
| `
|
|
535
|
-
| `
|
|
536
|
-
| `
|
|
537
|
-
| `
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
|
549
|
-
|
|
550
|
-
| `
|
|
551
|
-
| `
|
|
552
|
-
|
|
|
553
|
-
|
|
|
554
|
-
|
|
|
555
|
-
|
|
|
556
|
-
|
|
557
|
-
###
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|--------|-----------|-------------|
|
|
561
|
-
| `recall_context` | `task_description` | Searches observations + memories, returns context messages |
|
|
562
|
-
| `session_handoff` | `session_id` | Returns session data + summary for handoff between agents |
|
|
563
|
-
| `detect_patterns` | `project` (optional) | Analyzes recurring patterns across sessions |
|
|
564
|
-
|
|
565
|
-
### Standalone MCP Server
|
|
566
|
-
|
|
567
|
-
Run agentmemory as a standalone MCP server for any MCP-compatible agent (Cursor, Gemini CLI, OpenCode, Claude Desktop, Cline):
|
|
590
|
+
| `memory_patterns` | Detect recurring patterns |
|
|
591
|
+
| `memory_timeline` | Chronological observations |
|
|
592
|
+
| `memory_relations` | Query relationship graph |
|
|
593
|
+
| `memory_graph_query` | Knowledge graph traversal |
|
|
594
|
+
| `memory_consolidate` | Run 4-tier consolidation |
|
|
595
|
+
| `memory_claude_bridge_sync` | Sync with MEMORY.md |
|
|
596
|
+
| `memory_team_share` | Share with team members |
|
|
597
|
+
| `memory_team_feed` | Recent shared items |
|
|
598
|
+
| `memory_audit` | Audit trail of operations |
|
|
599
|
+
| `memory_governance_delete` | Delete with audit trail |
|
|
600
|
+
| `memory_snapshot_create` | Git-versioned snapshot |
|
|
601
|
+
| `memory_action_create` | Create work items with dependencies |
|
|
602
|
+
| `memory_action_update` | Update action status |
|
|
603
|
+
| `memory_frontier` | Unblocked actions ranked by priority |
|
|
604
|
+
| `memory_next` | Single most important next action |
|
|
605
|
+
| `memory_lease` | Exclusive action leases (multi-agent) |
|
|
606
|
+
| `memory_routine_run` | Instantiate workflow routines |
|
|
607
|
+
| `memory_signal_send` | Inter-agent messaging |
|
|
608
|
+
| `memory_signal_read` | Read messages with receipts |
|
|
609
|
+
| `memory_checkpoint` | External condition gates |
|
|
610
|
+
| `memory_mesh_sync` | P2P sync between instances |
|
|
611
|
+
| `memory_sentinel_create` | Event-driven watchers |
|
|
612
|
+
| `memory_sentinel_trigger` | Fire sentinels externally |
|
|
613
|
+
| `memory_sketch_create` | Ephemeral action graphs |
|
|
614
|
+
| `memory_sketch_promote` | Promote to permanent |
|
|
615
|
+
| `memory_crystallize` | Compact action chains |
|
|
616
|
+
| `memory_diagnose` | Health checks |
|
|
617
|
+
| `memory_heal` | Auto-fix stuck state |
|
|
618
|
+
| `memory_facet_tag` | Dimension:value tags |
|
|
619
|
+
| `memory_facet_query` | Query by facet tags |
|
|
620
|
+
| `memory_verify` | Trace provenance |
|
|
621
|
+
|
|
622
|
+
</details>
|
|
623
|
+
|
|
624
|
+
### 6 Resources · 3 Prompts · 4 Skills
|
|
625
|
+
|
|
626
|
+
| Type | Name | Description |
|
|
627
|
+
|------|------|-------------|
|
|
628
|
+
| Resource | `agentmemory://status` | Health, session count, memory count |
|
|
629
|
+
| Resource | `agentmemory://project/{name}/profile` | Per-project intelligence |
|
|
630
|
+
| Resource | `agentmemory://memories/latest` | Latest 10 active memories |
|
|
631
|
+
| Resource | `agentmemory://graph/stats` | Knowledge graph statistics |
|
|
632
|
+
| Prompt | `recall_context` | Search + return context messages |
|
|
633
|
+
| Prompt | `session_handoff` | Handoff data between agents |
|
|
634
|
+
| Prompt | `detect_patterns` | Analyze recurring patterns |
|
|
635
|
+
| Skill | `/recall` | Search memory |
|
|
636
|
+
| Skill | `/remember` | Save to long-term memory |
|
|
637
|
+
| Skill | `/session-history` | Recent session summaries |
|
|
638
|
+
| Skill | `/forget` | Delete observations/sessions |
|
|
639
|
+
|
|
640
|
+
### Standalone MCP
|
|
641
|
+
|
|
642
|
+
Run without the full server — for any MCP client. Either of these works:
|
|
568
643
|
|
|
569
644
|
```bash
|
|
570
|
-
npx agentmemory
|
|
645
|
+
npx -y @agentmemory/agentmemory mcp # canonical (always available)
|
|
646
|
+
npx -y @agentmemory/mcp # shim package alias
|
|
571
647
|
```
|
|
572
648
|
|
|
573
649
|
Or add to your agent's MCP config:
|
|
574
650
|
|
|
651
|
+
Most agents (Cursor, Claude Desktop, Cline, etc.):
|
|
575
652
|
```json
|
|
576
653
|
{
|
|
577
654
|
"mcpServers": {
|
|
578
655
|
"agentmemory": {
|
|
579
656
|
"command": "npx",
|
|
580
|
-
"args": ["agentmemory
|
|
657
|
+
"args": ["-y", "@agentmemory/mcp"]
|
|
581
658
|
}
|
|
582
659
|
}
|
|
583
660
|
}
|
|
584
661
|
```
|
|
585
662
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
663
|
+
OpenCode (`opencode.json`):
|
|
664
|
+
```json
|
|
665
|
+
{
|
|
666
|
+
"mcp": {
|
|
667
|
+
"agentmemory": {
|
|
668
|
+
"type": "local",
|
|
669
|
+
"command": ["npx", "-y", "@agentmemory/mcp"],
|
|
670
|
+
"enabled": true
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
597
674
|
```
|
|
598
675
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
Four slash commands for interacting with memory:
|
|
676
|
+
---
|
|
602
677
|
|
|
603
|
-
|
|
604
|
-
|-------|-------|
|
|
605
|
-
| `/recall` | Search memory for past context (`/recall auth middleware`) |
|
|
606
|
-
| `/remember` | Save something to long-term memory (`/remember always use jose for JWT`) |
|
|
607
|
-
| `/session-history` | Show recent session summaries |
|
|
608
|
-
| `/forget` | Delete specific observations or entire sessions |
|
|
678
|
+
<h2 id="real-time-viewer"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-viewer.svg"><img src="assets/tags/section-viewer.svg" alt="Real-Time Viewer" height="32" /></picture></h2>
|
|
609
679
|
|
|
610
|
-
|
|
680
|
+
Auto-starts on port `3113`. Live observation stream, session explorer, memory browser, knowledge graph visualization, and health dashboard.
|
|
611
681
|
|
|
612
|
-
|
|
682
|
+
```bash
|
|
683
|
+
open http://localhost:3113
|
|
684
|
+
```
|
|
613
685
|
|
|
614
|
-
-
|
|
615
|
-
- Session explorer with observation details
|
|
616
|
-
- Memory browser with search and filtering
|
|
617
|
-
- Knowledge graph visualization
|
|
618
|
-
- Health and metrics dashboard
|
|
686
|
+
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'`).
|
|
619
687
|
|
|
620
|
-
|
|
688
|
+
---
|
|
621
689
|
|
|
622
|
-
|
|
690
|
+
<h2 id="configuration"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-config.svg"><img src="assets/tags/section-config.svg" alt="Configuration" height="32" /></picture></h2>
|
|
623
691
|
|
|
624
692
|
### LLM Providers
|
|
625
693
|
|
|
626
|
-
agentmemory
|
|
694
|
+
agentmemory auto-detects from your environment. No API key needed if you have a Claude subscription.
|
|
627
695
|
|
|
628
696
|
| Provider | Config | Notes |
|
|
629
697
|
|----------|--------|-------|
|
|
630
|
-
| **Claude subscription** (default) | No config needed | Uses `@anthropic-ai/claude-agent-sdk
|
|
631
|
-
|
|
|
632
|
-
|
|
|
633
|
-
|
|
|
634
|
-
|
|
|
635
|
-
|
|
636
|
-
No API key? agentmemory uses your Claude subscription automatically. Zero config.
|
|
698
|
+
| **Claude subscription** (default) | No config needed | Uses `@anthropic-ai/claude-agent-sdk` |
|
|
699
|
+
| Anthropic API | `ANTHROPIC_API_KEY` | Per-token billing |
|
|
700
|
+
| MiniMax | `MINIMAX_API_KEY` | Anthropic-compatible |
|
|
701
|
+
| Gemini | `GEMINI_API_KEY` | Also enables embeddings |
|
|
702
|
+
| OpenRouter | `OPENROUTER_API_KEY` | Any model |
|
|
637
703
|
|
|
638
704
|
### Environment Variables
|
|
639
705
|
|
|
@@ -641,262 +707,106 @@ Create `~/.agentmemory/.env`:
|
|
|
641
707
|
|
|
642
708
|
```env
|
|
643
709
|
# LLM provider (pick one, or leave empty for Claude subscription)
|
|
644
|
-
ANTHROPIC_API_KEY=sk-ant-...
|
|
645
|
-
# ANTHROPIC_BASE_URL=https://custom-endpoint.example.com
|
|
646
|
-
# MINIMAX_API_KEY=...
|
|
647
|
-
# MINIMAX_MODEL=MiniMax-M2.7
|
|
710
|
+
# ANTHROPIC_API_KEY=sk-ant-...
|
|
648
711
|
# GEMINI_API_KEY=...
|
|
649
712
|
# OPENROUTER_API_KEY=...
|
|
650
713
|
|
|
651
|
-
# Embedding provider (auto-detected
|
|
652
|
-
# EMBEDDING_PROVIDER=
|
|
714
|
+
# Embedding provider (auto-detected, or override)
|
|
715
|
+
# EMBEDDING_PROVIDER=local
|
|
653
716
|
# VOYAGE_API_KEY=...
|
|
654
|
-
# OPENAI_API_KEY=...
|
|
655
|
-
# COHERE_API_KEY=...
|
|
656
717
|
|
|
657
|
-
#
|
|
718
|
+
# Search tuning
|
|
658
719
|
# BM25_WEIGHT=0.4
|
|
659
720
|
# VECTOR_WEIGHT=0.6
|
|
660
|
-
|
|
661
|
-
# Provider fallback chain (comma-separated, tried in order)
|
|
662
|
-
# FALLBACK_PROVIDERS=anthropic,minimax,gemini,openrouter
|
|
663
|
-
|
|
664
|
-
# Bearer token for API auth
|
|
665
|
-
# AGENTMEMORY_SECRET=your-secret-here
|
|
666
|
-
|
|
667
|
-
# Engine connection
|
|
668
|
-
# III_ENGINE_URL=ws://localhost:49134
|
|
669
|
-
# III_REST_PORT=3111
|
|
670
|
-
# III_STREAMS_PORT=3112
|
|
671
|
-
# Viewer runs on III_REST_PORT + 2 (default: 3113)
|
|
672
|
-
|
|
673
|
-
# Memory tuning
|
|
674
721
|
# TOKEN_BUDGET=2000
|
|
675
|
-
# MAX_OBS_PER_SESSION=500
|
|
676
722
|
|
|
677
|
-
#
|
|
678
|
-
#
|
|
679
|
-
# CLAUDE_MEMORY_LINE_BUDGET=200
|
|
723
|
+
# Auth
|
|
724
|
+
# AGENTMEMORY_SECRET=your-secret
|
|
680
725
|
|
|
681
|
-
#
|
|
682
|
-
#
|
|
683
|
-
# STANDALONE_PERSIST_PATH=~/.agentmemory/standalone.json
|
|
726
|
+
# Ports (defaults: 3111 API, 3113 viewer)
|
|
727
|
+
# III_REST_PORT=3111
|
|
684
728
|
|
|
685
|
-
#
|
|
729
|
+
# Features
|
|
686
730
|
# GRAPH_EXTRACTION_ENABLED=false
|
|
687
|
-
# GRAPH_EXTRACTION_BATCH_SIZE=10
|
|
688
|
-
|
|
689
|
-
# Consolidation Pipeline (v0.5.0)
|
|
690
731
|
# CONSOLIDATION_ENABLED=true
|
|
691
|
-
# CONSOLIDATION_DECAY_DAYS=30
|
|
692
|
-
|
|
693
|
-
# Lesson Decay (v0.7.0)
|
|
694
732
|
# LESSON_DECAY_ENABLED=true
|
|
695
|
-
|
|
696
|
-
# Obsidian Export (v0.7.0)
|
|
697
733
|
# OBSIDIAN_AUTO_EXPORT=false
|
|
734
|
+
# AGENTMEMORY_EXPORT_ROOT=~/.agentmemory
|
|
735
|
+
# CLAUDE_MEMORY_BRIDGE=false
|
|
736
|
+
# SNAPSHOT_ENABLED=false
|
|
698
737
|
|
|
699
|
-
#
|
|
700
|
-
# AGENTMEMORY_TOOLS=core
|
|
701
|
-
|
|
702
|
-
# Team Memory (v0.5.0)
|
|
738
|
+
# Team
|
|
703
739
|
# TEAM_ID=
|
|
704
740
|
# USER_ID=
|
|
705
741
|
# TEAM_MODE=private
|
|
706
742
|
|
|
707
|
-
#
|
|
708
|
-
#
|
|
709
|
-
# SNAPSHOT_INTERVAL=3600
|
|
710
|
-
# SNAPSHOT_DIR=~/.agentmemory/snapshots
|
|
743
|
+
# Tool visibility: "core" (7 tools) or "all" (43 tools)
|
|
744
|
+
# AGENTMEMORY_TOOLS=core
|
|
711
745
|
```
|
|
712
746
|
|
|
713
|
-
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
<h2 id="api"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-api.svg"><img src="assets/tags/section-api.svg" alt="API" height="32" /></picture></h2>
|
|
750
|
+
|
|
751
|
+
109 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.
|
|
714
752
|
|
|
715
|
-
|
|
753
|
+
<details>
|
|
754
|
+
<summary>Key endpoints</summary>
|
|
716
755
|
|
|
717
756
|
| Method | Path | Description |
|
|
718
757
|
|--------|------|-------------|
|
|
719
|
-
| `GET` | `/agentmemory/health` | Health check
|
|
720
|
-
| `GET` | `/agentmemory/livez` | Liveness probe (always public) |
|
|
758
|
+
| `GET` | `/agentmemory/health` | Health check (always public) |
|
|
721
759
|
| `POST` | `/agentmemory/session/start` | Start session + get context |
|
|
722
|
-
| `POST` | `/agentmemory/session/end` |
|
|
760
|
+
| `POST` | `/agentmemory/session/end` | End session |
|
|
723
761
|
| `POST` | `/agentmemory/observe` | Capture observation |
|
|
762
|
+
| `POST` | `/agentmemory/smart-search` | Hybrid search |
|
|
724
763
|
| `POST` | `/agentmemory/context` | Generate context |
|
|
725
|
-
| `POST` | `/agentmemory/search` | Search observations (BM25). Optional `project`/`cwd` filters |
|
|
726
|
-
| `POST` | `/agentmemory/smart-search` | Hybrid search with progressive disclosure |
|
|
727
|
-
| `POST` | `/agentmemory/summarize` | Generate session summary |
|
|
728
764
|
| `POST` | `/agentmemory/remember` | Save to long-term memory |
|
|
729
|
-
| `POST` | `/agentmemory/forget` | Delete observations
|
|
730
|
-
| `POST` | `/agentmemory/
|
|
731
|
-
| `
|
|
732
|
-
| `
|
|
733
|
-
| `POST` | `/agentmemory/
|
|
734
|
-
| `POST` | `/agentmemory/
|
|
735
|
-
| `POST` | `/agentmemory/
|
|
736
|
-
| `
|
|
737
|
-
| `POST` | `/agentmemory/timeline` | Chronological observations around anchor |
|
|
738
|
-
| `POST` | `/agentmemory/relations` | Create memory relationship (with confidence) |
|
|
739
|
-
| `POST` | `/agentmemory/evolve` | Evolve memory (new version) |
|
|
740
|
-
| `POST` | `/agentmemory/auto-forget` | Run auto-forget (`?dryRun=true`) |
|
|
741
|
-
| `POST` | `/agentmemory/import` | Import data from JSON |
|
|
742
|
-
| `GET` | `/agentmemory/profile` | Project profile (`?project=/path`) |
|
|
743
|
-
| `GET` | `/agentmemory/export` | Export all data as JSON |
|
|
744
|
-
| `GET` | `/agentmemory/sessions` | List all sessions |
|
|
745
|
-
| `GET` | `/agentmemory/observations` | Session observations (`?sessionId=X`) |
|
|
746
|
-
| `GET` | `/agentmemory/viewer` | Real-time web viewer (also at `http://localhost:3113`) |
|
|
747
|
-
| `GET` | `/agentmemory/claude-bridge/read` | Read Claude Code native MEMORY.md |
|
|
748
|
-
| `POST` | `/agentmemory/claude-bridge/sync` | Sync memories to MEMORY.md |
|
|
749
|
-
| `POST` | `/agentmemory/graph/query` | Query knowledge graph (BFS traversal) |
|
|
750
|
-
| `GET` | `/agentmemory/graph/stats` | Knowledge graph node/edge counts |
|
|
751
|
-
| `POST` | `/agentmemory/graph/extract` | Extract entities from observations |
|
|
752
|
-
| `POST` | `/agentmemory/consolidate-pipeline` | Run 4-tier consolidation pipeline |
|
|
753
|
-
| `POST` | `/agentmemory/team/share` | Share memory with team members |
|
|
754
|
-
| `GET` | `/agentmemory/team/feed` | Recent shared items from team |
|
|
755
|
-
| `GET` | `/agentmemory/team/profile` | Aggregated team memory profile |
|
|
756
|
-
| `GET` | `/agentmemory/audit` | Query audit trail (`?operation=X&limit=N`) |
|
|
757
|
-
| `DELETE` | `/agentmemory/governance/memories` | Delete specific memories with audit |
|
|
758
|
-
| `POST` | `/agentmemory/governance/bulk-delete` | Bulk delete by type/date/quality |
|
|
759
|
-
| `GET` | `/agentmemory/snapshots` | List git snapshots |
|
|
760
|
-
| `POST` | `/agentmemory/snapshot/create` | Create git-versioned snapshot |
|
|
761
|
-
| `POST` | `/agentmemory/snapshot/restore` | Restore from snapshot commit |
|
|
762
|
-
| `POST` | `/agentmemory/lessons` | Save a lesson (returns 201 if created, 200 if strengthened) |
|
|
763
|
-
| `GET` | `/agentmemory/lessons` | List lessons (`?project=X&minConfidence=0.5`) |
|
|
764
|
-
| `POST` | `/agentmemory/lessons/search` | Search lessons by query |
|
|
765
|
-
| `POST` | `/agentmemory/lessons/strengthen` | Reinforce a lesson's confidence |
|
|
766
|
-
| `POST` | `/agentmemory/obsidian/export` | Export vault as Obsidian Markdown |
|
|
767
|
-
| `GET` | `/agentmemory/mcp/tools` | List MCP tools |
|
|
768
|
-
| `POST` | `/agentmemory/mcp/call` | Execute MCP tool |
|
|
769
|
-
| `GET` | `/agentmemory/mcp/resources` | List MCP resources |
|
|
770
|
-
| `POST` | `/agentmemory/mcp/resources/read` | Read MCP resource by URI |
|
|
771
|
-
| `GET` | `/agentmemory/mcp/prompts` | List MCP prompts |
|
|
772
|
-
| `POST` | `/agentmemory/mcp/prompts/get` | Get MCP prompt with arguments |
|
|
773
|
-
|
|
774
|
-
## Plugin Install
|
|
775
|
-
|
|
776
|
-
### From Marketplace (recommended)
|
|
765
|
+
| `POST` | `/agentmemory/forget` | Delete observations |
|
|
766
|
+
| `POST` | `/agentmemory/enrich` | File context + memories + bugs |
|
|
767
|
+
| `GET` | `/agentmemory/profile` | Project profile |
|
|
768
|
+
| `GET` | `/agentmemory/export` | Export all data |
|
|
769
|
+
| `POST` | `/agentmemory/import` | Import from JSON |
|
|
770
|
+
| `POST` | `/agentmemory/graph/query` | Knowledge graph query |
|
|
771
|
+
| `POST` | `/agentmemory/team/share` | Share with team |
|
|
772
|
+
| `GET` | `/agentmemory/audit` | Audit trail |
|
|
777
773
|
|
|
778
|
-
|
|
779
|
-
/plugin marketplace add rohitg00/agentmemory
|
|
780
|
-
/plugin install agentmemory
|
|
781
|
-
```
|
|
774
|
+
Full endpoint list: [`src/triggers/api.ts`](src/triggers/api.ts)
|
|
782
775
|
|
|
783
|
-
|
|
776
|
+
</details>
|
|
784
777
|
|
|
785
|
-
|
|
778
|
+
---
|
|
786
779
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
/plugin enable agentmemory # Re-enable
|
|
791
|
-
/plugin uninstall agentmemory # Remove
|
|
792
|
-
```
|
|
780
|
+
<h2 id="architecture"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-architecture.svg"><img src="assets/tags/section-architecture.svg" alt="Architecture" height="32" /></picture></h2>
|
|
781
|
+
|
|
782
|
+
Built on [iii-engine](https://iii.dev)'s three primitives — no Express, no Postgres, no Redis.
|
|
793
783
|
|
|
794
|
-
|
|
784
|
+
**118 source files · ~21,800 LOC · 646 tests · 123 functions · 34 KV scopes**
|
|
795
785
|
|
|
796
|
-
|
|
786
|
+
<details>
|
|
787
|
+
<summary>What iii-engine replaces</summary>
|
|
797
788
|
|
|
798
|
-
|
|
|
789
|
+
| Traditional stack | agentmemory uses |
|
|
799
790
|
|---|---|
|
|
800
791
|
| Express.js / Fastify | iii HTTP Triggers |
|
|
801
792
|
| SQLite / Postgres + pgvector | iii KV State + in-memory vector index |
|
|
802
793
|
| SSE / Socket.io | iii Streams (WebSocket) |
|
|
803
794
|
| pm2 / systemd | iii-engine worker management |
|
|
804
|
-
| Prometheus / Grafana | iii OTEL +
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
### Functions (123 mem:: functions)
|
|
810
|
-
|
|
811
|
-
| Category | Functions | Purpose |
|
|
812
|
-
|----------|-----------|---------|
|
|
813
|
-
| **Core Memory** | `observe`, `compress`, `search`, `smart-search` | Capture, compress, and search observations |
|
|
814
|
-
| | `context`, `summarize`, `remember`, `forget` | Build context, generate summaries, save/delete memories |
|
|
815
|
-
| | `file-context`, `enrich`, `patterns`, `generate-rules` | File history, enrichment, pattern detection, rule generation |
|
|
816
|
-
| | `migrate`, `export`, `import` | SQLite migration, JSON round-trip (v0.3.0–v0.7.2) |
|
|
817
|
-
| **Search** | `expand-query`, `sliding-window`, `graph-retrieval` | Query reformulations, context enrichment, entity-based retrieval |
|
|
818
|
-
| | `retention-score`, `retention-evict` | Ebbinghaus decay with tiered storage (hot/warm/cold) |
|
|
819
|
-
| **Memory Evolution** | `evolve`, `auto-forget`, `evict` | Version memories, TTL expiry, importance-based eviction |
|
|
820
|
-
| | `consolidate`, `consolidate-pipeline` | Merge duplicates, 4-tier consolidation (working→episodic→semantic→procedural) |
|
|
821
|
-
| | `verify`, `cascade-update` | Citation chain provenance, staleness propagation |
|
|
822
|
-
| **Knowledge Graph** | `graph-extract`, `graph-query`, `graph-stats` | LLM entity extraction, BFS traversal, statistics |
|
|
823
|
-
| | `temporal-graph-extract`, `temporal-query` | Temporal knowledge extraction + point-in-time queries |
|
|
824
|
-
| **Relationships** | `relate`, `get-related`, `timeline`, `profile` | Memory relations, chronological view, project profiles |
|
|
825
|
-
| **Claude Bridge** | `claude-bridge-read`, `claude-bridge-sync` | Bi-directional sync with MEMORY.md |
|
|
826
|
-
| **Actions** | `action-create`, `action-update`, `action-get`, `action-list` | Dependency-aware work items with typed edges |
|
|
827
|
-
| | `action-edge-create` | Create typed edges between actions (requires, unlocks, gated_by) |
|
|
828
|
-
| | `frontier`, `next` | Priority-ranked unblocked action queue |
|
|
829
|
-
| **Leases** | `lease-acquire`, `lease-release`, `lease-renew`, `lease-cleanup` | TTL-based atomic agent claims with auto-cleanup |
|
|
830
|
-
| **Routines** | `routine-create`, `routine-freeze`, `routine-list`, `routine-run`, `routine-status` | Frozen workflow templates instantiated into action chains |
|
|
831
|
-
| **Signals** | `signal-send`, `signal-read`, `signal-threads`, `signal-cleanup` | Threaded inter-agent messaging with read receipts |
|
|
832
|
-
| **Checkpoints** | `checkpoint-create`, `checkpoint-resolve`, `checkpoint-list`, `checkpoint-expire` | External condition gates (CI, approval, deploy) |
|
|
833
|
-
| **Mesh** | `mesh-register`, `mesh-sync`, `mesh-receive`, `mesh-list`, `mesh-remove` | P2P sync between agentmemory instances |
|
|
834
|
-
| **Sentinels** | `sentinel-create`, `sentinel-trigger`, `sentinel-check`, `sentinel-cancel`, `sentinel-list`, `sentinel-expire` | Event-driven condition watchers |
|
|
835
|
-
| **Sketches** | `sketch-create`, `sketch-add`, `sketch-promote`, `sketch-discard`, `sketch-list`, `sketch-gc` | Ephemeral action graphs with auto-expiry |
|
|
836
|
-
| **Crystals** | `crystallize`, `auto-crystallize`, `crystal-list`, `crystal-get` | LLM-powered compaction of action chains into digests |
|
|
837
|
-
| **Lessons** | `lesson-save`, `lesson-recall`, `lesson-list`, `lesson-strengthen`, `lesson-decay-sweep` | Confidence-scored lessons with dedup, reinforcement, and decay |
|
|
838
|
-
| **Facets** | `facet-tag`, `facet-untag`, `facet-query`, `facet-get`, `facet-stats`, `facet-dimensions` | Multi-dimensional tagging with AND/OR queries |
|
|
839
|
-
| **Diagnostics** | `diagnose`, `heal` | Self-diagnosis across 8 categories with auto-fix |
|
|
840
|
-
| **Flow** | `flow-compress` | LLM summarization of completed action chains |
|
|
841
|
-
| **Branch** | `detect-worktree`, `list-worktrees`, `branch-sessions` | Git worktree detection for shared memory |
|
|
842
|
-
| **Team** | `team-share`, `team-feed`, `team-profile` | Namespaced shared + private team memory |
|
|
843
|
-
| **Governance** | `governance-delete`, `governance-bulk`, `audit-query` | Delete with audit trail, bulk operations |
|
|
844
|
-
| **Snapshots** | `snapshot-create`, `snapshot-list`, `snapshot-restore` | Git-versioned memory state |
|
|
845
|
-
| **Export** | `obsidian-export` | Obsidian-compatible Markdown with YAML frontmatter + wikilinks |
|
|
846
|
-
|
|
847
|
-
### Data Model (34 KV scopes)
|
|
848
|
-
|
|
849
|
-
| Scope | Stores |
|
|
850
|
-
|-------|--------|
|
|
851
|
-
| `mem:sessions` | Session metadata, project, timestamps |
|
|
852
|
-
| `mem:obs:{session_id}` | Compressed observations with embeddings |
|
|
853
|
-
| `mem:summaries` | End-of-session summaries |
|
|
854
|
-
| `mem:memories` | Long-term memories (versioned, with relationships) |
|
|
855
|
-
| `mem:relations` | Memory relationship graph |
|
|
856
|
-
| `mem:profiles` | Aggregated project profiles |
|
|
857
|
-
| `mem:emb:{obs_id}` | Vector embeddings |
|
|
858
|
-
| `mem:index:bm25` | Persisted BM25 index |
|
|
859
|
-
| `mem:metrics` | Per-function metrics |
|
|
860
|
-
| `mem:health` | Health snapshots |
|
|
861
|
-
| `mem:config` | Runtime configuration overrides |
|
|
862
|
-
| `mem:confidence` | Confidence scores for memories |
|
|
863
|
-
| `mem:claude-bridge` | Claude Code MEMORY.md bridge state |
|
|
864
|
-
| `mem:graph:nodes` | Knowledge graph entities |
|
|
865
|
-
| `mem:graph:edges` | Knowledge graph relationships |
|
|
866
|
-
| `mem:semantic` | Semantic memories (consolidated facts) |
|
|
867
|
-
| `mem:procedural` | Procedural memories (extracted workflows) |
|
|
868
|
-
| `mem:team:{id}:shared` | Team shared items |
|
|
869
|
-
| `mem:team:{id}:users:{uid}` | Per-user team state |
|
|
870
|
-
| `mem:team:{id}:profile` | Aggregated team profile |
|
|
871
|
-
| `mem:audit` | Audit trail for all operations |
|
|
872
|
-
| `mem:actions` | Dependency-aware work items |
|
|
873
|
-
| `mem:action-edges` | Typed edges (requires, unlocks, gated_by, etc.) |
|
|
874
|
-
| `mem:leases` | TTL-based agent work claims |
|
|
875
|
-
| `mem:routines` | Frozen workflow templates |
|
|
876
|
-
| `mem:routine-runs` | Instantiated routine execution tracking |
|
|
877
|
-
| `mem:signals` | Inter-agent messages with threading |
|
|
878
|
-
| `mem:checkpoints` | External condition gates |
|
|
879
|
-
| `mem:mesh` | Registered P2P sync peers |
|
|
880
|
-
| `mem:sentinels` | Event-driven condition watchers |
|
|
881
|
-
| `mem:sketches` | Ephemeral action graphs |
|
|
882
|
-
| `mem:crystals` | Compacted action chain digests |
|
|
883
|
-
| `mem:facets` | Multi-dimensional tags |
|
|
884
|
-
| `mem:lessons` | Confidence-scored lessons with decay |
|
|
885
|
-
|
|
886
|
-
## Development
|
|
795
|
+
| Prometheus / Grafana | iii OTEL + health monitor |
|
|
796
|
+
|
|
797
|
+
</details>
|
|
798
|
+
|
|
799
|
+
<h2 id="development"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-development.svg"><img src="assets/tags/section-development.svg" alt="Development" height="32" /></picture></h2>
|
|
887
800
|
|
|
888
801
|
```bash
|
|
889
802
|
npm run dev # Hot reload
|
|
890
|
-
npm run build # Production build
|
|
891
|
-
npm test #
|
|
803
|
+
npm run build # Production build
|
|
804
|
+
npm test # 646 tests (~1.7s)
|
|
892
805
|
npm run test:integration # API tests (requires running services)
|
|
893
806
|
```
|
|
894
807
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
- Node.js >= 20
|
|
898
|
-
- [iii-engine](https://iii.dev/docs) (`curl -fsSL https://install.iii.dev/iii/main/install.sh | sh`)
|
|
808
|
+
**Prerequisites:** Node.js >= 20, [iii-engine](https://iii.dev/docs) or Docker
|
|
899
809
|
|
|
900
|
-
|
|
810
|
+
<h2 id="license"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-license.svg"><img src="assets/tags/section-license.svg" alt="License" height="32" /></picture></h2>
|
|
901
811
|
|
|
902
812
|
[Apache-2.0](LICENSE)
|