Farmslot · how run data moves

Run Data Map

Where a run's data lives at each moment: on the slot, on the gateway, in the bundle store, in the archive, and in each client's offline store. It also shows what moves between them, when, how much, and what keeps it from moving too often. Every claim comes from the code, and each panel lists the files it comes from. The full reference is docs/reference/run-data-sync.md.

pushed live moves at a checkpoint read on demand not copied
1 / 8
The mental model

Six rules that keep sync cheap

1

Live means small

While a worker runs, only small things stream: checklist and signal files (whole file, 1 s debounce, skipped when the checkbox hash is unchanged), the terminal pane only while someone watches it, native conversation deltas, and metrics every 30 s.

2

Big things move at checkpoints

Artifacts, screenshots, videos and diffs stay on the slot until a checkpoint: the terminal signal, completion, the gate package, or an explicit mirror refresh. A mirror skips files whose size and hash are unchanged; task-actions/ is copied whole.

3

A bundle is the record

Each capture becomes an immutable, digest-addressed bundle. Readers such as the artifact route, reviews and replay read the bundle, never the slot or the mutable task directory.

4

Clients ask "what changed?" first

A client reads a list of versions, then fetches only the rows whose version moved. Pushes carry a key, plus the entity body only when it changed and fits in 16 KiB.

5

Paint from the store, then refresh

Each client keeps an offline store (SQLite: WASM in Command Center, native in Companion). A screen paints from it before any request; only observed screens refetch, each with a minimum interval between reads.

6

Preload only what you'd open offline

In the background, clients fetch what a pending gate or an active run needs: details, the diff, and both sides of touched files, keeping what fits per-item caps (diff 5 MiB, file 1 MiB, image 2 MiB). Everything else loads when opened.

Layer by layer

What moves, when, and how much

What Direction When Size / cap Guard against over-sync Where
Checklist, SIGNAL, acceptance status, subtasks slot → gateway on change whole small file content dedupe, 1 s debounce, checkbox hash capabilities/src/fs-watch.ts:58, gateway/src/tasks/watcher.ts:583
Terminal pane slot → gateway → viewer while viewed pane text, every 500 ms sent only when the pane changed runtime/tmux-stream.ts:89
Native conversation node → gateway → viewer pushed deltas ≤ 400 rows / 832 KiB on open snapshot once, then deltas resources/native-conversations.ts:527
Fleet metrics, tmux workers node → gateway 30 s / 2 s sample small only changed snapshots sent server/route-method.ts:1654, node commands/tmux-worker-watch.ts:140
Artifact mirror (evidence, recipe artifacts, PR-body files, task actions) slot → gateway signal, completion, gate, refresh 512 KiB chunks, hash-verified skip when size + remote hash match (task-actions/ copied whole); package caps checked first run-completion/artifact-mirror.ts:394, core/slot-io.ts:489
Media (screenshots, video) slot → bundle after bundle metadata commits copied once fingerprinted on the slot, never staged in the mirror run-completion/retained-artifacts.ts:108
Retained bundle gateway → bundle store each capture immutable, digest-named capture key reuses an identical bundle run-bundle/src/retained.ts:2343
Task files on dispatch / resume gateway → slot dispatch, resume TASK.md, inputs/, artifacts/ files already in the slot's artifacts/ are kept; TASK.md, assets/ and inputs/ are overwritten; *.worker files never go out run-engine/task-sync.ts:38
Node support bundle gateway → node prepare, per command check content-hashed held until a file stamp changes (checked ≤ every 2 s, 10 min max age); remote check cached 10 min node-support/remote-command.ts:181, node-support/ensure.ts:244
Storage archive gateway → storage archive hourly pass task dir, bundle, sessions settled for the retention period (default 7 days), no run in the family on an open or unknown PR, not read by an unsettled follow-up, no keep tag, slot not held runs/retention.ts:66, runs/storage-archive.ts:197
Entity pushes (fleet, machines, PR list) gateway → clients on change, coalesced body only if ≤ 16 KiB 200 ms coalescing for busy families gateway revisions.ts:206, client-cache/keys.ts:114
Run list gateway → clients observed, ≥ 30 s apart versions, then changed rows versions first, ids only for moved rows client-cache/run-list-versions.ts:158
Diffs

What a diff carries, by file type

Four producers write diffs. The worker diff (artifacts/diff.txt, capped at 50 MiB, otherwise dropped with a reason) is local git, source-filtered, with binary patches. The review input is GitHub's per-file patches, source-filtered and kept as a display-only snapshot. The gate review diff's committed part and the live git.diff RPC are unfiltered; the gate's uncommitted part is produced like the worker diff. That is why file counts can differ between views. The source filter allows about 60 source extensions and common build files (Dockerfile, Makefile, Gemfile and similar).

File type Worker diff Review input (GitHub) Gate committed part, live git.diff Client prefetch
Allowlisted source text full hunks GitHub's hunks full hunks diff + both sides, file ≤ 1 MiB
Lockfiles (yarn.lock, package-lock, pnpm-lock, Cargo/Gemfile/Podfile.lock) left out of text and stats left out included as text, if in the diff
Images, video, archives left out left out "Binary files differ" line skipped; gate evidence images ≤ 2 MiB fetched separately
Binary bytes under a text extension (e.g. binary .plist) base85 binary patch, counts toward the 50 MiB cap usually no patch from GitHub, so a placeholder line "Binary files differ" line skipped before any git.show request
Generated files no special handling; projects add rules via diff_analysis.source_filter same filter included as text
Renames normalized {a => b} in stats, 50% similarity shown under the new path git.diff passes the old path per file both sides
Submodules gitlink only as GitHub reports it gitlink only skipped
Untracked ignored files (.env) never listed n/a (commits only) never listed never listed

Ignore rules apply to untracked files only. A tracked file that matches an ignore rule appears in every diff like any other tracked file.

Refs: core/source-diff-filter.ts:7-92, run-engine/diff-artifacts.ts:101,433-851,1035-1053, review/snapshots.ts:272-307, methods/git.ts:104-683, client-cache/prefetch.ts:479-645, client-cache/content.ts:21-180

Clients

Preloaded in the background vs loaded when opened

background
  • Run details (run.get) for listed runs on unmetered networks, otherwise pending gates and active runs only. Budget 64 MiB.
  • Pending gates: the package diff (stored only if ≤ 5 MiB), base files via batched git.show (4 MiB per page, 1 MiB per file), evidence images ≤ 2 MiB.
  • Active runs on a slot: the worktree diff plus untracked files, always read; base files only when the diff is ≤ 5 MiB. A head check runs at most once a minute and only while a view watches that slot.
  • Review rounds: each round's metadata, review diff and fix diff.
  • Companion on LAN only: gate videos and large images, up to 400 MiB in total.
  • Two at a time, foreground and connected only, never on a timer. Prefetch uses at most half the store (2 GiB Command Center, 500 MiB Companion) and gives way to anything the user opened.
when opened
  • Files over 1 MiB or binary, images over 2 MiB.
  • Base files of diffs over 5 MiB. The diff itself may already have downloaded in the background: the cap is checked after it arrives. For a gate it decides whether the diff is stored; for an active run it gates only the base files.
  • Command Center videos.
  • artifacts/diff.txt and the iteration diff (prefetch reads the gate package diff or the live diff instead).
  • Logs, terminal history and native transcripts (bounded to 400 rows / 832 KiB on open).
  • Base files for warm snapshots and GitHub PR snapshots.

The written rule is Content rules 1–6 and Prefetch rules 1–6 in docs/reference/gateway-change-notifications.md, and ADR-071 with amendments 1 and 2.

Storage

Lifecycle of a run's bytes

There are two different "archives". Run.archive is an operator action that moves the run record to .runs/archive/; records are kept forever. The storage archive is the hourly pass that moves a settled run's bytes (task dir, bundle, native sessions, session archives) to FARMSLOT_RUN_ARCHIVE_ROOT and deletes recreatable pins and review workspaces. A run's bytes move once it has been settled for the retention period (runBundleRetention.runRetentionDays in run-bundle-retention.json, default 7 days; see ADR-039 Amendment 8), has no keep tag and holds no slot. Every run on an open PR, or whose PR state is unknown, is kept whatever its age, together with its run family. An unsettled follow-up keeps its run family, and an in-flight review keeps the prior run it reads.

Known limitations

Where it syncs too much, or loses data

Structural gaps in the current code, each checked against the file it cites.

Limitation Effect Where