# Evals

> Check that a skill triggers when it should, and that it does better than working without it, then improve it from what failed.

A skill can fail in two ways: the agent doesn't load it when it should (or loads it when it shouldn't), or it loads it and the answer is no better. Evals test both, on the draft in your skills, without installing it.

## Cases

Choose **Evals** at the top of the editor. Each case is a prompt someone might type, with what a good answer does (its expectations), and whether the skill should trigger for it. Choose a case's prompt (the arrow at the end of it) to edit it in a panel over the table. The arrows at its top, or ↑ and ↓ when you're not typing in a field, move between cases, and Esc closes it.

- **Draft evals** asks the agent to write some: three prompts that should trigger the skill, two that shouldn't, and three with expectations to grade.
- **Add case** adds one by hand.
- A case can use files, such as a document to summarise. Put them in the skill's `evals/files/` folder and list them under **Files** in the case; each run copies them in, and the grader sees them too, so an expectation such as "uses the colours in tokens.css" can be judged.
- **Add check**, beside **Add expectation**, adds a check: a script in the skill that tests the answer, described below.

The cases are saved in the skill as `evals/evals.json`.

## Run

Choose **Run all**, or tick some cases first and choose **Run 2 selected** (or however many you ticked). Spellbook first says how many sessions it will start, since each one uses your account. Turn that off, or back on, with **Ask before a run** in Settings → General.

For each case, a run has up to three results:

- **Trigger**: given the prompt, did the agent load the skill? For a case that shouldn't trigger, it passes when it didn't.
- **With skill**: the agent answers the prompt with the skill, and a separate grader checks the answer against the expectations.
- **Baseline**: the same, without the skill. The grader isn't told which of the two it's grading.

*Illustration: The evals view. Along the top: With skill 3/3, Baseline 1/3, Trigger 4/5. Below, a table with columns Prompt, Trigger, With skill and Baseline. The first row, Write a commit message for these changes, has Pass, Pass and Fail. The last row, What's the weather in Leeds, has Pass for Trigger and dashes for the other two. After a run: the pass rates with the skill, without it and for triggering, then each case's results.*

Choose a result to see each expectation, the grader's evidence, and the agent's answer side by side, each scrolling on its own. The result opens in a panel over the table: switch between **Trigger**, **With skill** and **Baseline** at the top, or press `←` and `→`; step to the case before or after with the arrows on the right, or `↑` and `↓`; press `Esc` to close. Drag its left edge to make it up to 200 pixels wider. A skill earns its place when **With skill** beats **Baseline**.

### Runs per case

Agents vary from run to run, so a case that passes once may fail the next time. In Run's confirm, or Settings → General, choose **Runs per case**: once, 3 times or 5 times. Each run is its own sessions, so 3 times costs three times as much. A case that ran more than once shows how many tries passed, such as **2/3**, and it's marked as failing if any try failed, since a skill that fails one time in three isn't one to rely on. The pass rates count tries. In the result panel, **Tries** switches between them, or press `1` to `5`; a result opens on its first failed try. Ask for fixes says how often a case failed, and Try other descriptions tries each description as many times.

**Compare**, at the top of a result (or `C`), puts the answer with the skill beside the answer without it, each drawn, with how each was judged underneath: the quickest way to see what the skill changed. When a case ran more than once, both show the same try. Choose an arm's tab to see it on its own again.

A result marked **Couldn't run** is about the case, not the skill: usually a file it lists that isn't in `evals/files/`. Open it to see why. These results are left out of the pass rates.

Up to four sessions run at once. **Stop** cancels a run under way. Each run is saved in the skill's `evals/runs/` folder, which git ignores, and the newest shows when you come back.

### History

**History** lists every run of the skill, newest first: when it ran, on which model, where, how many times each case ran, and its three pass rates. Each run is labelled with the version of the skill it tested, numbered from your first run, so you can see whether an edit helped: a line for each of With skill, Baseline and Trigger runs across the versions, with a sentence on what the last change did. The line only joins runs of the same cases, run the same number of times, so it never compares 3 cases with 8. Choose a run to see its results in the table as they were. A past run can't be changed or run from there; **Back to the latest** returns.

Results from before you changed the skill are marked: a note above the table says to run again, and results whose case you've edited since are dimmed.

You can also ask Claude Agent to run the evals. It asks you first in the conversation, with how many sessions the run will start, then starts the same run as **Run all** and reads the results when it's done. Codex can't start a run, so with Codex, run them yourself.

### Commands

Some skills work by running something: a script, a build, `git log`. Turn on **Let it run commands** in the Evals bar and both full runs of each case (with the skill and without it) can use a shell. Each command runs in Claude Code's sandbox: it can write only in the case's own folder, can't reach the network, and can't read your home folder. Every command shows with its result, with its exit code and what it printed, and the grader sees them too. The trigger check never runs commands, and neither does Try other descriptions. The switch is off for every skill to begin with, and isn't part of the skill, so a skill you import never arrives with it on.

## How a run is kept apart

Each case runs in a fresh Claude Agent session, in a temporary folder with a copy of its files (and of the project, when it runs in one; see below). The skill under test is a copy of the draft as it was when the run started, and it's the only skill the session can load: none of your installed skills, and none of your Claude Code setup. During a run, nobody is there to answer a permission card, so anything outside the case's folder is refused and the result lists what was.

Evals run on Claude Agent, whichever agent you write with. Codex can't yet load one skill on its own, without the rest of your setup.

## Run in your project

A skill written for a codebase is best tested on that codebase. When the skill works from a project (chosen with the folder button under the message box), the Evals view has a **Run in** switch with the project's name, such as **Run in vega**. It's off until you turn it on, and goes off again if you choose a different project. It's kept beside Spellbook's settings, not in the skill.

With it on:

- Each case runs in its own copy of the project, with the case's files on top. In a git repo, only the files git tracks are copied, so `node_modules`, build output and anything else `.gitignore` leaves out stay behind. Outside git, Spellbook copies the folder without `node_modules`, `target`, `dist`, `build` and `.next`. Either way, files and folders whose names start with a dot, such as `.env`, are never copied, and links aren't followed.
- The trigger check, the answer with the skill and the baseline all run in a copy, so they're compared fairly. Both answers are given the project's `CLAUDE.md` and `AGENTS.md`, as Claude Code would be when working there.
- Checks run in the case's copy.
- The copies are deleted when the run ends. Your project itself is never changed.
- A project of more than 5,000 files, or more than 200 MB, isn't copied: the run doesn't start, and the Evals view says why. Turn the switch off to run the cases on their own.

A run made in a project says so beside its time, such as "Last run 19 Nov, 10:04 in vega". It records the project's name, never where it is on your Mac, since runs can be published. **Try other descriptions** always runs in empty folders, since the project has no say in which description triggers.

## Checks

Some things a grader judges badly, such as whether the JSON a skill writes has every field. If the skill has a script that tests its own output, a case can run it as a **check**:

- **The command** is `node`, `python3`, `bash` or `sh`, then a script in the skill's folder, then any plain arguments, such as `node scripts/validate.mjs`.
- **Given** is what the script reads: **The reply** (the agent's answer) or **A file it wrote**, by its path in the case's folder.
- It passes when the script exits with 0. Its output shows in the result, under the check's label.

Checks run in the with-skill and baseline results both, and count like any expectation. Spellbook runs them itself, after the agent has finished, never in the agent's session.

A check runs the skill's own code on your Mac, so before the first run of each version of a skill with checks, Run lists their commands and asks. A check has no network, 10 seconds at most, and can only write in the case's own folder. Only run checks from a skill you trust, such as one you wrote; read the scripts of one you imported first.

In `evals/evals.json`, a check is an object among the expectations: `{ "run": "node scripts/validate.mjs", "input": "reply", "label": "Writes valid JSON" }`. The input is `reply`, or `file:` and a path.

## Improve the skill from a run

- **Ask for fixes** shows after a run with failures. It sends the failing cases to your agent, which changes the skill to pass them, saying which change is for which case. The changes come back as usual, to keep or revert. Misses waiting in the skill's inbox go too: see [Spellbook tools](https://spellbook.getmurmur.dev/docs/tools.md).
- **Try other descriptions**, under the description in the header, is for when a skill triggers too often or not enough. Your agent writes three other descriptions, then each, with the current one, is tried on the skill's trigger cases in a copy, one after another. Choose **Use** beside the best to put it in the header as an edit; nothing changes until you do.
