@vib795/agent-memory 0.1.0
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/HOWTO.md +368 -0
- package/LICENSE +21 -0
- package/README.md +302 -0
- package/install.ps1 +54 -0
- package/install.sh +36 -0
- package/package.json +47 -0
- package/scripts/postinstall.js +45 -0
- package/skills/handoff/SKILL.md +344 -0
- package/skills/recall/SKILL.md +125 -0
- package/skills/remember/SKILL.md +155 -0
- package/src/atomic.js +57 -0
- package/src/cli.js +558 -0
- package/src/compact.js +242 -0
- package/src/config.js +91 -0
- package/src/digest.js +199 -0
- package/src/graph.js +99 -0
- package/src/index-db.js +317 -0
- package/src/promptfile.js +78 -0
- package/src/redact.js +97 -0
- package/src/schema.js +98 -0
- package/src/setup.js +211 -0
- package/src/staleness.js +151 -0
- package/src/store.js +0 -0
- package/src/targets.js +139 -0
package/HOWTO.md
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# How to use agent-memory
|
|
2
|
+
|
|
3
|
+
**A 10-minute read that will save you a lot of 10-minute re-explanations.**
|
|
4
|
+
|
|
5
|
+
You do not need to be a developer to follow this. If you can copy a line of text and
|
|
6
|
+
press Enter, you can do all of it.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. The problem, in one scene
|
|
11
|
+
|
|
12
|
+
You spend forty minutes with an AI assistant working out why the checkout page is slow.
|
|
13
|
+
You try three things. Two are dead ends. The third works, and you learn *why* — some
|
|
14
|
+
cache setting nobody documented.
|
|
15
|
+
|
|
16
|
+
The next morning you open a new chat.
|
|
17
|
+
|
|
18
|
+
It knows nothing. Not the dead ends, not the fix, not the reason. So you explain it
|
|
19
|
+
again, from the top, and pay for the privilege — because those forty minutes cost real
|
|
20
|
+
requests out of your monthly allowance, and you are about to spend them twice.
|
|
21
|
+
|
|
22
|
+
Your assistant has no long-term memory. Every conversation starts at zero.
|
|
23
|
+
|
|
24
|
+
**agent-memory gives it one.** A small set of notes, stored as plain text files on your
|
|
25
|
+
own machine, that any AI assistant on that machine can read — tomorrow, next month, from
|
|
26
|
+
a completely different project folder.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. What you actually get
|
|
31
|
+
|
|
32
|
+
Three commands you type into the chat box. That is the whole interface.
|
|
33
|
+
|
|
34
|
+
| You type | What happens |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `/remember` | "Keep this." It writes down what was decided and why. |
|
|
37
|
+
| `/recall` | "What do we already know?" It answers from your notes instead of guessing. |
|
|
38
|
+
| `/handoff` | "Save my place." It bottles up the current work so another window can continue it. |
|
|
39
|
+
|
|
40
|
+
The most important one is `/recall`, and here is the trick: **you usually will not type
|
|
41
|
+
it.** Your assistant reads a one-line summary of everything in your memory at the start
|
|
42
|
+
of every conversation, so when you ask a question your notes can answer, it goes and
|
|
43
|
+
looks on its own.
|
|
44
|
+
|
|
45
|
+
You are not managing a database. You are leaving notes for your future self, and
|
|
46
|
+
somebody else does the filing.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 3. Install it (about 60 seconds)
|
|
51
|
+
|
|
52
|
+
You will need **Node.js version 22.5 or newer**. To check, open a terminal —
|
|
53
|
+
on Windows that's **PowerShell**, on a Mac it's **Terminal** — and type:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
node --version
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If that prints something like `v22.5.0` or higher, you are set. If it prints an error or
|
|
60
|
+
a smaller number, install Node from [nodejs.org](https://nodejs.org) first.
|
|
61
|
+
|
|
62
|
+
Now run these two lines:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install -g @vib795/agent-memory
|
|
66
|
+
agent-memory setup
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Both lines matter.** The first downloads it. The second installs it into every AI tool
|
|
70
|
+
you have. Modern npm refuses to let a package run its own setup automatically — a
|
|
71
|
+
sensible security default — so the second line is you giving permission, by hand.
|
|
72
|
+
|
|
73
|
+
> No access to the npm registry at work? This works too, and needs nothing but GitHub:
|
|
74
|
+
> ```bash
|
|
75
|
+
> npm install -g https://github.com/vib795/agent-memory.git
|
|
76
|
+
> agent-memory setup
|
|
77
|
+
> ```
|
|
78
|
+
|
|
79
|
+
### What just happened
|
|
80
|
+
|
|
81
|
+
`setup` looked around your machine for AI tools, and installed itself into each one it
|
|
82
|
+
found — in whatever format that particular tool reads:
|
|
83
|
+
|
|
84
|
+
| If you have | It installs | Where |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| Claude Code | a skill | `~/.claude/skills/` |
|
|
87
|
+
| Codex CLI | a skill | `~/.codex/skills/` |
|
|
88
|
+
| VS Code, Insiders, Cursor, Windsurf | a prompt file | the editor's `prompts` folder |
|
|
89
|
+
| GitHub Copilot agent skills | a skill | `~/.agents/skills/` |
|
|
90
|
+
|
|
91
|
+
It prints exactly what it did. If your editor is not in that list, it will say so rather
|
|
92
|
+
than silently skipping it.
|
|
93
|
+
|
|
94
|
+
You should see something like:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Installed for 4 agents:
|
|
98
|
+
Agent skills (shared convention)
|
|
99
|
+
[link] /Users/you/.agents/skills/handoff
|
|
100
|
+
...
|
|
101
|
+
Store ready at /Users/you/.agents/memory (0 notes).
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Zero notes is correct. It is a new notebook. You have not written in it yet.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 4. Prove it works
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
agent-memory doctor
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This is your one diagnostic. It checks the Node version, finds your tools, verifies the
|
|
115
|
+
files are where they should be, and tells you plainly if something is wrong. Run it any
|
|
116
|
+
time something feels off — it is designed to be the first thing you try, not the last.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 5. Your first five minutes
|
|
121
|
+
|
|
122
|
+
Do this once. It takes longer to read than to do.
|
|
123
|
+
|
|
124
|
+
**Step one — open any AI assistant and teach it something.** Have a normal conversation
|
|
125
|
+
about a real project. Make a decision. Then type:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
/remember
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
It will pull out what was actually decided, strip anything that looks like a password or
|
|
132
|
+
a key, and save it. You will see which notes it wrote.
|
|
133
|
+
|
|
134
|
+
**Step two — close that conversation entirely.** Open a fresh one. Ideally in a
|
|
135
|
+
different project folder, to prove the point.
|
|
136
|
+
|
|
137
|
+
**Step three — ask about the thing you just decided.** Not `/recall`. Just ask, the way
|
|
138
|
+
you would ask a colleague:
|
|
139
|
+
|
|
140
|
+
> Why did we go with the queue instead of a cron job?
|
|
141
|
+
|
|
142
|
+
If it comes back with your reasoning — including what you rejected and why — it is
|
|
143
|
+
working. That is the whole product. Everything else is plumbing.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 6. The three commands, in more detail
|
|
148
|
+
|
|
149
|
+
### `/remember` — for things that stay true
|
|
150
|
+
|
|
151
|
+
Use it when something is settled and would be annoying to work out twice:
|
|
152
|
+
|
|
153
|
+
- **A decision**, and critically, *what you rejected and why.* "We chose X" ages badly.
|
|
154
|
+
"We chose X over Y because Y needs a native build step our laptops can't run" is still
|
|
155
|
+
useful in a year.
|
|
156
|
+
- **A constraint** you cannot see in the code. "The security team will not approve any
|
|
157
|
+
new background service." No amount of reading the codebase reveals that.
|
|
158
|
+
- **A convention** your team follows that isn't written down anywhere.
|
|
159
|
+
- **How a system actually works**, once you have finally understood it.
|
|
160
|
+
|
|
161
|
+
You can also point it at something specific:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
/remember the retry policy on the orders webhook
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Don't bother remembering** anything the code already says. If someone can find it by
|
|
168
|
+
opening a file, it does not need a note. Notes are for what lives in people's heads.
|
|
169
|
+
|
|
170
|
+
### `/handoff` — for moving work between windows
|
|
171
|
+
|
|
172
|
+
This one is not a chat summary. Summaries read nicely and still leave the next
|
|
173
|
+
conversation asking questions.
|
|
174
|
+
|
|
175
|
+
`/handoff` captures **working state**: the decisions with their reasoning, the
|
|
176
|
+
approaches you already tried that failed, what you were about to do next and what is
|
|
177
|
+
blocking it, which files you touched, and the exact `file:line` spots that matter.
|
|
178
|
+
|
|
179
|
+
Type `/handoff` and it hands you back a single line to paste elsewhere:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
Read C:\Users\you\.agents\handoffs\fix-checkout-latency.md and continue this work.
|
|
183
|
+
Follow the Next action.
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Paste that into any other window, in any project, and it picks up where you stopped.
|
|
187
|
+
|
|
188
|
+
Run `/handoff` again later on the same work and it updates the same file rather than
|
|
189
|
+
creating a second one — it recognises the thread even if you have started calling it
|
|
190
|
+
something slightly different. One previous version is kept, just in case.
|
|
191
|
+
|
|
192
|
+
**Bonus:** `/handoff` also does `/remember`'s job in the same breath, at no extra cost.
|
|
193
|
+
More on why that matters in a moment.
|
|
194
|
+
|
|
195
|
+
### `/recall` — for getting the answer back
|
|
196
|
+
|
|
197
|
+
Mostly automatic, as described above. Type it explicitly when you want to see
|
|
198
|
+
everything the memory holds on a subject, or when you suspect it knows something and
|
|
199
|
+
didn't volunteer it.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 7. Notes for your specific tool
|
|
204
|
+
|
|
205
|
+
### Claude Code
|
|
206
|
+
|
|
207
|
+
Nothing to do. The three commands appear as skills in both the terminal version and
|
|
208
|
+
the VS Code extension. Type `/recall` and you will see them.
|
|
209
|
+
|
|
210
|
+
### Codex CLI
|
|
211
|
+
|
|
212
|
+
Nothing to do. Codex uses the same skill format, and `setup` installs into
|
|
213
|
+
`$CODEX_HOME/skills` (usually `~/.codex/skills`). Restart Codex once after installing so
|
|
214
|
+
it picks up the new skills.
|
|
215
|
+
|
|
216
|
+
### GitHub Copilot in VS Code (the chat sidebar)
|
|
217
|
+
|
|
218
|
+
This is the one most people use, so read this bit.
|
|
219
|
+
|
|
220
|
+
`setup` writes **prompt files** into VS Code's user folder. Open Copilot chat, type `/`,
|
|
221
|
+
and you should see `recall`, `remember` and `handoff` in the dropdown.
|
|
222
|
+
|
|
223
|
+
**If you don't see them:**
|
|
224
|
+
|
|
225
|
+
1. Restart VS Code. New prompt files are picked up on start.
|
|
226
|
+
2. Check that prompt files are switched on. Open Settings, search for `chat.promptFiles`,
|
|
227
|
+
and make sure it is enabled. On older VS Code builds this is off by default.
|
|
228
|
+
3. Run `agent-memory doctor` to confirm the files landed in the folder VS Code is
|
|
229
|
+
actually reading.
|
|
230
|
+
|
|
231
|
+
**One thing to remember:** when you upgrade the package, re-run `agent-memory setup`.
|
|
232
|
+
Prompt files are copies, not links, so they do not update themselves.
|
|
233
|
+
|
|
234
|
+
### GitHub Copilot CLI
|
|
235
|
+
|
|
236
|
+
**Not supported, deliberately.** It is detected, and `setup` tells you it is skipping it.
|
|
237
|
+
|
|
238
|
+
Copilot CLI has no user-wide place to put instructions, so there is nothing to install
|
|
239
|
+
into. Writing a file into its config folder on a hunch is how you ship something that
|
|
240
|
+
does nothing while claiming to work.
|
|
241
|
+
|
|
242
|
+
If you want memory in a specific repository with Copilot CLI, add the instructions to
|
|
243
|
+
that repo's `.github/copilot-instructions.md` by hand. That works, but you have to do it
|
|
244
|
+
per repository — which is the exact problem this package exists to solve everywhere
|
|
245
|
+
else.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 8. Does this cost me extra requests?
|
|
250
|
+
|
|
251
|
+
Almost never, and the reason is worth knowing.
|
|
252
|
+
|
|
253
|
+
Your allowance is charged **per message you send**, not per action the assistant takes
|
|
254
|
+
while answering. So when `/handoff` saves your working state, it does it *inside* a turn
|
|
255
|
+
you already paid for. It is free.
|
|
256
|
+
|
|
257
|
+
`/remember` costs one request, because you sent one message. That is the only charge,
|
|
258
|
+
and you chose to spend it.
|
|
259
|
+
|
|
260
|
+
The savings run the other way. Every question your memory answers is a conversation you
|
|
261
|
+
did not have to have twice.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## 9. What it will not do
|
|
266
|
+
|
|
267
|
+
Being clear about this now saves disappointment later.
|
|
268
|
+
|
|
269
|
+
- **It does not save things on its own.** You invoke it, or `/handoff` does. Nothing
|
|
270
|
+
runs in the background. This is a deliberate choice: memory that fills itself up
|
|
271
|
+
becomes memory you cannot trust.
|
|
272
|
+
- **It does not sync between machines.** Your notes live on the computer that wrote
|
|
273
|
+
them. There is no server, no account, no cloud.
|
|
274
|
+
- **It is not shared with your team.** One person, one machine, for now.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 10. Where your things live, and who can see them
|
|
279
|
+
|
|
280
|
+
Everything is in one folder:
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
~/.agents/ (on Windows: C:\Users\you\.agents\)
|
|
284
|
+
handoffs/ your saved working states
|
|
285
|
+
memory/notes/ your notes, as plain markdown files
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Three things worth knowing:
|
|
289
|
+
|
|
290
|
+
**Nothing leaves your machine.** No server, no account, no telemetry, no background
|
|
291
|
+
process, nothing to get approved by IT. It is a small program that writes text files.
|
|
292
|
+
|
|
293
|
+
**Passwords and keys never get written down.** Anything that looks like a token, a key,
|
|
294
|
+
a connection string or a session cookie is replaced with `<redacted>` *before* anything
|
|
295
|
+
is saved — not to a note, not to a temporary file. There is no way to switch this off,
|
|
296
|
+
which is the point.
|
|
297
|
+
|
|
298
|
+
**Your notes are just files.** Open them in any text editor. Read them, edit them, put
|
|
299
|
+
them in Dropbox, print them out. If you uninstall this tool tomorrow, every note stays
|
|
300
|
+
exactly where it is and remains perfectly readable. You are not locked in — there is
|
|
301
|
+
nothing to be locked into.
|
|
302
|
+
|
|
303
|
+
**Nothing is ever deleted.** Notes that get replaced or go stale move to an `archive`
|
|
304
|
+
folder rather than disappearing.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 11. When something is wrong
|
|
309
|
+
|
|
310
|
+
**Start here, always:**
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
agent-memory doctor
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
| Symptom | What's going on |
|
|
317
|
+
|---|---|
|
|
318
|
+
| `/recall` doesn't appear in VS Code | Restart VS Code, then check the `chat.promptFiles` setting. See §7. |
|
|
319
|
+
| The commands vanished after an upgrade | Re-run `agent-memory setup`. |
|
|
320
|
+
| It answers with outdated information | Notes show their age. Anything captured long ago is flagged `verify before trusting` — that flag is doing its job, and you should. |
|
|
321
|
+
| `doctor` reports broken links | Usually means Node moved. Re-run `agent-memory setup`. |
|
|
322
|
+
| Something is badly confused | `agent-memory compact` tidies and rebuilds. Your notes are the source of truth, so this cannot lose anything. |
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## 12. Removing it
|
|
327
|
+
|
|
328
|
+
**The order matters, and npm will not do it for you:**
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
agent-memory uninstall # first — this removes the commands from your tools
|
|
332
|
+
npm uninstall -g @vib795/agent-memory
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
If you do it the other way round, npm deletes the program *including the part that
|
|
336
|
+
cleans up*, and your AI tools are left with commands that point at nothing. If that has
|
|
337
|
+
already happened, install it again and run `agent-memory setup` — that clears the dead
|
|
338
|
+
commands and puts working ones back.
|
|
339
|
+
|
|
340
|
+
Your notes are untouched either way. They are at `~/.agents/memory`, they are plain
|
|
341
|
+
text, and deleting them is your decision to make, not the uninstaller's.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Cheat sheet
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
node --version # must be 22.5+
|
|
349
|
+
npm install -g @vib795/agent-memory # 1. download
|
|
350
|
+
agent-memory setup # 2. install into your AI tools
|
|
351
|
+
agent-memory doctor # is everything OK?
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Then, in any AI chat:
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
/remember keep what we just worked out
|
|
358
|
+
/handoff save my place so another window can continue
|
|
359
|
+
/recall what do we already know about this?
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
And most of the time, just ask your question normally and let it find the answer itself.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
*More detail, and the reasoning behind the design, is in the
|
|
367
|
+
[README](README.md). Problems and ideas go in
|
|
368
|
+
[issues](https://github.com/vib795/agent-memory/issues).*
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Utkarsh Singh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# agent-memory
|
|
2
|
+
|
|
3
|
+
[](https://github.com/vib795/agent-memory/actions/workflows/test.yml)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](package.json)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
Give **GitHub Copilot** and **Claude Code** a memory that outlives the window, the
|
|
9
|
+
repository, and the week — using nothing an IT security review would need to approve.
|
|
10
|
+
|
|
11
|
+
Three user-level Agent Skills over one local store:
|
|
12
|
+
|
|
13
|
+
| Skill | What it does |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `/handoff` | Writes a portable working-state file so another window can pick up this thread |
|
|
16
|
+
| `/remember` | Captures durable knowledge into a cross-repo graph |
|
|
17
|
+
| `/recall` | Answers from that graph before deriving anything again |
|
|
18
|
+
|
|
19
|
+
**New here? Read the [HOW-TO](HOWTO.md)** — install, first five minutes, and the
|
|
20
|
+
per-tool notes for Claude Code, Codex and Copilot, written for people who do not
|
|
21
|
+
want to read the rest of this file.
|
|
22
|
+
|
|
23
|
+
## Why this exists
|
|
24
|
+
|
|
25
|
+
Moving context between windows today means copy-pasting the chat, retyping from
|
|
26
|
+
memory, and re-explaining. That costs 10 to 15 minutes per switch and burns premium
|
|
27
|
+
request credits re-deriving conclusions already reached.
|
|
28
|
+
|
|
29
|
+
Nothing in the platform closes the gap:
|
|
30
|
+
|
|
31
|
+
| Mechanism | Why it doesn't help |
|
|
32
|
+
|---|---|
|
|
33
|
+
| Copilot Memory | Repo-scoped by design. Facts "can only be used in operations on the same repository", and expire after 28 days |
|
|
34
|
+
| `/fork` | Copies a conversation inside one workspace |
|
|
35
|
+
| Prompt files in `.github/prompts/` | Workspace-scoped, so every repo needs its own copy |
|
|
36
|
+
| Third-party memory plugins | Blocked in many managed environments |
|
|
37
|
+
|
|
38
|
+
## Zero runtime dependencies
|
|
39
|
+
|
|
40
|
+
`node:sqlite` has shipped inside Node core since 22.5, so the graph index needs no
|
|
41
|
+
package, no service, and no network. `npm ls -g --depth 0` shows nothing under it.
|
|
42
|
+
On a locked-down desktop that is the difference between "a Node script" and "a new
|
|
43
|
+
database", which is the entire argument you will have to make to get this approved.
|
|
44
|
+
|
|
45
|
+
- **Markdown is the source of truth.** `index.db` is a disposable cache; delete it
|
|
46
|
+
and `agent-memory index` rebuilds it byte-identically.
|
|
47
|
+
- **Nothing leaves the machine.** No daemon, no scheduled task, no telemetry.
|
|
48
|
+
- **Uninstalling leaves readable notes behind.** The store is plain markdown and
|
|
49
|
+
stays useful with no tooling at all.
|
|
50
|
+
|
|
51
|
+
## The memory graph
|
|
52
|
+
|
|
53
|
+
Notes live at `%USERPROFILE%\.agents\memory\notes\<type>\<id>.md`, outside every
|
|
54
|
+
repository — that is what makes a note written in one project readable from another.
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
id: auth-service
|
|
58
|
+
type: system # system | decision | convention | constraint
|
|
59
|
+
title: Auth uses server sessions
|
|
60
|
+
scope: repo # repo | global
|
|
61
|
+
confidence: observed # observed | inferred
|
|
62
|
+
captured_sha: a1b2c3d # repo HEAD at capture; drives the staleness signal
|
|
63
|
+
repos: [orders-api]
|
|
64
|
+
edges:
|
|
65
|
+
- rel: depends-on # depends-on | applies-to | supersedes | contradicts | evidence-for
|
|
66
|
+
dst: postgres-primary
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Traversal is a SQLite recursive CTE. There is no graph layer on top of SQLite; the
|
|
70
|
+
recursive CTE *is* the graph engine, and `UNION` plus a depth bound is what keeps a
|
|
71
|
+
`contradicts` cycle from recursing forever.
|
|
72
|
+
|
|
73
|
+
### What keeps it honest
|
|
74
|
+
|
|
75
|
+
- **Staleness is visible at the moment of use.** Every note records the repo HEAD it
|
|
76
|
+
was captured at. On recall, `get` prints `captured 47 commits ago — verify before
|
|
77
|
+
trusting`. A note that quietly rots is worse than no note.
|
|
78
|
+
- **Redaction is fail-closed.** Keys, tokens, connection strings, private keys,
|
|
79
|
+
session cookies, internal hosts and foreign email addresses are replaced before any
|
|
80
|
+
byte reaches disk — not to a note, not to a temp file, not to the index.
|
|
81
|
+
- **Truncation is never silent.** Whenever the tree or the retrieval budget drops
|
|
82
|
+
something, the omitted ids are printed. Silent truncation reads as full coverage.
|
|
83
|
+
- **Constraints are never dropped.** At any cap, in either tier. A constraint is what
|
|
84
|
+
stops an agent burning a retry loop on an approach that was never going to ship.
|
|
85
|
+
|
|
86
|
+
## CLI
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
agent-memory init [--skills "<p1>,<p2>"] create the store, register skill files
|
|
90
|
+
agent-memory index rebuild index.db from notes/
|
|
91
|
+
agent-memory tree [--repo <name>] [--all] routing map, scoped to a repo
|
|
92
|
+
agent-memory get <id> [--depth N] a note plus its neighborhood
|
|
93
|
+
[--budget N] [--include-archived]
|
|
94
|
+
agent-memory search <terms> [--limit N] full-text fallback when the tree misses
|
|
95
|
+
agent-memory write --from-json <file> validated upsert; used by the skills
|
|
96
|
+
agent-memory compact dedup, decay, reindex, regenerate
|
|
97
|
+
agent-memory doctor preflight and health report
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Every command takes `--json`. Every cap lives in `config.json` and is tunable.
|
|
101
|
+
|
|
102
|
+
## Install
|
|
103
|
+
|
|
104
|
+
Two commands, and the second one is not optional:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm install -g @vib795/agent-memory
|
|
108
|
+
agent-memory setup
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Straight from git works too, and needs no registry access:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm install -g https://github.com/vib795/agent-memory.git
|
|
115
|
+
agent-memory setup
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`setup` probes for every agent on the machine and installs into each one it finds,
|
|
119
|
+
in whatever format that tool reads. It then creates the store and generates the
|
|
120
|
+
routing digest.
|
|
121
|
+
|
|
122
|
+
| Detected | Installed as | Where |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| Agent skills (shared convention) | linked skill directory | `~/.agents/skills/<name>/` |
|
|
125
|
+
| Claude Code, CLI and VS Code extension | linked skill directory | `~/.claude/skills/<name>/` |
|
|
126
|
+
| Codex CLI | linked skill directory | `$CODEX_HOME/skills/<name>/` |
|
|
127
|
+
| VS Code, Insiders, VSCodium, Cursor, Windsurf | prompt file | `<user data>/prompts/<name>.prompt.md` |
|
|
128
|
+
| Copilot CLI | *detected, skipped* | it documents no user-global prompt directory; use `.github/copilot-instructions.md` per repo |
|
|
129
|
+
|
|
130
|
+
Prompt files are what GitHub Copilot chat reads, and they appear as `/recall`,
|
|
131
|
+
`/remember` and `/handoff` in the chat box. They are **generated from the same
|
|
132
|
+
`SKILL.md` files** rather than maintained separately, so the two formats cannot
|
|
133
|
+
drift, and `compact` regenerates the routing digest into both.
|
|
134
|
+
|
|
135
|
+
`agent-memory doctor` lists what it detected, so an install that appears to do
|
|
136
|
+
nothing tells you whether your editor was missed or simply ignored the files.
|
|
137
|
+
|
|
138
|
+
**Why it is not automatic.** There is a `postinstall` hook that does exactly this,
|
|
139
|
+
but current npm refuses to run package install scripts unless you opt in per
|
|
140
|
+
package, and prints only a warning when it skips them. Managed environments go
|
|
141
|
+
further and set `ignore-scripts=true` globally. Rather than pretend, the second
|
|
142
|
+
command is documented as part of the install. If you would rather have it automatic:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm install -g --allow-scripts=@vib795/agent-memory @vib795/agent-memory
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Either way `agent-memory doctor` tells you where you stand; it reports
|
|
149
|
+
`skills linked: none registered` when setup has not run.
|
|
150
|
+
|
|
151
|
+
Windows uses directory junctions, which need neither admin rights nor Developer
|
|
152
|
+
Mode. On a network-backed profile (FSLogix, roaming) junctions fail and the skills
|
|
153
|
+
are copied instead — setup says which one you got, and copies need
|
|
154
|
+
`agent-memory setup` re-run after each upgrade.
|
|
155
|
+
|
|
156
|
+
### From a clone
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
./install.sh # macOS / Linux
|
|
160
|
+
powershell -ExecutionPolicy Bypass -File .\install.ps1 # Windows
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Both are thin wrappers over `agent-memory setup`; the linking logic lives in
|
|
164
|
+
`src/setup.js` so there is one implementation rather than three that drift.
|
|
165
|
+
|
|
166
|
+
Note that `npm install -g .` from a clone *symlinks* rather than copies, so
|
|
167
|
+
`compact` regenerates the description in your working tree and
|
|
168
|
+
`skills/recall/SKILL.md` will show as modified. That is expected — the description
|
|
169
|
+
is generated state, and the committed value is only a placeholder.
|
|
170
|
+
|
|
171
|
+
Needs Node 22.5 or newer; `doctor` says so plainly if the version is too old, and
|
|
172
|
+
`postinstall` refuses rather than failing your install.
|
|
173
|
+
|
|
174
|
+
Run `npm test` for the suite (71 tests, no dependencies). CI runs it on Linux,
|
|
175
|
+
macOS and Windows across Node 22 and 24, and separately installs the packed tarball
|
|
176
|
+
and exercises it end to end on all three.
|
|
177
|
+
|
|
178
|
+
## It is not a chat summary
|
|
179
|
+
|
|
180
|
+
A transcript summary reads fine and still leaves the next agent asking questions.
|
|
181
|
+
`/handoff` reconstructs **working state** instead:
|
|
182
|
+
|
|
183
|
+
- **Decisions** with the *why* and what was rejected
|
|
184
|
+
- **Constraints** that are invisible in the code
|
|
185
|
+
- **Rejected approaches**, so the next agent stops re-deriving your dead ends
|
|
186
|
+
- **Next action** and what's blocking it
|
|
187
|
+
- **Uncommitted work** as a file list, never inline diffs
|
|
188
|
+
- **Anchors** — the `file:line` references that matter
|
|
189
|
+
- **Open questions** only you can answer
|
|
190
|
+
|
|
191
|
+
## Use
|
|
192
|
+
|
|
193
|
+
Two different jobs, and it is worth being clear about which is which.
|
|
194
|
+
|
|
195
|
+
**Moving a thread between windows.** In window A:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
/handoff
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
It prints a pickup line. In window B, any repo, paste it:
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Read C:\Users\you\.agents\handoffs\migrate-orders-to-result-type.md and continue this work. Follow the Next action.
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Keeping what stays true.** `/handoff` also writes durable knowledge into the graph
|
|
208
|
+
in the same request — same turn, no extra credit. Mid-session, when something worth
|
|
209
|
+
keeping is established and you are not switching windows:
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
/remember
|
|
213
|
+
/remember the retry policy on the orders webhook
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
And in any repo, later, ask a question that memory should already answer. The agent
|
|
217
|
+
invokes `/recall` on its own, because the skill description tells it what is in
|
|
218
|
+
there.
|
|
219
|
+
|
|
220
|
+
## Where things live
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
%USERPROFILE%\.agents\ (Windows; ~/.agents/ on macOS and Linux)
|
|
224
|
+
handoffs/
|
|
225
|
+
index.md one row per thread, kept small so lookup stays cheap
|
|
226
|
+
<thread-id>.md current handoff
|
|
227
|
+
<thread-id>.prev.md exactly one prior version
|
|
228
|
+
memory/
|
|
229
|
+
notes/<type>/<id>.md the source of truth, plain markdown
|
|
230
|
+
notes/archive/ superseded, merged and decayed notes; never deleted
|
|
231
|
+
index.db disposable SQLite cache, rebuildable at any time
|
|
232
|
+
ROUTING.md generated map of everything known
|
|
233
|
+
config.json every cap in the design, tunable
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Re-running `/handoff` on the same thread updates it in place and keeps one `.prev`
|
|
237
|
+
backup. Threads are matched by judgment, not by string-comparing titles, so a title
|
|
238
|
+
that drifts as the work progresses does not create a duplicate.
|
|
239
|
+
|
|
240
|
+
## Design constraints it holds to
|
|
241
|
+
|
|
242
|
+
- **Memory work costs no extra requests.** A premium request is charged per prompt,
|
|
243
|
+
not per tool call, so capture rides inside a turn you already paid for. Only
|
|
244
|
+
`/remember` costs a request, and only because you chose to spend it.
|
|
245
|
+
- **Zero infrastructure.** Files and Node core. No daemon, no server, no scheduled
|
|
246
|
+
task, no network call, nothing for an IT policy to approve.
|
|
247
|
+
- **Secrets never hit disk.** Tokens, keys, and connection strings become
|
|
248
|
+
`<redacted:kind>` before any byte is written — not to a note, not to a temp file,
|
|
249
|
+
not to the index. There is no bypass flag.
|
|
250
|
+
- **Nothing is deleted.** Superseded, merged and decayed notes move to `archive/`
|
|
251
|
+
and stay reachable with `--include-archived`.
|
|
252
|
+
- **Reversible.** `npm uninstall -g agent-memory` removes the links and leaves every
|
|
253
|
+
note in place, readable with nothing installed.
|
|
254
|
+
|
|
255
|
+
## Status
|
|
256
|
+
|
|
257
|
+
Capture is **explicit**. You invoke it, or `/handoff` does; nothing fires on its own.
|
|
258
|
+
|
|
259
|
+
Not built yet, by choice:
|
|
260
|
+
|
|
261
|
+
- Automatic or ambient capture
|
|
262
|
+
- Team sharing, multi-machine sync
|
|
263
|
+
- An MCP server. It would read this same store, so it is an addition, not a rewrite.
|
|
264
|
+
|
|
265
|
+
What is deliberately unproven, and where you will find out: the cold-read test — a
|
|
266
|
+
fresh chat in a repo untouched for a month, answering correctly from the digest
|
|
267
|
+
alone. That needs real elapsed time and cannot be faked in a test suite.
|
|
268
|
+
|
|
269
|
+
## Uninstall
|
|
270
|
+
|
|
271
|
+
Order matters, and npm will not do it for you:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
agent-memory uninstall # first — removes every skill link and prompt file
|
|
275
|
+
npm uninstall -g @vib795/agent-memory
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
npm 7 dropped support for uninstall lifecycle hooks, so `npm uninstall -g` on its
|
|
279
|
+
own deletes the package and leaves a symlink per skill per agent pointing at nothing
|
|
280
|
+
— which every one of those agents will still try to load. Running it in the other
|
|
281
|
+
order is unrecoverable by
|
|
282
|
+
tooling, because the binary that would clean up has already been removed.
|
|
283
|
+
|
|
284
|
+
If that already happened, reinstalling and re-running `agent-memory setup` repairs it:
|
|
285
|
+
`setup` clears each stale link before writing the new one. Reinstalling alone is not
|
|
286
|
+
enough unless you passed `--allow-scripts`, since that is the same hook npm declines to
|
|
287
|
+
run. If you are not reinstalling, delete `~/.agents/skills/{handoff,recall,remember}`
|
|
288
|
+
and the equivalents under the other agent directories by hand.
|
|
289
|
+
|
|
290
|
+
`agent-memory doctor` reports broken links by path under `no broken skill links`.
|
|
291
|
+
That catches the case reinstalling does not: links pointing at a global prefix that
|
|
292
|
+
moved, which is what an `nvm` version switch does to a globally installed package.
|
|
293
|
+
|
|
294
|
+
`uninstall` only removes links that resolve back to this package — a skill you put
|
|
295
|
+
there yourself is left alone. Your notes stay at `~/.agents/memory`: they are plain
|
|
296
|
+
markdown, they outlive the tool that indexed them, and removing them is your call.
|
|
297
|
+
|
|
298
|
+
## Specs
|
|
299
|
+
|
|
300
|
+
- [issue #1](https://github.com/vib795/agent-memory/issues/1) — `/handoff`
|
|
301
|
+
- [issue #4](https://github.com/vib795/agent-memory/issues/4) — the memory
|
|
302
|
+
graph, with a comment listing every place the shipped code diverged from the spec
|