Understudy moves your work to a standby Sprite when your Fly.io Sprite stops answering.
It saves each Sprite's files to your Box folder every 30 seconds and keeps a standby Sprite asleep. When the first Sprite freezes, Understudy restores your files, packages, services and Claude Code session onto the standby and tells your phone. It's a personal agent that runs on its own Sprite. It never copies your login keys and never deletes your Sprites.
Demo film · Live demo · Field trials
When a Sprite freezes, everything inside it is stuck with it: unpushed commits, installed tools, running services and the coding agent's conversation. Its checkpoints are stuck too, because they belong to that one Sprite and hang when its API calls hang.
- Sprites becoming non-responsive after usage ("I also cannot create a new checkpoint")
- Unreachable sprite hangs indefinitely ("restore hangs, exec hangs, proxy hangs")
- Sprite with actual work unresponsive, even checkpoints ("This happens quite often btw")
sequenceDiagram
participant H as Helper on mason
participant K as Keeper
participant J as Jev (TypeSafe)
participant B as Box
participant U as mason-understudy
participant P as Your phone
H->>B: changed files, every 30 s
H->>K: heartbeat every 10 s (stops, or "disk writes stalled")
K->>K: two exec probes fail, 15 s apart
K->>J: frozen, busy, asleep or platform trouble?
J-->>K: frozen 96%
K->>K: fixed thresholds and vetoes in code
K->>U: wake, restore saves, packages, services, sessions
K->>P: "mason froze. You're on mason-understudy."
- You pick a Sprite to watch. Understudy installs a small helper service on it, saves its files to Box and builds a standby Sprite with the same packages and labels. Then the standby goes to sleep.
- While you work, the helper uploads changed files every 30 seconds, sends a signed heartbeat every 10 seconds and times a disk write every 5 seconds.
- When heartbeats stop or the disk stops finishing writes, the keeper probes the Sprite from outside. After two failed exec probes 15 seconds apart, it asks TypeSafe's Jev model whether the Sprite is frozen, busy, asleep or hit by platform trouble. Fixed thresholds in code decide, and hard vetoes in code overrule Jev.
- Understudy steps in. It wakes the standby, restores the latest save and checks every file's SHA-256, reinstalls packages, recreates services and puts your Claude Code and Codex sessions back. Then it checkpoints the new Sprite.
- Your phone buzzes through Pushover, and a support report in the format the Fly forum
asks for waits on the board. You decide whether to post it. The frozen Sprite gets one
last checkpoint and an
understudy-frozenlabel, and is otherwise left alone for Fly support.
Rehearsals restore your saves into a throwaway understudy-drill-* Sprite on a schedule
and then delete it, so you find out the saves work before you need them.
| Capability | Sprites feature or connector | Code |
|---|---|---|
| Runs the keeper and its board | Sprite Service keeper on port 8080, public Sprite URL with its own sign-in |
cmd/keeper, internal/web, scripts/install-keeper.sh |
| Runs the helper on each watched Sprite | Sprite Service understudy, installed through the filesystem API |
cmd/helper, internal/keeper/watch.go |
| Probing, building standbys, stepping in | Sprites API (exec, services, labels, checkpoints), called directly by the keeper with a Sprites token, because Fly refuses a connector pointing at its own API | internal/sprites, internal/gateway |
| Saves and restores | Box connector | internal/box, internal/pack, internal/restore |
| Frozen or busy? | TypeSafe connector (Jev) | internal/jev, internal/decide |
| The support report | Ollama Cloud connector | internal/ollama, internal/report |
| Telling you | Pushover connector | internal/pushover |
| Posting the report, only on your click | Discourse connector (optional) | internal/discourse |
| Staying awake only while needed | Tasks API on /.sprite/api.sock |
internal/tasks, internal/keeper/hold.go |
| Undo after a step-in | Checkpoints | internal/sprites/ops.go |
| Which Sprite may call which connector | Labels on Sprites, access policies on connectors | scripts/setup-connectors.sh, docs/connectors.md |
Live runs on 2026-11-30, on Sprites labelled understudy-demo, in an org on Fly.io's
Free plan. Full details are in docs/field-trials.md.
| Run | Result |
|---|---|
| Step in now, pressed by hand | 12 of 12 steps. 202 files restored, every SHA-256 matched. 99 s from start to finish, including the report and watching the new Sprite. |
| Simulated freeze, automatic step-in | Jev said frozen 96 % (busy 4 %) in 412 ms and the vetoes passed. Step-in took 145 s: 247 files, every SHA-256 matched, with the last commit, an uncommitted edit and the Claude session file on the standby. |
| Rehearsal into a drill Sprite | Restored in 55 s and deleted the drill. |
What went wrong:
- Detection took 139 s against a 45 s target. Two probe rounds were held back as "platform trouble" because the keeper's own API check paged through every Sprite while the API was slow. The check is now one request.
- In the automatic run, the last step, watching the new Sprite, was skipped because the Sprite had dozed off after its restore. It now retries. The watch was finished by hand.
- The rehearsal reported 2 git differences that were a false alarm, from comparing against an environment record older than the save. Fixed the same night.
- The automatic run's report came from the template, because Ollama drafting needs paid credits.
- A real "running but hung" freeze didn't reproduce on demand. The forum recipe and a
256 MB memory limit both ended in a restart, and Understudy correctly moved nothing. So
the automatic run uses a labelled simulation: the helper is really paused, the API
really says
running, and only the keeper's exec and checkpoint probes for that Sprite are made to time out. Every record from it says "simulated freeze". - Each run happened once. Busy-load trials, sleep trials, larger rehearsals and a repeat of the automatic run for a median are listed in the field trials and haven't run yet.
Watch the 2-minute film on YouTube. The live board shows the demo Sprites read-only, and the keeper's landing page explains the flow.
You need:
- the
spriteCLI, signed in withsprite login, andjq - a Box account, a TypeSafe API key, an Ollama API key and a Pushover application token plus your user key. Ollama drafting needs paid credits. Without them, reports come from the template.
- a Sprites token for your org (Fly dashboard, your org, Sprites, Tokens), saved as
sprites-token.txt - room for two Sprites per watched Sprite (it and its standby) plus the keeper
- this repo cloned, with
.envcopied from .env.example and the threeUNDERSTUDY_SETUP_*keys filled in
From the repo root:
scripts/setup-connectors.sh # TypeSafe, Ollama and Pushover, then a Box sign-in link
scripts/setup-connectors.sh --policies # after you approve Box in the browser
sprite create understudy-keeper --label understudy-keeper --label understudy-box --skip-console
sprite exec -s understudy-keeper --stdin -- bash -c 'umask 077; mkdir -p ~/.understudy && cat > ~/.understudy/sprites.token' < sprites-token.txt
sprite exec -s understudy-keeper -- bash -c "curl -fsSL https://raw.githubusercontent.com/winsznx/understudy/main/scripts/install-keeper.sh | bash"setup-connectors.sh reads the keys from .env, hands them to the sprite CLI on stdin
and prints only connector names, IDs and HTTP statuses. The token goes on the keeper
before the install, because the keeper reads it when it starts. The install script
builds the keeper, helper and CLI from source on the keeper Sprite, checks the Go
download against go.dev's published SHA-256, makes the keeper's URL public and prints a
one-time sign-in link. Open it, enter your
Pushover user key on the setup page, then press Watch a Sprite.
Every setting is in .env.example with its default and where the value
comes from. The keeper reads its settings from the environment, and the Sprites token
from ~/.understudy/sprites.token unless UNDERSTUDY_SPRITES_TOKEN is set. Connector
IDs are discovered from the gateway, and the UNDERSTUDY_CONN_* variables pin a
specific connection.
docs/architecture.md covers the keeper, the helper and the standby, the decision rules, the save format and the step-in state machine. docs/connectors.md covers each connector and its access policy.
- Never copied:
~/.ssh/,~/.aws/,~/.claude/.credentials.json,~/.codex/auth.json, other agents' credential files,.envfiles, keys and more. Every other file up to 5 MiB is scanned for secrets before upload, and Claude transcripts are saved with secrets removed. - Box, TypeSafe, Ollama Cloud and Pushover keys live in Sprites connectors, never in a Sprite. The keeper alone holds a Sprites token, in a 0600 file.
- The only Sprites Understudy deletes are its own
understudy-drill-*rehearsal Sprites. The check runs in code before any request is sent.
The threat model and what each service receives are in docs/security.md. To report a vulnerability, see SECURITY.md.
- Edits made in the last 30 seconds before a freeze can be lost.
- Running processes and memory don't move. Services restart and agent sessions resume from their files.
- Login keys are never copied, so you sign in to Claude (or Codex) once on the new Sprite.
- A Sprite that freezes within about 10 seconds of waking, before its first heartbeat, is noticed when you next open the board.
- When the Sprites API itself is down, Understudy waits instead of moving anything.
- The Box connector can't delete files, so old saves stay in Box. Retention tells you once which folders you can delete yourself.
- Files over 5 MiB are saved without a secret scan.
- Automatic step-in has been run on a simulated freeze only, and each trial has run once.
understudy simulate-freezeworks only on Sprites labelledunderstudy-demo.
Bug reports and pull requests are welcome. CONTRIBUTING.md has the build, the checks CI runs and the rules for anything that touches a real Sprite. This project follows the Contributor Covenant.
Built with Go 1.27 (toolchain go1.27.4), modernc.org/sqlite, fsnotify, klauspost/compress (zstd), goldmark and bluemonday.