create-ai-memory 0.10.0 → 0.11.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
@@ -276,7 +276,7 @@ optional. Set `AI_MEM_ROOT` in `~/.zshrc` first if you do not want the default
276
276
  | `ai-note <text>` | Append a timestamped note to today's session log while you work |
277
277
  | `ai-lesson <topic-slug> <problem> <solution>` | Append a dated Problem/Solution entry to a cross-project `_lessons/<topic-slug>.md` -- decisions, mistakes, solutions worth recalling outside the current project |
278
278
  | `ai-mem-lint` | Check the vault's links: orphaned session logs, dangling `previous` links, unreferenced project notes |
279
- | `ai-mem-search <term> [project]` | Grep across the vault (or one project's logs) for a term, with `file:line:excerpt` |
279
+ | `ai-mem-search <term> [project] [--hops]` | Grep across the vault (or one project's logs) for a term, with `file:line:excerpt`. With `--hops`, also resolves any `[[wikilink]]` on a matched line to its project note and shows a short excerpt -- one hop out along the graph, not just the literal text match |
280
280
  | `ai-mem-vault-backup` | Commit and push the vault if it's git-backed. `ai-note`/`ai-lesson` already call this; use it directly after editing a session log or project note by hand |
281
281
 
282
282
  Project is auto-resolved from the current git repo; pass a name to override.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ai-memory",
3
- "version": "0.10.0",
3
+ "version": "0.11.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
@@ -692,10 +692,20 @@ ai-mem-lint() {
692
692
  # vault scale (a personal notes collection, not a codebase) there is no real
693
693
  # performance reason to reach for anything faster.
694
694
  ai-mem-search() {
695
- local term="${1:-}"
696
- local project="${2:-}"
695
+ local hops=0
696
+ local -a rest
697
+ local a
698
+ for a in "$@"; do
699
+ if [[ "$a" == "--hops" ]]; then
700
+ hops=1
701
+ else
702
+ rest+=("$a")
703
+ fi
704
+ done
705
+ local term="${rest[1]:-}"
706
+ local project="${rest[2]:-}"
697
707
  if [[ -z "$term" ]]; then
698
- echo "Usage: ai-mem-search <term> [project]"
708
+ echo "Usage: ai-mem-search <term> [project] [--hops]"
699
709
  return 1
700
710
  fi
701
711
 
@@ -729,4 +739,27 @@ ai-mem-search() {
729
739
  print -r -- "$sorted"
730
740
  print -r -- "--"
731
741
  print -r -- "$(print -r -- "$raw" | wc -l | tr -d ' ') match(es) for '$term'"
742
+
743
+ (( hops )) || return 0
744
+
745
+ # One hop out: resolve [[wikilinks]] found on matched lines to their
746
+ # target note (currently: project notes only -- the confirmed use case
747
+ # is a _lessons entry linking the project(s) it hit) and show a short
748
+ # excerpt, so a match doesn't leave you to manually chase the link
749
+ # yourself.
750
+ local links link target excerpt
751
+ links="$(print -r -- "$raw" | grep -oE '\[\[[^]]+\]\]' | sed -E 's/^\[\[|\]\]$//g' | sort -u)"
752
+ [[ -n "$links" ]] || return 0
753
+
754
+ print -r -- "--"
755
+ print -r -- "one hop out:"
756
+ while IFS= read -r link; do
757
+ [[ -n "$link" ]] || continue
758
+ target="$AI_MEM_PROJECT_DIR/${link}.md"
759
+ [[ -f "$target" ]] || continue
760
+ excerpt="$(grep -m1 -A1 '^\* \*\*Purpose:\*\*' "$target" 2>/dev/null | tail -1)"
761
+ [[ -n "$excerpt" ]] || excerpt="$(sed -n '/^---$/,/^---$/!p' "$target" | grep -m1 -v '^$')"
762
+ print -r -- " [[$link]] -> $target"
763
+ [[ -n "$excerpt" ]] && print -r -- " $excerpt"
764
+ done <<< "$links"
732
765
  }