Physically separate the control plane (LLM loop/session/memory/compaction) from the tool executor (shell/file/image/computer) across an authenticated REST boundary, so they can run on two machines. The control plane holds continuity; the executor is replaceable hands that can die and reconnect without amnesia.
what's here #
Auth on the REST boundary
ToolClientHttpServer(executor) gains an optional shared bearer token: every request must presentAuthorization: Bearer <token>or 401. Constant-time comparison (timingSafeEqual).HttpToolClient(control plane) sends the token on/health+/toolscalls. It already degrades gracefully — on an unreachable executor it marks disconnected and returns an error result instead of throwing, so reef dying = lost hands, not death.apps/client(thecoral-executorentry) reads the token via--token-file(agenix) orNIRI_EXECUTOR_TOKEN; warns loudly if unset.- control plane resolves
NIRI_EXECUTOR_TOKEN_FILE/NIRI_EXECUTOR_TOKEN.
NixOS
- new
coral-executorbinary wrapper (apps/client entry). - new
services.coral-executormodule:listenAddress/port/tokenFile/capabilities/hashline, with an assertion that refuses to bind a tokenless executor to a non-loopback address (verified it fails correctly). services.coralgainsexecutorTokenFile→ exposesNIRI_EXECUTOR_TOKEN_FILEto workers.
verification #
npm run typecheckgreen across all packages.- 4 new tests: server accepts/rejects bearer token (missing / wrong scheme / wrong token / correct), client sends the header. All green.
nix flake showevals; module ExecStart + both assertion branches verified vianix eval.
Companion nix-config PR moves the control plane to homura and the executor to reef.