Seed Exact has two halves joined by one seam. The interface half is Contract, compiled to a plan and drawn as UIKit. The data half is TypeScript on Hermes, which talks to servers, the Keychain and one file. This page shows how the halves fit and follows one request end to end.
Layers
Layer | What it is | Where | Page |
|---|---|---|---|
Screens | Contract components per package, plus shared |
| |
Root | Routes, tabs, all state, every resource, mutation, task and action |
| |
Plan VM | Exact's Rust runner and layout kernel execute the plan | Exact | |
Presentation | Swift presenters draw UIKit: bars, lists, sheets, the tab bar | Exact | |
Seam |
|
| |
Sources | One |
| |
Crypto and identity | Keys, signed blobs, envelopes, the vault codec |
| |
Capabilities | Grants for network, two Keychain secrets, one file |
| |
Services | Seed site API, blob publishing, notify, vault server, agents server | remote |
There is no local Seed daemon and no shared client package at run time. The app signs everything itself, see Publishing signed blobs.
Build time
flowchart LR
C["app.contract and package contracts"] --> CC["Contract compiler"]
T["app.tamber"] --> CC
CC --> P["plan"]
CC --> D["app.contract.d.ts"]
D -. types .-> TS["app.ts and src"]
TS --> B["type check, Rolldown, hermesc"]
B --> H["Hermes bytecode"]
G["grants literal in app.ts"] --> R["receipt beside the bytecode"]
P --> APP["iOS app bundle"]
H --> APP
R --> APP
J["app.json and assets"] --> APPThe compiler bakes constant data into the plan so the first frame needs no JavaScript. Grants are read from the source without running it. On a merge to main, the same build runs on the delivery Mac and goes to TestFlight, see CI and delivery.
Run time
flowchart TB
subgraph phone["On the iPhone"]
V["UIKit views"] -->|events| RUN["runner: plan VM, state, tasks, router"]
RUN -->|layout| K["kernel"] --> V
RUN <-->|"resource and mutation calls, shaped replies"| DM["data module on Hermes"]
DM --> GR{"grants"}
GR --> NET["fetch and WebSocket"]
GR --> KC["Keychain: seed-keys, seed-vault-kek"]
GR --> FS["app:/data/vault/envelope.json"]
end
NET --> SITE["Seed site /api and /hm"]
NET --> NOTIFY["notify service"]
NET --> VAULT["vault server"]
NET --> AGENTS["agents server"]State lives only in the runner. The data module keeps module-level caches and the vault manager, but nothing the view reads directly. Every write to state happens in an action. Every side effect outside the app happens in a source.
The life of a resource request
Opening a document, step by step:
Navigation changes state. Tapping a link runs action follow, which sets nav = go(nav, …) (app.contract L277-L278). The derived readRefs recomputes from the Read tab's stack (L93-L94).
The resource is asked again. resource docs = readDocs(server, readRefs, readEpoch) as shape DocPage[] else empty() (L103). An argument changed, so the runner issues a new request. Until an answer arrives the view shows the previous answer, or empty() at launch, and pending(docs) is true.
The seam dispatches. Exact calls answer('readDocs', [server, refs, epoch], store, storage, native). app.ts L43-L45 looks the name up in the merged sources object.
The source runs. readDocs in src/read/sources.ts L21-L24 notes the epoch (a new epoch drops that server's caches) and calls loadDocs, see Read: loading pages, caches and embeds.
The network call. src/read/client.ts L10-L15 does GET {server}/api/Resource?… with exactTimeout: 15000. The host checks the URL against net.fetch https: before sending, see Seed site read API.
Decode and shape. The superjson envelope is decoded by hand (Read client), blocks become rows with Markdown text (Read: blocks to rows), and the source returns an array of DocPage records. Each stretch of this work between awaits must fit the 100 ms turn budget.
The shape check. The runner checks the answer against shape DocPage exactly. An extra field fails the resource, and the view keeps its last value.
The view updates. The root passes docs=docs, loading=pending(docs) to DocScreen (L751-L753). The screen picks its page with a derive and renders a native list of block rows (read.contract L287-L312), see Read: screens and components.
Refresh. Pull to refresh runs readRefresh, which increments readEpoch (L310-L311). Retry runs refresh docs. Both lead back to step 2, see State, refresh and stale-reply patterns.
A mutation follows the same path with three differences: an action sends it, its reply is an option that starts at none, and its declaration names resources to refresh and an action to run then. Posting a comment is the example: discussPosted signs a blob in the source and publishes it, see Discuss: loading and posting. A stream is a resource whose source returns fetch(url, {exactStream}), see Agents: WebSocket streams as resources.
Where to go next
Question | Page |
|---|---|
Which constraints will bite my code? | |
How are keys kept and blobs signed? | Identity: key storage, Crypto: changes, refs, comments and profiles |
How do identities sync between devices? | |
How is a change tested and shipped? | |
What is missing today? |
User stories
The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).
US-APP-08 Have the app stay fast and responsive: Build time, run time and the life of one request
US-APP-09 Know the app only reaches what it must: No local daemon; capabilities sit between the data module and the phone
US-TEAM-04 Understand how the app is built: The layers, build time, run time and the life of one request
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime