agent-memory-store 0.0.8 → 0.0.9
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 +75 -69
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
`agent-memory-store` gives your AI agents a shared, searchable, persistent memory — powered by SQLite with native FTS5 full-text search and optional semantic embeddings. No external services required.
|
|
10
10
|
|
|
11
|
+
## Why this exists
|
|
12
|
+
|
|
13
|
+
Every time you start a new session with Claude Code, Cursor, or any MCP-compatible agent, it starts from zero. It doesn't know your project uses Fastify instead of Express. It doesn't know you decided on JWT two weeks ago. It doesn't know the staging deploy is on ECS.
|
|
14
|
+
|
|
15
|
+
`agent-memory-store` gives agents a shared, searchable memory that survives across sessions. Agents write what they learn, search what they need, and build on each other's work — just like a team with good documentation, except it happens automatically.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
11
19
|
Agents read and write **chunks** through MCP tools. Search combines **BM25 ranking** (via SQLite FTS5) with **semantic vector similarity** (via local embeddings), merged through Reciprocal Rank Fusion for best-of-both-worlds retrieval.
|
|
12
20
|
|
|
13
21
|
```
|
|
@@ -61,28 +69,6 @@ To use a custom path:
|
|
|
61
69
|
AGENT_STORE_PATH=/your/project/.agent-memory-store npx agent-memory-store
|
|
62
70
|
```
|
|
63
71
|
|
|
64
|
-
## Performance
|
|
65
|
-
|
|
66
|
-
Benchmarked on Apple Silicon (Node v25, darwin arm64, BM25 mode):
|
|
67
|
-
|
|
68
|
-
| Operation | 1K chunks | 10K chunks | 50K chunks | 100K chunks | 250K chunks |
|
|
69
|
-
|-----------|-----------|------------|------------|-------------|-------------|
|
|
70
|
-
| **write** | 0.17 ms | 0.19 ms | 0.23 ms | 0.21 ms | 0.25 ms |
|
|
71
|
-
| **read** | 0.01 ms | 0.05 ms | 0.21 ms | 0.22 ms | 0.85 ms |
|
|
72
|
-
| **search (BM25)** | ~5 ms† | ~10 ms† | ~60 ms† | ~110 ms† | ~390 ms† |
|
|
73
|
-
| **list** | 0.2 ms | 0.3 ms | 0.3 ms | 0.3 ms | 1.1 ms |
|
|
74
|
-
| **state get/set** | 0.03 ms | 0.03 ms | 0.07 ms | 0.05 ms | 0.03 ms |
|
|
75
|
-
|
|
76
|
-
† Search times from isolated run (no model loading interference). During warmup, first queries may be slower.
|
|
77
|
-
|
|
78
|
-
**Key insights:**
|
|
79
|
-
|
|
80
|
-
- **list is O(1) in practice** — pagination caps results at 100 rows by default, so list time stays flat regardless of corpus size (0.2–1.1 ms at any scale)
|
|
81
|
-
- **write is stable at ~0.2 ms/op** — FTS5 triggers and embedding backfill are non-blocking; inserts stay constant
|
|
82
|
-
- **read is a single index lookup** — sub-millisecond up to 50K chunks, still <1 ms at 250K
|
|
83
|
-
- **search scales linearly with FTS5 corpus** — this is inherent to BM25 full-text scan; for typical agent memory usage (≤25K chunks), search stays under 30 ms
|
|
84
|
-
- **state ops are O(1)** — key/value store backed by a B-tree primary key, constant at all scales
|
|
85
|
-
|
|
86
72
|
## Configuration
|
|
87
73
|
|
|
88
74
|
### Claude Code
|
|
@@ -178,21 +164,57 @@ If you need to store memory outside the project directory, set `AGENT_STORE_PATH
|
|
|
178
164
|
|
|
179
165
|
### Environment variables
|
|
180
166
|
|
|
181
|
-
| Variable
|
|
182
|
-
|
|
167
|
+
| Variable | Default | Description |
|
|
168
|
+
| ------------------ | ----------------------- | ------------------------------------------------------------------ |
|
|
183
169
|
| `AGENT_STORE_PATH` | `./.agent-memory-store` | Custom path to the storage directory. Omit to use project default. |
|
|
184
170
|
|
|
171
|
+
## Teach your agent to use memory
|
|
172
|
+
|
|
173
|
+
Add this to your agent's system prompt (or `CLAUDE.md` / `AGENTS.md`):
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
## Memory
|
|
177
|
+
|
|
178
|
+
You have persistent memory via agent-memory-store MCP tools.
|
|
179
|
+
|
|
180
|
+
**Before acting on any task:**
|
|
181
|
+
|
|
182
|
+
1. `search_context` with 2–3 queries related to the task. Check for prior decisions, conventions, and relevant outputs.
|
|
183
|
+
2. `get_state("project_tags")` to load the tag vocabulary. If empty, this is a new project — ask the user about stack, conventions, and structure, then persist them with `write_context` and `set_state`.
|
|
184
|
+
|
|
185
|
+
**After completing work:**
|
|
186
|
+
|
|
187
|
+
1. `write_context` to persist decisions (with rationale), outputs (with file paths), and discoveries (with impact).
|
|
188
|
+
2. Use short, lowercase tags consistent with the vocabulary: `auth`, `config`, `decision`, `output`, `discovery`.
|
|
189
|
+
3. Set `importance: "critical"` for decisions other agents depend on, `"high"` for outputs, `"medium"` for background context.
|
|
190
|
+
|
|
191
|
+
**Before every write:**
|
|
192
|
+
|
|
193
|
+
1. `search_context` for the same topic first. If a chunk exists, `delete_context` it, then write the updated version. One chunk per topic.
|
|
194
|
+
|
|
195
|
+
**Rules:**
|
|
196
|
+
|
|
197
|
+
- Never guess a fact that might be in memory — search first, it costs <10ms.
|
|
198
|
+
- Never store secrets — write references to where they live, not the values.
|
|
199
|
+
- `set_state` is for mutable values (current phase, counters). `write_context` is for searchable knowledge (decisions, outputs). Don't mix them.
|
|
200
|
+
- Use `search_mode: "semantic"` when exact terms don't match (e.g., searching "autenticação" when the chunk says "auth").
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Copy, paste, done. This is enough for any agent to use memory effectively.
|
|
204
|
+
|
|
205
|
+
> **Want to go deeper?** The [`skills/SKILL.md`](./skills/SKILL.md) file is a comprehensive skill that teaches agents advanced patterns: cold start bootstrap for new projects, multi-agent pipeline handoffs, tag vocabulary management, deduplication workflows, and when to use each search mode. Install it in your project's skill directory if your agents run multi-step pipelines or need to coordinate across sessions.
|
|
206
|
+
|
|
185
207
|
## Tools
|
|
186
208
|
|
|
187
|
-
| Tool
|
|
188
|
-
|
|
209
|
+
| Tool | When to use |
|
|
210
|
+
| ---------------- | ------------------------------------------------------------------------- |
|
|
189
211
|
| `search_context` | **Start of every task** — retrieve relevant prior knowledge before acting |
|
|
190
|
-
| `write_context`
|
|
191
|
-
| `read_context`
|
|
192
|
-
| `list_context`
|
|
193
|
-
| `delete_context` | Remove outdated or incorrect chunks
|
|
194
|
-
| `get_state`
|
|
195
|
-
| `set_state`
|
|
212
|
+
| `write_context` | After decisions, discoveries, or outputs that other agents will need |
|
|
213
|
+
| `read_context` | Read a specific chunk by ID |
|
|
214
|
+
| `list_context` | Inventory the memory store (metadata only, no body) |
|
|
215
|
+
| `delete_context` | Remove outdated or incorrect chunks |
|
|
216
|
+
| `get_state` | Read a pipeline variable (progress, flags, counters) |
|
|
217
|
+
| `set_state` | Write a pipeline variable |
|
|
196
218
|
|
|
197
219
|
### `search_context`
|
|
198
220
|
|
|
@@ -207,11 +229,11 @@ search_mode string (optional) "hybrid" (default), "bm25", or "semantic".
|
|
|
207
229
|
|
|
208
230
|
**Search modes:**
|
|
209
231
|
|
|
210
|
-
| Mode
|
|
211
|
-
|
|
212
|
-
| `hybrid`
|
|
213
|
-
| `bm25`
|
|
214
|
-
| `semantic` | Vector cosine similarity only
|
|
232
|
+
| Mode | How it works | Best for |
|
|
233
|
+
| ---------- | ------------------------------------------------------------ | ----------------------------------- |
|
|
234
|
+
| `hybrid` | BM25 + semantic similarity merged via Reciprocal Rank Fusion | General use (default) |
|
|
235
|
+
| `bm25` | FTS5 keyword matching only | Exact term lookups, canonical tags |
|
|
236
|
+
| `semantic` | Vector cosine similarity only | Finding conceptually related chunks |
|
|
215
237
|
|
|
216
238
|
### `write_context`
|
|
217
239
|
|
|
@@ -264,43 +286,27 @@ WAL mode is enabled for concurrent read performance. No manual flush needed.
|
|
|
264
286
|
|
|
265
287
|
The embedding model (~23MB) is downloaded automatically on first use and cached in `~/.cache/huggingface/`. If the model fails to load, the system falls back to BM25-only search transparently.
|
|
266
288
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
If you're upgrading from a previous version that used `.md` files, the migration happens automatically on first startup. Your existing chunks and state are imported into SQLite, and the old directories are renamed to `chunks_backup/` and `state_backup/`.
|
|
270
|
-
|
|
271
|
-
## Agent system prompt
|
|
272
|
-
|
|
273
|
-
Paste this into the system prompt of every agent that should use the memory store:
|
|
274
|
-
|
|
275
|
-
```markdown
|
|
276
|
-
## Memory usage
|
|
277
|
-
|
|
278
|
-
You have access to a persistent local memory store via agent-memory-store MCP tools.
|
|
279
|
-
|
|
280
|
-
**At the start of each task:**
|
|
289
|
+
## Performance
|
|
281
290
|
|
|
282
|
-
|
|
283
|
-
2. Incorporate retrieved chunks into your reasoning.
|
|
284
|
-
3. Call `get_state` to check pipeline status if relevant.
|
|
291
|
+
Benchmarked on Apple Silicon (Node v25, darwin arm64, BM25 mode):
|
|
285
292
|
|
|
286
|
-
|
|
293
|
+
| Operation | 1K chunks | 10K chunks | 50K chunks | 100K chunks | 250K chunks |
|
|
294
|
+
| ----------------- | --------- | ---------- | ---------- | ----------- | ----------- |
|
|
295
|
+
| **write** | 0.17 ms | 0.19 ms | 0.23 ms | 0.21 ms | 0.25 ms |
|
|
296
|
+
| **read** | 0.01 ms | 0.05 ms | 0.21 ms | 0.22 ms | 0.85 ms |
|
|
297
|
+
| **search (BM25)** | ~5 ms† | ~10 ms† | ~60 ms† | ~110 ms† | ~390 ms† |
|
|
298
|
+
| **list** | 0.2 ms | 0.3 ms | 0.3 ms | 0.3 ms | 1.1 ms |
|
|
299
|
+
| **state get/set** | 0.03 ms | 0.03 ms | 0.07 ms | 0.05 ms | 0.03 ms |
|
|
287
300
|
|
|
288
|
-
|
|
289
|
-
- Decisions made and their rationale
|
|
290
|
-
- Key discoveries or findings
|
|
291
|
-
- Structured outputs intended for downstream agents
|
|
292
|
-
2. Use canonical tags consistent with the rest of the team.
|
|
293
|
-
3. Set `importance: high` or `critical` for information other agents will need.
|
|
301
|
+
† Search times from isolated run (no model loading interference). During warmup, first queries may be slower.
|
|
294
302
|
|
|
295
|
-
**
|
|
303
|
+
**Key insights:**
|
|
296
304
|
|
|
297
|
-
-
|
|
298
|
-
-
|
|
299
|
-
-
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
- Use `search_mode: "bm25"` for exact tag/keyword lookups
|
|
303
|
-
```
|
|
305
|
+
- **list is O(1) in practice** — pagination caps results at 100 rows by default, so list time stays flat regardless of corpus size (0.2–1.1 ms at any scale)
|
|
306
|
+
- **write is stable at ~0.2 ms/op** — FTS5 triggers and embedding backfill are non-blocking; inserts stay constant
|
|
307
|
+
- **read is a single index lookup** — sub-millisecond up to 50K chunks, still <1 ms at 250K
|
|
308
|
+
- **search scales linearly with FTS5 corpus** — this is inherent to BM25 full-text scan; for typical agent memory usage (≤25K chunks), search stays under 30 ms
|
|
309
|
+
- **state ops are O(1)** — key/value store backed by a B-tree primary key, constant at all scales
|
|
304
310
|
|
|
305
311
|
## Development
|
|
306
312
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-memory-store",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Local-first MCP memory server for multi-agent systems. Hybrid search (BM25 + semantic embeddings), SQLite-backed, zero-config.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./src/index.js",
|