Evals

An eval runs a skill against small fixture repositories and reports how many results the goal critic accepted. An eval from your own history runs it instead on issues one of your repositories already fixed, judged by the tests the fix added. This page is for people who change skills, add fixtures, decide whether an eval is required before a skill goes live, or want to know how kōjō does on their code before turning it on.

Three identical parcels pass under a measuring arch next to a meter with an orange needle. Three identical parcels pass under a measuring arch next to a meter with an orange needle.
An eval puts the same small cases through a skill and reads off how many results the goal critic accepts.

What an eval measures

A case is a small repository with a seeded problem (a bug, a missing feature, a flaky test, an outdated dependency), plus a task. A case for a skill that reads issues and pull requests also seeds them, on an in-memory forge of its own. The skill runs on it as a dry run in a throwaway sandbox, with its real goals.yaml and kit.yaml. The case passes when the goal critic accepts the result. Nothing is pushed or posted.

An eval reports, per case, whether it passed, how many attempts the critic needed, what it cost, and how close the diff is to a reference fix when the fixture has one.

Run an eval

kojo eval fix-bug

kojo eval takes one skill name, or --all for every skill that has fixtures. Naming neither, or both, is a usage error.

Flag Default Meaning
--all false Evaluate every skill that has fixtures. With --factory, every skill that has cases in that directory’s evals/.
--local false Run in this process from kojo.yaml, with an in-memory store.
--factory With --local: also read skills and eval cases from a repository’s .factory directory. See A repository’s own skills.
--json false Print one JSON document when the command ends, instead of text. See Output. Not with --history.
--min-pass-rate the activation policy’s minimum Fail below this pass rate, from 0 to 1. Without the flag, the command reads min_eval_pass_rate from the server’s activation policy. With --local it takes seed.activation.min_eval_pass_rate from the file. Both are 0 unless someone set them.

The global flags (--server, --token, -f) are in the CLI reference.

On the server

Without --local the command asks the server named by --server to run the eval and polls it every two seconds until it ends. Starting an eval needs a token with the skill:edit role or higher. The server runs the cases with its own workers, sandbox driver and models. Each case is an ordinary session with the surface eval, so you can open it in the dashboard and replay it. The run is stored and listed on the dashboard’s Evals page, which can also start an eval of a skill’s active version.

The Evals page of the dashboard: five eval runs with their status, pass rate, cost, who ran them and when, two of them on the history of a repository, and one fixture run of fix-bug open with its four cases, three passed and one failed, each with attempts, cost and similarity to the human fix.
A stored run, opened case by case; the failed case names the check the critic ran.

In this process

With --local the command builds kōjō from the kojo.yaml named by -f, with an in-memory store and without forges or chat, runs the cases and exits. A case that needs issues or pull requests brings them on its own in-memory forge (Issues and pull requests). Nothing is stored. The sandbox driver and the models are the ones that file configures, so the file must name a driver that runs commands. The fake driver does not: every case fails on it while the fixture is being seeded.

The repository has a config for this, evals/kojo.eval.yaml. It uses the mock model provider replaying the recorded responses and the development-only docker driver, and it sets the minimum pass rate to 1. It needs Docker and no keys. Run it from the repository root:

kojo eval --all --local -f evals/kojo.eval.yaml

This is what make eval and CI run; see Replaying the evals.

A repository’s own skills

With --local, --factory names a repository’s .factory directory, and the command reads two things from it. Its skills/<name>/ are loaded as the server loads a repository’s skills, and come before the built-in skill of the same name. Its evals/<skill>/<case>/ are cases in the layout of Fixtures: a skill with a directory there is evaluated on those cases alone, and every other skill keeps its built-in fixtures. With --all the command evaluates the skills that have cases in evals/.

kojo eval changelog-entry --local -f kojo.ci.yaml --factory .factory

A skill of skills/ that does not load, or that the server would drop because its kit asks for more than the egress limits of settings/egress allow, stops the command with exit 1 and the reason, instead of the built-in skill of its name running in its place. Files are read from disk, with their executable bit, and a symbolic link that leads out of the directory is not followed.

The Skills CI GitHub Action runs this on each pull request that changes a skill, and comments the pass rate, cost and cases on it.

Which version of the skill runs

An eval session has no repository, so the skill is resolved from the org layer and the built-in layer only: the org’s version when the org overrides the skill, otherwise the built-in one. A repository’s own .factory/skills/ override is not what the server’s eval runs. To evaluate an unpublished change on the server, run the eval from its draft in the Skills studio; see the activation gate. With --local --factory, the repository’s own skills come first; see A repository’s own skills.

Output

One summary line per skill, then one line per case. This is the replay run with evals/kojo.eval.yaml:

build-feature: 100% passed (1 case(s), $0.00)
  pass  shout-flag  1 attempt(s)  $0.00  similarity -
daily-digest: 100% passed (1 case(s), $0.00)
  pass  one-day  1 attempt(s)  $0.00  similarity -
dependency-review: 100% passed (1 case(s), $0.00)
  pass  mirror-upgrades  1 attempt(s)  $0.00  similarity 100%
fix-bug: 100% passed (1 case(s), $0.00)
  pass  last-page  1 attempt(s)  $0.00  similarity 100%
flaky-test-hunt: 100% passed (1 case(s), $0.00)
  pass  shared-scratch  1 attempt(s)  $0.00  similarity -
port-sdk: 100% passed (1 case(s), $0.00)
  pass  truncate  1 attempt(s)  $0.00  similarity -
release-watch: 100% passed (1 case(s), $0.00)
  pass  upstream-releases  1 attempt(s)  $0.00  similarity -
reproduce-bug: 100% passed (1 case(s), $0.00)
  pass  slug-digits  1 attempt(s)  $0.00  similarity 100%
review-pr: 100% passed (1 case(s), $0.00)
  pass  prune-keep  1 attempt(s)  $0.00  similarity -
security-audit: 100% passed (1 case(s), $0.00)
  pass  command-injection  1 attempt(s)  $0.00  similarity -
stale-issue-triage: 100% passed (1 case(s), $0.00)
  pass  old-issues  1 attempt(s)  $0.00  similarity -
triage: 100% passed (1 case(s), $0.00)
  pass  last-row  1 attempt(s)  $0.00  similarity -
Column Meaning
pass or FAIL Whether the goal critic accepted the case.
name The case’s directory name.
attempts How many verdicts the critic gave.
cost What the case’s session spent, from the prices configured for the tiers.
similarity Diff similarity to the reference fix, or - when the fixture has none.
detail For a failed case: the session’s error or the critic’s report, cut at 100 characters.

With --json the command prints no text: when it ends, it prints one JSON document to standard output, also when it fails. The logs of --local stay on standard error.

{
  "min_pass_rate": 1,
  "passed": true,
  "runs": [
    {
      "id": "evl_01m8yf9ffvhjqfpmpj0t7vt8je",
      "skill": "changelog-entry",
      "models": "fast=mock/replay strong=mock/replay",
      "cases": [
        { "name": "fixed-timeout", "passed": true, "attempts": 1, "cost_usd": 0, "session_id": "ses_01m8yf9ffvhjqfpmpj0xxrgxss", "similarity": 1 },
        { "name": "new-feature", "passed": true, "attempts": 1, "cost_usd": 0, "session_id": "ses_01m8yf9j5vteeb70kc8fj8bsst", "similarity": -1 }
      ],
      "pass_rate": 1,
      "cost_usd": 0,
      "status": "done",
      "author": "cli",
      "started_at": "2026-12-03T17:30:02.107567Z",
      "ended_at": "2026-12-03T17:30:06.610613Z"
    }
  ]
}
Key Meaning
min_pass_rate The pass rate each skill was held to.
passed true when every run finished at or above it. The exit code says the same.
runs One eval run per skill evaluated, as the API returns it: its cases with passed, attempts, cost_usd, similarity (-1 without a reference fix), detail for a failed case and session_id; pass_rate, cost_usd, models and status.
error Why the command failed, when it did: a skill below the bar, or an eval that could not start or finish. The runs that finished are still listed.

A usage error in the flags prints no JSON, only the message on standard error, with exit code 2. Everything after that, a kojo.yaml that does not load included, is in error, with the exit code of Exit codes.

Exit codes

Code When
0 Every evaluated skill reached --min-pass-rate and every run finished.
1 A skill is below --min-pass-rate, a run did not finish, or the eval could not start, for example because the skill has no fixtures.
2 Usage error, or kojo.yaml does not load.
3 The server cannot be reached or answered with a server error. With --local: kōjō could not be started from the file.

When the minimum is 0, which it is until the activation policy or the seed sets one, a run in which every case fails still exits 0. Pass --min-pass-rate when you use the exit code as a gate and are not sure the policy sets one.

Fixtures

Fixtures are compiled into the binary from evals/fixtures. A server evaluates against the fixtures of the version it runs; adding a case means rebuilding. A repository’s own cases, in the same layout, are read from disk by kojo eval --local --factory; see A repository’s own skills.

evals/fixtures/
└── fix-bug/                  # the skill's name
    └── last-page/            # the case's name
        ├── case.yaml         # required
        ├── reference.patch   # optional
        └── repo/             # required: the repository the skill works on
            ├── AGENTS.md
            ├── lib/pages.sh
            └── tests/pages_test.sh
Path Required Content
case.yaml yes The task and the inputs.
repo/ yes The files of the repository, copied into the sandbox’s workspace.
reference.patch no The human fix as a unified diff. Only used for the similarity score.
references/ no Reference repositories the skill reads next to the workspace: one directory per reference, with an optional <name>.diff and <name>.md beside it. port-sdk needs one named source.
a diff file no The diff of a seeded pull request, named by its diff key in case.yaml, such as pr-42.diff.

case.yaml has these keys:

Key Type Required Meaning
task string yes, unless number is set What the skill is asked to do. It is the text of the request. With number and no task, the task is the title and body of that issue or pull request, as a forge event would bring them.
inputs map of string to string no Values handed to the skill as an earlier skill would have recorded them. Names starting with KOJO_ are reserved.
number integer no The issue or pull request the request is about. forge must seed it. The request is about a pull request when it is seeded as one.
forge object no The issues and pull requests the skill reads. See Issues and pull requests.

This is the case of the fix-bug fixture:

task: |
  Bug report: `pages` reports one page too few whenever the items do not fill
  the last page. `sh lib/pages.sh 10 3` prints 3, but 10 items at 3 per page
  need 4 pages. A reproduction test exists: tests/pages_test.sh.
inputs:
  REPRO_TEST: tests/pages_test.sh
  REPRO_CMD: sh tests/pages_test.sh

The inputs stand in for a reproduce-bug run: they give fix-bug its ${REPRO_CMD} check and its ${REPRO_TEST} constraint.

Issues and pull requests

triage, review-pr, daily-digest and stale-issue-triage read the forge: an issue and its comments, a list of issues or of pull requests, a pull request and its diff. An eval session has no repository on a forge, so a case seeds what the skill reads under forge. The session’s get_issue, list_issues, list_pull_requests, get_pr, get_pr_diff and comment then work on an in-memory forge that holds it, with the repository <skill>/<case> on a forge called fixture. A new one is built when the session first uses a forge tool.

This is the review-pr case, whose request is pull request #42:

number: 42
forge:
  pull_requests:
    - number: 42
      title: "prune: make the number of backups to keep configurable"
      author: jlee
      head: prune-keep
      opened: 5h
      diff: pr-42.diff
      body: |
        The small hosts run out of disk with 7 backups, so this adds
        `--keep N` to `bin/prune.sh`. Without the flag nothing changes: the
        default stays 7.

Its repo/ is the pull request’s head, so the code the subagent reads and runs is the code under review, and pr-42.diff is what get_pr_diff returns.

The workspace of a case whose number is a pull request with a diff gets two commits: the base, which is the diff applied in reverse to repo/, and repo/ itself as the pull request’s head on top of it. KOJO_PR_BASE then names the base, and a check with on_base runs on it. So for a skill with an on_base check the diff must apply in reverse to repo/: a case whose diff does not fails at once, with an error that names the case. A case of any other skill whose diff does not apply runs on repo/ alone, with no base commit. Write the diff with git diff between the base and repo/ rather than by hand.

An issue under forge.issues:

Key Default Meaning
number required Above 0. Issues and pull requests share numbers, so no two may have the same.
title required
body empty
author alice
labels none
state open open or closed.
opened now How long ago it was opened.
comments none Oldest first, each with author (default alice), body and age.

A pull request under forge.pull_requests has the same number, title, body, author, opened and comments, and:

Key Default Meaning
state open open, closed or merged.
closed now How long ago a closed or merged pull request was closed or merged. No earlier than opened.
draft false
head patch-<number> The branch get_pr reports.
base main The branch it targets.
diff none A file of the case directory holding the unified diff get_pr_diff returns. Without one the diff is empty.

Times are ages, counted back from when the forge is built: a Go duration (90m, 36h) or a number of days (14d). An issue was last updated by its last comment, or when it was opened if it has none; a pull request by its last comment or when it was closed or merged, whichever is later, so list_issues and list_pull_requests with since_hours see what a real forge would. A comment may not be older than what comes before it. As on GitHub, GitLab and Forgejo, list_issues leaves pull requests out: a skill finds them with list_pull_requests.

A value with # in it, such as body: Fixes #12., needs quotes: unquoted, YAML reads # as the start of a comment and the value stops before it.

The forge is only read. comment records the comment without posting it, as in any dry run, and nothing else writes to it. kojo eval checks a case’s forge section when it loads the case: a duplicate number, an unknown state, comments out of order, a closed age on an open pull request or before its opening, a missing diff file or a number that is not seeded is an error that names the case.

The fixtures shipped in this version

Every built-in skill has at least one case:

Skill Case What it holds Reference fix
fix-bug last-page A page count that rounds down, with a failing test. yes
build-feature shout-flag A greeting command that needs a --shout flag, a test and a README entry. no
security-audit command-injection A backup script that runs a request parameter through eval. no
port-sdk truncate A shell implementation of a small text library that must gain the truncate function its Python sibling gained; the Python source is a reference repository. no
reproduce-bug slug-digits A slug command that drops digits although its README says it keeps them. The reproduction must fail on that, and only test files may change. yes
triage last-row Issue #31: a CSV sum that misses the last row, caused by a while read loop that skips a final line without a newline. #27 reports the same behaviour; #29 only looks similar. no
review-pr prune-keep Pull request #42, which makes the number of kept backups configurable with an off-by-one: the default keeps 6 instead of 7 and --keep 1 deletes every backup, while its tests pass. no
dependency-review mirror-upgrades Three dependencies from a registry copy in the repository (mirror/): a security advisory and a patch release to apply, and a new major that renames functions the code calls. Applying the major fails the tests, and a lockfile edited by hand fails them too. yes
release-watch upstream-releases Dependencies from a registry copy in the repository, with release notes: a minor that adds what the code works around and deprecates a function it calls, a new major that removes it, a deprecation in another package, and a patch that does not matter here. no
flaky-test-hunt shared-scratch A suite run in an order drawn from SEED, where one test fails whenever another left keys in the scratch directory they share: 6 of seeds 1 to 10, never alone. no
daily-digest one-day A day on the forge: three new issues (a regression and a direct question among them), one closed by a merged pull request, and a pull request waiting three days for review, named in a comment. Older issues stay out. no
stale-issue-triage old-issues Five stale issues, one per verdict (likely fixed, still valid, cannot tell, and two to close), checked against the code, and two recent ones that are not stale. no
write-tests unique-flag Pull request #12, which adds --unique to a line counter without a test. Tests of --unique must pass on its head and fail on the code from before it. no
write-tests refactor Pull request #13, which moves a rounding into a helper and changes no behaviour. The tests pass, NEW_TESTS_CMD stays unset, and the report says why behaviour is unchanged. no
docs-sync renamed-flag Pull request #21, which renames --dry to --dry-run and leaves README.md and docs/usage.md naming the old flag. The docs check (DOCS_CHECK_CMD) refuses the old name, and CHANGELOG.md, which names it too, must not change. no
docs-sync nothing-to-update Pull request #22, which changes how files are copied and nothing a reader sees. Nothing changes, and the report says what was searched. no

Fixtures run offline. The dependency-review and release-watch cases cannot reach a package registry, so their repository keeps one: mirror/ holds every published version, the release notes and the advisories, and tools/deps.sh is the package tool that reads it. Their AGENTS.md says so. The skills’ own commands for real ecosystems (npm outdated, go list -m -u all) are not exercised by them.

kojo eval on a skill without fixtures, such as one you created, fails with skill <name> has no fixtures.

How a case is run and scored

  1. The runner submits one request per case: the skill named directly, the case’s task as its text, dry_run set, the case’s inputs, its number when it has one, and the title Eval: <skill>/<case>.
  2. The engine runs it like any session that names a skill. There is no orchestrator turn. It creates the sandbox the skill’s kit asks for.
  3. Instead of cloning, the workspace is filled from the fixture’s repo/ directory and committed as one commit. Diffs are measured from that commit. The fixture’s AGENTS.md is used as the repository’s.
  4. The subagent works and the goal critic checks each attempt, exactly as in a real session: declared outputs, constraints, checks, then the judge. See goals.yaml.
  5. Because it is a dry run, nothing is pushed, comment records without posting, and memory_save stores nothing. The diff is kept on the session’s result.
  6. Cases run one after another. A case that has not ended after 30 minutes is cancelled and counted as failed.

The scores:

Score How it is computed
Passed The session ended as succeeded and the goal critic accepted the result.
Attempts The number of critic verdicts in the session.
Cost The session’s model spend in USD.
Similarity The lines the run’s diff adds and removes, compared with those of reference.patch: lines in common divided by lines in either (Jaccard), 0 to 1. Whitespace at the ends of a line is ignored.
Pass rate Passed cases divided by all cases of the skill.

Similarity is reported and never decides whether a case passes.

Two things follow from an eval session having no forge repository:

  • get_issue, list_issues, list_pull_requests, get_pr, get_pr_diff and comment work on the case’s own forge when it seeds one (Issues and pull requests), and return an error otherwise. Everything else the skill needs goes into task and repo/.
  • The model budgets apply as to any session, and eval spend counts toward the daily cap. While the daily cap is spent, a case that has not started waits; it is cancelled like any other case if that takes it past 30 minutes.

An eval session is a dry run, and dry runs are not retried after a transient failure: the case fails with that error.

Evals from your own history

Fixtures say how a skill does on cases written for it. An eval from history says how it does on your code: it takes pull requests that fixed an issue in one of your repositories, gives the skill each issue at the commit before the fix, and judges the result with the tests the fix added, which the skill never sees. Recordings cannot replay arbitrary history, so these evals run live models and cost what the calls cost. Nothing is pushed or posted.

kojo eval fix-bug --history github/acme/api --test-cmd 'go test ./...' --limit 10 --validate-only
kojo eval fix-bug --history github/acme/api --test-cmd 'go test ./...' --limit 10

The skill must change code (fix-bug and build-feature have the same shape: an issue in, a change out), and the repository must be enabled. It is resolved as that repository’s sessions resolve it today. The run is on the server, with its workers, sandbox driver and models; --local does not apply.

Flag Default Meaning
--history The repository, as forge/owner/name.
--test-cmd required The shell command that runs the repository’s tests, from the repository root.
--limit required The most cases to take, 1 to 50.
--since 90 days ago Only pull requests merged since this date (2026-06-01) or this many days (30d).
--validate-only false Mine and check the cases, report the cost bound, run no model.
--yes, -y false Run the valid cases without asking.
--min-pass-rate none Exit 1 below this pass rate.

What becomes a case

The runner lists the pull requests merged since --since, newest merge first, looks at no more than 300, and keeps one as a case when:

  • its description closes exactly one issue of the repository with the forge’s closing keywords: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved, then #12, owner/name#12 or the issue’s URL. On GitLab the -ing forms, implement and lists such as Closes #1, #2 and #3 count too. A pull request that closes no issue, two issues, or an issue of another repository is left out, and so is a second fix of an issue that is already a case;
  • it changes at least one test file and at least one other file;
  • the forge reports the commit it was merged as.

It stops at --limit cases. Every pull request it leaves out is listed with the reason.

A file is a test when it is under a directory named test, tests, __tests__, spec, specs, testdata, e2e, __snapshots__ or __mocks__ (and a few more), or when it is named as the common languages name tests: *_test.go, test_*.py, *_test.py, conftest.py, *.test.ts, *.spec.js and the other JavaScript and TypeScript extensions, *_spec.rb, *Test.java, *Tests.kt, *Tests.cs, *Tests.swift, *_test.dart, *_test.exs, *_test.cc, *.bats, *.t. Tests that live inside a source file, such as Rust’s #[cfg(test)] modules, count as code. The rules are in internal/testpaths/testpaths.go.

Checking each case, without a model

Each case is checked by a session that calls no model. In a sandbox of the skill’s image, after its kit setup, it fetches the fix and finds the commit before it:

The fix landed as The commit before it
A merge commit Its first parent.
One commit that changes exactly the pull request’s files (a squash, or a rebase of one commit) Its parent.
Several commits (a rebase) The pull request’s base, as the forge reports it.

Then it runs the test command twice on that commit: with only the fix’s test files written in, the command must fail; with the whole fix, it must pass. A case that does not hold is invalid, with the reason, and costs no model call:

  • the fix’s tests pass without the fix;
  • the fix’s tests do not pass with the whole fix;
  • the commit before the fix already has its change;
  • the fix changes no test file against the commit before it;
  • the check could not run (the commit is gone from the forge, the sandbox failed).

The test command is your input, never a model’s. It runs only in sandboxes, as a shell script from the repository root, for at most 30 minutes a run. KOJO_HIDDEN_TESTS holds the fix’s test files, one per line, so the command can target them:

go test $(dirname $KOJO_HIDDEN_TESTS | sort -u | sed 's|^|./|')

The cost bound and the confirmation

Once every case is checked, the run waits as validated and reports how many cases are valid and the most running them can cost: the valid cases times the per-session budget (budgets.per_session_usd of settings/models, see Models). A session checks its budget before each model call, so its last call can take it over by what that call costs. Without a per-session budget, or when a tier the skill uses (its own, and its judge’s) has no price, nothing bounds the cost: the run says so and cannot be confirmed.

Nothing calls a model until someone confirms. kojo eval asks, and --yes answers for you; without an answer and without --yes it exits 2 and the run stays validated. In the dashboard the run shows a button. Through the API or MCP the confirmation carries the bound you were shown, and nothing starts when the bound is now higher. A confirmation is refused while the daily budget is spent; once the cases run, a case that would start after it is spent is skipped with that reason. The cases run as many at a time as the server has workers (server.workers).

What the skill cannot see

The number means something only if the skill cannot find the fix. In the skill’s session:

  • The workspace is fetched at the commit before the fix and nothing else: no tags, no remote, no FETCH_HEAD. Every commit in it is that commit or one of its ancestors.
  • The forge is reachable only while the core fetches. Every other sandbox policy of the session leaves out the forge’s host and its subdomains (for GitHub also githubusercontent.com) and its credential, even when the kit allows them. Package registries the kit allows stay reachable: a repository that publishes itself as a package (a Go module through proxy.golang.org, an npm package) can be downloaded from there at a later version, and that is not blocked.
  • The forge tools (get_issue, list_issues, list_pull_requests, get_pr, get_pr_diff) see the repository as it was when the fix’s pull request was opened: nothing created at or after that moment, never the fix’s pull request, and the issue still open. The task is the issue’s title and body as they are today. A pull request merged after that moment is shown open, without its diff. The state of another issue is the one it has today. comment records without posting.
  • Team memory saved at or after that moment is not searched, and the repository’s AGENTS.md and .factory/memory/ are read from the workspace, not from the default branch.

How a case is scored

When the skill’s session ends, a second check session fetches the commit before the fix and the fix, applies the session’s diff to that commit (only the change carries over, not whatever else the skill’s sandbox held), writes the fix’s version of its test files over it, removing those the fix removed, and runs the test command. The case passes when it exits 0.

Recorded Meaning
State pass, fail, invalid with the reason, error (a session or a check failed for a reason of its own) or skipped (the daily budget was spent).
Goal critic Whether the critic accepted the skill’s result, as in a real session. It can accept a change the fix’s tests reject.
Similarity The non-test lines the change adds and removes, compared with the fix’s (the similarity of fixture evals).
Cost, took The skill’s session’s model spend and duration. Check sessions cost nothing.
Sessions The skill’s session, the scoring check and the validation check, each replayable in the dashboard.
Pass rate Passed cases divided by the cases that ran (pass, fail, error). Invalid and skipped cases do not count.

A history eval does not count for the activation gate: it measures the skill in use on one repository.

fix-bug on the history of github/acme/api: 5 merged pull request(s) looked at, 3 case(s), 2 skipped
  skipped  #404  its description closes no issue
  skipped  #390  it changes no test file
  PASS     issue #412  fix #419  critic accepted  similarity 71%  $1.84
  FAIL     issue #398  fix #403  critic accepted  similarity 22%  $2.61  the fix's tests fail on the result (exit 1)
  INVALID  issue #361  fix #364  critic -         similarity -    -      the fix's tests pass without the fix
50% passed the fix's tests; cost $4.45

kojo eval --history exits 1 when no case is valid, when the run does not finish, or below an explicit --min-pass-rate; 2 for a usage error or a cost that cannot be bounded.

An eval of fix-bug on the history of github/acme/api open on the Evals page: 14 merged pull requests looked at, 4 valid cases and 2 invalid, a pass rate of 50 percent, then each case with its issue, its fix, the goal critic's verdict, similarity, cost, time and links to its sessions; two invalid cases give their reason.
A history eval that ran: the critic accepted the second case, the fix's tests did not.

Recordings

The model provider mock does not call a model. It replays recorded responses from the directory models.recordings names, with no network and no keys. The dev stacks, the end-to-end tests and the eval test in make test run on it. The provider itself is described on the Models page.

Replay only replaces the model. The tool calls a recording contains are executed for real in the sandbox, and the skill’s checks really run. A replayed eval therefore tests the engine, the skill’s goals and the fixture, not the quality of a model.

Format

Every .yaml or .yml file under the recordings directory, at any depth, is a list of recordings. The eval recordings are in testdata/recordings/evals, one file per skill. This is the one for fix-bug:

- purpose: subagent:fix-bug
  match: "lib/pages.sh"
  turns:
    - tool_calls:
        - { name: read_file, input: { path: lib/pages.sh } }
        - { name: read_file, input: { path: tests/pages_test.sh } }
    - text: "The page count is an integer division, which rounds down. It has to round up."
      tool_calls:
        - name: edit_file
          input:
            path: lib/pages.sh
            old_string: "echo $(( total / size ))"
            new_string: "echo $(( (total + size - 1) / size ))"
        - { name: set_output, input: { name: TEST_CMD, value: "sh tests/pages_test.sh" } }
    - tool_calls:
        - { name: exec, input: { command: "sh tests/pages_test.sh" } }
    - text: |
        Root cause: `pages` divided total by size with integer division, which rounds down, so a partly filled last page was not counted.

        Change: the division now rounds up (`(total + size - 1) / size`) in lib/pages.sh. Zero items still give zero pages. The reproduction test and the rest of tests/pages_test.sh pass; the test file is unchanged.
- purpose: judge:fix-bug
  match: "lib/pages.sh"
  turns:
    - json: { pass: true, unmet: [], feedback: "" }
Key Meaning
purpose Who is calling: subagent:<skill>, judge:<skill>, orchestrator, risk. A trailing * matches any suffix, as in judge:*.
match Optional. A string that must occur in the system prompt or the user messages. Recordings with a match are tried before those without.
turns The replies, in order.
turns[].text The model’s text.
turns[].tool_calls Tool calls, each with name and input.
turns[].json A structured answer, such as a judge’s verdict.
turns[].tokens_in, turns[].tokens_out Token counts to report. Default 100 and 20.
repeat_last Answer with the last turn once the turns are used up, instead of failing. Default false.

The reply given is the turn whose index equals the number of model messages already in the conversation. Replay is stateless, so a session resumed from a checkpoint gets the same answers. When no recording fits, the session fails with mock model: no recording for purpose ..., and it is not retried.

Replaying the evals

The eval test replays every fixture against the recordings, on a sandbox driver for tests that runs the commands in a temporary directory on the host. It needs git and nothing else:

go test ./internal/eval/ -run TestBuiltinSkillEvals

It requires every case to pass on the first attempt, and the fix-bug diff to have a similarity of 1 to the reference fix. make test includes it.

make eval builds the binary and runs kojo eval --all --local -f evals/kojo.eval.yaml: every fixture, in the kōjō process, with the recorded responses. Unlike the Go test it uses real sandboxes, plain containers on the docker driver, so it needs Docker. It exits 1 when a skill is below a pass rate of 1. CI runs it on every change.

make eval
make eval SKILL=fix-bug
Variable Default Meaning
SKILL empty Evaluate this one skill instead of --all.
EVAL_CONFIG evals/kojo.eval.yaml The config file passed with -f.
EVAL_ARGS empty More flags for kojo eval, passed as they are.

Live models and recording

Two environment variables change what a recordings setup does:

Variable Effect
KOJO_LIVE_MODELS=1 Ignore models.recordings and call the providers of the configured tiers. It has no effect when a tier’s provider is mock.
KOJO_RECORD=1 With live models and models.recordings set, write every model response under <models.recordings>/recorded/, one file per session and purpose.

make record uses both to make new recordings of the evals with a live model:

make record
make record SKILL=fix-bug

It needs ANTHROPIC_API_KEY in the environment and refuses to start without it; the calls cost what the model costs. It builds the binary and runs kojo eval --all --local --min-pass-rate 0 with evals/kojo.record.yaml, which is the eval config with real model tiers and models.recordings set to out/recordings/evals. The answers are written under out/recordings/evals/recorded/. Nothing replays them from there.

To use a recorded file:

  1. Read it. A recording holds what the model said, including tool calls; make sure no key or token is in it.
  2. Add a match that is specific to the case. A recorded file holds a purpose and its turns, without a match.
  3. Move it into the skill’s file under testdata/recordings/evals/, which is what the replay runs read.

The same record config runs the evals against a live model without recording, which is what the nightly CI job does:

KOJO_LIVE_MODELS=1 make eval EVAL_CONFIG=evals/kojo.record.yaml

Write a new case

  1. Choose the skill and a name. Create evals/fixtures/<skill>/<case>/. The case name is the directory name.

  2. Build repo/. Make the smallest repository that shows the problem. Add an AGENTS.md that says how to run the tests, as the shipped fixtures do. Keep it to plain POSIX shell so it runs in any sandbox image, and call scripts with sh path/to/script.sh: the executable bit of a fixture file is not preserved.

  3. Write case.yaml. Put in task what would arrive as the request. Add inputs for values the skill expects from an earlier skill. For a skill that reads issues or pull requests, seed them under forge, and set number when the request is about one of them; then task can be left out. Design the case so that a wrong answer fails it: one clearly right category, one real bug, an upgrade that breaks the tests if it is applied.

  4. Check that the skill’s goals can be met. The skill’s goals.yaml applies unchanged. A build-feature case needs a place for a test, because that skill requires a changed test path; a fix-bug case needs a test suite the subagent can name as TEST_CMD.

  5. Add reference.patch if you want a similarity score: the human fix as a unified diff of the files in repo/.

  6. Check the layout. This test loads every fixture and fails on a missing case.yaml, an empty task, a missing repo/ or a forge section that does not build:

    go test ./internal/eval/ -run TestFixturesAreWellFormed
  7. Add recordings. The replay test runs every fixture, so a new case needs a subagent:<skill> recording, and a judge:<skill> recording when the skill has a judge, in testdata/recordings/evals/<skill>.yaml. Give each a match string that occurs in this case’s task or AGENTS.md and in no other case of the skill. The tool calls must produce a result that passes the skill’s checks, because the checks really run.

  8. Run the replay, first as the Go test, then in real sandboxes. make eval rebuilds the binary, which is needed because fixtures are compiled in:

    go test ./internal/eval/ -run TestBuiltinSkillEvals
    make eval SKILL=fix-bug
  9. Run it against a real model, with ANTHROPIC_API_KEY set, to see how the skill does on the case without a script. This costs what the calls cost, and the record config sets no minimum pass rate, so read the output:

    KOJO_LIVE_MODELS=1 make eval SKILL=fix-bug EVAL_CONFIG=evals/kojo.record.yaml

The activation gate

The dashboard’s Skills studio takes a skill change through four steps: draft, test, eval, activate. Evals are the third step and can be made a condition of the fourth.

  • Draft. Someone with the skill:edit role edits a copy of the skill. A draft never runs in a real session.
  • Test. The draft runs against a chosen issue or pull request of an enabled repository, as a dry run. Each test run is attached to the draft.
  • Eval. The draft’s files run over the fixtures of the skill with the same name. The run is attached to the draft. Saving new content to the draft clears its eval and its test runs.
  • Activate. Someone with the operator role makes the draft live.

Activation is checked on the server against the activation policy, the settings/activation config object of the org:

Field Type Seeded from kojo.yaml Effect
require_eval boolean seed.activation.require_eval, default false The draft must be proven on its current content: by a finished eval, or by an accepted test run when the skill has no fixtures.
min_eval_pass_rate number, 0 to 1 seed.activation.min_eval_pass_rate, default 0 That eval’s pass rate must be at least this. Also the default --min-pass-rate of kojo eval.
require_second_reviewer boolean no seed key; starts false The person who activates must have written none of the draft: not its author, nor anyone who edited it.

A draft is refused, with the reason, when its files do not validate, when its kit asks for more than the scope’s egress limits, or when require_second_reviewer is set and someone who wrote it, its author or an editor, tries to activate it. Only an admin changes the policy.

What the server checks when someone activates a draft, and what activation then does:

flowchart TD
    A["Activate a draft"] --> V{"Files validate, kit inside the egress limits?"}
    V -- no --> X["Refused, with the reason"]
    V -- yes --> S{"require_second_reviewer set, and the author or an editor activates?"}
    S -- yes --> X
    S -- no --> E{"require_eval set?"}
    E -- no --> W{"Where the scope's skills are edited"}
    E -- yes --> F{"Skill has eval fixtures?"}
    F -- yes --> P{"Eval of the draft finished, pass rate at least the minimum?"}
    F -- no --> T{"A test run of the draft succeeded, accepted by the goal critic?"}
    P -- no --> X
    T -- no --> X
    P -- yes --> W
    T -- yes --> W
    W -- dashboard --> L["The draft becomes the live revision"]
    W -- git --> PR["A pull request with the skill's files"]

With require_eval set, what the draft needs depends on whether the skill has eval fixtures:

The skill The draft needs
Has fixtures An eval of the draft that has finished, with a pass rate of at least min_eval_pass_rate.
Has no fixtures At least one test run of the draft that ended as succeeded with the goal critic accepting the result.

Fixtures are compiled into the binary and matched by skill name. In this version every built-in skill has them; a skill you create under a new name has none and takes the test-run route. Because saving a draft clears its eval and its test runs, the proof is always of the content being activated.

What activation does depends on where the scope’s skills are edited. With the dashboard as the source, the draft becomes the live revision at once, for sessions that start from then on. With git as the source, activation opens a pull request with the files under .factory/skills/<name>/, and its description carries the eval’s pass rate; the skill changes when that pull request is merged.

The gate covers activation from the Skills studio. A skill edited by hand in a repository’s .factory/ takes effect when the commit reaches the default branch, without an eval. Review those changes like code, and run kojo skills validate on them in CI.

Revisions, rollback and roles are in Managing kōjō; the rest of the studio is on the dashboard page.

Proposals kōjō makes

With self-improvement on, kōjō writes drafts of its own: proposed changes to a skill’s instructions or goals. Each is evaluated automatically, next to an eval of the version in use on the same fixtures, and closed as “did not hold up” when its pass rate is lower than the version in use’s or below min_eval_pass_rate. A skill without fixtures is not measured, and its proposal says so. Approving a proposal is activating its draft through this gate, and only a person signed in to the dashboard can do it.

Scroll to move. + - zoom, 0 fit, Esc close.100%