← Writing
2026.04.24 · AI / MCP / Systems
Field note 03 Shared memory 2026.04.24

How I Built a Shared Brain for My AI Agents

My AI setup started splitting into islands. Hermes on my VPS knew one thing, Claude Code and Codex on my MacBook knew another, and I got tired of re-explaining the same context. So I built one canonical brain they could all reach.

The problem was not the models. It was the missing memory layer between them.

I was already using multiple AI tools in different places. Hermes lived on my VPS. Claude Code, Codex, and other agents lived on my MacBook. On paper that sounded powerful. In practice, it meant each tool kept becoming the center of its own little universe.

One agent knew the server setup. Another knew the current project state. Another knew what I had decided yesterday. If I switched tools, the context did not come with me. The result was not dramatic failure. It was steady friction: repeated prompting, partial answers, forgotten decisions, and the feeling that I was rebuilding the same mental state every time I changed surfaces.

That was the point where I stopped thinking about “better prompts” and started thinking about architecture. I did not need another assistant. I needed one source of truth that all of them could use.

The real win was not smarter prompting. It was stopping context from being trapped inside one agent at a time.

I made the VPS the home base and put one canonical brain behind MCP.

I used gbrain as the shared memory layer and made the VPS the canonical home for it. The database lives in one place. Hermes connects to it locally through MCP. That part was straightforward. The harder part was the MacBook side: I wanted Claude Code, Codex, and OpenCode to reach the same brain over Tailscale without creating a duplicate copy on every machine.

The clean answer was to keep the brain centralized and expose it as a remote MCP service. Upstream gbrain still runs as stdio, so I added a small authenticated HTTP wrapper in front of it, bound it to my Tailscale IP, and gave it a health check, token auth, and a proper service on the server. That turned the brain into something every agent could point at instead of something I had to keep reinstalling and re-explaining.

The important decision was not just making it work. It was deciding what counts as canonical. The PGLite brain database became the source of truth. Git stayed as backup and versioning. All writes go through gbrain MCP instead of raw file edits. Once that was clear, the rest of the system got simpler.

Now the setup feels less like using tools and more like using one system.

The practical change is simple: I can move between agents without losing as much context. Hermes can hold the server-side memory. MacBook agents can read from the same brain instead of starting cold. The setup instructions are stable, the connection path is stable, and the memory layer is no longer tied to one interface.

That does not mean the system is magically finished. Shared memory still needs curation. Links still matter. Notes still need to be written clearly enough for another agent to use them later. But the shape of the problem changed. I am no longer asking, “which agent remembers this?” I am asking, “did we put this into the brain?” That is a much better question.

For me, this is the interesting part of AI tooling right now. Not just model capability, but system design: where memory lives, what becomes canonical, and how to make multiple agents feel less like separate chats and more like one operating layer.

  • One canonical brain on the VPS instead of fragmented per-agent memory.
  • Remote MCP access over Tailscale for MacBook agents.
  • Less repeated prompting, less context drift, and a cleaner base to build on.