@vib795/agent-memory 0.1.8 → 0.1.10
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 +1 -0
- package/package.json +1 -1
- package/skills/handoff/SKILL.md +9 -8
- package/skills/remember/SKILL.md +15 -8
- package/src/cli.js +22 -5
- package/src/setup.js +14 -3
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
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vib795/agent-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
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",
|
package/skills/handoff/SKILL.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
295
|
-
agent-memory write --from-json
|
|
296
|
-
Remove-Item -Force
|
|
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.
|
package/skills/remember/SKILL.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
116
|
-
agent-memory write --from-json
|
|
117
|
-
Remove-Item -Force
|
|
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
|
-
|
|
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
|
|
|
@@ -565,7 +569,20 @@ function main(argv) {
|
|
|
565
569
|
try {
|
|
566
570
|
result = fn(opts);
|
|
567
571
|
} catch (err) {
|
|
568
|
-
|
|
572
|
+
// err.message on its own loses the syscall and the path, which is the whole
|
|
573
|
+
// difference between "Path is a directory" and knowing which path and which
|
|
574
|
+
// operation. A user hitting this on a machine you cannot log into should be able
|
|
575
|
+
// to paste one line and have it be enough; a stack is one env var further.
|
|
576
|
+
const detail = [err.code, err.syscall, err.path].filter(Boolean).join(' ');
|
|
577
|
+
const line = detail ? `Error: ${err.message} [${detail}]` : `Error: ${err.message}`;
|
|
578
|
+
result = {
|
|
579
|
+
ok: false,
|
|
580
|
+
error: err.message,
|
|
581
|
+
code: err.code ?? null,
|
|
582
|
+
syscall: err.syscall ?? null,
|
|
583
|
+
path: err.path ?? null,
|
|
584
|
+
text: process.env.AGENT_MEMORY_DEBUG ? `${line}\n${err.stack}` : line,
|
|
585
|
+
};
|
|
569
586
|
}
|
|
570
587
|
|
|
571
588
|
if (opts.json) {
|
package/src/setup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
mkdirSync, rmSync, existsSync, lstatSync, symlinkSync, cpSync, readlinkSync, readFileSync,
|
|
2
|
+
mkdirSync, rmSync, rmdirSync, existsSync, lstatSync, symlinkSync, cpSync, readlinkSync, readFileSync,
|
|
3
3
|
} from 'node:fs';
|
|
4
4
|
import { join, dirname, resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -45,8 +45,19 @@ function isLink(path) {
|
|
|
45
45
|
function clear(path) {
|
|
46
46
|
// A stale symlink must be removed as a link rather than followed, or clearing it
|
|
47
47
|
// would delete the packaged skills on the other end.
|
|
48
|
-
if (isLink(path))
|
|
49
|
-
|
|
48
|
+
if (isLink(path)) {
|
|
49
|
+
try {
|
|
50
|
+
rmSync(path, { force: true });
|
|
51
|
+
} catch {
|
|
52
|
+
// A Windows directory junction reports as a symbolic link but deletes like a
|
|
53
|
+
// directory, and rmSync without `recursive` can reject it as EISDIR. rmdirSync
|
|
54
|
+
// removes the junction itself and never descends, so the skills on the other
|
|
55
|
+
// end stay put — which is exactly what passing `recursive` here would risk.
|
|
56
|
+
rmdirSync(path);
|
|
57
|
+
}
|
|
58
|
+
} else if (existsSync(path)) {
|
|
59
|
+
rmSync(path, { recursive: true, force: true });
|
|
60
|
+
}
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
/**
|