跳到正文
DEV Community· Open-Agentic-Brain-and-Memory·· 2 小時前AI 評分65

OpenAB 如何讓現有編碼工具共享記憶,無需切換框架

Stateful Agents Without Switching Frameworks: Shared Memory for the Coding Tools You Already Use

AI 導讀

Open Agentic Brain & Memory(OpenAB)為 Claude Code、Cursor、Codex 等現有編碼工具提供共享記憶層,透過啟動 hooks 和 MCP 連接同一個本機 SQLite 記憶庫,無須切換框架。

正文

Shared memory for AI coding agents is a single, persistent store of project decisions, fixes and preferences that every coding tool you use can read from and write to. It means Claude Code, Cursor and Codex start each session already knowing what any of them learned before, instead of each one starting from zero.

The problem with stateful agents is the "agent" part

Ask how to give an AI agent memory and the usual answer is to adopt a stateful agent framework. Build your agent inside its runtime, and it remembers. That works if you're building an agent. Most developers we talk to aren't. They're using Claude Code in the terminal, Cursor in the editor and Codex for the odd background task, and none of those tools runs inside anyone's framework.

So the memory problem stays put. Claude Code forgets everything when a chat ends. On Monday you tell it you dropped Redis for SQLite because the deployment target can't run a second service. On Tuesday you open Cursor, and it suggests a Redis cache. You explain again. On Wednesday Codex reaches for npm, and you remind it, for the fourth time this month, that this repo always uses pnpm.

Every one of those reminders costs tokens, and it costs your patience too. A notes file pasted into each chat helps a little, but it gets long, goes stale, and has to be pasted into every tool separately.

How shared memory for AI coding agents works with the tools you already have

At Open Agentic Brain & Memory (OpenAB), we built memory as a layer underneath your tools, not as a framework you move into. It connects through two things your tools already support: start-up hooks and MCP. You keep your editor, your terminal and your habits. The memory just shows up.

Today that covers Claude Code, Cursor, Codex, Antigravity and Kilo Code (beta). The loop has three parts.

Capture

As you work, OpenAB records the things worth keeping: a decision ("SQLite, not Redis"), a fix ("the flaky test was a timezone issue in CI"), a preference ("pnpm, always"). These get distilled into short memories and stored in a local SQLite database on your machine. Nothing goes to a server of ours, because we don't run one.

Tag by project

Each memory is tagged with the project it belongs to, which OpenAB finds by walking up from your working directory to the nearest .git. When you open a folder, that repo's history comes first. Projects aren't walled off from each other, though. A map of up to 20 projects lives in your global CLAUDE.md, AGENTS.md and GEMINI.md, so a tool working in one repo knows the others exist. Recall can search one project or all of them.

Recall

At session start, a hook injects a ranked briefing of at most 2,000 tokens. In our measurements it's ready in 84 ms (p50), so you won't notice it. During a session, tools can also pull memories on demand through MCP tools: brain_recall, brain_remember, brain_context and load-my-brain. Recall over a store of 10,000 memories takes 28 ms (p50). Search is hybrid, matching keywords and meaning, and memories carry outcome scores, so things that actually helped rank higher.

If you work on more than one laptop, OpenAB merges in what the other machines learned at start-up. The briefing is the same everywhere.

What it does to your token bill

This is where shared memory pays for itself. Every tool gets a short, ranked briefing instead of your whole history or a growing notes file.

  • Loading context for a 10,000-memory store: 1,325 tokens with OpenAB's ranked briefing, compared with 1,131,367 tokens to load the full store. That's from our own benchmark of a 10,000-memory store, published on the OpenAB site.

  • Answer quality at a fraction of the input: on the LoCoMo long-conversation benchmark, OpenAB keeps 97% of the score you get from feeding the full conversation, while reading 18% of the tokens. That's also our own run, so treat it as a claim you can check, not as gospel.

  • Hard ceiling per session: the start-up briefing is capped at 2,000 tokens by design, however large your memory grows.

Fewer tokens per session means you hit Claude, Cursor and Codex usage limits later. It also leaves more of the context window for the code you're actually working on.

Don't take our benchmark numbers on faith. Run brain eval to score recall on your own history and see how it does on your projects, not ours.

Shared memory vs. stateful agent frameworks

Stateful agent frameworks and memory APIs are good tools. They answer a different question. Here's how the approaches compare at a high level. The competitor descriptions are general summaries, so check each project's own documentation for current details.

OpenABStateful agent framework (e.g. Letta)Hosted memory API (e.g. Mem0 platform, Zep Cloud)

Runtime lock-inNone. Works under your existing tools via hooks and MCPYour agent runs inside the frameworkYou call their API from code you write
HostingSelf-hosted. Local SQLite, sync via your private GitHub repoSelf-host or their cloudTheir servers (some offer open-source editions)
Supported toolsClaude Code, Cursor, Codex, Antigravity, Kilo Code (beta)Agents built on the frameworkApps you integrate yourself
Account requiredNoDepends on deploymentYes, for hosted plans
LicenseApache-2.0Varies by projectVaries by project and plan

If you're building a custom agent from scratch, a framework may be the right call. If you want the coding tools you already use to share what they know, you don't need to switch anything.

Who holds the key

Memory about your codebase is sensitive, so we kept the ownership model simple. There's no account. Memories live in local SQLite. For sync, the store is age-encrypted and uploaded as a Release asset on your own private GitHub repo. The key stays only in your OS Keychain. A leaked repo or token exposes nothing readable. The trade-off is real: only you hold the key, so if you lose it, nobody can recover your memory.

You can also see everything. A local control panel lets you read, edit, pin or delete every memory. When you install, you choose whether to start from past AI work or start fresh.

Try it on one project first

The best test of shared memory for AI coding agents is boring: make one decision in Claude Code, then open Cursor the next day and see if it already knows. OpenAB is free, Apache-2.0, and built in public by Rohith, Chandan and Sushmita. The source is in the GitHub repo rohithhn/Open-Agentic-Brain-and-Memory. You can read how it works, and our guides on context engineering, agent hooks and long context vs RAG vs memory, on the OpenAB site, which covers setup for Claude Code, Cursor, Codex, Antigravity and Kilo Code.

Install Open Agentic Brain & Memory (OpenAB)

FAQ: shared memory for AI coding agents

Does shared memory send my code to a third-party server?

Not with OpenAB. Memories are stored in a local SQLite database, and sync happens through an age-encrypted blob on your own private GitHub repo. We run no server and you don't need an account.

How is this different from Mem0, Zep or Letta?

Letta is a framework you build agents inside. Mem0 and Zep are memory layers you integrate into your own apps, often through a hosted API. OpenAB sits under the coding tools you already use, through hooks and MCP, and is self-hosted by default.

Does it work with Cursor and Codex at the same time?

Yes. Every connected tool reads from and writes to the same store, so a decision made in one is available to the others. Claude Code, Antigravity and Kilo Code (beta) are supported too.

How much does shared memory reduce token usage?

In our benchmark, loading context for a 10,000-memory store took 1,325 tokens, compared with 1,131,367 for the full store. On LoCoMo, OpenAB kept 97% of the full-conversation score while reading 18% of the tokens. You can check results on your own history with brain eval.

What happens when two memories conflict?

Recall is ranked using hybrid search and outcome scores, so memories that helped tend to come first. If an old decision is simply wrong now, open the local control panel and edit or delete it, or pin the one you want to win.

Is it free?

Yes. OpenAB is free and open source under Apache-2.0, with no paid tier and no account. You only need your own private GitHub repo if you want to sync across machines.

來源:DEV Community · dev.to