@agentmemory/agentmemory 0.9.11 → 0.9.13
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 +65 -1
- package/dist/.env.example +167 -0
- package/dist/cli.mjs +50 -4
- 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 +214 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{src-IbjZ5iJi.mjs → src-Ca9oX6Hq.mjs} +224 -125
- package/dist/src-Ca9oX6Hq.mjs.map +1 -0
- package/dist/{standalone-awLAlipf.mjs → standalone-BpbiNqr9.mjs} +2 -2
- package/dist/{standalone-awLAlipf.mjs.map → standalone-BpbiNqr9.mjs.map} +1 -1
- package/dist/standalone.mjs +1 -1
- package/dist/standalone.mjs.map +1 -1
- package/dist/{tools-registry-CzSNN8Ca.mjs → tools-registry-D5l632PP.mjs} +3 -3
- package/dist/{tools-registry-CzSNN8Ca.mjs.map → tools-registry-D5l632PP.mjs.map} +1 -1
- package/dist/viewer/index.html +52 -25
- package/package.json +8 -4
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/image-refs-D4M1sJAz.mjs +0 -3
- package/dist/image-store-DR4g1FAW.mjs +0 -3
- package/dist/src-IbjZ5iJi.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
|
@@ -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 |
|
|
@@ -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/dist/cli.mjs
CHANGED
|
@@ -110,6 +110,7 @@ Usage: agentmemory [command] [options]
|
|
|
110
110
|
|
|
111
111
|
Commands:
|
|
112
112
|
(default) Start agentmemory worker
|
|
113
|
+
init Copy bundled .env.example to ~/.agentmemory/.env if absent
|
|
113
114
|
status Show connection status, memory count, flags, and health
|
|
114
115
|
doctor Run diagnostic checks (server, flags, graph, providers)
|
|
115
116
|
demo Seed sample sessions and show recall in action
|
|
@@ -361,12 +362,12 @@ async function main() {
|
|
|
361
362
|
p.intro("agentmemory");
|
|
362
363
|
if (skipEngine) {
|
|
363
364
|
p.log.info("Skipping engine check (--no-engine)");
|
|
364
|
-
await import("./src-
|
|
365
|
+
await import("./src-Ca9oX6Hq.mjs");
|
|
365
366
|
return;
|
|
366
367
|
}
|
|
367
368
|
if (await isEngineRunning()) {
|
|
368
369
|
p.log.success("iii-engine is running");
|
|
369
|
-
await import("./src-
|
|
370
|
+
await import("./src-Ca9oX6Hq.mjs");
|
|
370
371
|
return;
|
|
371
372
|
}
|
|
372
373
|
if (!await startEngine()) {
|
|
@@ -410,7 +411,7 @@ async function main() {
|
|
|
410
411
|
process.exit(1);
|
|
411
412
|
}
|
|
412
413
|
s.stop("iii-engine is ready");
|
|
413
|
-
await import("./src-
|
|
414
|
+
await import("./src-Ca9oX6Hq.mjs");
|
|
414
415
|
}
|
|
415
416
|
async function apiFetch(base, path, timeoutMs = 5e3) {
|
|
416
417
|
try {
|
|
@@ -732,6 +733,50 @@ async function runDemoSearch(base, query) {
|
|
|
732
733
|
topTitle: items[0]?.title ?? "(no results)"
|
|
733
734
|
};
|
|
734
735
|
}
|
|
736
|
+
function findEnvExample() {
|
|
737
|
+
const candidates = [
|
|
738
|
+
join(__dirname, "..", ".env.example"),
|
|
739
|
+
join(__dirname, ".env.example"),
|
|
740
|
+
join(process.cwd(), ".env.example")
|
|
741
|
+
];
|
|
742
|
+
for (const c of candidates) if (existsSync(c)) return c;
|
|
743
|
+
return null;
|
|
744
|
+
}
|
|
745
|
+
async function runInit() {
|
|
746
|
+
p.intro("agentmemory init");
|
|
747
|
+
const target = join(homedir(), ".agentmemory", ".env");
|
|
748
|
+
const template = findEnvExample();
|
|
749
|
+
if (!template) {
|
|
750
|
+
p.log.error("Could not locate .env.example in the package. Re-install with: npm i -g @agentmemory/agentmemory");
|
|
751
|
+
process.exit(1);
|
|
752
|
+
}
|
|
753
|
+
const dir = dirname(target);
|
|
754
|
+
const { mkdir, copyFile } = await import("node:fs/promises");
|
|
755
|
+
const { constants: fsConstants } = await import("node:fs");
|
|
756
|
+
try {
|
|
757
|
+
await mkdir(dir, { recursive: true });
|
|
758
|
+
await copyFile(template, target, fsConstants.COPYFILE_EXCL);
|
|
759
|
+
} catch (err) {
|
|
760
|
+
if (err?.code === "EEXIST") {
|
|
761
|
+
p.log.warn(`${target} already exists — leaving it untouched.`);
|
|
762
|
+
p.log.info(`Compare against the latest template: diff ${target} ${template}`);
|
|
763
|
+
p.outro("Nothing changed.");
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
p.log.error(`Failed to copy template: ${err instanceof Error ? err.message : String(err)}`);
|
|
767
|
+
process.exit(1);
|
|
768
|
+
}
|
|
769
|
+
p.log.success(`Wrote ${target}`);
|
|
770
|
+
p.note([
|
|
771
|
+
"All keys are commented out by default. Uncomment the ones you want.",
|
|
772
|
+
"",
|
|
773
|
+
"Common next steps:",
|
|
774
|
+
" 1. Pick an LLM provider key (ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY / etc.)",
|
|
775
|
+
" 2. Run `npx @agentmemory/agentmemory doctor` to verify the daemon sees them",
|
|
776
|
+
" 3. Run `npx @agentmemory/agentmemory` to start the worker"
|
|
777
|
+
].join("\n"), "Next steps");
|
|
778
|
+
p.outro(`Edit ${target} and you're set.`);
|
|
779
|
+
}
|
|
735
780
|
async function runDemo() {
|
|
736
781
|
const port = getRestPort();
|
|
737
782
|
const base = `http://localhost:${port}`;
|
|
@@ -872,7 +917,7 @@ async function runUpgrade() {
|
|
|
872
917
|
].join("\n"), "agentmemory upgrade");
|
|
873
918
|
}
|
|
874
919
|
async function runMcp() {
|
|
875
|
-
await import("./standalone-
|
|
920
|
+
await import("./standalone-BpbiNqr9.mjs");
|
|
876
921
|
}
|
|
877
922
|
async function runImportJsonl() {
|
|
878
923
|
const VALUE_FLAGS = new Set(["--port", "--tools"]);
|
|
@@ -977,6 +1022,7 @@ async function runImportJsonl() {
|
|
|
977
1022
|
}
|
|
978
1023
|
}
|
|
979
1024
|
({
|
|
1025
|
+
init: runInit,
|
|
980
1026
|
status: runStatus,
|
|
981
1027
|
doctor: runDoctor,
|
|
982
1028
|
demo: runDemo,
|