Claude Code and Codex CLI can read and write files and run shell commands. Both can ask before they do, and both have settings to allow or deny specific actions. The question is what to put where.
A three-level policy
| Level | Examples |
|---|---|
| Allow without asking | Read files in the repository; run the test and lint commands; git status and git diff |
| Ask each time | Install packages; write outside the repository; use the network; git commit; git push |
| Deny | Read secret files; rm -rf on broad paths; force-push; changing deploy or CI credentials |
Principles
- Start strict, relax with evidence. Allow a command after you have seen it used safely a few times.
- Prefer narrow rules. Allow
npm testrather than all ofnpm. - Separate the environment. Work in a development environment with development keys, not on a machine with production access.
- Keep the acceptance step with a person. An agent should not be able to approve its own work.
Review the settings
Settings files can be shared in the repository. Treat them like code: review changes, and read them again when someone joins.
Related: prompt injection in coding agents and keeping secrets out of context.