CLI Reference
Complete command-line interface reference for rlm-cli.
Global Options
Section titled “Global Options”These options apply to all commands:
| Option | Environment | Description |
|---|---|---|
-d, --db-path <PATH> | RLM_DB_PATH | Path to SQLite database (default: .rlm/rlm-state.db) |
-v, --verbose | Enable verbose output | |
--format <FORMAT> | Output format: text (default) or json | |
-h, --help | Print help information | |
-V, --version | Print version |
Commands
Section titled “Commands”Database Management
Section titled “Database Management”Initialize the RLM database. Creates the database file and schema if they don’t exist.
rlm-cli init [OPTIONS]Options:
| Option | Description |
|---|---|
-f, --force | Force re-initialization (destroys existing data) |
Examples:
# Initialize new databaserlm-cli init
# Re-initialize (destroys existing data)rlm-cli init --forcestatus
Section titled “status”Show current RLM state including database info, buffer count, and statistics.
rlm-cli statusExample Output:
RLM Status==========Database: .rlm/rlm-state.db (245 KB)Buffers: 3Total chunks: 42Variables: 2JSON Output:
rlm-cli status --format jsonDelete all RLM state (buffers, chunks, variables). Use with caution.
rlm-cli reset [OPTIONS]Options:
| Option | Description |
|---|---|
-y, --yes | Skip confirmation prompt |
Examples:
# Interactive reset (prompts for confirmation)rlm-cli reset
# Non-interactive resetrlm-cli reset --yesBuffer Operations
Section titled “Buffer Operations”Load a file into a buffer with automatic chunking and embedding generation.
Embeddings are automatically generated during load for semantic search support.
rlm-cli load [OPTIONS] <FILE>Arguments:
| Argument | Description |
|---|---|
<FILE> | Path to the file to load |
Options:
| Option | Default | Description |
|---|---|---|
-n, --name <NAME> | filename | Custom name for the buffer |
-c, --chunker <STRATEGY> | semantic | Chunking strategy: fixed, semantic, code, parallel |
--chunk-size <SIZE> | 3000 | Chunk size in characters (~750 tokens) |
--overlap <SIZE> | 500 | Overlap between chunks in characters |
Chunking Strategies:
| Strategy | Best For | Description |
|---|---|---|
semantic | Markdown, prose | Splits at sentence/paragraph boundaries |
code | Source code | Language-aware chunking at function/class boundaries |
fixed | Logs, binary, raw text | Splits at exact character boundaries |
parallel | Large files (>10MB) | Multi-threaded fixed chunking |
Code Chunker Supported Languages: Rust, Python, JavaScript, TypeScript, Go, Java, C/C++, Ruby, PHP
Examples:
# Load with default settings (semantic chunking)rlm-cli load document.md
# Load with custom namerlm-cli load document.md --name my-docs
# Load with fixed chunking and custom sizerlm-cli load logs.txt --chunker fixed --chunk-size 50000
# Load large file with parallel chunkingrlm-cli load huge-file.txt --chunker parallel --chunk-size 100000 --overlap 1000list (alias: ls)
Section titled “list (alias: ls)”List all buffers in the database.
rlm-cli listExample Output:
ID Name Size Chunks Created1 document.md 125,432 4 2024-01-15 10:30:002 config.json 2,048 1 2024-01-15 10:35:003 logs.txt 1,048,576 26 2024-01-15 10:40:00JSON Output:
rlm-cli list --format jsonShow detailed information about a specific buffer.
rlm-cli show [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID (number) or name |
Options:
| Option | Description |
|---|---|
-c, --chunks | Include chunk details |
Examples:
# Show buffer by namerlm-cli show document.md
# Show buffer by IDrlm-cli show 1
# Show buffer with chunk detailsrlm-cli show document.md --chunksdelete (alias: rm)
Section titled “delete (alias: rm)”Delete a buffer and its associated chunks.
rlm-cli delete [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name to delete |
Options:
| Option | Description |
|---|---|
-y, --yes | Skip confirmation prompt |
Examples:
# Delete with confirmationrlm-cli delete document.md
# Delete without confirmationrlm-cli delete 1 --yesadd-buffer
Section titled “add-buffer”Create a new buffer from text content. Useful for storing intermediate results.
rlm-cli add-buffer <NAME> [CONTENT]Arguments:
| Argument | Description |
|---|---|
<NAME> | Name for the new buffer |
[CONTENT] | Text content (reads from stdin if omitted) |
Examples:
# Add buffer with inline contentrlm-cli add-buffer summary "This is the summary of chunk 1..."
# Add buffer from stdinecho "Content from pipe" | rlm-cli add-buffer piped-content
# Add buffer from file via stdincat results.txt | rlm-cli add-buffer resultsexport-buffers
Section titled “export-buffers”Export all buffers to a file (JSON format).
rlm-cli export-buffers [OPTIONS]Options:
| Option | Description |
|---|---|
-o, --output <FILE> | Output file path (stdout if omitted) |
-p, --pretty | Pretty-print JSON output |
Examples:
# Export to stdoutrlm-cli export-buffers --format json
# Export to filerlm-cli export-buffers --output backup.json --prettyContent Operations
Section titled “Content Operations”View a slice of buffer content without loading the entire buffer.
rlm-cli peek [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
Options:
| Option | Default | Description |
|---|---|---|
--start <OFFSET> | 0 | Start offset in bytes |
--end <OFFSET> | start + 3000 | End offset in bytes |
Examples:
# View first 3000 bytes (default)rlm-cli peek document.md
# View specific rangerlm-cli peek document.md --start 1000 --end 5000
# View from offset to default lengthrlm-cli peek document.md --start 10000Search buffer content using regular expressions.
rlm-cli grep [OPTIONS] <BUFFER> <PATTERN>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
<PATTERN> | Regular expression pattern |
Options:
| Option | Default | Description |
|---|---|---|
-n, --max-matches <N> | 20 | Maximum matches to return |
-w, --window <SIZE> | 120 | Context characters around each match |
-i, --ignore-case | Case-insensitive search |
Examples:
# Basic searchrlm-cli grep document.md "error"
# Case-insensitive searchrlm-cli grep document.md "TODO" --ignore-case
# Regex pattern with contextrlm-cli grep logs.txt "ERROR.*timeout" --window 200 --max-matches 50
# Search by buffer IDrlm-cli grep 1 "function.*async"Chunking Operations
Section titled “Chunking Operations”chunk-indices
Section titled “chunk-indices”Calculate and display chunk boundaries for a buffer without writing files.
rlm-cli chunk-indices [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
Options:
| Option | Default | Description |
|---|---|---|
--chunk-size <SIZE> | 3000 | Chunk size in characters |
--overlap <SIZE> | 500 | Overlap between chunks |
Examples:
# Show chunk boundaries with defaultsrlm-cli chunk-indices document.md
# Custom chunk sizerlm-cli chunk-indices document.md --chunk-size 20000 --overlap 1000write-chunks
Section titled “write-chunks”Split a buffer into chunk files for processing.
rlm-cli write-chunks [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
Options:
| Option | Default | Description |
|---|---|---|
-o, --out-dir <DIR> | .rlm/chunks | Output directory |
--chunk-size <SIZE> | 3000 | Chunk size in characters |
--overlap <SIZE> | 500 | Overlap between chunks |
--prefix <PREFIX> | chunk | Filename prefix |
Output Files:
Files are named {prefix}_{index}.txt (e.g., chunk_0.txt, chunk_1.txt).
Examples:
# Write chunks with defaultsrlm-cli write-chunks document.md
# Custom output directory and prefixrlm-cli write-chunks document.md --out-dir ./output --prefix doc
# Custom chunk size for smaller chunksrlm-cli write-chunks large.txt --chunk-size 20000 --overlap 500Search Operations
Section titled “Search Operations”search
Section titled “search”Search chunks using hybrid semantic + BM25 search with Reciprocal Rank Fusion (RRF).
rlm-cli search [OPTIONS] <QUERY>Arguments:
| Argument | Description |
|---|---|
<QUERY> | Search query text |
Options:
| Option | Default | Description |
|---|---|---|
-k, --top-k <N> | 10 | Maximum number of results |
-t, --threshold <SCORE> | 0.3 | Minimum similarity threshold (0.0-1.0) |
-m, --mode <MODE> | hybrid | Search mode: hybrid, semantic, bm25 |
--rrf-k <K> | 60 | RRF k parameter for rank fusion |
-b, --buffer <BUFFER> | Filter by buffer ID or name | |
-p, --preview | Include content preview in results | |
--preview-len <N> | 150 | Preview length in characters |
Search Modes:
| Mode | Description |
|---|---|
hybrid | Combines semantic and BM25 scores using RRF (recommended) |
semantic | Vector similarity search using embeddings |
bm25 | Traditional full-text search with BM25 scoring |
Examples:
# Basic hybrid searchrlm-cli search "database connection errors"
# Search with more resultsrlm-cli search "API endpoints" --top-k 20
# Semantic-only searchrlm-cli search "authentication flow" --mode semantic
# Search specific bufferrlm-cli search "error handling" --buffer logs
# Search with content previewrlm-cli search "auth" --preview --preview-len 200
# JSON output for programmatic userlm-cli --format json search "your query" --top-k 10Output (JSON format):
{ "count": 2, "mode": "hybrid", "query": "your query", "results": [ {"chunk_id": 42, "score": 0.0328, "semantic_score": 0.0499, "bm25_score": 1.6e-6}, {"chunk_id": 17, "score": 0.0323, "semantic_score": 0.0457, "bm25_score": 1.2e-6} ]}Extract chunk IDs: jq -r '.results[].chunk_id'
Agentic Workflow Operations
Section titled “Agentic Workflow Operations”update-buffer
Section titled “update-buffer”Update an existing buffer with new content, re-chunking and optionally re-embedding.
rlm-cli update-buffer [OPTIONS] <BUFFER> [CONTENT]Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
[CONTENT] | New content (reads from stdin if omitted) |
Options:
| Option | Default | Description |
|---|---|---|
-e, --embed | Automatically embed new chunks after update | |
--strategy <STRATEGY> | semantic | Chunking strategy |
--chunk-size <SIZE> | 3000 | Chunk size in characters |
--overlap <SIZE> | 500 | Overlap between chunks |
Examples:
# Update from stdincat updated.txt | rlm-cli update-buffer main-source
# Update with inline contentrlm-cli update-buffer my-buffer "new content here"
# Update and re-embedrlm-cli update-buffer my-buffer --embed
# Update with custom chunkingcat new_code.rs | rlm-cli update-buffer code-buffer --strategy codedispatch
Section titled “dispatch”Split chunks into batches for parallel subagent processing. Returns batch assignments with chunk IDs for orchestrator use.
rlm-cli dispatch [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
Options:
| Option | Default | Description |
|---|---|---|
--batch-size <N> | 10 | Number of chunks per batch |
--workers <N> | Number of worker batches (alternative to batch-size) | |
-q, --query <QUERY> | Filter to chunks matching this search query | |
--mode <MODE> | hybrid | Search mode for query filtering |
--threshold <SCORE> | 0.3 | Minimum similarity threshold for filtering |
Examples:
# Dispatch all chunks in batches of 10rlm-cli dispatch my-buffer
# Create 4 batches for 4 parallel workersrlm-cli dispatch my-buffer --workers 4
# Only dispatch chunks relevant to a queryrlm-cli dispatch my-buffer --query "error handling"
# JSON output for orchestratorrlm-cli --format json dispatch my-bufferOutput (JSON format):
{ "buffer_id": 1, "total_chunks": 42, "batch_count": 5, "batches": [ {"batch_id": 0, "chunk_ids": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}, {"batch_id": 1, "chunk_ids": [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]} ]}aggregate
Section titled “aggregate”Combine findings from analyst subagents. Reads JSON findings, filters by relevance, groups, and outputs a synthesizer-ready report.
rlm-cli aggregate [OPTIONS]Options:
| Option | Default | Description |
|---|---|---|
-b, --buffer <BUFFER> | Read findings from a buffer (stdin if omitted) | |
--min-relevance <LEVEL> | low | Minimum relevance: none, low, medium, high |
--group-by <FIELD> | relevance | Group by: chunk_id, relevance, none |
--sort-by <FIELD> | relevance | Sort by: relevance, chunk_id, findings_count |
-o, --output-buffer <NAME> | Store results in a new buffer |
Input Format (JSON array of analyst findings):
[ {"chunk_id": 12, "relevance": "high", "findings": ["Bug found"], "summary": "Critical issue"}, {"chunk_id": 27, "relevance": "medium", "findings": ["Minor issue"], "summary": "Needs review"}]Examples:
# Aggregate from stdincat findings.json | rlm-cli aggregate
# Read from bufferrlm-cli aggregate --buffer analyst-findings
# Filter to high relevance onlyrlm-cli aggregate --min-relevance high
# Store aggregated resultsrlm-cli aggregate --output-buffer synthesis-input
# JSON outputrlm-cli --format json aggregateChunk Operations
Section titled “Chunk Operations”chunk get
Section titled “chunk get”Get a chunk by ID (primary pass-by-reference mechanism for subagents).
rlm-cli chunk get [OPTIONS] <ID>Arguments:
| Argument | Description |
|---|---|
<ID> | Chunk ID (globally unique across all buffers) |
Options:
| Option | Description |
|---|---|
-m, --metadata | Include metadata in output |
Examples:
# Get chunk contentrlm-cli chunk get 42
# Get chunk with metadata (JSON)rlm-cli --format json chunk get 42 --metadatachunk list
Section titled “chunk list”List all chunks for a buffer.
rlm-cli chunk list [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
Options:
| Option | Default | Description |
|---|---|---|
-p, --preview | Show a content preview for each chunk | |
--preview-len <N> | 100 | Preview length in characters |
Examples:
# List chunks for bufferrlm-cli chunk list docs
# List with content previewrlm-cli chunk list docs --preview
# List with longer previewrlm-cli chunk list docs --preview --preview-len 200
# JSON outputrlm-cli --format json chunk list docs | jq '.[].id'chunk embed
Section titled “chunk embed”Generate embeddings for buffer chunks. Note: Embeddings are automatically generated during load, so this is typically only needed with --force to re-embed.
rlm-cli chunk embed [OPTIONS] <BUFFER>Arguments:
| Argument | Description |
|---|---|
<BUFFER> | Buffer ID or name |
Options:
| Option | Description |
|---|---|
-f, --force | Force re-embedding even if embeddings exist |
Examples:
# Check if embeddings exist (will report "already embedded")rlm-cli chunk embed docs
# Force re-embeddingrlm-cli chunk embed docs --forcechunk status
Section titled “chunk status”Show embedding status for all buffers.
rlm-cli chunk statusExample Output:
Embedding Status================
Total: 42/42 chunks embedded
Buffer ID Chunks Embeddeddocs 1 15 15logs 2 27 27Variable Operations
Section titled “Variable Operations”Manage context-scoped variables (persisted per session/context).
rlm-cli var [OPTIONS] <NAME> [VALUE]Arguments:
| Argument | Description |
|---|---|
<NAME> | Variable name |
[VALUE] | Value to set (omit to get current value) |
Options:
| Option | Description |
|---|---|
-d, --delete | Delete the variable |
Examples:
# Set a variablerlm-cli var current_chunk 3
# Get a variablerlm-cli var current_chunk
# Delete a variablerlm-cli var current_chunk --deleteglobal
Section titled “global”Manage global variables (persisted across all contexts).
rlm-cli global [OPTIONS] <NAME> [VALUE]Arguments:
| Argument | Description |
|---|---|
<NAME> | Variable name |
[VALUE] | Value to set (omit to get current value) |
Options:
| Option | Description |
|---|---|
-d, --delete | Delete the variable |
Examples:
# Set a global variablerlm-cli global project_name "my-project"
# Get a global variablerlm-cli global project_name
# Delete a global variablerlm-cli global project_name --deleteConfiguration
Section titled “Configuration”Default Chunk Sizes
Section titled “Default Chunk Sizes”| Parameter | Default | Description |
|---|---|---|
chunk_size | 3,000 chars | ~750 tokens (optimized for semantic search) |
overlap | 500 chars | Context continuity between chunks |
max_chunk_size | 50,000 chars | Maximum allowed chunk size |
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
RLM_DB_PATH | Default database path |
Exit Codes
Section titled “Exit Codes”| Code | Description |
|---|---|
0 | Success |
1 | General error |
2 | Invalid arguments |
Output Formats
Section titled “Output Formats”All commands support multiple output formats via --format:
| Format | Description |
|---|---|
text | Human-readable text (default) |
json | JSON for programmatic use |
ndjson | Newline-delimited JSON for streaming |
# Status as JSONrlm-cli status --format json
# List buffers as JSONrlm-cli list --format json
# Search results as JSONrlm-cli grep document.md "pattern" --format json
# NDJSON for streaming pipelinesrlm-cli --format ndjson chunk list my-bufferSee Also
Section titled “See Also”- README.md - Project overview and quick start
- Architecture - Internal architecture documentation
- RLM Paper - Recursive Language Model pattern