~/msb-manager$docs v0.14.0 github

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#

terminal
$ msbctl

The 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 (say work and personal) 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#

terminal
$ msbctl add myproject

A 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:

  1. Sandbox name: lowercase letters, digits and dashes. It defaults to the folder name.
  2. Repo: detected from the checkout's origin. Give owner/name for 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.
  3. 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.
  4. Git identity and SSH keys: which keys from your host agent this sandbox may use. Nothing is ticked by default.
  5. Features: what the project needs, not raw egress rules. Ticking python brings the PyPI egress group and the toolchain packages. For a GitHub repo, features are pre-ticked from the repo's languages.
  6. Resources and disks: cpus, memory, the root disk size and, for podman, a container disk.
  7. Package caches, extra folders and secrets: all optional.
  8. Image: offered pinned by digest, so a moving tag can't change the sandbox underneath you.
  9. 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:

FileWhatCommitted?
<project>/.msb/sandbox.tomlthe portable policy: egress groups, packages, resourcesyes, if the project folder is the checkout
<project>/.msb/dev.yamlthe image (read by msbctl, never passed to msb)yes, likewise
~/.config/msb/sandboxes/<name>.tomlthe machine-local entry: host path, identity, keys, mountsnever

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:

SettingValue
Repository accessOnly select repositories → this one
ContentsRead and write
Pull requestsRead and write
ActionsRead-only
MetadataRead-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#

terminal
$ msbctl start myproject

The 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#

terminal
$ cd ~/workspaces/myproject
$ msbctl shell

Inside 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:

terminal
$ claude

It'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#

terminal
$ msbctl stop

Stopping 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#