Post

I built my AI a brain. Then a jury of AIs tried to break it.

5 July 2026

I know about 5% of Python. One year of college, most of it spent realizing I’d rather talk to people than to compilers. So let’s set expectations: this is the story of a sales guy who spent three months building a roughly 3,900-line memory system he mostly can’t read, by directing a dozen AI models that spent most of that time arguing with each other and, occasionally, with me.

It works now. That’s the ending. The middle is where it gets funny.

The itch

I do most of my work through an AI coding tool that lives in my terminal. It writes the scripts, runs the jobs, fixes the things. Genuinely brilliant, right up until it hits a wall called /compact.

Every AI has a short-term memory that fills up. When it does, it “compacts”: crushes hours of work into a paragraph and throws the rest away. Picture the sharpest colleague you’ve ever had, and every few hours someone taps them on the head and they forget your name, the task, the reasoning, and what comes next.

“Hi! What are we working on?”

The thing you were holding ninety seconds ago, my friend.

So in early April I built the first version. I called it MAX SAVE. It was supposed to be a weekend fix. It became a season.

Chapter one: glorified Ctrl+S with existential dread

Version one was a ritual. Every few hours it tarballed the whole project so I could roll back from “I just broke everything” to “I just broke everything, but slightly less.” Fast enough that I didn’t groan. That was the entire spec.

Then the horror: it saved the files but not why I’d made them. Weeks later I’d open a backup and stare at code like hieroglyphics. The old me had made decisions and left no note.

So I added a Continuity block: it now writes down the hypothesis I was testing, the dead ends, the 2 a.m. idea I abandoned and why. The first time it worked, I felt like a time traveler handing my past self a sticky note: “DON’T DO THAT.”

Chapter two: the tool that forgot itself

Here’s the joke the universe wrote for me. I built a machine to catch my forgetting, and caught it forgetting.

Halfway through a 42-firm data sweep, it saved the files but forgot that half the jobs were still running, and missed the flag that said “I’m working unsupervised right now.” I resumed into a fresh session, blissfully unaware the chaos was ongoing. Same day, fixed.

Then I found it wasn’t backing up the runtime folders, the junk drawer where the temporary files that actually mattered lived, so rebuilds died on missing pieces. Same day, fixed that too.

A tool built to catch my forgetting had nearly gotten away with forgetting itself. The fixes were embarrassingly small. The lesson wasn’t.

Chapter three: the version wars

The version history reads like a confession. v6.5. v6.6. v6.10. Then, somehow, v79, v80, v82. Consolidations, hook rewrites, optimization passes, fix bundles, dozens of “final” versions across April and May. I kept renaming it, re-scoping it, promising myself this was the last one, and it never was.

Around this point it stopped being my habit and became infrastructure: one global command every project could call. And it started plugging into the rest of my setup, the hivemind, a shared shared notebook that every session and every project writes into, so lessons learned in one place don’t die there. MAX SAVE stamps the hivemind’s exact version into every save, so when a session resumes, it knows precisely which version of the collective memory it’s standing on.

Infrastructure attracts critics. That part was still coming.

Chapter four: the rewrite that started the war

By July I’d accepted a hard truth: a text file is a liar. Two windows open at once, and one silently overwrites the other. A crash mid-write leaves half a file. The “latest state” shows up wearing yesterday’s timestamp. My memory system had a memory that misremembered, which is worse than one that forgets.

So I rebuilt the spine. I put a real database underneath, SQLite, the quiet little engine inside your phone, and made it the source of truth. Every checkpoint now lands in one all-or-nothing transaction, append-only, so history can never be overwritten. The human-readable resume file became just a view of the database: delete it and the system re-renders it on the next startup. It heals itself.

Then the piece I’m genuinely proud of, reasoning-forward. When a compact hits, the system reaches into the database, finds the last real save that carried my thinking, and pushes it into the wiped session: the hypothesis, the decisions, the walls we’d already hit. So the AI wakes up knowing what we were doing, and why, and every wall we’d already ruled out. That single feature is the whole difference between an intern and a colleague.

And I gave it a proper long-term memory to sit beside the short-term resume: a durable, searchable session store, my own version of the pattern Google ships in its Agent Development Kit, every session logged into a database with full-text search. So I don’t just resume the last point; I can search three months of my own history and ask, “when did I last touch this, and what did I decide?”

Under the hood it grew a whole cast of obsessive little organs: an event-sourced ledger that records each fact the moment it happens; content-addressed backups that refuse to re-save identical files; atomic writes so a power cut can’t leave a corpse; a self-healing check on every startup; a lock so two saves can’t trample each other; a schema version so future-me can upgrade instead of excavate; and a one-line health probe for when something smells off. About 3,900 lines of it. I can read maybe two hundred.

Chapter five: the night the jury turned up

To make sure it was solid, I did what any responsible non-engineer does. I asked other AIs to destroy it. Not one. A panel.

GPT-5.5. GLM 5.5 Turbo. zai 5.2. Qwen 3.7 Max. Kimi K2.6, then Kimi K2.7. DeepSeek Flash. One after another, all night, each strolling in convinced it had found the fatal flaw. GLM, to its credit, sniffed out real ledger bugs early. The rest were a parade.

Round one: “CRITICAL DATA LOSS.” Fixed. Round two, new model, same headline. Round three: three “CRITICAL” bugs, two already fixed in round one, the third the model misreading its own quote. About fifteen rounds of this in a single night. My favourite was the reviewer that declared four critical data-loss bugs while openly admitting it couldn’t see the code, so it simply guessed. It guessed wrong, four times, with total confidence.

I even brought in Fable. Fable studied the whole thing, nodded thoughtfully, and contributed absolutely nothing the reasoners hadn’t already flagged. Every panel needs the one member who shows up to agree with the room and bill for the hour.

And my own AI? While fixing everyone’s imaginary bugs, it lovingly introduced two real ones, put the newest save below the old one so I’d wake up reading yesterday’s news first, then “fixed” that by cloning the block onto itself. I watched my memory system develop memory problems live, at 2 a.m., in front of me.

Somewhere in there I typed, and I’ll quote myself accurately: “why do I have to babysit you, you should know by now what I want.” A little later, less composed: “why are there STILL bugs? You said you fixed them all hours ago.” Ninety days of patience has a floor, and I found it.

What it actually taught me

Adversarial AI review never returns “zero.” It can’t. Point a model at code and say “find the bugs” and it finds them the way a metal detector finds bottle caps, because the job is finding, and stopping feels like failing. The strongest reviewer I threw at it, a deep-code panel running the heavy models, returned four confident “critical” findings. Every one was false; they’d misread which direction the file was written in. When even your best, most expensive critic finds nothing real, that’s the bell at the end of the fight.

The reviews weren’t useless, early on they caught genuinely nasty things: a real race condition, a silent history-eating overwrite, the ledger corruption GLM found. The skill was never running the reviews. It was knowing when the well is dry, instead of drilling forever because a machine will always, cheerfully, hand you one more “critical.”

Where it landed

Nine tests out of nine, green. Self-healing. It survives crashes, restarts, and the compact that started all of this. I wrote it a real specification, a contract of promises it must never break, so future-me can tell a genuine regression from a reviewer having a bad night. I made it portable, so it runs on any machine instead of only mine. And I put the whole thing online, open-source and free, for anyone else tired of re-introducing themselves to their own AI every morning.

Tokens? I stopped counting around the point where counting became a second job. Hours, no idea. Days, roughly ninety, across some ninety sessions, April to July. Lines of code, about 3,900, of which I understand a proud 5%, exactly matching my one year of college.

Why a sales guy built a database engine

Because an assistant that forgets is a very smart intern you re-onboard every single morning. An assistant that remembers, the work, the reasoning, the dead ends, the why, is a partner. Continuity compounds. Amnesia resets you to zero, forever, politely, with a smile: “Hi! What are we working on?”

I built a machine so my AI would stop treating me like a stranger. It cost me three months, a jury of the world’s best models mostly crying wolf, one model crying nothing at all, my own tool sabotaging itself twice, and more 2 a.m. arguments with a database than I’ll be admitting to my family.

It remembers me now. It remembers the work, the reasoning, and every wall we already hit so we don’t hit it twice. It can search three months of our history in a heartbeat. It wakes up after every memory-wipe and picks up mid-sentence, like it never left.

I can barely read it. It never forgets me. Between the two of us, exactly one has a perfect memory now, and for once, it isn’t the human.

Open-source and free, link in the comments. Bring your own amnesia.


Code: github.com/popescugeorgebogdan-debug/cc-max-save

Comments

Comments are moderated before they appear; your name and message become public.

Send me a message about this post

Private message · lands straight in my inbox.