create-ai-memory 0.15.0 → 0.15.1

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
@@ -466,7 +466,7 @@ that can grow without limit is a cost that compounds silently.
466
466
 
467
467
  | what reaches the prompt | bound |
468
468
  |---|---|
469
- | Profile and standards | **8,000 chars** each (`AI_MEM_NOTE_MAX_CHARS`) |
469
+ | Profile and standards | **8,000 chars** each for shell launchers; GUI MCP is uncapped by default (`AI_MEM_NOTE_MAX_CHARS`) |
470
470
  | Previous session outcome | 4 fields, 500 chars each |
471
471
  | Lesson index | 200 slugs, names only |
472
472
  | Project note | **a path, not its contents** |
@@ -850,7 +850,7 @@ git -C <repo> config core.hooksPath .githooks
850
850
  | `AI_MEM_AGENTS` | `claude codex agy gemini cursor opencode` | Space-separated agents to generate `-start` functions for |
851
851
  | `AI_MEM_SKILLS` / `AI_MEM_SKILL_ORDER` | empty | Your per-session skills (see above) |
852
852
  | `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 |
853
- | `AI_MEM_NOTE_MAX_CHARS` | `8000` | Cap on what one inlined note contributes to the launch prompt. Truncation states the real total and the path. `0` disables it |
853
+ | `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 |
854
854
  | `AI_MEM_SEARCH_LIMIT` | `25` | Result lines `ai-mem-search` prints before it truncates. The default is sized for an agent's context window; raise it when you are reading the output yourself (see [How search works](#how-search-works)) |
855
855
  | `AI_MEM_HOME` | the module's own directory | Exported by the module when it is sourced, not set by you. A cron job, a launchd agent or any non-interactive shell can re-source the module with `zsh -c 'source "$AI_MEM_HOME/ai-mem.zsh"; ...'` instead of a hard-coded path |
856
856
  | `AI_MEM_SEARCH_PER_FILE` | `1` | Lines shown per file once the cap binds. Spreads results across notes instead of on the chattiest one; ignored when every match already fits |
package/bin/ai-mem-mcp.js CHANGED
@@ -53,7 +53,13 @@ const VERSION = (() => {
53
53
  function zsh(snippet) {
54
54
  const r = spawnSync('zsh', ['-c', `source ${JSON.stringify(MODULE)} >/dev/null 2>&1\n${snippet}`], {
55
55
  encoding: 'utf8',
56
- env: { ...process.env, AI_MEM_ROOT: VAULT },
56
+ // GUI context must include the complete profile and standards by default.
57
+ // Callers can still set AI_MEM_NOTE_MAX_CHARS to restore a smaller cap.
58
+ env: {
59
+ ...process.env,
60
+ AI_MEM_ROOT: VAULT,
61
+ AI_MEM_NOTE_MAX_CHARS: process.env.AI_MEM_NOTE_MAX_CHARS ?? '0',
62
+ },
57
63
  maxBuffer: 8 * 1024 * 1024,
58
64
  });
59
65
  if (r.error) return { ok: false, text: `failed to run zsh: ${r.error.message}` };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ai-memory",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
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
@@ -444,7 +444,8 @@ __ai_mem_prepare_session() {
444
444
  project_session_dir="$(__ai_mem_project_session_dir "$project_name")"
445
445
  local previous_session_note=""
446
446
  previous_session_note="$(__ai_mem_latest_session_log "$project_name")" || return 1
447
- local session_note="$project_session_dir/${project_name}-$(date +%Y-%m-%d_%H-%M-%S).md"
447
+ local session_stamp="$(date +%Y-%m-%d_%H-%M-%S)"
448
+ local session_note="$project_session_dir/${project_name}-${session_stamp}.md"
448
449
 
449
450
  __ai_mem_guard "$project_note" || return 1
450
451
  __ai_mem_guard "$session_note" || return 1
@@ -456,13 +457,29 @@ __ai_mem_prepare_session() {
456
457
  "$AI_MEM_PROJECT_DIR/_project_template.md" > "$project_note"
457
458
  fi
458
459
 
460
+ # A blank note with this second's timestamp belongs to a separate session.
461
+ # Wait for the next timestamp instead of overwriting its previous-session
462
+ # link. A note with Live Notes is the active GUI/CLI session and must be
463
+ # reused.
464
+ if [[ -f "$session_note" ]] && ! grep -q '^### Live Notes' "$session_note" 2>/dev/null; then
465
+ while [[ -f "$session_note" ]]; do
466
+ sleep 1
467
+ session_stamp="$(date +%Y-%m-%d_%H-%M-%S)"
468
+ session_note="$project_session_dir/${project_name}-${session_stamp}.md"
469
+ done
470
+ fi
471
+
459
472
  local prev_link=""
460
473
  if [[ -n "$previous_session_note" ]]; then
461
474
  prev_link="[[${previous_session_note:t:r}]]"
462
475
  fi
463
476
 
464
- SESSION_DATE="$(date +%Y-%m-%d)" PROJECT_NAME="$project_name" PREV_LINK="$prev_link" perl -0pe 's/\{\{date\}\}/$ENV{SESSION_DATE}/g; s/\{\{project_name\}\}/$ENV{PROJECT_NAME}/g; s/\{\{previous_session_link\}\}/$ENV{PREV_LINK}/g' \
465
- "$AI_MEM_SESSION_DIR/_session_template.md" > "$session_note"
477
+ # Context reads can follow a GUI write in the same second. Reusing an
478
+ # existing timestamped note preserves Live Notes and any other append.
479
+ if [[ ! -f "$session_note" ]]; then
480
+ SESSION_DATE="$(date +%Y-%m-%d)" PROJECT_NAME="$project_name" PREV_LINK="$prev_link" perl -0pe 's/\{\{date\}\}/$ENV{SESSION_DATE}/g; s/\{\{project_name\}\}/$ENV{PROJECT_NAME}/g; s/\{\{previous_session_link\}\}/$ENV{PREV_LINK}/g' \
481
+ "$AI_MEM_SESSION_DIR/_session_template.md" > "$session_note"
482
+ fi
466
483
 
467
484
  export AI_MEM_ACTIVE_PROJECT="$project_name"
468
485
  export AI_MEM_PREVIOUS_SESSION_LOG="$previous_session_note"