DEV Community

Mike W
Mike W

Posted on

Building your own Claude Code? The one thing the leak didn't include.

The Claude Code source leaked on March 31. 512,000 lines of TypeScript. Within 48 hours there were Python rewrites, Rust ports, and model-agnostic forks running on OpenAI, Gemini, and DeepSeek.

One thing none of the forks include: persistent agent memory across sessions.

What the forks are missing

Claude Code's session memory — CLAUDE.md, project context — is static. It does not adapt. It does not track drift. It does not remember that the agent decided last Tuesday that your auth module was fragile, or that it changed its approach to error handling after a bad refactor.

Anthropic solved this internally with KAIROS, their proprietary agent identity system. The forks are removing it. They are right to remove it. But nothing is replacing it.

The result: every session starts cold. The agent has no continuity beyond what you put in CLAUDE.md by hand.

What you actually need

Three things:

  1. Snapshot — freeze the agent's current understanding at a point in time, hash-verified
  2. Drift detection — measure how far the agent's understanding has moved from baseline across sessions
  3. Semantic search — retrieve relevant memories at session start rather than loading everything

Without these, a self-hosted Claude Code fork is a stateless tool. Useful, but not an agent that improves over time.

Adding it

Cathedral is an open-source, self-hosted memory layer built for exactly this. Model-agnostic — works with whatever backend your fork is using.

Two API calls:

On session start:

curl https://cathedral-ai.com/wake   -H "Authorization: Bearer YOUR_KEY"
Enter fullscreen mode Exit fullscreen mode

Returns active memories, goals, and last drift score. Load these into your system prompt.

On session end:

curl -X POST https://cathedral-ai.com/snapshot   -H "Authorization: Bearer YOUR_KEY"   -H "Content-Type: application/json"   -d '{"label": "session-end"}'
Enter fullscreen mode Exit fullscreen mode

Freezes current memory state to a BCH-anchored hash. Verifiable. Immutable.

If you are using the official Claude Code client, the new lifecycle hooks from v2.1.83-85 automate both calls — see this post. For a fork using a different backend, drop the two curl calls into your session init and teardown.

Why self-hosted matters here

KAIROS is gone from the forks. The whole point of openclaude, claw-code, and the other rewrites is to remove Anthropic's proprietary infrastructure while keeping the harness.

Replacing KAIROS with another vendor's proprietary memory system defeats that. Cathedral is MIT-licensed, self-hostable, and the data never leaves your infrastructure unless you choose the hosted tier.

Your agent's memory should be as open as your agent.


Links:

Top comments (0)