msb-kandev

Kandev sandbox hosts: the msbctl kandev verbs the Kandev plugin drives over ssh through host serve --kandev, one JSON document per verb with KandevError codes and exit 3, source = "kandev" registry en

SKILL.md

GitHub

Kandev

Detail carved out of AGENTS.md, which keeps only what has to hold in every session. Repo-specific throughout; the facts here are verified against msb 0.7.6 and re-checked on 0.7.7.

msbctl kandev <verb> (cmd_kandev(), KANDEV_VERBS) is what the Kandev plugin runs over ssh through host serve --kandev (restricted_problem(argv, kandev=True): kandev verbs only, and the everyday key runs none). The plugin key also runs doctor --json, scoped under kandev_key(): host checks in full, registry_checks() over Kandev's entries (and unparsable k- ones) with orphans from the Kandev label, no github-token/secret-store/autostart, and loose secrets files counted, never named (they are <sandbox>.env); test_kandev_key_sees_no_operator_sandbox holds that line. Every verb prints ONE JSON document on stdout (stdout is redirected to stderr meanwhile) and exits 0, or 3 with {"error": {"code", "message"}} where code is one of KANDEV_ERROR_CODES; raise KandevError, and a die() inside becomes unavailable. Off unless [kandev] enabled (kandev_settings() validates the table; allow_extra = [] allows NO extra egress, ["*"] anything). A Kandev sandbox is a registry entry with source = "kandev" (templates/registry-kandev.toml.in, written BEFORE msb create so reap can clean a crash up), named by kandev_name() (k-<env> or k-<24 hex of sha256>), looked up only by kandev_lookup(), which treats any non-Kandev file of that name as absent; name_problem() keeps k- from new operator names. Sandbox loads one (is_kandev, an empty project) so ls/show/shell/exec work; kandev_guard() in main() refuses every other operator verb, ensure_running() never starts one and skips all the per-boot plumbing, and refuse_before_create() refuses to (re)create one. Creation is kandev_provision(), NOT do_create(): no bootstrap, mounts, vsock, profile, identity, git_push, Claude token or GH_TOKEN; --pull never after kandev_pull(), labels msbctl.owner=kandev + kandev.env=, four 127.0.0.1 ports from [kandev] port_pool (kandev_alloc_ports(), under kandev_lock()). Secret values, registry passwords and the agentctl nonce come on stdin (kandev_read_header(), one JSON line, binary after it for agentctl) and go only into one msb process's environment or one msb exec's stdin — tests assert they reach no argv and no file. Registry credentials: a throwaway MSB_CONFIG_PATH copy naming password_env, the value in that one pull's env (spike 16). The Kandev API is pinned by address: resolved host-side, one IP rule, and a guest /etc/hosts line that kandev_pin_api() rewrites on every start because msb regenerates the file at boot (spike 16); DNS rebind protection stays on. kandev reap (systemd user timer from host kandev install) is one pass, not a daemon; it never removes a VM lacking the label or an entry lacking the source. Data path: tailscale serve --set-path=/vm/<name>/p/<port> per port ([kandev] serve), unverified until spike 16's part 5 runs on a real tailnet node.