> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ancha.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs describe the Ancha CLI, npm package @ancha-labs/cli version 0.1.4, and the hosted workspace at app.ancha.io. Coding agents should start at https://docs.ancha.io/coding-agents. Run the CLI as `ancha` after `npm install -g @ancha-labs/cli`, or as `npx -y @ancha-labs/cli@0.1.4` without installing. Pass --json for machine-readable output, or set ANCHA_JSON=1. Every command ends with a `next:` line naming the next command. Exit codes: 0 pass, 1 a check failed or a comparison regressed, 2 usage, config or authentication error, 3 infrastructure error, 4 unimplemented endpoint with --strict.

# ancha baseline

> Freeze a completed run's summary under a name, so later runs can prove they did not get worse with ancha run --compare.

A baseline is a frozen copy of a completed run's summary. `ancha run --compare <name>` compares a new run with it scene by scene.

## ancha baseline save

```bash theme={null}
ancha baseline save [options] <name>
```

| Argument | Description |
| - | - |
| `name` | Baseline name: letters, digits, hyphens and underscores |

| Option | Description |
| - | - |
| `--from <run>` | Completed run id or latest (default: "latest") |
| `--force` | Explicitly replace an existing baseline |
| `--out <dir>` | Where run directories are (default: .ancha/runs) |

```bash theme={null}
ancha baseline save before
```

```text Output theme={null}
baseline before saved from run_20261031-071701_17197fa05a6c4361: /path/to/project/.ancha/baselines/before.json
```

* The baseline is written to `.ancha/baselines/<name>.json`, or to a `baselines` directory next to a custom `--out`.
* Later runs never change it, even when `latest` moves.
* Saving over an existing name fails unless you pass `--force`:

```text Output theme={null}
error[USAGE]: baseline "before" already exists
hint: choose another name or use --force to replace it explicitly
```

Names use letters, digits, hyphens and underscores, up to 64 characters. `latest` and names that start with `run_` are reserved.

## Comparing

```bash theme={null}
ancha run --compare before
```

The comparison needs the same set of scenes, with the same content and checks, as the baseline. Formatting and key order in the YAML do not matter. Trial counts may differ. If a scene changed, save a new baseline. A baseline that contains invalid trials cannot be used; rerun it with a healthy setup. See [`ancha run`](https://docs.ancha.io/cli/run#compare-with-a-baseline).

Never compare a run with itself: save the baseline from the version you trust, then change the agent.

## Exit codes

`0` when saved. `2` for an existing name without `--force`, a reserved or invalid name, or an unknown run.


## Related topics

- [Tests](https://docs.ancha.io/concepts/tests.md)
- [CLI overview](https://docs.ancha.io/cli/overview.md)
- [ancha run](https://docs.ancha.io/cli/run.md)
- [Troubleshooting](https://docs.ancha.io/troubleshooting.md)
- [ancha docs](https://docs.ancha.io/cli/docs.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.