Sense 28: The Direct Line — Data Skips the Middle
Ce contenu n’est pas encore disponible dans votre langue.
Sense 28 · Forming · Last touched 2026-08-20
- last_verified: 2026-07-27
Synced from
docs/design/sense_28_the_direct_line.mdin the engine repo — that’s the source; this page is a build-time mirror.
The cloud holds the picture, not the dataset. (Sense 27)
Now: the cloud doesn’t even hold the picture. The browser fetches it straight from the laptop.
Status: proposed (stub) Date: 2026-05-04 Author: the owner + Claude (end-of-day, post-Sense 27)
What pulled us in
Section titled “What pulled us in”Sense 16 (P2P2P) gave us your data, your machine, their browser. Sense 27 (The Funnel) shrinks what flows through the middle. But the middle is still there: every query result still passes through the cloud JinDesk’s memory before reaching the browser.
This is fine for performance once Sense 27 lands. It is not fine for a stronger version of the Sovereignty Principle:
A compromised cloud can still log every row that flows through it.
Today, if Fly were compromised, an attacker could read every material code, every billing record, every patient-coded finding — not by accessing the laptop, but by tapping the cloud machine that the rows pass through on their way to the browser. The Sovereignty Principle promises that Ctrl+C unplugs the data, but in practice the cloud could keep a copy.
The Direct Line closes that gap.
The Principle
Section titled “The Principle”Data flows directly from laptop to browser. The cloud sees no rows.
laptop ────── tunnel ─────► browser (data path) ▲ │ cloud (control plane only) — renders the shell — issues signed query handles — never sees a rowThe cloud is reduced to: routing, page rendering, query authorization. It composes SQL, signs it, and hands the browser a signed query handle. The browser sends the handle to the laptop’s tunnel directly. The laptop verifies the signature, executes the query, returns rows over the same direct connection. The cloud never touches the bytes.
This makes the cloud cryptographically incapable of seeing data, not merely promising not to. The “they” in their browser becomes the only party that ever sees a row.
The Mechanism (sketch)
Section titled “The Mechanism (sketch)”-
Page render (cloud) — SSR the page shell. Inject into the page payload: the tunnel URL, a session token, and for each panel the signed SQL handle (SQL string + params + signature). The cloud never executes the SQL.
-
Panel fetch (browser) —
fetch(`${tunnelUrl}/query`, {method: 'POST',headers: {'Authorization': `Bearer ${sessionToken}`,'Content-Type': 'application/json',},body: JSON.stringify(signedHandle),}) -
Query execution (laptop) — the Go proxy verifies the signature against the cloud’s public key, runs the SQL (read-only DuckDB), streams rows back to the browser.
-
Render (browser) — panel JS parses, renders chart. Cloud never sees the result.
Why pre-signed queries. Without signing, handing the browser a tunnel URL + token would let it ask the laptop arbitrary SQL — a stolen token = full DB read. Pre-signed SQL says: the laptop only runs queries the cloud has explicitly authorized for this session and this page. Even with a leaked token, the attacker can only re-run already-authorized queries.
This depends on Sense 27 — once panels fetch their own data and the SQL is already composed at request time, the cloud signs the same SQL it would have executed.
Risks and Downsides
Section titled “Risks and Downsides”Cryptographic surface
Section titled “Cryptographic surface”- Key management. The cloud needs a signing key; the laptop needs the matching public key, baked into the proxy at build time or rotated via a trusted bootstrap. Rotation strategy must not require redeploying every laptop binary.
- Replay window. Signed handles must include a TTL and a session binding, otherwise a captured handle works forever from any browser.
- Token visibility in browser. Session tokens now live in JS — visible in devtools, extensions, page snapshots. Mitigated by: short TTL, single-session scope, signed-SQL authorization layer underneath.
CORS / network
Section titled “CORS / network”- Cross-origin from
proxy.jinflow.ioto*.trycloudflare.com. Tunnel must send CORS headers. Cloudflare’s free tunnels do; custom-domain tunnels need configuration. A custom subdomain (tunnel.<user>.jinflow.io) per session would be nicer but adds DNS plumbing. - Connection pooling. Browser opening direct connections to the laptop loses HTTP/2 multiplexing benefits the cloud was getting. Likely fine for our query rates, worth measuring.
Architecture
Section titled “Architecture”- Config engine stays cloud-side, single instance. The config engine resolves the 4-level cascade (engine → pack → tenant → entity) into a flat display config; it governs pagination, columns, precision, granularity. It does not compose SQL — query modules do. Under the Direct Line, the loader still composes SQL on the cloud exactly as today, then signs it. The browser receives signed handles + display config and renders. No duplication, no config-engine-in-the-browser.
- Streaming rows. With direct path, NDJSON streaming
becomes natural — the browser reads
Response.body.getReader()and renders progressively. This is the right place for Sense 27’s Lever 3.
- Latency profile changes. Today: page returns rendered. After: page returns shell, panels populate over direct connection. Empty-then-fill flash worse than today’s buffered-then-render. Mitigated by: skeletons, parallel panel fetches, prefetch on hover.
- Error surfaces split. Cloud errors (auth, signing) and laptop errors (SQL, KLS missing, tunnel down) reach the user differently. Need a unified error language across both surfaces.
What we lose
Section titled “What we lose”- Cloud-side logging of which panels were used. Today the cloud sees every query and could log usage. After, the cloud only sees which signed handles it issued — not whether they were actually fetched. We can still log issuance, but not consumption. Probably fine.
- Cloud-side caching. Today the cloud could cache query results across requests. After, caching has to live either in the browser (per-session) or on the laptop (per-tunnel). Likely a wash — the cloud’s cache was always going to be small and short-lived for privacy reasons.
Sequence (after Sense 27)
Section titled “Sequence (after Sense 27)”This sense builds on Sense 27, doesn’t replace it.
- Sense 27 Lever 1 — aggregate at source (independent value)
- Sense 27 Lever 2 — panels fetch their own data
- Sense 28 — those fetches go to the laptop directly, not via the cloud
- Sense 27 Lever 3 — streaming becomes natural over the direct connection
The tightest sequence: Lever 1 first, then Sense 28 + Lever 2 together (they share the panel-fetch infrastructure), then Lever 3 once streaming is the obvious next step.
Out of Scope
Section titled “Out of Scope”- WebRTC / true P2P. The Direct Line uses HTTP over a Cloudflare Tunnel — same plumbing as today, just different endpoints. WebRTC would skip Cloudflare entirely but adds NAT traversal, signaling, and a much larger attack surface. Not worth it for the marginal privacy gain.
- Encrypted DuckDB files. Orthogonal — the laptop is trusted in our model; encryption-at-rest is for laptop loss scenarios.
- Replacing Cloudflare Tunnel. Tunnel is fine; it’s the right tool. The change is who connects to it.
Decision
Section titled “Decision”Adopt as the destination architecture for proxy mode. Stage behind Sense 27’s first two levers — neither blocks the other, but Sense 28 is a much cleaner ship if Lever 2 is already in place.
Bring this back into focus once Material Map’s Funnel migration is settled and the panel-fetch pattern has been proved out on one route.
How this manifests in jinflow
Section titled “How this manifests in jinflow”Not yet manifest in the engine. Status: proposed. See the implementation phases / open questions above for the path from this paper to running code.
Numerical neighbors: ← Sense 27: The Funnel — Narrow at the Source · Sense 29 — The Atelier →