How to keep your Claude eval running when things change

Day 6, 25 minutes · advanced

Goal of this lessonSave a baseline, change the prompt, add a new failure case and run a regression check that shows what broke.

Why it matters

An eval you ran once is a snapshot. Next month you will tweak the prompt, a new model will come out, or a customer will send an email the sorter gets badly wrong. Each of those can break something that used to work, and you will not notice until a customer does.

Today you turn the eval into a habit. You save a baseline, make a change, add a new test case from a real mistake and run a regression check that lists exactly which cases broke. At the end Tjalling has a routine he can run in a minute after every change, and a note that says when to run it.

The words you need today

  • Regression: something that worked before and is broken after a change. "It got worse" in one word.
  • Baseline: a saved result from before the change, to compare against.
  • Regression eval: an eval whose job is to check that everything that used to pass still passes.

Two kinds of evals

Anthropic's engineering post on evals separates them:

  • A capability eval asks what the system can do well. It may start at a low pass rate and gives you something to improve.
  • A regression eval asks whether the system still handles everything it used to. It should pass nearly 100% of the time. A drop means something broke.

When cases in a capability eval pass reliably, they can move into the regression set. Tjalling's test set does both jobs for now: the score tells him how good the sorter is, and the regression check tells him what changed.

When to run the eval again

  • After every prompt edit. Small wording changes can have effects you did not expect. The engineering post describes teams where users said things "feel worse" after changes and nobody could check.
  • Before you change model. The page on choosing a model says a good evaluation set is the most important step in deciding whether to upgrade. The engineering post notes that teams with evals can test a new model in days instead of weeks.
  • Now and then on the same model. The page on model IDs says a model ID such as claude-haiku-5-5 is a pinned snapshot: the model itself does not change. The serving setup around it can, and the page says that can cause small differences in behaviour. Every model ID also has its own retirement date, so one day you will have to move.
  • When a new mistake shows up. Turn it into a test case right away, as the post advises: user-reported failures make your test set reflect real use.

Turning a mistake into a test case

Say a customer wrote: "My bike was stolen last night. Can you tell me the frame number from my repair last spring?" It sounds urgent, but nobody needs a repair, so Tjalling wants it in other, not urgent. Today you add it as case e13, with an edge note that says why it is there. Remove anything personal before you add a real email.

Add a case with its ground truth even if the sorter now gets it right. The point is that it stays right after the next change.

Reading the regression check

regression.py compares results.json with baseline.json, case by case:

  • broken since baseline: passed before, fails now. These need your attention.
  • fixed since baseline: failed before, passes now.
  • new cases: not in the baseline yet, with the ones that fail.

When something broke, the script ends with exit code 1. That is the signal other tools use for "stop": later you can run it automatically before every change goes live.

One broken case is not always a real regression. Claude can give a different answer on another run, so run that case again before you decide. If it fails again and again, find out why before you ship the change. This course suggests one more habit: when you accept a new result as the new normal, copy results.json to baseline.json again, so the next check compares against it.

Read the answers now and then

The engineering post ends with simple advice: read the transcripts. A transcript is the full record of a run: here, the email and Claude's answer, which results.json keeps. A score can hide a check that passes for the wrong reason or a test case that is no longer fair. Read a handful of answers every time you change something.

The steps

  1. Save a baseline from a run with your current prompt.
  2. Create the regression check.
  3. Make a change: put the better prompt from lesson 5 in place.
  4. Add the new case from a real mistake.
  5. Run the eval and the check and read what broke, what got fixed and what is new.
  6. Write down when you will run it again.

Follow the steps below.

Today's actions

Ticks are not saved without an account

Do it in Claude API

Claude API

  1. Open a terminal in your spokeworth-evals folder and turn on the virtual environment: source .venv/bin/activate on macOS or Linux, .venv\Scripts\Activate.ps1 on Windows. Run python run_eval.py once with your current prompt.
  2. Copy results.json to baseline.json: cp results.json baseline.json on macOS or Linux, Copy-Item results.json baseline.json in PowerShell. This is your baseline.
  3. Create regression.py with this code. It compares results.json with baseline.json per case id and stops with exit code 1 when a case that passed in the baseline fails now.
    import json
    import sys
    
    baseline = {r["id"]: r["passed"] for r in json.load(open("baseline.json", encoding="utf-8"))}
    current = {r["id"]: r["passed"] for r in json.load(open("results.json", encoding="utf-8"))}
    
    broken = [i for i in current if baseline.get(i) is True and not current[i]]
    fixed = [i for i in current if baseline.get(i) is False and current[i]]
    new = [i for i in current if i not in baseline]
    new_failing = [i for i in new if not current[i]]
    
    print("baseline:", sum(baseline.values()), "of", len(baseline), "passed")
    print("now:     ", sum(current.values()), "of", len(current), "passed")
    print("broken since baseline:", broken or "none")
    print("fixed since baseline: ", fixed or "none")
    print("new cases:", new or "none", "| failing:", new_failing or "none")
    
    if broken:
        print("REGRESSION: look at these cases before you ship the change.")
        sys.exit(1)
    print("No regressions.")
  4. Open classifier.py and replace the whole PROMPT = """...""" block with this one. It is variant B from lesson 5 (if you kept A, skip this step).
    PROMPT = """You sort emails for Spokeworth Cycles, a small bike repair shop.
    Pick exactly one category: repair_booking, parts_question, complaint, invoice or other.
    Set urgent to true only if the customer cannot ride their bike today.
    A question about a bill or a payment is invoice. With two requests, the first one decides.
    Answer with JSON only, without code fences, like this: {"category": "complaint", "urgent": false}
    
    <email>
    {email}
    </email>"""
  5. Open test_set.jsonl in your editor and add this line at the end, on its own line. It stands for an email the sorter once got wrong. Save the file and run python check_set.py.
    {"id": "e13", "email": "My bike was stolen last night. Can you tell me the frame number from my repair last spring?", "category": "other", "urgent": false, "edge": "added after a real mistake: sounds urgent, but no repair is needed"}
  6. Run python run_eval.py, then python regression.py. It lists the cases broken and fixed since the baseline and the new cases. Run a broken case again before you decide it is a real regression.
  7. Add a line to criteria.txt that says when you run the eval again, for example: after every prompt edit, before switching model, and when a new mistake shows up.

Note: Add the e13 line in your editor, not with a shell command: a redirect such as >> in Windows PowerShell can write the file in another text encoding, and the scripts read it as UTF-8. After this change variants.py builds variant B on top of the new prompt, so update it before you run compare.py again.

Paid planPay as you go: buy prepaid credits in the Claude Console (minimum 5 US dollars). There is no free tier. Max, Ultra and Team plans include monthly API credits.

Checked on 4 December 2026 · Source: Claude API docs: Model IDs and versioning (opens in a new tab)

Create a free account to save your progress. Sign in or sign up