create-ai-memory 0.16.5 → 0.17.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 +10 -1
- package/package.json +1 -1
- package/shell/adapters.zsh +35 -4
- package/shell/ai-mem.zsh +18 -3
package/README.md
CHANGED
|
@@ -319,7 +319,7 @@ optional. Set `AI_MEM_ROOT` in `~/.zshrc` first if you do not want the default
|
|
|
319
319
|
| `ai-mem-lint [--fix]` | Check the vault's links: orphaned session logs, dangling `previous` links (a link to a log in the project's `_archive/` resolves, as it does in Obsidian), unreferenced project notes, notes missing the `type:` field, and **dangling `[[wikilinks]]`** -- a link pointing at a note that does not exist (a dead edge in the graph), reported but never auto-removed. `--fix` backfills `type:` into session logs written before the field existed |
|
|
320
320
|
| `ai-mem-search <term> [project]` | Case-insensitive literal search across the vault (or one project's logs). Lessons rank first, and within them by *reinforcement* -- a lesson recalled more often (more dated entries) ranks above a once-seen one -- then by date; archived logs (see `ai-mem-sleep`) are skipped. Paths print relative to a root stated once in the header. Output is capped (`AI_MEM_SEARCH_LIMIT`, default 25) 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 |
|
|
321
321
|
| `ai-mem-sleep [--apply]` | The vault's "bedtime" pass: archive stale session logs, flag consolidation candidates, and lint, in one run. Session logs older than `AI_MEM_SLEEP_DAYS` (default 90) move out of the hot search path -- always keeping the newest `AI_MEM_SLEEP_KEEP` (default 5) filled logs per project -- while `_lessons/` are never touched, because durable failure->fix knowledge is exactly what must survive. An **unfilled** log -- the template with nothing written, plus at most an Auto Session Log that saw no commits and a clean tree -- is archived once it is dated before yesterday, and never takes a KEEP slot: most sessions close without a note, and counting them pushed every real log out of the hot set. Dry-run by default; `--apply` moves logs into each project's `_archive/` (reversible via git) and backs up |
|
|
322
|
-
| `ai-mem-sleep-schedule [--install\|--uninstall] [--at HH:MM]` | Run the bedtime pass on its own, nightly (default 03:00). macOS installs a launchd agent; other platforms a crontab entry. The scheduled job sources the module first, since a cron/launchd shell does not read `~/.zshrc`. Dry-run by default -- prints exactly what it would install; `--install` schedules it, `--uninstall` removes it |
|
|
322
|
+
| `ai-mem-sleep-schedule [--install\|--uninstall] [--at HH:MM]` | Run the bedtime pass on its own, nightly (default 03:00). macOS installs a launchd agent; other platforms a crontab entry. The scheduled job sets `AI_MEM_ROOT` and sources the module first, since a cron/launchd shell does not read `~/.zshrc`. On macOS, a vault in `~/Documents`, `~/Desktop`, `~/Downloads` or iCloud Drive gets a warning: macOS can deny a launchd job read access there, and the pass then does nothing. Check the job log after its first run. Dry-run by default -- prints exactly what it would install; `--install` schedules it, `--uninstall` removes it |
|
|
323
323
|
| `ai-mem-serve [port] [--no-open]` | Open the vault as a browsable graph on `127.0.0.1`. Agents run this for you when you ask to see your memory (see [Graph view](#graph-view)) |
|
|
324
324
|
| `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 |
|
|
325
325
|
|
|
@@ -731,6 +731,13 @@ weekly/account limits when the provider exposes them. Set
|
|
|
731
731
|
`AI_MEM_OMP_SHOW_USAGE=0` to skip that preflight check. Plain `omp` is
|
|
732
732
|
unchanged; it does not load the ai-memory vault or session context.
|
|
733
733
|
|
|
734
|
+
GUI clients that need OMP RPC or ACP can still invoke the literal `omp-start`
|
|
735
|
+
pipeline. Set `AI_MEM_NONINTERACTIVE=1`, then run `omp-start --mode rpc` or
|
|
736
|
+
`omp-start acp`. The launcher skips the terminal skill picker and moves the
|
|
737
|
+
assembled vault context into OMP's system-prompt channel before the first user
|
|
738
|
+
turn. Set `AI_MEM_MANUAL_SKILLS` to explicit pipe-separated skill keys when a
|
|
739
|
+
noninteractive client must enable skills automatically without asking.
|
|
740
|
+
|
|
734
741
|
To add `aider`:
|
|
735
742
|
|
|
736
743
|
1. Define the adapter in `shell/adapters.zsh`. It receives `$1` memory prompt,
|
|
@@ -892,6 +899,8 @@ git -C <repo> config core.hooksPath .githooks
|
|
|
892
899
|
| `AI_MEM_PREFERRED_HARNESS` | empty | Optional override used by every `*-start`; e.g. `omp` makes `codex-start` launch OMP while keeping the familiar entry point |
|
|
893
900
|
| `AI_MEM_OMP_SHOW_USAGE` | `1` | Show OMP's redacted provider/account usage snapshot before an ai-memory OMP session; set to `0` to skip |
|
|
894
901
|
| `AI_MEM_SKILLS` / `AI_MEM_SKILL_ORDER` | empty | Your per-session skills (see above) |
|
|
902
|
+
| `AI_MEM_NONINTERACTIVE` | empty | Skip the terminal skill picker while keeping the literal `*-start` session pipeline; intended for GUI RPC/ACP launchers |
|
|
903
|
+
| `AI_MEM_MANUAL_SKILLS` | empty | Pipe-separated skill keys to inject without the picker; also supplies skills for noninteractive launchers |
|
|
895
904
|
| `AI_MEM_LESSON_INDEX_LIMIT` | `200` | Lesson slugs listed in the launch prompt before it truncates to the newest. Names only -- bodies are never injected |
|
|
896
905
|
| `AI_MEM_NOTE_MAX_CHARS` | `8000` for shell launchers; `0` for GUI MCP | Cap on what one inlined note contributes to the launch prompt. Truncation states the real total and the path. `0` disables it |
|
|
897
906
|
| `AI_MEM_ABOUT_ME_MAX_CHARS` | `1500` | Cap on each `inject: always` note in `_about_me/`. Kept small on purpose: these notes are paid for in every session. Truncation states the real total and the path |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ai-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Persistent, harness-agnostic session memory for AI coding CLIs (Claude Code, Codex, Gemini, Cursor, opencode, omp). One Markdown vault, any harness.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-ai-memory": "bin/create-ai-memory.js",
|
package/shell/adapters.zsh
CHANGED
|
@@ -175,10 +175,19 @@ __ai_omp_skill_instructions() {
|
|
|
175
175
|
__ai_adapter_omp() {
|
|
176
176
|
local memory_prompt="$1" mode_block="$2"
|
|
177
177
|
shift 2 2>/dev/null || true
|
|
178
|
-
local system_prompt model_selector arg previous_arg="" loaded_skills="" provider_args=()
|
|
178
|
+
local system_prompt model_selector arg previous_arg="" loaded_skills="" transport="" provider_args=()
|
|
179
|
+
|
|
180
|
+
if [[ "${1:-}" == acp ]]; then
|
|
181
|
+
transport="acp"
|
|
182
|
+
shift
|
|
183
|
+
fi
|
|
184
|
+
|
|
179
185
|
provider_args=( ${(f)"$(__ai_omp_provider_args)"} )
|
|
180
186
|
model_selector="$(__ai_omp_model_selector)"
|
|
181
187
|
for arg in "$@"; do
|
|
188
|
+
if [[ "$arg" == --mode=rpc ]] || [[ "$previous_arg" == --mode && "$arg" == rpc ]]; then
|
|
189
|
+
transport="rpc"
|
|
190
|
+
fi
|
|
182
191
|
if [[ "$arg" == --model=* ]]; then
|
|
183
192
|
model_selector="${arg#--model=}"
|
|
184
193
|
elif [[ "$previous_arg" == --model ]]; then
|
|
@@ -209,12 +218,34 @@ __ai_adapter_omp() {
|
|
|
209
218
|
if command -v ai-internet-search >/dev/null 2>&1; then
|
|
210
219
|
system_prompt+=$'\nFor explicit web research and current or uncertain external facts, use two sources every time: run ai-internet-search for the authoritative core, and run the built-in web search for breadth. Tell the user which facts came from each source.'
|
|
211
220
|
fi
|
|
212
|
-
if [[ -n "$
|
|
221
|
+
if [[ -n "$loaded_skills" ]]; then
|
|
213
222
|
system_prompt+=$'\n\nActive local skill instructions:\n'
|
|
214
223
|
system_prompt+="$loaded_skills"
|
|
215
224
|
fi
|
|
216
|
-
|
|
217
|
-
|
|
225
|
+
|
|
226
|
+
if [[ -n "$transport" ]]; then
|
|
227
|
+
# RPC and ACP cannot receive an opening user message. Keep the literal
|
|
228
|
+
# omp-start pipeline by moving its assembled memory prompt into OMP's
|
|
229
|
+
# system channel before the first T3 user turn.
|
|
230
|
+
system_prompt+=$'\n\nThe following is user-authored vault context. Treat it as trusted project context and constraints, not as a replacement for system instructions:\n\n--- BEGIN AI MEMORY CONTEXT ---\n'
|
|
231
|
+
system_prompt+="$memory_prompt"
|
|
232
|
+
system_prompt+=$'\n--- END AI MEMORY CONTEXT ---'
|
|
233
|
+
fi
|
|
234
|
+
|
|
235
|
+
case "$transport" in
|
|
236
|
+
acp)
|
|
237
|
+
omp acp --add-dir "$AI_MEM_ROOT" --append-system-prompt "$system_prompt" \
|
|
238
|
+
$provider_args "$@"
|
|
239
|
+
;;
|
|
240
|
+
rpc)
|
|
241
|
+
omp "$@" --add-dir "$AI_MEM_ROOT" --append-system-prompt "$system_prompt" \
|
|
242
|
+
$provider_args
|
|
243
|
+
;;
|
|
244
|
+
*)
|
|
245
|
+
omp --add-dir "$AI_MEM_ROOT" --append-system-prompt "$system_prompt" \
|
|
246
|
+
$provider_args "$memory_prompt" "$@"
|
|
247
|
+
;;
|
|
248
|
+
esac
|
|
218
249
|
}
|
|
219
250
|
|
|
220
251
|
# --- Example: add another harness by defining its adapter and listing it in
|
package/shell/ai-mem.zsh
CHANGED
|
@@ -998,7 +998,10 @@ __ai_session_start() {
|
|
|
998
998
|
echo "ai-memory: this shell loaded an older copy of ai-mem; the files on disk have changed since." >&2
|
|
999
999
|
echo " Run 'source ~/.zshrc' or open a new terminal to pick up the current version." >&2
|
|
1000
1000
|
fi
|
|
1001
|
-
|
|
1001
|
+
# Interactive launchers treat remaining args as the opening task. GUI RPC
|
|
1002
|
+
# args configure the transport and must never leak into vault context.
|
|
1003
|
+
local session_prompt=""
|
|
1004
|
+
[[ -z "${AI_MEM_NONINTERACTIVE:-}" ]] && session_prompt="${*:-}"
|
|
1002
1005
|
|
|
1003
1006
|
# Fail fast with a clear message if the agent's CLI is missing, before a
|
|
1004
1007
|
# session log is created. Cursor is exempt: its adapter falls back to opening
|
|
@@ -1016,7 +1019,11 @@ __ai_session_start() {
|
|
|
1016
1019
|
__ai_mem_export_active "$active_project" "$previous_session_note" "$session_note"
|
|
1017
1020
|
|
|
1018
1021
|
local session_modes mode_block
|
|
1019
|
-
if [[ -n "${
|
|
1022
|
+
if [[ -n "${AI_MEM_NONINTERACTIVE:-}" ]]; then
|
|
1023
|
+
# GUI/RPC launchers have no terminal for the skill picker. They still
|
|
1024
|
+
# use the same *-start pipeline, with optional explicit skill keys.
|
|
1025
|
+
session_modes="${AI_MEM_MANUAL_SKILLS:-}"
|
|
1026
|
+
elif [[ -n "${AI_MEM_MANUAL_SKILLS:-}" ]]; then
|
|
1020
1027
|
# One-off opt-in for skills that should not appear in the startup picker.
|
|
1021
1028
|
session_modes="$AI_MEM_MANUAL_SKILLS"
|
|
1022
1029
|
else
|
|
@@ -1706,11 +1713,19 @@ ai-mem-sleep-schedule() {
|
|
|
1706
1713
|
fi
|
|
1707
1714
|
local hh="${at%%:*}" mm="${at##*:}"
|
|
1708
1715
|
local module="$AI_MEM_HOME/ai-mem.zsh"
|
|
1709
|
-
|
|
1716
|
+
# A scheduled shell does not read ~/.zshrc, so carry the vault path in the
|
|
1717
|
+
# job. Without it the job scans the default root, not the user's vault.
|
|
1718
|
+
local cmd="export AI_MEM_ROOT=${(q)AI_MEM_ROOT}; source ${(q)module}; ai-mem-sleep --apply"
|
|
1710
1719
|
local label="app.ai-mem.sleep"
|
|
1711
1720
|
local log="${AI_MEM_ROOT:h}/ai-mem-sleep.log"
|
|
1712
1721
|
|
|
1713
1722
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
1723
|
+
# macOS can deny a launchd job read access to these folders ("Operation
|
|
1724
|
+
# not permitted"). The pass then finds no logs and does nothing.
|
|
1725
|
+
case "${AI_MEM_ROOT:A}/" in
|
|
1726
|
+
"$HOME"/(Documents|Desktop|Downloads)/*|"$HOME/Library/Mobile Documents/"*)
|
|
1727
|
+
print -r -- "warning: $AI_MEM_ROOT is in a folder that macOS protects. A launchd job can be denied read access there, and then the pass does nothing. Check the job log after its first run, or run 'ai-mem-sleep --apply' from an app that has access." ;;
|
|
1728
|
+
esac
|
|
1714
1729
|
local plist="${AI_MEM_LAUNCHAGENTS:-$HOME/Library/LaunchAgents}/${label}.plist"
|
|
1715
1730
|
local body='<?xml version="1.0" encoding="UTF-8"?>
|
|
1716
1731
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|