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
37 lines
2.1 KiB
Markdown
37 lines
2.1 KiB
Markdown
# Contributing to pdtv26
|
|
|
|
The [README](README.md) says what pdtv26 does and why; this is how to work on it.
|
|
|
|
## Development
|
|
|
|
The tools come from the flake. To run every folder's tests, as [CI](.gitea/workflows/check.yaml) should on each push:
|
|
|
|
```
|
|
nix flake check
|
|
```
|
|
|
|
To work in one folder:
|
|
|
|
```
|
|
cd ir-pico
|
|
nix develop
|
|
make help
|
|
make test
|
|
```
|
|
|
|
Each module's docstring says what it is. Docs are only for what isn't code, such as [wiring](ir-pico/wiring.md).
|
|
|
|
## Design
|
|
|
|
### Capabilities on the wire
|
|
|
|
The connections are [Cap'n Web](https://github.com/cloudflare/capnweb) over WebSockets, on a private network such as a Tailscale tailnet. A server listens with a [gate](speech/gate.js), not the capability itself: the gate hands the capability to whoever presents its key, compared in constant time, and a client can open and call in one round trip. Keys reach services through systemd's `LoadCredential` (`$CREDENTIALS_DIRECTORY`), never through argv, the environment, or the Nix store.
|
|
|
|
### 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.
|