create-ai-memory 0.11.0 → 0.11.2
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 +1 -1
- package/package.json +1 -1
- package/shell/ai-mem.zsh +43 -20
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]
|
|
279
|
+
| `ai-mem-search <term> [project]` | Case-insensitive literal search across the vault (or one project's logs), newest match first. Paths print relative to a root stated once in the header. Output is capped (`AI_MEM_SEARCH_LIMIT`, default 40) with an explicit `N hidden` notice, because the usual caller is an agent with a finite context window. Also resolves any `[[wikilink]]` on a matched line to its project note -- one hop out along the graph, always on, not a flag to remember |
|
|
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.11.
|
|
3
|
+
"version": "0.11.2",
|
|
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
|
@@ -308,7 +308,7 @@ $previous_session_block
|
|
|
308
308
|
Use the Obsidian vault as the persistent memory layer.
|
|
309
309
|
Treat the global profile and standards note as the shared baseline for every run.
|
|
310
310
|
Keep durable preferences and project facts in the vault, and keep the active session log updated with decisions, blockers, and next steps.
|
|
311
|
-
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.
|
|
311
|
+
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. Search is case-insensitive and matches literally, and its output is capped: if it reports results hidden, narrow with a project argument or a more specific term rather than assuming you have seen everything. Start broad and narrow from there -- a first query that is too specific is the usual way to miss what you were looking for.
|
|
312
312
|
When you hit a mistake, decision, or solution worth remembering across projects (not just this one), run \`ai-lesson <topic-slug> <problem> <solution>\` -- e.g. \`ai-lesson rate-limiting "a fixed-window limiter kept losing bursts of legitimate traffic" "switched to a token bucket, which absorbs bursts correctly"\`. It appends a dated Problem/Solution entry to a cross-project note at _lessons/<topic-slug>.md; ai-mem-search already covers it.
|
|
313
313
|
EOF
|
|
314
314
|
}
|
|
@@ -690,22 +690,15 @@ ai-mem-lint() {
|
|
|
690
690
|
|
|
691
691
|
# Full-text search across the vault. Plain grep -- no new dependency, and at
|
|
692
692
|
# vault scale (a personal notes collection, not a codebase) there is no real
|
|
693
|
-
# performance reason to reach for anything faster.
|
|
693
|
+
# performance reason to reach for anything faster. Always resolves one hop
|
|
694
|
+
# out along any [[wikilinks]] on a matched line (see below) -- not a flag,
|
|
695
|
+
# because a flag only helps if whoever's calling this remembers it exists,
|
|
696
|
+
# and the whole point is not depending on that.
|
|
694
697
|
ai-mem-search() {
|
|
695
|
-
local
|
|
696
|
-
local
|
|
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]:-}"
|
|
698
|
+
local term="${1:-}"
|
|
699
|
+
local project="${2:-}"
|
|
707
700
|
if [[ -z "$term" ]]; then
|
|
708
|
-
echo "Usage: ai-mem-search <term> [project]
|
|
701
|
+
echo "Usage: ai-mem-search <term> [project]"
|
|
709
702
|
return 1
|
|
710
703
|
fi
|
|
711
704
|
|
|
@@ -718,8 +711,17 @@ ai-mem-search() {
|
|
|
718
711
|
fi
|
|
719
712
|
fi
|
|
720
713
|
|
|
714
|
+
# -i: a case-sensitive default silently returns a confident "no matches"
|
|
715
|
+
# for a term the vault genuinely holds under different casing. Measured on
|
|
716
|
+
# a real vault: `precompact` found 0 case-sensitively and 3 with -i;
|
|
717
|
+
# `Postgres` 56 vs 90. A false empty state is the worst possible answer
|
|
718
|
+
# from a memory tool, because it is indistinguishable from the truth --
|
|
719
|
+
# and the explicit empty-state message below is exactly what makes it
|
|
720
|
+
# look authoritative.
|
|
721
|
+
# -F: the caller is usually an agent passing a free-text term, where a
|
|
722
|
+
# stray . ( | must match literally rather than as a regex metacharacter.
|
|
721
723
|
local raw
|
|
722
|
-
raw="$(grep -
|
|
724
|
+
raw="$(grep -rniF --exclude-dir=.git --exclude='_session_template.md' --exclude='_project_template.md' --exclude='_lesson_template.md' -- "$term" "$search_root" 2>/dev/null)"
|
|
723
725
|
|
|
724
726
|
if [[ -z "$raw" ]]; then
|
|
725
727
|
print -r -- "no matches for '$term' in $search_root"
|
|
@@ -736,12 +738,33 @@ ai-mem-search() {
|
|
|
736
738
|
print -r -- "${ts:-0000-00-00_00-00-00}|${line}"
|
|
737
739
|
done | sort -r | cut -d'|' -f2-)"
|
|
738
740
|
|
|
739
|
-
|
|
741
|
+
# Bound the output. The consumer is normally an agent with a finite
|
|
742
|
+
# context window, and an unbounded dump is actively harmful there in a
|
|
743
|
+
# way it is not for a human who skims: a common term produced ~29k
|
|
744
|
+
# tokens on a real vault, overflowing the host's tool-response cap and
|
|
745
|
+
# getting silently truncated, so the agent could not tell "hidden" from
|
|
746
|
+
# "absent". Near-miss padding is also the most damaging kind of
|
|
747
|
+
# distractor for a model, so fewer, cleaner hits beat more of them.
|
|
748
|
+
# Count goes FIRST -- the reader needs the size of the result set before
|
|
749
|
+
# the result set, not after it.
|
|
750
|
+
local total limit
|
|
751
|
+
total="$(print -r -- "$raw" | wc -l | tr -d ' ')"
|
|
752
|
+
limit="${AI_MEM_SEARCH_LIMIT:-40}"
|
|
753
|
+
|
|
754
|
+
print -r -- "$total match(es) for '$term'"
|
|
755
|
+
print -r -- "paths below $search_root"
|
|
740
756
|
print -r -- "--"
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
757
|
+
# Strip the repeated vault root (a third to a half of all output bytes on
|
|
758
|
+
# a real vault, with zero information lost -- it is printed once above)
|
|
759
|
+
# and clamp very long lines, which are common in prose notes.
|
|
760
|
+
print -r -- "$sorted" | head -n "$limit" \
|
|
761
|
+
| sed "s|^${search_root}/||" \
|
|
762
|
+
| awk '{ if (length($0) > 200) print substr($0, 1, 200) " [...]"; else print }'
|
|
744
763
|
|
|
764
|
+
if (( total > limit )); then
|
|
765
|
+
print -r -- "--"
|
|
766
|
+
print -r -- "showing $limit of $total ($(( total - limit )) hidden) -- narrow with: ai-mem-search '$term' <project>, or raise AI_MEM_SEARCH_LIMIT"
|
|
767
|
+
fi
|
|
745
768
|
# One hop out: resolve [[wikilinks]] found on matched lines to their
|
|
746
769
|
# target note (currently: project notes only -- the confirmed use case
|
|
747
770
|
# is a _lessons entry linking the project(s) it hit) and show a short
|