DEV Community

Feng Zhang
Feng Zhang

Posted on

I build Memoir - GIT for AI Memory

https://github.com/zhangfengcdt/memoir

AI coding agents are currently built on a "Global Variable" anti-pattern that burns tokens and contaminates context. Memoir is an open-source version control system for agent memory that automatically syncs with your git branches — eliminating "token rent" and ensuring your AI respects your current workflow.

The "global variable" anti-pattern

Most developers work in branches to isolate work. But AI memory is usually global and flat.

The CLAUDE.md trap. Using CLAUDE.md as a permanent memory store is an anti-pattern. It's a giant global variable that grows until it chokes your context window.

The MEMORY.md cache tax. Claude Code's MEMORY.md is even more expensive. Because it's a flat file injected at the top of your prompt, every time the agent "learns" a new fact and updates the file, it invalidates your entire prefix cache.

The vector DB mess. "Auto-memory" uses vector search to find "relevant" text based on vibes. It pulls experimental patterns into your stable production hotfix because they "sound" similar, regardless of what branch you are on.

Memory race conditions

If you run parallel agents or share an agent across a team, it's like multiple threads writing to the same global variable without a mutex. One agent "commits" a new pattern, instantly corrupting the context for everyone else.

We are shipping memory "data corruption" as a feature.

Try it now

Memoir is Apache 2.0 and free forever. It's built for Claude Code first — head to the install guide on the homepage to get set up in a minute.

Top comments (0)