Source: https://hatchery.build/docs/checks

# Dataset checks

Checks catch task problems before evaluations run. The built-in linter finds malformed packages, rubrics review task content, and custom checkers enforce project-specific rules.

Hosted check runs are unavailable. Run `hatchery check` on your computer or in CI to upload results to Hatchery's checks board.

Before you continue, [connect the CLI](quickstart.md#connect-the-cli) and [build the `tasks` dataset](tasks-and-datasets.md#build-a-dataset). The examples use that directory and the project selected by `HATCHERY_PROJECT`. The host running checks needs the Python bridge configured in the quickstart. Rubric and custom checks also need a Harbor environment such as Docker.

## Add a lint check

Create `tasks/checks.toml`:

```toml
on = []

[[check]]
name = "lint"
uses = "harbor-lint"
select = ["invalid-task-config", "invalid-task-files"]
```

This example names the check `lint` and selects the built-in linter with `uses = "harbor-lint"`. The two rules in `select` check the task configuration and its declared files.

Push the dataset so Hatchery has both the tasks and the check definition, then run the check on your computer:

```sh
hatchery push tasks
hatchery check tasks
```

The push prints the dataset id and revision. The check command uses that stored revision and runs checks without current results. It marks results as `reused`, `pass`, `fail`, or `not measured` and reports any cost. It exits with status 1 if a task fails or cannot be measured.

Open the dataset in Studio to review results by task and check. Select a result to see its verdict, findings, execution location, and files read. A passing lint result means the selected lint rules found no problem. It does not assess instruction clarity or task difficulty.

To run `lint` again for one task, copy its id from the push output or Studio:

```sh
hatchery check tasks --check lint --task TASK_ID --rerun
```

Replace `TASK_ID` with the task you want to check. Whenever you change `checks.toml` or a referenced rubric, run `hatchery push tasks` again so the next check uses the new definition.

## Add a rubric check

Use a rubric when you want a model to judge task content. Add this definition to `tasks/checks.toml`:

```toml
[[check]]
name = "spec"
uses = "harbor-check"
rubric = "rubrics/spec.toml"
agent = "claude-code"
model = "claude-sonnet-4-6"
```

Create `tasks/rubrics/spec.toml`:

```toml
[[criteria]]
name = "declared_output"
description = "The instruction names every output file that tests read"
guidance = "Pass when every tested output path is explicit. Fail when tests depend on an unstated path."
```

This rubric checks whether the task names every output file its tests read. Add a `[[criteria]]` section for each independent question.

Supply the model credential in the environment that runs the command. For a local run:

```sh
export ANTHROPIC_API_KEY="..."
hatchery push tasks
hatchery check tasks --check spec
```

If a task explicitly asks the runtime to pass through a host environment variable, also set `HATCHERY_RUN_ALLOW_HOST_ENV=true` to allow that access.

Pass `--env NAME` to select a local Harbor environment for a check.

## Add a custom checker

Write a custom checker when a rule needs code, specialist tools, or a deterministic test unavailable in the built-in checkers. The checker is a task in the same project. Push it first:

```sh
hatchery push path/to/document-check
```

The command prints the checker's package name. Add that name to `tasks/checks.toml`:

```toml
[[check]]
name = "documents"
uses = "task"
task = "clavia/document-check"
agent = "oracle"
params = { threshold = 0.9 }
```

Replace `clavia/document-check` with the package name from your push, then run `hatchery push tasks` again before `hatchery check tasks --check documents`.

While the checker runs, the task being reviewed is available at `/app/task` and the `params` values are in `/app/params.json`. The checker writes its answer to `/app/check-result.json`. With the default `oracle` agent, the runtime runs the checker's `solution/solve.sh`.

```json
{
  "criteria": {
    "title": {
      "outcome": "fail",
      "explanation": "The instruction is missing a title."
    }
  },
  "findings": [
    { "rule": "missing-title", "path": "instruction.md", "message": "Add a title.", "line": 1 }
  ]
}
```

Use `criteria` for named questions with an outcome and explanation. Outcomes are `pass`, `fail`, and `not_applicable`. Use `findings` for problems tied to a rule and file. Paths are relative to the task package. `line` and `column` are optional positive integers. A result can include either section or both.

A custom checker can use a prebuilt image or Dockerfile. Docker Compose checkers return `not measured` because this runner does not start Compose services.

## Control when checks run

Hatchery accepts and stores `on` and `secrets` from `checks.toml` as metadata. A dataset push starts no checks, even with `on = ["push"]`. The local machine or CI runner supplies any required secrets through its environment. To check on each push, configure your CI workflow to run `hatchery check` after `hatchery push`.

Hatchery reuses a result while the inputs that checker read still match. The linter records the individual files and paths it examined. Rubric and custom checks become out of date after any package change because Hatchery cannot observe every file their sandbox may read.
