A PWA for the pi coding agent running on spark: browse every session (CLI or app), continue them with live streaming, start new ones, switch models and thinking levels, watch context usage, use slash commands, and @-mention files. Styled after thatsit.dev.
hub/: Node server on spark. Runs one headlesspi --mode rpcper open session, serves REST + SSE, accepts only your Tailscale identity from the app's origin. Zero runtime dependencies; runs.tsdirectly on Node ≥ 22.18.app/: Vite + Lit PWA (static; deploys to pi.thatsit.app).shared/: wire types and the conversation reducer both sides use.- Design:
docs/superpowers/specs/2026-10-10-pi-web-design.md.
npm install
mkdir -p .dev-data && cat > .dev-data/config.json <<'JSON'
{ "port": 7878, "hostname": "localhost:5173", "allowedLogin": "dev@local", "dev": true }
JSON
npm run dev -w hub # hub on 127.0.0.1:7878, using your real ~/.pi/agent sessions
npm run dev -w app # app on http://localhost:5173 (proxies /api and plays tailscale serve)From another machine: ssh -L 5173:localhost:5173 spark-713a, then open
http://localhost:5173.
npm test # shared + hub + bridge (node:test, real pi against a fake model) + app (vitest)
npm run typecheck
npm run e2e -w app # Playwright: desktop + phone flows against the real hubTests never touch ~/.pi/agent: every pi they start gets a temporary
PI_CODING_AGENT_DIR with a fake OpenAI-compatible model. The e2e hub also
uses a temporary PI_WEB_DATA_DIR (port 7898).
~/.config/pi-web/config.json (created on first start):
{
"port": 7878,
"hostname": "spark-713a.tail9274fa.ts.net:7878",
"allowedLogin": "michaelthatsit@github",
"allowedOrigins": ["https://pi.thatsit.app"],
"idleMinutes": 20,
"maxHeadless": 6,
"piBin": "pi",
"approvalMode": "auto",
"push": true
}idleMinutes: an idle headless pi is closed after this long; a session with a live preview is kept, since the preview server runs in that process.
push turns the hub's Web Push alerts (a finished turn, a dialog that needs you, a ring question) on or off; the phone mirrors them to the watch. It is Web Push only. The older watchAlert: "off" still loads as push: false.
approvalMode is the approval mode new app-started sessions begin in; the session settings sheet in the app (the sliders next to the model) changes it per session. While a turn is running, the hub answers a permission extension's Allow/Deny select (picking Allow) or yes/no confirm itself, so the agent keeps going with the app closed:
auto: for every tool call.semi: only for obviously benign calls: reading, listing or searching inside the session folder, writing or editing a file inside it, or a read-only shell command (ls,cat,grep,git status, …). Everything else asks in the app.manual: never; every flagged call asks in the app.
Dialogs outside a running turn, inputs, and selects without an allow option always reach the app.
Settings → hub → "check for updates" asks the hub where its checkout stands against origin/master; "update & restart" runs git pull --ff-only origin master and npm install in the checkout and exits, and the systemd unit (Restart=always) brings it back on the new code. The hub refuses while a session is mid-turn, unless you choose "update anyway", and when the checkout has local changes. Only the hub updates this way; the app itself deploys from Cloudflare Pages on every push to master.
A pi started in a terminal shows up live in pi-web when it loads the bridge extension in bridge/. Load it for one run:
pi -e ~/workspace/pi-web/bridge/index.tsOr load it for every run:
pi install ~/workspace/pi-web/bridgeThe bridge connects to the hub at ~/.config/pi-web/bridge.sock. Set PI_WEB_BRIDGE_SOCKET to use another socket, for example .dev-data/bridge.sock for npm run dev -w hub. If the hub isn't running, the bridge waits quietly and connects when it starts.
From the app you can watch the terminal session stream, prompt, steer and queue follow-ups, switch the model and thinking level, compact, and rename. Fork, clone, !bash, export and extension commands stay in the terminal, and extension dialogs show as "waiting for you in the terminal". If the app is running a reply in headless pi when you resume that session in a terminal, the terminal is told to wait. When the reply finishes, the terminal is told the session is free: /resume it there to continue with the latest messages. The same goes for a session open in another terminal, once that terminal quits or moves on.
pi can show an image in the conversation with its show_image tool: give it the path of a PNG, JPEG, GIF or WebP file (up to 2 MB, checked by content, not extension). The app shows it as a figure in the reply. Images load by reference: messages and history carry only a reference, and the app fetches the bytes when the figure scrolls into view. The show-image skill in bridge/skills tells pi when to use the tool.
Pi can open a live preview in the app with its preview tool: preview({ cwd }) serves an app checkout (live reload), preview({ dir }) a folder, preview({ file }) one file, preview({}) returns the scratch folder for mockups, and preview({ stop: true }) closes it.
Previews are tailnet-only, one per session, and stop when the session ends.
The progress panel shows the session's goal, plan, to-dos and subagents. On desktop (1200 px and up) it's a right-hand column. On the phone it's a header badge that opens a full-screen view, or swipe in from the right edge. Tapping a subagent opens its thread read-only. The hub serves this data through read-only routes: /api/sessions/:id/goal, /plan, /subagents and /subagents/:key/history. The plan section depends on agents ticking the checkboxes as they go; that instruction lives in ~/.pi/agent/AGENTS.md, outside this repo.
- To-dos:
todoresults from rpiv-todo. - Subagents:
subagentresults from pi-subagents, plusstatus.jsonfor background runs. - Goal:
goal-statesession entries, when an extension writes them (pi-goal was removed on 2026-11-25; the section stays empty without one). - Plan: the most recent
docs/superpowers/plans/*.mdthe agent read or edited.
The thatsit-app pi skill builds small PWAs at <name>.thatsit.app from the app template and turns later changes into PRs with preview links. See skills/thatsit-app/README.md for install and usage.
Turn notifications on in settings. A device then gets a push when one of pi-web's headless sessions finishes a run with no app open on it, waits on a dialog, or stops with an error. Tapping the notification opens the session. Terminal sessions don't notify, because you are at the terminal.
On iPhone or iPad, add pi-web to the Home Screen first (Share → Add to Home Screen) and turn notifications on from the installed app. Safari tabs can't receive push.
The hub keeps its push keys in ~/.config/pi-web/vapid.json and the subscribed devices in ~/.config/pi-web/push.json. Deleting vapid.json makes new keys. Each device then re-subscribes the next time it opens pi-web.
The hub has an API for a Pebble watch. It offers queries: pi's approval dialogs, and questions that local services such as ring-profile raise through a loopback API on 127.0.0.1:7879. It also lists the sessions, takes answers, skips and prompts, and receives voice notes from an Index 01 ring. It is open to anything on the tailnet logged in as you, with no extra token, so the phone and the ring need only the hub's address. When the watch app is closed, push (above) turns the Web Push that carries a new query or a finished turn to the wrist on or off. See docs/watch-api.md for the routes and curl examples, and the watch UI spec for the design.
The watch side is in watch/: one Pebble Alloy watchapp for the Pebble Time 2 (emery), watch/app/, built on the pebble-ui library, with a phone-side PebbleKit JS bridge to the hub. It has three screens: the session list, a session's last reply, and a query answered from an action menu. A ring note answers the query on screen or prompts the open session. watch/README.md covers the toolchain, the emulator dev loop against a stub hub or the real hub, the Pebble app setup (the hub URL and theme are set in the app's settings page), the hardware checklist and the known issues. watch/PROTOCOL.md has the phone-to-watch messages.
The app is a Cloudflare Pages project (pi-web) connected to this repo. A push
to master builds npm run build -w app (Node 24) and publishes app/dist to
https://pi.thatsit.app; other branches get preview deployments.
Starting a new session with a preselected model is not in Plan 1: start the session, then switch via the model sheet.
The hub runs as a systemd user unit, exposed on the tailnet by tailscale serve:
npm install # once, and after pulling new dependencies
systemctl --user link ~/workspace/pi-web/deploy/pi-web-hub.service
systemctl --user enable --now pi-web-hub.service
sudo loginctl enable-linger $USER # keep it running without a login session
tailscale serve --bg --https=7878 http://127.0.0.1:7878After pulling hub changes, systemctl --user restart pi-web-hub. Restarting
closes any running app-started pi sessions (their history is kept). Logs:
journalctl --user -u pi-web-hub.