create-ai-memory 0.4.0 → 0.5.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
@@ -237,6 +237,7 @@ optional. Set `AI_MEM_ROOT` in `~/.zshrc` first if you do not want the default
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
239
  | `ai-mem-lint` | Check the vault's links: orphaned session logs, dangling `previous` links, unreferenced project notes |
240
+ | `ai-mem-search <term> [project]` | Grep across the vault (or one project's logs) for a term, with `file:line:excerpt` |
240
241
 
241
242
  Project is auto-resolved from the current git repo; pass a name to override.
242
243
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ai-memory",
3
- "version": "0.4.0",
3
+ "version": "0.5.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
@@ -591,4 +591,38 @@ ai-mem-lint() {
591
591
  print -r -- "$issues issue(s) found"
592
592
  fi
593
593
  return $(( issues > 0 ? 1 : 0 ))
594
+ return $(( issues > 0 ? 1 : 0 ))
595
+ }
596
+
597
+ # Full-text search across the vault. Plain grep -- no new dependency, and at
598
+ # vault scale (a personal notes collection, not a codebase) there is no real
599
+ # performance reason to reach for anything faster.
600
+ ai-mem-search() {
601
+ local term="${1:-}"
602
+ local project="${2:-}"
603
+ if [[ -z "$term" ]]; then
604
+ echo "Usage: ai-mem-search <term> [project]"
605
+ return 1
606
+ fi
607
+
608
+ local search_root="$AI_MEM_ROOT"
609
+ if [[ -n "$project" ]]; then
610
+ search_root="$(_ai_mem_project_session_dir "$project")"
611
+ if [[ ! -d "$search_root" ]]; then
612
+ print -r -- "ai-mem-search: no session logs for project '$project'"
613
+ return 1
614
+ fi
615
+ fi
616
+
617
+ local raw
618
+ raw="$(grep -rn --exclude-dir=.git --exclude='_session_template.md' --exclude='_project_template.md' -- "$term" "$search_root" 2>/dev/null)"
619
+
620
+ if [[ -z "$raw" ]]; then
621
+ print -r -- "no matches for '$term' in $search_root"
622
+ return 1
623
+ fi
624
+
625
+ print -r -- "$raw"
626
+ print -r -- "--"
627
+ print -r -- "$(print -r -- "$raw" | wc -l | tr -d ' ') match(es) for '$term'"
594
628
  }