Skip to content

CLI Reference

All commands are under basemode-loom. Run basemode-loom --help or basemode-loom <command> --help for up-to-date flags.

The CLI defaults to view, so basemode-loom some-id-or-text behaves like basemode-loom view some-id-or-text.

Generation

run

Generate continuations from a new prompt.

basemode-loom run "Your prompt here" [OPTIONS]
Option Default Description
-m, --model gpt-4o-mini Model to use
-M, --max-tokens 200 Max tokens per continuation
-n, --branches 1 Number of parallel continuations
-t, --temperature 0.9 Sampling temperature
-s, --strategy auto Force a basemode continuation strategy
--rewind false Rewind short trailing word fragments before generation
--show-strategy false Print the resolved strategy before generation
--show-usage false Print token usage estimates after generation
--show-cost false Print estimated cost after generation
--db default DB Use a custom SQLite database path

If prefix is omitted, run will read from stdin.

continue

Generate continuations from the current active node.

basemode-loom continue [OPTIONS]

Uses the same model/settings as the active node's tree unless overridden.

Option Description
-b, --branch Branch index to continue from (default: checked-out child)
-m, --model Override the active tree model
-n, --branches Number of continuations
-M, --max-tokens Override max tokens
-t, --temperature Override temperature
-s, --strategy Override strategy
--rewind Rewind short trailing word fragments before generation
--show-strategy / --show-usage / --show-cost Print generation diagnostics
--db Use a custom SQLite database path

Chat

chat

Plain chat with any basemode model, stored as a loom tree: every turn is a node, every reply a branch.

basemode-loom chat "pick a scottish island" -s "be terse"   # new chat
basemode-loom chat -c "how many people live there?"         # continue it
basemode-loom chat -c "now as a haiku" -m claude-haiku-4-5 -m groq/openai/gpt-oss-120b
basemode-loom chat -c -b 2                                   # switch to reply 2, print the chat
basemode-loom chat -l                                        # list chats, most recent first
basemode-loom chat -r 297a "and another thing"               # continue an older chat by id prefix
cat notes.md | basemode-loom chat "summarise this"
Option Default Description
-c, --continue false Continue the most recent chat; with no message, print it
-r, --resume — Continue a specific chat by id or id prefix (a node id resumes from that exact turn)
-l, --list false List chats: id, name, turns on the current path, replies, models, last updated
-b, --branch — With -c/-r: switch to sibling reply N of the last turn first
-m, --model stored basemode default Model to answer; repeat to ask several side by side
-n, --branches 1 Replies per model
-s, --system — System prompt (new chats only; stored as the tree context)
-M, --max-tokens 4096 Max output tokens per reply
-t, --temperature 0.7 Sampling temperature
--db chats.sqlite Chat database

Piped or redirected stdin is prepended to the message. Several replies stream side by side; the conversation continues from reply 1 unless you pick another with -b. A send that no model answered is discarded, so the next -c carries on from the last real reply. -c follows the most recently touched chat: resuming one with -r, or navigating it in view, makes it the latest. If the chat database has a keyword index (see index), each reply tops it up, so new turns are searchable straight away.

Chats are kept in their own database, ~/.local/share/basemode/chats.sqlite (BASEMODE_CHAT_DB overrides), so they never become loom's active node or appear in its tree picker. The format is ordinary loom data — see Tree Structure — so basemode-loom view --db ~/.local/share/basemode/chats.sqlite browses them, but generating in the TUI still does raw continuation.

view

Open the interactive TUI explorer.

basemode-loom view [NODE_ID_OR_FILE]

If given a node ID or file path, opens that tree. Otherwise opens the most recently active tree. See TUI Guide for keybindings.

source can be:

  • A node ID or unique node-ID prefix
  • A .txt file, which is imported as a root prompt if needed
  • A .json loom export, which is imported into the store
  • Literal text, which becomes a new root unless an identical root already exists

If no argument is provided and stdin is piped, view uses stdin as the source text.

nodes

List recent nodes.

basemode-loom nodes [-n 20]

active

Show the current active node summary and metadata.

basemode-loom active

show

Show a specific node.

basemode-loom show <NODE_ID>

Supports prefix matching — you can use the first few characters of a node ID. Pass --segment to print only the node's own text segment instead of the reconstructed full text.

children

List the children of a node.

basemode-loom children <NODE_ID>

roots

List all root nodes.

basemode-loom roots

Shows root ID, optional generated name, child count, created time, and a text preview.

select

Mark a node as the active cursor.

basemode-loom select <NODE_ID>

Analysis

embed

Build a sqlite-vec semantic index inside the selected loom database:

basemode-loom embed --db corpus.sqlite --model hash --dim 256
basemode-loom embed --db corpus.sqlite --model mlx
basemode-loom embed --db corpus.sqlite --model mlx --incremental
Option Default Description
--model hash hash, mlx, or an MLX/Hugging Face model ID
--dim 256 Vector dimension for the hash embedder
--min-chars 1 Skip shorter node segments
--batch-size 64 Number of nodes embedded per batch
--incremental false Reuse matching vectors, add new nodes, and prune deleted nodes
--db default DB Database to update

The default hash embedder is deterministic and useful for testing the complete pipeline, but MLX provides meaningful semantic retrieval. Install basemode-loom[embed] for hash indexing or basemode-loom[embed-mlx] for MLX. Changing the model or vector dimension causes an incremental run to rebuild the entire index so query and document vectors remain compatible.

The HTTP API exposes the same active-database operation as POST /api/embeddings; GET /api/embeddings reports its current model, dimension, and vector count. Both operations are included in /openapi.json.

index

Build an FTS5 keyword index (nodes_fts) inside the selected database, so the tree picker's keyword search works on ordinary loom and chat databases, not only on prebuilt corpora. No extra dependencies.

basemode-loom index
basemode-loom index --db ~/.local/share/basemode/chats.sqlite
basemode-loom index --db ~/.local/share/basemode/chats.sqlite --incremental
Option Default Description
--min-chars 1 Skip shorter node segments
--incremental false Index new nodes and prune deleted ones instead of rebuilding
--db default DB Database to update

Like the vector index it is an explicit projection: loom does not update it as you generate, so re-run with --incremental to make new nodes searchable. Text edited in place is only picked up by a full rebuild. An existing nodes_fts of a different shape (built by another tool) is refused rather than replaced.

stats

Show quantitative statistics for a tree.

basemode-loom stats [NODE_ID] [--json] [--file EXPORT.json]

Includes tree depth, path stats, model breakdown, bookmark/hide rates, and descendant-score metrics. Pass --json for machine-readable output, or --file to analyze a JSON export without using the SQLite store.

rating

Rate models against each other using the choices already in the trees.

basemode-loom rating [--root ID] [--models a,b,c] [--signal descendant] [--json]

Every generation batch is a controlled comparison, so the corpus is a tournament. Unlike the per-model peer score in stats, these ratings share one scale across cohorts that never met. Reports the comparison graph and its cut edges, elo with bootstrap intervals, depth-conditional fits, which pairwise differences are still unmeasured, and which line-up to generate next. See Model Rating.

Export

export

Export a tree to a file or stdout.

basemode-loom export --to json
basemode-loom export --node <NODE_ID> --to file.md
basemode-loom export --node <NODE_ID> --to output.json

Supported targets:

  • json for JSON to stdout
  • md or markdown for Markdown to stdout
  • A file path ending in .json, .md, or .markdown

JSON export serializes the full tree. Markdown export writes the currently checked-out path text for that tree.

There is no standalone import CLI command in the current implementation. To import:

  • Open a .json export through basemode-loom view export.json
  • Use the REST POST /api/import endpoint

Server

serve

Start the FastAPI web server.

basemode-loom serve [--host 127.0.0.1] [--port 8000]

See Web Server for API documentation.

Storage

By default, basemode-loom uses ~/.local/share/basemode/generations.sqlite.

  • Override it per command with --db /path/to/file.sqlite
  • Override it globally with BASEMODE_DB=/path/to/file.sqlite