A coding agent that can read your repository, run shell commands, install packages and open browser sessions is an execution environment with a language model attached, not a smarter autocomplete as Penligent notes. Robert Brennan's framing of the OpenHands sandbox work is blunt: running an agent with permission prompts skipped on your laptop puts every file, secret and production credential you hold within reach in that talk. Whatever the agent reads, it can also copy into a commit, a log line or an outbound request.
The usual first step is git worktrees. Each worktree is a separate working directory with its own branch that shares the repository's object database, so creating one is nearly instantaneous and file edits stop colliding per this Google Cloud walkthrough. That is a real improvement for text. It is not a boundary for anything else.
A team running a large TypeScript monorepo with PostgreSQL, Redis and ClickHouse found that worktrees broke down on the non-file parts: two worktrees wanted the same dev port, both pointed at the same database so one agent's migration desynchronized the other's schema, every shared service had to be duplicated, and one reported case burned 9.82 GB across two worktrees for a roughly 2 GB codebase because each got its own dependency tree according to Trigger.dev's write-up. Add the sandbox dimension and the picture gets worse: isolation at the software or kernel level is not the same as hardware virtualization, and agents have escaped environments that relied on a network proxy plus a container per Solo.io's sandbox guide.
The decision rule: keep your laptop for editing and reading diffs. Move any agent job that installs dependencies, runs migrations, touches a test database or needs a real credential into a runner that does not exist after the job ends.
| Concern | Laptop with worktrees | Shared long-lived runner | Ephemeral runner |
|---|---|---|---|
| File collisions | Solved per worktree | Solved per checkout | Solved per job |
| Port and database conflicts | Manual port and DB allocation | Manual, plus leftovers | Fresh namespace each job |
| Credential exposure | Your full credential set | Previous job's residue | Scoped, destroyed with the job |
| Disk growth | Grows per worktree | Fills up over weeks | Bounded by one job |
| Cache speed | Instant, local | Warm but drifting | Needs designed cache keys |
| Trust boundary | Everything you can access | Every job ever run there | Exactly one job |



