create-ai-memory 0.11.3 → 0.12.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/shell/ai-mem.zsh +23 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ai-memory",
3
- "version": "0.11.3",
3
+ "version": "0.12.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/ai-mem.zsh CHANGED
@@ -11,6 +11,19 @@ AI_MEM_HOME="${0:A:h}"
11
11
  # vault on first use so install.sh is optional (plugin-manager installs work).
12
12
  AI_MEM_TEMPLATE_SRC="${AI_MEM_HOME:h}/vault-template"
13
13
 
14
+ # Fingerprint of the module files, recorded at source time and re-checked at
15
+ # launch. A shell keeps whatever function definitions it loaded at startup:
16
+ # editing these files, or upgrading the package, changes nothing in a
17
+ # terminal that is already open. That is a silent trap rather than an
18
+ # obvious one -- the launcher still runs, still reports success, and quietly
19
+ # uses whatever behaviour was current whenever this terminal was opened,
20
+ # which can be months. Comparing the two makes the staleness visible.
21
+ # cksum is POSIX, so this needs no macOS/Linux branch.
22
+ _ai_mem_fingerprint() {
23
+ cksum "$AI_MEM_HOME/ai-mem.zsh" "$AI_MEM_HOME/adapters.zsh" 2>/dev/null \
24
+ | awk '{ printf "%s-", $1 }'
25
+ }
26
+ export AI_MEM_SOURCED_FINGERPRINT="$(_ai_mem_fingerprint)"
14
27
  # Vault root. Override in ~/.zshrc; defaults to a hidden dir under $HOME.
15
28
  : "${AI_MEM_ROOT:=$HOME/.ai-memory/_Ai_Memory}"
16
29
  if [[ -d "$AI_MEM_ROOT" ]]; then
@@ -450,6 +463,16 @@ _ai_session_start() {
450
463
  shift
451
464
  fi
452
465
 
466
+ # Warn (never block) if this shell is running a stale copy. Everything
467
+ # below would otherwise succeed quietly using the old behaviour, and the
468
+ # only symptom is a fix that appears not to have worked.
469
+ local _fp_now
470
+ _fp_now="$(_ai_mem_fingerprint)"
471
+ if [[ -n "$AI_MEM_SOURCED_FINGERPRINT" && -n "$_fp_now" \
472
+ && "$_fp_now" != "$AI_MEM_SOURCED_FINGERPRINT" ]]; then
473
+ echo "ai-memory: this shell loaded an older copy of ai-mem; the files on disk have changed since." >&2
474
+ echo " Run 'source ~/.zshrc' or open a new terminal to pick up the current version." >&2
475
+ fi
453
476
  local session_prompt="${*:-}"
454
477
 
455
478
  # Fail fast with a clear message if the agent's CLI is missing, before a