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

# Inspect, diff, and reset

> Measure a provider mutation against an explicit prior state and restore the declared baseline.

State inspection lets a test verify what an agent actually changed without
teaching the agent that it is inside Archal.

## Capture the before state

```bash theme={null}
archal state get <session-id> github > github-before-response.json
```

The state endpoint wraps the provider state in a response envelope. Extract the
`state` value when using it as the explicit `before` file expected by the CLI.

```bash theme={null}
jq '.state' github-before-response.json > github-before.json
```

## Run the provider mutation

Call the provider-shaped API or MCP tool through the connection returned for
the environment. The agent under test does not receive state-management tools.

## Compare the result

```bash theme={null}
archal state diff <session-id> github --before github-before.json
```

The result contains before and after hashes, changed paths, and truncation
metadata. It compares with the file you supplied, not with a hidden snapshot.

## Reset

Reset one environment through the API, or reset every environment with the CLI:

```bash theme={null}
archal session reset <session-id>
```

Reset restores the current baseline. Initial state establishes the first
baseline. A later `state load` replaces it.

Reset overwrites live state. In an interactive or shared sandbox, name the
target and get explicit approval first. A disposable CI sandbox can reset
non-interactively when the workflow was configured to do so and guarantees
cleanup.
