feat(brain): a sandboxed language model session with an MCP channel to the box

The brain: a long-running Claude Code session, confined with bwrap to
its workspace, that hears the box through a channel and works the TV
with the box's ir and look capabilities.

- brain/channel.js: MCP on stdio to the brain (reply, say, ir_listen,
  ir_send, look, report_problem), and the ask capability, behind a
  gate, to the box
- brain/ask.js: the conversations between them; report.js: an issue on
  one repository, by a token that can do nothing else
- brain/brain.service: the session in tmux, in bwrap: a read-only
  system, an empty home but for its workspace, keys, and claude
- brain/instructions.md: how to work the TV; it imports household.md,
  who's who (an example, with no real people)
- brain/Makefile: make install, attach, status
- checks: brain-js (unit tests), brain (the package, put together)

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-12-02 18:57:08 -06:00
1 parent 190600a696
commit 5cbea49349
16 files changed
+927 -1

No files matched your search

+4
View File
@@ -30,3 +30,7 @@ The connections are [Cap'n Web](https://github.com/cloudflare/capnweb) over WebS
### Confinement
The box's services run under systemd with `ProtectSystem=strict`, `DynamicUser` where possible, `DevicePolicy=closed` and only the devices they need (the GPIO chip and ALSA for the button; the Pico's tty for `ir`), and `IPAddressAllow` limited to the private network, plus the camera's LAN for `look` alone. `look` won't take a frame unless the button service is there to show it: it connects to the button's socket, whose group is look's alone, and waits for the box to flash and tap. [box/module.nix](box/module.nix) has the details.
The brain runs in [bwrap](brain/brain.service): a read-only system, an empty home directory except for its workspace, its channel's keys (read-only), and the claude binary; its own source is in the Nix store, read-only, so it can read how it works. The systemd and D-Bus sockets, the ssh and gpg agents, and X are hidden. The network is not yet confined: it needs its model's API, but today it could also reach the home network.
Its tools are pre-approved by name: `reply`, `say`, `ir_listen`, `ir_send`, `look`, `report_problem`, and `python3 -I`. Nothing in a channel message can approve anything else.