I've been doing a lot of vibe coding with Claude Code and Codex, and I keep running into the same problem: I ask for one small change, then later discover that the AI modified several files or areas I didn't expect. By then, I can't always remember exactly what changed or when. Is there a reliable way to track AI-generated edits or maintain an activity log beyond ordinary Git usage, or is this simply something we have to accept when using coding agents?
4 Answers
You can add process controls on top of Git: ask the agent to explain its plan and list the files it expects to touch before editing, require approval before changes, and tell it to summarize every modified file when finished. A changelog or decision-record file can help preserve context, but Git remains the authoritative record. For extra safety, use lint rules, tests, protected branches, and pull requests rather than letting the agent commit directly to the main branch.
For larger tasks, I have the agent work on a separate branch or Git worktree. It can make as many changes as it wants there, while my main checkout stays untouched. After reviewing the complete diff and running tests, I either merge the work or delete the worktree.
A worktree is especially useful because the agent cannot modify the directory you’re currently reviewing. It makes accidental changes during inspection much less likely.
Review the staged diff, not just the general working-tree diff. Explicitly stage only the files you intended to change, such as with git add path/to/file, and then inspect git diff --staged before committing. Avoid blindly using git add -A, since unrelated files may get included after your initial review.
Git is usually enough if you use it deliberately. Commit your clean working state before every AI task, keep the task narrowly scoped, then inspect the diff afterward and commit the result separately. I also use a separate branch for agent experiments so nothing reaches the main branch until I’ve reviewed it.
Small, atomic commits make a huge difference. If the agent changes unrelated files, you can immediately discard those changes or identify which prompt caused them.

If the agent repeatedly edits outside the requested scope, that’s often a sign the prompt needs clearer boundaries. Explicitly state which directories it may modify and which ones are read-only.