Three cleanups before pushing an AI-assisted repo to a client
Agent handoff files I nearly committed, infrastructure docs I deleted, and env vars I almost stripped by mistake.
I was working on the compliance backend for a financial-education AI assistant. Weeks of agent-assisted work had piled up without a push. Before I could even think about pushing to the client’s remote, the repo needed cleanup. Three things bit me.
Three agent files, untracked but unignored
CLAUDE.md, GEMINI.md and AGENT-HANDOFF.md all sat in the working tree. All three held my own notes: vault paths, internal reasoning, half-finished plans for conversations with the main dev team. None of it belonged in the client’s remote.
They were untracked, which felt safe. It is not. Untracked only means git has not started tracking them. One git add -A from me, one habit from a tool, and they are in the next commit. I added all three to .gitignore before anything else.
The lesson: agent handoff files are internal to the operator, like a .env. Treat them that way from day one, before Claude or any other agent writes the first byte.
Four infrastructure docs, all half-stale
DEVELOPER_HANDOVER.md, INFRASTRUCTURE.md, INFRASTRUCTURE_CHANGES.md and docs/infrastructure_brainmap.md had all accumulated over months of agent sessions. Each had been the single source of truth at some point. None were current. All four contradicted each other on small things that matter when a new dev opens the repo for the first time.
I deleted all four and kept two canonical overviews: README.md for anyone opening the repo, MASTER_EXPLAINER.md for the full architecture. Any future “infrastructure” writing goes into one of those two or does not exist. Agents are very happy to write a new doc. Having a rule that there are only two keeps it manageable.
The SMTP env vars I almost stripped
I had disconnected the email-verification routes earlier that week. The feature was moving to the second server, run by the main dev team. My first instinct was to delete the SMTP_* lines from env.template, since the feature using them was gone.
A quick grep across the service for SMTP_ turned up notificationService.ts, which uses the same credentials to send compliance alerts to admins. If I had stripped the vars, those alerts would have silently failed in production, and nobody would notice until something went wrong on the compliance side, which is exactly when you want the alerts.
I left the vars alone and rewrote the misleading comment in env.template that said these were only for email verification.
Numbers
4 docs deleted. 3 agent files added to .gitignore. 2 canonical overviews kept. 2 of 3 pre-existing gate failures fixed on the way through.
What I would steal
The .gitignore line for agent files goes into every new repo on day one, before any agent runs:
CLAUDE.md
GEMINI.md
AGENT-HANDOFF.md
Add any others your tooling writes. The rule is: if an agent writes a file for you, assume it will try to commit that file for you, too.
The SMTP point generalises. When you remove a feature, grep the entire codebase for the env vars it touched before stripping anything. The second caller is always the one you forgot about, and it is always the one that notices failures loudest.