Wiki

Internal documentation — the host-server architecture behind the Pragma desktop app.

This section documents how Pragma actually works: the processes on a host, the wire protocol between them, and where every byte lands on disk. It is written for contributors and the curious — user-facing behaviour lives in the user guide.

The one-paragraph version

The desktop app is a controller, not a host. It renders UI and brokers control decisions, but a persistent pragma-server owns the terminals, scrollback, agent status, and sidecars, listening on an owner-only Unix socket. A small HTTP pragma-gateway fronts the same server for remote clients — the mobile app, the web build, and @pragma-sh/sdk. pragma-cli is installed into agent terminals to speak to the socket directly. The desktop can therefore be closed, restarted, or updated while sessions keep running.

Where the code lives

Crate / packageRole
crates/pragma-serverPersistent host server: PTYs, status, fanouts, sidecars.
crates/pragma-clientClient transport library + SSH/WSL bridges.
crates/pragma-corePure host business logic (git, fs, exec, scratchpads).
crates/pragma-gatewayLocalhost HTTP gateway.
crates/pragma-platformOS seams: IPC, paths, perms, processes, shells, WSL.
crates/pragma-protocolWire frames and shared names.
crates/pragma-cliThe agent-facing CLI.
apps/pragmaThe Tauri desktop app (controller).
packages/*SDK, plugin API, automations, sidecars, agent integrations.

Shared constants flow from one JSON schema (packages/constants/schema.json) into both TypeScript and Rust, so the two languages cannot disagree about a wire name.

On this page