Agents forget by design, so git has to remember
If you run coding agents that forget everything between tasks and you want their rules, results and lessons to survive, this is how I do it with git.
It started when a reader picked out one line from my last post: Drew Breunig’s point that managing what an agent sees has to move out of the model and into the system around it.
Most of mine forget on purpose at the end of each piece of work, and that only works because git remembers it for them. I run them under Rigby, a small supervisor I wrote.
Commit what’s worth keeping before the session ends
A lane starts every unit in a fresh session. That keeps its context small and stops one task’s history leaking into the next.
The cost is that anything the lane learned or decided in that session is gone when it ends.
So the rule is simple: if it’s worth keeping, it has to be in a commit by the time the unit finishes.
So I treat the session as scratch space and the commit as the memory. You can do the same by making a commit part of finishing, for anything you’ll want next time.
That covers what a lane learns. What it works to has to survive too.
Read the rules from main, not the agent’s branch
The rules a lane works to aren’t in its prompt. They’re two small files the project commits: one maps code areas to their rules and tests, and the other holds lessons from past mistakes.
Rigby reads both from the main branch, never from the lane’s own copy.
A lane can’t loosen the rules it’s about to be judged by, even by accident, because its own edits to those files don’t count until they’re reviewed and merged.
To do the same, read your agents’ rules from main, whatever their own branch says.
Rules say what a lane should do, but whether it did is a separate question, and the lane shouldn’t be the one to answer it.
Read “done” from git, not the agent’s message
When a lane finishes, it doesn’t get to describe what it did. The command that closes a unit reads the facts from git: the commit, the branch, the files that changed, and whether anything was left uncommitted.
The supervisor then works out the whole change itself, from where the unit started to the commit the lane reported.
It never takes a commit id, a file list or a verdict from the lane’s message.
That last step matters most. The reviewer’s rules are rebuilt from what the commit actually touched, so a file the head never mentioned still brings its rules with it.
One line in my operating notes sums it up: the mailbox, where agents leave each other messages, is for waking agents, and git is for facts.
So done is a commit, not a message. If you run a supervisor of your own, have it read the commit, the changed files and the uncommitted state from git.
Write a lesson only after a mistake repeats
A review that blocks a unit is worth keeping too. Rigby records which rule broke and where.
If the same rule fails twice in the same area, it’s proposed as a lesson for that area’s future briefs, five at most.
Proposing isn’t the same as adding. The lesson is written into the committed lessons file, and that change goes through review like code does.
Retirement is git as well. A lesson about code that’s been deleted, or about an area that’s had ten commits since without the mistake coming back, drops out on its own.
So I let a mistake earn its place and leave when git says it’s no longer needed. Cap them, because more than five per area stop being read.
Ask git instead of keeping a second record
My first cleanup kept its own records about which copies of the project were safe to remove: holds, claims, a retry ledger.
Each one was a correct fix, and each one was a new place for things to get stuck.
What replaced them is a question git already answers. A copy whose branch is merged into main, with nothing uncommitted, can go. Anything else is listed with the one command that removes it.
Before you add a hold, a claim or a retry ledger to your own cleanup, ask whether git already answers the question.
Once I’d stopped keeping my own records, I started noticing how much other context has none.
Hold your agents’ other context to git’s standard
Running agents this way made something obvious to me. Code is the one part of a company where every change has a record of who made it, when, why, and what it replaced.
The rest of a company’s context mostly doesn’t. The decisions, the reasons behind them and what changed since live in chat threads, documents and people’s heads.
An agent working from that gets whatever someone happened to paste in. Nobody can easily check whether it was current, or which version of a decision it saw.
Ask the table’s five questions of anything you give an agent.
That’s the part I’m working on now. At Neuma, where I’m a founding engineer, we’re building the system of record for a company’s intelligence, the context layer that powers its AI agents, workflows and tools.
How far to trust it
What to copy
If an agent needs to know it, or I’ll need to check it later, it belongs in a system of record, not a session.
For code that system is git, and these are the steps I follow:
- End every unit on a commit. Anything not committed is gone with the session.
- Commit a rules file that maps code areas to their rules and tests, and a lessons file for past mistakes. Read both from main, never from the agent’s own branch.
- Close a unit by reading git: the commit, the branch, the files that changed and whether anything was left uncommitted. Rebuild the whole change from where the unit started, and take no commit id, file list or verdict from the agent’s message.
- Build the reviewer’s rules from the files the commit really touched.
- When a review blocks a unit, record which rule broke and where. Propose a lesson when the same rule fails twice in one area, five per area at most, and review it like code.
- Retire a lesson when its code is gone or ten commits pass without a repeat.
- Remove a finished copy of the project only when its branch is merged into main with nothing uncommitted. List the rest with the one command that removes each.
For code, that system already exists, and it’s git. For everything else a company knows, it’s still being built.
How it works
Rigby does the carrying and the checking, and git holds the facts. I’ve written about handing work over and cleaning up before.