Assume a breach. If this agent obeys an attacker at this moment, what can it read, what can it change, and where can it send data? Each item below makes that answer smaller.
Do these five items first
- Keep three things apart. Do not give one agent session private data, untrusted content and a way to send data out. If a task needs all three, approve each step or start a new session.
- Turn on the sandbox and make it mandatory. In Claude Code, set
sandbox.enabledandfailIfUnavailabletotrueandallowUnsandboxedCommandstofalse. List each permitted website. Block reads of key folders and.envfiles. Codex has file and network limits by default. - Give the agent its own key. Use a fine-grained access token or a GitHub App for the named repositories only. Do not give the agent your personal token for all repositories.
- Keep production and backups away from the agent. Give it development data only. Do these actions yourself: delete, send, publish, pay and deploy.
- Protect your own sign-in. Use a hardware security key or a passkey for the mailbox, the code host, the password manager and the bank. Put your SSH key on the hardware key, because software cannot copy a secret from it.
Isolation for work that nobody watches
- Add an outer boundary. Run an unattended agent in a small virtual machine (Docker Sandboxes) or in a cloud session, not in your normal shell.
- Do not skip the permission checks. Do not use a flag such as
--dangerously-skip-permissionson a computer that holds keys. - Start the agent in a project folder. Do not start it in the home folder or in the downloads folder.
What the agent installs and loads
- Wait before you install a new package version. Set a waiting period of a minimum of one day:
min-release-agein npm,minimumReleaseAgein pnpm,exclude-newerin uv. - Fix each connector and each skill to one exact version. Scan the agent configuration with Snyk Agent Scan or Cisco MCP Scanner.
- Read the files that steer the agent before you open an unknown repository:
CLAUDE.md,AGENTS.md,.mcp.jsonand the folder.claude/.
Accounts, data and terms of service
- Use an account with commercial terms for client work. On a personal plan, turn off the setting that permits training on your data.
- Do not make public share links for conversations that contain client data. Delete assistant memory that is not necessary.
- Use the path that each service names for agents: its API, its connector or its command-line tool. If a service refuses automated access or shows a CAPTCHA, the agent stops and you decide.
- Keep the agent away from the account that you cannot lose. Give it a separate mailbox and separate accounts. Keep an export of your important data outside the main account.
- Limit browser agents. Permit named websites only. Use a browser profile that has no banking session.
Records and recovery
- Keep a record. Keep the local transcripts longer (
cleanupPeriodDaysin Claude Code). Work on git branches with small commits. - Keep one backup that the keys of the agent cannot delete. Restore it one time as a test.
- Set a spend limit at the AI provider, and add one hook that blocks destructive commands. A hook is a script that the agent software runs at a fixed event.
- Know how to stop. Write down how to cancel each key of the agent. Cancel one key as an exercise.
- Write one page of rules: the data that agents can use, the systems that they must not touch, and the steps to stop and restore.
Evidence and sources: the MHL handbook "Zero Trust for AI Agent Deployment", sections "Single user" and "The three scenarios compared". The sequence of the items is our inference from the causes of incidents and from vendor documentation. No standard gives a set of controls for each size of organisation.