Skip to content

CLI Reference

Complete command-line interface reference for rlm-cli.

These options apply to all commands:

OptionEnvironmentDescription
-d, --db-path <PATH>RLM_DB_PATHPath to SQLite database (default: .rlm/rlm-state.db)
-v, --verboseEnable verbose output
--format <FORMAT>Output format: text (default) or json
-h, --helpPrint help information
-V, --versionPrint version

Initialize the RLM database. Creates the database file and schema if they don’t exist.

Terminal window
rlm-cli init [OPTIONS]

Options:

OptionDescription
-f, --forceForce re-initialization (destroys existing data)

Examples:

Terminal window
# Initialize new database
rlm-cli init
# Re-initialize (destroys existing data)
rlm-cli init --force

Show current RLM state including database info, buffer count, and statistics.

Terminal window
rlm-cli status

Example Output:

RLM Status
==========
Database: .rlm/rlm-state.db (245 KB)
Buffers: 3
Total chunks: 42
Variables: 2

JSON Output:

Terminal window
rlm-cli status --format json

Delete all RLM state (buffers, chunks, variables). Use with caution.

Terminal window
rlm-cli reset [OPTIONS]

Options:

OptionDescription
-y, --yesSkip confirmation prompt

Examples:

Terminal window
# Interactive reset (prompts for confirmation)
rlm-cli reset
# Non-interactive reset
rlm-cli reset --yes

Load a file into a buffer with automatic chunking and embedding generation.

Embeddings are automatically generated during load for semantic search support.

Terminal window
rlm-cli load [OPTIONS] <FILE>

Arguments:

ArgumentDescription
<FILE>Path to the file to load

Options:

OptionDefaultDescription
-n, --name <NAME>filenameCustom name for the buffer
-c, --chunker <STRATEGY>semanticChunking strategy: fixed, semantic, code, parallel
--chunk-size <SIZE>3000Chunk size in characters (~750 tokens)
--overlap <SIZE>500Overlap between chunks in characters

Chunking Strategies:

StrategyBest ForDescription
semanticMarkdown, proseSplits at sentence/paragraph boundaries
codeSource codeLanguage-aware chunking at function/class boundaries
fixedLogs, binary, raw textSplits at exact character boundaries
parallelLarge files (>10MB)Multi-threaded fixed chunking

Code Chunker Supported Languages: Rust, Python, JavaScript, TypeScript, Go, Java, C/C++, Ruby, PHP

Examples:

Terminal window
# Load with default settings (semantic chunking)
rlm-cli load document.md
# Load with custom name
rlm-cli load document.md --name my-docs
# Load with fixed chunking and custom size
rlm-cli load logs.txt --chunker fixed --chunk-size 50000
# Load large file with parallel chunking
rlm-cli load huge-file.txt --chunker parallel --chunk-size 100000 --overlap 1000

List all buffers in the database.

Terminal window
rlm-cli list

Example Output:

ID Name Size Chunks Created
1 document.md 125,432 4 2024-01-15 10:30:00
2 config.json 2,048 1 2024-01-15 10:35:00
3 logs.txt 1,048,576 26 2024-01-15 10:40:00

JSON Output:

Terminal window
rlm-cli list --format json

Show detailed information about a specific buffer.

Terminal window
rlm-cli show [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID (number) or name

Options:

OptionDescription
-c, --chunksInclude chunk details

Examples:

Terminal window
# Show buffer by name
rlm-cli show document.md
# Show buffer by ID
rlm-cli show 1
# Show buffer with chunk details
rlm-cli show document.md --chunks

Delete a buffer and its associated chunks.

Terminal window
rlm-cli delete [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name to delete

Options:

OptionDescription
-y, --yesSkip confirmation prompt

Examples:

Terminal window
# Delete with confirmation
rlm-cli delete document.md
# Delete without confirmation
rlm-cli delete 1 --yes

Create a new buffer from text content. Useful for storing intermediate results.

Terminal window
rlm-cli add-buffer <NAME> [CONTENT]

Arguments:

ArgumentDescription
<NAME>Name for the new buffer
[CONTENT]Text content (reads from stdin if omitted)

Examples:

Terminal window
# Add buffer with inline content
rlm-cli add-buffer summary "This is the summary of chunk 1..."
# Add buffer from stdin
echo "Content from pipe" | rlm-cli add-buffer piped-content
# Add buffer from file via stdin
cat results.txt | rlm-cli add-buffer results

Export all buffers to a file (JSON format).

Terminal window
rlm-cli export-buffers [OPTIONS]

Options:

OptionDescription
-o, --output <FILE>Output file path (stdout if omitted)
-p, --prettyPretty-print JSON output

Examples:

Terminal window
# Export to stdout
rlm-cli export-buffers --format json
# Export to file
rlm-cli export-buffers --output backup.json --pretty

View a slice of buffer content without loading the entire buffer.

Terminal window
rlm-cli peek [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name

Options:

OptionDefaultDescription
--start <OFFSET>0Start offset in bytes
--end <OFFSET>start + 3000End offset in bytes

Examples:

Terminal window
# View first 3000 bytes (default)
rlm-cli peek document.md
# View specific range
rlm-cli peek document.md --start 1000 --end 5000
# View from offset to default length
rlm-cli peek document.md --start 10000

Search buffer content using regular expressions.

Terminal window
rlm-cli grep [OPTIONS] <BUFFER> <PATTERN>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name
<PATTERN>Regular expression pattern

Options:

OptionDefaultDescription
-n, --max-matches <N>20Maximum matches to return
-w, --window <SIZE>120Context characters around each match
-i, --ignore-caseCase-insensitive search

Examples:

Terminal window
# Basic search
rlm-cli grep document.md "error"
# Case-insensitive search
rlm-cli grep document.md "TODO" --ignore-case
# Regex pattern with context
rlm-cli grep logs.txt "ERROR.*timeout" --window 200 --max-matches 50
# Search by buffer ID
rlm-cli grep 1 "function.*async"

Calculate and display chunk boundaries for a buffer without writing files.

Terminal window
rlm-cli chunk-indices [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name

Options:

OptionDefaultDescription
--chunk-size <SIZE>3000Chunk size in characters
--overlap <SIZE>500Overlap between chunks

Examples:

Terminal window
# Show chunk boundaries with defaults
rlm-cli chunk-indices document.md
# Custom chunk size
rlm-cli chunk-indices document.md --chunk-size 20000 --overlap 1000

Split a buffer into chunk files for processing.

Terminal window
rlm-cli write-chunks [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name

Options:

OptionDefaultDescription
-o, --out-dir <DIR>.rlm/chunksOutput directory
--chunk-size <SIZE>3000Chunk size in characters
--overlap <SIZE>500Overlap between chunks
--prefix <PREFIX>chunkFilename prefix

Output Files: Files are named {prefix}_{index}.txt (e.g., chunk_0.txt, chunk_1.txt).

Examples:

Terminal window
# Write chunks with defaults
rlm-cli write-chunks document.md
# Custom output directory and prefix
rlm-cli write-chunks document.md --out-dir ./output --prefix doc
# Custom chunk size for smaller chunks
rlm-cli write-chunks large.txt --chunk-size 20000 --overlap 500

Search chunks using hybrid semantic + BM25 search with Reciprocal Rank Fusion (RRF).

Terminal window
rlm-cli search [OPTIONS] <QUERY>

Arguments:

ArgumentDescription
<QUERY>Search query text

Options:

OptionDefaultDescription
-k, --top-k <N>10Maximum number of results
-t, --threshold <SCORE>0.3Minimum similarity threshold (0.0-1.0)
-m, --mode <MODE>hybridSearch mode: hybrid, semantic, bm25
--rrf-k <K>60RRF k parameter for rank fusion
-b, --buffer <BUFFER>Filter by buffer ID or name
-p, --previewInclude content preview in results
--preview-len <N>150Preview length in characters

Search Modes:

ModeDescription
hybridCombines semantic and BM25 scores using RRF (recommended)
semanticVector similarity search using embeddings
bm25Traditional full-text search with BM25 scoring

Examples:

Terminal window
# Basic hybrid search
rlm-cli search "database connection errors"
# Search with more results
rlm-cli search "API endpoints" --top-k 20
# Semantic-only search
rlm-cli search "authentication flow" --mode semantic
# Search specific buffer
rlm-cli search "error handling" --buffer logs
# Search with content preview
rlm-cli search "auth" --preview --preview-len 200
# JSON output for programmatic use
rlm-cli --format json search "your query" --top-k 10

Output (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'


Update an existing buffer with new content, re-chunking and optionally re-embedding.

Terminal window
rlm-cli update-buffer [OPTIONS] <BUFFER> [CONTENT]

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name
[CONTENT]New content (reads from stdin if omitted)

Options:

OptionDefaultDescription
-e, --embedAutomatically embed new chunks after update
--strategy <STRATEGY>semanticChunking strategy
--chunk-size <SIZE>3000Chunk size in characters
--overlap <SIZE>500Overlap between chunks

Examples:

Terminal window
# Update from stdin
cat updated.txt | rlm-cli update-buffer main-source
# Update with inline content
rlm-cli update-buffer my-buffer "new content here"
# Update and re-embed
rlm-cli update-buffer my-buffer --embed
# Update with custom chunking
cat new_code.rs | rlm-cli update-buffer code-buffer --strategy code

Split chunks into batches for parallel subagent processing. Returns batch assignments with chunk IDs for orchestrator use.

Terminal window
rlm-cli dispatch [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name

Options:

OptionDefaultDescription
--batch-size <N>10Number 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>hybridSearch mode for query filtering
--threshold <SCORE>0.3Minimum similarity threshold for filtering

Examples:

Terminal window
# Dispatch all chunks in batches of 10
rlm-cli dispatch my-buffer
# Create 4 batches for 4 parallel workers
rlm-cli dispatch my-buffer --workers 4
# Only dispatch chunks relevant to a query
rlm-cli dispatch my-buffer --query "error handling"
# JSON output for orchestrator
rlm-cli --format json dispatch my-buffer

Output (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]}
]
}

Combine findings from analyst subagents. Reads JSON findings, filters by relevance, groups, and outputs a synthesizer-ready report.

Terminal window
rlm-cli aggregate [OPTIONS]

Options:

OptionDefaultDescription
-b, --buffer <BUFFER>Read findings from a buffer (stdin if omitted)
--min-relevance <LEVEL>lowMinimum relevance: none, low, medium, high
--group-by <FIELD>relevanceGroup by: chunk_id, relevance, none
--sort-by <FIELD>relevanceSort 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:

Terminal window
# Aggregate from stdin
cat findings.json | rlm-cli aggregate
# Read from buffer
rlm-cli aggregate --buffer analyst-findings
# Filter to high relevance only
rlm-cli aggregate --min-relevance high
# Store aggregated results
rlm-cli aggregate --output-buffer synthesis-input
# JSON output
rlm-cli --format json aggregate

Get a chunk by ID (primary pass-by-reference mechanism for subagents).

Terminal window
rlm-cli chunk get [OPTIONS] <ID>

Arguments:

ArgumentDescription
<ID>Chunk ID (globally unique across all buffers)

Options:

OptionDescription
-m, --metadataInclude metadata in output

Examples:

Terminal window
# Get chunk content
rlm-cli chunk get 42
# Get chunk with metadata (JSON)
rlm-cli --format json chunk get 42 --metadata

List all chunks for a buffer.

Terminal window
rlm-cli chunk list [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name

Options:

OptionDefaultDescription
-p, --previewShow a content preview for each chunk
--preview-len <N>100Preview length in characters

Examples:

Terminal window
# List chunks for buffer
rlm-cli chunk list docs
# List with content preview
rlm-cli chunk list docs --preview
# List with longer preview
rlm-cli chunk list docs --preview --preview-len 200
# JSON output
rlm-cli --format json chunk list docs | jq '.[].id'

Generate embeddings for buffer chunks. Note: Embeddings are automatically generated during load, so this is typically only needed with --force to re-embed.

Terminal window
rlm-cli chunk embed [OPTIONS] <BUFFER>

Arguments:

ArgumentDescription
<BUFFER>Buffer ID or name

Options:

OptionDescription
-f, --forceForce re-embedding even if embeddings exist

Examples:

Terminal window
# Check if embeddings exist (will report "already embedded")
rlm-cli chunk embed docs
# Force re-embedding
rlm-cli chunk embed docs --force

Show embedding status for all buffers.

Terminal window
rlm-cli chunk status

Example Output:

Embedding Status
================
Total: 42/42 chunks embedded
Buffer ID Chunks Embedded
docs 1 15 15
logs 2 27 27

Manage context-scoped variables (persisted per session/context).

Terminal window
rlm-cli var [OPTIONS] <NAME> [VALUE]

Arguments:

ArgumentDescription
<NAME>Variable name
[VALUE]Value to set (omit to get current value)

Options:

OptionDescription
-d, --deleteDelete the variable

Examples:

Terminal window
# Set a variable
rlm-cli var current_chunk 3
# Get a variable
rlm-cli var current_chunk
# Delete a variable
rlm-cli var current_chunk --delete

Manage global variables (persisted across all contexts).

Terminal window
rlm-cli global [OPTIONS] <NAME> [VALUE]

Arguments:

ArgumentDescription
<NAME>Variable name
[VALUE]Value to set (omit to get current value)

Options:

OptionDescription
-d, --deleteDelete the variable

Examples:

Terminal window
# Set a global variable
rlm-cli global project_name "my-project"
# Get a global variable
rlm-cli global project_name
# Delete a global variable
rlm-cli global project_name --delete

ParameterDefaultDescription
chunk_size3,000 chars~750 tokens (optimized for semantic search)
overlap500 charsContext continuity between chunks
max_chunk_size50,000 charsMaximum allowed chunk size
VariableDescription
RLM_DB_PATHDefault database path

CodeDescription
0Success
1General error
2Invalid arguments

All commands support multiple output formats via --format:

FormatDescription
textHuman-readable text (default)
jsonJSON for programmatic use
ndjsonNewline-delimited JSON for streaming
Terminal window
# Status as JSON
rlm-cli status --format json
# List buffers as JSON
rlm-cli list --format json
# Search results as JSON
rlm-cli grep document.md "pattern" --format json
# NDJSON for streaming pipelines
rlm-cli --format ndjson chunk list my-buffer