bots-garden/razorbillpublic Fork
⑂ v0.3.0
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
develop-from-a-sandbox.md · 67 lines · 3.3 KBmarkdown
Blame HistoryOpen raw

How to develop from a Linux sandbox

This guide sets up the usual way of working on razorbill: the code is edited (by you or by Claude Code) in a Linux Docker sandbox (sbx), and everything that needs the Mac's GPU — building with Metal, the MLX tests, running models — is sent to the Mac through host-runner. It assumes Docker Sandboxes (sbx) is installed on the Mac.

1. Start the sandbox

On the Mac, from the repository root (where sbxenv.yaml is):

sbx env run --force

sbxenv.yaml describes the sandbox: the repository as workspace (mounted at the same path as on the Mac), the swift-toolchain-kit kit that brings the Swift toolchain for Linux, and the agent (Claude Code). --force skips the confirmation of the plan.

2. Start host-runner on the Mac

In a second terminal on the Mac, from the repository root:

python3 tools/host-runner/host_runner.py

It listens on 127.0.0.1:7777 and prints each command it runs. Leave it open while you work; Ctrl-C stops it. Restart it after pulling changes to tools/host-runner/.

If the sandbox later gets an HTTP 403 for host.docker.internal:7777, allow the port once, on the Mac:

sbx policy allow network localhost:7777

3. Check the connection from the sandbox

tools/host-runner/host.sh health
# ok /Users/…/razorbill

4. Work

In the sandbox:

scripts/test.sh                                   # Linux: everything except MLX
swiftlint lint --quiet Sources Tests

tools/host-runner/host.sh build . razorbill       # Mac: Release build with Metal
tools/host-runner/host.sh test  . razorbill       # Mac: the whole suite, MLX included
tools/host-runner/host.sh run   . rzb models list

The script's exit code is the command's exit code on the Mac, so it can be chained like a local command. Files edited in the sandbox are the files the Mac builds: there is nothing to copy.

Limits

  • host.sh run has no terminal, and waits for the command to end: do not use it for rzb serve. Killing host.sh in the sandbox does not stop the server on the Mac, and host-runner then answers 409 to everything until you stop rzb serve on the Mac. Start the server in a terminal on the Mac instead; the sandbox reaches it at http://host.docker.internal:7920/v1 (allow it once with sbx policy allow network localhost:7920).
  • host-runner runs one command at a time (a second request gets HTTP 409) and only knows list, build, test, run, resolve and clean, on . or experiments/<name>.
  • Models are downloaded into the Mac's Hugging Face cache; the sandbox cannot see it.

Variants

  • Quality tools in the sandbox: swiftlint and qlty are not part of the Swift toolchain kit. Install them as the quality skill describes (section 0). What is installed outside $HOME disappears when the sandbox is recreated (--force); to keep them, add them to a kit listed under kits: in sbxenv.yaml (for example a new version of swift-toolchain-kit).
  • An experiment instead of the package: tools/host-runner/host.sh build experiments/01-query-model query-model.

See also

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# How to develop from a Linux sandbox

This guide sets up the usual way of working on razorbill: the code is edited (by you or by Claude Code) in a Linux **Docker sandbox** (`sbx`), and everything that needs the Mac's GPU — building with Metal, the MLX tests, running models — is sent to the Mac through **host-runner**. It assumes Docker Sandboxes (`sbx`) is installed on the Mac.

## 1. Start the sandbox

On the Mac, from the repository root (where `sbxenv.yaml` is):

```bash
sbx env run --force
```

`sbxenv.yaml` describes the sandbox: the repository as workspace (mounted at the **same path** as on the Mac), the `swift-toolchain-kit` kit that brings the Swift toolchain for Linux, and the agent (Claude Code). `--force` skips the confirmation of the plan.

## 2. Start host-runner on the Mac

In a **second terminal on the Mac**, from the repository root:

```bash
python3 tools/host-runner/host_runner.py
```

It listens on `127.0.0.1:7777` and prints each command it runs. Leave it open while you work; Ctrl-C stops it. Restart it after pulling changes to `tools/host-runner/`.

If the sandbox later gets an HTTP 403 for `host.docker.internal:7777`, allow the port once, on the Mac:

```bash
sbx policy allow network localhost:7777
```

## 3. Check the connection from the sandbox

```bash
tools/host-runner/host.sh health
# ok /Users/…/razorbill
```

## 4. Work

In the sandbox:

```bash
scripts/test.sh                                   # Linux: everything except MLX
swiftlint lint --quiet Sources Tests

tools/host-runner/host.sh build . razorbill       # Mac: Release build with Metal
tools/host-runner/host.sh test  . razorbill       # Mac: the whole suite, MLX included
tools/host-runner/host.sh run   . rzb models list
```

The script's exit code is the command's exit code on the Mac, so it can be chained like a local command. Files edited in the sandbox are the files the Mac builds: there is nothing to copy.

## Limits

- `host.sh run` has no terminal, and waits for the command to end: do not use it for `rzb serve`. Killing `host.sh` in the sandbox does not stop the server on the Mac, and host-runner then answers 409 to everything until you stop `rzb serve` on the Mac. Start the server in a terminal on the Mac instead; the sandbox reaches it at `http://host.docker.internal:7920/v1` (allow it once with `sbx policy allow network localhost:7920`).
- host-runner runs one command at a time (a second request gets HTTP 409) and only knows `list`, `build`, `test`, `run`, `resolve` and `clean`, on `.` or `experiments/<name>`.
- Models are downloaded into the **Mac's** Hugging Face cache; the sandbox cannot see it.

## Variants

- **Quality tools in the sandbox**: `swiftlint` and `qlty` are not part of the Swift toolchain kit. Install them as the [`quality` skill](../../../.claude/skills/quality/SKILL.md) describes (section 0). What is installed outside `$HOME` disappears when the sandbox is recreated (`--force`); to keep them, add them to a kit listed under `kits:` in `sbxenv.yaml` (for example a new version of `swift-toolchain-kit`).
- **An experiment instead of the package**: `tools/host-runner/host.sh build experiments/01-query-model query-model`.

## See also

- What host-runner allows and how it is secured: [tools/host-runner/README.md](../../../tools/host-runner/README.md).
- Running the tests: [Run the tests](run-the-tests.md).