create-ai-memory 0.13.0 → 0.14.1

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/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "create-ai-memory",
3
- "version": "0.13.0",
3
+ "version": "0.14.1",
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
- "create-ai-memory": "bin/create-ai-memory.js"
6
+ "create-ai-memory": "bin/create-ai-memory.js",
7
+ "ai-mem-mcp": "bin/ai-mem-mcp.js",
8
+ "ai-mem-serve": "bin/ai-mem-serve.js"
7
9
  },
8
10
  "scripts": {
9
11
  "test": "zsh tests/run.sh",
@@ -16,6 +18,7 @@
16
18
  "files": [
17
19
  "bin/",
18
20
  "shell/",
21
+ "web/",
19
22
  "hooks/",
20
23
  "vault-template/",
21
24
  "install.sh",
@@ -23,16 +26,17 @@
23
26
  "LICENSE"
24
27
  ],
25
28
  "keywords": [
29
+ "agent",
26
30
  "ai",
27
- "memory",
28
31
  "claude",
32
+ "cli",
29
33
  "codex",
30
- "gemini",
31
34
  "cursor",
32
- "opencode",
33
- "cli",
34
- "agent",
35
+ "gemini",
36
+ "mcp",
37
+ "memory",
35
38
  "obsidian",
39
+ "opencode",
36
40
  "zsh"
37
41
  ],
38
42
  "homepage": "https://github.com/rambaarde/create-ai-memory#readme",
@@ -31,9 +31,20 @@ __ai_adapter_gemini() {
31
31
  gemini --include-directories "$AI_MEM_ROOT" -i "$memory_prompt"
32
32
  }
33
33
 
34
- # Cursor has no CLI prompt path, so persist the session's skill choices as a
35
- # managed always-apply rule that this adapter rewrites each launch (and clears
36
- # when nothing is selected).
34
+ # Cursor ships two entry points. `cursor-agent` is the CLI and takes the
35
+ # prompt positionally, so it gets the vault context like every other agent.
36
+ # `cursor` is the GUI, which has no prompt path -- launching it drops the
37
+ # memory prompt entirely, so it is a fallback rather than the target.
38
+ #
39
+ # Either way the session's skill choices are persisted as a managed
40
+ # always-apply rule, rewritten each launch and cleared when nothing is
41
+ # selected: cursor-agent has no --append-system-prompt equivalent, so the
42
+ # rule file is the only channel for the mode block.
43
+ #
44
+ # --workspace is deliberately not passed. It sets the working directory,
45
+ # which already is the project being worked on, and it is not an --add-dir
46
+ # equivalent -- the vault reaches Cursor through the absolute note paths
47
+ # inlined in the prompt.
37
48
  __ai_adapter_cursor() {
38
49
  local memory_prompt="$1" mode_block="$2"
39
50
  shift 2
@@ -52,7 +63,9 @@ __ai_adapter_cursor() {
52
63
  else
53
64
  rm -f "$cursor_rule"
54
65
  fi
55
- if command -v cursor >/dev/null 2>&1; then
66
+ if command -v cursor-agent >/dev/null 2>&1; then
67
+ cursor-agent "$memory_prompt" "$@"
68
+ elif command -v cursor >/dev/null 2>&1; then
56
69
  cursor "$@"
57
70
  else
58
71
  open -a Cursor
package/shell/ai-mem.zsh CHANGED
@@ -279,6 +279,31 @@ __ai_mem_ensure_vault() {
279
279
  cp "$src" "$dst"
280
280
  fi
281
281
  done
282
+
283
+ # Seeding only fills in a MISSING file, which is right -- these are the
284
+ # user's notes and templates, and an upgrade must not overwrite edits they
285
+ # made. But that leaves an existing vault on whatever templates it had
286
+ # when it was created: `npm update` never touches them, and neither does
287
+ # install.sh. The session log template is the one where that silently
288
+ # matters, because every future log is copied from it -- a template with
289
+ # no `type:` rebuilds a backlog of non-conforming notes one session at a
290
+ # time, and nothing surfaces it.
291
+ #
292
+ # So repair exactly that one field, additively, and leave everything else
293
+ # in the file alone. This runs on session prep, so an existing install
294
+ # heals on its next launch rather than waiting for someone to think to run
295
+ # ai-mem-lint --fix.
296
+ local tmpl="$AI_MEM_SESSION_DIR/_session_template.md"
297
+ if [[ -f "$tmpl" ]] && ! grep -qm1 '^type: ' "$tmpl"; then
298
+ __ai_mem_guard "$tmpl" || return 1
299
+ local tmp="$tmpl.aimem-upgrade"
300
+ if [[ "$(head -1 "$tmpl")" == "---" ]]; then
301
+ { head -1 "$tmpl"; print -r -- "type: ai-session-log"; tail -n +2 "$tmpl"; } > "$tmp"
302
+ else
303
+ { print -rl -- "---" "type: ai-session-log" "---" ""; cat "$tmpl"; } > "$tmp"
304
+ fi
305
+ mv "$tmp" "$tmpl"
306
+ fi
282
307
  }
283
308
 
284
309
  __ai_mem_prepare_session() {
@@ -433,6 +458,7 @@ Use the Obsidian vault as the persistent memory layer.
433
458
  Treat the global profile and standards note as the shared baseline for every run.
434
459
  Keep durable preferences and project facts in the vault, and keep the active session log updated with decisions, blockers, and next steps.
435
460
  For anything not covered above -- a decision from further back, a different project, a health check on the vault's links -- run \`ai-mem-search <term> [project]\` or \`ai-mem-lint\` yourself; both are plain shell commands already on PATH. Search is case-insensitive and matches literally, and its output is capped: if it reports results hidden, narrow with a project argument or a more specific term rather than assuming you have seen everything. Start broad and narrow from there -- a first query that is too specific is the usual way to miss what you were looking for.
461
+ If the user asks to see, open or browse their memory rather than search it, run \`ai-mem-serve\` -- it opens the vault as a graph in their browser, and is safe to run again if it is already up.
436
462
  When you hit a mistake, decision, or solution worth remembering across projects (not just this one), run \`ai-lesson <topic-slug> <problem> <solution>\` -- e.g. \`ai-lesson rate-limiting "a fixed-window limiter kept losing bursts of legitimate traffic" "switched to a token bucket, which absorbs bursts correctly"\`. It appends a dated Problem/Solution entry to a cross-project note at _lessons/<topic-slug>.md; ai-mem-search already covers it.
437
463
  EOF
438
464
  }
@@ -824,6 +850,30 @@ ai-mem-lint() {
824
850
  fi
825
851
  done < <(find "$AI_MEM_PROJECT_DIR" -maxdepth 1 -name "*.md" -print0 2>/dev/null)
826
852
 
853
+ # The template is skipped by the loop above, and rightly -- it is not a
854
+ # note. But it is what every future log is copied from, so a template
855
+ # without `type:` quietly re-creates the whole backlog one session at a
856
+ # time. An existing install keeps its own copy of the template and never
857
+ # picks up a newer one, so fixing the shipped file is not enough.
858
+ local tmpl="$AI_MEM_SESSION_DIR/_session_template.md"
859
+ if [[ -f "$tmpl" ]] && ! grep -qm1 '^type: ' "$tmpl"; then
860
+ if (( fix )); then
861
+ __ai_mem_guard "$tmpl" >/dev/null && {
862
+ local ttmp="$tmpl.aimem-backfill"
863
+ if [[ "$(head -1 "$tmpl")" == "---" ]]; then
864
+ { head -1 "$tmpl"; print -r -- "type: ai-session-log"; tail -n +2 "$tmpl"; } > "$ttmp"
865
+ else
866
+ { print -rl -- "---" "type: ai-session-log" "---" ""; cat "$tmpl"; } > "$ttmp"
867
+ fi
868
+ mv "$ttmp" "$tmpl"
869
+ print -r -- "added \`type:\` to the session log template, so new logs carry it"
870
+ }
871
+ else
872
+ print -r -- "the session log template has no \`type:\` field, so every new log will lack one. Fix with: ai-mem-lint --fix"
873
+ (( issues++ ))
874
+ fi
875
+ fi
876
+
827
877
  if (( $#untyped_files )); then
828
878
  if (( fix )); then
829
879
  # Written by hand rather than with `sed -i`, whose in-place flag