Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Limiting what the agent can break card 3 of 6

Four layers, outermost first

builds on: A coding agent is a model in a loop, Untrusted text can steer the agent
1. **Isolate**: run the agent in a container or VM that mounts only the project, not `~/.ssh` or `~/.aws`. 2. **No production credentials**: give it a test database and scoped, short-lived tokens. 3. **Own branch or worktree**: its resets and commits land on its own copy, not on your uncommitted work or `main`. Only layer 1 stops it from reaching your checkout, and only layer 2 stops it from pushing to the remote. 4. **Approval gates**: require your yes for `rm -rf`, `git push --force`, `git reset --hard`, migrations and deploys. Gates match command text, and `python -c` can do the same damage. Gates back up isolation; they never replace it.
Terms on this card
container
An isolated process environment (e.g. Docker) that sees only the files, network and variables you explicitly give it.
VM
Virtual machine: a whole simulated computer with its own operating system, isolated from your real machine.
worktree
A second working directory for the same git repository, checked out on its own branch. Changes there don't touch your main checkout's files.
main
The repository's primary branch, which everyone builds on.
Approval gates
A setting that makes the agent stop and ask you before running certain commands, instead of running them automatically.
Learn this step by step on Bytewise
Lesson goal: Set up safeguards that bound the damage an agent can do: sandboxes or containers, no production credentials, separate branches or worktrees, and approval gates for destructive commands such as `rm -rf`, `git push --force`, `git reset --hard` and database migrations. Match the agent's permissions to how much you trust the task. · the whole lesson