Shipping Software with Git + Claude Code · step 3 of 5 draft

Write history for the next reader

Agent sessions don’t share memory. What they share is the repo, and git log is the one channel where a past session can talk to a future one. A commit message that says why is context the next agent (or you, in three weeks) gets for free; a message that says “fix” is a hole where an explanation should be.

You’ve met this before. “Commit messages are documentation” and digging through git blame are ancient craft. The agent twist doubles the audience and the authorship: messages are now written by agents and read by agents, so their quality directly sets how much context a fresh session starts with.

The habits

Try it

TRY IT The weird retry loop

you

There's a bizarre retry loop in the uploader: it sleeps random amounts and retries even on success. Clean it up.

agent

It does look wrong: un-idiomatic, seemingly redundant. The question is whether it's a mistake or a survivor.

Pick the agent's next move, then see where it leads:

you

Uploads started failing around midnight, every night. That's new. Or... old?

agent

Old. git log on the file: commit 8f3d2a1, two years ago. "Retry-after-success works around CDN edge cache serving stale 200s; do NOT simplify, see incident #142." The weirdness was the fix. The explanation was one git log away, and I deleted the fix without reading it.

the baseline

Blame-blind cleanup: the code looked wrong because the constraint it handled was invisible, but not undocumented. History held the answer; the resurrection of incident #142 was entirely self-inflicted.

agent

Found it. 8f3d2a1: the retry-after-success works around a CDN serving stale 200s, tied to incident #142. So the real question isn't "how do I clean this" but "is that CDN behavior still live?" I can test that: staged an upload through the CDN path. The stale-200 behavior is still there. The loop stays; I'll add a comment pointing at the commit so the next reader doesn't need the dig.

you

So the cleanup is a comment. Cheap.

correct

Two minutes of reading turned "clean up this mess" into the actual task: verify whether the constraint still holds (it does), keep the fix, and leave the trail one hop shorter for the next reader. AF-02

you

No idea. That code's two years old. Maybe Dana wrote it? I'd guess it's safe to simplify.

agent

Proceeding on your guess, then, which is worse evidence than what the repo already holds. The commit that introduced this loop explains it precisely; I asked a human to remember what the history had already written down.

plausible but wrong

Asking beats blind editing, but it outsources to fallible memory what git log answers verbatim. History is the channel past sessions (and past humans) left for exactly this moment; read it before spending anyone's recall.

Do it by hand

Two prompts to start using today: “before you touch that module, read its git log and blame the function you’re changing; tell me what you learned”, and “rewrite that commit message: first line what, body why, plus what you verified.”

Or paste this into Claude

Standing rules for this repo's history. (1) Before editing any file
you haven't read in this session, check git log --oneline -15 -- <file>
and blame the region you're changing; if the history explains something
surprising, say so before proceeding. (2) Every commit message: first
line states the change in plain words; body states why, and what was
verified (the actual command or probe, not "it works"). (3) Keep your
co-author trailer on. Add these to CLAUDE.md under "git agreements".
Show me the diff first.

Watch out