Get started
This page takes you from a fresh install to an agent running in your first sandbox. It takes about ten minutes, most of which is the first bootstrap.
A word you don't know is probably in the Glossary.
1. First run: the machine-level setup#
$ msbctlThe first time msbctl runs on a machine with nothing configured, it offers a short walk-through. Each step is optional, and msbctl setup returns to any of them later:
- Git identities: the names and emails a sandbox can commit as, and optionally an SSH key to sign with. They're applied inside the guest with
git config --system, so a repo's own identity still wins. - Coding agents: which agents a new sandbox gets ticked: Claude Code, pi, both or none. The steps below that only one agent uses are skipped when no sandbox would get it.
- Claude login: a long-lived token from
claude setup-token, stored in~/.config/msb/secrets/global.env(mode 0600). Sandboxes get a placeholder for it; the real token never enters a VM. You can store several under names (sayworkandpersonal) and pick a default. - Your network: egress groups for your own machines, such as a Git server or a package mirror on your LAN.
- New-sandbox defaults: where projects live, the default cpus and memory, which identity to use.
2. Register a project#
$ msbctl add myprojectA bare name resolves under your workspaces folder (~/workspaces by default), and the folder is created if it's missing. A path that states its location is taken as written: /srv/thing, ~/src/thing, ./thing.
The wizard then asks, in order:
- Sandbox name: lowercase letters, digits and dashes. It defaults to the folder name.
- Repo: detected from the checkout's
origin. Giveowner/namefor GitHub, or the clone URL for any other forge (Codeberg, your own Forgejo). If the folder is empty, it offers to clone the repo into a subfolder. A repo that isn't on GitHub skips every GitHub step below; see Credentials. - Coding agents: ticked from
[defaults] agents. Every later step follows this answer: without Claude Code there's no Claude token step and no token bound; with pi you pick its model endpoints. None is fine. - Git identity and SSH keys: which keys from your host agent this sandbox may use. Nothing is ticked by default.
- Features: what the project needs, not raw egress rules. Ticking
pythonbrings the PyPI egress group and the toolchain packages. For a GitHub repo, features are pre-ticked from the repo's languages. - Resources and disks: cpus, memory, the root disk size and, for podman, a container disk.
- Package caches, extra folders and secrets: all optional.
- Image: offered pinned by digest, so a moving tag can't change the sandbox underneath you.
- GitHub token, for a GitHub repo: a fine-grained PAT for this one repository, read straight into a 0600 file. It's never echoed and never on a command line.
Nothing is started yet. The wizard writes three things:
| File | What | Committed? |
|---|---|---|
<project>/.msb/sandbox.toml | the portable policy: egress groups, packages, resources | yes, if the project folder is the checkout |
<project>/.msb/dev.yaml | the image (read by msbctl, never passed to msb) | yes, likewise |
~/.config/msb/sandboxes/<name>.toml | the machine-local entry: host path, identity, keys, mounts | never |
The GitHub token#
GitHub has no API for creating fine-grained tokens, so this one step is manual, once per project. Create one at https://github.com/settings/personal-access-tokens/new with exactly:
| Setting | Value |
|---|---|
| Repository access | Only select repositories → this one |
| Contents | Read and write |
| Pull requests | Read and write |
| Actions | Read-only |
| Metadata | Read-only (forced) |
Inside the sandbox, GH_TOKEN is a placeholder. The real value is swapped in on the host, in the Authorization header only, for github.com and api.github.com. It's also what git push uses by default. With git_push = "ssh", pushes go through the filtered SSH agent instead (see git push).
3. Start it#
$ msbctl start myprojectThe first start creates the VM and runs the bootstrap inside it, once. That installs the base packages, node, gh, Claude Code and whatever the features asked for. It takes a few minutes. The bootstrap deliberately doesn't stop at the first failure: it reports every step that failed together at the end, so a missing egress rule shows up in one pass rather than one round trip at a time.
Later starts take seconds: the VM keeps its state between stop and start.
4. Work in it#
$ cd ~/workspaces/myproject
$ msbctl shellInside a registered project folder you can leave the sandbox name out (see Everyday use). The shell starts in /work (or the host's own path, if you chose that when registering), which is your project folder, shared from the host. Files the guest writes there belong to you on the host.
Run the agent:
$ claudeIt's already logged in through the placeholder token, already has the central CLAUDE.md, and can push to GitHub through the filtered SSH agent.
5. Stop it#
$ msbctl stopStopping keeps everything: installed packages, the Claude state, your files. An idle running sandbox costs about 300 MB, so leaving a few running is cheap.
Where next#
- Everyday use: the picker,
exec, and the current-folder shortcuts. - Network & egress: what to do when something is refused.
- Credentials & SSH: more tokens, key selection, commit signing.