Skip to content

Commit 6f7e9d5

Browse files
committed
docs: update CLAUDE.md and CONTRIBUTING.md for macOS VM backend
1 parent f07b285 commit 6f7e9d5

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

CLAUDE.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ CI runs e2e tests via `.github/workflows/e2e-linux.yml` and `.github/workflows/e
5555

5656
## Project Structure
5757

58-
- `cmd/sluice/main.go` - CLI entrypoint with flag parsing, runtime selection (--runtime docker|apple|none|auto), and signal handling
58+
- `cmd/sluice/main.go` - CLI entrypoint with flag parsing, runtime selection (--runtime docker|apple|macos|none|auto), and signal handling
5959
- `cmd/sluice/cred.go` - CLI subcommand handler for credential management (add/list/remove with optional policy+binding auto-creation)
6060
- `cmd/sluice/audit.go` - CLI subcommand handler for audit log verification (`audit verify`)
6161
- `cmd/sluice/cert.go` - CLI subcommand handler for CA certificate generation (`cert generate`)
@@ -107,7 +107,7 @@ CI runs e2e tests via `.github/workflows/e2e-linux.yml` and `.github/workflows/e
107107
- `internal/telegram/approval.go` - TelegramChannel implementing channel.Channel interface
108108
- `internal/telegram/bot.go` - Telegram message formatting utilities and token sanitization
109109
- `internal/telegram/commands.go` - Telegram admin commands (/policy, /cred, /status, /audit, /help) backed by SQLite store
110-
- `internal/container/types.go` - ContainerManager interface shared by Docker and Apple Container backends, Runtime enum (Docker=0, Apple=1, None=2), ContainerStatus struct
110+
- `internal/container/types.go` - ContainerManager interface shared by Docker, Apple Container, and macOS VM (tart) backends, Runtime enum (Docker=0, Apple=1, None=2, MacOS=3), ContainerStatus struct
111111
- `internal/container/apple.go` - Apple Container backend: AppleCLI wrapping `container` CLI via os/exec, AppleManager implementing ContainerManager, CA cert injection
112112
- `internal/container/apple_test.go` - Tests for AppleCLI, AppleManager, and CA cert injection with mock CommandRunner
113113
- `internal/container/tart.go` - macOS VM backend: TartCLI wrapping `tart` CLI for Virtualization.framework VMs with Bin() accessor and StartVM() for non-blocking background launch, TartManager implementing ContainerManager with VirtioFS volume sharing, tart-specific CA cert guest path (TartCACertGuestPath = /Volumes/ca/sluice-ca.crt), Keychain-based CA cert injection, and background VM process management via startVM function field
@@ -123,6 +123,7 @@ CI runs e2e tests via `.github/workflows/e2e-linux.yml` and `.github/workflows/e
123123
- `compose.e2e.yml` - Three-container e2e setup (sluice + tun2proxy + test-runner) for Linux integration tests
124124
- `scripts/docker-entrypoint.sh` - Container entrypoint with CA cert generation and copy to shared volume
125125
- `scripts/apple-container-setup.sh` - macOS setup script for Apple Container: pf rules, tun2proxy, IP forwarding
126+
- `scripts/macos-vm-setup.sh` - macOS setup script for tart VM backend: tun2proxy, pf rules, IP forwarding, tart dependency check
126127
- `scripts/setup-vault.sh` - Interactive credential and CA setup script
127128
- `scripts/gen-phantom-env.sh` - Phantom token env file generator for openclaw container
128129
- `examples/config.toml` - Example TOML seed file for initial DB population via `sluice policy import`
@@ -746,31 +747,33 @@ See `compose.yml` in the repo root. Key features:
746747

747748
## Apple Container Support
748749

749-
Apple Container (macOS Virtualization.framework micro-VMs) is supported as an alternative to Docker. It gives native macOS isolation with access to Apple frameworks (EventKit, Messages, CallKit) that are unavailable in Linux containers.
750+
Apple Container (macOS Virtualization.framework micro-VMs) is supported as an alternative to Docker. It runs Linux guests with lightweight hypervisor isolation. Apple Container does NOT provide access to Apple frameworks (iMessage, EventKit, Keychain, Shortcuts). For Apple framework access, use the macOS VM backend (`--runtime macos`).
750751

751752
### Runtime selection
752753

753754
The `--runtime` flag selects the container backend:
754755

755756
| Flag value | Description |
756757
|-----------|-------------|
757-
| `auto` (default) | Auto-detect: checks for `container` CLI (Apple) and Docker socket. Prefers Apple on macOS if both are available. |
758+
| `auto` (default) | Auto-detect: checks for `container` CLI (Apple) and Docker socket. Prefers Apple on macOS if both are available. Never auto-selects `macos`. |
758759
| `docker` | Use Docker backend. Requires Docker socket. |
759-
| `apple` | Use Apple Container backend. Requires macOS and `container` CLI. |
760+
| `apple` | Use Apple Container backend. Requires macOS and `container` CLI. Runs Linux guests. |
761+
| `macos` | Use macOS VM backend via `tart`. Requires macOS with Apple Silicon and `tart` CLI (`brew install cirruslabs/cli/tart`). Runs macOS guests with full Apple framework access. Explicit-only (not auto-detected) because macOS VMs are heavyweight (2-4s boot, 1.5GB+ RAM). Use `--vm-image` to specify the OCI image (must include tart agent). Use `--cert-dir` for CA cert shared volume path. |
760762
| `none` | Standalone mode. No container management. User configures `ALL_PROXY=socks5://localhost:1080` manually. |
761763

762764
### ContainerManager interface
763765

764-
Both Docker and Apple Container backends implement `container.ContainerManager` (defined in `internal/container/types.go`). Telegram commands, MCP injection, and credential management code works with any backend through this interface.
766+
Docker, Apple Container, and macOS VM (tart) backends all implement `container.ContainerManager` (defined in `internal/container/types.go`). Telegram commands, MCP injection, and credential management code works with any backend through this interface.
765767

766768
### Apple Container architecture
767769

768770
```
769771
Apple Container:
770-
OpenClaw micro-VM (bridge100) -> pf route-to -> tun2proxy on host -> SOCKS5 -> sluice on host -> internet
772+
OpenClaw Linux micro-VM (bridge100) -> pf route-to -> tun2proxy on host -> SOCKS5 -> sluice on host -> internet
771773
```
772774

773775
Key differences from Docker:
776+
- Runs Linux guests (not macOS). No Apple framework access.
774777
- `/dev/net/tun` is not supported inside Apple Container guests. tun2proxy runs on the host.
775778
- macOS pf rules redirect VM bridge traffic through the host TUN device.
776779
- VM management via `container` CLI (run, exec, stop, rm, inspect, ls) wrapped by `internal/container/apple.go`.

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ When writing new e2e tests, use the helpers in `e2e/helpers_test.go` (startSluic
4949

5050
### macOS-specific tests
5151

52-
- Apple Container integration tests (`internal/container/`) use mock `CommandRunner` by default and run on all platforms
52+
- Apple Container and macOS VM (tart) integration tests (`internal/container/`) use mock `CommandRunner` by default and run on all platforms
5353
- Full integration tests requiring a real Apple Container runtime are in `e2e/apple_test.go` (see `docs/apple-container-quickstart.md`)
54+
- macOS VM tests require `tart` CLI (`brew install cirruslabs/cli/tart`) and Apple Silicon. Unit tests use mocked `CommandRunner` and run everywhere. E2e tests with a real macOS VM require `tart` installed and a compatible OCI image.
5455

5556
## Commit Messages
5657

@@ -108,7 +109,7 @@ Do not edit `internal/api/api.gen.go` manually. It is regenerated from the spec.
108109
- `internal/channel/http/` -- HTTP webhook channel (HMAC-signed delivery, sync/async approval)
109110
- `internal/telegram/` -- TelegramChannel implementation of channel.Channel interface
110111
- `internal/audit/` -- Append-only JSON lines logger with blake3 hash chaining
111-
- `internal/container/` -- ContainerManager interface, Apple Container backend (CLI wrapper, pf routing, CA cert injection)
112+
- `internal/container/` -- ContainerManager interface, Apple Container backend, macOS VM (tart) backend (CLI wrappers, pf routing, CA cert injection)
112113
- `internal/docker/` -- Docker container backend implementing ContainerManager with hot credential reload
113114
- `cmd/sluice/` -- CLI entrypoint and subcommands (policy, mcp, cred, cert, audit, channel) with `--runtime` flag for backend selection
114115

docs/plans/20260405-macos-vm-backend.md renamed to docs/plans/completed/20260405-macos-vm-backend.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ tart exec openclaw -- security add-trusted-cert \
217217

218218
### Task 8: [Final] Update documentation
219219

220-
- [ ] Update CLAUDE.md: document macOS VM backend, tart CLI, --runtime macos
221-
- [ ] Update CLAUDE.md: correct Apple framework access claims (macOS VM only, not Apple Container)
222-
- [ ] Update CLAUDE.md: add RuntimeMacOS to runtime comparison table
223-
- [ ] Update CONTRIBUTING.md: note tart requirement for macOS VM testing
224-
- [ ] Move this plan to `docs/plans/completed/`
220+
- [x] Update CLAUDE.md: document macOS VM backend, tart CLI, --runtime macos
221+
- [x] Update CLAUDE.md: correct Apple framework access claims (macOS VM only, not Apple Container)
222+
- [x] Update CLAUDE.md: add RuntimeMacOS to runtime comparison table
223+
- [x] Update CONTRIBUTING.md: note tart requirement for macOS VM testing
224+
- [x] Move this plan to `docs/plans/completed/`
225225

226226
## Post-Completion
227227

0 commit comments

Comments
 (0)