Sultan Kautsar

One Shared Memory for Four AI Agents

I run four AI agents on one laptop, and each kept its own memory and history. I built a single local vault that collects all of it every hour and gives every agent the same starting context.

Knowledge systemSolo consultancy

3 min read

The Client

This one is internal: my own consultancy, where I do tracking and web work for agencies and companies with Claude Code, Codex, Hermes, and opencode. The agents run daily on the same machine, across more than 30 projects.

The Problem

Each agent stored its history in a different format and kept its own memory. A correction I gave one tool never reached the others, and project context had to be explained again in every new session. The history was also fragile: Claude Code’s transcripts only reached back about a month, so a cleanup on the tool’s side could erase the record of how a decision was made.

What I Did

  1. Inventory Found where each agent keeps sessions and memory, and what format they use
  2. Vault and layout Numbered folders for memory, projects, sessions, decisions, and runbooks
  3. Importer Hourly timer, additive only, redacted digests committed to git
  4. Adoption
    • Shared memory Final store that every agent reads and writes
    • Instruction blocks The same short rules in all four agents' configs

One vault, laid out for finding things
The vault is a git repository on the laptop with no remote. Folders are numbered so they sort in the order I use them: inbox, daily notes, shared memory, project cards, session digests, system notes, decisions, runbooks, and a copy of each agent’s config.

An importer that never deletes
A Python script reads the Claude Code and Codex JSONL files and the Hermes and opencode databases, then writes a digest per session with the title, prompts, how it ended, and the files changed. A user timer runs it every hour in about 15 seconds. It only adds and updates, so a session stays in the vault after the agent’s own history is gone.

Redaction before writing
Private key blocks, common API key formats, password and token assignments, bearer tokens, and credentials in URLs are masked before a note is written. I store digests instead of transcripts, which keeps the vault at 4 MB.

Shared memory as the source of truth
I moved 24 Claude Code memories into one shared folder sorted by user, feedback, project, and reference, with an index. The importer skips anything already promoted, so the old store becomes an intake for new notes instead of a second copy that drifts.

Agents that know about it
Each of the four agents got the same short block in its global instructions: read the memory index and project card first, write one note per durable fact, record decisions, and never edit the generated folders or push the vault. I tested each in a fresh session.

The Result

The vault holds 736 session digests from September 22 to November 10 (344 from Claude Code, 378 from Codex, 7 from Hermes, 7 from opencode), 35 daily notes, 28 shared memories, 12 hand-written project cards, 5 decisions, and 2 runbooks. It updates itself every hour and each change is a git commit.

What I Would Change

The first importer rebuilt its folders from scratch on every run, which would have deleted history exactly when I needed it. I made it additive on the first day. Two Codex sessions are still missing from the count, and the redaction is pattern-based, so it is a filter and not a guarantee. There is no copy outside the laptop yet, because the digests describe client work and I want to review them before a remote exists.

The full write-up, with the folder layout and the mistakes, is in One Obsidian Vault for Four AI Agents.

Similar Problem?

I use AI for research, code, and automation every day, with guards on anything that changes something live.

More Work

Next step

Have a project in mind? Let's talk.

Tell me what you have and what you need. I usually reply within one working day with how I'd approach it.

Write to Me

Tell me about your project or idea. I usually reply within one working day.