Seven Tracks of Mechanism, One Process to Keep Alive
Everything so far (shares, routes, tickets, the cache, jobs, pairs, the write call) lives inside one Python process per Mac. If that process is down, an app on that Mac gets local_delta_down, and a peer that wanted this Mac's files gets a refused connect. So the most important operational fact about Delta is boring on purpose: one LaunchAgent per Mac, labelled com.cwk.delta, started at login and restarted whenever it exits. This lesson is that agent: what installs it, what it runs, which Macs carry it, and why it is the only background process Delta has.
The Install Script Is the Only Door
Delta's repository ships one installer, scripts/install.sh, and it is run on the Mac it installs, as the account Delta will serve. It never reaches another Mac. Read it top to bottom and every step is a refusal or a check before it is an action:
- The interpreter must be usable. It imports
ssl,sqlite3andhttp.serverwith/usr/bin/python3. If that fails, it stops and says to install the Xcode Command Line Tools. There is no conda environment to build, because Delta is standard library only (Track 1). - This Mac must be in Delta's fleet. It asks Delta's own config for this Mac's fleet label, the two ports from the family port ledger and the state root, and checks the label against
fleet_labels(). A Mac outside the fleet is refused withnot in Delta's fleet (every family Mac but the household's); not installing. - State is created private. The state folder (
~/cwk-dbs/delta-dbunless the host profile moves it) is made with mode700. The local token and this Mac's TLS certificate are generated there if they do not exist yet. The script prints only the first 16 hex digits of the certificate's fingerprint, enough for a person to compare and nothing a caller could use. - The plist is rendered, then linted, then moved.
deploy/com.cwk.delta.plist.templatehas two placeholders, the repository path and the logs folder. The script fills them into a temporary file, runsplutil -lint, and only a plist that lints replaces the installed one. - The service is replaced, not stacked. If the agent is loaded,
launchctl bootoutfirst, thenbootstrapandkickstart -k. - Done means it answers. The script polls
http://127.0.0.1:<engine>/v1/healthfor up to ten seconds. If Delta never answers, it prints the last twenty lines oflaunchd.err.logand exits non-zero. "launchctl returned 0" is never reported as success.
install.sh --check runs the same identification, then reports whether the plist exists, whether the service is loaded and what health answers, and changes nothing.
What the Plist Says
| Key | Value | Why |
|---|---|---|
ProgramArguments | /usr/bin/python3 -B -E -s -m delta serve | Apple's python (the Local Network gate lets a platform binary through); -B no bytecode files, -E ignore PYTHON* variables, -s no user site-packages |
WorkingDirectory | the repository | so -m delta imports the checkout; it is also why a relative local path is refused (Track 6) |
RunAtLoad, KeepAlive | true, true | start at login; restart on any exit |
ThrottleInterval | 10 | a crash loop restarts at most every ten seconds |
NumberOfFiles | 8192 (soft limit) | pooled connections, partials and listings hold many descriptors at once |
StandardOutPath, StandardErrorPath | logs/launchd.out.log, logs/launchd.err.log | what the process printed before its own logging started, and every crash |
Nothing in the plist names a Mac, an address or a port. The ports come from the ledger when the process starts, so the same template installs on every Mac (invariant 8).
Which Macs Carry It
Delta's fleet is computed, not listed: every Mac in Kit's maintenance group (the Macs Dad manages) and its fanout_excluded group (Pippa's home Mac), minus any Mac in the household group. Pippa's home Mac runs it in her own pippa account and serves that account's home; Dad's ruling the day Delta was born was that her home gets one too, as a matter of course. The household's Mac (Mom's) runs no background service at all, so it runs no Delta; when it needs one specific share, its client asks a gateway directly (Track 4).
Because every Mac runs the same code and the same install, there is no "Delta server". The workbench and the service host are peers to each other in exactly the way a laptop is.
No Scheduler of Its Own
Delta moves nothing on its own. A transfer happens only when a person types delta cp or delta sync, or an app asks through kit_delta. The vault pair, the memory pair and Lantern's mirror pull all have their own schedulers in their own apps; Delta is the channel they ride. The one loop inside the daemon is housekeeping: every six hours it sweeps abandoned partials and bounds the logs (next lesson). That split matters when something goes wrong: if files are moving at three in the morning, the question is never "what did Delta decide", it is "which app asked".
The Family Sees It as a Card
Delta serves no web page and docks no Pippa panel, so its face in the family is Firelink's card. Firelink's operations registry declares the service label com.cwk.delta and a health check: GET /v1/health must contain "member":"cwkDelta". The short health answer carries the label, the version, the protocol, the uptime and this Mac's clock (a pair reads it for clock skew). The full one, which only this Mac's engine gives, adds shares and their load failures, the cache, routes, peers, jobs, partials waiting and the counters. A share whose child failed to load turns the status to degraded, never to down: one broken app share must not take the channel away from everyone else.