keepcalculator

06 Numbers and Powers

How to Audit AI Agent Actions and Undo Changes

Card No. 06·81246 · Updated · Standard formula, shown below

This guide explains how to review what an AI agent has done on your system, identify unwanted changes, and safely revert them. You’ll learn practical methods for auditing agent activity, using built-in tools and version control, and restoring your system to a previous state. This is essential for anyone using AI agents for automation, file management, or code changes.

What You’ll Need

  • Access to the AI agent’s interface or logs (e.g., terminal history, API logs, or a dashboard).
  • Basic familiarity with your operating system’s file explorer and terminal/command prompt.
  • If the agent works with code: a Git repository or similar version control system.
  • If the agent modifies files: a backup solution (e.g., Time Machine on macOS, File History on Windows, or a cloud backup).
  • For system-wide changes: administrator/root access to your computer.

Step-by-Step

  1. Identify the agent’s scope of work. Before you audit, know what the agent was supposed to do. Was it supposed to edit a specific folder, modify a config file, or send emails? This helps you focus your audit.
  2. Check the agent’s activity log. Most AI agents log their actions. Look for a log file (often in the agent’s installation directory or a dedicated logs folder) or a command history. If you used a CLI agent, check the terminal history (e.g., history command in Linux/macOS, or F7 in Windows Command Prompt). For GUI agents, look for a “History” or “Activity” panel.
  3. Review file changes. If the agent modified files, use your file explorer to sort by “Date Modified” and look for files changed around the time the agent ran. For a more precise audit, use a diff tool. On macOS/Linux, you can use diff in the terminal; on Windows, use fc (file compare). For example: diff original.txt modified.txt shows the differences.
  4. Use version control if available. If the agent worked in a Git repository, run git status to see what files changed, and git diff to see the exact changes. This is the most reliable way to audit and undo changes.
  5. Check for new processes or services. If the agent might have started background tasks, open your Task Manager (Windows) or Activity Monitor (macOS) and look for unfamiliar processes. Note the process names and their start times.
  6. Undo changes using version control. If you have Git, you can revert changes with git checkout -- <file> to discard changes to a specific file, or git revert <commit> to undo a commit. Be careful: git checkout will overwrite your changes, so make sure you don’t need them.
  7. Restore from backup. If the agent deleted or corrupted files, use your backup system. On Windows, right-click the file/folder and select “Restore previous versions.” On macOS, open Time Machine and navigate to a snapshot before the agent ran. For cloud backups, log in and restore the affected files.
  8. Undo system changes. If the agent changed system settings (e.g., registry entries on Windows, or plist files on macOS), you may need to manually revert them. On Windows, you can use System Restore to roll back to a restore point. On macOS, you can use Time Machine to restore the entire system if needed. For specific settings, look up the default value and change it back.
  9. Kill unwanted processes. If you found a suspicious process started by the agent, end it via Task Manager/Activity Monitor. Then, check if it auto-starts at boot (look in Startup apps on Windows, or Login Items on macOS) and disable it.
  10. Test the system. After undoing changes, verify that your files and applications work as expected. Open the files the agent touched, run your main applications, and check that no error messages appear.
  11. Document what happened. Write down what the agent did, what you reverted, and any issues you encountered. This helps you in the future and improves your understanding of the agent’s behavior.
  12. Prevent future issues. Consider giving the agent a restricted environment (e.g., a sandbox or a dedicated user account) and set up automatic backups before running agents.

Common Mistakes

  • Not checking the log first. Diving into file changes without knowing what the agent actually did can waste time and miss hidden changes.
  • Using git checkout without saving current changes. This command permanently discards your uncommitted changes. Always commit or stash first.
  • Restoring the wrong backup. Make sure the backup is from a time before the agent ran, otherwise you might restore the unwanted changes again.
  • Ignoring new processes. An agent might have installed a background service that could cause security issues. Always check for new processes.
  • Forgetting to test after reverting. Undoing changes can break other things. Always test your system thoroughly.

Tips

  • Use a virtual machine or container. Run AI agents in an isolated environment (like Docker or a VM) so that any damage is contained and you can simply discard the container.
  • Set up automatic backups. Schedule regular backups (e.g., daily) so you always have a recent restore point.
  • Create a system restore point manually. On Windows, you can create a restore point before running an agent. On macOS, you can make a local Time Machine snapshot.
  • Use a dedicated user account for agents. This limits the agent’s permissions and makes it easier to track its activity.
  • Keep a copy of the agent’s output. If the agent generates files, save them in a separate folder so you can easily delete them if needed.
  • Read the agent’s documentation. Many agents have built-in undo commands or safety features. Know them before you run the agent.

Troubleshooting

What if the agent’s log is missing or incomplete? Check if the agent stores logs in a different location (e.g., in the user’s home directory under .agent_logs). If not, you can rely on file modification times and system event logs. On Windows, use Event Viewer to see system changes; on macOS, use the Console app.

What if I can’t undo a change because I don’t know what the original value was? Look for configuration files that may have backups (e.g., .bak files). If not, search online for the default value of that setting. For code, use the repository’s history to see the previous version.

What if the agent deleted files that are not in my backup? If you have a cloud backup, check if the files are in the trash or recycle bin. Some cloud services keep deleted files for a limited time. If not, you may need to use file recovery software, but this is not always successful.

What if the agent changed system settings that I can’t revert manually? Use System Restore (Windows) or Time Machine (macOS) to roll back to a point before the agent ran. This should revert system settings. If that fails, you might need to reinstall the affected application or the OS.

What if the agent is still running and making changes? Immediately terminate the agent process. On Windows, use Task Manager; on macOS, use Activity Monitor. Then, disconnect from the network if the agent is cloud-based, and review its recent activity.

What if I accidentally revert a change that was actually good? If you used Git, you can recover the reverted commit with git reflog and git cherry-pick. For file changes, check your backup or the agent’s log to see what the change was and reapply it manually.

Frequently Asked Questions

Q: Can I undo all changes an AI agent made automatically? A: Not usually. Some agents have a built-in “undo” command, but it’s not universal. The safest method is to use version control or a system restore point before running the agent.

Q: How do I know if an AI agent made a change without a log? A: Check file modification times, look for new files or folders, and review system event logs. If you suspect a change, you can compare the current state with a known-good backup.

Q: Is it safe to use System Restore to undo agent changes? A: Yes, System Restore is generally safe. It reverts system files and settings, but it does not affect your personal files. However, it may remove recently installed programs, so use it with caution.

Q: What if the agent modified a file that I need to keep? A: If you have a backup, restore it. If not, you can try to manually edit the file back to its original state using the agent’s log or your memory. For code, use version control to revert the specific changes.

Q: Can I prevent an AI agent from making unwanted changes in the future? A: Yes, by running the agent in a sandboxed environment, giving it limited permissions, and setting up automatic backups. Also, review the agent’s configuration to disable any features that modify system settings.

Q: What is the best way to audit an AI agent that works with cloud services? A: Check the service’s activity log (e.g., AWS CloudTrail, Google Cloud Audit Logs). These logs record API calls made by the agent, allowing you to see exactly what it did and potentially revert changes via the service’s API.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →