DEV Community

ahwai zhang
ahwai zhang

Posted on Originally published at github.com

Solving AI Agent Amnesia: Building a Self-Hosted Shared Memory Mesh for Coding LLMs

Every developer using AI coding agents (Claude Code, Cursor, Codex CLI, Antigravity) knows the feeling:

You spend three hours with an AI assistant debugging a distributed state machine, isolating an obscure race condition, and fine-tuning an Nginx reverse proxy. The agent understands every nuance of your architecture.

Then, you close your terminal.

The next morning, you open a new session: Your agent has complete amnesia.

You re-explain the database schema. You re-explain why port 5432 is reserved. You re-explain your branching rules.


The Trap of the 8,000-Token Markdown File

The standard workaround today is creating a CLAUDE.md or memory.md file in your repository root.

It works fine for the first week. But after three weeks of active development:

  1. Context Window Tax: Your markdown file swells to 8,000+ tokens. Every single prompt you send wastes 15% of your context window loading static documentation.
  2. Context Rot & Noise: The LLM gets overwhelmed by irrelevant historical notes and begins hallucinating or ignoring recent instructions.
  3. Multi-Agent Knowledge Silos: When your frontend agent figures out a subtle CORS issue with the authentication gateway, your backend agent in another repository has no way to access that knowledge—and wastes hours re-debugging the exact same issue.

The Solution: A Container-Isolated Shared Memory Mesh

We built and open-sourced Transcendence Memory to solve this once and for all.

Transcendence Memory provides a self-hosted cloud memory service that turns isolated AI sessions into a collaborative, persistent knowledge network:

  Agent A (Frontend / Claude)       Agent B (Backend / Codex)       Agent C (DevOps / Terminal)
       |                                  |                                  |
       |  store & search own              |  store & search own              |  store & search own
       |  cross-query B, C                |  cross-query A, C                |  cross-query A, B
       |                                  |                                  |
       +----------------------------------+----------------------------------+
                                          |
                             Transcendence Memory Server
                             +-------------------------+
                             |  Container: frontend    |
                             |  Container: backend     |
                             |  Container: devops      |
                             |  Container: shared      |
                             +-------------------------+
Enter fullscreen mode Exit fullscreen mode

Key Architecture Highlights

  1. Strict Container Isolation: Each agent writes exclusively to its own namespace (frontend, backend, etc.). No accidental context contamination.
  2. Cross-Query Mesh: Agents can perform semantic queries across peer containers without polluting their working prompt state.
  3. Multi-Tier RAG & Knowledge Graph:
    • Tier 0: Ultra-low latency vector retrieval via LanceDB (<15ms, zero LLM inference token cost).
    • Tier 1: Hybrid BM25 + dense vector ranking.
    • Tier 2: Entity-relationship Knowledge Graph extraction powered by LightRAG.
    • Tier 3: Multimodal parsing for system diagrams, PDFs, and database schemas.
  4. Lifecycle Hooks for Zero-Effort Capture: Integrates with your host CLI. When you run git commit, an automatic hook summarizes the architectural intent and saves it without manual note-taking.
  5. 100% Self-Hosted & Private: Runs via a clean Docker Compose stack. Zero telemetry, full data sovereignty. Works with any OpenAI-compatible endpoint or local Ollama models.

Deploy in 60 Seconds with an AI Prompt

You don't even need to read through configuration docs. The repository README includes an AI-Assisted Setup Prompt: simply copy the prompt into Claude Code or Cursor, and your agent will install, configure, and health-check the Docker container automatically!

Explore the code and join the project on GitHub:

MIT Licensed. If you find this helpful for your daily AI workflow, leave a ⭐️ on GitHub!

Top comments (0)