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 4 of 6

Your shell is the agent's shell

builds on: A coding agent is a model in a loop, Untrusted text can steer the agent
Before launching, you give the agent its own worktree and branch, so a `git reset --hard` there can't touch your uncommitted work. Then you check what it would inherit, and swap production for test. Note the limits. Nothing stops the agent from running `cd ..` into your main checkout. And `unset AWS_PROFILE` only hides a variable: `~/.aws/credentials` can still hold a default profile, which AWS tools fall back to in any process you start. Only a container that mounts the project but not your home directory truly removes them.
// Shell
$ git worktree add ../wt-mig -b agent/mig
Preparing worktree (new branch 'agent/mig')
HEAD is now at 3f9c2e1 Add orders migration
$ cd ../wt-mig
$ env | grep -E 'DATABASE|AWS'
DATABASE_URL=postgres://prod-db/app
AWS_PROFILE=prod-admin
$ unset AWS_PROFILE
$ export DATABASE_URL=$TEST_DB_URL
$ agent "fix the failing migration test"
Terms on this card
container
An isolated process environment (e.g. Docker) that sees only the files, network and variables you explicitly give it.
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.
git reset --hard
Moves the branch to another commit and overwrites tracked files in the working directory. Staged changes and edits to tracked files are discarded with no undo. Untracked files are left alone.
unset
Shell command that removes an environment variable from the current shell, so processes started afterwards don't inherit it.
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