Sub topic 1
Reviewing an Agent's Multi-File Changes
A coding agent can inspect a repository, edit several files, add tests, and update configuration in one run. This makes the agent useful for connected changes. It also means one incorrect assumption can spread across many files.
Prerequisites
You should know basic Git commands, read code in at least one language, and run a project's tests and checks. You should also have used a coding agent that edits files.
How an Agent Changes Many Files at Once
An agent usually follows a chain:
- It interprets your request and searches the repository.
- It chooses files based on names, imports, tests, and configuration.
- It changes interfaces, implementations, tests, and documentation.
- It runs some checks and reports what it did.
The report is useful context, but it is not proof. The agent may miss untracked files, misunderstand a local convention, or make a behavior change outside the request.
You Own the Diff
Treat every changed line as your responsibility. Check the files and behavior yourself. Trust the agent's summary only as a map for your review.
Look especially for:
- New dependencies or APIs that the project does not already use.
- Changes to error handling, permissions, validation, or defaults.
- Tests that were deleted, weakened, skipped, or marked as expected failures.
- Formatting or refactoring that hides a small behavior change.
- Files unrelated to the requested task.
Scope the Task Before the Run
Define the requested behavior, allowed files or areas, and evidence of completion. For example: “Rename the configuration loader, update its callers and tests, preserve all behavior, and run the loader test suite.” This gives you a boundary for the diff and a concrete verification target.
Start from a Clean Branch
Use a separate branch and record the starting point. A clean working tree lets you distinguish the agent's changes from your own.
git switch -c agent/rename-config-loader
git status --short
git log --oneline -1If git status --short prints existing changes, stop and decide whether to commit, stash, or preserve them before running the agent.
Triage Before Reading Code
First inspect the complete change set:
git status --short
git diff --stat
git diff --name-status
git diff --diff-filter=D --name-onlyThis order reveals untracked files, deleted files, and unexpected scope before implementation details consume your attention.
Exercise
Why inspect git status --short before reading the diff?
Show answer
git diff omits untracked files, so status reveals the complete set of files the agent changed or created.