CLI Reference
rlmx "query"
Run an RLM query against a context.
Options
Context loading
Examples
Output formats
rlmx init
Scaffold a .rlmx/ config directory with templates.
Creates a
.rlmx/ directory containing:
Templates
default— General-purpose RLM usage with balanced system prompt and criteriacode— Code analysis template with code-focused system prompt and tool definitions
Example
rlmx cache
Pre-warm the provider cache for a given context, or estimate its size and cost without making any API calls.
--context is required. Without --estimate, rlmx performs a single-iteration warmup run so the provider caches the prompt prefix for subsequent queries.
Examples
Outputs
With--estimate — a key: value block is printed to stdout and the process exits without calling any LLM:
--estimate — a minimal RLM loop runs to prime the provider cache. Progress and the summary are emitted to stderr:
rlmx batch
Run bulk queries from a questions file against a shared cached context. Each question is executed through the same RLM loop used by rlmx "query", with provider-level prompt caching always enabled so the first question pays full price and subsequent questions benefit from the cache.
# are ignored.
--cache does not need to be passed — batch mode always runs with cache.enabled = true. If the context exceeds the provider’s token limit, rlmx falls back to pgserve storage mode when storage.enabled is auto or always.Example
Outputs
rlmx batch writes JSONL to stdout — one JSON object per question, followed by a final aggregate line:
rlmx stats
Query run history and cost breakdowns from the rlmx observability database (pgserve at ~/.rlmx/data). Stats are populated automatically by every run that saves a session.
Without any flags,
rlmx stats prints the 20 most recent sessions as a terminal table (id, query, model, iterations, cost, status, duration).
Stats require pgserve storage. If
~/.rlmx/data does not exist, the command prints "No stats yet. Run a query first." and exits cleanly. See Configuration for storage setup.Examples
Outputs
Default (sessions table) — plain-text columns written to stdout:--run <id> — one row per event (llm_call, repl_exec, sub_call) with iteration, token counts, cost, duration, and kind-specific detail (model, code preview, request type).
--costs — one row per (session, model) pair with total calls, input/output tokens, cost, and average call duration.
--tools — one row per (session, request_type) with calls, errors, and average duration.
--output json — any of the above as a pretty-printed JSON array of rows.
rlmx benchmark
Run benchmarks that compare the RLM loop against a direct LLM call on the same question. rlmx benchmark does not accept --context — each mode ships its own dataset.
Flags
Model and provider are resolved from
rlmx.yaml / ~/.rlmx/settings.json via the usual priority order.
Examples
Outputs
Both modes print a box-drawn comparison table to stderr with per-question rows (Direct / RLM / Savings) and a TOTALS footer covering tokens, cost, latency, and average RLM iterations:rlmx benchmark cost --output json, the same results are emitted as a structured JSON document to stdout (timestamp, mode, model, per-question runs[], and totals). Every benchmark — table or JSON — is also persisted to ~/.rlmx/benchmarks/benchmark-<mode>-<timestamp>.json and the saved path is printed to stderr.
rlmx config
Manage global settings stored at ~/.rlmx/settings.json.
rlmx config set
"true" becomes boolean, numeric strings become numbers.
rlmx config get
rlmx config list
API_KEY, SECRET, TOKEN) are masked.
rlmx config delete
rlmx config path
~/.rlmx/settings.json).
Common keys
Priority order
Settings are resolved in this order (highest priority first):- CLI flags (
--max-cost 0.10) - Project
rlmx.yaml - Global
~/.rlmx/settings.json - Hardcoded defaults
Tool levels
The--tools flag controls which functions are available in the REPL:
core (default)
Paper-faithful RLM functions:
Plus any custom tools defined in
rlmx.yaml.
standard (core + batteries)
All core functions plus utility batteries:
With Google provider, also includes Gemini batteries: