Every developer running modern AI coding tools has hit the wall. You spend forty minutes guiding Claude Code through a gnarly distributed state bug, hit a wall or context degradation, decide to try OpenAI Codex or Cursor in the exact same directory, and immediately realize the painful truth: your context is dead. You are back to square one, manually retyping architectural constraints, repeating failed hypotheses, and explaining why the test runner needs custom environment flags.
The vendor ecosystem has built a landscape of hyper-isolated memory islands. Cursor remembers fragments on your local drive, Claude Code keeps internal notes, and every new agent CLI rolls its own proprietary storage. None of them talk to each other. None of them cross machines reliably. None of them survive a handoff to a colleague.
The open-source project ai-memory (hosted at aimemory.sh) attacks this fragmentation at the systems level. Instead of treating agent memory as an opaque, vendor-locked side effect, it re-architects long-term memory into an open, git-backed markdown wiki coupled with a typed handoff protocol.
The Fragmented Agent Problem
Today, developers rarely stick to one agent for an entire engineering lifecycle. You might run Claude Code for exploratory refactoring, spin up Gemini CLI or Grok for quick script verification, test changes against OpenCode or Devin, and switch to Cursor, Kimi, or Kiro for targeted module edits. More than twenty modern harnesses exist, yet each operates as a clean slate or a walled garden.
The architectural defect is threefold:
- Machine Isolation: Memory is pinned to a single disk. If you switch from your desktop workstation to a laptop, your agent forgets yesterday's design decisions.
- Agent Isolation: Context captured by one agent interface is invisible to another. Switching tools requires manual context re-injection.
- Team Omission: Knowledge acquired by an agent during a debugging session stays locked inside the individual developer's terminal.
ai-memory acts as a unified state layer beneath all these tools. Over twenty harnesses feed one centralized memory repository. When you close one agent mid-flight, the next one picks up where it stopped.
bash# Exit Claude Code mid-task claude-code # ... work happens, session ends ... # Resume instantly in Codex without re-explaining the stack ai-memory run codex
The Typed Handoff Protocol
Most context systems rely on lossy, LLM-generated summaries that drop the critical details you actually need, such as exact error codes or half-edited file paths. ai-memory replaces vague summaries with a typed handoff protocol.
Every handoff has an explicit owner and must be claimed exactly once. When you quit an agent and start another via ai-memory run, the system executes a coordinated context transfer:
+------------------+ Handoff Packet (Typed Protocol) +------------------+
| Claude Code | --------------------------------------------> | Codex |
| (Session Quits) | - Where work left off | (Session Starts) |
+------------------+ - Failed approaches & open questions +------------------+
| - Claimed exactly once |
| |
v v
+---------------------------------------------------------------------------------------+
| ai-memory core |
| - Shared Workstream (Server) |
| - Ephemeral Local Projection of Native History (Path/body never sent to remote) |
+---------------------------------------------------------------------------------------+
When you launch an agent through ai-memory run codex, the runtime injects both the shared project workstream and an ephemeral, private local projection of the previous agent's visible native history. If a bounded startup packet omitted an edge-case detail, Codex can still inspect that local projection.
Crucially, the architecture respects strict privacy boundaries. The remote memory server receives only the harness type and the session identity. It never receives the local transcript path or the transcript body. If you choose to launch an agent directly without the wrapper, it runs untethered, behaving exactly as it did before.
Architecture: Git-Backed Plain Markdown Over Vector DBs
A common anti-pattern in modern AI tooling is wrapping a fragile, opaque vector database around binary blobs. When retrieval fails, debugging vector weights is nearly impossible.
ai-memory rejects binary stores entirely. The definitive source of truth is a git-backed wiki of standard .md files.
.ai-memory/ (Git-backed Wiki)
├── architecture/
│ └── service-boundaries.md
├── handoffs/
│ └── handoff-2025-user-codex.md
└── episodic/
└── session-build-fixes.md
This design unlocks immediate practical advantages:
- Inspectability: You can inspect your agents' memories using standard POSIX utilities like
grepor edit them manually in Obsidian. - Portability: Moving, syncing, or backing up state requires nothing more exotic than
rsyncor nativegit push. - Zero Loss: The relational database powering search queries is merely a derived index. If the index corrupts, you can wipe it and rebuild it entirely from the raw markdown files.
- No Vector Store Maintenance: There are no binary stores, embeddings migrations, or heavy external databases to manage.
Silent Capture with Zero-LLM Overhead
A friction point in memory architectures is requiring the developer to explicitly say, "Remember this." In practice, developers forget, and context is lost.
ai-memory relies on silent lifecycle hooks that observe agent actions directly. It records prompts, tool executions, and session boundaries automatically. Before any artifact is committed to storage, it passes through a typed privacy boundary designed to sanitize data. From there, the server consolidates the sanitized events into readable markdown pages.
Importantly, the standard operating path consumes zero LLM calls. Data capture, text indexing, fast retrieval, and cross-agent handoffs operate locally using deterministic systems code without an API key. You do not burn tokens just to record what your agent did.
Algorithmic Decay and Compaction
Unchecked memory stores eventually pollute an agent's context window with stale data. Instead of firing off expensive background LLM passes to prune notes, ai-memory uses an access-weighted algorithmic decay model:
| Mechanism | Operating Model | Token Cost | Behavior |
|---|---|---|---|
| Access-Weighted Retention | Passive / Always On | 0 API calls | Pages decay based on schedules tuned per tier. Actively searching, opening, or linking to a page resets its decay curve. |
| Durable Compaction | Deterministic / Opt-in | 0 API calls | Cold episodic notes are stripped down to durable facts (file paths, decisions, error codes) rather than discarded. |
| Deduplication & Conflict Flagging | Heuristic / Opt-in | 0 API calls | Collapses near-identical notes and flags structural contradictions without external inference calls. |
| "Dream" Pass | LLM-Driven / Opt-in | Configured LLM | An optional background pass that rewrites clusters of cold notes into consolidated, coherent pages while the machine sits idle. |
Because memory sits on top of Git, destructive pruning does not exist. If a compaction routine alters an episodic note, the original text remains intact inside the git version chain, restorable at any point using the built-in restore-page command.
Cross-Project and Cross-Machine Topology
Developer workflows are rarely restricted to a single repository or a single computer. ai-memory structures context across two specific boundaries:
1. Cross-Project Profiles
When opening a fresh repository, developers usually waste several prompts teaching the agent baseline preferences: preferred package managers, test layout patterns, and architectural quirks.
ai-memory loads a persistent user profile across every project session start. This profile sits directly beneath the repository-specific rules file as a fallback default. For a single user, this operates out of the box. On shared team instances, it is strictly opt-in and private per developer.
2. Multi-Machine and Team Infrastructure
The memory engine runs as an independent daemon. You can host it locally on a laptop, deploy it to a homelab server, or spin it up on an internal company network.
+-----------------------+
| ai-memory Server |
| (Homelab or Cloud) |
+-----------------------+
^ ^
| |
Project A| |Project A
Knowledge| |Knowledge
v v
+------------+ +------------+
| Workstation| | Laptop |
| Dev Session| | Dev Session|
+------------+ +------------+
When deployed across a team, project-level knowledge is shared automatically. What an agent learns while resolving an issue in one developer's session becomes accessible to an agent running on a teammate's machine. At the same time, personal handoffs remain strictly isolated to the user who created them. Multi-user authentication, granular attribution, and audit logging are fully native to the core platform without requiring premium enterprise tiers.
By decoupling agent memory from proprietary platforms and anchoring it to a git-backed markdown engine, ai-memory delivers a predictable context protocol for modern coding agents. You can shift between tools like Claude Code, Codex, Cursor, and Devin without leaving your operational history behind.
