Frostline becomes three Go binaries with one job each, one dispatcher, a pure domain that owns every decision, and plugins that live on the caller's side of a process boundary. Python leaves the command path in phase 1 and the box in phase 2.
frostline runs as you. frostline-core runs as the service account and is the only dispatcher. frostline-root does 13 named privileged jobs through sudo and nothing else.service.Dispatch. No second path, no per-call Python, no per-call sudo.OutcomeUnknown, never a retry.frostline-<name> executables that run as you and talk only through the public API. Core knows no stack.Three trust zones. Arrows are the only ways across. Your laptop runs the same front binary and reaches the box over HTTPS instead of the local socket.
flowchart LR
subgraph you["Your account (laptop or box)"]
front["frostline (Go front)
generated parser
MCP stdio, Code Mode broker
your files read and written as you"]
ext["frostline-rn and other plugins
run as you, no new privileges"]
serve["frostline serve
per member, HTTPS and tokens"]
goru["goru-worker
sandbox for agent JS"]
end
subgraph svc["Service account (frostline)"]
core["frostline-core serve
peer auth, Dispatch,
scheduler, state, journal"]
dev["per-device supervisor
resident-worker + control socket"]
sim["mldr, darlingserver,
DisplayHost, the iOS app"]
end
subgraph root["Root"]
rootbin["frostline-root
13 named subcommands"]
end
laptop["Laptop front"] -->|"HTTPS /v2/call"| serve
front -->|"unix socket, framed calls"| core
serve -->|"unix socket, as that member"| core
ext -->|"public CLI and API only"| front
front -->|"runs agent code in"| goru
core -->|"control socket"| dev
dev -->|"supervises"| sim
core -->|"sudo, exact subcommands"| rootbin
front -->|"sudo forward-run only"| rootbin
classDef caller fill:__ICESOFT__,stroke:__ICE__,color:__INK__
classDef service fill:__NEWSOFT__,stroke:__NEW__,color:__INK__
classDef privileged fill:__WARNSOFT__,stroke:__WARN__,color:__INK__
classDef outside fill:__SURF2__,stroke:__INK2__,color:__INK__
class front,ext,serve,goru caller
class core,dev,sim service
class rootbin privileged
class laptop outside
| Binary | Runs as | Owns | Never does |
|---|---|---|---|
frostline | you | Parsing, your files, MCP, Code Mode, per-member HTTPS serve, plugin dispatch, port forwarding entry | Device work, state, decisions |
frostline-core | service account | Auth, the one dispatcher, scheduling, device state, the intent journal, device supervisors | HTTPS, tokens, writing your files, running plugins |
frostline-root | root via sudo | Mounts, images, network lock, namespace guard, kill and trace helpers | Anything not on its list of 13 |
goru-worker | you | Running agent code in a sandbox | Linking into a privileged binary |
Dependencies point inward. A layering test parses every import and fails the build when an arrow goes the wrong way.
flowchart LR cmd["cmd/*
the only place that wires"] --> api cmd --> adapters cmd --> cli cli["cli/
parser, contexts, your I/O"] --> schema api["api/
wire, local, https, mcp"] --> service api --> schema service["service/
Dispatch, authz, scheduler,
machines, journal"] --> ports service --> domain adapters["adapters/
ctrl, frames, ax, hid, stage,
guest, sqlite, systemd, legacy"] --> ports ports["ports/
Device, Clock, StateStore,
Frames, AX, HID, RootHelper"] --> domain schema["schema/
generated from verbs/*.json"] --> domain domain["domain/
types, unions, transition tables
stdlib only, no IO, no clock"] classDef pure fill:__NEWSOFT__,stroke:__NEW__,color:__INK__ classDef edge fill:__ICESOFT__,stroke:__ICE__,color:__INK__ classDef wiring fill:__WARNSOFT__,stroke:__WARN__,color:__INK__ class domain,ports pure class adapters,api,cli,schema,service edge class cmd wiring
| Package | Holds | May import | Banned inside it |
|---|---|---|---|
domain/ | IDs, sessions, tap and settle, lifecycle, budgets, outcomes, errors | stdlib | time.Now, os, net, exec, panic, printing, globals |
ports/ | Small interfaces plus scripted fakes | domain | Any implementation |
service/ | Dispatch, authorization, queues, the call, service and device machines, journal | domain, ports | Concrete adapters, package globals |
adapters/ | Everything that touches the world. All guest-written data enters through adapters/guest and leaves as validated, typed observations. | domain, ports | service, api |
api/ | Framed wire codec, peer auth, HTTPS relay, MCP | service, schema | adapters |
schema/ | Generated types, codecs, help, MCP schemas, fl.d.ts | domain | Hand edits |
cmd/ | main for each binary | everything | Logic |
Four ideas carry the whole core. The snippets are the shape the domain lane is building to, written against the strict gate.
Named IDs. A device ID can never be passed where a run ID belongs.
type DeviceID string
type RunID string
type LeaseID string
type PlanID uint64
type Generation uint32
type SessionKey struct {
Device DeviceID
Generation Generation
}
Closed unions. The linter fails the build if a switch misses a case.
type Outcome interface{ isOutcome() }
type Settled struct{ Evidence Evidence }
type MovingAtDeadline struct{ Last Observation }
type OutcomeUnknown struct{ Plan PlanID }
type DeviceFailure struct{ Phase Phase }
func (Settled) isOutcome() {}
func (MovingAtDeadline) isOutcome() {}
func (OutcomeUnknown) isOutcome() {}
func (DeviceFailure) isOutcome() {}
Transition tables. Every state machine is data plus one pure step function.
type SettleState interface{ isSettleState() }
type SettleEvent interface{ isSettleEvent() }
type Decision interface{ isDecision() }
type SampleAt struct{ At Instant }
type Finish struct{ Outcome Outcome }
func Advance(s SettleState, e SettleEvent) (SettleState, Decision)
Ports. The service sees the device through a narrow interface. Tests use a scripted fake.
type Device interface {
Observe(ctx context.Context, k SessionKey) (Observation, error)
Inject(ctx context.Context, k SessionKey, p Plan) (Receipt, error)
}
type Clock interface {
Now() Instant
WaitUntil(ctx context.Context, at Instant) error
}
func (s *Service) Dispatch(ctx context.Context, c Call) Reply
Errors are one closed union too: Usage, Denied, StaleSession, Busy, Deadline, EvidenceUnavailable, DeviceFailure, OutcomeUnknown. Each carries a stable code and whether the device was touched. They map to today's exit codes and JSON fields at the edge, and code matches them with errors.As, never by text.
Three explicit machines replace the implicit state spread across today's 17,000-line core. Each one is a table in domain/ with a test for every row.
stateDiagram-v2 direction LR [*] --> Received Received --> Refused: peer auth fails Received --> Authenticated: auth ok Authenticated --> Refused: bad frame Authenticated --> Authorized: allowed Authenticated --> Refused: denied Authorized --> Queued: enqueued Authorized --> Refused: queue full Queued --> Cancelled: caller hangs up Queued --> Refused: device reset Queued --> Running: its turn Running --> Replied: done Running --> Cancelled: cancel before touch Running --> OutcomeUnknown: lost after touch Running --> DeadlineExceeded: deadline Running --> DeviceFailure: device died Replied --> [*]
| Service | Moves to | When |
|---|---|---|
| Starting | Reconciling | Journal replayed. Pending intents with no receipt become unknown. |
| Reconciling | Ready or Degraded | Every device classified, or 10 s with some unreachable |
| Ready | Degraded and back | A device goes unreachable, then recovers or ends |
| Any | Draining | SIGTERM. Long calls answered at once, 5 s cap. |
| Draining | Stopped | Nothing in flight. Callers queue on the socket meanwhile. |
| Device | Moves to | When |
|---|---|---|
| Unknown | Reachable or Unreachable | First probe |
| Unreachable | Reachable | Re-probe with backoff, 1 to 30 s |
| Reachable | Wedged | A call runs 5 s past its deadline |
| Any | Resetting | down --force or relaunch, on its own lane, never queued behind the stuck call |
| Resetting | Reachable at N+1, or Ended | Generation bumped, so late effects from the old session are fenced off |
The overhead budget for everything before the device is 15 ms at p95, checked in CI on every PR. Today the same path costs 268 ms with two Python starts.
sequenceDiagram
participant F as frostline (you)
participant C as frostline-core
participant J as Journal
participant D as Device supervisor
F->>C: tap frame over core.sock
C->>C: peer creds, pidfd, groups, lease check
C->>J: write intent (plan 17)
C->>D: inject plan 17
D-->>C: receipt for plan 17
C->>J: record receipt
loop settle, driven by domain.Advance
C->>D: observe frame, accessibility, activity
D-->>C: typed observation
end
C-->>F: reply Settled with evidence
Note over C,J: if the reply is lost after injection, the next caller sees OutcomeUnknown with plan 17, and nothing is resent
A plugin is an executable named frostline-<name>. Typing frostline rn push runs frostline-rn push as you, with no new privileges. Plugins hold all stack knowledge so the core stays generic.
FROSTLINE_BIN, FROSTLINE_DEVICE, FROSTLINE_SESSION, FROSTLINE_JSON. It calls Frostline only through the public CLI and API. Never tokens, never service paths.
On your side of the process boundary. On team boxes, over HTTPS and through MCP, only plugins shipped in the kit and on the allowlist can run. Anything found on PATH is refused there.
Generic verbs: add, push changed files, up with app arguments, forward a port, look, tap, flows. The incremental push in #1391 is one of these. It moves bytes and knows nothing about JavaScript.
Lives in your repo and is read by the client only: the app, flows, named forwards, native path globs, visual masks. Nothing from it crosses to the box except content and names.
flowchart LR
edit["You change JS"] --> rn["frostline-rn push"]
rn -->|"hash native inputs"| fp{"Native
unchanged?"}
fp -->|"no"| build["Build natively, then add"]
fp -->|"yes"| bundle["Export minified bundle
and assets locally"]
bundle -->|"splice into cached shell,
check asset paths"| push["frostline push
(generic, core)"]
push -->|"file hashes first,
then only missing bytes"| box["Box: assemble, install,
relaunch"]
build --> box
dev["frostline-rn up"] -->|"Metro on your machine,
forwarded port 8081"| box
classDef plugin fill:__ICESOFT__,stroke:__ICE__,color:__INK__
classDef core fill:__NEWSOFT__,stroke:__NEW__,color:__INK__
classDef slow fill:__WARNSOFT__,stroke:__WARN__,color:__INK__
class rn,bundle,dev,fp plugin
class push,box core
class build slow
class edit plugin
| You changed | One way to ship it | Where it runs |
|---|---|---|
| JS, while developing | frostline rn up with fast refresh | Metro on your machine, the box only runs the simulator |
| JS, release or CI bundle | frostline rn push | Plugin on your machine, generic delta push to the box |
| Native code | Build, then frostline add | Your machine, or a build service later |
Merged as #1395. A red gate is never waived.
| Rule | How it is checked |
|---|---|
| Every switch over a union covers every case | exhaustive, gochecksumtype |
| No nil dereferences | nilaway |
| Layers point inward | depguard plus a layering test over every import |
| The domain is pure | forbidigo bans clock, files, network, processes, panic and printing in domain/ |
| No hidden shared state | gochecknoglobals in service, adapters and render. No init() side effects. |
| Errors are typed | errorlint, wrapcheck at adapter edges, errcheck |
| No races, no order dependence | go test -race -shuffle=on |
| Parsers survive hostile input | Fuzz targets on every PR, longer at release. The wire codec took 65 million inputs clean. |
| Go behaves exactly like today | A command moves only when it matches the recorded corpus: JSON replies, error codes, exit codes, files written. Its Python is deleted in the same PR. |
| Piece | State | Link |
|---|---|---|
| Delete before porting (3,650 lines) | merged | #1392 #1394 #1396 |
| Strict Go gate | merged | #1395 |
| Command catalog split and generated parser, 13,960 usage cases identical | merged | #1393 #1398 |
| Wire protocol and codec | merged | #1399 |
| Recorded corpus, 55 cases, zero diffs on replay | merged | #1397 #1401 |
| Core service and auth, 7 ms p95 overhead measured | in review soon | W1-core |
| Domain types, machines, journal | building | W1-domain |
| Go CLI front and cutover | building | W1-front |
| Commands one by one: tap, look, type, swipe, key, wait, up, down, then the rest | wave 2 | Starts when the core service merges |
| Runtime, setup and install off Python | phase 2 |