Telemetry and the ledgers¶
The Desk needs only fibers and tmux. Channels, session history, and board marks need a record of what happened, and that record is three append-only JSONL files in the daemon's state directory.
| File | Written by | Carries |
|---|---|---|
~/.shuttle/events.jsonl |
shuttle hook event, from your agent harness (the coding-agent CLI you're running — Claude Code, Codex, …) |
one line per harness hook event |
~/.shuttle/sessions.jsonl |
the daemon, at dispatch / claim / resume | one line per session: which fiber it belonged to |
~/.shuttle/commits.jsonl |
the Pi extension, after a bash call that committed (shuttle hook commit) |
one line per commit: sha, subject, repo, --shortstat counts, and the session that made it |
All three resolve against $SHUTTLE_DATA_DIR (default ~/.shuttle; the value
is trimmed and a leading ~ expands to your home), and each has its own
override: SHUTTLE_EVENTS_FILE, SHUTTLE_SESSIONS_FILE,
SHUTTLE_COMMITS_FILE (trimmed, blank counting as unset, otherwise taken as
written).
They are host-local by design. Every file records what happened on the machine
that wrote it, and a hub reads a remote's copy over the tunnel rather than
syncing it — which is why every temporal endpoint is host-scoped with a
/composite sibling that fans in every host the hub aggregates (the
fleet).
The event stream¶
The raw material. shuttle hook event appends one JSON line per harness hook
event. Shuttle.EventStream reads events.jsonl and its rotated sibling
events.jsonl.1 once at boot and follows appends to feed worker turn state on
the Desk, the family board, and
the board's document receipts.
Recording and rotation¶
The plugin registers shuttle hook event for SessionStart, UserPromptSubmit,
PreToolUse, PostToolUse, Stop, StopFailure, SubagentStop, Notification and
SessionEnd in Claude Code and Codex, the Pi extension calls it for Pi's
equivalents, and shuttle hook antigravity translates the Antigravity CLI's;
felt setup claude|codex|pi|antigravity installs the wiring. The hook writes
only when the stream's parent directory already exists, so an install without
daemon state grows no stream. SHUTTLE_EVENTS_FILE overrides the path and
creates its parent; SHUTTLE_EVENTS=off disables recording. Probe the writer
by hand:
echo '{"hook_event_name":"SessionStart"}' | SHUTTLE_EVENTS_FILE=/tmp/e.jsonl shuttle hook event
The live file rotates once it passes SHUTTLE_EVENTS_MAX_BYTES (64 MiB): it is
renamed to events.jsonl.1 and a fresh stream starts. The daemon reads both
files once at boot, the rotated one first, keeps what it derives from them in
memory — the sent-files trail, retained board records, and each session's turn
state — and carries that across a rotation rather than re-reading. Only events.jsonl.1 is
kept; an older rotation is overwritten, so a sent file leaves the trail with
the second rotation after it. Writers that find the stream full at the same
moment serialize the rename on a flock of events.jsonl.lock, so it rotates
once. A toolInput over 8 KiB is trimmed to its file paths plus
truncated: true, so a Write of a large file does not park the whole body in
the stream.
The session ledger¶
~/.shuttle/sessions.jsonl pairs a fiber with the harness session dispatched
against it — one line per session, not per event:
{"fiber":"work/paper/edits","uid":"01KTS…","session":"0883ade1-…",
"harness":"claude-code","host":"hub-mac","tmux":"edits-01KTS…-shuttle",
"at":1786203000000,"kind":"dispatch"}
Nothing installs this — the daemon writes it itself, at each moment it
certainly knows the pairing (kind names which: dispatch, claim, or
resume).
The alternative is inference — read the tmux session name, pull the ULID out of it, hope the worker is still alive — and that disappears the moment the session ends, so nothing downstream could answer "which sessions has this card had?" after the fact. The ledger makes the association structural, and the line outlives the session.
The commit ledger¶
~/.shuttle/commits.jsonl pairs a commit with the session that made it. It
attributes commits without parsing a fiber name out of a subject line, backing
provenance and board marks.
The pairing is only knowable inside the session's own process tree, where the
daemon is not — so the Pi extension writes it after a bash call that ran a
git commit: shuttle hook commit reads the commit back, dedupes against the
tail of the ledger, and appends one line. felt setup pi installs it. The
Claude Code and Codex plugin registers no commit recorder, so their commits
appear only when something else appends them (below).
The file stays absent on a host with no ~/.shuttle — a felt user who does not
run shuttle acquires nothing. There is no git log fallback: only recorded, joined commits count, so
commits made outside an agent session do not appear.
To grow one yourself, append a line per commit with at least:
{"at":1786203000000,"kind":"commit","sha":"79def80…",
"subject":"desk: cycle lens","repo":"~/dev/felt",
"files":3,"insertions":42,"deletions":7,
"session":"0883ade1-…","tmux":"edits-01KTS…-shuttle","cwd":"~/dev/felt"}
at and sha are the two the reader requires. session is the join key: it
must be the harness session UUID, the same value the session ledger records. A
malformed line is skipped, never raised.
When a ledger is missing¶
Every temporal feed is optional, and every failure path resolves to an empty result rather than an error. A view with nothing to draw says so and moves on; it does not break, and neither does the rest of the board.
The event stream only grows once ~/.shuttle exists, because shuttle hook event refuses to
create its own directory. Bootstrap step 3 creates it, so a bootstrapped host is
already enabled — a CLI-only install is not.
The endpoints¶
Every feed is host-scoped with a /composite sibling that merges this host's
read with every configured remote's, reporting per-origin freshness so a
disconnected host grays out rather than silently dropping history.
| Route | Reads | Serves |
|---|---|---|
/api/v1/sessions |
session ledger | fiber↔session pairings |
/api/v1/commits |
commit ledger | commit↔session pairings |
/api/v1/sent-files/all |
events | SendUserFile pushes |
Nothing is fetched until someone looks. A hub does not poll its remotes'
feeds in the background. A composite request is what asks each remote for its
copy of that feed, and a remote asked within the last minute is served from
the hub's cache instead. Each remote's last good answer is kept on disk under
$SHUTTLE_DATA_DIR/remote-temporal/, so an unreachable host keeps
contributing what it last said, and is marked stale once that answer is more
than ten minutes old.
Every route answers 304 when its inputs have not moved. The ledgers
validate on their files, and /sent-files/all validates on the {mtime, size}
of the events file and its rotated sibling. A composite's validator adds each
remote's cached copy of the feed.
The 304 is a bandwidth saving, not a cost model. A validator over
events.jsonl moves every few seconds on a busy host, so no route over it
relies on one: Shuttle.EventStream reads events.jsonl.1 and events.jsonl
once at boot and holds four projections in memory: sent-file events, per-session turn state, session succession, and family-board records.
It then reads only what has been appended since its last poll, following a rotation by the file's inode. That is
what makes a request cost a stat and an in-memory read rather than a full
re-stream. A sent file therefore stays on the trail through one rotation and
leaves it with the second.
For the writer/reader contract behind the joins, see The event stream and the ledgers — internals.