Environment variables
Environment variables matter when you run Qube from source or self-host the web server. The installed desktop app is configured almost entirely through its in-app Settings screen, and most people never touch these.
Environment variables matter when you run Qube from source or self-host the web server. The installed desktop app is configured almost entirely through its in-app Settings screen, and most people never touch these.
In development, Next.js loads variables from .env.local (copy the provided
.env.example as a starting point). In a desktop build, the release pipeline
bakes the connector key into an env.json next to the server; everything else
can be set in the app.
Variables you are most likely to need
| Variable | Purpose |
|---|---|
COMPOSIO_API_KEY | Key for connected apps. Required when building from source; released desktop builds already embed a built-in key, and you can also set your own in Settings → Advanced → Composio API Key. Get one at the Composio dashboard. |
QUBE_DATA_DIR | Directory for durable state (.memory/, .agents/, browser profiles, logs, SQLite). Defaults to the current working directory in source runs; the desktop app points it at the application data directory. |
WORKSPACE_PATH | Absolute path to the file workspace. Defaults to ./workspace under the working directory (a legacy ./playground folder is used if it already exists). Hard Reset deletes the workspace only when it lives inside QUBE_DATA_DIR; remove an external path separately. |
WORKSPACE_DIR_NAME | Folder name for the workspace when WORKSPACE_PATH is not set (default workspace). |
LWC_SECRET | Secret used to sign ChatGPT sign-in session cookies. If unset, Qube generates and persists one in .memory/lwc-secret.txt, so this is mainly needed for stable multi-deploy hosting. Generate with openssl rand -hex 32. |
PORT | Port for the local web server (the dev script uses 3010; the desktop sidecar defaults to 3010). |
ChatGPT sign-in
| Variable | Purpose |
|---|---|
LWC_SECRET | Signing secret for session cookies (see above). Rotating it signs everyone out. |
LWC_CLIENT_VERSION | Pins the Codex client version used for ChatGPT model discovery. By default Qube tracks the latest @openai/codex release automatically; only pin it if discovery misbehaves. |
LWC_DEFAULT_MODEL | Fallback ChatGPT model for requests that don't name one. |
Browser and computer use
See Browser automation and Computer use for the full feature context.
| Variable | Default | Purpose |
|---|---|---|
CHROME_PATH | — | Absolute path to the Chrome/Chromium/Edge binary to launch. |
BROWSER_HEADED (or BROWSER_HEADLESS=0) | headless | Set to 1 to show a real OS browser window in addition to the side panel. |
BROWSER_CDP_PORT | 9222 | Chrome DevTools Protocol port for the managed browser. |
BROWSER_MCP_DISABLED | off | Set to 1 to disable the built-in browser automation service. |
BROWSER_MCP_COMMAND / BROWSER_MCP_ARGS_JSON | built-in service | Replace the built-in browser service with a custom command. |
PLAYWRIGHT_BROWSERS_PATH | OS cache | Override where Playwright-bundled Chromium is looked for. |
COMPUTER_USE_DISABLED | off | Set to 1 to disable OS-level computer control entirely. |
COMPUTER_USE_COMMAND | ocu/open-computer-use | Override the computer-use driver command. |
COMPUTER_USE_TIMEOUT_MS | 60000 | Timeout for a driver call. |
COMPUTER_TAKEOVER_TTL_MS | 900000 (15 min) | How long a browser takeover request waits for you. |
COMPUTER_USE_KERNEL | on | The describe → permission → verify kernel wrapper; set to 0 to disable. |
BROWSER_CDP_ENDPOINT | http://127.0.0.1:9222 | CDP endpoint the built-in browser service connects to. |
Agent execution limits
| Variable | Default | Purpose |
|---|---|---|
PI_HARNESS_TIMEOUT_MS | 300000 (5 min) | Rolling timeout for one interactive chat round; re-armed by every goal continuation. |
PI_HARNESS_MAX_STEPS | 60 (1–500) | Max model/tool steps in one pass of an interactive run. |
QUBE_VERIFICATION_ROUNDS | 2 (0–10) | Extra passes allowed to repair a failed completion check. |
PI_MAX_CONCURRENT_RUNS | 32 (1–128) | How many chats can run at the same time. |
QUBE_RUN_STALE_MS | 45000 | After this long without progress, a run record is treated as stale. |
PI_HARNESS_MAX_TOTAL_MS | 3600000 (1 h) | Absolute wall clock for one chat run; goal continuation extends the rolling timeout only up to this. |
QUBE_SILENT_CONTINUATIONS | 8 | Silent nudge rounds for a stalled turn or a failed tool call; 0 disables them. |
QUBE_GOAL_CONTINUATIONS | 30 (0–500) | Continuation rounds while TodoWrite goals are unfinished; 0 disables goal continuation. |
QUBE_GOAL_STALL_ROUNDS | 3 (1–20) | Consecutive goal rounds with no progress (no completed item, no successful tool call) before stopping. |
QUBE_GOAL_ERROR_ROUNDS | 2 (0–10) | Consecutive provider/tool-error rounds tolerated while goals remain open. |
QUBE_GOAL_INHERITED_ROUNDS | 5 (0–50) | Rounds granted to a checklist inherited from an earlier turn before it must be re-written or cancelled. |
PI_TASK_TIMEOUT_MS | 180000 | Rolling timeout for one background task run (reset by each productive round). |
PI_TASK_MAX_TOTAL_MS | 1800000 (30 min) | Absolute wall clock for one background task run. |
PI_TASK_HEARTBEAT_STEPS | 12 | Max tool steps for a check-in run. |
PI_TASK_SCHEDULED_STEPS | 20 | Max tool steps for a scheduled task run. |
PI_TASK_MAX_ROUNDS | 12 (1–50) | Continuation rounds inside a background run while its plan has open items. |
PI_TASK_STALL_ROUNDS | 3 (1–20) | Consecutive no-progress background rounds before the run stops. |
PI_SUBAGENT_TIMEOUT_MS | 180000 | Timeout for a subagent. |
PI_MCP_TIMEOUT_MS | 45000 | Startup/communication timeout for custom MCP servers. |
PI_CONNECTOR_TIMEOUT_MS | 30000 | Timeout for connector (Composio) tool calls. |
PERMISSION_TIMEOUT_MS | 300000 | How long an approval card waits before timing out. |
ASK_USER_TIMEOUT_MS | 300000 | How long a single-question prompt (ask_user tool) waits for an answer. The multi-question panel (ask_question tool) uses PERMISSION_TIMEOUT_MS instead. |
QUBE_HEARTBEAT_CONNECTOR_TIMEOUT_MS | 6000 | Timeout for each read-only connector check during the check-in sweep. |
Memory, compaction and UI
| Variable | Default | Purpose |
|---|---|---|
QUBE_COMPACTION_ENABLED | enabled | Set to false to disable automatic context compaction (the manual compaction endpoint still works). |
QUBE_COMPACTION_CONTEXT_TOKENS | 128000 | Assumed model context window when the provider reports none. |
QUBE_COMPACTION_RESERVE_TOKENS | 20000 | Headroom below the window that triggers compaction. |
QUBE_COMPACTION_KEEP_RECENT_TOKENS | 15000 | Recent history kept verbatim alongside the summary. |
QUBE_COMPACTION_SUMMARY_TOKENS | 4096 | Maximum size of a generated summary. |
QUBE_COMPACTION_TOOL_CHARS | 2000 | Per-tool-output truncation when serializing history for a summary. |
QUBE_COMPACTION_SUMMARY_MAX_CHARS | 24000 | Character cap on a stored summary. |
QUBE_TOOL_OUTPUT_INLINE_CHARS | 16000 | Tool results larger than this are saved to .memory/tool-outputs/ and paged back on demand. |
QUBE_TOOL_OUTPUT_MAX_CHARS | 24000 | Maximum characters of a tool result kept in the conversation. |
QUBE_TOOL_OUTPUT_READ_CHARS | 30000 | Characters returned per page when the agent reads a stored tool result. |
QUBE_TOOL_OUTPUT_MAX_FILES | 200 | Stored tool results kept per chat. |
QUBE_TOOL_OUTPUT_RETENTION_HOURS | 168 (7 days) | How long stored tool results are kept. |
QUBE_READ_FILE_MAX_CHARS | 30000 | Default character limit when the agent reads a file. |
ACP and experimental flags
| Variable | Purpose |
|---|---|
QUBE_MODEL | Default model as provider:model for ACP editor sessions; falls back to the app's configured default. |
PI_DURABLE_ENABLED | Set to 1 to route chat through the experimental SQLite-backed durable harness instead of the default in-memory Pi harness. Unfinished migration path — not recommended for daily use. |
Model settings that are not environment variables
A few model parameters are set by the app rather than by environment variables:
- Temperature — there is no temperature control in the interface. The
agent uses
0.3when the chat request does not include one. However, the Settings dialog keeps a temperature value of0.7and writes it to the browser's local storage (qube-temperature) whenever you save Preferences or close Settings, and chat requests send that stored value. In practice, chats use0.7once Settings has been opened at least once. - Reasoning effort — chosen per chat in the composer's model picker (Off, Low, Medium, High; non-reasoning models show only Off).
- Context window and price — taken from the provider's model list where
available and used for compaction and the usage meter; otherwise
QUBE_COMPACTION_CONTEXT_TOKENSapplies.
Build and release variables
These are read by build scripts and CI, not by the running app:
| Variable | Purpose |
|---|---|
TAURI_BUILD | Set by the desktop build so Next.js produces the standalone server the sidecar runs. |
GITHUB_TOKEN / GH_TOKEN, GITHUB_REPOSITORY, GITHUB_REF_NAME, GITHUB_API_URL | Used by scripts/build-updater-json.mjs in the release workflow to assemble latest.json for the updater. |
The desktop shell itself sets PORT, HOSTNAME=127.0.0.1, QUBE_DATA_DIR,
QUBE_DESKTOP=1 and QUBE_APP_VERSION for the sidecar; you do not set these
yourself.
How settings interact
- In-app Settings (providers, custom instructions, run on start,
keep-alive) are stored in
.memory/app-settings.jsonand related files underQUBE_DATA_DIR; they apply regardless of how the server was launched. - Environment variables fill in what the app settings don't cover and are
useful for containers and CI. When both exist, the in-app setting generally
wins for user-facing preferences, while build-time variables such as
COMPOSIO_API_KEYare read directly.
Architecture
This page explains how Qube is put together, for contributors who want to change the code. It describes the repository as of version 0.0.118. For setup, tests and contribution rules, see Development and architecture.
Qube as an ACP agent
Qube can run as an Agent Client Protocol (ACP) agent over standard input/output. An ACP-compatible editor — for example Zed with external agents — spawns Qube as a subprocess and drives it with JSON-RPC: initialize →…