Skip to content
qqthe agent runtime
DocsCLI reference

CLI reference

Every qq command and flag.

qq --help and qq <command> --help are authoritative; this page is the map.

Accepted by every command:

FlagEffect
--model PROVIDER/MODELoverride the configured route for this invocation
--max-output-tokens Noverride the generation cap
--organization NAMEselect an enrolled organization manifest
--approve-self-contained-read-image FAMILY:SHA256attest exact self-contained native read behavior for progress/audit accounting; repeat for up to ten families
-V, --versionqq 0.1.10 (b07fa9f 2026-10-30)

Read-image approvals are process-start host decisions for ask, run, serve and interactive execution. The flag attests read behavior for admitted argv/stdin in a C/POSIX or unset locale, independent of HOME/TERM and without executable helpers or configuration-driven code. Approvals remain immutable through profile, child and cached plans. Existing-server attachment and the isolated TUI QA fixture reject nonempty approvals explicitly.

Verified reads currently require literal Linux exec, an approved self-contained static native image, a held workspace cwd and sealed image binding. Supported families are cat, head, tail, wc, grep, nl, cut, pwd, echo and uniq. Other process contexts count as Work. Ordinary approval policy still controls execution; built-in reads keep their existing accounting. See ADR-0060 for the host contract and receipt boundary.

InvocationEffect
qqopen the TUI in the current directory; start a new session
qq --session IDopen the TUI on an existing session of this workspace
qq --tui-qa-root PATHisolated, credential-free diagnostic fixture (../runbooks/tui-qa.md)

Requires a terminal on stdin and stdout; in a pipe use qq ask or qq run.

One streamed answer with workspace read tools and the MCP tools a server’s allow lists; no approval questions or persisted session. Headless.

One unattended agent task. Headless.

FlagDefault
--workspace PATHcurrent directory
--session IDnew session
--approval read-only|ask|auto|fullauto
--profile NAMEdefault
--steer-stdinstdin unread
--timeout-seconds N, --max-turns N, --max-cost-usd Vunlimited
--correlation KEY=VALUEnone; ≤ 8
--output-schema PATH, --output-repair-turns Nnone; 2
--format text|jsonltext
--trace PATHnone

Exit codes: 0 completed · 1 task failed · 2 invalid configuration · 3 timeout or budget · 4 harness failure · 5 needs input · 130 interrupted.

qq serve [--bind ADDR] [--allow-origin ORIGIN]…

Section titled “qq serve [--bind ADDR] [--allow-origin ORIGIN]…”

The user-scoped server in the foreground. Default bind 127.0.0.1:0. The same server as qq daemon run. Headless.

The per-user daemon: one background qq that owns the session store and serves clients until it is stopped. Headless.

SubcommandBehavior
run [--bind ADDR] [--allow-origin ORIGIN]…serve in the foreground until stopped, SIGTERM or Ctrl-C
run --detachstart in the background and return once it serves; report an already running daemon instead
statusprint the running daemon’s address, pid, version and log path; exit 1 when none runs
stopask the daemon to stop and wait until it has closed the store, also when it is already stopping
restart [--bind ADDR] [--allow-origin ORIGIN]…stop, then start this binary with --detach
SubcommandPrints
pathsglobal config dir, global config.ron, global tui.ron, data dir, managed dir, organizations file and cache; each path ends in (exists) or (missing)
sourcesevery file consulted in precedence order, and pending trust: lines
checkconfiguration is valid (model: …) or the first error; exit 1 on error
showthe merged configuration with secrets redacted, then TUI settings
explain FIELDwhich source set FIELD: model, organization, worker_model, delegation, audit, approval_timeout, retention, reasoning_effort, max_output_tokens, provider.NAME, profile.NAME, tui.theme, tui.bindings.ACTION
SubcommandEffect
login PROVIDER [--profile NAME] [--oauth] [--device-auth] [--allow-file]store a credential for a built-in provider (openai, anthropic, google, xai, openai-codex); prompts without echo, or reads stdin when piped; --oauth is for xai; openai-codex uses the loopback browser flow by default and --device-auth prints a code for a browser on any device
set NAME [--kind KIND] [--endpoint URL] [--allow-file]store an arbitrary named secret for Stored("NAME")
listevery stored credential: name, backend, kind, endpoint
status NAMEmetadata for one credential
logout NAMEremove one

--allow-file permits a user-only plaintext file when no OS keyring exists.

Connect to the one declared MCP server NAME (starting its process or contacting its endpoint, with only that server’s credential resolved), list its tools, and print one JSON object: server, digest, configured_pin, matches_pin (null without a pin), a warning that the descriptors are untrusted, and tools with each name, description, input_schema, and hints. No tool is called and nothing is written; the digest is what pin takes (MCP servers). Exit 1 when the server is not configured, cannot be reached, or does not answer within 45 s.

Connect to every declared MCP server (starting their processes or contacting their endpoints, each with its own credential), list their tools, and print one JSON object with a warning and servers. Each server has a server name, a state (ready, needs_auth, unavailable, or quarantined), the exact reason (null when ready), configured_pin, the observed digest when it listed, and for ready servers the tools names. Descriptions are not printed; use qq mcp inspect NAME to review them. No tool is called and nothing is written. Exit 1 only when configuration does not load or the whole check exceeds 45 s. An unhealthy server is reported, not an error.

Accept the sensitive sections of the project configuration found from the current directory, printing what was accepted. Permissions.

Is QQ ready to run here? One line per check, each ok, warn, fail, or skip, with the remedy indented under anything that is not ok. Exit 0 when nothing fails, 1 otherwise; warnings do not fail the run. Everything is local: files, environment, the credential store, and a loopback probe of the discovery file. No provider is contacted and nothing is written.

Checkok meansOtherwise
configurationevery layer parses and validatesfail with the parse or policy error; warn when project files await trust
project trustno project file is pendingfail listing each file and the sections it declares; qq trust
modela route is selected (--model, QQ_MODEL, or a file)fail naming your global config.ron; skip when configuration did not load
credentialthe model’s provider resolves a credential: stored PROVIDER/default (OS keyring), environment VAR, an AWS chain input, or none requiredfail with qq auth login PROVIDER / the environment variable; skip when there is no model
credential storethe store index reads; N stored (keyring)warn when the index cannot be read
mcpnone declared, or every declared HTTP server’s bearer resolveswarn naming the server, the credential problem, and its remedy (qq auth set NAME, export the variable); runs proceed without that server; skip when configuration did not load
serverrunning at ADDR (pid, version) or none running; qq starts one on demandwarn when the discovery state is unreadable
workspacethe current directory resolves; lists .qq/config.ron and AGENTS.md when presentwarn without an AGENTS.md; fail when the directory does not exist
environmentalways ok; says whether QQ is on the host or in a container, and that commands run as your user with that machine’s network and credentials—
snapshotsthe workspace is in a Git work tree, so qq undo can restore each runwarn outside Git, when git cannot run, or when Git is older than 2.32
datathe data directory is private and writable; shows sessions.sqlite3 and its sizefail when it is not a directory, world-readable, or read-only

--json prints one object: { "version": { "qq", "protocol", "capabilities", "descriptor", "store_schema" }, "checks": [ { "name", "status": "ok|warn|fail|skipped", "summary", "details": [...], "remedy": null|"..." } ], "failed": N } (details is omitted when empty).

qq init [--project] [--model PROVIDER/MODEL] [--force]

Section titled “qq init [--project] [--model PROVIDER/MODEL] [--force]”

Write a commented starter config.ron with the model sessions start with, then print the path and the next command:

wrote /home/you/.config/qq/config.ron (model: openai/gpt-5.6)
next: qq auth login openai # or export OPENAI_API_KEY
then: qq
FlagEffect
nonewrite <global>/config.ron (the directory qq config paths lists as global), created user-private
--projectwrite .qq/config.ron in the current directory instead; the output adds note: run qq trust so this project's model is loaded
--model PROVIDER/MODELuse this route; without it, and with a terminal on stdin, qq init lists the built-in providers and reads a number or a full route. Without a terminal it fails with pass --model PROVIDER/MODEL
--forcereplace an existing file; otherwise … already exists; pass --force to overwrite and the file is untouched

The next-step line names qq auth login PROVIDER and the API-key variable for the built-in HTTP providers, the browser sign-in for openai-codex, the AWS credential chain for bedrock, and a providers: declaration for any other name. The written file is validated through the same loader as every other command; a route that names an unknown provider is reported with the path so you can edit it or rerun with --force.

Organization manifests: a RON document fetched over HTTPS and layered beneath your global config.

SubcommandEffect
enroll NAME URLfetch and cache
listenrolled names without network
use NAMEmake one the default (--organization / QQ_ORGANIZATION override)
refresh NAMErefetch, keeping the last good copy on failure
remove NAMEforget it

Restore the workspace to how it was before a run changed it. Before a run first edits a file or runs a command that may write, QQ records the working tree, untracked files included, as a hidden Git commit under refs/qq/snapshots/. The last 50 per repository are kept, and with retention_days set, none older than that.

Runs in child sessions you create take their own snapshots. A spawned sub-agent skips its snapshot only when a sponsoring run or one of its sponsors already has a snapshot for the same workspace; undoing that run also reverts the sub-agent’s edits.

Terminal window
qq undo # restore the newest run's snapshot for this directory
qq undo --list # list snapshots, newest first
qq undo 3f9a # restore one by name or unique prefix

Before restoring, qq undo records the current state and prints the qq undo NAME that brings it back. Only files under the workspace are restored; the index, stash, commits and branches are left alone, and qq undo says so when HEAD has moved since the snapshot. Not covered: ignored files, untracked files over 16 MiB, anything outside the workspace, and anything outside a Git work tree, which gets no snapshot. Exit 0 on success, 2 when there is no matching snapshot, 1 on a Git failure. Snapshots need Git 2.32 or newer; with an older Git, qq undo refuses.

qq undo works on the files directly and does not check for running agents. The TUI’s /undo goes through the server instead, which refuses while a run is active or queued.

Fork before the Nth user prompt (default: the newest prompt). The new session inherits the preceding conversation and runs in a separate Git worktree with the preceding checkpoint’s files. The original conversation and checkout are unchanged. The command prints the new session id, worktree, selected prompt and how to open it. It uses the running server, or opens the local session store when no server is running. Fork requires a retained Git checkpoint; it does not fall back to editing the source checkout.

File-changing model turns capture a checkpoint after their tools finish. Turn diffs use a baseline taken before that turn’s first mutation, so external edits between turns are not attributed to QQ. Capture runs beside the next model request; the next mutation waits for it. The last 200 turns’ refs are kept per session, plus fork pins, with the same exclusions as undo.

Version plus the compatibility contracts this build speaks: protocol, capabilities, descriptor, store schema.

See Configuration › Environment variables.