> For the complete documentation index, see [llms.txt](https://docs.cleric.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cleric.ai/usage/change-verification.md).

# Change Verification

Verify whether a released change worked and whether it caused regressions

Change Verification verifies a released code or configuration change against production evidence. Cleric checks whether the intended outcome occurred, looks for regressions, and continues monitoring signals that need more time.

## How It Works

Automatic verification begins when a configured Slack release notification runs the `verify` agent, or when a pipeline sends a release to a [pipeline trigger](#send-releases-from-a-pipeline). For each release, Cleric:

1. Identifies what shipped, where and when it shipped, and whether the expected version is live.
2. Records each change. Cleric skips changes without a production outcome to verify. For every tracked change, it reads the source diff and records expectations about the running system.
3. Checks each expectation against production logs, metrics, traces, infrastructure state, or live configuration. It resolves the expectation when the evidence is sufficient or monitors it with a scheduled check when more observation time is needed.
4. Updates the change and expectation statuses as new evidence arrives.

When a release contains several changes, Cleric assesses each change independently. This keeps an anomaly or missing data for one change from obscuring the results for the others.

## Baseline Assumptions

Automatic Change Verification assumes that your environment has:

* **Release notifications:** A Slack channel where a bot posts the deployed service or component, environment, rollout time, and version, or a pipeline that sends the same details to Cleric. Pull request or commit links improve the analysis.
* **Source access:** A connected source-control integration that lets Cleric read change descriptions and diffs.
* **Production access:** Connected integrations that expose the logs, metrics, traces, infrastructure state, or live configuration needed to assess the change.

Cleric reports missing access or missing telemetry as a limitation. It does not treat an empty query result as proof until it has validated the query and its filters.

## Set Up Automatic Change Verification

{% stepper %}
{% step %}

### Prepare the Release Channel

Choose the Slack channel that receives release notifications. A channel dedicated to deployments works best because a catch-all trigger can process every bot message without matching unrelated alerts.

Invite Cleric to the channel with `/invite @Cleric` if it is not already a member.
{% endstep %}

{% step %}

### Add a Bot Message Trigger

Open **Settings > Automations > Triggers** and click **Add trigger**. Keep the **Bot message** trigger type selected, then configure:

* **Channel:** Select the release channel.
* **And matches keyword(s):** Use `*` when every bot message in the channel is a release notification. Otherwise use a distinctive phrase that appears in release messages, such as `deployment completed`.
* **Then > Run agent:** Select `verify`.

Place this trigger above broader triggers that could match the same release message. The first matching trigger runs.
{% endstep %}

{% step %}

### Validate the Next Release

After the next release notification, confirm that Cleric reacts to the message and posts a link in its thread. The link opens the **Changes** page scoped to that release. Confirm that Cleric identified the correct changes, target environment, and rollout time.
{% endstep %}
{% endstepper %}

For more detail about trigger matching and ordering, see [Configuring Automations](https://docs.cleric.ai/setup/agents-and-triggers.md#adding-a-bot-message-trigger).

## Send Releases From a Pipeline

A pipeline can send its deployments to Cleric directly, without a release channel or a Slack bot of its own. Each pipeline uses a pipeline trigger: a key it sends with every release and the Slack channel where Cleric posts it.

{% stepper %}
{% step %}

### Add a Pipeline Trigger

Open **Settings > Automations > Triggers**, click **Add trigger** and choose **Pipeline**. Then configure:

* **A pipeline sends a deployment:** Name the trigger after the team or service that deploys, such as `Payments deploys`.
* **Post releases to:** Select the Slack channel where Cleric posts each release and its verification. Invite Cleric with `/invite @Cleric` first. Choose **Don't post (web UI only)** to verify releases without posting in Slack. Their results then appear only on the release's page in Cleric, and nobody is notified, even of an anomaly.

Cleric shows the trigger's key once, right after you add it. Store it as a secret in your pipeline, such as `CLERIC_TRIGGER_KEY`.
{% endstep %}

{% step %}

### Send Each Release

Add a step that runs after the rollout succeeds. Send each release once: every call starts a new verification. The step below is an example for a bash shell with `curl` and `jq`: adapt it to your pipeline's tools and variables.

{% code overflow="wrap" %}

```bash
jq -n --arg service "payments-api" --arg environment "prod" --arg version "$GITHUB_SHA" \
  '{service: $service, environment: $environment, version: $version}' \
  | curl -sS --fail-with-body -X POST "https://<your-instance>.app.cleric.ai/api/v1/api-triggers/releases" \
      -H "Authorization: Bearer $CLERIC_TRIGGER_KEY" \
      -H "Content-Type: application/json" \
      --data @- \
  || echo "Cleric did not receive this release; the deploy is unaffected." >&2
```

{% endcode %}

* **The key:** the step reads it from the `CLERIC_TRIGGER_KEY` environment variable, so map your pipeline's secret into it. In GitHub Actions, set `CLERIC_TRIGGER_KEY` under the step's `env` to `secrets.CLERIC_TRIGGER_KEY`.
* **The body:** `jq` builds it, so values with quotes or newlines, such as a changelog in `notification`, stay valid JSON. To send another [release field](#release-fields), add an `--arg` for it and its key to the braces.
* **Failures:** if Cleric refuses the call or can't be reached, the step prints a warning with Cleric's reason instead of failing a deploy that has already rolled out.
  {% endstep %}

{% step %}

### Check the First Release

After the next deployment, confirm that Cleric posts in the trigger's channel, names the release it created, and replies in its thread, or that the release appears on the **Changes** page for a web-only trigger.
{% endstep %}
{% endstepper %}

### Release Fields

Send at least `service` or `notification`. Every other field is optional, and each one you send gives Cleric more to verify against.

| Field              | Description                                                                                                                                                                     |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `service`          | The service or component deployed. Required unless `notification` is set.                                                                                                       |
| `notification`     | Free text about the deployment, such as a changelog or the message a release bot would post. Cleric verifies against it but does not post it. Required unless `service` is set. |
| `environment`      | Where it was deployed, such as `prod-us-east`.                                                                                                                                  |
| `version`          | The version, tag or commit SHA deployed.                                                                                                                                        |
| `previous_version` | The version it replaced.                                                                                                                                                        |
| `status`           | The rollout's outcome, such as `succeeded`.                                                                                                                                     |
| `repository`       | The source repository, such as `acme/payouts`.                                                                                                                                  |
| `deployer`         | Who released it: a name, email or handle.                                                                                                                                       |
| `changes_url`      | A link to what changed: a pull request, a compare view or a changelog.                                                                                                          |
| `pipeline_url`     | A link to the pipeline run that deployed it.                                                                                                                                    |

Every field except `notification` takes a single line of text. `changes_url` and `pipeline_url` must be `http` or `https` links. Cleric rejects fields it does not recognize.

Cleric's post in the channel shows the trigger's name and the single-line fields exactly as sent, and links to `changes_url` and `pipeline_url`. It never posts `notification`, so text from commit messages or pull requests cannot mention anyone or add links as Cleric. Once Cleric has finished its first pass over the release, it adds the changes it found to the same post, grouped by author: each pull request's title as plain text, with its number linked when the pull request is in the same repository as `changes_url` or `pipeline_url`. Authors are named, not mentioned. To show your own formatted release message in Slack, post it from your own bot and use a [bot message trigger](#add-a-bot-message-trigger) instead.

### Responses

| Status | Meaning                                                                                                            |
| ------ | ------------------------------------------------------------------------------------------------------------------ |
| `200`  | Cleric started the release. The response includes its `slug`.                                                      |
| `401`  | The key is missing or unknown.                                                                                     |
| `403`  | The trigger is disabled.                                                                                           |
| `422`  | The body is invalid. The response names the field.                                                                 |
| `502`  | Slack did not accept Cleric's post, for example because Cleric is not in the channel. Retry, or check the channel. |
| `503`  | Slack is not connected. Retry later.                                                                               |

To change where a pipeline's releases go, edit its trigger.

### Rotate or Revoke a Key

Open **Settings > API keys** to see every pipeline key, when each was last used, and any rotation in progress. Click **Rotate** on a key and choose how long the current key keeps working:

* **Stops working now:** Use this for a leaked key. Pipelines that send it are refused at once.
* **Keeps working for 24 hours** or **7 days:** Both keys work while you update the pipeline's secret. Clicking **Revoke old key** shows when a pipeline last used the old key, so you can see whether any pipeline still sends it. Click **Revoke old key** to stop it before it expires.

Cleric shows the new key once. Deleting a pipeline trigger also stops its key.

## Run Change Verification From Slack

Run the built-in agent from Slack by prefixing the request with `!verify`. Change verification cannot be started from web chat.

For a pull request:

{% code overflow="wrap" %}

```
@Cleric !verify https://github.com/acme/checkout/pull/1234
```

{% endcode %}

For another type of release, describe the change and target environment:

{% code overflow="wrap" %}

```
@Cleric !verify Verify the checkout-api feature flag rollout in production from 14:00 UTC.
```

{% endcode %}

If Cleric cannot identify the change or environment from the request and connected systems, it asks for the missing detail.
