Add sessions-ctl and systemd units for the dev box

sessions-ctl creates, starts, stops and lists Claude Code sessions. Each one
is a checkout in ~/sessions/<name>, a state file and a systemd user unit that
runs claude with Remote Control in its own tmux server. Sessions are restarted
if they crash, come back at boot (linger), and resume the same conversation
by a pinned session UUID.

Over SSH it runs as a forced command: only list/repos/status/create/start/
stop/health are accepted, arguments are validated, and nothing reaches a shell
or Claude as a prompt. refresh-access keeps the key's from= restriction in
sync with the IP of reudy.net (hourly timer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
agent 2026-09-30 11:55:38 +00:00
commit 1816f6f863
7 changed files with 754 additions and 0 deletions

25
dev/config.example.toml Normal file
View file

@ -0,0 +1,25 @@
# ~/.config/sessions/config.toml — read by sessions-ctl. chmod 600.
# install.sh copies this file there once and never overwrites it.
# Where session checkouts live (one directory per session).
workspace_root = "~/sessions"
# How many sessions may run at once. Each claude process takes a few hundred
# MB; the unit caps each session at 1.6 GB (MemoryMax). The box has ~4 GB.
max_running = 2
# Remote Control names look like "<prefix>-<session name>" in the Claude app.
remote_control_prefix = "dev-box"
# Repos a session may be created from. The key is what the web app shows and
# sends; the URL never crosses the SSH link. Being on this list is what makes
# a checkout trusted by Claude Code, so only list repos you trust.
[repos]
sessions = "ssh://git@git.reudy.net:14922/reudy-net/sessions.git"
[ssh_access]
# prod's key may only connect from the address(es) this name resolves to.
# Re-resolved hourly by sessions-access-refresh.timer.
allow_from_host = "reudy.net"
# The public half of the key the web app container uses.
public_key = "ssh-ed25519 AAAA… comment"