One project.
Two sandboxes.
Give Codex and Claude Code a project folder to edit. Their commands run in separate environments, with limits on the files and network destinations they can reach.
Apple silicon macOS 15 or later
- Supported agents
Codex
Claude Code
- Isolation runtime
- Brig microVMs
- Native terminal
- libghostty
Why sandbox a coding agent?
Ask an agent to run tests, and it may first install a dependency. In your Mac terminal, a faulty setup script could overwrite files in another project.
Brig runs each agent in its own microVM, a small virtual machine on your Mac. Each guest has its own Linux kernel and home directory. Both guests can edit the project folder you share.
- Files and tools
- A setup script can replace a tool inside the guest without replacing the one on your Mac. Mac folders outside the sharing plan stay out of reach.
- Network access
- You choose which hosts guest commands can contact. The policy denies other destinations by default. A permitted host can still receive project data.
- Account access
- The guest gets an access token so the agent can make requests. The credential that renews your provider sign-in stays on your Mac.
How it works
Follow one Codex task inside a Brig microVM. The terminal and project in this walkthrough are simulated.
- auth.openai.com
- chatgpt.com
- api.openai.com
- team/northstar
-
Start Codex
Brig verifies the image and boots a private Linux kernel with four vCPUs and 4 GiB of memory. In the guest shell, you start
codexand typeImplement prd-79. -
Check the destination
Codex looks up a test fixture. The gateway on your Mac checks the hostname against the project’s allowlist. The lookup is denied, so Codex continues with the local fixture.
-
Write to the project
Codex edits a file in the mounted project. The edit appears in the same folder on your Mac. Other Mac folders stay outside the guest’s filesystem.
-
Call the provider
The gateway allows the connection to ChatGPT. Codex uses its guest access token. Tugboat keeps the refresh token on your Mac.
-
Use a brokered credential
The guest policy blocks a direct fetch from GitHub. In a second run, a Git route permits fetching
team/northstar. The guest contactsbrig.internal, where the broker checks the repository and uses the Mac’s credential to fetch it. -
Open a local preview
If you publish a port in Brig, a browser on your Mac can reach the guest’s dev server through localhost. Other guest ports stay closed to incoming connections.
-
Run tests offline
After the chat ends, you restart the guest in offline mode. A guest shell can run the project’s local tests while outbound connections are blocked.
-
Resume the session
The private home survives a stop. Restart the guest with its network policy to resume the saved chat. Removing the sandbox leaves your project edits on your Mac.
- Target
- Rule
- Result
Inside the workspace.
Select a view to explore a sample project.
From folder to first chat.
-
Connect your account.
Sign in with ChatGPT or Claude under Settings → Providers. Use that account across your projects.
-
Choose a folder.
Select Add new project, then choose your agent. Tugboat prepares a separate environment for that agent.
-
Start the conversation.
Select New Chat to work in the terminal. Review Git changes and run project tests in the same environment.
Frequently asked questions
Why does Tugboat use Brig instead of Docker Sandboxes?
Brig puts the network rules outside the agent’s control. A gateway on your Mac filters outgoing packets from the agent and any install script it runs. Tugboat requires a policy that denies connections by default. Brig can allow specific hosts or IP address ranges. If the runtime cannot enforce the policy, Brig refuses to start the sandbox.
Brig’s optional credential broker can keep a key on the host and use it only for an allowed request, down to the HTTP method, path or Git repository. For ChatGPT and Claude sign-in, Tugboat gives the guest an access token and keeps the refresh token on your Mac.
Docker Sandboxes (sbx) also uses microVMs. It enforces network rules through host-side proxies and can add credentials to outgoing requests. Brig lets us inspect the gateway code and the tests that show which connections it allows or blocks.
Brig network policiesBrig credential brokerBrig security testsDocker Sandboxes architecture
Which parts of a chat run on my Mac?
The agent edits files and runs commands inside its sandbox on your Mac. It sends requests to its model provider for responses. Those requests can include code and command output from your project.
What happens to my work when I stop a sandbox?
Your edits are already in the project folder on your Mac. Stopping the sandbox ends that agent’s running processes. Tugboat keeps its guest home and saved chats, so you can resume a conversation later.
Get Tugboat for Mac.
You need an Apple silicon Mac with macOS 15 or later, an account for your agent, and internet access for the first environment download.