DEV Community

Self-Hosted AI Coding Memory vs Hosted Memory Layers: What You Give Up and What You Keep

Self-hosted AI memory for coding tools is a memory store that runs on your own machine and syncs to storage you control. It holds the decisions, fixes and preferences your AI tools pick up, and the vendor never sees them. A hosted memory layer does the same job on the vendor's servers, under the vendor's retention terms.

Which one to pick depends on what the memory holds. Choose self-hosted if it will contain proprietary code or you work across several tools and machines. Choose hosted if you want zero setup and accept the vendor's terms. A single-tool plugin sits in between and only helps while you stay in that one tool.

Every coding session starts from zero, and no tool knows what the others learned. Memory fixes that, but only if you know what it stores and who holds it.

What your AI coding memory actually contains

It is more sensitive than most people assume. A useful memory records:

  • Decisions and the reasons behind them, such as "dropped Redis for SQLite because we run on one box."

  • File paths, function names and architecture notes.

  • Preferences and rules, such as "always use pnpm."

  • Errors and the fixes that worked.

Put together, that is a map of your codebase and your mistakes. Secrets also slip in. GitGuardian's State of Secrets Sprawl 2024 report counted 12.8 million new secrets in public GitHub commits during 2023, which shows how easily credentials end up in places nobody intended. In a documented prompt-side case, Samsung restricted ChatGPT use in 2023 after employees pasted internal source code into it, as reported by Bloomberg. Anything an agent reads can end up in its memory unless you can inspect and delete it.

Retention terms matter too. OpenAI's API documentation says API data may be retained for up to 30 days for abuse monitoring by default. Anthropic's consumer terms, updated in 2025, keep chats for up to five years if you allow model training and for 30 days if you don't. Cursor documents a Privacy Mode under which code is not stored by its model providers. Those terms differ by vendor and by mode, so read the current version before you rely on any of them.

Self-hosted AI memory for coding tools vs hosted layers and plugins

Hosted memory layers

Mem0 and Supermemory offer hosted APIs, and Mem0 also has an open-source option. Setup is quick and someone else runs the infrastructure. The cost is that your decisions and code context live on a server you don't control, under terms that can change. Verify each vendor's current terms before you cite them, because they move.

Single-tool plugins

Plugins such as Claude-mem keep session memory for one tool. That works if you only use Claude Code. The developer who switches between Claude Code, Cursor and Codex gets three separate memories that never meet. Tell one tool about your pnpm rule and the others still don't know.

Self-hosted, shared memory

This is the approach we took. At Open Agentic Brain & Memory (OpenAB), we store memory in a local SQLite database and share it across Claude Code, Cursor, Codex, Antigravity and Kilo Code (beta). There is no account and no server of ours. You can read, edit, pin or delete every memory in a local control panel. You can see the whole design on the OpenAB site.

Self-hosting costs you something too. You manage your own key, and nobody can reset it for you. If you want no setup at all, a hosted layer is the easier path.

How age-encrypted sync to your own private GitHub repo works

Local memory is useful until you open a second laptop. To cover that, the database is encrypted with age and uploaded as a Release asset on your private GitHub repo. At start-up, the tool merges in what your other machines learned, so the briefing is the same everywhere.

The key stays in the OS Keychain on your machine. GitHub only ever stores ciphertext. A leaked repo or token exposes nothing readable, because the key is not there.

The flip side is that only you hold the key. If you lose it, nobody can recover your memory, including us. That is the deal with owner-held encryption. Back the key up the way you would back up an SSH key, and expect to move it to each new machine yourself.

Latency and token budgets: what to measure before you choose

Whatever you pick, measure two things. The first is how long start-up takes. A hook that adds seconds to every session gets switched off. The second is how many tokens it injects. Unbounded memory is just a long prompt, and a longer context costs more. A guide on long context vs RAG vs memory puts full-context runs at about 4.6 times the cost of memory in its benchmark, so a budget matters.

Here is what we measured on our own setup:

  • The start-up hook injects a briefing of at most 2,000 tokens in 84 ms (p50).

  • Recall over 10,000 memories takes 28 ms (p50) through the MCP tools.

Those numbers come from our own benchmarks on our own hardware, so yours will differ. Don't take ours or any vendor's on trust. The brain eval command scores recall against your own history. Run something like it on a week of your real sessions before you commit, whichever tool you choose. If you want the full picture first, the OpenAB overview shows how the pieces fit.

FAQ

Is self-hosted AI memory for coding tools safe?

It is safer than hosted for proprietary code, because nothing leaves your control unencrypted. OpenAB stores memory locally and syncs only an age-encrypted blob, with the key in your OS Keychain. You still own the risks of your own machine and your key.

What is the difference between OpenAB and Mem0 or Zep?

OpenAB is self-hosted and has no vendor server, while Mem0 and Zep are memory layers for building AI apps and agents, with hosted options. We built ours for the person using several coding tools, not for a developer wiring memory into a product. Check their current docs for specifics, since both change often.

Do I need an account or a server to run it?

No. There is no account and no server of ours. You only need a private GitHub repo if you want sync across machines.

Does self-hosted memory work offline?

Local recall does, because the memory is a SQLite database on your machine. Only cross-machine sync needs a network connection.

What about secrets pasted into prompts?

Treat them as exposed, and rotate them. Because every memory is readable, editable and deletable in the control panel, you can find a stray key and remove it. Encryption at rest and in sync limits the damage, but it does not undo a leak.

Install OpenAB

Top comments (0)