Last updated 13 October 2026
How to check Claude Code changes before saving
The risk of automatic code edits
You run a prompt and watch the terminal flicker as Claude Code starts editing your files. This is a moment of high tension for any developer. You trust your own logic, but an agent might miss a subtle edge case. It might break a naming convention that it did not see in the current context window. The fear is not just about bugs. It is about the loss of control over your local file system. You need a way to verify every character before the Edit tool finishes its work.
When working with an agent that has the power to run the Bash tool or use the Write tool, you are giving it significant access to your repository. If the agent misinterprets a prompt, it could delete a block of code that took hours to write. This is why understanding the built-in review and permission systems is vital for your workflow. You should treat the agent as a junior developer who needs a thorough code review before their work is written into your active branch.
Control flow with permission modes
The first line of defense is the permission mode system. Claude Code operates in different modes that you can cycle through using Shift+Tab inside a session. The default mode asks for permission before it uses tools that change things, while plan mode focuses on thinking through the steps without execution. If you are worried about sudden writes, staying in default or moving to plan gives you the chance to see what the agent intends to do. This manual gatekeeping ensures that no tool runs without your specific keyboard confirmation.
In the default mode, the agent will describe the tool it wants to use and the parameters it will pass. For example, it might say it wants to use the Edit tool on a specific file. You then have the option to allow the action, deny it, or provide more feedback. This is the most direct way to check changes before they happen. You see the proposed edit in the terminal, and the process stops until you hit the enter key to proceed or the Escape key to cancel. This prevents the agent from entering a bypassPermissions state unless you explicitly allow it.
Reviewing changes with the review command
Once the agent finishes a task, you can use the /review command. This command is designed to show you a summary of the work done during the current session. It provides a way to look back at the logic and the changes applied to the repository. While the agent often shows a diff in the terminal as it works, /review allows for a more contemplative look at the output. You can use this to verify that the Write and Edit tools followed your instructions accurately.
The review process is not just about the code itself but also about the reasoning the agent used. By checking the summary, you can see if the agent understood the architectural constraints of your project. If the review shows that the agent took a shortcut that violates your coding standards, you can immediately issue a follow-up prompt to fix the issue. This command serves as a final checkpoint before you move on to the next task in your backlog or run a claude update to ensure you have the latest features.
Integrating terminal git workflows
Git remains your most powerful tool for verification. Since Claude Code respects .gitignore and operates directly on your local files, you can use the Bash tool to run git commands without leaving the session. You might ask the agent to show you the diff of the changes it just made by typing a prompt for a git diff. Alternatively, you can open a second terminal window to run git commands manually. This gives you a standard colored diff that you are already used to reading, allowing you to catch unintended deletions.
Using git diff outside of the agent interface provides an unbiased view of the file system. Sometimes an agent might think it changed a file in one way, but the actual result on disk is slightly different due to formatting rules. By running a git status or git diff in a separate pane, you can verify the truth of the file system. This practice is especially useful when the agent is performing complex refactoring across multiple directories using the Glob and Grep tools. It ensures that the Task tool actually reached the outcome you expected.
Configuring tool permissions in settings files
For more granular control, you can modify the configuration files. The .claude/settings.json file in your project root or the ~/.claude/settings.json file for your user account contains a permissions section. You can set specific tools like Edit or Write to always ask for permission or even deny them in certain contexts. If you find the agent is too aggressive with file changes, explicit permission settings act as a permanent safety rail. You can also use .claude/settings.local.json to keep these safety settings on your machine without committing them to the shared repository.
Inside the settings.json file, you can define the behavior for each tool. For instance, you might want the Read tool to always be allowed so the agent can gather context freely, but you want the Bash tool to always require a prompt. This fine-tuned control allows you to build a workspace where you are not constantly interrupted for minor actions but remain in full control of any action that could damage the codebase. Customizing these settings is a one-time task that significantly improves the safety of your automated coding sessions without needing to manually toggle modes every time.
Visualizing parallel changes with adhdTerminal
When you are managing several different features at once, the terminal can become crowded. This is where adhdTerminal is the honest answer to your problem. It is a native app for macOS and Windows, made by MINDBALANCER OU in Estonia, and it is not affiliated with Anthropic. It runs many Claude Code sessions side by side, where each one is a tile on a wall. A tile has a colour, a number, and a name. It shows whether it is working, waiting for you, done, or idle. This visual layout helps you keep track of which session is making which changes across your entire project.
Each tile shows the last exchanges of its conversation and can even show numbers and headlines the project publishes. Tiles reopen in the same place after a restart and resume the same session, so you never lose your place. A free iPhone app mirrors the wall over an end to end encrypted link and can answer a prompt or send the next task. It costs 99 dollars once, and one key runs one computer at a time and can be moved. There is a 7 day free trial and no account is required. This setup provides a structured way to handle the high volume of code changes an agent produces while keeping each task isolated.
Handling interruptions and backtracking
If you see a change happening that you do not like, you can stop the agent immediately. Pressing the Escape key once interrupts what the agent is doing, whether it is generating text or executing a tool. If you press Escape twice, the interface offers you a list of earlier messages. This allows you to go back to a point in the conversation before the bad change was made. It is effectively an undo button for the logic of the session.
This backtracking feature is essential when a conversation goes off the rails. Sometimes an agent gets stuck in a loop or starts making changes that are based on a misunderstanding of the requirements. By going back to an earlier message, you can prune the conversation tree and provide a better prompt. This prevents the context window from filling up with incorrect code and confusing the agent further. It is a much faster way to fix mistakes than trying to explain the error to the agent and asking it to revert the files manually using the Write tool.
Managing project instructions via CLAUDE.md
Project-specific instructions in CLAUDE.md can also prevent bad changes from happening in the first place. By placing a CLAUDE.md file in the root of your repo, you provide the agent with a set of rules it must follow. You can explicitly tell it to never delete certain files or to always show a plan before using the Edit tool. The agent reads this file at the start of every session, making it the best place to store your personal preferences for code reviews and safety checks.
You can also have subdirectory-specific instructions by placing additional CLAUDE.md files in those folders. This is useful for large monorepos where different modules have different coding standards or deployment risks. For example, you might have very strict review rules in your core payment processing folder but more relaxed rules in your documentation folder. The agent will respect the instructions in the nearest CLAUDE.md file, ensuring that its behavior is always appropriate for the specific code it is touching. This reduces the need for manual verification on every single tool use.
Visual inspection with the ide command
The /ide command is a helpful shortcut when you need to see the code in a full editor instead of just the terminal. When you run this command, it attempts to open the current project or specific files in your configured integrated development environment. This allows you to use your editor built-in diffing tools and syntax highlighting to review what the agent has done. It is often easier to spot a missing bracket or a logic error in a full-screen editor than in a small terminal window.
Using the /ide command creates a bridge between the command line agent and your primary development tools. While Claude Code is powerful, it does not replace the visual clarity of a modern editor. By jumping into the IDE, you can run your own local tests and use your favorite plugins to verify the agent work. Once you are satisfied with the changes, you can return to the terminal and continue the session. This hybrid approach combines the speed of an agent with the precision of your existing development environment.
Questions people ask
How do I see a diff of my changes before I commit them to git?
You can use the Bash tool to run a git diff command directly inside the Claude Code session. This prints the differences between your working directory and the last commit to the terminal. Reviewing this output ensures you see every line the agent changed before you decide to keep the work.
Can I force the agent to always ask before it edits a file?
Yes, you can cycle through permission modes by pressing Shift+Tab until you are in the default mode. You can also configure specific tool permissions in your .claude/settings.json file. This allows you to require a manual confirmation for the Edit and Write tools while letting other tools run freely.
What should I do if the agent makes a mistake in a large file?
Press Escape twice to open the message history and select a point in the conversation before the mistake happened. This rolls back the state of the session so you can try a different approach or provide more specific instructions. You can then use the /review command or your own IDE to verify that the next attempt is correct.
Read next
- Add build instructions to your CLAUDE.md fileImprove project context by adding specific build commands and environment requirements to your CLAUDE.md file for the AI to follow.
- Add common error fixes to CLAUDE.mdImprove project memory by adding a section for common errors and their fixes to your CLAUDE.md configuration file.
- Add custom shell aliases for Claude CodeSpeed up your workflow by creating shell aliases for common Claude Code invocations and project-specific startup commands.
- Add test commands to a CLAUDE.md fileUnderstand how to define specific test runners and environment flags in your CLAUDE.md file so the tool runs the correct test suite.