- Marks land on the right control (points vs pixels, OCR-tolerant names, browser pages listed) and appear as their words are spoken. - A Sparkle-style update window: what's new, Install and Relaunch / Install on Quit / Skip This Version; the update box fills while downloading. - 3D closes on a click outside, really closes, caps frames, lowers quality when slow, pauses when idle and rebuilds after a graphics reset. - Releases are signed with Pixie's own certificate so macOS keeps permissions across updates. - Dictation falls back to the clipboard; the helper gives up on slow apps; locks survive a panic. - README and site pictures drawn by Pixie's overlay; new logo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 KiB
Pixie architecture (0.8)
Pixie's code and binary are still called Pixie (identifier pixie.s41r4j.in).
┌──────────────── Pixie.app (Tauri, Rust) ────────────────┐
hold ⌃⌥ ──────▶ │ hotkey poll (20 ms) ─▶ session (voice loop) ─▶ llm::Provider ─│──▶ Claude / OpenAI /
│ │ │ tools::run (tool loop) │ DeepSeek
│ ▼ ▼ │
│ panel · overlay · shelf · guide (made at launch) │
│ settings · note · canvas (made when opened, freed on close) │
│ ▲ │ │
│ events (pixie://event) jobs (workspace, note.md) │
└─────────┬───────────────────────────┬──────────────┬─────────┘
JSON lines (stdio) unix socket stdio JSON-RPC
▼ ▼ ▼
pixie-helper (Swift) native host ⇄ extension MCP servers
Speech · AVAudioEngine · (same binary, Chrome (mcp.json)
ScreenCaptureKit+Vision · native messaging)
AVSpeechSynthesizer · AX ·
WebKit PDF · PDFKit text
pixie-voice (C, sherpa-onnx Kokoro): natural voice, loaded on demand, unloaded when quiet
Windows / Linux: no Swift helper; src-tauri/src/native/ answers the same commands in-process
(Windows: GDI capture, Windows OCR, UI Automation, SendInput, WinRT speech in and out;
Linux: grim/scrot, tesseract, xdotool, espeak-ng)
Voice turn
- ⌃⌥ down: interrupt anything in flight (barge-in), open the notch (
agent-launch), startlisten_start(on-device Speech when available, mic level meter) and, in parallel, a screenshot of the screen under the pointer with OCR lines and the frontmost window's controls (e1,e2… with frames). Our windows are excluded from capture. - ⌃⌥ up:
listen_stop→ final transcript. Empty → "didn't catch that". - Prompt (
crates/core/src/prompt.rs, golden-tested), ordered for prompt caching: tools → system prompt with only what stays the same (identity → persona → mode → policy → stable environment → plan/note → the job → final contract) → history → the newest user message, which starts withprompt::context: RIGHT NOW (time, front app, window) and, for voice, the screen description (Capture::describe_for: the 30 controls and 40 text lines that match the request or sit nearest the pointer;look full=truefor all). Questions with no screen words skip the screen (screen::about_screen). On Claude,cache_controlmarks the last tool, the system prompt and the end of history, plus automatic caching for the turn's own steps (AnthropicProvider::cache_marks). Screenshot (1280 px wide) attached when the model takes images and screen sharing is on. Usage records uncached, cache-read and cache-write tokens and prices each at its own rate (usage.rs). Jobs cap a tool result at 20k characters and stub results older than the last 6 steps from step 15, every 10 steps (agent.rs). - Streamed answer → cut at sentence ends → spoken while still streaming, by Kokoro (when
installed; it starts loading as soon as they start talking) or the system voice. For Kokoro,
Pixie writes numbers and symbols out and turns words into phonemes itself
(
pixie_voice::say, with the model's lexicon plus fallbacks), and the sidecar levels the audio to speech loudness;speak_wordevents light up words in the notch. - Tools during the turn:
highlight,draw(overlay),mac_step(AX),note/note_answer(the paper card),start_job, web, device, browser, apps, connectors,canvas(Excalidraw, used on its own when it helps; Settings → General → Drawing),memory,pixieandlook. ≤ 12 steps. Computer use over several steps (screen.rs): everymac_stepaction ends with the helper'sscreen_state(Accessibility only: app, window, focused field, controls, text), which replaceslast_captureso clicks snap to the newest screen. Control ids are Pixie's, not the helper's:screen::stabilizekeeps the same id for the same control (kind + label + frame, or the only one of its kind and label) for the whole request and reports ids that went away; on the Mac an id is pressed at its current position (press_point). - Today's chat carries on all day (last 12 turns in full, older ones summarised). The notch collapses 7 s after speech ends unless hovered.
opencode as the model
src/opencode.rs. When Settings picks opencode, opencode::run_agent replaces Pixie's tool
loop: one opencode serve (own XDG_CONFIG_HOME and OPENCODE_DB, random password, a shell
watcher that ends it with Pixie, stopped after 10 idle minutes), one session per turn or job run
with agent pixie (opencode's tools denied), Pixie's system prompt as the session's
instructions entry, earlier turns and the screenshot in the prompt. Pixie's tools are served
back over a localhost HTTP MCP endpoint with a bearer token; each call is routed by opencode's
session id to that turn's ToolCtx and run by pixie_tools::execute. Text streams from
/api/event; usage goes to usage.jsonl. OpencodeProvider answers plain text calls
(summaries, memory) through /api/experimental/generate/text.
Jobs
<app_data>/jobs/<id>/{note.md, output/, tmp/, inbox/, AGENTS.md, state.json}. The job runs
the same tool loop with the job prompt (≤ 60 steps, deeper effort), emits plan/progress/note
events, can ask_user (card turns amber, sound, toast), and ends with the report blocks
(DONE_TITLE, NEXT_ACTIONS, ARTIFACTS, LEARNED, parsed by crates/core/src/report.rs).
LEARNED lines go to <app_data>/memory.md and come back in the environment block. Follow-ups
from the note window continue the same conversation.
Hard rules in code
- Path denylist (
.ssh,.gnupg,Library/Keychains,.aws,.config/gh,.env*), checked on the literal and symlink-resolved path, before any read;bashcommands naming them are refused (crates/tools/src/guard.rs). device_save_filenever overwrites (2,3, …).write/editonly inside the job folder or temp.bash: job cwd, 300 s default timeout, 50 KB output cap.- Background jobs can't click around (
mac_steponlyopen); password fields are never typed into by the extension; secure input pauses screen capture.
Updates and experiments
updates.rs: tauri-plugin-updater againstreleases/latest/download/latest.json(minisign public key intauri.conf.json; CI signs with the repo secrets). Checks 25 s after launch and every 6 h; keeps the verified download in memory and, at a quiet moment (or at once after Check now), opens theupdatewindow (views/Update.tsx): Install and Relaunch, Install on Quit (also what closing it means), Skip This Version (rollback::skip). Notes arelatest.json's, i.e. the version's CHANGELOG section. A waiting download installs at quit.settings.experimentalholds per-feature switches:connectors, and3d(scene3d.rs: thescene3dtool, ascenewindow runningviews/Scene3D.tsxwith Three.js, lazy-loaded, drawing only while something moves). The Excalidraw canvas incanvas.rs, files in<app_data>/canvases/, graduated in 0.7.6 and replaced the old board.- Narrated drawing (
narrate.rs): marks inside the answer text ([[circle e12]],[[arrow e3 e7]],[[3d heart]]) are cut out of the stream inspeech.rs, replaced by private-use stand-ins so the sentence splitter knows their sentence, and run on that utterance'sspeak_start(at once when nothing is spoken). They go throughoverlay::highlight/overlay::draw, so they snap to the same controls as the tools. - Self-healing (
heal.rs): the logger tees to<app_data>/logs/pixie.log; a panic hook writeslogs/crash.txt, picked up on the next launch (a toast, and a problems entry); settings and memory are written withsave_safely(temp file + rename +.last-goodcopy) and read withload_safely(a damaged file is set aside as.damagedand the copy restored);heal::notekeepsissues.md;myself::checkupandopen_reportback thepixieactions checkup / issues / report and Settings → About → Health. Reports opengithub.com/s41r4j/pixie/issues/new?title=&body=in their browser, redacted (heal::redact); nothing is posted by Pixie. - Watchdogs (
watchdog.rs): every 30 s pings the helper (twice, 8 s), checks the voice server for sentences waiting 40 s with no output (kokoro::hung) and pings each connector (ping, silence only counts); a hung part is restarted, three in five minutes and it's left alone (judge). Every 5 s: the hotkey poller's heartbeat (hotkey::since_tick, a replacement poller takes over by generation) and notch modes nothing drives any more (stuck_after). Helper errors that mean a permission is off go throughwatchdog::helper_error: toast, open the pane, poll for it to come back. - Pointing (0.8.2,
overlay.rs,screen.rs,narrate.rs): numbers from the model are tried as screen points and, when it saw the screenshot, as image pixels; whichever snaps to a real control or text line wins (snap_scored). Names go throughscreen::norm(case, punctuation, OCR's I/l/1 and 0/O) and match by most of their words. Marks carry the number of words before them (narrate::placed) and fire on the voice'sspeak_wordevents two words early, so the pointer arrives as the thing is named. The helper setsAXManualAccessibilityon the front app once so Chromium and Electron build their page's Accessibility tree. - Exact clicks and asking first (0.8.1): the helper keeps each snapshot's AX elements by
generation (
gen, last 8), marks controls whose middle is outside their scroll areas, window or every screen ashidden, and answerselement(live frame, hidden, covered),scroll_to,press_element,hit_testandactivate.buddy::live_targetresolves an id to the live control before a click or press; points are clicked as given.safety.rsdecides what's risky (labels, keys, typed commands) and asks in a system dialog before it happens. - Idle cost (0.8.1): the overlay's frame loop stops once the buddy has settled on a still pointer
and
wakerestarts it (any event, or a mode leaving "follow").emitsends the fast events only where they're drawn (only_for:buddy.cursorto the overlay,mic.levelto the panel and Settings,speech.wordto the panel);onEventlistens as the current window so both the broadcast and the targeted events arrive. The poll thread sleeps 40 ms instead of 20 after 3 s with no modifier held and the pointer still (hotkey::pace). The helper'scaptureruns the JPEG, OCR and AX snapshot in parallel and returnstook_ms;sessionlogs stage times. - Pixie's speech to text (0.8.1,
crates/stt+stt.rs):ffi.rsloads sherpa-onnx's C API at runtime (structs mirror the vendored v2.0.1 header; sizes are asserted in a test). The recogniser runs as a child of the same program (pixie --stt-engine <runtime> <model>,engine.rs): audio frames in on stdin, JSON lines out, so a bad library can't crash the app and the model stays loaded for 10 minutes.stt.rsreads the microphone with cpal, resamples to 16 kHz mono, pipes it, and sends each new text tolive_type_update(Swift helper on the Mac,native::liveelsewhere), which types only the changed end (text::keystrokes).session.rspicks it withstt::wantedand falls back to the helper'slisten_*. - Canvas kit (0.8.1,
canvas_kit.rs):canvasdraw withmakeis laid out in Rust into plain Excalidraw skeletons (pure, unit-tested), then drawn like any elements.editis applied in the window (applyChangesinCanvas.tsx);[[canvas id]]marks go throughnarrate.rstocanvas::focus. - 3D (0.8.1,
Scene3D.tsx,scene3d.rs):sanitizebounds everything the window draws. Each object is a pivot group (parts nest byparent); copies are one InstancedMesh. Frames are drawn on demand (at most 60 a second); shadows update only on frames where something moved. Since 0.8.2 the window is destroyed on close (not hidden), drops quality after 30 slow frames (past the first 10, which compile shaders), pauses motion after 60 s untouched, and rebuilds fromscene3d_getafterwebglcontextrestored. - Locks (0.8.2,
pixie_core::sync::LockOk):lock_ok()instead of.lock().unwrap(), so a panic while a lock is held doesn't make every later lock panic too. - App ID (
rename.rs): up to 0.8.0 the ID wascom.openclicky.app; since 0.8.1 it'spixie.s41r4j.inand the program ispixie.move_datarenames the old data folder to the new one before anything opens it and leaves a symlink (a junction on Windows) at the old path; the browser bridge removes the old host registration. - Rollback (
rollback.rs, macOS):keep_currentcopies the bundle to<app_data>/previousbeforeupdate.install;launches.jsoncounts launches that end within a minute without Quit; the third in a row on the version an update brought swaps the copy back from a detached shell after Pixie exits, andskip-versionkeeps the updater from offering it again. - Agents' processes (
pixie_tools::children):bashand coding agents spawn in their own process group, listed in<app_data>/agents.pids; dropped guards end a stopped command's whole group, Quit ends all, and the helper ends the listed groups when its stdin closes. - Several screens (0.8.0):
panel::pinned_screen/home_screenplace the notch by thenotch_screensetting;AX.snapshotwidens its screen filter to the front window's frame when the window crosses the edge;lookin Live mode defaults todisplay=window; the capture lists the front app's off-screen windows (AX.elsewhere), used only bysession::desktops_line. - Type as you speak (
LiveTyperin the helper):listen_start live_typechecks a text field has focus; each partial is diffed against what's typed (backspaces, then unicode key events from a private event source so held dictate keys don't apply);live_type_finishswaps in the tidied text; a focus change stops it. - Several screens (
screen.rs):displays()lists named screens (a main-thread hop, no capture);screens_lineadds one RIGHT NOW line only when there's more than one;look display=…resolves a screen and the helper'scapturetakes anatpoint. - Personalities:
settings.personaadds a STYLE block after the identity inprompt.rs(Pix adds nothing; jobs never get one); faces arebrand-face-*icons, read bylib/persona.ts.
Decisions (simplest behaviour-preserving option; what's next)
| Topic | Choice | Next |
|---|---|---|
| Native APIs | Swift helper sidecar over JSON lines on macOS; in-process native layer on Windows/Linux | none |
| STT / TTS | Apple Speech on-device; Kokoro (local) or the system voice for answers | Streaming cloud STT/TTS adapters |
| Models | Anthropic Messages for Claude and DeepSeek, an OpenAI client, live model lists with prices | none |
| Hotkey | Polling CGEventSourceFlagsState (no permission needed) |
Event tap to swallow keys |
| Notch window | Transparent borderless NSWindow over the menu bar; click-through except the drawn shape (hit.rs) |
NSPanel subclass |
| Web search | DuckDuckGo HTML, Bing fallback (no key) | Pluggable search API |
| Browser | chrome.scripting + DOM refs; the app binary doubles as native host |
CDP for trusted input; Windows registration |
| Connectors | MCP stdio servers from mcp.json, plus a gallery |
HTTP transport + OAuth sign-in UI |
| Memory | Webviews only for windows in use; voice model unloads after 5 quiet minutes | none |
See ROADMAP.md for what's open.
Tests (npm test)
note DSL parser · report parser · prompt goldens per mode · path denylist + never-overwrite · tool loop against a scripted provider · SSE accumulator · provider config · MCP client against a fake stdio server · native-messaging framing · notes ops · web parsing · hotkey chords · sentence splitter · dotenv · skills loader · resource slots · audio bus.