Skip to content

CLI reference

The cairn CLI is the control client. Run it from an installed wheel (cairn ...) or a repo checkout (uv run cairn ...).

Commands fall into five groups:

GroupCommands
Inspect & verifydoctor · ls · validate · pack · config
Run & replayrun · preflight · replay · lineage · eval · test · visualize
Authorinit · lock · bundle
Serve & operateremote · worker · deploy · demo
Govern & improveask · connect · pilot · knowledge · suggest

Preflight health check: env config + reachability of configured services. Confirms packs load, profile bindings resolve to registered operators, and required services are present. The fastest way to verify an install.

FlagEffect
--strictTreat warnings as failures (exit non-zero).

List packs and their contributions — name, version, tags, code contributions, declared assets. Pass a pack name to restrict the listing; --json for a machine-readable shape.

Offline validation of templates / skills / policies. No LLM calls, no backend.

FlagEffect
--strictTreat warnings as failures.
--template-path <dir>Extra directory to resolve skill template refs from (repeatable).
-v, --verboseVerbose output.

Emit the UI contract for a template — inputs/outputs schema, plan, steps, integrations. This is the same contract every cairn surface (CLI, console, HTTP) renders from. Exit 0 if the template is runnable.

Show the composed configuration surface for a workflow: the knobs of every operator reachable from it, split into governance and operational scopes. See Configuration.

Fire one trigger (or template) through the pipeline and persist a replayable trace. Two modes:

  • Trigger mode (default): the positional argument is a trigger JSON file; the payload is skill-matched and policy-gated.
  • Direct-template mode (with --input): the positional argument is a namespaced template ref like training/finetune, run directly against the input JSON — no skill matching, no policy.
Terminal window
cairn run training/finetune --input job.json
FlagEffect
--source <s>Trigger source for raw payloads: pattern / alert / metric / schedule / manual / cascade. Default manual.
--service <name>Service the trigger targets (falls back to payload.service).
--env <env>Policy environment: dev / staging / production. Default production.
--input <file>Direct-template mode: the template’s input payload.
--dry-runDirect-template mode: compile + validate + show the execution plan (the node DAG) without running any operator.
--mockDirect-template mode: operators that declare supports_mock take their .mock() path (no side effects).
-I, --interactiveDirect-template mode: at each governed HITL gate, prompt approve/reject in the terminal and resume in-process (no server needed).

The side-effect-free ready/blocked verdict for a workflow — cost, gates, and blockers — without starting a run. Exit 0 = ready, 1 = blocked.

Terminal window
cairn preflight dataset-readiness/check -i inputs.json
FlagEffect
-i, --input <file>JSON object of input values. Optional — with no inputs the verdict lists what’s missing.
-p, --profile <name>Environment/profile the plan resolves under. Default: the env-default profile.
--no-connectionsSkip the advisory connection-health check (faster; offline).

Render a past run’s persisted event trace as a human-readable timeline.

FlagEffect
--jsonEmit raw meta + events JSON instead of the timeline.
--source <s>Trace source: auto (local files, else DB store) / file / db. Default auto.

Show the content-addressed provenance/lineage record(s) for a subject — a model name, incident id, plan id (matched on the audit target / model_name / subject). Omit the subject to list all records.

FlagEffect
--jsonEmit matching records as JSON.
--audit-log <path>Audit log path. Default: $OBS_AUDIT_LOG or ./audit.jsonl.

Dataset-driven evaluation for a pack’s templates. Each case fires through the same pipeline as run. Two workflows:

Regression — snapshot, change, compare:

Terminal window
cairn eval <pack> --save-baseline before.json
# ...edit prompts / change model...
cairn eval <pack> --compare-against before.json --threshold 80

Recipe eval — score a produced artifact against the pack’s declared eval recipe instead of running dataset cases:

Terminal window
cairn eval <pack> --recipe --tier easy --output run-output.json
FlagEffect
--case <name>Run only one case.
--dataset <stem>Restrict to one dataset file.
--env <env>Policy environment. Default production.
--jsonMachine-readable summary.
--save-baseline <file>Persist per-case outputs as a regression baseline.
--compare-against <file>Compare against a baseline: per-case agreement, cost delta, template-version-change flag.
--threshold <pct>With --compare-against: minimum agreement % to exit 0 (CI gating).
--recipeScore a produced artifact with the pack’s eval recipe. Requires --output.
--output <file>With --recipe: the run’s stored output JSON. Scored, never re-run.
--tier <t>With --recipe: restrict to one demo tier (easy / medium / complex).
--workflow <name>With --recipe: restrict to one workflow (template).
--runtimeWith --recipe: run the reference-free runtime recipe instead of the .eval test recipe.
--mockWith --recipe: take the eval operator’s mock() path (no LLM/GPU/IO).

Run a pack’s pytest suite — locates the pack’s tests (<path>/tests if present, else the path itself) and shells out to pytest. Arguments after -- pass straight through.

Terminal window
cairn test cairn/packs/training -- -k finetune

Render a compiled template’s graph as Mermaid (paste into any markdown tool). Today the supported kind is template.

Terminal window
cairn visualize template training/finetune -o graph.mmd

Scaffolding subcommands:

SubcommandCreates
init packA new pack (flat layout: one dir = project = package = pack).
init templateA minimal flow: prompt template stub in the current pack.
init skillA minimal skill stub.
init policyA minimal policy stub.
init operatorAn operator pack — a wheel bundling one or more operators.

Pin the shipped pack closure by content hash into cairn.lock.

Terminal window
cairn lock # write/update the lockfile
cairn lock --check # CI gate: recompute and fail if missing or stale

Bundle-pipeline tooling. A bundle chains multiple governed workflows into a pipeline — see Pipelines & bundles.

SubcommandEffect
bundle validateValidate a bundle’s data contract against the participating templates’ schemas. Exits non-zero on any violation.
bundle runValidate, compile, and run a bundle pipeline in-process; prints each step’s steps.<id> output and the final result.

Drive a running cairn server over its HTTP + SSE API — submit runs, watch them live, resolve approvals. The server protects these routes with JWT auth when OBS_JWT_SECRET is set.

Terminal window
cairn remote login --endpoint https://your-server # authenticate, store a JWT
cairn remote submit <skill> -i key=value # fire a run (async)
cairn remote ps # list runs (one-shot)
cairn remote watch # live-refreshing dashboard
cairn remote status <run_id> # one run's lifecycle record
cairn remote logs -f <run_id> # tail events live (SSE)
cairn remote cancel <run_id> # cancel (best-effort)

Human-in-the-loop: a run paused at an operation gate has status awaiting_approval; resolve it from the terminal:

Terminal window
cairn remote approve <run_id> # approve → resume
cairn remote reject <run_id> # reject → skip the gated op
cairn remote approve --watch <run_id> # stream → prompt at the pause → resume

Also: remote console (interactive Textual TUI over the server; needs the tui extra) and remote hash-password (print an argon2 hash for OBS_API_PASSWORD_HASH; needs the auth extra).

Run a Temporal worker for the durable runtime.

FlagEffect
--remotePoll the dedicated remote/GPU queue (OBS_TEMPORAL_REMOTE_TASK_QUEUE).
--task-queue <name>Override the task queue to poll (takes precedence over --remote).

Operate the unified deployment stack (compose profiles + one .env).

SubcommandEffect
deploy doctorValidate that the deploy .env and enabled profiles are consistent — required vars present, runtime/profile agreement (e.g. OBS_RUNTIME=temporal needs the temporal profile). --env <file>, --profile <name> (repeatable), --strict.

Seed an opt-in demo workspace — runs, a pilot, an audit trail, a pending approval — so a fresh install has something to look at.

FlagEffect
-w, --workspace <id>Workspace id to seed / archive. Default demo.
--archiveTear the demo workspace down (soft-delete; runs/audit preserved).

AI-assisted: turn intent into governed cairn plans and runs. The assistant never bypasses policy — it produces the same governed plans you could build by hand.

SubcommandEffect
ask planAssemble a deterministic plan for a template (no LLM). Exit 0 if runnable.
ask runResolve a natural-language intent → governed plan (LLM intent→template).
FlagEffect
--profile <path>Execution profile path.
--model <id>Model for intent resolution. Default gpt-4o-mini.

Manage typed infra connections — model APIs, compute, MCP servers. Secret values live in the secret store; connections hold references only.

SubcommandEffect
connect addAdd (or --force replace) a connection from the provider catalog, or an OAuth connection via a broker (--via oauth).
connect authorize(Re)start the OAuth flow for an existing kind=oauth connection.
connect lsList configured connections (names + kinds + secret keys — never values).
connect testResolve the connection’s secret refs, run the provider’s authenticated health probe, persist the result. Exit 0 = connected / degraded-but-reachable, 1 = missing/failed.
connect rmDelete a connection (removes the reference — never the secret value).
connect providersList the provider catalog — what you can connect add.

The pilot evaluation ledger — pilots, experiments, runs, scorecards, findings. A pilot is a hypothesis under evaluation; experiments are its arms; runs attach to experiments with a role (cairn or baseline).

SubcommandEffect
pilot newCreate a pilot.
pilot experimentAdd an experiment arm.
pilot attachAttach a run to an experiment with a role (cairn | baseline).
pilot scoreRecord a reviewer scorecard for a run (weighted overall computed on write).
pilot baselineRecord the structured manual baseline for a run (setup/tools/commands/retries).
pilot findingRecord a finding on a pilot (optionally pinned to a run).
pilot linkLink a run out to an external system (Langfuse / Grafana / Notion…).
pilot overallA run’s weighted overall + whether it clears the success thresholds.
pilot cohortA run’s per-reviewer scorecards + inter-rater agreement.
pilot deltaThe manual-baseline-vs-cairn glue-cut delta for a run.
pilot compareCompare a pilot’s experiments: cairn vs baseline mean weighted overall.
pilot rollupAggregate scorecard + cost over a pilot’s or experiment’s run group.
pilot lsList pilots (or one pilot’s experiments with --pilot).

Bring-your-own knowledge corpora — git-sourced, indexed, composed into roles.

SubcommandEffect
knowledge addRegister a git-sourced corpus (optionally index it now).
knowledge listList registered BYO corpora.
knowledge indexPull the source + run it through the RAG pipeline (parse → embed → upsert).
knowledge removeRemove a BYO corpus record (vectors re-indexed away on the next pass).
knowledge index-packsIndex the RAG corpora declared by installed packs.

Governed improvement suggestions — cluster labeled failures, route, review, accept/reject. Suggestions are proposals; a human accepts or rejects them.

SubcommandEffect
suggest generateCluster a workflow’s labeled failures and emit routed suggestions.
suggest list / showBrowse suggestions.
suggest accept / rejectResolve a suggestion.