Resonance Lattice · Docs

CLI reference

rlat is the command-line interface to a knowledge model. Every subcommand below is wired and ships — this page is rebuilt directly from the command parser.

01 — The surface

Command map

rlat dispatches the following top-level commands. They group into seven jobs: build a model, query it, inspect it, keep it fresh, work the insight / trust layer, drive memory and intent, and share it.

CommandJobNeeds an LLM key?
install-encoderone-time: stage the encoder cacheno
buildbuild a knowledge model from text sourcesno
init-projectone-command project setup (build + primer)no
searchsingle-shot top-k retrieval over source + insight layersno
deep-searchmulti-hop research loop returning a grounded answeryes
profilecorpus shape / bands / drift summaryno
comparecross-knowledge-model comparison (base band)no
summarygenerate an extractive context primerno
skill-contextmarkdown context block for an Anthropic skillno
refreshlocal-mode incremental delta-applyno
watchlive, debounced refresh loopno
syncremote-mode incremental delta-applyno
freshnessremote-mode read-only drift checkno
convertchange storage mode in placeno
auditread-only trust-contract audit of the insight layerno
tracefull provenance chain for an insight or sourceno
reverifyLLM re-judge of stale insightsyes
growopt-in self-improvement pass: fill the archive's most-demanded, worst-covered gaps from its own telemetryyes
probeidle-cycle self-probe of weak-zone queriesyes
memoryper-user flat memory (17 subcommands — full table on Memory & sessions)only verify
intentdeclare and resolve the live intent graphonly decompose (what-next uses one when present)
expertisebuild the expertise primer (memory + intent synthesis)no
lensmanage .lens perspective artefactsno
workspaceresolve / declare the workspace identityno
fabricmanage fabric:// aliases for hosted UDFsno
capture-envauto-probe machine-readable environment attributes into the insight bandno
capture-attributerecord one fact, constraint, or falsified belief about your worldno
consolidate-insightsfold accumulated outcome signals into each insight's confidenceno

A "yes" above means the CLI verb needs a key for unattended runs — not that the capability does. Every keyed loop also runs free in-session on your Claude subscription (API keys — the free path).

An insight is an earned, cited summary stored alongside the raw source passages. rlat search retrieves over both the source layer and the insight layer; deep-search plus the insight layer produce faithfully-grounded answers — every claim traces back to the corpus. See the claim system page for the full model.

02 — Build

rlat build

Build a knowledge model from one or more source paths.

rlat build <sources...> -o knowledge_model.rlat \
  [--store-mode bundled|local|remote] \
  [--remote-url-base URL] \
  [--kind corpus|intent] \
  [--source-root PATH] \
  [--runtime auto|openvino|onnx|torch] \
  [--min-chars N] [--max-chars N] \
  [--batch-size N] \
  [--ext EXT ...]

Examples

# Default: local mode — smallest .rlat, source stays on disk
rlat build ./docs ./src -o my-corpus.rlat

# Bundled — self-contained, ship anywhere
rlat build ./docs ./src -o my-corpus.rlat --store-mode bundled

# Remote — source pinned at canonical URLs
rlat build ./docs -o my-corpus.rlat \
  --store-mode remote --remote-url-base https://example.com/corpus/v1

# Restrict to specific extensions (override the default text allowlist)
rlat build ./notebooks -o nb.rlat --ext .ipynb --ext .md

Flags

FlagDefaultEffect
<sources...>(required)One or more files or directories. Directories are walked recursively.
-o, --output(required)Output .rlat path.
--store-modelocalHow the model resolves source files at query time. See the Storage modes page.
--remote-url-base(none)URL prefix joined with each relative source_file. Required when --store-mode remote.
--kindcorpusKnowledge-model kind tag (corpus or intent).
--source-rootcommon ancestor of sourcesRoot for the source_file paths recorded in the registry.
--runtimeautoEncoder runtime. auto = OpenVINO on Intel CPUs, ONNX elsewhere; torch needs the [build] extra.
--min-chars200Chunker minimum chunk size.
--max-chars3200Chunker maximum chunk size.
--batch-size32Encoder batch size. Smaller for tight RAM, larger for GPU throughput.
--ext EXTbuilt-in allowlistOverride the file-extension allowlist. Repeatable; the leading dot is optional.

What gets built

Exit codes

CodeMeaning
0Build succeeded.
1Runtime error (no text files found, chunker produced no passages).
2Usage error (missing <sources>).
Big corpus, no GPU?

CPU encoding runs at ~80–150 passages/sec; a CUDA T4 runs at ~1,500–2,500. For corpora over ~10K passages, the rlat-build-on-kaggle skill walks through using a free T4 GPU.

03 — Setup shortcuts

rlat init-project

One-command project setup. Auto-detects source directories in the current working directory, builds a knowledge model with sensible defaults, and (unless --no-primer) writes a context primer to .claude/resonance-context.md.

cd my-project/
rlat init-project                                  # auto-detect docs/, src/, README.md, etc.
rlat init-project -o custom.rlat                    # override the output path
rlat init-project --source ./notes --source ./code  # explicit sources, skip auto-detect
rlat init-project --no-primer                       # skip .claude/resonance-context.md

It is equivalent to:

rlat build <detected-sources> -o <cwd>.rlat
rlat summary <cwd>.rlat -o .claude/resonance-context.md

Auto-detection looks for docs/, src/, lib/, notebooks/, examples/ and top-level *.md / *.rst / *.txt. If none exist, the command errors and asks you to be explicit with --source rather than producing an empty knowledge model.

rlat install-encoder

Pre-stage the gte-modernbert-base encoder cache. Most users never run this directly — the first rlat build triggers it automatically. Useful for offline-build environments and CI.

rlat install-encoder                   # default pinned revision
rlat install-encoder --force           # re-download and re-convert even if cached
rlat install-encoder --revision <sha>  # pin to a different HuggingFace revision

The cache lives at ~/.cache/rlat/encoders/<revision>/. ONNX is always exported; OpenVINO IR is exported additionally on Intel CPUs.

06 — Inspect

rlat profile

Knowledge-model diagnostics — what is in the .rlat without running a query. Reports the backbone, bands, store mode, build config, ANN parameters, and a drift summary.

rlat profile km.rlat [--format text|json] [--source-root DIR] [--no-drift]

The drift walk re-hashes every passage and reads every distinct source file. --no-drift returns immediately with metadata only — useful for scripted dumps or sanity checks on huge models. In JSON, the drift field carries an explicit status tag (computed / skipped) so consumers branch on the status rather than sniffing for keys.

rlat compare

Cross-knowledge-model comparison. Uses the base band on both sides — the band every knowledge model shares, so the numbers are always directly comparable.

rlat compare a.rlat b.rlat [--format text|json] [--sample N]
MetricMeaning
centroid_cosineCosine of the two corpora's mean vectors — a single thematic-alignment number.
coverage_a_in_bMean max-cosine for a sample of A's rows against all of B: "how well are A's passages mirrored in B?"
coverage_b_in_aThe same direction reversed. Asymmetric — corpora differ in size and focus.

Coverage sampling uses a fixed seed, so identical inputs produce identical numbers across runs.

rlat summary

Extractive primer generation. Produces a structured markdown document capturing what is in a knowledge model — designed to be loaded into an AI assistant's system prompt so it knows the corpus shape without spending tokens on a full search.

rlat summary km.rlat [-o output.md] [--query "..." ...] [--source-root DIR]

# The canonical assistant-integration pattern:
rlat summary my-corpus.rlat -o .claude/resonance-context.md
SectionSource
Landscapetop hits against the corpus centroid — "what is this model about?"
Structuresource-file breakdown sorted by passage count
Evidenceper-query top hits (only when --query is given; repeatable)

rlat skill-context

Markdown context block for the Anthropic skill !command dynamic-injection primitive. The shell command runs before the model sees the skill; its stdout replaces the placeholder.

rlat skill-context km.rlat --query "..." [--query "..." ...] \
  [--top-k N] [--token-budget T] \
  [--mode augment|knowledge|constrain] \
  [--source-root DIR] [--strict] [--strict-names]

Output carries citation anchors, a per-passage drift status, and a confidence-metrics header so the model can self-judge. Multiple --query flags emit one block per query, in submission order — useful for pairing a fixed preset query with the user's query. --strict exits with code 2 if any passage has drifted; --strict-names exits with code 3 on a name-aliasing refusal.

07 — Keep it fresh

rlat refresh

Bring a local-mode knowledge model back in sync after you edit source files. Incremental — unchanged passages keep their band rows untouched; only modified and added passages are re-encoded.

rlat refresh my-corpus.rlat                  # apply all deltas
rlat refresh my-corpus.rlat --dry-run        # report counts only

Local mode only. Bundled archives are immutable post-build (re-run rlat build); remote archives route to rlat sync. After a refresh, any insight whose cited source content hash changed is flagged stale by the drift cascade. Override flags: --source (repeatable), --source-root, --ext (repeatable), and --batch-size.

rlat watch

A live, silent, self-discovering refresh loop. It sits on top of rlat refresh — running the incremental delta-apply pipeline on every save after a debounce window, so the archive stays current as you edit.

rlat watch                     # zero-arg: discover *.rlat in cwd, watch all
rlat watch my-corpus.rlat      # explicit single archive
rlat watch --once              # CI / pre-commit: synchronous one-shot reconcile
rlat watch --verbose           # print one line per refresh (default: silent)

The default UX is silent — errors are loud, success is invisible. A short startup line confirms what is being watched, then the loop falls quiet. --once is the CI / pre-commit shape: a synchronous one-shot reconciliation with no observer, since in CI the files have already changed before the command runs. Watch requires the [watch] extra: pip install rlat[watch].

rlat sync

Bring a remote-mode knowledge model back in sync against upstream. The same incremental delta-apply as refresh, with the upstream-state oracle replaced by a network poll.

rlat sync my-corpus.rlat                            # poll mode (default)
rlat sync my-corpus.rlat --upstream-manifest <url>  # catalog mode
rlat sync my-corpus.rlat --dry-run                  # list paths only

Catalog mode (--upstream-manifest) diffs an upstream JSON catalog against the archive's pinned manifest and detects added, modified, and removed paths. Poll mode (default) re-fetches every URL in the existing manifest and detects modified and removed paths only — it cannot enumerate new files. If poll-mode requests hit a network error, sync aborts rather than silently deleting corpus content; --treat-unreachable-as-removed is the explicit opt-in to drop those paths.

rlat freshness

Remote mode only — bundled and local archives print a friendly error pointing at rlat build / rlat refresh.

rlat freshness my-corpus.rlat                 # text report (per-entry status)
rlat freshness my-corpus.rlat --format json   # structured counts + per-entry map

It walks every manifest entry, downloads the upstream bytes, hashes them, and reports per-entry status (verified / drifted / missing). Read-only; exits with code 2 if any entry is non-verified — suitable for CI gating before deciding to run rlat sync.

rlat convert

Switch a knowledge model between storage modes (bundled / local / remote) without rebuilding embeddings. The band, registry, and ANN index are storage-mode-independent — conversion is a metadata and payload shuffle, atomic in place by default.

rlat convert km.rlat --to {bundled|local|remote} \
  [--source-root DIR] \
  [--remote-url-base URL] \
  [-o output.rlat] \
  [--dry-run]
From → ToRequired flags
local → bundled(none)
local → remote--remote-url-base
bundled → local--source-root
bundled → remote--remote-url-base
remote → local--source-root
remote → bundled(none)

--to <current_mode> is a friendly idempotent no-op. Before writing, every kept passage's content hash is re-validated against live bytes; if any passage has drifted, conversion aborts with the drift report — run rlat refresh or rlat sync first, then retry. passage_id and content_hash are preserved across every conversion.

08 — Insight & trust

rlat audit

Read-only inspection of the source/insight provenance state. It surfaces layer sizes and the insight verdict states.

rlat audit km.rlat              # summary (layer sizes, verdict states)
rlat audit km.rlat --stale      # list insights flagged stale by the drift cascade
rlat audit km.rlat --orphans    # list insights whose cited source was removed
rlat audit km.rlat --format json

The audit also surfaces the corpus's own self-audit — the LLM-free shape report computed at build/refresh: under-served demand gaps and same-topic cross-document contradiction candidates (high-cosine pairs worth a stance check). --with-text / --min-cosine recompute the candidates live at a chosen cosine floor with resolved text (judge-ready, demand-ranked); --external lists web-fetched claims and their source URLs — the input to a world-freshness re-check.

rlat audit km.rlat --shape                          # demand gaps + contradiction candidates (stored)
rlat audit km.rlat --shape --min-cosine 0.85 --with-text   # live, judge-ready candidate pairs
rlat audit km.rlat --external --format json         # web-fetched claims + their source URLs

rlat trace

The full provenance chain for an insight or a source passage. Given an insight_id, it prints the cited source passages with hash and char span, plus any lineage chain. Given a source passage_id, it prints every insight that cites that passage (a reverse trace).

rlat trace km.rlat <insight_id-or-passage_id> [--format text|json]

rlat reverify

After rlat refresh flags insights as stale (because their cited source content hash changed), reverify asks an LLM whether the updated source still supports each insight. Survivors flip back to accepted with refreshed citations; failures retire. LLM-driven — needs an Anthropic API key (~1 call per stale row).

rlat reverify km.rlat [--limit N] [--model ID] [--verbose]

rlat grow

One opt-in pass of the self-improvement loop. Reads the archive's own persisted telemetry for confirmed-recurring intents the corpus answers relatively worst, authors a grounded fill for the top --max-fills of them, and lands each through the faithfulness gate + compression test into the insight band. --dry-run previews the candidates with no LLM call and no writes. Opt-in by design — it spends LLM calls and writes to the archive, so it never runs implicitly. Telemetry accrues when sessions run with RLAT_CAPTURE_PERSIST=1; with no telemetry the command is a clean no-op.

rlat grow km.rlat [--max-fills N] [--dry-run] [--source-root DIR] [--model ID]

rlat probe

An idle-cycle self-probe. Between active sessions it scans the workspace event ledger for weak zones — queries that previously failed to ground, or repeated queries that never received a positive verdict — and re-attempts deep-search against the current corpus. Successful re-runs write synthesis candidates automatically. LLM-driven — needs an Anthropic API key.

rlat probe km.rlat [--limit N] [--max-hops N] [--top-k N] [--dry-run]

rlat capture-env

Auto-probe the machine-readable environment and land every observed attribute in the knowledge model's insight band — shell version, operating system, account type, execution policy, domain membership, proxy, plus the corpus size read from the archive itself. One command, zero questions, zero confabulation: a probe only writes a value it actually read, so a captured fact can never be invented. Each attribute lands keyed, so re-running updates in place rather than duplicating.

rlat capture-env km.rlat [--no-corpus-size]
FlagDefaultEffect
--no-corpus-sizeoffSkip the corpus-size attribute (the passage count read from the archive).
$ rlat capture-env my-project.rlat
  + The user is running PowerShell 7.4.6 (Core edition).
  + The user's operating system is Windows 11 Pro.
  + The user's knowledge model contains 39 passages.
[rlat capture-env] captured 3 attribute(s) into my-project.rlat

rlat capture-attribute

Manually record one fact about your world — the fallback for facts no probe can read. The claim lands in the knowledge model's insight band, born active, and is served alongside retrieval from then on.

rlat capture-attribute km.rlat "<text>" \
  [--kind attribute|constraint|falsified] \
  [--criticality low|normal|high|critical] \
  [--attribute-key KEY]
FlagDefaultEffect
<text>(required)The fact, or - to read it from stdin.
--kindattributeattribute — a fact about your environment. constraint — a standing rule, always served rather than retrieved by similarity. falsified — something proven wrong, stored as a negation claim.
--criticalityhighHow decisive the fact is for answers: low / normal / high / critical.
--attribute-key(none)Normalized subject for serve-time dedup (e.g. workspace capacity). Within the same kind, the newest value for a key wins at serve time. Omit to leave unkeyed — never deduped.
# A fact about your environment — keyed, so a newer value replaces it
rlat capture-attribute my-project.rlat \
  "The team's Fabric capacity is an F64 SKU." --attribute-key "fabric capacity"

# A standing rule — always served, never lost to a similarity miss
rlat capture-attribute my-project.rlat \
  "Deploys to prod happen Tuesday only." --kind constraint

# Something proven wrong — put the evidence in the text
rlat capture-attribute my-project.rlat \
  "Tried caching encoder weights in OneLake; falsified by the 2026-05 latency benchmark." \
  --kind falsified
09 — Memory

rlat memory <subcommand>

Per-user flat memory. Memory is a flat, polarity-tagged, confidence-graded row store — one embedding band plus one row file per user, at ~/.rlat/memory/<user-id>/. Rows carry a primary polarity (prefer / avoid / factual) and a workspace scope tag. The claim system page is the full guide; the subcommand surface is:

SubcommandPurpose
addAppend a manual row; auto-stamps the cwd workspace tag.
listTabular view of the row store, with optional filters.
recallGated retrieval. Synchronous one-shot by default; --daemon boots the long-lived recall server.
feedbackLog a good/bad vote on the most recent recall injection.
consolidateRun the session-end pass: confidence raise → forget. Fully mechanical — no LLM, no key. Flags: --cwd, --dry-run.
verifyCheck high-criticality rows against a corpus. Needs an API key.
corroborateUser corroboration — raise a row's confidence one step.
evalPrint the longitudinal scorecard (useful + effortless axes).
rollupWeekly digest — this week versus the prior week.
dedupRetroactively collapse same-text, same-workspace rows.
session-markRecord a session-boundary timestamp.
trainMutate a row (--bad-vote / --good-vote / --corroborate); the full training loop runs via the /rlat-train slash command.
gcManual escape-hatch deletion; requires at least one filter, never automatic.
doctorProbe the per-user store, the recall daemon, and the encoder revision.
hookUserPromptSubmit hook entry point — wired via settings.json.
install-hooksWire the recall + capture hooks into Claude Code settings.json. --user targets ~/.claude/settings.json; --project-dir sets the project root containing .claude/ (default: cwd); --mine also sets RLAT_MINE_ATTRIBUTES=1 to opt into passive world-fact mining. Idempotent; preserves foreign hooks.
captureSessionEnd hook entry point — wired via settings.json.
Exit codes

0 success · 1 usage / runtime error · 2 deprecated subcommand (primer — replaced by the per-prompt UserPromptSubmit hook) · 3 a surface that runs as a Claude Code slash command rather than a CLI body (train <task>/rlat-train).

# Add a manual row — defaults to polarity=factual + the cwd workspace tag
rlat memory add "prefer pytest -xvs <path> for debugging" --polarity prefer

# Cross-workspace habit — visible in any cwd
rlat memory add "prefer Sonnet 4.6 over Haiku 4.5" --polarity prefer --scope cross-workspace

# Inspect and recall
rlat memory list --polarity prefer
rlat memory recall "how do I run the tests" --top-k 5 --explain

# Garbage collect — requires a filter; --dry-run previews
rlat memory gc --is-bad --dry-run
10 — Intent & expertise

rlat intent <subcommand>

Declare and resolve the live intent graph at .rlat-state/intent/ — the goals, tasks, and steps the agent is working toward.

SubcommandPurpose
addDeclare a new live intent (a step or task).
listList live intents, optionally filtered by status.
pathPrint the parent chain (root → leaf) for an intent.
acceptRecord a user-source satisfied verdict on an intent.
rejectRecord a user-source not satisfied verdict on an intent.
activateFlip a proposed intent to active.
what-nextRecommend the next move from the live intent graph. Uses an LLM to phrase the recommendation when a key is present; falls back to a plain top-candidate readout without one (--no-llm forces the fallback).
decomposeDecompose a task intent into step children via an LLM. Needs an API key — refuses cleanly without one.
declare-durableDeclare a durable goal or direction, written to the per-user store.
durableList durable goals and directions.
capture-planCapture plan-mode output as a proposed task plus steps.

accept and reject here are intent verdicts — the user telling the agent whether an intent was satisfied. They are not a memory or insight promotion gate; insight promotion is faithfulness-gated and outcome-driven.

rlat expertise build

Render the expertise primer — the earned synthesis of the memory and intent layers — to disk (default .claude/expertise.md) so the agent reads it on session start.

rlat expertise build [--out PATH] [--max-intents N] [--max-memory-rows N]

rlat workspace

Resolve or declare the per-project workspace identity the harness uses for memory and intent tagging.

rlat workspace status                  # show the resolved identity + its source
rlat workspace declare --name my-proj  # write a workspace declaration override
11 — Lens

rlat lens <subcommand>

Manage .lens artefacts — a saved perspective that reweights retrieval. The claim system page is the full guide.

SubcommandPurpose
createCreate a new empty lens (--id, --name, --scope, optional --stance file).
showInspect a .lens file.
composeCombine two or more lenses into one.
rlat lens create --id team-a --name "Team A" --scope team -o team-a.lens
rlat lens set-trust team-a.lens "docs/external/*" 0.2   # suppress external docs
rlat lens set-trust team-a.lens "src/*" 2.0             # boost first-party source
rlat lens set-trust team-a.lens "src/*" --remove        # drop a weight again
rlat lens show team-a.lens
rlat search my-corpus.rlat "..." --lens team-a.lens
12 — Fabric

rlat fabric

Manage the fabric://<alias> aliases used by rlat search fabric://.... Each alias maps to a Microsoft Fabric User Data Function endpoint URL.

rlat fabric add team=https://<udf-endpoint-url>   # register an alias + scaffold the skill
rlat fabric list                                   # show all registered aliases
rlat fabric remove team                            # drop an alias
rlat fabric publish-rlat ./team-docs.rlat \        # maintainer: upload .rlat + update the manifest
    --workspace <ws-id> --lakehouse <lh-id>

Each add / remove rewrites a rlat-fabric-search skill under .claude/skills/ so Claude Code's skill list reflects the current alias set. The first fabric:// query mints a Microsoft Entra token — device-code flow by default, with a service-principal fallback when the Azure environment variables are set. See the Fabric page for the end-to-end setup.

What's next