DEV Community

joexk
joexk

Posted on

Designing a shared memory for coding agents without embeddings

When several coding agents work on the same project, each one starts cold. Claude Code doesn't know what Codex worked out yesterday, and a local model picking up a small follow-up knows nothing at all. I wanted one memory they all share, and I wanted it to stay small, honest and local.

This is how the memory in JoeBro works. JoeBro is a free, GPLv3 Mac workspace for Claude Code, Codex, OpenCode and local models. The memory is a standard MCP server, so the ideas apply to any setup.

Small facts, not summaries

The unit of memory is one short fact: a decision, a gotcha, a workaround that actually worked. "The flaky test is test_sync, don't trust a single failure." "We chose SQLite on purpose; don't suggest Postgres."

Session summaries were the first thing I tried, and they recalled badly. A summary is about everything, so it matches every query weakly. One fact per idea matches precisely or not at all.

Five tools

  • memory_remember: save a fact, with an optional topic.
  • memory_recall: find the facts relevant to a query.
  • memory_supersede: replace a fact with a corrected one.
  • memory_forget: retire a fact.
  • memory_project_brief: a short brief handed to an agent at session start.

The brief is capped at a small token budget. Everything else is pull-only, so the memory never floods the context window.

Recall without embeddings

Recall is plain lexical matching: token overlap, weighted by how rare each word is in that project's memory, with a boost when words hit a fact's topic label. There are no embeddings and no model calls anywhere.

That sounds primitive, but with small facts it works well. The query "why is the build failing on CI" and the fact "CI needs DEVELOPER_DIR set because xcode-select points at the Command Line Tools" share exactly the rare words that matter. Hybrid recall with embeddings is still on my list to test, but lexical has gone further than I expected.

Strength and decay

Every fact has a strength:

  • A recall bumps it.
  • Unused facts decay on a half-life.
  • Each project has a size cap, and when it fills, the weakest unpinned facts are archived.
  • Pinned facts never decay. That's for things like rollback steps, which might go unread for months and then matter a lot.

Decay only affects ranking and what makes the brief. A weak fact still comes back on a direct recall until the cap archives it.

Provenance

Every fact records the agent, model, session and host that wrote it. This turned out to matter more than anything else:

  • When two agents disagree, you can see whether a claim came from a small local model or a frontier one.
  • A fix that only worked on one laptop doesn't get treated as project truth on another machine.

Nothing is destructive

Any connected agent can supersede or forget any fact; there's no per-author ownership. The safety net is that nothing is ever deleted:

  • Forget archives a fact.
  • Supersede archives the old version with a pointer to the new one, so history is a chain.
  • Every action is logged with which agent did it.
  • Writing a fact that already exists reinforces it instead of creating a duplicate.

It stays on your machine

The whole thing is one SQLite file per project on your disk, keyed by the repo's normalised git remote. No account, no telemetry, and no server in the middle. Local models get the same memory and tools as the cloud agents, so a cheap Ollama model can do a follow-up using what a bigger model already figured out, without anything leaving the Mac.

If you're building something similar, I'd love to hear how you handle write permissions between agents and how aggressive your decay is.

Repo: github.com/joexk1/JoeBro. Disclosure: I made it.

Top comments (0)