All courses

Setting safety boundaries for a session

Choose the boundaries for a given task: the folder, permission level, network access, credentials in reach, and whether it runs in a sandbox. Base the choice on what the worst plausible mistake or injection could damage.

Builds on: Keeping secrets out of the agent's reach, Catching destructive commands, Unknown and invented packages, Untrusted text steering the agent, Sandboxes and isolated environments

Read it card by card Start the whole course

Same agent, two very different tasks

Two tasks today. One: fix a wrong date format in `scripts/report.py`. Two: read the 20 newest issues on your project's public issue tracker and draft fixes. Your laptop also holds a `.env` with a live database password, your cloud logins and your SSH keys. Should both tasks run with the same folder, permissions and access? If not, what decides the difference?

Size the fence to the worst plausible outcome

A session can go wrong in two ways. The agent makes a mistake, such as running a wrong command or editing the wrong files. Or untrusted text steers it (injection). What gets damaged depends on what is in reach and what the agent may do without asking. You control five dials: starting folder, credentials in reach, network access, permission level, and sandbox or not. Set them for each task, sized to its worst case, not the likely case.

The boundary checklist

First ask: what is the worst plausible mistake? What is the worst thing injected text could make it do? Then set: 1. **Folder**: the project root, fully committed. Never your home folder. 2. **Credentials**: none unless the task needs them. If it does, a test key. 3. **Network**: untrusted text + private data + network is dangerous. Remove one. 4. **Permissions**: auto-approve only what git can undo, such as edits to committed files in the project. 5. **Sandbox**: required before you grant broad autonomy.

Walking through the issue task

For the issues task, the worst case is an issue that says "run this setup command" or "post your config to this URL". Untrusted input, your `.env` and network access together make the dangerous combination. So run it in a sandbox on a fresh copy of the repository, which has no `.env` because that file isn't committed. Give it no real credentials and keep approval on for every command. Limit the network if your tool allows it. The date fix reads no outside text, so its worst case is a bad edit that git can undo. The project folder is enough, with `.env` denied, edits auto-approved and commands asked.

A boundary note before you start

Write a few lines like these before each session. Same tool, very different settings, because the worst cases differ.
# Task A: fix date format in report.py
Worst case:  garbled files (git can undo)
Folder:      project root, committed
Credentials: none; .env denied
Network:     not needed
Permissions: edits auto, commands ask
Sandbox:     optional

# Task B: draft fixes from public issues
Worst case:  injected text leaks secrets
Folder:      fresh copy of the repository
Credentials: none at all
Network:     only the issue site, if allowed
Permissions: ask before every command
Sandbox:     required

What to remember

Before each session, ask what the worst plausible mistake or injection could damage. Then shrink the folder, credentials, network and permissions until that worst case only hits things you can undo with git or throw away with the sandbox.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.