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

# Pages

A **page** presents trial results as a benchmark your team can share. It can rank results, compare two groups of trials, show selected task files, and explain the evidence behind each score.

## Publish your first page

Start with a completed job whose trials contain a reward named `reward`. Add the `published` label from the job detail page in Studio. The page below selects that job and ranks its results.

Open **Pages** in Studio, choose **New page**, and replace the template with this source:

```mdx
---
title: Clavia Benchmark
summary: Results from our published evaluation set.
views:
  published:
    where:
      - { field: jobLabels, operator: includes_all, values: [published] }
    metric: reward
---

<Leaderboard view="published" caption="Mean verifier reward across tasks; higher is better." />

## Methodology

<Evidence view="published" />
```

The preview updates from your project's current results as you type. Choose the page address and audience, then select **Publish**. Private pages use account invitations or viewer links for individual readers. Anyone with the URL can read a public page.

A page starts with YAML settings between the `---` lines. Its body uses Markdown and result components. Every page needs a `title` and can have a one-line `summary`.

## Choose trials with views

A **view** is a named selection of trials. Define it under `views`, then use its name in result components. The first example uses the `published` view for both the leaderboard and evidence summary.

Each `where` clause adds a condition. The example below selects trials from the named dataset only when their job has both labels. For a text field, several values in one condition are alternatives. For job labels, `includes_all` requires every value and `excludes` rejects a job with any value.

```yaml
views:
  with-skills:
    where:
      - { field: jobLabels, operator: includes_all, values: [published, with-skills] }
      - { field: dataset, operator: is, values: [clavia/skillsbench] }
    metric: reward
```

View names begin with a lowercase letter, contain only lowercase letters, digits, and hyphens, and contain at most 64 characters.

| Field | Value |
| --- | --- |
| `job` | Job id |
| `jobLabels` | Labels assigned to the job |
| `dataset` | Dataset package name from the job source |
| `datasetRevision` | Dataset revision number written as text |
| `task` | Task package name |
| `agent` | Agent name |
| `agentVersion` | Agent version |
| `model` | Model name |
| `provider` | Model provider |
| `reasoningEffort` | Reasoning effort |

Use `is`, `is_not`, `contains`, or `not_contains` with text fields. Use `is`, `is_not`, `gt`, or `lt` with `datasetRevision`. Use `includes_any`, `includes_all`, or `excludes` with `jobLabels`.

A leaderboard can combine named selections in one chart and table:

```mdx
<Leaderboard view="leaderboard, recent" />
```

The comma-separated names select the union of their trials. Each trial counts once even when several views select it, and the original attempt order is preserved. Every name must exist. The views must have the same configured metric, including all leaving it unspecified, unless the leaderboard sets `metric`. `Compare` still names one view per side, and `Evidence` names one view.

Job labels let you change a view without changing the job or republishing the page. A newly labelled job and its trials enter matching views when the published document refreshes.

After you [connect the CLI](quickstart.md#connect-the-cli), you can also label a job from the terminal:

```sh
hatchery jobs label job_123 --add published --remove draft
```

Replace `job_123` with a job id from your project.

## Add result components

A **result component** turns selected trials or task files into a chart, table, evidence summary, or sample. Place each component on its own line between Markdown sections. Quote text attributes such as `view="published"`. Write Boolean options such as `download` by themselves.

| Component | Attributes | Result |
| --- | --- | --- |
| `<Leaderboard view="v" />` | `view` required; `metric` and `caption` optional | Score versus cost chart and ranked table |
| `<Compare baseline="a" treatment="b" />` | `baseline` and `treatment` required; `metric`, `label-baseline`, `label-treatment`, and `caption` optional | Baseline and treatment scores with signed lift |
| `<Sample task="org/name">caption</Sample>` | `task` required; `title`, `revision`, `files`, `tables`, and bare `download` optional | Selected task files with previews and optional downloads |
| `<Evidence view="v" />` | `view` required | Datasets, evaluation runner versions, jobs, trials, tasks, attempts, coverage, and where the results came from |

Use names from `views` in `Leaderboard`, `Compare`, and `Evidence`. Set `metric` on a component to show a different reward from the view. Add a `caption` to explain a leaderboard or comparison score.

This example asks whether skills improve reward. It selects jobs by label and compares the same agent, model, and reasoning effort in both groups so Hatchery can pair the results.

```mdx
---
title: SkillsBench
summary: Do reusable skills improve agent performance?
views:
  with-skills:
    where:
      - { field: jobLabels, operator: includes_all, values: [with-skills] }
    metric: reward
  without-skills:
    where:
      - { field: jobLabels, operator: includes_all, values: [without-skills] }
    metric: reward
---

<Compare baseline="without-skills" treatment="with-skills" label-baseline="Without skills" label-treatment="With skills" caption="Change in mean verifier reward." />
```

## Add diagrams

Add a Mermaid diagram with a `mermaid` code fence. Hatchery validates it during `page check`, preview, and publish. The page revision stores the source, and the reader's browser renders it.

```mermaid
flowchart LR
  job[Job] --> trials[Trials]
  trials --> evidence[Evidence]
```

*Evidence flows from trials into the published benchmark.*

The diagram keeps its flow direction and appears centered without an outer card. Put an emphasized or bold paragraph immediately after the fence to make a centered figure caption. Other code fences remain code blocks. Diagram links and images are disabled, so a diagram cannot navigate the reader or load a remote resource. A diagram can contain at most 50,000 source characters, 4,000,000 SVG characters, and 5,000 flowchart edges.

## Understand scores

A leaderboard row represents one combination of agent, model, provider, and reasoning effort. For grouping, a trial without a recorded provider uses the sole known provider for its agent and model among the selected trials. This lookup spans reasoning efforts, while rows still separate reasoning efforts. If no provider or several providers are known, the missing provider stays separate. Explicit provider identities remain unchanged. It shows an agent version only when every trial in the group reports the same version. If a job slot has several attempts, the score uses the first attempt with a valid value for the chosen reward.

Hatchery first calculates the mean for each task, then calculates the mean across tasks. Rows sort by score descending, cost ascending, then name. Comparisons pair rows by agent, model, and reasoning effort.

Set `metric` when trials report more than one reward. A component metric takes priority over its view metric. If both are absent, Hatchery uses `reward` when it exists or the only available reward. If several rewards remain, the page asks you to choose one. A reward displays as a percentage when all its values fall between 0 and 1.

Row task coverage is the number of distinct tasks with a valid selected reward divided by all distinct tasks selected for that row. A successful rerun in a later job covers a task whose earlier attempt failed. This measures coverage of the row's selected tasks, rather than every task in the project or dataset. Evidence separately reports valid trials divided by selected trials. Cost per trial uses `agent_result.cost_usd`. Tokens per trial add input and output tokens. Duration uses the `TrialResult` start and finish times. A missing measurement displays as unavailable.

Rows lead with the model display name. The agent name appears only when the same model occurs under several agents. Reasoning effort appears only when it distinguishes selected rows. Evidence identifies the datasets, evaluation runner versions, and availability of supporting logs for the selected results.

## Name models

Use `models` to give raw model identifiers reader-friendly names:

```yaml
models:
  openai/gpt-6.1-sol: GPT 6.1 Sol
  anthropic/claude-sonnet-4-6: Claude Sonnet 4.6
```

You can name up to 64 models. Put the model identifier on the left and a nonempty, single-line display name on the right. Hatchery formats identifiers omitted from `models`. A reader can hover over any display name to see its original identifier.

## Show task samples

A `Sample` lets readers inspect selected files from a task in your project. Push the task, choose files with `files`, and review every match before publishing. Page readers can open the matched files.

```mdx
<Sample task="clavia/skillsbench-compose" files="instruction.md,tests/**" download>
Inspect the instruction and verifier files used in this benchmark.
</Sample>
```

Replace `clavia/skillsbench-compose` with a task package name from your project. `files` is a comma-separated list of globs and defaults to `instruction.md`. `*` matches within one path segment, `**` matches across segments, and other characters are literal. The bare `download` attribute permits downloads of matched files. Omit it to allow previews only.

Use `download="task"` to let readers download the complete Harbor task, including `tests/`, `solution/`, and files outside `files` and selected tables. Review the complete task revision before publishing this permission. The file browser still shows only the selected files. For consecutive samples, a single Download button in the sample header downloads every task in that tab group, and appears only when every sample permits complete task downloads. Separate groups have separate downloads. The ZIP is named `<page-slug>-tasks.zip` and places each task under its short Harbor task name. Bare `download` continues to permit individual selected-file downloads.

```mdx
<Sample task="clavia/skillsbench-compose" files="instruction.md,tests/**" download="task" />
```

The browser requests `GET /api/public/pages/{project}/{slug}/blocks/{firstBlock}/tasks.zip`, where `firstBlock` is the zero-based page component index of the first sample in the consecutive group. Its `revisions` query lists the resolved task revisions in tab order so the ZIP matches the samples the reader inspected. If an unpinned sample has changed, the request asks the reader to refresh before downloading. Tracked links keep their `link` token on this request. If a floating task revision changes, refresh the page before downloading. Repeated short task names receive numeric suffixes such as `example-2` to keep their directories separate.

Set a positive `revision` number to keep the sample on one exact task version. Without it, the sample follows the latest task revision and can change without a new page revision.

A sample gets its title from its `title` attribute, task metadata title, task description, or package name, in that order. Consecutive samples become tabs over one file browser. The tabs stay on one horizontally scrollable row, with the selected tab visible. A lone sample displays its Markdown caption. Tabbed samples use their tab titles. On desktop, the workspace can expand beyond the reading column and fades the page contents behind it.

Samples keep the task's folder tree, file-type icons, and preview pane. The reader-facing groups are Instruction for `instruction.md`, Environment for `environment/**`, Solution for `solution/**`, Tests for `tests/**`, and Files for remaining paths. Include `solution/output/**` in the Sample's `files` only when readers should receive those reference deliverables. Other task files appear only when the author's globs select them. Sample readers receive no editing or revision controls.

The browser previews Markdown, text, CSV, TSV, PDF, DOCX, XLSX, XLS, ODS, EML, HTML, PNG, JPEG, GIF, and WebP files. PPTX and unknown types remain available only when downloads are permitted. Files above `pageSamplePreviewBytes` cannot be previewed.

### Show structured grading data

Declare named `tables` beside `views` and `models` in the front matter, then select them with the Sample's comma-separated `tables` attribute. The author chooses the labels and JSON fields; tasks can continue to expose shell or pytest verifiers through `files` without a table.

```mdx
---
title: Benchmark
tables:
  grading:
    label: Grading
    file: tests/task.json
    rows: /criteria
    columns:
      - { label: ID, value: /id }
      - { label: Deliverable, value: /deliverable }
      - { label: Passes when, value: /rule/pass }
---

<Sample task="clavia/example" files="instruction.md" tables="grading" download />
```

`rows` and each column's `value` use RFC 6901 JSON Pointers. Omit `rows` or use an empty string to select the document root. Escape a field's tilde as `~0` and slash as `~1`. `rows` must select an array, and each column must resolve in at least one row. Missing fields and null display as empty cells. Scalars display as text, arrays of scalars join with a comma and space, and nested values display as compact JSON. Cells render no Markdown, HTML, or links.

Each selected table appears in its own sidebar section after Solution and before Tests and Files, including when no solution file is selected. Its source appears separately as a raw file only when `files` selects it. A table publishes the whole source file to readers, including fields and rows outside the displayed pointers. Review all source bytes before publishing. The `download` attribute permits downloading that source, and `pageSampleTableBytes` bounds table source validation.

`page check` and `page publish` validate table sources against the selected task revision, including file presence, JSON syntax, the rows array, and columns that resolve in no row. Validation covers the task revision current at check or publish. Pin `revision` on Samples with tables to keep a later task push from removing or reshaping a table source. A missing or reshaped source shows an error in that table pane while the other sample files remain available. Checking a sample with tables requires a project and a connection to Hatchery so it can read that revision; samples without tables retain local syntax checking. The existing `POST /api/projects/{id}/page-previews` operation accepts `{ source }` under page write access and validates without storing a page. Invalid tables return line, column, and message problems through the preview contract or a publication `PageInvalid` error. Task source bytes come from the same content store used by public sample reads.

Hatchery treats sample files as untrusted. Markdown and email do not load remote images. Links retain only HTTP, HTTPS, and mail destinations. HTML and email frames cannot run scripts or use same-origin access.

## Add images with the CLI

After you [connect the CLI](quickstart.md#connect-the-cli), add an image with a relative Markdown path from the page source:

```md
![Trial flow](figures/trial-flow.png)
```

`page check` and `page publish` resolve the path from the directory that contains the MDX file. Images accept `.png`, `.jpg`, `.jpeg`, and `.webp`, with at most 2,097,152 bytes per asset. Remote image URLs and absolute paths are invalid. A check that validates tables through page preview uploads its referenced image bytes to the content store first. Images inherit the page audience and expiry.

## Publish from the CLI

Create a starter file:

```sh
hatchery page init benchmark.mdx
```

Open `benchmark.mdx`. Replace the example task package with a task in your project, or remove the `Sample` block. Then check and publish the file:

```sh
hatchery page check benchmark.mdx
hatchery page publish benchmark.mdx --slug skillsbench --audience private
```

`page check` reports each problem as `file:line:column message` and exits with status 1 when the source is invalid. Replace `skillsbench` with a new lowercase project slug. A later publish to the same slug creates a revision. If another author publishes first, load the current source and apply your changes to that revision.

When you create a page, `--audience` accepts `private` or `public`. `--listed` adds a public page to the Hatchery directory, `--primary` makes it the project primary page, and `--expires` sets an expiry. Only public pages can be listed. Page expiry applies to every viewer.

## Share a page

A private page grants access through account invitations or viewer links and displays a confidentiality notice. A public page is available to anyone with its URL.

Open **Share**, enter the recipient's email in **Add people by email**, and select **Send**. The recipient signs in with their normal Hatchery account using a WorkOS email code or another configured method such as Google. Their verified email must match the invitation. The invitation grants access to this page and its selected files without organization membership or project access.

Enable **Can invite others** to let the recipient open **Share** and invite specific people. A recipient sees only the people they invited, with an email address and one-word status. The page owner can open each person's controls for invitation lineage, activity, delivery, resend, and removal details. Recipient access ends no later than the inviter's access. Revoking someone's invitation also revokes their invitation chain. A later invitation starts a new chain.

Existing viewer links remain available in the same dialog. A copied viewer link can be used by anyone holding it. Create a separate link for each reader when that sharing mode fits:

```sh
hatchery page link skillsbench --label "Clavia diligence" --expires 2027-01-15T00:00:00Z
hatchery page views skillsbench
```

The create command prints the viewer URL once. Each link has its own expiry. You can revoke one without affecting other viewers or changing the page. The activity log records page opens, file previews, and downloads with the viewer label, page revision, task, and file when applicable. Filter it with `hatchery page views skillsbench --link <link-id>`.

The first page in a project becomes its primary page and opens at `/p/{projectId}`. Other pages open at `/p/{projectId}/{slug}`. An admin can make another page primary in Studio. Manage a reader's access through their invitation or viewer link. Page expiry closes access for every reader.

The Cloudflare platform reuses resolved documents for repeat opens at the same edge location for up to 30 seconds by default, so trial results and sample selections can lag by that interval. The current revision and access rules still apply on every open, and view tracking still runs. The document API response uses `Cache-Control: no-store`.

## Source rules

Pages accept prose, headings, lists, block quotes, code, GFM tables, approved relative images, links, and the four page components. Links can use HTTP, HTTPS, `mailto:`, or a page fragment.

Imports, exports, JavaScript expressions, HTML, remote images, lowercase HTML elements, unknown JSX elements, expression attributes, and spread attributes are invalid. A `Sample` caption can contain Markdown but cannot contain another component.

## Applied limits

Server defaults are exported as `DEFAULT_STORE_POLICY` in `packages/store/src/policy.ts`. A host overrides the applied values through the `StorePolicy` service. If a request exceeds a limit, the error tells you which limit was reached and its value. The table renderer accepts a `rowLimit` override.

The Cloudflare platform exports `DEFAULT_PAGE_CACHE_POLICY` in `platform/cloudflare/src/page-cache.ts`. `HATCHERY_PAGE_CACHE_TTL_SECONDS` sets the freshness window and `HATCHERY_PAGE_CACHE_MAX_BYTES` sets the maximum stored document size, 256 KiB by default. Setting either to zero disables the cache. Larger documents resolve normally.

| Policy | Default | Scope |
| --- | ---: | --- |
| `pagesPerProject` | 100 | Live and revoked page records in one project |
| `pageSourceBytes` | 262,144 | Source bytes in one revision |
| `pageViews` | 32 | Named views in one page |
| `pageModels` | 64 | Model display mappings in one page |
| `pageComponents` | 64 | Components in one page |
| `pageSamples` | 16 | Sample components in one page |
| `pageSampleFiles` | 500 | Files resolved by one sample |
| `pageSamplePrefetchDepth` | 3 | Additional R2 bodies opened ahead of the current archive file, without application read ahead; operators override with `HATCHERY_PAGE_SAMPLE_PREFETCH_DEPTH`, reported by `X-Hatchery-Sample-Prefetch-Depth`; zero disables prefetch |
| `pageSampleTaskBytes` | 268,435,456 | Complete ZIP bytes, including entry headers, in a sample-task download; operators override with `HATCHERY_PAGE_SAMPLE_TASK_BYTES` |
| `pageSamplePreviewBytes` | 33,554,432 | Bytes in one browser preview |
| `pageSampleTableBytes` | 2,097,152 | Bytes in one table source validated through the content store |
| `pageSampleTableColumns` | 24 | Columns in one declared table; the CLI also accepts `HATCHERY_PAGE_SAMPLE_TABLE_COLUMNS` |
| `pageSampleTableRows` | 5,000 | Rows rendered in one table pane; the renderer accepts a `rowLimit` override and shows the applied value when rows are omitted |
| `pageAssets` | 24 | Relative image assets in one page revision |
| `pageAssetBytes` | 2,097,152 | Bytes in one page image asset |
| `pageTrialsScanned` | 100,000 | Newest trials one result block scans |
| `pageLinksPerPage` | 200 | Retained viewer links and account invitations for one page |
| `pageLinkMaxSeconds` | 90 days | Maximum viewer-link and account-invitation lifetime |
| `pageMaxSeconds` | 365 days | Maximum requested page expiry |
| `pageViewsRetained` | 100,000 | Detailed activity rows retained per page |
| `jobLabelsPerJob` | Same as `taskLabelsPerTask` | Labels on one job |

If a result block reaches `pageTrialsScanned`, it uses the newest trials within the limit and tells readers that some trials were excluded. When older activity entries are removed, the total counts and first and last view times remain available for each page and viewer link.
