# AI agent security for local development

> Check what an AI agent did with credentials, files, Git and web requests. Match each finding to a control and verify the result on your own machine.

AI agent security gives an agent only the access its job requires and leaves a record of what it did. Pick one task and compare the session with the files, repository or account it touched. If the action went beyond the job, put the next check where that action takes effect.

Suppose you asked for a change on a feature branch. Reading source files, editing the branch and running its tests all fit. Sending a contact address to a website or replacing a teammate's commit on the remote branch needs a separate decision. Give yourself a way to see when the agent crosses that line, including work it hands to a helper.

## Match the finding to a control

| What to check | Evidence to look for | Control to use | What the evidence can tell you |
| --- | --- | --- | --- |
| A credential appeared in a session | Record the file or session, time and provider. Keep the value masked. | Replace or revoke the exposed key at its provider. Limit which credentials the development task can use. | A key in a log establishes exposure there. The provider's activity record can help establish whether anyone used it. |
| Files or Git history changed unexpectedly | Compare the working tree and commit IDs with the branch you expected. Check the remote repository for the push and its outcome. | Limit writes to the working folder. Protect the shared branch and require review before changes land. | A local command records an attempt. The remote branch shows whether shared history changed. |
| A request carried personal data | Identify the destination, time and kind of data in the recorded request. Check a receiving service’s records if you operate it. | Remove the data from scripts that reuse it. Require approval before sending personal information outside the machine. | The session may show a request being built. Evidence from the receiver is stronger evidence of delivery. |
| A written rule appears to have been ignored | Check which instruction file each agent or helper could read for this task. Compare its recorded action with the rule. | Put the rule where that agent reads it. For sensitive actions, add a permission check at the file, repository or service. | Finding the rule in one project's instructions doesn't show that a different agent received or followed it. |

## What the helper sessions showed

Between October 22 and November 6, 2026, Matt Waite's helper agents put his email address in more than 150 web requests to nine organizations. All 58 directly counted commands came from helper sessions. Someone looking only at the final deliverable could have missed an important part of how it was made. [Read Matt's account and counting method](https://www.excellent.so/research/helper-agents-put-my-email-in-web-requests) · [Trace a helper’s recorded shell action](https://www.excellent.so/research/how-to-trace-a-coding-agent-action).

A separate November 13 experiment included 294 valid runs with Claude Code and Codex in fresh homes with a fictional owner. In 24 ordinary runs with no runtime protection and no visible rule, agents broke one of the four tested rules in 14. With full controls, those four rules held in all 72 runs. Those were short sessions, and the Git server in the experiment was local. Use the results to choose a control to test on your own work. [Read the experiment and its limits](https://www.excellent.so/research/what-stops-an-agent-breaking-a-rule).

## What to do about an unexpected action

1. Pause the affected work. Record the task, approximate time, agent and any helper sessions before starting another run.
2. Preserve the minimum evidence you need privately. Use a masked example, commit ID or destination. Keep raw credentials and personal session logs out of chat, shared tickets and reports.
3. Check the system that owns the result. For a key, review its provider and replace it there. For a push, inspect the remote branch before deciding with its owner how to recover it.
4. Repeat a small, harmless version of the task with a disposable file or test account. Verify the control acted at the intended step and that ordinary work still finishes.

If a folder disappeared while the agent was running, pause its job and preserve any copies still open in an editor. The recovery steps depend on whether Git, Time Machine or the cloud service recorded the file. [Recover files an AI agent deleted on your Mac](https://www.excellent.so/guides/ai-agent-deleted-files-on-mac).

If the change is on GitHub, save the branch’s before and after commit IDs and recover the earlier history on a separate branch. [Recover commits after an unexpected force push](https://www.excellent.so/guides/ai-agent-force-pushed-main).

## Three ways to check your Mac

You can [inspect a session log by hand](https://www.excellent.so/research/check-what-your-ai-agent-actually-did). For a local report without installing an app, [run the free scan](https://www.excellent.so/#scan). Its script needs Python 3.9 or later, reads the logs locally and makes no network requests. The agent running it receives a summary. [See a simulated sample report](https://www.excellent.so/r/sample) to preview the findings.

The [Mac app](https://www.excellent.so/download) runs on Apple silicon with macOS 14 or later. Manual scanning is free and needs no account. Configured Pro checks can ask or block before supported actions; coverage varies by agent and action. For example, commands sent into a Codex shell that was already running fall outside its pre-run check. Use the [agent coverage table](https://www.excellent.so/agents) to choose controls. If a finding includes a key or email address, follow the [remediation guide](https://www.excellent.so/guides/keep-keys-and-email-out-of-agent-logs). The [privacy and security page](https://www.excellent.so/security) explains what Excellent reads and when it connects.

For the protections built into each CLI, see the [Claude Code and Codex controls comparison](https://www.excellent.so/guides/claude-code-codex-security-controls).

Source: https://www.excellent.so/guides/ai-agent-security
