create-ai-memory 0.6.0 → 0.7.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.
@@ -61,9 +61,30 @@ rm -f "$tmp"
61
61
  # error (no network, no remote configured, etc).
62
62
  vault_git_root="$(git -C "${AI_MEM_ROOT:-}" rev-parse --show-toplevel 2>/dev/null || true)"
63
63
  if [ -n "$vault_git_root" ]; then
64
- git -C "$vault_git_root" add -A 2>/dev/null || true
65
- if ! git -C "$vault_git_root" diff --cached --quiet 2>/dev/null; then
66
- git -C "$vault_git_root" commit -q -m "vault backup: ${stamp}" 2>/dev/null || true
67
- git -C "$vault_git_root" push -q 2>/dev/null || true
64
+ # A same-second Stop from a second terminal is real -- flock isn't
65
+ # portable to every platform this ships on, but `mkdir` is atomic
66
+ # everywhere. A lock older than 60s is almost certainly abandoned by a
67
+ # crashed run, not a genuine concurrent one (this operation normally
68
+ # completes in well under a second), so clear it rather than let one
69
+ # dead process wedge every future backup forever.
70
+ lock_dir="$vault_git_root/.git/aimem-backup.lock"
71
+ if [ -d "$lock_dir" ]; then
72
+ lock_age=$(( $(date +%s) - $(stat -c %Y "$lock_dir" 2>/dev/null || stat -f %m "$lock_dir" 2>/dev/null || echo 0) ))
73
+ if [ "$lock_age" -gt 60 ]; then
74
+ rmdir "$lock_dir" 2>/dev/null || true
75
+ fi
68
76
  fi
77
+
78
+ if mkdir "$lock_dir" 2>/dev/null; then
79
+ trap 'rmdir "$lock_dir" 2>/dev/null || true' EXIT
80
+ git -C "$vault_git_root" add -A 2>/dev/null || true
81
+ if ! git -C "$vault_git_root" diff --cached --quiet 2>/dev/null; then
82
+ git -C "$vault_git_root" commit -q -m "vault backup: ${stamp}" 2>/dev/null || true
83
+ git -C "$vault_git_root" push -q 2>/dev/null || true
84
+ fi
85
+ rmdir "$lock_dir" 2>/dev/null || true
86
+ trap - EXIT
87
+ fi
88
+ # else: another process holds a fresh lock right now -- skip silently,
89
+ # the next Stop event (this session or another) will catch up.
69
90
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ai-memory",
3
- "version": "0.6.0",
3
+ "version": "0.7.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
6
  "create-ai-memory": "bin/create-ai-memory.js"
package/shell/ai-mem.zsh CHANGED
@@ -260,6 +260,7 @@ $previous_session_block
260
260
  Use the Obsidian vault as the persistent memory layer.
261
261
  Treat the global profile and standards note as the shared baseline for every run.
262
262
  Keep durable preferences and project facts in the vault, and keep the active session log updated with decisions, blockers, and next steps.
263
+ 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.
263
264
  EOF
264
265
  }
265
266