# Command line reference

`--help` output of every `naga` command, captured live so it cannot drift from the real argument parsers, one page for each group of commands. `python -m nagasim` is the same program.

## Run and compare

Run a model, compare scenarios and search for the best settings.

| Command | What it does |
|---|---|
| [`naga examples`](run-and-compare.md#naga-examples) | list the models that ship in the package |
| [`naga plugins`](run-and-compare.md#naga-plugins) | list the plugins loaded, failed and scanned (read-only) |
| [`naga run`](run-and-compare.md#naga-run) | run a model headless |
| [`naga scenarios`](run-and-compare.md#naga-scenarios) | run named scenarios headless and compare them |
| [`naga explain`](run-and-compare.md#naga-explain) | rank the measured contributors to a KPI and suggest one test of the top one |
| [`naga invest`](run-and-compare.md#naga-invest) | payback, NPV and ROI of each scenario against a baseline |
| [`naga fit`](run-and-compare.md#naga-fit) | fit an input distribution to CSV data |
| [`naga uncertainty`](run-and-compare.md#naga-uncertainty) | how much of each KPI's spread comes from the data its inputs were fitted to |
| [`naga doe`](run-and-compare.md#naga-doe) | design of experiments over model parameters |
| [`naga optimize`](run-and-compare.md#naga-optimize) | search model parameters for the best KPI within a replication budget |
| [`naga policy-eval`](run-and-compare.md#naga-policy-eval) | evaluate a controller against a Policy-mode DECIDE |

## Check and edit model files

Validate, format, diff, merge and test model files, and export them as code.

| Command | What it does |
|---|---|
| [`naga schema`](model-files.md#naga-schema) | JSON Schema of the model file format |
| [`naga validate`](model-files.md#naga-validate) | structured validation problems, exit 1 on errors |
| [`naga fmt`](model-files.md#naga-fmt) | rewrite model files in their shortest canonical form |
| [`naga export`](model-files.md#naga-export) | write a model as Python code that builds it (nagasim.build) |
| [`naga diff`](model-files.md#naga-diff) | semantic diff of two model files by record identity |
| [`naga merge`](model-files.md#naga-merge) | three-way merge of model files by record identity |
| [`naga check`](model-files.md#naga-check) | run a model's assertions and reality checks |
| [`naga verify`](model-files.md#naga-verify) | check the engine against textbook queueing theory |
| [`naga facts`](model-files.md#naga-facts) | run once and list what happened that nothing else reports, as facts |
| [`naga ci-template`](model-files.md#naga-ci-template) | print a GitHub Actions workflow running 'naga check' |

## Build a model from data

Draft a model from tables or an event log, or translate one from another tool.

| Command | What it does |
|---|---|
| [`naga generate`](build-from-data.md#naga-generate) | build a model from Stations/Products/Routings tables |
| [`naga discover`](build-from-data.md#naga-discover) | draft a model from an event log (CSV or XES), with a report of what it assumed |
| [`naga sdimport`](build-from-data.md#naga-sdimport) | translate an XMILE/Vensim file into a model JSON |

## Digital twin

Read a plant, start a run from its state, calibrate and forecast.

| Command | What it does |
|---|---|
| [`naga bind`](twin.md#naga-bind) | resolve a model's data bindings and show what each one read |
| [`naga watch`](twin.md#naga-watch) | print what a model's live data sources send, as it arrives |
| [`naga state`](twin.md#naga-state) | take a model's state from a run, and check one before a start |
| [`naga plant`](twin.md#naga-plant) | map what a plant sends into an observed timeline: check, replay a log, watch |
| [`naga twin`](twin.md#naga-twin) | an operational twin: monitor, forecast, compare, report |
| [`naga approve`](twin.md#naga-approve) | approve a twin's recommendation (asks first) |
| [`naga trust`](twin.md#naga-trust) | trust a model's item code on this computer (shows it, asks first) |
| [`naga plc-write`](twin.md#naga-plc-write) | write approved setpoints to a soft PLC on this machine (dry-run unless --write) |
| [`naga calibrate`](twin.md#naga-calibrate) | fit model parameters to observed KPIs |
| [`naga forecast`](twin.md#naga-forecast) | short-horizon forecast with prediction bands |

## Plan, inspect and share

Plan with a solver, find the loops that drive a system dynamics model, and share a model in a browser.

| Command | What it does |
|---|---|
| [`naga plan`](plan-and-share.md#naga-plan) | deterministic plan, optional CP-SAT proposal and risk |
| [`naga loops`](plan-and-share.md#naga-loops) | loop dominance (Loops That Matter) of an SD model |
| [`naga viewer`](plan-and-share.md#naga-viewer) | one HTML file in which the engine re-runs a model in a browser |

## Agents

Serve the model operations to an assistant.

| Command | What it does |
|---|---|
| [`naga mcp`](agents.md#naga-mcp) | Model Context Protocol server over stdio |
| [`naga assist`](agents.md#naga-assist) | one headless assistant turn |
| [`naga skill`](agents.md#naga-skill) | show or copy the simulation-study guide for an assistant |
| [`naga study`](agents.md#naga-study) | check a study folder: rerun its versions (its reproduce steps with --steps), check its numbers, record your own validation |
| [`naga room`](agents.md#naga-room) | the live control room of a study in your browser |
