CLI Reference

The StrataDB CLI (strata) provides an interactive command-line interface for interacting with StrataDB databases.

Installation

# From crates.io
cargo install strata-cli

# From source
git clone https://github.com/stratadb-labs/strata-core
cd strata-core
cargo install --path crates/cli

Quick Start

# Open a database
strata /path/to/data

# Or use an in-memory database
strata --memory

# Run a single command
strata /path/to/data -c "kv put greeting hello"

Command Line Options

OptionDescription
<PATH>Path to the database directory
--memoryUse ephemeral in-memory database
-c, --command <CMD>Execute command and exit
--jsonOutput in JSON format
--rawOutput raw values (no formatting)
-h, --helpShow help
-V, --versionShow version

Command Reference

Database Commands

CommandDescription
pingCheck database connectivity
infoGet database statistics
flushFlush pending writes to disk
compactTrigger database compaction

KV Store Commands

CommandDescription
kv put <key> <value>Store a value (supports multiple pairs)
kv get <key>Retrieve a value (supports multiple keys)
kv del <key>Delete a key (supports multiple keys)
kv list [--prefix <p>]List keys with optional prefix
kv history <key>Get version history

Options:

  • --with-version, -v — Include version and timestamp with get
  • --prefix, -p — Filter by prefix
  • --limit, -n — Maximum results
  • --all, -a — Fetch all (auto-pagination)

State Cell Commands

CommandDescription
state set <cell> <value>Set a state cell
state get <cell>Get a state cell
state init <cell> <value>Initialize if not exists
state cas <cell> <value> [--expect <v>]Compare-and-swap
state del <cell>Delete a state cell
state list [--prefix <p>]List state cells
state history <cell>Get version history

Event Log Commands

CommandDescription
event append <type> <payload>Append an event
event get <sequence>Get event by sequence
event list <type>List events by type
event lenGet total event count

Options:

  • --file, -f — Read payload from file (use - for stdin)
  • --limit, -n — Maximum events
  • --after, -a — Return events after sequence

JSON Store Commands

CommandDescription
json set <key> <path> <value>Set value at JSONPath
json get <key> <path>Get value at JSONPath
json del <key> <path>Delete at JSONPath
json list [--prefix <p>]List document keys
json history <key>Get version history

Vector Store Commands

CommandDescription
vector create <coll> <dim>Create collection
vector drop <coll>Delete collection
vector listList collections
vector stats <coll>Collection statistics
vector upsert <coll> <key> <vector>Insert/update vector
vector get <coll> <key>Get vector by key
vector del <coll> <key>Delete vector
vector search <coll> <query> <k>Search similar vectors

Options:

  • --metric, -m — Distance metric (cosine, euclidean, dot_product)
  • --filter, -f — Metadata filter (JSON array)
  • --metadata — Attach metadata to vector

Branch Commands

CommandDescription
branch create <name>Create new branch
branch info <name>Get branch metadata
branch listList all branches
branch exists <name>Check if branch exists
branch del <name>Delete branch
branch fork <src> <dst>Fork with all data
branch diff <a> <b>Compare two branches
branch merge <src> <tgt>Merge branches
branch use <name>Switch to branch
branch export <name> <path>Export to bundle file
branch import <path>Import from bundle file

Space Commands

CommandDescription
space create <name>Create new space
space listList all spaces
space exists <name>Check if space exists
space del <name>Delete empty space
space del-force <name>Delete space and all data
space use <name>Switch to space

Transaction Commands

CommandDescription
txn beginStart transaction
txn commitCommit transaction
txn rollbackRollback transaction
txn infoGet transaction info
txn activeCheck if transaction active

Search Command

search <query> [--k <n>] [--primitives <list>]

Search across multiple primitives (kv, json, events, state).


Output Formats

Human (default)

Redis-style output optimized for readability:

> kv put name "Alice"
(integer) 1

> kv get name
"Alice"

> kv list
1) "name"

JSON (--json)

Machine-readable JSON output:

strata /data --json -c "kv get name"
# {"value": "Alice"}

Raw (--raw)

Unformatted values only:

strata /data --raw -c "kv get name"
# Alice

REPL Commands

These commands are only available in interactive mode:

CommandDescription
help [command]Show help for a command
clearClear the screen
quit / exitExit the REPL

Press TAB to autocomplete command names, subcommands, flags, and branch/space names.