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
45 lines
2.3 KiB
Desktop File
45 lines
2.3 KiB
Desktop File
# pdtv26-brain: a Claude Code session with the box's channel, confined to its workspace, ~/pdtv26-brain.
|
|
# People talk to it through the box. A systemd user unit; make install (brain/Makefile) puts it in place.
|
|
# Attach: make attach, or @tmux@/bin/tmux -S /run/user/$UID/pdtv26-brain/tmux.sock attach (detach: C-b d)
|
|
|
|
[Unit]
|
|
Description=pdtv26-brain: Claude Code with the box's channel
|
|
|
|
[Service]
|
|
Type=forking
|
|
WorkingDirectory=%h/pdtv26-brain
|
|
Environment=PATH=%h/.local/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin
|
|
Environment=TERM=xterm-256color
|
|
# Its own config, login, and session state, inside its workspace: trust and approvals persist
|
|
# (a bind-mounted ~/.claude.json can't be replaced by rename), and it never sees ~/.claude.
|
|
Environment=CLAUDE_CONFIG_DIR=%h/pdtv26-brain/.config-claude
|
|
RuntimeDirectory=pdtv26-brain
|
|
|
|
# bwrap, not ProtectHome= and friends: with kernel.apparmor_restrict_unprivileged_userns=1
|
|
# the user manager cannot mount, and silently runs the service unconfined.
|
|
#
|
|
# The system is read-only, the Nix store and its own source (@src@) with it; the home directory
|
|
# is empty (--tmpfs %h) but for what's bound back in: its workspace (writable; its config and cache
|
|
# live there), its channel's keys (~/.config/pdtv26-brain: the channel runs inside the sandbox, as
|
|
# Claude's child), and the claude binary. Whatever else lands in the home directory stays hidden.
|
|
# Hiding %t removes the systemd and D-Bus sockets (systemd-run would escape), the ssh and gpg agents,
|
|
# and tmux itself; hiding /tmp removes X.
|
|
ExecStart=@tmux@/bin/tmux -S %t/pdtv26-brain/tmux.sock new-session -d -s pdtv26-brain \
|
|
@bubblewrap@/bin/bwrap --die-with-parent \
|
|
--ro-bind / / --dev /dev --proc /proc --tmpfs /tmp --tmpfs %t \
|
|
--tmpfs %h \
|
|
--bind %h/pdtv26-brain %h/pdtv26-brain \
|
|
--bind %h/pdtv26-brain/.cache %h/.cache \
|
|
--ro-bind %h/.config/pdtv26-brain %h/.config/pdtv26-brain \
|
|
--ro-bind %h/.local/bin/claude %h/.local/bin/claude \
|
|
--ro-bind %h/.local/share/claude %h/.local/share/claude \
|
|
claude -n pdtv26-brain --permission-mode auto --dangerously-load-development-channels server:box
|
|
ExecStop=-@tmux@/bin/tmux -S %t/pdtv26-brain/tmux.sock kill-server
|
|
|
|
# tmux exits 0 when claude exits, so on-failure would never fire.
|
|
Restart=always
|
|
RestartSec=30
|
|
|
|
[Install]
|
|
WantedBy=default.target
|