AI Agent Safety
AI agents are powerful tools that can read files, edit code, and run commands on your behalf. This makes it important to think about what an AI agent should and should not have access to, and to verify its work before accepting it into your codebase.
Use an Isolated Environment
The most effective safety measure is to run AI agents in an environment that does not contain anything the agent should not have access to. Consider:
- Running your development environment in a virtual machine or container dedicated to AI-assisted work. This limits what the agent can see and do to the contents of that environment.
- Using a separate user account for AI-assisted development, so the agent cannot access files, credentials, or configuration belonging to your primary account.
- Keeping sensitive data such as production databases, customer data, and proprietary secrets outside the development environment where the agent runs.
Secure SSH Keys and Credentials
AI agents can run shell commands, which means they can potentially use any credentials available in the environment. To limit this:
- Do not run an ssh-agent with broadly scoped keys loaded while working with an AI agent. If the agent can run ssh or git commands, it can reach any host those keys grant access to.
- Use SSH keys with narrow access. For example, deploy keys configured for a single repository (VCS-only access, no shell) are safer than personal SSH keys that grant access to many systems. GitHub, GitLab, and similar services support repository-specific deploy keys for this purpose.
- Store credentials (API keys, tokens, database passwords) in a secrets manager or environment that the AI agent cannot access, rather than in files or environment variables in the working directory.
- Review your ~/.ssh/config, ~/.netrc, and similar files to ensure they do not provide the agent with unintended access to remote systems.
Configure Pre-Approval Settings
Wing's Project Properties let you control what Claude Code is pre-approved to do without asking for confirmation. Review these settings to ensure they are consistent with your requirements:
- Preapprove Edits For -- By default, Claude Code may edit files in all project directories under version control. You can restrict this to specific directories or disable pre-approval entirely so that Claude Code must ask before every edit.
- Preapprove Running Commands -- Disabled by default. When enabled, Claude Code may run shell commands without asking. Leave this disabled unless you are working in an isolated environment where unrestricted command execution is acceptable.
- Preapprove Revision Control Commands -- Disabled by default. When enabled, Claude Code may run VCS commands without asking. Consider leaving this disabled so that operations like push require explicit approval.
These settings are described in detail in Configuration.
Add Site-Specific Requirements
Wing comes with built-in instructions that increase AI safety — for example, Claude Code is instructed not to push to remote repositories or perform other destructive VCS operations without first asking for permission. You can add your own site-specific requirements on top of these:
- Add rules to the CLAUDE.md file in your project's top-level directory. Claude Code reads this file at the start of every session and follows the instructions it contains. For example, you might prohibit access to specific directories, require that certain tests pass before any commit, or restrict which external services may be contacted.
- Add rules to your global Claude Code memory (~/.claude/CLAUDE.md) for instructions that should apply across all projects.
- Ask Claude Code about the best options for your particular requirements — it can help you craft effective safety rules for your situation.
Review the Agent's Work
Reviewing AI-generated changes is an essential part of the safety picture. No matter how carefully the environment is configured, the agent can still produce code that is incorrect, insecure, or that does not meet your standards.
- Use Wing's review feature before committing. When Claude Code finishes a task, click the REVIEW button or configure Auto-Start Review in Project Properties to automatically review changes. Wing's diff viewer lets you inspect every change, add comments, revert individual hunks, and approve or request further work before anything is committed. See Reviewing Changes for details.
- Use your team's code review process. In most development environments, AI-generated code should go through the same review process as human-written code — pull requests, code review by teammates, and CI checks. AI tools can assist with code review as well, but human oversight remains important.
- Run tests. Ask the AI agent to write and run unit tests as part of every task. Review the tests themselves to ensure they actually verify the behavior you expect, not just that the code runs without errors.
- Check for security issues. AI-generated code can contain security vulnerabilities just as human-written code can. Pay particular attention to input validation, authentication, authorization, and handling of sensitive data in AI-generated code.
