@vib795/agent-memory 0.1.9 → 0.1.11

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 CHANGED
@@ -236,16 +236,17 @@ Prompt files are copies, not links, so they do not update themselves.
236
236
 
237
237
  ### GitHub Copilot CLI
238
238
 
239
- **Not supported, deliberately.** It is detected, and `setup` tells you it is skipping it.
239
+ **Supported.** `setup` installs the three skills into `~/.copilot/skills/<name>/`, and
240
+ they appear as `/handoff`, `/remember` and `/recall`.
240
241
 
241
- Copilot CLI has no user-wide place to put instructions, so there is nothing to install
242
- into. Writing a file into its config folder on a hunch is how you ship something that
243
- does nothing while claiming to work.
242
+ GitHub documents two personal skill directories, `~/.copilot/skills` and
243
+ `~/.agents/skills`, and Copilot reads both. The shared one is always written, so
244
+ Copilot is served even on a machine that has never run the CLI; the `.copilot` one is
245
+ written as well when that directory exists, so a machine that has run it keeps its
246
+ skills where its own documentation says to look.
244
247
 
245
- If you want memory in a specific repository with Copilot CLI, add the instructions to
246
- that repo's `.github/copilot-instructions.md` by hand. That works, but you have to do it
247
- per repository — which is the exact problem this package exists to solve everywhere
248
- else.
248
+ Earlier versions of this guide said Copilot CLI was unsupported. That was true when it
249
+ was written and stopped being true in 0.1.5.
249
250
 
250
251
  ---
251
252
 
@@ -326,9 +327,40 @@ agent-memory doctor
326
327
 
327
328
  ---
328
329
 
329
- ## 12. Removing it
330
+ ## 12. Updating it
330
331
 
331
- **The order matters, and npm will not do it for you:**
332
+ **Installed from npm:**
333
+
334
+ ```bash
335
+ npm install -g @vib795/agent-memory@latest
336
+ agent-memory setup
337
+ ```
338
+
339
+ The second line is not optional. Prompt files are copies rather than links, so VS Code
340
+ keeps reading the old text until something rewrites them, and nothing warns you.
341
+
342
+ **Installed from a clone** — one command, which pulls and re-runs the installer:
343
+
344
+ ```bash
345
+ ./update.sh # macOS / Linux
346
+ powershell -ExecutionPolicy Bypass -File .\update.ps1 # Windows
347
+ ```
348
+
349
+ Both finish with `agent-memory doctor`, so you find out straight away if a tool was
350
+ left holding stale files. Your notes are never touched by an upgrade.
351
+
352
+ ---
353
+
354
+ ## 13. Removing it
355
+
356
+ **One command, which does the two steps in the order that works:**
357
+
358
+ ```bash
359
+ ./uninstall.sh # macOS / Linux
360
+ powershell -ExecutionPolicy Bypass -File .\uninstall.ps1 # Windows
361
+ ```
362
+
363
+ **Or by hand. The order matters, and npm will not do it for you:**
332
364
 
333
365
  ```bash
334
366
  agent-memory uninstall # first — this removes the commands from your tools
package/README.md CHANGED
@@ -96,6 +96,7 @@ agent-memory get <id> [--depth N] a note plus its neighborhood
96
96
  [--budget N] [--include-archived]
97
97
  agent-memory search <terms> [--limit N] full-text fallback when the tree misses
98
98
  agent-memory write --from-json <file> validated upsert; used by the skills
99
+ --from-json - read the JSON from stdin instead
99
100
  agent-memory compact dedup, decay, reindex, regenerate
100
101
  agent-memory doctor preflight and health report
101
102
  ```
@@ -397,10 +398,40 @@ What is deliberately unproven, and where you will find out: the cold-read test
397
398
  fresh chat in a repo untouched for a month, answering correctly from the digest
398
399
  alone. That needs real elapsed time and cannot be faked in a test suite.
399
400
 
401
+ ## Update
402
+
403
+ An upgrade is not finished until `setup` has run again. Prompt files are copies
404
+ rather than links, so an editor keeps reading the old text until something rewrites
405
+ them, and nothing warns you.
406
+
407
+ **Installed from npm:**
408
+
409
+ ```bash
410
+ npm install -g @vib795/agent-memory@latest
411
+ agent-memory setup
412
+ ```
413
+
414
+ **Installed from a clone** — one command, which pulls and re-runs the installer:
415
+
416
+ ```bash
417
+ ./update.sh # macOS / Linux
418
+ powershell -ExecutionPolicy Bypass -File .\update.ps1 # Windows
419
+ ```
420
+
421
+ Both end in `agent-memory doctor`, so you find out immediately if an agent was left
422
+ holding stale files. Your notes are never touched by an upgrade.
423
+
400
424
  ## Uninstall
401
425
 
402
426
  Order matters, and npm will not do it for you:
403
427
 
428
+ ```bash
429
+ ./uninstall.sh # macOS / Linux
430
+ powershell -ExecutionPolicy Bypass -File .\uninstall.ps1 # Windows
431
+ ```
432
+
433
+ Or by hand, which is the same two steps in the same order:
434
+
404
435
  ```bash
405
436
  agent-memory uninstall # first — removes every skill link and prompt file
406
437
  npm uninstall -g @vib795/agent-memory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vib795/agent-memory",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Durable cross-repo knowledge graph for GitHub Copilot and Claude Code. Markdown source of truth, disposable SQLite index, zero runtime dependencies.",
5
5
  "keywords": [
6
6
  "github-copilot",
@@ -36,6 +36,10 @@
36
36
  "skills/",
37
37
  "install.sh",
38
38
  "install.ps1",
39
+ "update.sh",
40
+ "update.ps1",
41
+ "uninstall.sh",
42
+ "uninstall.ps1",
39
43
  "README.md",
40
44
  "HOWTO.md",
41
45
  "LICENSE"
@@ -274,8 +274,7 @@ Types are `system`, `decision`, `convention`, `constraint`. Edge relations are
274
274
  `depends-on`, `applies-to`, `supersedes`, `contradicts`, `evidence-for`.
275
275
 
276
276
  ```bash
277
- tmp="$(mktemp)"
278
- cat > "$tmp" <<'JSON'
277
+ agent-memory write --from-json - --source handoff <<'JSON'
279
278
  {"nodes":[
280
279
  {"id":"use-sessions","type":"decision",
281
280
  "title":"Chose server sessions over JWT",
@@ -283,19 +282,21 @@ cat > "$tmp" <<'JSON'
283
282
  "edges":[{"rel":"evidence-for","dst":"auth-service"}]}
284
283
  ]}
285
284
  JSON
286
- agent-memory write --from-json "$tmp" --source handoff
287
- rm -f "$tmp"
288
285
  ```
289
286
 
290
287
  ```powershell
291
- $tmp = [System.IO.Path]::GetTempFileName()
292
288
  @'
293
289
  <the JSON>
294
- '@ | Set-Content -Path $tmp -Encoding UTF8
295
- agent-memory write --from-json $tmp --source handoff
296
- Remove-Item -Force $tmp
290
+ '@ | Set-Content -Path .agent-memory-write.json -Encoding UTF8
291
+ agent-memory write --from-json .agent-memory-write.json --source handoff
292
+ Remove-Item -Force .agent-memory-write.json
297
293
  ```
298
294
 
295
+ **Use these as written. Do not introduce a variable.** Some agent terminals rewrite
296
+ `$`-prefixed lines before the shell sees them, corrupting the payload into malformed
297
+ JSON. PowerShell writes a file rather than piping because Windows PowerShell pipes to
298
+ a native command using `$OutputEncoding`, which is not UTF-8 by default.
299
+
299
300
  `write` redacts before anything reaches disk and reports every validation error at
300
301
  once. Surface its warnings verbatim; a `title collision` warning means two ids now
301
302
  describe the same thing and the user should know.
@@ -98,25 +98,32 @@ Fields you may set: `id`, `type`, `title`, `body`, `repos`, `scope`, `confidence
98
98
  **bash (macOS / Linux):**
99
99
 
100
100
  ```bash
101
- tmp="$(mktemp)"
102
- cat > "$tmp" <<'JSON'
101
+ agent-memory write --from-json - --source remember <<'JSON'
103
102
  <the JSON from Step 2>
104
103
  JSON
105
- agent-memory write --from-json "$tmp" --source remember
106
- rm -f "$tmp"
107
104
  ```
108
105
 
109
106
  **PowerShell (Windows / AVD):**
110
107
 
111
108
  ```powershell
112
- $tmp = [System.IO.Path]::GetTempFileName()
113
109
  @'
114
110
  <the JSON from Step 2>
115
- '@ | Set-Content -Path $tmp -Encoding UTF8
116
- agent-memory write --from-json $tmp --source remember
117
- Remove-Item -Force $tmp
111
+ '@ | Set-Content -Path .agent-memory-write.json -Encoding UTF8
112
+ agent-memory write --from-json .agent-memory-write.json --source remember
113
+ Remove-Item -Force .agent-memory-write.json
118
114
  ```
119
115
 
116
+ **Use these as written. Do not introduce a variable.** Some agent terminals rewrite
117
+ `$`-prefixed lines before the shell sees them, which turns the payload into malformed
118
+ JSON and costs you two retries diagnosing a corruption that never reached disk. Both
119
+ recipes above are free of variables for that reason.
120
+
121
+ PowerShell writes a file rather than piping, because Windows PowerShell pipes to a
122
+ native command using `$OutputEncoding`, which is not UTF-8 by default and would mangle
123
+ any non-ASCII character in a body. `-Encoding UTF8` on a file is explicit and safe. The
124
+ file is written next to you and removed on the next line; if you see it left behind,
125
+ the write failed and the JSON is still there to read.
126
+
120
127
  Redaction runs inside `write`, before any bytes reach disk, and cannot be turned
121
128
  off. You still must not paste a raw secret into the JSON: the guard is a backstop,
122
129
  not a licence.
package/src/cli.js CHANGED
@@ -298,7 +298,11 @@ function cmdSearch(opts) {
298
298
  }
299
299
 
300
300
  function readNodesFrom(file) {
301
- const raw = JSON.parse(readFileSync(file, 'utf8'));
301
+ // `-` means stdin. Naming a temp file takes a shell variable, and some agent
302
+ // terminals rewrite `$`-prefixed lines before the shell ever sees them, which
303
+ // corrupts the payload into malformed JSON with nothing to point at. Reading the
304
+ // document straight off the pipe removes the variable, and with it the failure.
305
+ const raw = JSON.parse(readFileSync(file === '-' ? 0 : file, 'utf8'));
302
306
  if (Array.isArray(raw)) return raw;
303
307
  if (Array.isArray(raw?.nodes)) return raw.nodes;
304
308
  return [raw];
@@ -306,11 +310,11 @@ function readNodesFrom(file) {
306
310
 
307
311
  function cmdWrite(opts) {
308
312
  const file = opts['from-json'];
309
- if (!file || file === true || !existsSync(file)) {
313
+ if (!file || file === true || (file !== '-' && !existsSync(file))) {
310
314
  return {
311
315
  ok: false,
312
- error: 'write requires --from-json <file>',
313
- text: 'write requires --from-json <file>',
316
+ error: 'write requires --from-json <file>, or - to read stdin',
317
+ text: 'write requires --from-json <file>, or - to read stdin',
314
318
  };
315
319
  }
316
320
 
package/uninstall.ps1 ADDED
@@ -0,0 +1,54 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Removes the skills and the CLI, in the order that is recoverable.
4
+
5
+ .DESCRIPTION
6
+ npm will not enforce that order and gets it wrong on its own: `npm uninstall -g`
7
+ deletes the package and leaves one link per skill per agent pointing at nothing,
8
+ which every one of those agents still tries to load. By then the binary that would
9
+ have cleaned them up is gone too, so tooling cannot fix it. This unlinks first and
10
+ removes the package second.
11
+
12
+ Your notes are never touched. They are plain markdown under
13
+ %USERPROFILE%\.agents\memory, they outlive the tool that indexed them, and removing
14
+ them is your call, not this script's.
15
+
16
+ .EXAMPLE
17
+ powershell -ExecutionPolicy Bypass -File .\uninstall.ps1
18
+ #>
19
+
20
+ # Not 'Stop': a half-finished uninstall is worse than a reported failure, so each step
21
+ # is allowed to fail and say so.
22
+ $ErrorActionPreference = 'Continue'
23
+
24
+ $source = $PSScriptRoot
25
+
26
+ $node = Get-Command node -ErrorAction SilentlyContinue
27
+ if (-not $node) {
28
+ Write-Error "node not found on PATH. agent-memory needs Node >= 22.5."
29
+ exit 1
30
+ }
31
+
32
+ Write-Host "Removing skills" -ForegroundColor Cyan
33
+ # Run from the checkout rather than the installed binary, so this still works when the
34
+ # global package is already gone.
35
+ & node (Join-Path $source 'src\cli.js') uninstall
36
+
37
+ Write-Host ""
38
+ Write-Host "Removing the CLI" -ForegroundColor Cyan
39
+ try {
40
+ & npm uninstall -g '@vib795/agent-memory' 2>&1 | Out-Null
41
+ $npmExit = $LASTEXITCODE
42
+ } catch {
43
+ $npmExit = 1
44
+ }
45
+
46
+ if ($npmExit -eq 0) {
47
+ Write-Host " [npm] package removed" -ForegroundColor Green
48
+ } else {
49
+ Write-Host " [npm] not removed. It may not be installed globally:" -ForegroundColor Yellow
50
+ Write-Host " npm uninstall -g `"@vib795/agent-memory`"" -ForegroundColor Yellow
51
+ }
52
+
53
+ Write-Host ""
54
+ Write-Host "Done. Your notes are untouched." -ForegroundColor Cyan
package/uninstall.sh ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bash
2
+ # Removes the skills and the CLI, in the order that is recoverable.
3
+ #
4
+ # npm will not enforce that order and gets it wrong on its own: `npm uninstall -g`
5
+ # deletes the package and leaves one link per skill per agent pointing at nothing,
6
+ # which every one of those agents still tries to load. By then the binary that would
7
+ # have cleaned them up is gone too, so tooling cannot fix it. Unlink first, remove
8
+ # the package second.
9
+ #
10
+ # Your notes are never touched. They are plain markdown under ~/.agents/memory, they
11
+ # outlive the tool that indexed them, and removing them is your call, not this script's.
12
+ #
13
+ # No `set -e`: a half-finished uninstall is worse than a reported failure, so each
14
+ # step is allowed to fail and say so.
15
+ set -uo pipefail
16
+
17
+ source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
+
19
+ if ! command -v node >/dev/null 2>&1; then
20
+ echo "node not found on PATH. agent-memory needs Node >= 22.5." >&2
21
+ exit 1
22
+ fi
23
+
24
+ echo "Removing skills"
25
+ # Run from the checkout rather than the installed binary, so this still works when
26
+ # the global package is already gone.
27
+ node "$source_dir/src/cli.js" uninstall
28
+
29
+ echo
30
+ echo "Removing the CLI"
31
+ if npm uninstall -g @vib795/agent-memory >/dev/null 2>&1; then
32
+ echo " [npm] package removed"
33
+ else
34
+ echo " [npm] not removed. It may not be installed globally, or may need sudo:"
35
+ echo " npm uninstall -g @vib795/agent-memory"
36
+ fi
37
+
38
+ echo
39
+ echo "Done. Your notes are untouched at ${AGENT_MEMORY_HOME:-$HOME/.agents/memory}."
package/update.ps1 ADDED
@@ -0,0 +1,45 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Updates a clone install: pull, then re-run the installer.
4
+
5
+ .DESCRIPTION
6
+ The install logic is deliberately not repeated here. install.ps1 already relinks the
7
+ skills, relinks the CLI and runs doctor; an update is exactly that plus a pull, and
8
+ writing it a second time is how the two drift.
9
+
10
+ Re-running setup is not optional on an upgrade. Prompt files are copies rather than
11
+ links, so VS Code keeps reading the old text until something rewrites it.
12
+
13
+ .EXAMPLE
14
+ powershell -ExecutionPolicy Bypass -File .\update.ps1
15
+ #>
16
+
17
+ $ErrorActionPreference = 'Stop'
18
+
19
+ $source = $PSScriptRoot
20
+
21
+ if (-not (Test-Path (Join-Path $source '.git'))) {
22
+ Write-Host "This is not a git checkout, so there is nothing to pull." -ForegroundColor Yellow
23
+ Write-Host "If you installed from npm, update with:" -ForegroundColor Yellow
24
+ Write-Host " npm install -g @vib795/agent-memory@latest" -ForegroundColor Yellow
25
+ Write-Host " agent-memory setup" -ForegroundColor Yellow
26
+ exit 1
27
+ }
28
+
29
+ Write-Host "Pulling" -ForegroundColor Cyan
30
+ # git writes ordinary progress to stderr, and `Stop` would treat that as terminating.
31
+ $previousPreference = $ErrorActionPreference
32
+ $ErrorActionPreference = 'Continue'
33
+ try {
34
+ & git -C $source pull --ff-only 2>&1 | Write-Host
35
+ $gitExit = $LASTEXITCODE
36
+ } finally {
37
+ $ErrorActionPreference = $previousPreference
38
+ }
39
+ if ($gitExit -ne 0) {
40
+ Write-Error "git pull failed. Resolve that first, then run this again."
41
+ exit 1
42
+ }
43
+
44
+ Write-Host ""
45
+ & powershell -ExecutionPolicy Bypass -File (Join-Path $source 'install.ps1')
package/update.sh ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ # Updates a clone install: pull, then re-run the installer.
3
+ #
4
+ # The install logic is deliberately not repeated here. install.sh already relinks the
5
+ # skills, relinks the CLI and runs doctor; an update is exactly that plus a pull, and
6
+ # writing it a second time is how the two drift.
7
+ #
8
+ # Re-running setup is not optional on an upgrade. Prompt files are copies rather than
9
+ # links, so an editor keeps reading the old text until something rewrites it.
10
+ set -euo pipefail
11
+
12
+ source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13
+
14
+ if [ ! -d "$source_dir/.git" ]; then
15
+ echo "This is not a git checkout, so there is nothing to pull." >&2
16
+ echo "If you installed from npm, update with:" >&2
17
+ echo " npm install -g @vib795/agent-memory@latest" >&2
18
+ echo " agent-memory setup" >&2
19
+ exit 1
20
+ fi
21
+
22
+ echo "Pulling"
23
+ git -C "$source_dir" pull --ff-only
24
+
25
+ echo
26
+ exec "$source_dir/install.sh"