AI Agents4 min read

The Real Fix for AI Commit Cruft Is a Better Habit

Simon Willison's commit-rewriter treats leaked agent chatter as a cosmetic problem, but the fix is upstream discipline, not downstream laundering.

By Curious Technologist Editorial

A tool that rewrites your commit history after the fact is a confession, not a solution. Building commit-rewriter to scrub coding-agent cruft and private issue IDs out of Datasette's security-release commits before publication tells you something more interesting than the tool itself: even a maintainer who has spent years thinking carefully about software supply chains got caught publishing commits he didn't want the world to see, and only noticed after the fact.

The cruft was never a formatting problem

The instinct here is to treat this as a cosmetics issue — commit messages look sloppy, so tidy them up before anyone sees. That undersells what actually happened. Coding agents don't just leave verbose messages; they leave message text describing what they did, which can include reasoning about vulnerabilities, references to internal tracking IDs, and sometimes context about why a fix was scoped the way it was. For a security release specifically, that's not lint, that's the closest thing to a pre-disclosure advisory a repository can accidentally publish. A rewritten history fixes the optics. It does nothing about the fact that the sensitive detail may already have been synced to a mirror, scraped by a bot, or cached by a code-search index in the minutes between push and rewrite.

A tool that cleans up commit messages after publication is solving the version of the problem that's already too late to matter.

Squash-and-clean isn't new, agents just made it mandatory

None of this is conceptually new. Developers have force-pushed over embarrassing commits, squashed "wip" and "fix typo" noise, and rebased away half-finished branches since Git had a rebase command. What's changed is the volume and character of the noise. A human developer writing "wip, fix typo, actually fix it this time" is embarrassing; a coding agent writing three paragraphs per commit explaining its reasoning, occasionally quoting the issue tracker verbatim, is a different order of leak. The rewriting habit that used to be optional hygiene is turning into a mandatory step in the release pipeline for any team using agents on anything that touches security work. That's a real cost, and it's one most teams haven't priced in yet: someone now needs to review agent-authored commit messages the way they'd review agent-authored code, before either goes anywhere near a public remote.

In practice: the cheapest version of this fix has nothing to do with a new tool. It's configuring your agent harness to write terse, templated commit messages in the first place — no chain-of-thought, no issue-ID interpolation from private trackers — and keeping the verbose reasoning in a local log or PR description that never leaves your infrastructure. Rewriting after the fact is a recovery mechanism for when that discipline fails, not a substitute for having it.

Who actually benefits from a rewriting tool existing

The honest answer to who this helps is: solo maintainers and small teams shipping their own security patches, who don't have a release-engineering function to catch this before it goes out. For anyone in that position, a small uvx-installable tool that branches your repo state before rewriting — so you can revert — is a reasonable safety net, and the timestamped-branch behavior is the right default; it means a bad rewrite costs you a few minutes, not a repo. But notice what it doesn't help with: teams with an actual CI/release pipeline, where the fix is a pre-push hook or a commit-message linter, not a post-hoc rewrite tool run by hand. If your organization is regularly finding agent cruft in commits after they're public, the process gap is earlier than the point this tool operates on.

The counter-argument, and where it holds

The strongest case against my position is that perfect upstream discipline is unrealistic, especially for the exact people who benefit most from agentic coding tools — people moving fast, working alone, without a release checklist. For them, a lightweight cleanup pass before a git push --tags is genuinely better than nothing, and expecting them to configure agent harnesses correctly every single time is asking more of hobbyists than the tooling ecosystem currently makes easy. That's fair, and it's the reason a tool like this is worth having rather than dismissing. But "worth having" and "solves the problem" are different claims. A safety net under a tightrope walker is worth having too; it doesn't mean the walker shouldn't also be watching their feet.

What to actually change this week

If you run an agent against a private or embargoed repository, the practical move isn't installing a rewriting tool — it's checking, today, what your harness currently puts in commit messages by default, and whether that default references anything from a private tracker, internal hostname, or pre-disclosure ticket. Most harnesses will let you template commit messages or suppress the verbose trailer entirely; that's a five-minute config change with zero ongoing cost, versus a rewrite-and-hope step bolted onto every release. For most individual developers using agents for personal projects, none of this matters — nobody's auditing your hobby repo's git log for leaked secrets. The exception is exactly the case that prompted this tool: anyone shipping fixes for a vulnerability before it's publicly known, where the commit history itself becomes part of the disclosure surface, whether you intended it to be or not.

Sources & further reading

The analysis above is our own. The underlying reporting and primary documents are credited here.