Every clawq command is listed below. Run clawq COMMAND --help for per-command usage details.

Commands

CommandDescription
clawq activeShow active 5-hour window usage (cost, tokens, quota)
clawq agentStart the daemon (agent loop, gateway, all configured channels)
clawq agentsManage agent templates (list, show, create, edit, delete, bind, unbind)
clawq agents listList all templates (builtins marked [builtin], user marked [user])
clawq agents show <name>Full template details including system prompt preview
clawq agents create <name>Create a new template in ~/.clawq/agents/
clawq agents edit <name>Edit a template (copies builtin to user dir first)
clawq agents delete <name>Delete a user template (refuses for builtins)
clawq agents bind <pattern> <agent>Add agent routing binding to config
clawq agents unbind <pattern>Remove an agent routing binding
clawq agents bindingsList all agent routing bindings
clawq auditView and manage the security audit log
clawq audit list [--limit N]List recent audit log entries (default 20)
clawq audit verifyVerify audit log integrity (HMAC chain)
clawq audit export [PATH]Export audit log to file
clawq audit import PATHImport audit log from file
clawq audit purgePurge old audit entries per retention policy
clawq authShow API key status or encrypt plaintext secrets in config
clawq auth codex-login [PROVIDER]Start ChatGPT/Codex OAuth login for a configured provider
clawq auth codex-status [PROVIDER]Show saved Codex OAuth status
clawq auth codex-logout [PROVIDER]Remove saved Codex OAuth credentials
clawq benchmarkMeasure tool invocation latency to diagnose performance
clawq capabilitiesList all active runtime capabilities
clawq completionsGenerate and install shell tab-completion scripts (bash, zsh, fish)
clawq costsShow cumulative LLM costs and token usage
clawq backgroundInspect and control background coding agent worktree tasks
clawq background add RUNNER [--model MODEL] REPO [--branch NAME] PROMPTQueue a background coding task in a fresh git worktree
clawq background show IDInspect one background task, including log/worktree paths when available
clawq background wait ID [--timeout SECONDS]Block until a background task finishes, then print the final summary
clawq background logs ID [--lines COUNT] [--offset LINE] [--follow/-f]Show the captured log for a background task
clawq background resume IDResume a previously started worktree-backed background task using the runner’s native session support
clawq background message ID MESSAGE...Queue a follow-up user-style chat message for a previously started worktree-backed background task and resume it
clawq background cancel IDCancel a queued or running background task
clawq background retry IDRe-queue a failed background task (max 3 retries)
clawq background recover ID [--runner R] [--model M]Recover a failed or stuck task by spawning a replacement with full context from the original
clawq background finalize IDRebase, fast-forward merge, and clean up a completed task’s worktree
clawq channelList configured channels
clawq channel set-model NAME MODELSet a channel-specific default model (overrides global primary_model)
clawq channel show-model NAMEShow the current model for a channel (channel override or global default)
clawq channel clear-model NAMEClear a channel’s model override to inherit from global default
clawq configManage configuration (wizard, get/set/show)
clawq cronManage cron jobs for scheduled agent messages
clawq debug html-previewPreview HTML rendering
clawq debug http on|off|status|clear|tailManage HTTP debug logging
clawq doctorCheck configuration for common issues
clawq held-itemsManage held feature plans awaiting admin review (default: list pending)
clawq held-items save --name N --desc D --plan-file F --layer LSave a feature plan to the held items queue
clawq held-items list [--status STATUS]List held items by status (pending, approved, rejected, all)
clawq held-items show IDShow full details of a held item
clawq held-items approve ID [--by ADMIN] [--notes TEXT]Approve a pending held item
clawq held-items reject ID [--by ADMIN] [--notes TEXT]Reject a pending held item
clawq manifest teamsGenerate Teams bot manifest commands
clawq manifest telegramGenerate Telegram setMyCommands payload
clawq mcpStart the MCP server (Model Context Protocol)
clawq runner token --session KEY [--ttl-hours N]Generate a runner bearer token for remote question relay
clawq memoryShow memory backend configuration
clawq migrateRun database migrations
clawq modelsList configured LLM providers and their default models
clawq onboardInteractive setup wizard (or template when not in a TTY)
`clawq delegate [—runner autokimi
clawq phase2Show Phase 2 feature status
clawq providerInspect LLM provider configuration and live quota state
clawq otp-showShow the current browser pairing code and any Telegram TOTP codes
clawq rigManage agent-driven setup rigs (install, adjust, remove, list)
clawq rig install <name>Install a rig by delegating setup to a background task
clawq rig adjust <name>Reconfigure an installed rig
clawq rig remove <name>Remove an installed rig and clean up
clawq rig listList available rigs and their install status
clawq reset-agentWipe all session history, cron jobs, and workspace files
clawq runtimeManage native and Docker runtimes
clawq serviceManage the clawq system service (start/stop/restart/install/uninstall/systemd-unit)
clawq service systemd-unitPrint a systemd unit file for user-level daemon management
clawq service launchd-plistPrint a launchd plist file for macOS daemon management
clawq service installInstall and enable service autostart (systemd on Linux, launchd on macOS)
clawq service uninstallStop and remove the autostart service configuration
clawq sessionInspect and control agent sessions
clawq session list [--include-postmortem]List active sessions with state, channel, and pending queue counts. Postmortem sessions (__postmortem_*) are hidden by default; pass --include-postmortem to show them.
clawq session show KEYShow session details and message history
clawq session model SESSION getGet the current per-session model override (or global default)
clawq session model SESSION set MODELSet a per-session model override (auto-normalizes legacy format)
clawq session model SESSION clearClear the per-session model override, reverting to global default
clawq session archive show ID [--offset N] [--limit N]View archived session messages with pagination
clawq session inject [--cwd PATH] SESSION MSGInject a message into a session’s durable inbound queue (optionally set agent working directory)
clawq session pending SESSIONShow pending inbound queue entries for a session
clawq session keepalive SESSION on|offToggle session keepalive
clawq session heartbeat SESSION on|offToggle heartbeat routing for a session
clawq session epochs SESSIONShow session epoch boundaries
clawq session compact SESSIONCompact session history by summarizing older messages
clawq pipeline listList available pipelines (builtin + user-defined from ~/.clawq/pipelines/)
clawq pipeline show NAMEShow a pipeline definition (inputs, steps, schemas)
clawq pipeline run NAME --input k=v ...Execute a pipeline with inputs
clawq pipeline validate NAMEValidate a pipeline definition
clawq pipeline create NAMEScaffold a new pipeline YAML
clawq pipeline wizardInteractive pipeline builder
clawq pipeline history [--pipeline NAME]List past pipeline runs
clawq pipeline result RUN-IDShow detailed results for a pipeline run
clawq skillsManage agent skills (SKILL.md and shell-script definitions)
clawq setupInteractive setup wizards for channel integrations
clawq statusShow runtime configuration and daemon status
clawq transcribeTranscribe an audio file using the configured STT provider
clawq tunnelManage a public tunnel to the local gateway
clawq updateRequest a live daemon update and graceful restart
clawq usageShow provider quota/usage status (use --refresh/-r to force fetch)
clawq usage historyShow historical quota snapshots (--provider NAME, --since PERIOD, --limit N, --json)
clawq usage purge [PERIOD]Delete old quota history (default: 90d; accepts 7d, 30d, 90d, all)
clawq versionPrint version and build info
clawq watcherManage the error correction watcher (status, enable/disable, reports)
clawq watcher statusShow watcher config and EC process status (default)
clawq watcher enableEnable the error correction watcher
clawq watcher disableDisable the error correction watcher
clawq watcher reportsList recent EC reports
clawq watcher report IDShow a specific EC report with full detail
clawq workspacePrint the current workspace directory
clawq workspace backup [NAME]Backup all workspace files to a named version (auto-generates timestamp name if omitted)
clawq workspace versionsList all workspace backup versions (newest first)
clawq workspace restore NAMERestore workspace files from a named backup version
clawq workspace delete NAMEDelete a workspace backup version

Config Subcommands

The config command has four subcommands for managing ~/.clawq/config.json:

config wizard

clawq config wizard

Full interactive TUI wizard that walks through provider, model, security, channels, gateway, and memory configuration. Writes the result to ~/.clawq/config.json.

config set

clawq config set KEY VALUE

Set a config value by dot-path. Examples:

clawq config set providers.openrouter.api_key "sk-..."
clawq config set providers.openrouter.base_url "https://openrouter.ai/api/v1"
clawq config set agent_defaults.primary_model "openrouter:gpt-4o"
clawq config set channels.telegram.accounts.main.bot_token "123:ABC..."
clawq config set channels.telegram.accounts.main.allow_from '["*"]'
clawq config set security.tools_enabled true

config get

clawq config get KEY

Read a single config value by dot-path:

clawq config get providers.openrouter.default_model
# openai/gpt-4o

config show

clawq config show [SECTION]

Display the current configuration with secrets redacted. Optionally pass a section name to view only that section:

clawq config show              # full config
clawq config show channels     # channels section only
clawq config show security     # security section only

Setup Subcommands

The setup command provides per-channel interactive wizards for configuring individual integrations. Each wizard loads any existing configuration, presents a TUI dashboard, and merges changes back into ~/.clawq/config.json.

clawq setup discord      # Discord bot token, guilds, users, gateway intents
clawq setup github       # GitHub PAT, repos, webhook paths
clawq setup slack        # Slack bot token, app token, signing secret
clawq setup teams        # MS Teams app credentials
clawq setup telegram     # Telegram bot token, allowed users
clawq setup tunnel       # Cloudflare / Tailscale / ngrok tunnel
clawq setup summarizer   # Autosummarizer settings

Running clawq setup without a subcommand prints the list of available wizards.

Common Workflows

First-time setup

clawq onboard          # interactive wizard
clawq doctor           # validate configuration
clawq workspace        # show the active workspace path
clawq agent            # start the daemon

Day-to-day operations

clawq status           # check runtime status
clawq models           # list providers and models
clawq channel          # list active channels
clawq capabilities     # list available features

Background coding runs

clawq delegate "implement the task from TASK.md"
clawq delegate --runner codex --model gpt-5.4 --repo /path/to/repo "implement the task from TASK.md"
clawq background add codex --model gpt-5.4 /path/to/repo "implement the task from TASK.md"
clawq background add claude /path/to/repo --branch clawq-fixup "repair the failing tests"
clawq background list
clawq background show 1
clawq background wait 1
clawq background logs 1
clawq background resume 1
clawq background message 1 "Please fix the failing tests before wrapping up"
clawq background cancel 1
clawq background retry 1
clawq background recover 1 --runner claude
clawq background finalize 1

clawq delegate is the high-level handoff command for this flow. The background subcommands are the more explicit control surface when you want to inspect queue state, wait for completion in the terminal, or read the saved task log.

Background tasks are daemon-owned. The full clawq agent process polls the queue, creates a fresh git worktree for each task under ~/.clawq/background-worktrees/, runs the selected CLI non-interactively, and stores the task log under ~/.clawq/background-logs/.

Once a worktree-backed task has started, clawq background resume <id> resumes it using the runner’s tracked session ID (when available) or falls back to the runner’s generic continue flag. Each runner’s session ID is automatically captured: Claude pre-assigns a UUID via --session-id, Codex parses JSONL output for thread_id, and OpenCode/Kimi/Cursor extract session IDs from log output. clawq background message <id> ... injects a new user message into that resumed conversation. The injected message is delivered durably and replayed FIFO for the target task.

Tasks with automerge enabled will automatically rebase onto the target branch and fast-forward merge on success. If a conflict occurs, the parent agent is notified and can use background finalize <id> to retry the rebase and fast-forward merge after resolving conflicts. If the worktree has uncommitted changes (staged or unstaged), finalize and automerge will refuse to proceed and report the dirty state — commit or discard changes first, then retry.

Security and auditing

clawq auth             # show API key status (secrets redacted)
clawq auth encrypt     # encrypt plaintext API keys in config
clawq audit            # view security audit log

Runtime management

# Native runtime
clawq runtime native start
clawq runtime native stop
clawq runtime native health

# Docker runtime
clawq runtime docker start
clawq runtime docker stop
clawq runtime docker health

# Check all runtime status
clawq runtime status

Daemon signals

SignalEffect
SIGHUPReload ~/.clawq/config.json immediately
SIGUSR1Graceful restart (drain in-flight requests, then restart)
SIGINT / SIGTERMGraceful shutdown

Config is also auto-reloaded every 10 seconds when the file changes on disk.

Tunnel management

# Standalone tunnel control (when daemon is not running)
clawq tunnel start          # Start tunnel with configured provider
clawq tunnel stop           # Stop the running tunnel
clawq tunnel status         # Show tunnel status (default; detects daemon-managed tunnels)

# Live tunnel control (when daemon is running)
clawq tunnel apply          # Reconcile tunnel state with current config
clawq tunnel restart        # Force stop + restart with current config
clawq tunnel daemon-status  # Show tunnel manager state as JSON

The daemon automatically reconciles tunnel state when config changes are detected (via SIGHUP or file polling). Use tunnel apply to trigger reconciliation explicitly without editing config. Use tunnel restart to force a restart even when config hasn’t changed.

Supported providers: cloudflare (default), tailscale, ngrok, custom. Set tunnel.provider in config.

Make Targets

Build and development tasks are available via Make:

TargetDescription
make bootstrapCreate opam switch and install all dependencies
make buildBuild the project
make build-minimalBuild minimal binary (clawq-min, core-only)
make build-opt-speedOptimized build with -O3
make build-opt-sizeOptimized build with -O2 -compact
make build-opt-speed-strippedStripped optimized speed build
make build-opt-size-strippedStripped optimized size build
make build-opt-minimalOptimized minimal binary
make testRun all tests
make fmtFormat code with ocamlformat
make fmt-checkCheck formatting
make extractRegenerate OCaml from Coq theories
make extract-checkCheck for extraction drift
make uiBuild the web UI and regenerate embedded assets
make ui-devRun the web UI watcher with Bun
make ui-checkVerify embedded web UI assets are current
make runPrint CLI help
make cleanClean build artifacts
make docker-buildBuild Docker image
make docker-runRun daemon in Docker
make verify-reportGenerate formal verification report and badge
make releaseBuild release artifacts

Running Tests

# Run all tests
make test

# List all test suites and cases
opam exec --switch=clawq-5.1 -- dune exec test/test_main.exe -- list

# Run a specific test suite by regex
opam exec --switch=clawq-5.1 -- dune exec test/test_main.exe -- test command_bridge

# Run specific test case indices
opam exec --switch=clawq-5.1 -- dune exec test/test_main.exe -- test command_bridge 20

# Run multiple indices or ranges
opam exec --switch=clawq-5.1 -- dune exec test/test_main.exe -- test scheduler 0,3,8-10

Prefer gpt-5.4 for Codex delegation when quality matters. Use gpt-5.3-codex when you specifically want the Codex-tuned path or need to mirror Codex OAuth defaults.

Plan Subcommands

The plan command manages multi-stage planning pipelines (planner → plan-review → coder → code-review):

clawq plan list                    # List all pipelines (default)
clawq plan start PROMPT [OPTIONS]  # Start a new pipeline (foreground, blocking)
clawq plan show ID                 # Show pipeline status and details
clawq plan logs ID [--lines N]     # Show logs for the current stage
clawq plan cancel ID               # Cancel a running pipeline

Options for plan start:

OptionDescription
--repo PATHRepository path to plan against
--runner NAMERunner: auto, kimi, opencode, codex, claude, gemini, cursor
--planner-model MModel for the planner stage
--reviewer-model MModel for the reviewer stage
--coder-model MModel for the coder stage
--max-plan-review-iters NMaximum plan-review iterations (default 3; set 0 to skip)
--max-code-review-iters NMaximum code-review iterations (default 3; set 0 to skip)
--no-plan-reviewSkip plan review phase
--no-code-reviewSkip code review phase

Message Interrupts

Interrupt syntax

Prefix a message with ! to interrupt the current turn for that session and send the rest as a normal message. Works in the web UI, Telegram, Discord, Slack, Teams, and all other chat channels.

  • !stop — interrupts the in-flight turn and sends “stop” as the next message
  • ! (bare) — interrupts and sends “[interrupted]”

When shell_exec is interrupted, the running process is moved to a background shell instead of being killed. Use /tools to see bg_shell_status, bg_shell_wait, and bg_shell_result for tracking background shell jobs.

Slash Commands

Slash commands are available in chat-integrated channels (Telegram, Discord, Slack, Teams, web UI). Type /help in any channel to see the full list.

CommandDescription
/startShow the ready message
/helpList available slash commands, skills, and agents
/newReset the current session
/statusRich table-formatted status report (uptime, PID, sessions, connectors, tunnel)
/runtime_ctxShow the full per-session runtime context block
/thinking [level]Show or set thinking level: low, medium, high, off, xhigh, max
/thinking menuInteractive thinking level selection menu
/show_thinkingToggle display of model thinking in responses
/heartbeat [on|off|status]Toggle heartbeat routing for this session
/compactCompact session history by summarizing older messages
/modelShow current model, favorites, and usage ranking
/model helpShow model command usage text
/model set <name>Set model for this session (validates against known models)
/model set-force <name>Set model bypassing validation (for custom/local models)
/model set-default <name>Set default model in config (persistent, auto-normalizes format)
/model fav <name>Toggle a model as favorite
/model unfav <name>Remove from favorites
/model list [provider]List available models
/model usageShow provider quota and usage stats
/model menu [page]Interactive model selection from favorites (paginated)
/costs [session [KEY]|model|provider]Show cost breakdowns
/costs menuInteractive cost view selection menu
/usage [session [KEY]|model|provider]Show token usage breakdowns
/activeShow active 5-hour window usage (cost, tokens, quota)
/bg [list|show|logs|cancel|retry|create] [id|prompt]Background task management
/bg finalize <id>Manually finalize a background task (rebase + fast-forward merge + cleanup)
/bg menuInteractive background task action menu
/cron [list|show|add|edit|remove|history]Manage cron jobs: list, show details, create (with optional --ttl), edit schedule/message/TTL, remove, view run history
/uptimeShow current daemon uptime
/toolsList all available tools, skills, and agents
/tasksShow the agent’s current task tree
/agent <name> <prompt>Invoke a named agent template for a one-off turn
/agent menu [page]Paginated agent template browser (8 per page, next/prev navigation)
/agent listList all available agent templates
/delegate <prompt>Delegate a prompt to a temporary subagent
/fork_and <prompt>Fork current session and run a prompt in a new subagent
/config [show|get|set|keys|wizard]View or modify configuration from chat
/config menu [page]Interactive config section browser (paginated)
/skills [page]List available skills with interactive selection (paginated)
/pair <code>Pair with TOTP code from browser
/repoShow current repository status for this session
/repo <url|path>Clone or associate a repository with this session
/repo forgetRemove repository association from session
/repo updateManually fetch/pull the associated repository
/idea <description>Log an idea to the backlog (invokes bl idea)
/session archives [KEY]List session archives (optionally filtered by session key)
/session archive show IDView archived session messages with pagination
/updatePull, rebuild, and gracefully restart clawq
/debug_dump_chatDump session state to file and send as attachment
/bash <command>Run a bash command (admin only)