create-ai-memory 0.14.2 → 0.15.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/README.md +369 -293
- package/bin/ai-mem-mcp.js +2 -0
- package/bin/ai-mem-serve.js +11 -1
- package/bin/create-ai-memory.js +11 -1
- package/hooks/claude/session-start.sh +9 -0
- package/hooks/claude/session-summary.sh +21 -2
- package/install.sh +3 -3
- package/package.json +1 -1
- package/shell/adapters.zsh +15 -0
- package/shell/ai-mem.zsh +645 -26
- package/web/viewer.html +25 -2
package/bin/ai-mem-mcp.js
CHANGED
|
@@ -109,6 +109,8 @@ const INSTRUCTIONS = [
|
|
|
109
109
|
'',
|
|
110
110
|
'Before answering anything about their work, call get_context. It returns their profile, standards, the current project note, and what the last session concluded.',
|
|
111
111
|
'Before solving a problem, call search_memory -- they may have solved it already, and repeating a solved mistake is the failure this vault exists to prevent. Search broadly first; too specific a first query is the usual way to miss something.',
|
|
112
|
+
'When you hit a blocker -- an error you do not understand, an unclear failure, or a second failed attempt at the same thing -- search again before guessing. Lessons rank above session logs, so a hit under _lessons/ is the recorded fix.',
|
|
113
|
+
'Search ONE distinctive word, not a sentence. Matching is literal substring: a whole error line finds nothing, and a bare tool name returns hundreds of irrelevant lines. Pick the most unusual word in the symptom and try two or three separately.',
|
|
112
114
|
'',
|
|
113
115
|
'Write back. A session that only reads leaves nothing behind, and the next one starts cold:',
|
|
114
116
|
'- add_note for what happened, decided, or broke during this session.',
|
package/bin/ai-mem-serve.js
CHANGED
|
@@ -181,14 +181,24 @@ function buildGraph() {
|
|
|
181
181
|
const seen = new Set();
|
|
182
182
|
const edges = [];
|
|
183
183
|
for (const n of nodes) {
|
|
184
|
+
// A wikilink whose basename matches no note is a dead edge. It is still not
|
|
185
|
+
// drawn to a phantom node -- OKF asks consumers to tolerate links that do
|
|
186
|
+
// not resolve -- but the COUNT is kept on the source node, so the graph can
|
|
187
|
+
// mark which notes carry a broken link without inventing targets for them.
|
|
188
|
+
const danglingSeen = new Set();
|
|
184
189
|
for (const link of n.links) {
|
|
185
190
|
const target = byBasename.get(link);
|
|
186
|
-
if (!target
|
|
191
|
+
if (!target) {
|
|
192
|
+
if (link && link !== basename(n.id, '.md')) danglingSeen.add(link);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (target === n.id) continue;
|
|
187
196
|
const key = n.id + ' -> ' + target;
|
|
188
197
|
if (seen.has(key)) continue;
|
|
189
198
|
seen.add(key);
|
|
190
199
|
edges.push({ source: n.id, target });
|
|
191
200
|
}
|
|
201
|
+
if (danglingSeen.size) n.dangling = danglingSeen.size;
|
|
192
202
|
delete n.links;
|
|
193
203
|
}
|
|
194
204
|
return { vault: VAULT, nodes, edges };
|
package/bin/create-ai-memory.js
CHANGED
|
@@ -22,7 +22,17 @@ const pkgRoot = resolve(__dirname, '..'); // bundled tool
|
|
|
22
22
|
const dest = resolve(process.argv[2] || join(homedir(), 'ai-memory'));
|
|
23
23
|
|
|
24
24
|
// Files that make up the tool; copied verbatim from the package into dest.
|
|
25
|
-
|
|
25
|
+
//
|
|
26
|
+
// `bin` and `web` are as load-bearing as `shell`: ai-mem-serve is the graph
|
|
27
|
+
// viewer and ai-mem-mcp is how GUI clients reach the vault at all. Both were
|
|
28
|
+
// added to package.json's `files` when they were written, so they shipped in
|
|
29
|
+
// the tarball -- and stopped there, because this list was never updated. A
|
|
30
|
+
// user who installed the documented way got neither, while the README told
|
|
31
|
+
// them to run both.
|
|
32
|
+
//
|
|
33
|
+
// package.json comes along because ai-mem-mcp reports its own version from it;
|
|
34
|
+
// without it the server introduced itself to every client as 0.0.0.
|
|
35
|
+
const ITEMS = ['shell', 'bin', 'web', 'hooks', 'vault-template', 'install.sh', 'create-ai-memory.plugin.zsh', 'package.json', 'LICENSE'];
|
|
26
36
|
|
|
27
37
|
console.log(`create-ai-memory: installing into ${dest}`);
|
|
28
38
|
mkdirSync(dest, { recursive: true });
|
|
@@ -10,6 +10,15 @@ set -euo pipefail
|
|
|
10
10
|
log="${AI_MEM_ACTIVE_SESSION_LOG:-}"
|
|
11
11
|
[ -n "$log" ] || exit 0
|
|
12
12
|
|
|
13
|
+
# The launcher's exports outlive the agent in the user's shell, so a later
|
|
14
|
+
# plain `claude` in another repo inherits them. Write only in the repo the
|
|
15
|
+
# session was launched in (any worktree of it). Unset = an older launcher.
|
|
16
|
+
# Same guard as session-summary.sh; keep the two in step.
|
|
17
|
+
if [ -n "${AI_MEM_ACTIVE_GIT_DIR:-}" ]; then
|
|
18
|
+
here="$(cd "$(git rev-parse --git-common-dir 2>/dev/null || echo /nonexistent)" 2>/dev/null && pwd -P || true)"
|
|
19
|
+
[ "$here" = "$AI_MEM_ACTIVE_GIT_DIR" ] || exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
13
22
|
sha="$(git rev-parse HEAD 2>/dev/null || true)"
|
|
14
23
|
[ -n "$sha" ] || exit 0
|
|
15
24
|
|
|
@@ -15,6 +15,16 @@ log="${AI_MEM_ACTIVE_SESSION_LOG:-}"
|
|
|
15
15
|
[ -n "$log" ] || exit 0
|
|
16
16
|
[ -f "$log" ] || exit 0
|
|
17
17
|
|
|
18
|
+
# The launcher's exports outlive the agent in the user's shell, so a later
|
|
19
|
+
# plain `claude` in another repo inherits them and would write that repo's
|
|
20
|
+
# commits into this project's log. Write only in the repo the session was
|
|
21
|
+
# launched in (any worktree of it). Unset = an older launcher.
|
|
22
|
+
# Same guard as session-start.sh; keep the two in step.
|
|
23
|
+
if [ -n "${AI_MEM_ACTIVE_GIT_DIR:-}" ]; then
|
|
24
|
+
here="$(cd "$(git rev-parse --git-common-dir 2>/dev/null || echo /nonexistent)" 2>/dev/null && pwd -P || true)"
|
|
25
|
+
[ "$here" = "$AI_MEM_ACTIVE_GIT_DIR" ] || exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
18
28
|
marker="## Auto Session Log"
|
|
19
29
|
|
|
20
30
|
branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo '(no git)')"
|
|
@@ -47,9 +57,18 @@ ${changes}
|
|
|
47
57
|
EOF
|
|
48
58
|
)"
|
|
49
59
|
|
|
50
|
-
# Strip
|
|
60
|
+
# Strip the previous auto block, then append the fresh one. Strip only the
|
|
61
|
+
# block: ai-note appends Live Notes at EOF, so after the first Stop they sit
|
|
62
|
+
# below the block. Cutting from the marker to EOF erased them. The block ends
|
|
63
|
+
# after the "- " lines under its last bullet; the blank line that ai-note puts
|
|
64
|
+
# before each note ends it.
|
|
51
65
|
tmp="$(mktemp)"
|
|
52
|
-
awk -v m="$marker" '
|
|
66
|
+
awk -v m="$marker" '
|
|
67
|
+
index($0, m) == 1 { inblock = 1; last = 0; next }
|
|
68
|
+
inblock && /^\* \*\*Uncommitted changes/ { last = 1; next }
|
|
69
|
+
inblock && last && !/^- / { inblock = 0; if ($0 == "") next }
|
|
70
|
+
!inblock { print }
|
|
71
|
+
' "$log" > "$tmp"
|
|
53
72
|
printf '%s\n\n%s\n' "$(cat "$tmp")" "$block" > "$log"
|
|
54
73
|
rm -f "$tmp"
|
|
55
74
|
|
package/install.sh
CHANGED
|
@@ -72,7 +72,7 @@ banner
|
|
|
72
72
|
# --- gather settings ---------------------------------------------------------
|
|
73
73
|
AI_MEM_ROOT="${AI_MEM_ROOT:-$HOME/.ai-memory/_Ai_Memory}"
|
|
74
74
|
ask AI_MEM_ROOT "Where should your memory vault live?" "$AI_MEM_ROOT"
|
|
75
|
-
AI_MEM_AGENTS="${AI_MEM_AGENTS:-claude codex gemini cursor opencode}"
|
|
75
|
+
AI_MEM_AGENTS="${AI_MEM_AGENTS:-claude codex agy gemini cursor opencode}"
|
|
76
76
|
ask AI_MEM_AGENTS "Which agents should get <agent>-start launchers?" "$AI_MEM_AGENTS"
|
|
77
77
|
|
|
78
78
|
# --- scaffold the vault ------------------------------------------------------
|
|
@@ -92,7 +92,7 @@ copy_if_absent "$HERE/vault-template/_lessons/_lesson_template.md" "$AI_ME
|
|
|
92
92
|
|
|
93
93
|
# --- assemble the ~/.zshrc lines ---------------------------------------------
|
|
94
94
|
LINES="export AI_MEM_ROOT=\"$AI_MEM_ROOT\""
|
|
95
|
-
if [ "$AI_MEM_AGENTS" != "claude codex gemini cursor opencode" ]; then
|
|
95
|
+
if [ "$AI_MEM_AGENTS" != "claude codex agy gemini cursor opencode" ]; then
|
|
96
96
|
LINES="$LINES
|
|
97
97
|
export AI_MEM_AGENTS=\"$AI_MEM_AGENTS\""
|
|
98
98
|
fi
|
|
@@ -135,7 +135,7 @@ cat <<EOF
|
|
|
135
135
|
(your memory; safe to back up, sync, or open in Obsidian)
|
|
136
136
|
|
|
137
137
|
From inside any git repo, run: claude-start
|
|
138
|
-
(or codex-start / gemini-start / cursor-start / opencode-start)
|
|
138
|
+
(or codex-start / agy-start / gemini-start / cursor-start / opencode-start)
|
|
139
139
|
|
|
140
140
|
Optional integrations: see $HERE/hooks/ and the README.
|
|
141
141
|
EOF
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ai-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Persistent, agent-agnostic session memory for AI coding CLIs (Claude Code, Codex, Gemini, Cursor, opencode). One Markdown vault, any agent.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-ai-memory": "bin/create-ai-memory.js",
|
package/shell/adapters.zsh
CHANGED
|
@@ -31,6 +31,21 @@ __ai_adapter_gemini() {
|
|
|
31
31
|
gemini --include-directories "$AI_MEM_ROOT" -i "$memory_prompt"
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
# Antigravity (agy): Google's successor to the Gemini CLI, installed as the
|
|
35
|
+
# `antigravity-cli` cask with `agy` as its binary. It takes --add-dir like
|
|
36
|
+
# codex and -i for an interactive initial prompt like the Gemini CLI did, so
|
|
37
|
+
# the vault is granted the same way and the session still opens interactively
|
|
38
|
+
# rather than printing one answer and exiting.
|
|
39
|
+
#
|
|
40
|
+
# --prompt on agy is an alias for --print, which runs ONE turn and exits. That
|
|
41
|
+
# is the wrong verb here: a launcher exists to start a session the developer
|
|
42
|
+
# keeps working in, so -i (--prompt-interactive) is the correct flag.
|
|
43
|
+
__ai_adapter_agy() {
|
|
44
|
+
local memory_prompt="$1"
|
|
45
|
+
shift 2>/dev/null || true
|
|
46
|
+
agy --add-dir "$AI_MEM_ROOT" -i "$memory_prompt"
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
# Cursor ships two entry points. `cursor-agent` is the CLI and takes the
|
|
35
50
|
# prompt positionally, so it gets the vault context like every other agent.
|
|
36
51
|
# `cursor` is the GUI, which has no prompt path -- launching it drops the
|