Skip to main content

CLI Reference

rlmx "query"

Run an RLM query against a context.
The default command. Loads context into a Python REPL, then iterates with the LLM until it produces a final answer.

Options

Context loading

Examples

Output formats


rlmx init

Scaffold a .rlmx/ config directory with templates.
Creates a .rlmx/ directory containing:
RLMX v0.260331+ uses the .rlmx/ directory as the only config location. Projects using the old flat-file rlmx.yaml in the project root must re-run rlmx init to migrate.

Templates

  • default — General-purpose RLM usage with balanced system prompt and criteria
  • code — 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:
Without --estimate — a minimal RLM loop runs to prime the provider cache. Progress and the summary are emitted to stderr:
If the context exceeds the provider’s token limit, the command exits with a non-zero status and an error message. See Cache Mode for the full caching workflow.

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.
Questions are read one per line. Blank lines and lines beginning with # 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:
Budget trips, cache fallbacks, and verbose progress are logged to stderr so the stdout stream stays valid JSONL for downstream pipelines. See Batch Mode for full details.

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:
With 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

Set a configuration value. Values are type-coerced: "true" becomes boolean, numeric strings become numbers.

rlmx config get

Retrieve a setting value. API keys are masked in output.

rlmx config list

Show all configured settings. Sensitive keys (containing API_KEY, SECRET, TOKEN) are masked.

rlmx config delete

Remove a setting.

rlmx config path

Print the settings file path (~/.rlmx/settings.json).

Common keys

Priority order

Settings are resolved in this order (highest priority first):
  1. CLI flags (--max-cost 0.10)
  2. Project rlmx.yaml
  3. Global ~/.rlmx/settings.json
  4. 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:

full (standard + environment)

All standard functions plus auto-injected information about available Python packages and versions in the REPL environment.

Global flags

These flags work with any command: