@jcyamacho/agent-memory 0.0.17 → 0.0.18
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 +38 -62
- package/dist/index.js +44 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Persistent memory for MCP-powered coding agents.
|
|
4
4
|
|
|
5
5
|
`agent-memory` is a stdio MCP server that gives your LLM durable memory backed
|
|
6
|
-
by SQLite. It
|
|
6
|
+
by SQLite. It helps your agent remember preferences, project context, and prior
|
|
7
|
+
decisions across sessions.
|
|
8
|
+
|
|
9
|
+
It exposes four tools:
|
|
7
10
|
|
|
8
11
|
- `remember` -> save facts, decisions, preferences, and project context
|
|
9
12
|
- `recall` -> retrieve the most relevant memories later
|
|
10
13
|
- `revise` -> update an existing memory when it becomes outdated
|
|
11
14
|
- `forget` -> delete a memory that is no longer relevant
|
|
12
15
|
|
|
13
|
-
Use it when your agent should remember preferences, project facts, and prior
|
|
14
|
-
decisions across sessions.
|
|
15
|
-
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
18
|
Claude CLI:
|
|
@@ -27,52 +27,56 @@ Codex CLI:
|
|
|
27
27
|
codex mcp add memory -- npx -y @jcyamacho/agent-memory
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
OpenCode:
|
|
31
31
|
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
```jsonc
|
|
33
|
+
{
|
|
34
|
+
"$schema": "https://opencode.ai/config.json",
|
|
35
|
+
"mcp": {
|
|
36
|
+
"memory": {
|
|
37
|
+
"type": "local",
|
|
38
|
+
"command": ["npx", "-y", "@jcyamacho/agent-memory"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
##
|
|
44
|
+
## Optional LLM Instructions
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
Optional LLM instructions to reinforce the MCP's built-in guidance:
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
48
|
+
```md
|
|
49
|
+
## Agent Memory
|
|
50
|
+
|
|
51
|
+
- Use `memory_recall` at conversation start and before design choices,
|
|
52
|
+
conventions, or edge cases.
|
|
53
|
+
- Query `memory_recall` with 2-5 short anchor-heavy terms or exact phrases,
|
|
54
|
+
not full questions or sentences.
|
|
55
|
+
- Pass `workspace` for project-scoped memory. Omit it only for truly global memories.
|
|
56
|
+
- Use `memory_remember` to save one durable fact when the user states a stable
|
|
57
|
+
preference, correction, or reusable project decision.
|
|
58
|
+
- If the fact already exists, use `memory_revise` instead of creating a duplicate.
|
|
59
|
+
- Use `memory_forget` to remove a wrong or obsolete memory.
|
|
60
|
+
- Do not store secrets or temporary task state in memory.
|
|
61
|
+
```
|
|
51
62
|
|
|
52
63
|
## Web UI
|
|
53
64
|
|
|
54
65
|
Browse, edit, and delete memories in a local web interface:
|
|
55
66
|
|
|
56
67
|
```bash
|
|
57
|
-
npx -y @jcyamacho/agent-memory --ui
|
|
68
|
+
npx -y @jcyamacho/agent-memory@latest --ui
|
|
58
69
|
```
|
|
59
70
|
|
|
60
71
|
Opens at `http://localhost:6580`. Use `--port` to change:
|
|
61
72
|
|
|
62
73
|
```bash
|
|
63
|
-
npx -y @jcyamacho/agent-memory --ui --port 9090
|
|
74
|
+
npx -y @jcyamacho/agent-memory@latest --ui --port 9090
|
|
64
75
|
```
|
|
65
76
|
|
|
66
77
|
The web UI uses the same database as the MCP server.
|
|
67
78
|
|
|
68
|
-
##
|
|
69
|
-
|
|
70
|
-
- `remember` saves durable facts, preferences, decisions, and project context.
|
|
71
|
-
- `recall` retrieves the most relevant saved memories.
|
|
72
|
-
- `revise` updates an existing memory when it becomes outdated.
|
|
73
|
-
- `forget` deletes a memory that is no longer relevant.
|
|
74
|
-
|
|
75
|
-
## How Ranking Works
|
|
79
|
+
## How Recall Finds Memories
|
|
76
80
|
|
|
77
81
|
`recall` uses a multi-signal ranking system to surface the most relevant
|
|
78
82
|
memories:
|
|
@@ -99,7 +103,9 @@ When you save a memory from a git worktree, `agent-memory` stores the main repo
|
|
|
99
103
|
root as the workspace. `recall` applies the same normalization to incoming
|
|
100
104
|
workspace queries so linked worktrees still match repo-scoped memories exactly.
|
|
101
105
|
|
|
102
|
-
##
|
|
106
|
+
## Configuration
|
|
107
|
+
|
|
108
|
+
### Database Location
|
|
103
109
|
|
|
104
110
|
By default, the SQLite database is created at:
|
|
105
111
|
|
|
@@ -119,7 +125,7 @@ Set `AGENT_MEMORY_DB_PATH` when you want to:
|
|
|
119
125
|
- share a memory DB across multiple clients
|
|
120
126
|
- store the DB somewhere easier to back up or inspect
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
### Model Cache Location
|
|
123
129
|
|
|
124
130
|
By default, downloaded embedding model files are cached at:
|
|
125
131
|
|
|
@@ -142,36 +148,6 @@ Set `AGENT_MEMORY_MODELS_CACHE_PATH` when you want to:
|
|
|
142
148
|
Schema changes are migrated automatically, including workspace normalization for
|
|
143
149
|
existing git worktree memories when the original path can still be resolved.
|
|
144
150
|
|
|
145
|
-
## Development
|
|
146
|
-
|
|
147
|
-
For working on the project itself or running from source. Requires Bun and
|
|
148
|
-
Node.js.
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
bun install
|
|
152
|
-
bun run build
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
To use a local build as your MCP server:
|
|
156
|
-
|
|
157
|
-
```json
|
|
158
|
-
{
|
|
159
|
-
"mcpServers": {
|
|
160
|
-
"memory": {
|
|
161
|
-
"command": "node",
|
|
162
|
-
"args": [
|
|
163
|
-
"/absolute/path/to/agent-memory/dist/index.js"
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
bun lint
|
|
172
|
-
bun test
|
|
173
|
-
```
|
|
174
|
-
|
|
175
151
|
## License
|
|
176
152
|
|
|
177
153
|
MIT
|
package/dist/index.js
CHANGED
|
@@ -12464,7 +12464,7 @@ class StdioServerTransport {
|
|
|
12464
12464
|
}
|
|
12465
12465
|
}
|
|
12466
12466
|
// package.json
|
|
12467
|
-
var version2 = "0.0.
|
|
12467
|
+
var version2 = "0.0.18";
|
|
12468
12468
|
|
|
12469
12469
|
// src/config.ts
|
|
12470
12470
|
import { homedir } from "node:os";
|
|
@@ -20058,11 +20058,17 @@ function parseOptionalDate(value, fieldName) {
|
|
|
20058
20058
|
|
|
20059
20059
|
// src/mcp/tools/forget.ts
|
|
20060
20060
|
var forgetInputSchema = {
|
|
20061
|
-
id: string2().describe("
|
|
20061
|
+
id: string2().describe("Memory id to delete. Use an id returned by `recall`.")
|
|
20062
20062
|
};
|
|
20063
20063
|
function registerForgetTool(server, memory) {
|
|
20064
20064
|
server.registerTool("forget", {
|
|
20065
|
-
|
|
20065
|
+
annotations: {
|
|
20066
|
+
title: "Forget",
|
|
20067
|
+
destructiveHint: true,
|
|
20068
|
+
idempotentHint: true,
|
|
20069
|
+
openWorldHint: false
|
|
20070
|
+
},
|
|
20071
|
+
description: 'Delete a memory that is wrong or obsolete. Use after `recall` when you have the memory id. Use `revise` instead if the fact should remain with corrected wording. Returns `<memory id="..." deleted="true" />`.',
|
|
20066
20072
|
inputSchema: forgetInputSchema
|
|
20067
20073
|
}, async ({ id }) => {
|
|
20068
20074
|
try {
|
|
@@ -20269,11 +20275,11 @@ function normalizeTerms(terms) {
|
|
|
20269
20275
|
|
|
20270
20276
|
// src/mcp/tools/recall.ts
|
|
20271
20277
|
var recallInputSchema = {
|
|
20272
|
-
terms: array(string2()).min(1).describe("
|
|
20278
|
+
terms: array(string2()).min(1).describe("Pass 2-5 short anchor-heavy terms or exact phrases as separate entries. Prefer identifiers, commands, file paths, package names, and conventions likely to appear verbatim. Avoid vague words, full questions, and repeating the workspace name."),
|
|
20273
20279
|
limit: number2().int().min(1).max(MAX_RECALL_LIMIT).optional().describe("Maximum matches to return. Keep this small when you only need the strongest hits."),
|
|
20274
|
-
workspace: string2().optional().describe("Pass the current working directory. Git worktree paths are normalized to the main repo root for matching.
|
|
20275
|
-
updated_after: string2().optional().describe("Only return memories updated
|
|
20276
|
-
updated_before: string2().optional().describe("Only return memories updated
|
|
20280
|
+
workspace: string2().optional().describe("Pass the current working directory to prefer memories from the active project. Git worktree paths are normalized to the main repo root for matching."),
|
|
20281
|
+
updated_after: string2().optional().describe("Only return memories updated on or after this ISO 8601 timestamp."),
|
|
20282
|
+
updated_before: string2().optional().describe("Only return memories updated on or before this ISO 8601 timestamp.")
|
|
20277
20283
|
};
|
|
20278
20284
|
function toMemoryXml(r) {
|
|
20279
20285
|
const workspace = r.workspace ? ` workspace="${escapeXml(r.workspace)}"` : "";
|
|
@@ -20285,7 +20291,12 @@ ${content}
|
|
|
20285
20291
|
}
|
|
20286
20292
|
function registerRecallTool(server, memory) {
|
|
20287
20293
|
server.registerTool("recall", {
|
|
20288
|
-
|
|
20294
|
+
annotations: {
|
|
20295
|
+
title: "Recall",
|
|
20296
|
+
readOnlyHint: true,
|
|
20297
|
+
openWorldHint: false
|
|
20298
|
+
},
|
|
20299
|
+
description: "Find memories relevant to the current task or check whether a fact already exists before saving. Use at conversation start and before design choices. Pass short anchor-heavy `terms` and `workspace` when available. Returns `<memories>...</memories>` or a no-match hint.",
|
|
20289
20300
|
inputSchema: recallInputSchema
|
|
20290
20301
|
}, async ({ terms, limit, workspace, updated_after, updated_before }) => {
|
|
20291
20302
|
try {
|
|
@@ -20296,7 +20307,7 @@ function registerRecallTool(server, memory) {
|
|
|
20296
20307
|
updatedAfter: parseOptionalDate(updated_after, "updated_after"),
|
|
20297
20308
|
updatedBefore: parseOptionalDate(updated_before, "updated_before")
|
|
20298
20309
|
});
|
|
20299
|
-
const text = results.length === 0 ? "No matching memories found. Retry once with 1-3 alternate
|
|
20310
|
+
const text = results.length === 0 ? "No matching memories found. Retry once with 1-3 overlapping alternate terms or an exact identifier, command, file path, or phrase likely to appear in the memory." : `<memories>
|
|
20300
20311
|
${results.map(toMemoryXml).join(`
|
|
20301
20312
|
`)}
|
|
20302
20313
|
</memories>`;
|
|
@@ -20311,12 +20322,18 @@ ${results.map(toMemoryXml).join(`
|
|
|
20311
20322
|
|
|
20312
20323
|
// src/mcp/tools/remember.ts
|
|
20313
20324
|
var rememberInputSchema = {
|
|
20314
|
-
content: string2().describe("One durable fact to save. Use a
|
|
20315
|
-
workspace: string2().optional().describe("Pass the current working directory for project-
|
|
20325
|
+
content: string2().describe("One new durable fact to save. Use a self-contained sentence or short note."),
|
|
20326
|
+
workspace: string2().optional().describe("Pass the current working directory for project-scoped memory. Git worktree paths are saved as the main repo root. Omit for truly global memory.")
|
|
20316
20327
|
};
|
|
20317
20328
|
function registerRememberTool(server, memory) {
|
|
20318
20329
|
server.registerTool("remember", {
|
|
20319
|
-
|
|
20330
|
+
annotations: {
|
|
20331
|
+
title: "Remember",
|
|
20332
|
+
destructiveHint: false,
|
|
20333
|
+
idempotentHint: false,
|
|
20334
|
+
openWorldHint: false
|
|
20335
|
+
},
|
|
20336
|
+
description: 'Save one new durable fact for later recall. Use for stable preferences, corrections, reusable decisions, and project context not obvious from code or git history. Save exactly one fact. If the memory already exists, use `revise` instead. Do not store secrets, temporary task state, or facts obvious from code or git history. Returns `<memory id="..." />`.',
|
|
20320
20337
|
inputSchema: rememberInputSchema
|
|
20321
20338
|
}, async ({ content, workspace }) => {
|
|
20322
20339
|
try {
|
|
@@ -20335,12 +20352,18 @@ function registerRememberTool(server, memory) {
|
|
|
20335
20352
|
|
|
20336
20353
|
// src/mcp/tools/revise.ts
|
|
20337
20354
|
var reviseInputSchema = {
|
|
20338
|
-
id: string2().describe("
|
|
20339
|
-
content: string2().describe("
|
|
20355
|
+
id: string2().describe("Memory id to update. Use an id returned by `recall`."),
|
|
20356
|
+
content: string2().describe("Corrected replacement text for that memory. Keep it to one durable fact.")
|
|
20340
20357
|
};
|
|
20341
20358
|
function registerReviseTool(server, memory) {
|
|
20342
20359
|
server.registerTool("revise", {
|
|
20343
|
-
|
|
20360
|
+
annotations: {
|
|
20361
|
+
title: "Revise",
|
|
20362
|
+
destructiveHint: false,
|
|
20363
|
+
idempotentHint: false,
|
|
20364
|
+
openWorldHint: false
|
|
20365
|
+
},
|
|
20366
|
+
description: 'Update one existing memory when the same fact still applies but its wording or details changed. Use after `recall` when you already have the memory id. Keep it to one fact and do not merge unrelated facts. Returns `<memory id="..." updated_at="..." />`.',
|
|
20344
20367
|
inputSchema: reviseInputSchema
|
|
20345
20368
|
}, async ({ id, content }) => {
|
|
20346
20369
|
try {
|
|
@@ -20361,15 +20384,12 @@ function registerReviseTool(server, memory) {
|
|
|
20361
20384
|
|
|
20362
20385
|
// src/mcp/server.ts
|
|
20363
20386
|
var SERVER_INSTRUCTIONS = [
|
|
20364
|
-
"Use this server for durable memory:
|
|
20365
|
-
"Use `recall` at conversation start
|
|
20366
|
-
"
|
|
20367
|
-
"`
|
|
20368
|
-
"
|
|
20369
|
-
"
|
|
20370
|
-
"Call `recall` before `remember`; if the fact already exists, use `revise` instead of creating a duplicate.",
|
|
20371
|
-
"Use `revise` to correct an existing memory and `forget` to remove a wrong or obsolete one.",
|
|
20372
|
-
"Pass workspace for project-scoped calls. Git worktree paths are canonicalized to the main repo root on save and recall. Omit workspace only for truly global memories."
|
|
20387
|
+
"Use this server only for durable memory that should survive across turns: stable preferences, corrections, reusable decisions, and project context not obvious from code or git history.",
|
|
20388
|
+
"Use `recall` at conversation start, before design choices, and before saving memory.",
|
|
20389
|
+
"Use `remember` only for a new durable fact. Use `revise` when the fact already exists but needs correction.",
|
|
20390
|
+
"Use `forget` only when a memory is wrong or no longer relevant.",
|
|
20391
|
+
"Pass workspace for project-scoped memory. Omit it only for truly global memory.",
|
|
20392
|
+
"Do not store secrets or temporary task state in memory."
|
|
20373
20393
|
].join(" ");
|
|
20374
20394
|
function createMcpServer(memory, version3) {
|
|
20375
20395
|
const server = new McpServer({
|