create-ai-memory 0.4.0 → 0.6.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 +39 -0
- package/package.json +1 -1
- package/shell/ai-mem.zsh +43 -0
package/README.md
CHANGED
|
@@ -97,6 +97,44 @@ already have, every launch.
|
|
|
97
97
|
One environment variable, `AI_MEM_ROOT`, points at the vault, so the whole system
|
|
98
98
|
moves between machines by pointing at the same folder.
|
|
99
99
|
|
|
100
|
+
## The full loop
|
|
101
|
+
|
|
102
|
+
Agents read the vault through `ai-mem.zsh` at launch and write to it through a Stop
|
|
103
|
+
hook at close. You read the same files in Obsidian, or through `ai-mem-search` and
|
|
104
|
+
`ai-mem-lint`. Neither side gets a privileged interface — it's the same folder either way.
|
|
105
|
+
|
|
106
|
+
```mermaid
|
|
107
|
+
sequenceDiagram
|
|
108
|
+
autonumber
|
|
109
|
+
actor You
|
|
110
|
+
participant Shell as claude-start
|
|
111
|
+
participant Agent as Claude Code
|
|
112
|
+
participant Vault as _Ai_Memory
|
|
113
|
+
participant Backup as git backup (optional)
|
|
114
|
+
|
|
115
|
+
You->>Shell: claude-start
|
|
116
|
+
Shell->>Vault: read _Global_Profile.md + _Standards.md
|
|
117
|
+
Vault-->>Shell: full text
|
|
118
|
+
Shell->>Vault: read prior session's Session Outcome
|
|
119
|
+
Vault-->>Shell: Summary / Decisions / Blockers / Next
|
|
120
|
+
Shell->>Vault: create session log (project + previous wikilinks)
|
|
121
|
+
Shell->>Agent: launch, all of it as the first message
|
|
122
|
+
Note over You,Agent: the session's work happens here
|
|
123
|
+
You->>Agent: ai-note "..." (optional, mid-session)
|
|
124
|
+
Agent->>Vault: append to Live Notes
|
|
125
|
+
Note over Agent: session ends -- Stop hook fires
|
|
126
|
+
Agent->>Vault: rewrite Auto Session Log (branch, commits, changes)
|
|
127
|
+
Agent->>Backup: commit + push, if the vault is git-backed
|
|
128
|
+
Note over Vault: nothing overwritten -- a fresh file every session
|
|
129
|
+
You->>Shell: claude-start (next time)
|
|
130
|
+
Shell->>Vault: read prior session again
|
|
131
|
+
Note over Shell,Vault: now includes what just happened
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Everything through step 10 touches only files on your machine. Step 11 is the
|
|
135
|
+
only network call in the whole loop, and only exists if you set up a git-backed
|
|
136
|
+
vault yourself; skip that and everything stays local, always.
|
|
137
|
+
|
|
100
138
|
## See a full session
|
|
101
139
|
|
|
102
140
|
```console
|
|
@@ -237,6 +275,7 @@ optional. Set `AI_MEM_ROOT` in `~/.zshrc` first if you do not want the default
|
|
|
237
275
|
| `ai-context [project]` | Print the vault context block for the current repo, and arm the git commit guard |
|
|
238
276
|
| `ai-note <text>` | Append a timestamped note to today's session log while you work |
|
|
239
277
|
| `ai-mem-lint` | Check the vault's links: orphaned session logs, dangling `previous` links, unreferenced project notes |
|
|
278
|
+
| `ai-mem-search <term> [project]` | Grep across the vault (or one project's logs) for a term, with `file:line:excerpt` |
|
|
240
279
|
|
|
241
280
|
Project is auto-resolved from the current git repo; pass a name to override.
|
|
242
281
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ai-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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
|
@@ -592,3 +592,46 @@ ai-mem-lint() {
|
|
|
592
592
|
fi
|
|
593
593
|
return $(( issues > 0 ? 1 : 0 ))
|
|
594
594
|
}
|
|
595
|
+
|
|
596
|
+
# Full-text search across the vault. Plain grep -- no new dependency, and at
|
|
597
|
+
# vault scale (a personal notes collection, not a codebase) there is no real
|
|
598
|
+
# performance reason to reach for anything faster.
|
|
599
|
+
ai-mem-search() {
|
|
600
|
+
local term="${1:-}"
|
|
601
|
+
local project="${2:-}"
|
|
602
|
+
if [[ -z "$term" ]]; then
|
|
603
|
+
echo "Usage: ai-mem-search <term> [project]"
|
|
604
|
+
return 1
|
|
605
|
+
fi
|
|
606
|
+
|
|
607
|
+
local search_root="$AI_MEM_ROOT"
|
|
608
|
+
if [[ -n "$project" ]]; then
|
|
609
|
+
search_root="$(_ai_mem_project_session_dir "$project")"
|
|
610
|
+
if [[ ! -d "$search_root" ]]; then
|
|
611
|
+
print -r -- "ai-mem-search: no session logs for project '$project'"
|
|
612
|
+
return 1
|
|
613
|
+
fi
|
|
614
|
+
fi
|
|
615
|
+
|
|
616
|
+
local raw
|
|
617
|
+
raw="$(grep -rn --exclude-dir=.git --exclude='_session_template.md' --exclude='_project_template.md' -- "$term" "$search_root" 2>/dev/null)"
|
|
618
|
+
|
|
619
|
+
if [[ -z "$raw" ]]; then
|
|
620
|
+
print -r -- "no matches for '$term' in $search_root"
|
|
621
|
+
return 1
|
|
622
|
+
fi
|
|
623
|
+
|
|
624
|
+
# Newest-first: for a time-series log the most recent match is usually the
|
|
625
|
+
# relevant one, so a large result set stays usable at a glance even without
|
|
626
|
+
# ranking. Sort key is the YYYY-MM-DD_HH-MM-SS embedded in the filename;
|
|
627
|
+
# lines with no such timestamp (e.g. _Global_Profile.md) sort last.
|
|
628
|
+
local sorted ts
|
|
629
|
+
sorted="$(print -r -- "$raw" | while IFS= read -r line; do
|
|
630
|
+
ts="$(print -r -- "$line" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}' | head -1)"
|
|
631
|
+
print -r -- "${ts:-0000-00-00_00-00-00}|${line}"
|
|
632
|
+
done | sort -r | cut -d'|' -f2-)"
|
|
633
|
+
|
|
634
|
+
print -r -- "$sorted"
|
|
635
|
+
print -r -- "--"
|
|
636
|
+
print -r -- "$(print -r -- "$raw" | wc -l | tr -d ' ') match(es) for '$term'"
|
|
637
|
+
}
|