create-ai-memory 0.3.0 → 0.4.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 CHANGED
@@ -236,6 +236,7 @@ optional. Set `AI_MEM_ROOT` in `~/.zshrc` first if you do not want the default
236
236
  | `ai-start [project]` | Prepare the session (project note and fresh log) without launching an agent |
237
237
  | `ai-context [project]` | Print the vault context block for the current repo, and arm the git commit guard |
238
238
  | `ai-note <text>` | Append a timestamped note to today's session log while you work |
239
+ | `ai-mem-lint` | Check the vault's links: orphaned session logs, dangling `previous` links, unreferenced project notes |
239
240
 
240
241
  Project is auto-resolved from the current git repo; pass a name to override.
241
242
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ai-memory",
3
- "version": "0.3.0",
3
+ "version": "0.4.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
@@ -545,4 +545,50 @@ ai-note() {
545
545
 
546
546
  printf '\n- %s %s\n' "$timestamp" "$note_text" >> "$session_note"
547
547
  printf 'Appended to %s\n' "$session_note"
548
+ printf 'Appended to %s\n' "$session_note"
549
+ }
550
+
551
+ # Lints the vault's links: session logs missing a project wikilink, previous
552
+ # links pointing at a note that no longer exists, and project notes nothing
553
+ # links back to. Pure grep/find -- no new dependency, catches exactly the
554
+ # "isolated dots in Graph View" class of problem before you have to notice it
555
+ # by eye.
556
+ ai-mem-lint() {
557
+ local issues=0 f label target found
558
+
559
+ while IFS= read -r -d '' f; do
560
+ [[ "${f:t}" == "_session_template.md" ]] && continue
561
+
562
+ if ! grep -qm1 -E '^project:.*\[\[.*\]\]' "$f" 2>/dev/null; then
563
+ print -r -- "orphaned session log (no project link): $f"
564
+ (( issues++ ))
565
+ fi
566
+
567
+ label="$(grep -m1 '^previous:' "$f" 2>/dev/null)"
568
+ if [[ "$label" == *'[['* ]]; then
569
+ target="${label#*\[\[}"
570
+ target="${target%%\]\]*}"
571
+ found="$(find "${f:h}" -maxdepth 1 -name "${target}.md" -print -quit 2>/dev/null)"
572
+ if [[ -z "$found" ]]; then
573
+ print -r -- "dangling previous link: $f -> [[${target}]] (not found)"
574
+ (( issues++ ))
575
+ fi
576
+ fi
577
+ done < <(find "$AI_MEM_SESSION_DIR" -maxdepth 2 -name "*.md" -print0 2>/dev/null)
578
+
579
+ while IFS= read -r -d '' f; do
580
+ [[ "${f:t}" == "_project_template.md" ]] && continue
581
+ local pname="${f:t:r}"
582
+ if ! grep -rq -- "\[\[${pname}\]\]" "$AI_MEM_SESSION_DIR" 2>/dev/null; then
583
+ print -r -- "unreferenced project note (no session log links to it): $f"
584
+ (( issues++ ))
585
+ fi
586
+ done < <(find "$AI_MEM_PROJECT_DIR" -maxdepth 1 -name "*.md" -print0 2>/dev/null)
587
+
588
+ if (( issues == 0 )); then
589
+ print -r -- "ok: vault links are clean"
590
+ else
591
+ print -r -- "$issues issue(s) found"
592
+ fi
593
+ return $(( issues > 0 ? 1 : 0 ))
548
594
  }