{"slug": "ai-memory-persistent-cross-agent-long-term-memory-for-coding-clis", "title": "ai-memory: Persistent Cross-Agent Long-Term Memory for Coding CLIs", "summary": "A developer released ai-memory, an open-source Rust binary that provides vendor-neutral, git-backed long-term memory for more than 20 AI coding harnesses including Claude Code, Cursor, and Codex. The tool captures session observations through native lifecycle hooks, stores them as human-readable markdown files indexed by SQLite FTS5, and passes pending task handoffs between agents via claim-once tokens, all with zero LLM API calls by default. Optional background LLM consolidation and local vector embeddings can be enabled by users.", "body_md": "AI coding agents have revolutionized day-to-day software development, but they have introduced a frustrating new bottleneck: **agent amnesia**.\n\nAs developers increasingly juggle multiple coding harnesses—using Claude Code for architecture planning, Cursor for frontend adjustments, and Codex or OpenCode for automated refactors—they quickly discover that each tool operates in a completely isolated silo:\n\n**ai-memory (`akitaonrails/ai-memory`)** was created to break down these walls. Built in Rust as a single, self-contained binary, it provides a vendor-neutral, git-backed long-term memory server that bridges more than 20 AI coding harnesses.\n\nHere is a technical overview of how ai-memory works, its zero-LLM architecture, and how it handles cross-agent handoffs.\n\nMost coding assistants provide some flavor of built-in memory. Claude Code creates local project notes, Cursor maintains workspace indexes, and various plugins offer per-session scratchpads.\n\nHowever, these implementations share three critical flaws:\n\nai-memory separates memory management into four distinct, observable stages:\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                       AI Coding Agent                       │\n│    (Claude Code / Cursor / Codex / Antigravity CLI / etc.)   │\n└──────────────────────────────┬──────────────────────────────┘\n                               │\n            [ 1. Capture (Silent Lifecycle Hooks) ]\n                               │\n                               ▼\n           [ 2. Consolidate (Git-Backed Markdown) ]\n                               │\n                               ▼\n               [ 3. Recall (FTS5 + Entity Search) ]\n                               │\n                               ▼\n        [ 4. Cross-Agent Handoff (Typed & Claim-Once) ]\n```\n\nRather than forcing developers into awkward *\"please remember this\"* ceremonies, ai-memory utilizes native agent lifecycle hooks. As you work, sanitized observations (prompts, tool invocations, session milestones) are streamed through a typed privacy boundary.\n\nThe central invariant of ai-memory is that **the human developer owns the data**. \n\nMemory is compiled into an ordinary, git-backed wiki composed of human-readable `.md` files. You can:\n\n`grep` or `ripgrep`.` git push` or `rsync`.\nThe underlying database is strictly a derived index (SQLite FTS5) that can be completely wiped and reconstructed from the markdown files at any time.\n\nBy default, ai-memory operates with **zero LLM API calls**. \n\nCapture, indexing, and recall use high-performance full-text search (SQLite FTS5), entity extraction, and link graphs. A developer can run ai-memory completely offline with zero API keys and zero recurring expenses. For users who want it, optional background LLM consolidation and local vector embeddings can be toggled on.\n\nWhen you terminate a session in Claude Code, ai-memory records where the task halted, which hypotheses failed, and what tasks remain open.\n\nWhen you launch Codex or Cursor in that same repository, the new agent claims the pending handoff token exactly once, immediately injecting a compact, high-signal brief into the prompt context.\n\nai-memory provides first-party integration (via MCP server registration, lifecycle hooks, or both) across major platforms:\n\nYou can run ai-memory on any workstation using the pre-built Docker container:\n\n```\n# Start the local memory daemon (binds to loopback 127.0.0.1:49374)\ndocker run -d --name ai-memory \\\n    --restart unless-stopped \\\n    -p 127.0.0.1:49374:49374 \\\n    -v ai-memory-data:/data \\\n    akitaonrails/ai-memory:latest\n```\n\nTo connect ai-memory to Claude Code, simply install the MCP bridge and hooks:\n\n```\nai-memory install-mcp --client claude-code --apply\nai-memory install-hooks --agent claude-code --apply\n```\n\nNow, any observations, architectural choices, and unresolved debugging questions will automatically persist into your project's local markdown wiki, ready to be retrieved by whichever agent you open next.\n\nai-memory treats developer memory the way developer tools ought to be built: local-first, transparent, git-versioned, and completely independent of any single model vendor.\n\nBy eliminating the cognitive tax of re-explaining systems to every new tool, it makes a multi-agent coding workflow genuinely seamless.", "url": "https://wpnews.pro/news/ai-memory-persistent-cross-agent-long-term-memory-for-coding-clis", "canonical_source": "https://dev.to/terminalchai/ai-memory-persistent-cross-agent-long-term-memory-for-coding-clis-3c40", "published_at": "2026-09-22 19:10:54+00:00", "updated_at": "2026-09-22 19:22:59.507394+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "agent-protocols", "ai-infrastructure"], "entities": ["ai-memory", "akitaonrails", "Claude Code", "Cursor", "Codex", "OpenCode", "Rust", "SQLite FTS5"], "alternates": {"html": "https://wpnews.pro/news/ai-memory-persistent-cross-agent-long-term-memory-for-coding-clis", "markdown": "https://wpnews.pro/news/ai-memory-persistent-cross-agent-long-term-memory-for-coding-clis.md", "text": "https://wpnews.pro/news/ai-memory-persistent-cross-agent-long-term-memory-for-coding-clis.txt", "jsonld": "https://wpnews.pro/news/ai-memory-persistent-cross-agent-long-term-memory-for-coding-clis.jsonld"}}