Quark
Quark is a small coding agent you run as a desktop app. It is written in Rust on GPUI, the UI framework behind the Zed editor, and it is inspired by pi. It reuses pi's sign-in file and keeps its threads where pi keeps its own.
First run
cd your-project
quark
Quark works in the directory you start it from. Every tool call, shell command, and file path is relative to it. The sidebar shows the folder name, the git branch, and whether you're signed in.
Type a request and press Enter. The agent streams its answer, calls tools as it needs them, and shows each tool result in the thread.
The window
| Area | What it holds |
|---|---|
| Sidebar | New thread button, saved threads for this folder, workspace and connection status. Ctrl B hides it. |
| Top bar | Thread name, branch, and buttons for branches, shortcuts, settings, and theme. |
| Thread | Your messages on the right, the agent's replies, tool results, and shell output. |
| Composer | Prompt input, then model, context tier, effort, context used, and Send. |
Tool results show a green dot on success and a red one on failure. Edits show a colored diff. Ctrl O collapses tool output to one line each.
Models, context, and effort
Open the picker with Ctrl K, or click the model name in the composer. It has three controls.
Context. Most models come with a short and a long context window. Short is the default. Long raises the window to roughly 1M tokens. Ctrl W switches without opening the picker.
Effort. How hard the model reasons before it answers. The picker lists only the levels the selected model accepts, for example low through max for Claude models, or none through max for some GPT models. Ctrl T steps to the next level.
Model. Each row shows the model's context size for the window you picked, and its rate.
/session prints the current thread's token count and cost.
Tools
The agent can call seven tools.
| Tool | Arguments | Notes |
|---|---|---|
read | path, offset, limit | Line-numbered output, 2,000 lines per call by default |
write | path, content | Creates parent folders |
edit | path, edits[{oldText,newText}] | Each oldText must match exactly once. Returns a unified diff. |
bash | command, timeout | Runs bash -lc in the project folder. 120 s default timeout. |
grep | pattern, path, glob, ignoreCase, literal, limit | Regex search. Skips hidden files and anything in .gitignore. |
find | pattern, path, limit | Glob match on file paths. *.rs matches at any depth. Same skips as grep. |
ls | path, limit | Sorted listing, folders end in / |
Output over 48 KB is truncated. The agent stops after 16 rounds of tool calls in one turn.
Tools run with your user's permissions, like any program you start. To isolate them, run Quark in a container.
Sessions
Each thread is a JSONL file in ~/.pi/agent/sessions/--<folder>--/, modeled on pi's version 3 session format. Every entry points to its parent, so a thread is a tree, not a list.
/treeor Branches shows the tree. Click an entry to continue from that point. New messages start a new branch, and the old one stays./resumeor the sidebar opens an older thread.quark -creopens the most recent thread for the folder./namesets a title./compactmarks a compaction point./exportwrites a standalone HTML copy.
Slash commands
Type / in the composer to see matching commands. Tab completes.
| Command | Action |
|---|---|
/model [id] | Open the picker, or switch to id |
/context [short|long] | Switch context tier |
/thinking [level] | Set or cycle effort |
/tree | Branch navigator |
/resume | Show saved threads |
/new | New thread |
/name <title> | Rename thread |
/session | Thread id, entries, tokens, cost, file path |
/export [path] | Export to HTML |
/compact | Record a compaction boundary |
/copy | Copy the last reply |
/theme [dark|light] | Switch theme |
/settings | Settings |
/hotkeys | Shortcut list |
/login | Auth status |
/quit | Quit |
Start a line with ! to run it as a shell command without involving the model, for example !git status.
Keyboard shortcuts
On macOS, Cmd works wherever Ctrl is listed.
| Key | Action |
|---|---|
| Enter | Send |
| Shift Enter | New line |
| Tab | Complete a slash command |
| ↑ ↓ | Prompt history |
| Ctrl K | Model, context, and effort |
| Ctrl W | Short or long context |
| Ctrl T | Next effort level |
| Ctrl P | Next model |
| Ctrl N | New thread |
| Ctrl B | Show or hide the sidebar |
| Ctrl O | Collapse or expand tool output |
| Ctrl U | Clear the prompt |
| Ctrl V | Paste |
| Esc | Close a dialog, or stop the reply |
Command line
quark [OPTIONS] [PROMPT]...
| Option | Default | Meaning |
|---|---|---|
-p, --print | Run the prompt, print the answer, exit | |
--mode <m> | interactive | interactive, text, json, or rpc |
--model <id> | gpt-4.1 | Model id. Falls back to the first available model. |
--context <tier> | short | short or long |
--thinking <level> | medium | Effort level |
--provider <id> | auto | github-copilot, openai, or openrouter |
--theme <t> | dark | dark or light |
-c, --continue | Continue the latest thread | |
--session <file> | Open a specific JSONL file | |
--no-session | Don't save anything | |
--cwd <dir> | current dir | Working folder |
--overlay <name> | Open model, tree, settings, or hotkeys on start |
JSON mode
--mode json prints one JSON object per line:
{"type":"text_delta","delta":"OK"}
{"type":"tool_start","id":"call_1","name":"read","args":{"path":"Cargo.toml"}}
{"type":"tool_done","id":"call_1","name":"read","isError":false,"output":"..."}
{"type":"done"}
Other types: thinking_delta, error.
RPC mode
--mode rpc reads one JSON command per line on stdin:
| Command | Reply |
|---|---|
{"type":"get_state"} | {"type":"state","sessionId":...,"model":...,"modelsCount":...} |
{"type":"new_session"} | {"type":"session_created","sessionId":...} |
{"type":"prompt","message":"..."} | The same event stream as JSON mode |
Authentication
Quark tries these in order and uses the first that works:
github-copilotin~/.pi/agent/auth.jsongithub-copilotin~/.local/share/opencode/auth.jsonCOPILOT_GITHUB_TOKENOPENAI_API_KEY, with optionalOPENAI_BASE_URLOPENROUTER_API_KEY
For a GitHub token, Quark exchanges it for a short-lived API token, takes the API host from that token, and caches it back in ~/.pi/agent/auth.json. Requests carry the same editor headers as the VS Code Copilot extension.
Context length and effort levels come from the provider's model list. With OpenAI or OpenRouter keys Quark uses a small built-in model list.
Files Quark touches
| Path | Read | Write |
|---|---|---|
~/.pi/agent/auth.json | yes | refreshed API token |
~/.local/share/opencode/auth.json | yes | no |
~/.pi/agent/sessions/ | yes | one JSONL per thread |
AGENTS.md, CLAUDE.md in the project | yes, added to the system prompt | no |
| Project files | through tools | through tools |
Set PI_CODING_AGENT_DIR to move ~/.pi/agent.
Architecture
Eight files. A prompt goes from the window (or the command line) to agent, which streams the model's reply, runs the tools it asks for, sends results back, and repeats until the model is done. Each message is appended to the thread file by session.
Core, 1,337 lines. Everything a coding agent needs. Counts leave out tests.
| File | Lines | What it does |
|---|---|---|
agent.rs | 230 | Builds the system prompt, streams replies over SSE, runs tools, loops until the model stops calling them |
auth.rs | 237 | Finds credentials, exchanges tokens, reads the model list and context windows |
tools.rs | 278 | The seven tools and their JSON schemas |
session.rs | 338 | Reads and appends thread files, builds the branch tree, exports HTML |
cli.rs | 201 | Flags, and the print, JSON, and RPC modes |
main.rs | 53 | Starts a headless mode, or opens the window and loads the fonts |
Interface, 2,461 lines. The desktop window.
| File | Lines | What it does |
|---|---|---|
ui.rs | 2,329 | Sidebar, thread, markdown and diff rendering, composer, picker, dialogs, squircle drawing |
theme.rs | 132 | Dark and light colors |
The interface is expected to grow. The core is meant to stay about this size.
The window runs on GPUI's main thread. Network and tool work runs on a Tokio runtime, and events come back through a channel, so the window never blocks on the network.
Footprint
Measured on one Linux x86_64 machine (4 cores, 32 GB). Idle memory is PSS summed over the process tree, 8 seconds after launch with no prompt, median of 3 runs.
| Kind | Install size | Main binary | Idle memory | |
|---|---|---|---|---|
| Quark 0.2.0 | GPU desktop app | 32 MB | 32 MB | 134 MB |
| Codex 0.172.0 | Terminal UI | 449 MB | 321 MB | 141 MB |
| OpenCode 2.3.2 | Terminal UI | 1,016 MB | 253 MB | 178 MB |
| T3 Code 0.1.12 | Web / desktop | 508 MB | 174 MB | not measured |
Quark ran on software Vulkan because the machine has no GPU, which raises its memory. The terminal apps' numbers leave out the terminal emulator.
To reproduce, run bench.sh once per tool:
Xvfb :97 &
DISPLAY=:97 docs/bench.sh quark 8 quark --no-session
docs/bench.sh codex 8 codex
docs/bench.sh opencode 8 opencode
Install size is du -sb of the installed package folder.
Troubleshooting
unable to find library -lxkbcommon-x11 when building. Install libxkbcommon-x11-dev (Debian/Ubuntu) or the equivalent for your distro.
pkg-config command could not be found. Install pkg-config, or set RUST_FONTCONFIG_DLOPEN=1.
The window opens but stays blank. Your Vulkan driver is missing. Install mesa-vulkan-drivers. On headless machines, VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json uses the software renderer.
Offline in the sidebar. No credentials were found. See Authentication.
API error 400 about the model. Your plan doesn't include that model. Pick another with Ctrl K.