Cymatix Context
Pages

Cymatix Context

Start

Concepts

Reference

Project

CLI

  • cymatix is the cold-start surface. Every invocation is a fresh Python process: it opens the SQLite knowledge store (read-only by default), runs one operation, and exits. No daemon, no long-lived state, no server required.
  • That makes it the natural surface for scripts, CI, and subprocess-driving agents. An agent can run a full retrieve → verify → drill → reread loop without an MCP host or an HTTP port.
  • Every agent-facing command takes --json, built by the same code as the matching MCP tool and HTTP endpoint, so the item shapes match and a caller can swap surfaces with little or no parser change. The envelopes differ in a few places; see the shapes table under the --json workflow below.
  • Canonical spellings come first. cymatix document get and --max-docs are the software-lexicon forms; cymatix gene get and --max-genes are legacy aliases and remain fully supported, not deprecated.
  • The long-lived HTTP surface is a separate entry point: cymatix-server. See HTTP API.

Commands

Command Purpose
cymatix query "<text>" Run the retrieval pipeline once and print the result
cymatix packet "<text>" Freshness-labeled agent-safe evidence bundle: verified / stale_risk items plus a refresh_targets reread plan
cymatix refresh-targets "<text>" The reread plan only, no evidence items
cymatix document get <id> (legacy: cymatix gene get) Full document model — content, tags, signals, fragments, lifecycle tier, embedding
cymatix document preview <id> (legacy: cymatix gene preview) Content-only char-capped snippet for a cheap relevance check
cymatix neighbors "<text>" Top-k SEMA neighbors for a query — a semantic-space graph walk
cymatix ingest <path> Add a file or directory to the knowledge store
cymatix status Store reachable, config valid, optional server probe
cymatix diag corpus Corpus shape: documents, fragments, tier mix, compression ratio, staleness
cymatix diag bed [--db PATH] [--identity] Bed provenance: what built this store, on what code, and how it has aged. --identity adds the live document-id digest (a full scan)
cymatix config show [--text] [--config PATH] The effective configuration — TOML merged with env overrides. JSON by default; --text prints flat key=value lines
cymatix mcp lanes List the configured lanes: name, role, URL, MCP entry name, store path (0.11.0)
cymatix mcp install --host H [--lane L] Point a chat host's MCP config at a lane (0.11.0)
cymatix compare --lanes A,B --queries FILE Run the same queries against two lanes and write a diff receipt (0.11.0)
cymatix mcp serve --http [--port N] [--lane L] [--profile P] Serve the MCP tools over loopback streamable HTTP for clients that cannot spawn a stdio process (0.12.0)
cymatix trace export --in SRC --out DIR Shareable, re-keyed export of metadata-level packet traces (0.11.3)
cymatix plugins list The add-ons found, with source, signature check and status (0.12.0)
cymatix serve Deferred. Prints a pointer at cymatix-server and exits 4

cymatix document and cymatix gene resolve to the same module, so cymatix document get abc123 --json and cymatix gene get abc123 --json are byte-identical in behavior.

Which one to reach for

You want to… Command
Understand what a term means in this codebase cymatix query
Check whether what you know is still fresh, before editing cymatix packet --task-type edit
Know what to reread before a destructive operation cymatix refresh-targets
Inspect one specific document cymatix document get / cymatix document preview
Look around a result before acting cymatix neighbors
Check that the store is healthy cymatix status, cymatix diag corpus
See what config actually loaded cymatix config show
Check an engine change 1:1 against the live build cymatix compare

Flags that matter

cymatix query "<text>" [--k N] [--json] [--tier focused] [--learn]

  • --k N — cap on returned documents. Omitted, it honors [budget] max_docs_per_turn (legacy max_genes_per_turn, default 12).
  • --tier focused — walk-tier hint, mapping to the internal decoder_mode = "condensed". focused is the only accepted value today; the full broad / focused / tight vocabulary lands in v1.1, and anything else is rejected by argparse with exit 2.
  • --learn — replicate the query back into the store. Off by default, so repeated CLI calls never silently mutate state.

cymatix packet "<text>" [--task-type T] [--max-docs N] [--include-raw] [--json]

  • --task-type ∈ {plan, explain, review, edit, debug, ops, quote}, default explain. Higher-risk types apply stricter freshness and coordinate-confidence gates — the same query can come back verified under explain and needs_refresh under edit.
  • --max-docs N (legacy --max-genes) — retrieval top-K, default 8. Both spellings share one argparse destination, so passing both is plain last-wins; the config-surface "legacy wins" collision rule does not apply here.
  • --include-raw — full document content per item instead of the compressed thumbnail. Use it when the packet is the only context source and the downstream model needs real bytes.

cymatix refresh-targets "<text>" [--task-type T] [--max-docs N] [--json] — same flags, but --task-type defaults to edit (the usual caller).

cymatix document preview <id> [--chars N] [--json] — --chars sets the preview budget, default 240.

cymatix neighbors "<text>" [--k N] [--json] — --k defaults to 10. Returns count: 0 with no error when the SEMA codec is unavailable — the embeddings extra is missing, or no embeddings are populated. Use cymatix status or cymatix diag corpus to tell those cases apart.

cymatix ingest <path>

Flag Effect
--recursive / -r Walk subdirectories. Without it, top-level files only
--ext .EXT Add an extension. Repeatable. Default set: .txt .md .rst .py .ts .js .json .toml .yml .yaml
--exclude-dir NAME Skip a directory name during a recursive walk. Repeatable; adds to the default set
--no-default-excludes Walk vendored and generated trees too (.venv, node_modules, .git, __pycache__, dist, build, …). Off by default — ingesting a virtualenv poisons the store with third-party source
--okf Treat the path as an OKF v0.1 knowledge bundle directory. Walks every non-reserved .md file itself; --recursive / --ext do not apply
--bundle-id ID Override the OKF bundle id (default: the directory name). --okf only
--deterministic Deterministic-ingest profile: no SEMA / dense / SPLADE encodes at ingest, so the store holds no float tensors. --okf only

Single-file inputs are extension-filtered too — cymatix ingest binary.exe errors rather than silently ingesting garbage. --json prints a machine-readable summary.

Lanes, MCP over HTTP, compare, trace export, and plugins

cymatix mcp install --host H [--lane L] [--scope workspace|user] [--dry-run]

  • --host ∈ {claude-code, claude-desktop, cursor, gemini-cli}. The primary lane is written as the canonical cymatix-context entry; any other lane as cymatix-context-<lane> beside it, so one host can reach several lanes.
  • Only the entry's CYMATIX_MCP_URL and host tags are rewritten; its command, args and any env keys you added are kept. The file is backed up and replaced atomically. Only JSON mcpServers hosts are written; Codex (TOML) keeps using cymatix-status snippets. --dry-run prints the entry without writing.
  • --server-command / --server-arg (repeatable) override the launch command; the desktop app passes its bundled engine here.

cymatix mcp serve --http [--port N] [--lane NAME] [--profile lean|full|remote-read] [--host 127.0.0.1] (0.12.0)

  • Serves the MCP tools over stateless streamable HTTP at /mcp. Defaults: port 11441, lane stable (the lane's port becomes the proxied Cymatix URL, as in install), profile lean (the same tools as stdio).
  • Loopback only. Any --host other than 127.0.0.1 exits 2, and a request whose Host or Origin is not loopback is rejected.
  • remote-read exposes only cymatix_context, cymatix_context_packet, cymatix_health and the five cymatix_document_* read tools, and refuses to start if the surface cannot be pruned to exactly that set.
  • Identity, the optional CYMATIX_MCP_HTTP_TOKEN bearer, and the session rules for this transport: "Streamable HTTP transport" on MCP and IDE Integration.
  • Exit 0 clean stop, 2 unknown lane, non-loopback host or missing --http.

cymatix compare --lanes A,B --queries FILE [--max-docs N] [--out PATH] [--token T]

  • Sends each query to both lanes' /context/packet with ignore_delivered, and writes a receipt (default compare-<a>-vs-<b>-<timestamp>.json) with per-query delivered ids, identical / same_set / top1_same / jaccard, the know/miss verdict of each side, and each lane's /admin/config-dump. Queries are matched by text, never by position.
  • --queries reads .txt (one per line, # comments), .jsonl or .json (strings, or objects with question / query). --max-docs defaults to
  • --token defaults to $CYMATIX_ADMIN_TOKEN.
  • Tie-breaks can depend on Python's hash seed: start both lanes with the same PYTHONHASHSEED before reading a small diff as a change. Lane setup: Configuration.

cymatix trace export --in SRC --out DIR

  • SRC is a trace directory or a packets*.jsonl file. The export refuses full-level records, re-keys every hash and every content- or path-derived id under a fresh per-export key (document ids are content hashes, so they are never exported in the clear), drops raw text and the chain hash, aborts on a secret-scan hit, and writes a per-field keep / rekey / drop manifest.
  • The output is JSONL; a Parquet copy is written beside it only when pyarrow is installed (the trace-export extra, pip install "cymatix-context[trace-export]"). Exit 1 when the export is refused or the input is missing.

cymatix plugins list (0.12.0)

  • One row per add-on found in the cymatix.plugins entry-point group and the plugin directory: name, version, source (entry_point or directory), whether its signature verified, and status (loaded, skipped or disabled, with the reason). Exit 0.
  • A plugin can add its own subcommands. They run as cymatix <command> ... but are not listed in cymatix --help. Configuration: [plugins] on Configuration.

The --json agent workflow

The four retrieval commands compose into a walk an agent can drive entirely through subprocess calls:

# 1. What do we know?
cymatix query "how does the freshness gate demote stale docs?" --json

# 2. About to edit — is what we know still true?
cymatix packet "edit the freshness gate" --task-type edit --json

# 3. Drill into a specific document the packet named
cymatix document get c084a6dc1f2b --json

# 4. Look around it
cymatix neighbors "freshness gate" --k 10 --json

# 5. Before acting: what must be reread first?
cymatix refresh-targets "edit the freshness gate" --json

The shapes:

Command --json shape
query verdict (know / miss / unknown), expressed_context, evidence (document ids), estimated_tokens, decision_reason, next_action, plus the know or miss block
packet The full ContextPacket — task_type, query, verified[], stale_risk[], companions[], contradictions[], refresh_targets[], coordinate_confidence, file_coverage, know / miss, delivery, notes. Same model as POST /context/packet, but printed as-is: the unused one of know / miss is present as null, and there is no packet_id, response_mode or plr_confidence
refresh-targets { refresh_targets: [...], count: int }. The rows are the same RefreshTarget objects POST /context/refresh-plan returns; the HTTP envelope is { query, task_type, refresh_targets, response_mode }
document get The full document model
document preview { gene_id, preview, truncated, total_chars, path }
neighbors { query, k, neighbors: [{ gene_id, sema_cos_sim, preview, path }], count }. Identical to GET /debug/neighbors

Two things to branch on, in order:

  1. verdict / the miss block. miss carries do_not_answer_from_genome: true and is load-bearing — do not answer from the store. next_action is the pre-composed hint (answer_from_evidence on a know; the escalate or refresh plan on a miss).
  2. decision_reason. One string explaining why the verdict landed where it did, so a failing run is diagnosable without re-reading the bytes.

The JSON keeps legacy field names on the wire by default — gene_id in the preview and neighbor shapes above is verbatim, not a typo. Since 0.10.0 the opt-in, experimental [budget] wire_format = "canonical" renames those fields (gene_id → document_id, …) in every --json output; the legacy names stay the default. See Configuration and Lexicon.

cymatix status

Three checks, then a single next-action line:

Genome: up (genomes/main/genome.db)
  gene_count: 18547
Config: valid (cymatix.toml)
Server: up (http://127.0.0.1:11437)

Next action: ...
  • Store — opens the .db read-only (URI mode, so it never takes a lock) and counts rows. A missing file reports file_not_found with the fix (cymatix ingest <path>); a non-Cymatix file reports not_a_cymatix_genome.
  • Config — confirms cymatix.toml loads, and echoes the resolved store path and server port. This is the fastest way to check that a CYMATIX_STORE_PATH override actually took.
  • Server — an optional HTTP / launcher probe. --no-network skips it; a down server is not a failure for the CLI workflow.

Flags: --json, --no-network, --config PATH. Exit 0 healthy, 3 if the store or config check failed.

The rendered labels above (Genome:, gene_count:) are the literal strings the command prints today — the CLI's own text output has not been through the lexicon pass. Read them as "knowledge store" and "document count".

cymatix diag corpus

total_genes: 18547
total_codons: 91234
compression_ratio: 5.0
tier_distribution:
  open: 14200
  euchromatin: 3100
  heterochromatin: 1247
staleness:
  ...
  • total_genes / total_codons — documents and fragments.
  • tier_distribution — the lifecycle mix. open is full content, euchromatin is summarized, heterochromatin is cold (content preserved but demoted by the density gate, and only reachable through the opt-in cold tier).
  • compression_ratio — raw characters over compressed characters across the whole store.
  • staleness — best-effort, from the store's health summary. Prints (unavailable) when the summary cannot be computed rather than failing.

Fixed after the 0.9.1 tag (#419): the tier counts were previously reported as zero. The CLI's stats projection read chromatin_open / chromatin_euchromatin / chromatin_heterochromatin, but /stats emits open / euchromatin / heterochromatin. The projection now accepts both, so cymatix diag corpus and cymatix status show the real distribution. If you have an old script asserting zeros here, it will start seeing real numbers.

Exit 0 success, 1 if the stats call failed.

No daemon — what that costs

  • Each invocation pays its own process start-up and store open. For a handful of calls that is the right trade; for a tight query loop, run cymatix-server and hit HTTP API instead.
  • [hardware] lazy_encoders = true (the default) keeps the cost down by deferring heavy encoder construction to first use — and at shipped defaults (since 0.9.x) the SEMA and dense encoders are never constructed on the retrieval path at all.
  • cymatix --help deliberately does not import the retrieval stack: subcommand modules import their dependencies lazily inside run().
  • Daemon mode (cymatix serve) is deferred with no design doc. It exits 4 and points at cymatix-server.

Exit codes

Code Meaning
0 Success
1 Operation failed
2 Bad CLI arguments (argparse default)
3 Status check failed (cymatix status only)
4 Subcommand deferred / not implemented

Environment

  • CYMATIX_CONFIG — path to cymatix.toml. Default ./cymatix.toml.
  • CYMATIX_STORE_PATH (legacy CYMATIX_GENOME_PATH, which wins on conflict) — overrides the store path. Use :memory: for tests and ephemeral runs.
  • CYMATIX_ADMIN_TOKEN — the bearer cymatix compare sends (its --token default), for lanes with [server] admin_token set.
  • CYMATIX_MCP_HTTP_TOKEN — when set, cymatix mcp serve --http requires Authorization: Bearer <token> on every request.
  • CYMATIX_ALLOW_UNSIGNED_PLUGINS=1 — load unsigned directory plugins.

Full env table: Configuration.

When cymatix is not on PATH

The console scripts (cymatix, cymatix-server, cymatix-status, cymatix-vault, cymatix-launcher) are generated at install time and hardcode the absolute interpreter path. Two recoveries:

# The script resolves to a deleted editable-install path (you moved the source tree)
pip install --force-reinstall --no-deps cymatix-context

# Or bypass the console script entirely — this always works
python -m cymatix_context.cli --help

Go deeper