labs Quark

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

AreaWhat it holds
SidebarNew thread button, saved threads for this folder, workspace and connection status. Ctrl B hides it.
Top barThread name, branch, and buttons for branches, shortcuts, settings, and theme.
ThreadYour messages on the right, the agent's replies, tool results, and shell output.
ComposerPrompt 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.

ToolArgumentsNotes
readpath, offset, limitLine-numbered output, 2,000 lines per call by default
writepath, contentCreates parent folders
editpath, edits[{oldText,newText}]Each oldText must match exactly once. Returns a unified diff.
bashcommand, timeoutRuns bash -lc in the project folder. 120 s default timeout.
greppattern, path, glob, ignoreCase, literal, limitRegex search. Skips hidden files and anything in .gitignore.
findpattern, path, limitGlob match on file paths. *.rs matches at any depth. Same skips as grep.
lspath, limitSorted 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.

Slash commands

Type / in the composer to see matching commands. Tab completes.

CommandAction
/model [id]Open the picker, or switch to id
/context [short|long]Switch context tier
/thinking [level]Set or cycle effort
/treeBranch navigator
/resumeShow saved threads
/newNew thread
/name <title>Rename thread
/sessionThread id, entries, tokens, cost, file path
/export [path]Export to HTML
/compactRecord a compaction boundary
/copyCopy the last reply
/theme [dark|light]Switch theme
/settingsSettings
/hotkeysShortcut list
/loginAuth status
/quitQuit

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.

KeyAction
EnterSend
Shift EnterNew line
TabComplete a slash command
↑ ↓Prompt history
Ctrl KModel, context, and effort
Ctrl WShort or long context
Ctrl TNext effort level
Ctrl PNext model
Ctrl NNew thread
Ctrl BShow or hide the sidebar
Ctrl OCollapse or expand tool output
Ctrl UClear the prompt
Ctrl VPaste
EscClose a dialog, or stop the reply

Command line

quark [OPTIONS] [PROMPT]...
OptionDefaultMeaning
-p, --printRun the prompt, print the answer, exit
--mode <m>interactiveinteractive, text, json, or rpc
--model <id>gpt-4.1Model id. Falls back to the first available model.
--context <tier>shortshort or long
--thinking <level>mediumEffort level
--provider <id>autogithub-copilot, openai, or openrouter
--theme <t>darkdark or light
-c, --continueContinue the latest thread
--session <file>Open a specific JSONL file
--no-sessionDon't save anything
--cwd <dir>current dirWorking 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:

CommandReply
{"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:

  1. github-copilot in ~/.pi/agent/auth.json
  2. github-copilot in ~/.local/share/opencode/auth.json
  3. COPILOT_GITHUB_TOKEN
  4. OPENAI_API_KEY, with optional OPENAI_BASE_URL
  5. OPENROUTER_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

PathReadWrite
~/.pi/agent/auth.jsonyesrefreshed API token
~/.local/share/opencode/auth.jsonyesno
~/.pi/agent/sessions/yesone JSONL per thread
AGENTS.md, CLAUDE.md in the projectyes, added to the system promptno
Project filesthrough toolsthrough 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.

FileLinesWhat it does
agent.rs230Builds the system prompt, streams replies over SSE, runs tools, loops until the model stops calling them
auth.rs237Finds credentials, exchanges tokens, reads the model list and context windows
tools.rs278The seven tools and their JSON schemas
session.rs338Reads and appends thread files, builds the branch tree, exports HTML
cli.rs201Flags, and the print, JSON, and RPC modes
main.rs53Starts a headless mode, or opens the window and loads the fonts

Interface, 2,461 lines. The desktop window.

FileLinesWhat it does
ui.rs2,329Sidebar, thread, markdown and diff rendering, composer, picker, dialogs, squircle drawing
theme.rs132Dark 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.

KindInstall sizeMain binaryIdle memory
Quark 0.2.0GPU desktop app32 MB32 MB134 MB
Codex 0.172.0Terminal UI449 MB321 MB141 MB
OpenCode 2.3.2Terminal UI1,016 MB253 MB178 MB
T3 Code 0.1.12Web / desktop508 MB174 MBnot 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.

View this page's source on GitHub