TUI and CLI

The interactive chat interface, slash commands, one-shot runs, dashboards, and budget controls.

Guardian has two interfaces: a one-shot CLI and an interactive TUI. Both use the same engine and the same provider configuration.

Commands

CommandWhat it does
guardianOpen the interactive chat TUI
guardian startStart the proxy server
guardian dashServe the analytics dashboard
guardian optimize "text"Fold text and print the stats
guardian run "prompt"One-shot prompt; streams to stdout
guardian --model <id>Start the TUI with a specific model
guardian --lm-studioPoint at a local LM Studio server
guardian --base-url <url> --api-key <key>Any OpenAI-compatible endpoint
guardian run "summarise the failing tests"
guardian run "explain src/core/prompt-cache.ts" --json
guardian run "hello" --base-url http://127.0.0.1:1234/v1 --model local-model
guardian run "run the focused tests and explain failures" --agent --exec

--agent enables the agent loop; --exec allows it to run commands. Use --exec only in a sandbox or a repository you trust.

TUI

Type / to open the command palette. It filters as you type; Tab completes, Enter runs, Esc dismisses. Ctrl+P opens it from anywhere.

Session

CommandEffect
/clearClear the conversation and session ledger
/historyTurn count and token totals
/retryRe-send the last message
/undoDrop the last turn
/export [file]Write the conversation to Markdown

Model and provider

CommandEffect
/modelsInteractive model picker
/model [id]Show or switch the active model
/providersList configured providers
/connect [url] [key]Connect an OpenAI-compatible provider
/disconnectReturn to the shared gateway
/providerShow which provider the model routes to

Context and cost

CommandEffect
/system [text]Show or set the system prompt
/contextContext size and optimization state
/temp [value]Sampling temperature
/maxtokens [value]Per-turn output cap
/tokensToken breakdown
/compactFold and shard the current history
/costSession cost and savings
/statsPer-turn table
/budgetBudget guard status

Features

CommandEffect
/fold <text>Fold and show the saving
/shard <text>Shard and show the saving
/toolsTool-gating configuration
/cachePrompt and response cache status
/prewarmWrite the provider prompt cache
/setupProvider setup status
/tour60-second command tour
/trioAI Trio status and scorecard
/doctorEnvironment diagnostics
/surfaceMulti-surface runtime configuration

Dashboard

# Build once
bun run build:dashboard

# Serve
guardian dash

The dashboard reads /api/v1/stats/* and shows savings, compression, request logs, and budget headroom.

Scripting

--json makes run emit machine-readable output. Exit codes are non-zero on provider, budget, or validation failures, so it composes in CI.

guardian run "check the changelog" --json | jq -r '.text'