Intent-Based Rollback for AI-Generated Code
When an AI-generated change breaks production, the question is usually not 'which hash?' It is 'undo the OAuth retry change' or 'revert the agent's billing refactor.'
Rollback is easy when you know the exact commit. It is harder when an AI agent made several related commits, used vague messages, or touched files outside the obvious failure area. During an incident, teams think in intent: undo the caching change, revert the payment retry behavior, remove the migration helper.
Intent-based rollback connects that human description to recorded AI provenance. Instead of searching only commit messages and diffs, it can search prompts, decisions, and context records attached to commits.
Why AI changes make rollback harder
AI-generated work often arrives as a coherent patch across multiple files. The commit message may be short. The important clue may live in the original prompt: "make login retries more aggressive" or "simplify billing plan sync". If that prompt is not stored, responders are left with hashes and guesses.
What intent-based rollback needs
To roll back by intent, the repository needs durable records that map commits to tasks. At minimum, store the prompt or task summary with each AI-assisted commit. Better records include agent identity, changed files, test evidence, and decisions.
With h5i, h5i capture commit records that provenance. h5i rollback accepts a natural-language intent and searches recent AI-generated commits for the best match. Its help text describes the command as: revert the AI-generated commit whose intent best matches a description.
$ h5i rollback "OAuth login retry change" --dry-run $ h5i rollback "OAuth login retry change" --yes
Why not just use git revert?
You still use Git semantics for the actual revert. Intent-based rollback helps find the right commit. Once the target is identified, the rollback should be reviewable like any other change.
Best practices
- Capture task prompts for every AI-assisted commit.
- Use specific commit messages, but do not rely on messages alone.
- Keep unrelated agent edits out of the same commit.
- Record decisions when the agent chooses between approaches.
- Use
--dry-runbefore applying a rollback during triage.
FAQ
Does intent-based rollback replace incident review?
No. It speeds up target selection. Humans still need to verify the revert and run the appropriate tests.
What makes rollback accurate?
Specific provenance. Prompts, task summaries, decisions, and changed-file metadata give the rollback search better evidence than commit messages alone.
Can this work on old commits?
Only if enough provenance was captured for those commits. That is the reason to record intent at commit time.
Sources and verification
This article avoids vendor-specific claims that were not checked against primary docs or local h5i CLI behavior.
Bring AI provenance into Git
h5i records prompts, context, test evidence, review signals, and agent messages alongside normal Git history.
Star on GitHub Read the guides