Liking cljdoc? Tell your friends :D

CLI reference: fractal

fractal is the command-line surface for driving sessions and reading what happened. It uses canonical SQLite rows plus BlobStore payloads; Datahike is a rebuildable query index, and the CLI does not read per-session filesystem homes.

fractal <verb> <subject> [args] [--flags]

Invoke it as fractal ... through bin/fractal, or directly with:

clojure -M -m fractal-engine.agentcli ...

Conventions

  • <run> is a session id or alias resolved in the canonical store. The store root defaults to .fractal/ in the invocation directory, override with --runs-dir.
  • [node] is an address within a recursive tree: root, child-0001, or root/child-0001/child-0004.
  • --json emits parseable JSON. stream emits JSONL.
  • --no-color disables ANSI color.

The local store root physically contains store.sqlite, content-addressed blobs, and optionally a derived Datahike index. Those files are backend state, not session identity.

Exit codes

codemeaning
0success / final value exists / claims supported
1engine or usage error
2no FINAL
3timeout
5confabulation suspected by verify

Drive verbs

chat [run]

Talk to a persistent, resumable session. Without [run], starts a new session. With [run], resolves the existing session id/alias and resumes the same session. REPL vars persist across turns through completed-head snapshots. A live progress line polls the canonical store while the turn runs.

fractal chat
fractal chat my-session
fractal chat --provider vertex-gemini --model gemini-3.5-flash

run "<task>"

Start a session, run one turn, and print a chainable session handle.

fractal run "Summarize this repo." --fake-script simple --name demo
fractal run "..." --provider openai --model gpt-4o-mini --json

resume <run> "<task>"

Restore the selected completed head into the same logical session and run another turn. Resume advances the same session current-head and preserves the same cache id. Use --turn N to restore a specific completed turn head.

fork <run> "<task>"

Restore a source head into a new user/API session with a new cache id by default. Fork leaves the source session current-head and fingerprint unchanged. Use --name NAME to assign a stable id/alias to the fork.

Read verbs

show <run> [node]

Display node identity, model/status/counts, step observations, leaves, child addresses, and final summary. --final resolves and prints the full final value. --leaves focuses on leaf calls.

fractal show my-run
fractal show my-run child-0002
fractal show my-run child-0002 --final

tree <run>

Print the recursive session tree: one line per node with status and step/leaf/child counts.

prime <run>

Compact orientation for a run: model, status, counts, final summary, and next commands.

ls

List canonical sessions in the store root with status, counts, and final presence.

store check|rebuild-index

Validate the canonical SQLite + BlobStore root, or rebuild the derived Datahike index:

fractal store check --json
fractal store rebuild-index

inspect <run> [node]

Structured session/node details. Use --json for API-friendly output.

verify <run> [node]

Run the trust layer over a node's FINAL value.

  • default: deterministic grep floor over cited file evidence;
  • --root <repo>: resolve relative citations against a repo root;
  • --deep: use the engine as an adversarial judge.
fractal verify my-run child-0001 --root .
fractal verify my-run child-0001 --root . --deep \
  --provider vertex-gemini --model gemini-3.5-flash

trace <run> [node]

Claim provenance for a node: final value, evidenced claims, and child/leaf refs.

cost <run>

Spend breakdown from canonical call facts: calls, tokens, cost, and per-child rollups. It reports visibility, not a cap.

Drive commands that settle a turn print a compact turn plus total spend summary. codebrain init and codebrain ask print the full usage block: this turn versus cumulative, with root, child RLM, leaf, token, cache, and estimated-cost splits. LLM calls are provider calls; rows include structural invocation records such as child RLM edges.

leaves <run> [node]

Resolve a node's leaf call inputs and outputs from BlobStore.

step <run> [node] N

Print one model/eval step in full.

stream <run> (alias tail)

Print canonical event facts as JSONL in append order. This is not tail events.ednl; no session event file is required.

Engine options

These apply to run, resume, fork, and chat:

flagmeaning
--provider / --modelroot provider and model
--leaf-provider / --leaf-modelprovider/model for lm and map-lm
--child-provider / --child-modelprovider/model for rlm, map-rlm, attach-rlm
--fake-script NAMEoffline scripted provider
--runs-dir DIRcanonical store root; default .fractal/
--name IDassign session id/alias
--max-turns Nturn leash
--max-fanout Nfanout leash
--call-timeout-ms MSper-call wall-clock timeout

Live runs cost money and can hang. Normal use should set practical leashes until an engine-level governor exists.

Operation semantics

  • FINAL returns control and records a completed head; it does not terminate the session.
  • resume advances the same session.
  • fork creates a new user/API session and leaves the source unchanged.
  • rlm and map-rlm create child sessions, invocation facts, and model-visible RLM envelopes (:rlm/value, :rlm/session, :rlm/head, :rlm/meta).
  • attach-rlm continues a session ref or branches from a head ref. Session-ref attach advances the callee session; head-ref attach creates a new attached child and leaves the source head unchanged.
  • lm and map-lm create calls only.

Recipes

# offline: run, then read
fractal run "Define x and return it." --fake-script simple --name demo
fractal show demo
fractal tree demo
fractal inspect demo --json

# live: start a session with explicit models
fractal chat --provider vertex-gemini --model gemini-3.5-flash \
  --child-provider vertex-gemini --child-model gemini-3.5-flash \
  --leaf-provider vertex-gemini --leaf-model gemini-3.1-flash-lite-preview \
  --call-timeout-ms 600000

# machine-readable events
fractal stream demo | jq 'select(.["event/type"] == "call/started")'
fractal show demo --json | jq '.final'

Backend status

This pass implements local SQLite, a filesystem-backed BlobStore, and a rebuildable filesystem-backed Datahike index. No S3/AWS backend is implemented.

Can you improve this documentation? These fine people already did:
DeadMeme5441 & DeadMeme
Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close