Skip to main content

CLI Reference

The Graphora CLI is a single binary that covers the full extract → inspect → compare → regression-test loop. It works in two modes: embedded (runs the extraction pipeline locally — only a Gemini API key required) and remote (talks to a Graphora API server, hosted or self-deployed). This page is the authoritative command reference. For end-to-end walkthroughs see the Platform Quickstart and Local Dev Guide.

Installation

This installs both the graphora CLI and the Python client library. Requires Python 3.9 or higher. To install just the client library without the CLI, omit the [cli] extra. Verify:

Quick start

Commands at a glance


Configuration

Config is stored at ~/.graphora/config.yaml. The CLI also reads several environment variables — see Environment variables below.

graphora config init

Interactive setup. For embedded mode, graphora-api is auto-downloaded and cached on first use; you only need a Gemini API key.

graphora config set

graphora config get / show / path

graphora init

Shortcut for graphora config init with the two flags people set most often:

graphora status

Reports the active mode, whether the embedded graphora-api binary is cached, and whether your API key / auth token are configured.

Extracting graphs

graphora extract

Run the extraction pipeline over one or more documents.
Supported file formats (10 total): The parser sniffs by file extension. Directories passed to graphora extract are recursed; files with unsupported extensions are skipped silently. Behind the scenes — schema modes. graphora extract is a thin wrapper over three API paths, picked by the --schema / --mode flags: See API Reference — Extraction modes for the full posture comparison and when to pick each.

graphora schema infer

Generate an ontology YAML from documents without performing a full extraction. Useful as a starting point before extraction, or to diff against an existing schema.

graphora schema validate

Lint an ontology YAML for structural correctness and common issues. Exits non-zero on validation failure — safe to wire into pre-commit hooks.

Inspecting graphs

The next three commands require remote mode — they talk to a Graphora API server (hosted or your own deployment) and need an auth token.

graphora explain

Show the source-span evidence and decision-log trail behind a single node or edge. Renders the originating text + document, the schema-inference / merge / accept-reject decisions the pipeline emitted, and any alternatives considered.

graphora diff

Compare two transforms and show added / removed / changed nodes and edges, with a summary table plus per-section detail tables.
Each entry in the changed section expands to one row per property change, so the rendered row count can exceed --limit when entries have multiple changes. --json always emits the full set.

Scenarios

A scenario is a named point-in-time snapshot of a transform’s extracted graph. Scenarios are useful for branching what-if comparisons before publishing, or for pinning a known-good state before running a destructive merge.

graphora scenario create

graphora scenario list

Lightweight summary view (counts only, no embedded graph). Use scenario show to fetch the full record.

graphora scenario show

graphora scenario delete

The server’s delete is intentionally non-idempotent — a 404 fires when the scenario doesn’t exist or belongs to another user. Same posture as explain and diff on cross-tenant access.

Regression testing

graphora test

Run a golden-corpus regression test against a Graphora API. For each subdirectory under <corpus-path>, the runner registers ontology.yaml, uploads document.txt, waits for extraction to complete, then POSTs the live transform_id plus expected.json to /api/v1/golden/score and records the report.
Exit codes: Each subdirectory under <corpus-path> must contain document.txt, ontology.yaml, and expected.json to count as a corpus entry. Other subdirectories are skipped silently.

MCP integration

graphora install

Wire Graphora’s MCP server into an agent client’s config so the agent can call graphora-mcp tools directly.
The cursor, vscode, codex, and claude-code clients write to the workspace; claude-desktop writes to the user-global config. Existing mcpServers entries are preserved unless you pass --force.

Maintenance

graphora update

Update the embedded-mode graphora-api binary by re-downloading from GitHub.

graphora version

Prints the installed graphora CLI version. Equivalent to graphora --version.

Embedded vs remote mode

Embedded mode is recommended for one-off extractions, CI pipelines, and evaluation. No database, Redis, or external services needed; graphora-api is auto-downloaded on first use and cached at ~/.graphora/api/. Remote mode is required for the explain, diff, scenario, and test commands, since those depend on server-side state (transform IDs, scenario storage, the golden-scoring endpoint). Configure it once with graphora config init --mode remote.

Environment variables

Precedence for --api-url / --auth-token: explicit flag > environment variable > ~/.graphora/config.yaml.

Python client library

The CLI is built on top of the Python client. For programmatic access:
See the Client Library documentation for the full API surface.