@agentmemory/agentmemory 0.9.12 → 0.9.14
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/.env.example +167 -0
- package/README.md +88 -22
- package/dist/.env.example +167 -0
- package/dist/cli.mjs +449 -84
- package/dist/cli.mjs.map +1 -1
- package/dist/image-refs-HVu22rfu.mjs +116 -0
- package/dist/image-refs-HVu22rfu.mjs.map +1 -0
- package/dist/image-store-BfN1vDbj.mjs +3 -0
- package/dist/index.mjs +140 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{src-Cqsy23f_.mjs → src-BBI-ah3h.mjs} +150 -124
- package/dist/src-BBI-ah3h.mjs.map +1 -0
- package/dist/{standalone-DNt6O3zG.mjs → standalone-Cf5sp0XM.mjs} +2 -2
- package/dist/{standalone-DNt6O3zG.mjs.map → standalone-Cf5sp0XM.mjs.map} +1 -1
- package/dist/standalone.mjs +1 -1
- package/dist/standalone.mjs.map +1 -1
- package/dist/{tools-registry-NUso4hxA.mjs → tools-registry-BDimtXJb.mjs} +3 -3
- package/dist/{tools-registry-NUso4hxA.mjs.map → tools-registry-BDimtXJb.mjs.map} +1 -1
- package/package.json +13 -9
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/image-refs-BkMGNmEs.mjs +0 -3
- package/dist/image-store-RY_BkYWK.mjs +0 -3
- package/dist/src-Cqsy23f_.mjs.map +0 -1
package/.env.example
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# agentmemory configuration
|
|
3
|
+
# =============================================================================
|
|
4
|
+
#
|
|
5
|
+
# Copy this file to `~/.agentmemory/.env` (or to your project root if you
|
|
6
|
+
# prefer scoped config) and uncomment the lines you want to override.
|
|
7
|
+
#
|
|
8
|
+
# Every line is OFF by default — `agentmemory` runs out of the box with no
|
|
9
|
+
# LLM key, no embedding key, and no API auth. Set keys here only when you
|
|
10
|
+
# want to enable the corresponding feature.
|
|
11
|
+
#
|
|
12
|
+
# Run `npx @agentmemory/agentmemory init` to copy this file into place
|
|
13
|
+
# automatically. Run `npx @agentmemory/agentmemory doctor` to verify that
|
|
14
|
+
# the daemon reads the env you expect.
|
|
15
|
+
#
|
|
16
|
+
# Defaults shown in comments. Listed in priority order — the first key
|
|
17
|
+
# present wins on the LLM detection path (see src/config.ts::detectProvider).
|
|
18
|
+
|
|
19
|
+
# -----------------------------------------------------------------------------
|
|
20
|
+
# 1. LLM provider — pick ONE
|
|
21
|
+
# -----------------------------------------------------------------------------
|
|
22
|
+
#
|
|
23
|
+
# Without a provider key, agentmemory runs in noop mode: observations are
|
|
24
|
+
# indexed via zero-LLM synthetic compression, hybrid search still works,
|
|
25
|
+
# but LLM-backed summarisation / reflection / consolidation are disabled.
|
|
26
|
+
# The detection order is OPENAI_API_KEY → MINIMAX_API_KEY → ANTHROPIC_API_KEY
|
|
27
|
+
# → GEMINI_API_KEY → OPENROUTER_API_KEY → noop.
|
|
28
|
+
|
|
29
|
+
# OPENAI_API_KEY=sk-... # Used for OpenAI-compatible embeddings today. PR #307 will extend this to chat completions (DeepSeek, SiliconFlow, vLLM, LM Studio, Ollama via `/v1`).
|
|
30
|
+
# OPENAI_BASE_URL=https://api.openai.com # Override for OpenAI-compatible providers
|
|
31
|
+
|
|
32
|
+
# ANTHROPIC_API_KEY=sk-ant-...
|
|
33
|
+
# ANTHROPIC_MODEL=claude-sonnet-4-20250514 # Default Anthropic model
|
|
34
|
+
# ANTHROPIC_BASE_URL=https://api.anthropic.com # Override for Anthropic-compatible proxies / Azure AI Foundry
|
|
35
|
+
|
|
36
|
+
# GEMINI_API_KEY=... # Either env name works; GEMINI_API_KEY takes precedence
|
|
37
|
+
# GOOGLE_API_KEY=... # Alias for GEMINI_API_KEY when set alone (emits a one-time stderr hint)
|
|
38
|
+
# GEMINI_MODEL=gemini-2.5-flash # Default Gemini model (auto-detected GA model)
|
|
39
|
+
|
|
40
|
+
# OPENROUTER_API_KEY=sk-or-...
|
|
41
|
+
# OPENROUTER_MODEL=anthropic/claude-sonnet-4-20250514
|
|
42
|
+
|
|
43
|
+
# MINIMAX_API_KEY=...
|
|
44
|
+
# MINIMAX_MODEL=MiniMax-M2.7
|
|
45
|
+
|
|
46
|
+
# MAX_TOKENS=4096 # Cap LLM completion tokens for compression / summarise calls
|
|
47
|
+
|
|
48
|
+
# Opt-in Claude-subscription fallback (spawns @anthropic-ai/claude-agent-sdk
|
|
49
|
+
# child sessions). Off by default — the agent-sdk fallback can trigger
|
|
50
|
+
# Stop-hook recursion (#149 follow-up) when invoked from inside Claude Code.
|
|
51
|
+
# AGENTMEMORY_ALLOW_AGENT_SDK=true
|
|
52
|
+
|
|
53
|
+
# FALLBACK_PROVIDERS=anthropic,gemini # Comma-separated chain tried after the primary provider returns an error (e.g. rate limit)
|
|
54
|
+
|
|
55
|
+
# -----------------------------------------------------------------------------
|
|
56
|
+
# 2. Embedding provider — auto-detected, override via EMBEDDING_PROVIDER
|
|
57
|
+
# -----------------------------------------------------------------------------
|
|
58
|
+
#
|
|
59
|
+
# Without an embedding key, agentmemory runs in BM25-only mode for hybrid
|
|
60
|
+
# search. Detection order: EMBEDDING_PROVIDER override → GEMINI_API_KEY →
|
|
61
|
+
# OPENAI_API_KEY → VOYAGE_API_KEY → COHERE_API_KEY → OPENROUTER_API_KEY →
|
|
62
|
+
# local (Xenova/all-MiniLM-L6-v2, 384-dim).
|
|
63
|
+
|
|
64
|
+
# EMBEDDING_PROVIDER=local # local | openai | voyage | cohere | gemini | openrouter
|
|
65
|
+
|
|
66
|
+
# VOYAGE_API_KEY=pa-... # Optimised for code embeddings
|
|
67
|
+
|
|
68
|
+
# COHERE_API_KEY=... # General-purpose embeddings
|
|
69
|
+
|
|
70
|
+
# Reuses OPENAI_API_KEY / OPENAI_BASE_URL above when EMBEDDING_PROVIDER=openai.
|
|
71
|
+
# OPENAI_EMBEDDING_MODEL=text-embedding-3-small # Embedding model when EMBEDDING_PROVIDER=openai
|
|
72
|
+
# OPENAI_EMBEDDING_DIMENSIONS=1536 # Required when the model is not in the known-models table
|
|
73
|
+
|
|
74
|
+
# OPENROUTER_EMBEDDING_MODEL=openai/text-embedding-3-small # When EMBEDDING_PROVIDER=openrouter
|
|
75
|
+
|
|
76
|
+
# -----------------------------------------------------------------------------
|
|
77
|
+
# 3. Auth & security
|
|
78
|
+
# -----------------------------------------------------------------------------
|
|
79
|
+
#
|
|
80
|
+
# Bearer-token auth for the REST API + viewer + all integration plugins.
|
|
81
|
+
# Without a secret, REST endpoints are open on loopback. Set this when
|
|
82
|
+
# you expose the daemon beyond loopback or run behind a reverse proxy.
|
|
83
|
+
|
|
84
|
+
# AGENTMEMORY_SECRET=your-secret-here
|
|
85
|
+
|
|
86
|
+
# -----------------------------------------------------------------------------
|
|
87
|
+
# 4. Search tuning
|
|
88
|
+
# -----------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
# BM25_WEIGHT=0.4 # Hybrid search weight for BM25 leg
|
|
91
|
+
# VECTOR_WEIGHT=0.6 # Hybrid search weight for vector leg
|
|
92
|
+
# AGENTMEMORY_GRAPH_WEIGHT=0.2 # Graph traversal bonus on smart-search ranking
|
|
93
|
+
# TOKEN_BUDGET=2000 # Max tokens injected via mem::context per session
|
|
94
|
+
# MAX_OBS_PER_SESSION=500 # Per-session observation cap before consolidation kicks in
|
|
95
|
+
|
|
96
|
+
# -----------------------------------------------------------------------------
|
|
97
|
+
# 5. Behaviour flags
|
|
98
|
+
# -----------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
# AGENTMEMORY_AUTO_COMPRESS=true # Run LLM compression on every observation batch (requires a provider key). Default off — synthetic compression handles most cases.
|
|
101
|
+
# AGENTMEMORY_INJECT_CONTEXT=true # Inject recalled memories back into agent prompts (#143). Default off — hooks capture observations but do not modify conversation.
|
|
102
|
+
# CONSOLIDATION_ENABLED=true # Run the 4-tier consolidation pipeline (memories → semantic → procedural). Default off — opt in once you've measured the LLM cost.
|
|
103
|
+
# CONSOLIDATION_DECAY_DAYS=30 # Age (days) after which non-reinforced memories decay during consolidation
|
|
104
|
+
# GRAPH_EXTRACTION_ENABLED=true # Extract concept-graph edges on remember; powers the graph-traversal recall path
|
|
105
|
+
# GRAPH_EXTRACTION_BATCH_SIZE=8 # Memories per graph-extraction batch
|
|
106
|
+
# AGENTMEMORY_REFLECT=true # Periodically auto-synthesize lessons from memories
|
|
107
|
+
# AGENTMEMORY_DROP_STALE_INDEX=true # Drop on-disk BM25 / vector index on startup if dim guard fires (#248). Recovery toggle for stuck-state debugging.
|
|
108
|
+
# AGENTMEMORY_IMAGE_EMBEDDINGS=true # Enable image embeddings when an image provider is present (experimental).
|
|
109
|
+
|
|
110
|
+
# -----------------------------------------------------------------------------
|
|
111
|
+
# 6. CLI / runtime knobs
|
|
112
|
+
# -----------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
# AGENTMEMORY_TOOLS=all # core (7 tools, default) | all (51 tools) — surface exposed to MCP clients
|
|
115
|
+
# AGENTMEMORY_SLOTS=memory # Comma-separated plugin slot names the CLI should claim
|
|
116
|
+
# AGENTMEMORY_DEBUG=1 # Trace MCP shim probe + standalone fallback decisions to stderr
|
|
117
|
+
# AGENTMEMORY_FORCE_PROXY=1 # Skip the MCP shim livez probe and trust AGENTMEMORY_URL (for sandboxed MCP clients that can't reach localhost)
|
|
118
|
+
# AGENTMEMORY_PROBE_TIMEOUT_MS=2000 # MCP shim livez probe timeout
|
|
119
|
+
# AGENTMEMORY_URL=http://localhost:3111 # REST base URL — honored by status, doctor, MCP shim
|
|
120
|
+
# AGENTMEMORY_VIEWER_URL=http://localhost:3113 # Override the viewer URL printed by `agentmemory status`
|
|
121
|
+
# AGENTMEMORY_EXPORT_ROOT=~/agentmemory-backup # Default destination for `agentmemory export`
|
|
122
|
+
|
|
123
|
+
# STANDALONE_MCP=1 # MCP shim only — bypass the worker and run @agentmemory/mcp in-process
|
|
124
|
+
# STANDALONE_PERSIST_PATH=~/.agentmemory/local.db # Path used by the standalone MCP shim's local fallback store
|
|
125
|
+
|
|
126
|
+
# Snapshot exporter — periodic snapshots of state_store + stream_store.
|
|
127
|
+
# SNAPSHOT_ENABLED=true
|
|
128
|
+
# SNAPSHOT_DIR=~/.agentmemory/snapshots
|
|
129
|
+
# SNAPSHOT_INTERVAL=3600 # Seconds between snapshots
|
|
130
|
+
|
|
131
|
+
# Team sharing — when set, memories are scoped to (TEAM_ID, USER_ID) tuples.
|
|
132
|
+
# TEAM_MODE=shared
|
|
133
|
+
# TEAM_ID=acme
|
|
134
|
+
# USER_ID=rohit
|
|
135
|
+
|
|
136
|
+
# -----------------------------------------------------------------------------
|
|
137
|
+
# 7. Ports
|
|
138
|
+
# -----------------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
# III_REST_PORT=3111 # REST API port (also affects viewer at +2)
|
|
141
|
+
# III_STREAMS_PORT=3112 # Streams API port
|
|
142
|
+
# III_ENGINE_URL=ws://localhost:49134 # iii-engine WebSocket URL (used by the worker)
|
|
143
|
+
|
|
144
|
+
# -----------------------------------------------------------------------------
|
|
145
|
+
# 8. iii engine pin
|
|
146
|
+
# -----------------------------------------------------------------------------
|
|
147
|
+
#
|
|
148
|
+
# agentmemory currently pins iii-engine to v0.11.2 — v0.11.6 introduces a
|
|
149
|
+
# new sandbox-everything-via-`iii worker add` model that agentmemory
|
|
150
|
+
# hasn't been refactored for yet. Override with AGENTMEMORY_III_VERSION
|
|
151
|
+
# only after migrating to the sandbox model manually.
|
|
152
|
+
|
|
153
|
+
# AGENTMEMORY_III_VERSION=0.11.2
|
|
154
|
+
|
|
155
|
+
# -----------------------------------------------------------------------------
|
|
156
|
+
# 9. Claude Code bridge (opt-in)
|
|
157
|
+
# -----------------------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
# CLAUDE_MEMORY_BRIDGE=true # Mirror compressed memories into Claude Code's CLAUDE.md
|
|
160
|
+
# CLAUDE_PROJECT_PATH=/path/to/your/project # Required when CLAUDE_MEMORY_BRIDGE=true
|
|
161
|
+
# CLAUDE_MEMORY_LINE_BUDGET=200 # Lines of memory CLAUDE.md should hold
|
|
162
|
+
|
|
163
|
+
# -----------------------------------------------------------------------------
|
|
164
|
+
# 10. Obsidian export (opt-in)
|
|
165
|
+
# -----------------------------------------------------------------------------
|
|
166
|
+
|
|
167
|
+
# OBSIDIAN_AUTO_EXPORT=true # Auto-export memories to an Obsidian vault on every consolidation
|
package/README.md
CHANGED
|
@@ -77,17 +77,32 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
|
|
|
77
77
|
<td align="center" width="12.5%">
|
|
78
78
|
<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/>
|
|
79
79
|
<strong>Claude Code</strong><br/>
|
|
80
|
-
<sub>12 hooks + MCP
|
|
80
|
+
<sub>native plugin + 12 hooks + MCP</sub>
|
|
81
|
+
</td>
|
|
82
|
+
<td align="center" width="12.5%">
|
|
83
|
+
<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/>
|
|
84
|
+
<strong>Codex CLI</strong><br/>
|
|
85
|
+
<sub>native plugin + 6 hooks + MCP</sub>
|
|
81
86
|
</td>
|
|
82
87
|
<td align="center" width="12.5%">
|
|
83
88
|
<a href="integrations/openclaw/"><img src="https://github.com/openclaw.png?size=120" alt="OpenClaw" width="48" height="48" /></a><br/>
|
|
84
89
|
<strong>OpenClaw</strong><br/>
|
|
85
|
-
<sub>
|
|
90
|
+
<sub>native plugin + MCP</sub>
|
|
86
91
|
</td>
|
|
87
92
|
<td align="center" width="12.5%">
|
|
88
93
|
<a href="integrations/hermes/"><img src="https://github.com/NousResearch.png?size=120" alt="Hermes" width="48" height="48" /></a><br/>
|
|
89
94
|
<strong>Hermes</strong><br/>
|
|
90
|
-
<sub>
|
|
95
|
+
<sub>native plugin + MCP</sub>
|
|
96
|
+
</td>
|
|
97
|
+
<td align="center" width="12.5%">
|
|
98
|
+
<a href="integrations/pi/"><img src="assets/agents/pi.svg" alt="pi" width="48" height="48" /></a><br/>
|
|
99
|
+
<strong>pi</strong><br/>
|
|
100
|
+
<sub>native plugin + MCP</sub>
|
|
101
|
+
</td>
|
|
102
|
+
<td align="center" width="12.5%">
|
|
103
|
+
<a href="https://github.com/tinyhumansai/openhuman"><img src="https://raw.githubusercontent.com/tinyhumansai/openhuman/main/app/src-tauri/icons/128x128.png" alt="OpenHuman" width="48" height="48" /></a><br/>
|
|
104
|
+
<strong>OpenHuman</strong><br/>
|
|
105
|
+
<sub>native Memory trait backend</sub>
|
|
91
106
|
</td>
|
|
92
107
|
<td align="center" width="12.5%">
|
|
93
108
|
<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/>
|
|
@@ -99,23 +114,18 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
|
|
|
99
114
|
<strong>Gemini CLI</strong><br/>
|
|
100
115
|
<sub>MCP server</sub>
|
|
101
116
|
</td>
|
|
117
|
+
</tr>
|
|
118
|
+
<tr>
|
|
102
119
|
<td align="center" width="12.5%">
|
|
103
120
|
<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/>
|
|
104
121
|
<strong>OpenCode</strong><br/>
|
|
105
122
|
<sub>MCP server</sub>
|
|
106
123
|
</td>
|
|
107
124
|
<td align="center" width="12.5%">
|
|
108
|
-
<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/>
|
|
109
|
-
<strong>Codex CLI</strong><br/>
|
|
110
|
-
<sub>6 hooks + MCP + skills</sub>
|
|
111
|
-
</td>
|
|
112
|
-
<td align="center" width="12.5%">
|
|
113
125
|
<a href="https://github.com/cline/cline"><img src="https://github.com/cline.png?size=120" alt="Cline" width="48" height="48" /></a><br/>
|
|
114
126
|
<strong>Cline</strong><br/>
|
|
115
127
|
<sub>MCP server</sub>
|
|
116
128
|
</td>
|
|
117
|
-
</tr>
|
|
118
|
-
<tr>
|
|
119
129
|
<td align="center" width="12.5%">
|
|
120
130
|
<a href="https://github.com/block/goose"><img src="https://github.com/block.png?size=120" alt="Goose" width="48" height="48" /></a><br/>
|
|
121
131
|
<strong>Goose</strong><br/>
|
|
@@ -146,16 +156,6 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
|
|
|
146
156
|
<strong>Roo Code</strong><br/>
|
|
147
157
|
<sub>MCP server</sub>
|
|
148
158
|
</td>
|
|
149
|
-
<td align="center" width="12.5%">
|
|
150
|
-
<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/>
|
|
151
|
-
<strong>Claude SDK</strong><br/>
|
|
152
|
-
<sub>AgentSDKProvider</sub>
|
|
153
|
-
</td>
|
|
154
|
-
<td align="center" width="12.5%">
|
|
155
|
-
<img src="https://img.shields.io/badge/104-endpoints-1f6feb?style=flat-square" alt="REST API" width="48" /><br/>
|
|
156
|
-
<strong>Any agent</strong><br/>
|
|
157
|
-
<sub>REST API</sub>
|
|
158
|
-
</td>
|
|
159
159
|
</tr>
|
|
160
160
|
</table>
|
|
161
161
|
|
|
@@ -368,7 +368,7 @@ codex plugin install agentmemory
|
|
|
368
368
|
|
|
369
369
|
The Codex plugin ships from the same `plugin/` directory as the Claude Code plugin. It registers:
|
|
370
370
|
|
|
371
|
-
- `@agentmemory/mcp` as an MCP server (all 51 tools when `
|
|
371
|
+
- `@agentmemory/mcp` as an MCP server (proxies all 51 tools when `AGENTMEMORY_URL` points at a running agentmemory server; falls back to 7 tools locally when no server is reachable)
|
|
372
372
|
- 6 lifecycle hooks: `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, `Stop`
|
|
373
373
|
- 4 skills: `/recall`, `/remember`, `/session-history`, `/forget`
|
|
374
374
|
|
|
@@ -457,6 +457,30 @@ The agentmemory entry is the **same MCP server block** across every host that us
|
|
|
457
457
|
|
|
458
458
|
**Sandboxed MCP clients** (Flatpak / Snap / restrictive containers) that can't reach the host's `localhost`: also set `"AGENTMEMORY_FORCE_PROXY": "1"` in the `env` block, and point `AGENTMEMORY_URL` at a route the sandbox can actually reach (e.g. your LAN IP). See [#234](https://github.com/rohitg00/agentmemory/issues/234) for the diagnostic walkthrough.
|
|
459
459
|
|
|
460
|
+
### Programmatic access (Python / Rust / Node)
|
|
461
|
+
|
|
462
|
+
agentmemory registers its core operations as iii functions (`mem::remember`, `mem::observe`, `mem::context`, `mem::smart-search`, `mem::forget`). Any language with an iii SDK can call them directly over `ws://localhost:49134` — no separate REST client per language.
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
pip install iii-sdk # Python
|
|
466
|
+
cargo add iii-sdk # Rust
|
|
467
|
+
npm install iii-sdk # Node
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
```python
|
|
471
|
+
from iii import register_worker
|
|
472
|
+
|
|
473
|
+
iii = register_worker("ws://localhost:49134")
|
|
474
|
+
iii.connect()
|
|
475
|
+
|
|
476
|
+
iii.trigger({
|
|
477
|
+
"function_id": "mem::smart-search",
|
|
478
|
+
"payload": {"project": "demo", "query": "how do tokens refresh"},
|
|
479
|
+
})
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Worked example: [`examples/python/`](examples/python/) (quickstart + observation/recall flow). REST on `:3111` remains available for hosts without an iii runtime.
|
|
483
|
+
|
|
460
484
|
### From source
|
|
461
485
|
|
|
462
486
|
```bash
|
|
@@ -529,6 +553,44 @@ npx -y @agentmemory/mcp
|
|
|
529
553
|
|
|
530
554
|
---
|
|
531
555
|
|
|
556
|
+
<h2 id="deploy">Deploy</h2>
|
|
557
|
+
|
|
558
|
+
One-click templates for managed hosts. Each one ships a self-contained
|
|
559
|
+
Dockerfile that pulls `@agentmemory/agentmemory` from npm and copies
|
|
560
|
+
the iii engine binary in from the official `iiidev/iii` Docker Hub
|
|
561
|
+
image — no pre-built agentmemory image required. Persistent storage
|
|
562
|
+
mounts at `/data`; the first-boot entrypoint overwrites the
|
|
563
|
+
npm-bundled iii config (which binds `127.0.0.1`) with a deploy-tuned
|
|
564
|
+
one that binds `0.0.0.0` and uses absolute `/data` paths, generates
|
|
565
|
+
the HMAC secret, then drops privileges from `root` to `node` via
|
|
566
|
+
`gosu` before exec'ing the agentmemory CLI.
|
|
567
|
+
|
|
568
|
+
<p>
|
|
569
|
+
<a href="https://fly.io/launch?repo=https://github.com/rohitg00/agentmemory&path=deploy/fly"><img src="https://img.shields.io/badge/Deploy%20to-fly.io-8b5cf6?style=for-the-badge&logo=fly.io&logoColor=white" alt="Deploy to fly.io" /></a>
|
|
570
|
+
<a href="https://railway.com/new/template?template=https%3A%2F%2Fgithub.com%2Frohitg00%2Fagentmemory&rootDirectory=deploy%2Frailway"><img src="https://img.shields.io/badge/Deploy%20to-Railway-0B0D0E?style=for-the-badge&logo=railway&logoColor=white" alt="Deploy to Railway" /></a>
|
|
571
|
+
</p>
|
|
572
|
+
|
|
573
|
+
Render's one-click deploy button requires `render.yaml` at the repository root, which we deliberately keep clean. Use the Render Blueprint flow documented in [`deploy/render/`](./deploy/render/README.md) to point at the in-repo blueprint manually.
|
|
574
|
+
|
|
575
|
+
Full setup details (HMAC capture, viewer SSH tunnel, rotation, backup,
|
|
576
|
+
cost floors) live in [`deploy/`](./deploy/README.md):
|
|
577
|
+
|
|
578
|
+
- [`deploy/fly`](./deploy/fly/README.md) — single machine with
|
|
579
|
+
`auto_stop_machines = "stop"`; cheapest idle.
|
|
580
|
+
- [`deploy/railway`](./deploy/railway/README.md) — Hobby plan flat fee,
|
|
581
|
+
volume in the dashboard.
|
|
582
|
+
- [`deploy/render`](./deploy/render/README.md) — Blueprint flow,
|
|
583
|
+
automatic disk snapshots on paid plans.
|
|
584
|
+
- [`deploy/coolify`](./deploy/coolify/README.md) — self-hosted on your
|
|
585
|
+
own VPS via [Coolify](https://coolify.io/self-hosted); same Docker
|
|
586
|
+
Compose stack, you own the host and the data.
|
|
587
|
+
|
|
588
|
+
Only port `3111` is published. The viewer on `3113` stays bound to
|
|
589
|
+
loopback inside the container — every template's README documents the
|
|
590
|
+
SSH-tunnel pattern for reaching it.
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
532
594
|
<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>
|
|
533
595
|
|
|
534
596
|
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.
|
|
@@ -644,6 +706,8 @@ Triple-stream retrieval combining three signals:
|
|
|
644
706
|
|
|
645
707
|
Fused with Reciprocal Rank Fusion (RRF, k=60) and session-diversified (max 3 results per session).
|
|
646
708
|
|
|
709
|
+
BM25 tokenizes Greek, Cyrillic, Hebrew, Arabic, and accented Latin out of the box. For Chinese / Japanese / Korean memories, install the optional segmenters (`npm install @node-rs/jieba tiny-segmenter`) to split CJK runs into word-level tokens; without them, agentmemory soft-falls to whole-run tokenization and prints a one-time hint on stderr.
|
|
710
|
+
|
|
647
711
|
### Embedding providers
|
|
648
712
|
|
|
649
713
|
agentmemory auto-detects your provider. For best results, install local embeddings (free):
|
|
@@ -655,7 +719,7 @@ npm install @xenova/transformers
|
|
|
655
719
|
| Provider | Model | Cost | Notes |
|
|
656
720
|
|---|---|---|---|
|
|
657
721
|
| **Local (recommended)** | `all-MiniLM-L6-v2` | Free | Offline, +8pp recall over BM25-only |
|
|
658
|
-
| Gemini | `
|
|
722
|
+
| Gemini | `gemini-embedding-001` | Free tier | 100+ languages, 768/1536/3072 dims (MRL), 2048-token input. Replaces `text-embedding-004` ([deprecated, shutdown Jan 14, 2026](https://ai.google.dev/gemini-api/docs/deprecations)) |
|
|
659
723
|
| OpenAI | `text-embedding-3-small` | $0.02/1M | Highest quality |
|
|
660
724
|
| Voyage AI | `voyage-code-3` | Paid | Optimized for code |
|
|
661
725
|
| Cohere | `embed-english-v3.0` | Free trial | General purpose |
|
|
@@ -667,6 +731,8 @@ npm install @xenova/transformers
|
|
|
667
731
|
|
|
668
732
|
51 tools, 6 resources, 3 prompts, and 4 skills — the most comprehensive MCP memory toolkit for any agent.
|
|
669
733
|
|
|
734
|
+
> **MCP shim vs full server:** the published `@agentmemory/mcp` package is a thin shim. It exposes the full 51-tool surface **only when it can reach a running agentmemory server** via `AGENTMEMORY_URL` (proxy mode). With no server reachable, the shim falls back to a 7-tool local set (`memory_save`, `memory_recall`, `memory_smart_search`, `memory_sessions`, `memory_export`, `memory_audit`, `memory_governance_delete`). The `AGENTMEMORY_TOOLS=core|all` env var is a *server-side* flag — setting it in the shim's `env` block has no effect. If you see only 7 tools in Cursor / OpenCode / Gemini CLI, start `npx @agentmemory/agentmemory` (or the Docker stack) and set `AGENTMEMORY_URL=http://localhost:3111`.
|
|
735
|
+
|
|
670
736
|
### 50 Tools
|
|
671
737
|
|
|
672
738
|
<details>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# agentmemory configuration
|
|
3
|
+
# =============================================================================
|
|
4
|
+
#
|
|
5
|
+
# Copy this file to `~/.agentmemory/.env` (or to your project root if you
|
|
6
|
+
# prefer scoped config) and uncomment the lines you want to override.
|
|
7
|
+
#
|
|
8
|
+
# Every line is OFF by default — `agentmemory` runs out of the box with no
|
|
9
|
+
# LLM key, no embedding key, and no API auth. Set keys here only when you
|
|
10
|
+
# want to enable the corresponding feature.
|
|
11
|
+
#
|
|
12
|
+
# Run `npx @agentmemory/agentmemory init` to copy this file into place
|
|
13
|
+
# automatically. Run `npx @agentmemory/agentmemory doctor` to verify that
|
|
14
|
+
# the daemon reads the env you expect.
|
|
15
|
+
#
|
|
16
|
+
# Defaults shown in comments. Listed in priority order — the first key
|
|
17
|
+
# present wins on the LLM detection path (see src/config.ts::detectProvider).
|
|
18
|
+
|
|
19
|
+
# -----------------------------------------------------------------------------
|
|
20
|
+
# 1. LLM provider — pick ONE
|
|
21
|
+
# -----------------------------------------------------------------------------
|
|
22
|
+
#
|
|
23
|
+
# Without a provider key, agentmemory runs in noop mode: observations are
|
|
24
|
+
# indexed via zero-LLM synthetic compression, hybrid search still works,
|
|
25
|
+
# but LLM-backed summarisation / reflection / consolidation are disabled.
|
|
26
|
+
# The detection order is OPENAI_API_KEY → MINIMAX_API_KEY → ANTHROPIC_API_KEY
|
|
27
|
+
# → GEMINI_API_KEY → OPENROUTER_API_KEY → noop.
|
|
28
|
+
|
|
29
|
+
# OPENAI_API_KEY=sk-... # Used for OpenAI-compatible embeddings today. PR #307 will extend this to chat completions (DeepSeek, SiliconFlow, vLLM, LM Studio, Ollama via `/v1`).
|
|
30
|
+
# OPENAI_BASE_URL=https://api.openai.com # Override for OpenAI-compatible providers
|
|
31
|
+
|
|
32
|
+
# ANTHROPIC_API_KEY=sk-ant-...
|
|
33
|
+
# ANTHROPIC_MODEL=claude-sonnet-4-20250514 # Default Anthropic model
|
|
34
|
+
# ANTHROPIC_BASE_URL=https://api.anthropic.com # Override for Anthropic-compatible proxies / Azure AI Foundry
|
|
35
|
+
|
|
36
|
+
# GEMINI_API_KEY=... # Either env name works; GEMINI_API_KEY takes precedence
|
|
37
|
+
# GOOGLE_API_KEY=... # Alias for GEMINI_API_KEY when set alone (emits a one-time stderr hint)
|
|
38
|
+
# GEMINI_MODEL=gemini-2.5-flash # Default Gemini model (auto-detected GA model)
|
|
39
|
+
|
|
40
|
+
# OPENROUTER_API_KEY=sk-or-...
|
|
41
|
+
# OPENROUTER_MODEL=anthropic/claude-sonnet-4-20250514
|
|
42
|
+
|
|
43
|
+
# MINIMAX_API_KEY=...
|
|
44
|
+
# MINIMAX_MODEL=MiniMax-M2.7
|
|
45
|
+
|
|
46
|
+
# MAX_TOKENS=4096 # Cap LLM completion tokens for compression / summarise calls
|
|
47
|
+
|
|
48
|
+
# Opt-in Claude-subscription fallback (spawns @anthropic-ai/claude-agent-sdk
|
|
49
|
+
# child sessions). Off by default — the agent-sdk fallback can trigger
|
|
50
|
+
# Stop-hook recursion (#149 follow-up) when invoked from inside Claude Code.
|
|
51
|
+
# AGENTMEMORY_ALLOW_AGENT_SDK=true
|
|
52
|
+
|
|
53
|
+
# FALLBACK_PROVIDERS=anthropic,gemini # Comma-separated chain tried after the primary provider returns an error (e.g. rate limit)
|
|
54
|
+
|
|
55
|
+
# -----------------------------------------------------------------------------
|
|
56
|
+
# 2. Embedding provider — auto-detected, override via EMBEDDING_PROVIDER
|
|
57
|
+
# -----------------------------------------------------------------------------
|
|
58
|
+
#
|
|
59
|
+
# Without an embedding key, agentmemory runs in BM25-only mode for hybrid
|
|
60
|
+
# search. Detection order: EMBEDDING_PROVIDER override → GEMINI_API_KEY →
|
|
61
|
+
# OPENAI_API_KEY → VOYAGE_API_KEY → COHERE_API_KEY → OPENROUTER_API_KEY →
|
|
62
|
+
# local (Xenova/all-MiniLM-L6-v2, 384-dim).
|
|
63
|
+
|
|
64
|
+
# EMBEDDING_PROVIDER=local # local | openai | voyage | cohere | gemini | openrouter
|
|
65
|
+
|
|
66
|
+
# VOYAGE_API_KEY=pa-... # Optimised for code embeddings
|
|
67
|
+
|
|
68
|
+
# COHERE_API_KEY=... # General-purpose embeddings
|
|
69
|
+
|
|
70
|
+
# Reuses OPENAI_API_KEY / OPENAI_BASE_URL above when EMBEDDING_PROVIDER=openai.
|
|
71
|
+
# OPENAI_EMBEDDING_MODEL=text-embedding-3-small # Embedding model when EMBEDDING_PROVIDER=openai
|
|
72
|
+
# OPENAI_EMBEDDING_DIMENSIONS=1536 # Required when the model is not in the known-models table
|
|
73
|
+
|
|
74
|
+
# OPENROUTER_EMBEDDING_MODEL=openai/text-embedding-3-small # When EMBEDDING_PROVIDER=openrouter
|
|
75
|
+
|
|
76
|
+
# -----------------------------------------------------------------------------
|
|
77
|
+
# 3. Auth & security
|
|
78
|
+
# -----------------------------------------------------------------------------
|
|
79
|
+
#
|
|
80
|
+
# Bearer-token auth for the REST API + viewer + all integration plugins.
|
|
81
|
+
# Without a secret, REST endpoints are open on loopback. Set this when
|
|
82
|
+
# you expose the daemon beyond loopback or run behind a reverse proxy.
|
|
83
|
+
|
|
84
|
+
# AGENTMEMORY_SECRET=your-secret-here
|
|
85
|
+
|
|
86
|
+
# -----------------------------------------------------------------------------
|
|
87
|
+
# 4. Search tuning
|
|
88
|
+
# -----------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
# BM25_WEIGHT=0.4 # Hybrid search weight for BM25 leg
|
|
91
|
+
# VECTOR_WEIGHT=0.6 # Hybrid search weight for vector leg
|
|
92
|
+
# AGENTMEMORY_GRAPH_WEIGHT=0.2 # Graph traversal bonus on smart-search ranking
|
|
93
|
+
# TOKEN_BUDGET=2000 # Max tokens injected via mem::context per session
|
|
94
|
+
# MAX_OBS_PER_SESSION=500 # Per-session observation cap before consolidation kicks in
|
|
95
|
+
|
|
96
|
+
# -----------------------------------------------------------------------------
|
|
97
|
+
# 5. Behaviour flags
|
|
98
|
+
# -----------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
# AGENTMEMORY_AUTO_COMPRESS=true # Run LLM compression on every observation batch (requires a provider key). Default off — synthetic compression handles most cases.
|
|
101
|
+
# AGENTMEMORY_INJECT_CONTEXT=true # Inject recalled memories back into agent prompts (#143). Default off — hooks capture observations but do not modify conversation.
|
|
102
|
+
# CONSOLIDATION_ENABLED=true # Run the 4-tier consolidation pipeline (memories → semantic → procedural). Default off — opt in once you've measured the LLM cost.
|
|
103
|
+
# CONSOLIDATION_DECAY_DAYS=30 # Age (days) after which non-reinforced memories decay during consolidation
|
|
104
|
+
# GRAPH_EXTRACTION_ENABLED=true # Extract concept-graph edges on remember; powers the graph-traversal recall path
|
|
105
|
+
# GRAPH_EXTRACTION_BATCH_SIZE=8 # Memories per graph-extraction batch
|
|
106
|
+
# AGENTMEMORY_REFLECT=true # Periodically auto-synthesize lessons from memories
|
|
107
|
+
# AGENTMEMORY_DROP_STALE_INDEX=true # Drop on-disk BM25 / vector index on startup if dim guard fires (#248). Recovery toggle for stuck-state debugging.
|
|
108
|
+
# AGENTMEMORY_IMAGE_EMBEDDINGS=true # Enable image embeddings when an image provider is present (experimental).
|
|
109
|
+
|
|
110
|
+
# -----------------------------------------------------------------------------
|
|
111
|
+
# 6. CLI / runtime knobs
|
|
112
|
+
# -----------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
# AGENTMEMORY_TOOLS=all # core (7 tools, default) | all (51 tools) — surface exposed to MCP clients
|
|
115
|
+
# AGENTMEMORY_SLOTS=memory # Comma-separated plugin slot names the CLI should claim
|
|
116
|
+
# AGENTMEMORY_DEBUG=1 # Trace MCP shim probe + standalone fallback decisions to stderr
|
|
117
|
+
# AGENTMEMORY_FORCE_PROXY=1 # Skip the MCP shim livez probe and trust AGENTMEMORY_URL (for sandboxed MCP clients that can't reach localhost)
|
|
118
|
+
# AGENTMEMORY_PROBE_TIMEOUT_MS=2000 # MCP shim livez probe timeout
|
|
119
|
+
# AGENTMEMORY_URL=http://localhost:3111 # REST base URL — honored by status, doctor, MCP shim
|
|
120
|
+
# AGENTMEMORY_VIEWER_URL=http://localhost:3113 # Override the viewer URL printed by `agentmemory status`
|
|
121
|
+
# AGENTMEMORY_EXPORT_ROOT=~/agentmemory-backup # Default destination for `agentmemory export`
|
|
122
|
+
|
|
123
|
+
# STANDALONE_MCP=1 # MCP shim only — bypass the worker and run @agentmemory/mcp in-process
|
|
124
|
+
# STANDALONE_PERSIST_PATH=~/.agentmemory/local.db # Path used by the standalone MCP shim's local fallback store
|
|
125
|
+
|
|
126
|
+
# Snapshot exporter — periodic snapshots of state_store + stream_store.
|
|
127
|
+
# SNAPSHOT_ENABLED=true
|
|
128
|
+
# SNAPSHOT_DIR=~/.agentmemory/snapshots
|
|
129
|
+
# SNAPSHOT_INTERVAL=3600 # Seconds between snapshots
|
|
130
|
+
|
|
131
|
+
# Team sharing — when set, memories are scoped to (TEAM_ID, USER_ID) tuples.
|
|
132
|
+
# TEAM_MODE=shared
|
|
133
|
+
# TEAM_ID=acme
|
|
134
|
+
# USER_ID=rohit
|
|
135
|
+
|
|
136
|
+
# -----------------------------------------------------------------------------
|
|
137
|
+
# 7. Ports
|
|
138
|
+
# -----------------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
# III_REST_PORT=3111 # REST API port (also affects viewer at +2)
|
|
141
|
+
# III_STREAMS_PORT=3112 # Streams API port
|
|
142
|
+
# III_ENGINE_URL=ws://localhost:49134 # iii-engine WebSocket URL (used by the worker)
|
|
143
|
+
|
|
144
|
+
# -----------------------------------------------------------------------------
|
|
145
|
+
# 8. iii engine pin
|
|
146
|
+
# -----------------------------------------------------------------------------
|
|
147
|
+
#
|
|
148
|
+
# agentmemory currently pins iii-engine to v0.11.2 — v0.11.6 introduces a
|
|
149
|
+
# new sandbox-everything-via-`iii worker add` model that agentmemory
|
|
150
|
+
# hasn't been refactored for yet. Override with AGENTMEMORY_III_VERSION
|
|
151
|
+
# only after migrating to the sandbox model manually.
|
|
152
|
+
|
|
153
|
+
# AGENTMEMORY_III_VERSION=0.11.2
|
|
154
|
+
|
|
155
|
+
# -----------------------------------------------------------------------------
|
|
156
|
+
# 9. Claude Code bridge (opt-in)
|
|
157
|
+
# -----------------------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
# CLAUDE_MEMORY_BRIDGE=true # Mirror compressed memories into Claude Code's CLAUDE.md
|
|
160
|
+
# CLAUDE_PROJECT_PATH=/path/to/your/project # Required when CLAUDE_MEMORY_BRIDGE=true
|
|
161
|
+
# CLAUDE_MEMORY_LINE_BUDGET=200 # Lines of memory CLAUDE.md should hold
|
|
162
|
+
|
|
163
|
+
# -----------------------------------------------------------------------------
|
|
164
|
+
# 10. Obsidian export (opt-in)
|
|
165
|
+
# -----------------------------------------------------------------------------
|
|
166
|
+
|
|
167
|
+
# OBSIDIAN_AUTO_EXPORT=true # Auto-export memories to an Obsidian vault on every consolidation
|