# Lab 24: the suite and its judge (/building-ai-workers/evaluating-ai-workers/lab)

---
type: Document
title: "Lab 24: the suite and its judge"
description: "The lab for Chapter 24, in three sittings, each right after its part of the chapter: Ana's labels and the checks by code, the judge measured against her marks, then a broken prompt, six traces to name and the port."
status: stable
order: 324.9
ksor:
  owner: team:panaversity
  audience:
    - public
  approval:
    by: process:panaversity
    at: 2026-11-30T00:02:23Z
chapter: '24'
part: III
expert_status: co-build
concepts: []
last_verified: '2026-11-29'
generated:
  at: 2026-11-30T00:02:23Z
  by: esl-rewrite/1.2.0+ksor.1
trust_tier: unverified
build_id: sha256:cc6fd9ac5f72207d4365ecbda63d87d1b64f99e05519b358a45b9f5d9bfd6f8f
dirty: true
ksor_version: 0.0.60
---

<!-- OPEN: lab folder not built -->
<!-- OPEN: the lab's design is not yet in specs/labs/part-2-facts.md. The spec fixes data/golden/cases.yaml, labels.csv, marks.csv, npm run eval, .github/workflows/eval.yml, traces/failure-modes/, tests/fixtures/openai/ and the tag ch24. Every other file name, script name, tag and minute count on this page is a proposal: the start tag lab24-start, data/golden/runs/, data/golden/invoices/, data/golden/split.yaml, src/extract/, src/eval/, prompts/judge-rubric.md, docs/judge-calibration.md, docs/failure-modes.md, ports/ch24.md, tests/fixtures/broken-prompt/, tests/fixtures/new-case/, and each answer key's link. -->

You build the suite that speaks for Ana on the answers she never reads. It takes 3 sittings, and a free plan can spread them over days.

| Sitting | Do it after | Tasks |
| --- | --- | --- |
| Sitting 1 | 24.1 to 24.3 | Tasks 1 and 2 |
| Sitting 2 | 24.4 to 24.6 | Tasks 3 and 4 |
| Sitting 3 | 24.7 to 24.10 | Tasks 5 and 6, then Task 7, the port |

### Before you start

> [!IMPORTANT]
> The lab's files are not published yet. The download link for `brightline-lab-ch24.zip` and the answer keys below will work once they are. Until then, read the tasks with the chapter.

**The download.** Start from `brightline-lab-ch24.zip` ([download it here](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24.zip)). Every task's test replays recorded answers, with no key. Only a **Live step** needs your hosted worker, and you can skip every one.

<!-- EDITOR: the live steps cannot run without Lab 23's hosted worker, which no zip can ship, so the opening now says so, and the first commit is named "Start of Lab 24". The other option: cut the live steps that need the hosted worker, so the lab names no earlier lab at all (docs/authoring.md, section 4). -->

**What you need.** Node 22.22.0 or later, Python 3.12 or later with uv, git, the GitHub CLI, and the Claude Code, Codex and OpenCode apps, signed in.

**The job.** You are Brightline's builder, and today is Monday, April 12, 2027. Ana Morales, the AP analyst, has written 40 cases with her **labels**, and has marked 40 recorded answers pass or fail, **her marks**.

**How every task runs.** (1) Open a fresh session with the named coding agent, in `brightline-ap/`. (2) Write your prediction down before anything runs. (3) In plan mode, give the agent the task's prompt. (4) Approve each command. (5) Check the result against **What good looks like** and the task's answer key. (6) Add a line to `ports/ch24.md`: the task, the agent and what it proved.

**Where you are Ana.** Three tasks ask you to be Ana. You give her reasons in Task 3, her mark in Task 5, and her label in Task 6, each typed by you, from her labels. The agent never writes a mark, changes a label or reads an API key: you paste each key into `.secrets/` yourself.

### Sitting 1: Ana's labels, and checks by code

**Before you start, answer in a line each:** What is a quality goal (24.1)? What does a case in a golden set hold (24.2)? Which marks can code give alone (24.3)?

**New words in this sitting's prompts.**

| Word in a prompt | What it means |
| --- | --- |
| Case | One input with Ana's expected answer (24.2) |
| Label | Ana's expected answer for a case. For a question: the decision, the line it must cite, the words it must contain and the claim it must not make. For an invoice: the value of each field |
| Replay | Run the suite on recorded answers, with no model call and no key |
| Threshold | The number of cases that must pass for the suite to pass. An owned file holds it |
| `needs_review` | The status of a result that code would not accept. It waits for Ana and is never posted as done |

#### Task 1. Ana's labels, in the repository (Claude Code)

*Goal:* the golden set under git, loaded and checked by code, with its owners named.

*Where:* `brightline-ap/`, on your computer. No model call.

**Predict:** Ana's label for a question holds words the answer must contain. Which part of "The controller, before payment" can a word check confirm, and which part can it not?

**In plain words.** The golden set is Ana's judgment written down once. This task puts it in place before any check uses it. Code makes sure the set is complete, and the repository makes sure nobody changes it by accident. You will see the cases counted in a table, and the label of the approver question.

**By hand first.** This is for the live steps only. You need a Claude Console account with API credits, and a staging workspace with its own spending limit. You also need a staging key in `.secrets/anthropic.env`, which git ignores, and the hosted worker running in your own staging accounts. Step 2 below checks that the limit exists before any live step.

> Read `README.md`, `AGENTS.md` and 24.1 to 24.3 in `docs/chapter-24/`.
>
> 1. Put this folder under git, with a main branch, in one first commit of everything here, "Start of Lab 24", and tag it `lab24-start`. Run the offline tests the README lists, and stop at the first failure.
> 2. Check that a staging workspace with its own spending limit exists, without printing any key, and tell me the limit. If `.secrets/anthropic.env` is missing, say so and carry on: only the live steps need it.
> 3. Read `data/golden/cases.yaml` and `data/golden/labels.csv`. Show me a table: how many cases of each kind, how many are usual and how many are hard, and three cases in full with Ana's label beside each.
> 4. Write `src/eval/golden.ts` and its Python twin, which load the cases and labels, and a test that fails if a case has no label, a label has no case, an id repeats, or the counts are not 25 questions and 15 extractions.
> 5. Add `data/golden/` and the suite's threshold file to `.github/CODEOWNERS` with my GitHub name as the owner, standing in for Ana, and add one line to `AGENTS.md`: an agent never edits a label, a mark or the threshold.
> 6. Find the case "Who approves a $12,000.00 invoice?" and show me its label.

**What good looks like:** one commit at `lab24-start`, and the offline tests pass. The table shows 40 cases, 25 questions and 15 extractions. The loader's test passes. The approver case's label has the decision "The controller, before payment", the line `ap-triage-rules.md`, line 8, and a claim it must not make: any approver the policies do not name. Your prediction: a word check can confirm "controller" and the cited line. It cannot confirm the order, because the order of two steps can be written many ways.

**Saves:** `src/eval/golden.ts`, its Python twin and test, `.github/CODEOWNERS`, one line in `AGENTS.md`.

**Check it now.** Download [Task 1's answer key](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24-key-task-1.md).

#### Task 2. The extraction step, and the checks by code (Claude Code)

*Goal:* the portal reads each new invoice into fields. It does so before the 7:10 session starts, and `npm run eval` checks all 40 cases with code.

*Where:* `brightline-ap/`. Replay first, then one live step.

**Predict:** an extraction returns valid JSON with every field in the right shape, and the total is wrong. Which check catches it: the schema, or the comparison with Ana's value?

**In plain words.** This task adds the extraction step, and gives the suite its first checks. The step reads each new invoice into fields with one model call. Code checks the result's shape with the invoice schema the repository already has, and a result that fails goes to `needs_review`, where it waits for Ana. Then you run all 40 cases on recorded answers and read the first report, which shows who marked each case. One case in it is red, and you look at why. Chapter 25 makes the model keep to the schema. This lab only checks.

<!-- EDITOR: the prompts name the command `npm run eval` once, in step 3 below, where the agent builds it and could guess another name. Every other prompt now says "the suite". The other option: name no command in any prompt, and let the kit's `AGENTS.md` hold it (docs/authoring.md, section 6). -->

> Read 24.3 in `docs/chapter-24/`.
>
> 1. Write `src/extract/extract-invoice.ts` and its Python twin: one Messages API call for one invoice's text, outside the hosted session. The prompt asks for JSON with the invoice number, vendor id, invoice date, terms, `poNumber`, `subtotalCents`, `taxCents` and `amountCents`. Do not list the allowed terms in the prompt. Add the three new fields to the invoice schema. Check the reply with that schema. On a failed check, return `needs_review` with the reason, and do not retry.
> 2. In the portal's morning job, call the extraction for each new invoice before the 7:10 session starts, and add its results to the report, with every `needs_review` listed for Ana.
> 3. Write `src/eval/run.ts` and its Python twin, run by `npm run eval`. For each extraction case, compare every field with Ana's value. For each question case, check that the answer cites her line and contains her words. Never check the order of two steps with words. By default it replays the recorded answers in `tests/fixtures/`. With `--live` it calls the model.
> 4. Print a report: each case, pass or fail, and who marked it. Read the threshold from its owned file, which says 39 of 40. The suite passes at 39 only when the failing case is the one that file names.
> 5. Run the suite on replay and show me the report. Show me the failing case's extracted fields beside Ana's values.

**Live step, optional.** Ask the agent to run the suite live once. It sends about 15 extraction requests and starts about 25 worker sessions, each with a budget of at most 10 cents.

**Check before you approve.** Predict first: what does the suite do when a second case fails and the count is 38? Then ask the agent to show the lines that read the threshold, and to run the suite once on a copy of the fixtures with one more wrong field.

**What good looks like:** the replay report shows 39 of 40, every mark made by code. One extraction case is red: its total was read as the subtotal, so its shape passed the schema and its value did not match Ana's. The report names that case as the one the threshold allows. With one more wrong field, the suite fails. Your prediction: the comparison with Ana's value. The schema checks shape only.

**Saves:** `src/extract/extract-invoice.ts`, `src/eval/run.ts`, their Python twins and tests, the changed invoice schema, the morning job's change.

**Check it now.** Download [Task 2's answer key](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24-key-task-2.md).

**Checkpoint 1.** Before Sitting 2, check that you can do these without looking back.

- Say what a label holds for a question and for an invoice (24.2).
- Say which part of the approver answer code cannot mark, and why (24.3).
- Say why one red case does not fail the suite today, and what a second one does.

### Sitting 2: the judge, measured against Ana

**Before you start, answer in a line each:** What does a judge read that code cannot check (24.4)? Why is the judge measured on answers it never saw while its rubric was written (24.5)? What does a number in the report have to say besides the count (24.6)?

**New words in this sitting's prompts.**

| Word in a prompt | What it means |
| --- | --- |
| Rubric | The written rules the judge marks by, taken from Ana's reasons (24.4) |
| Verdict | The judge's mark: `correct`, `incorrect` or `unknown` |
| Mark | Ana's pass or fail on one recorded answer, kept in `data/golden/marks.csv` |
| Calibration answers | The 30 marked answers the rubric may be fixed against |
| Held-out answers | The 10 marked answers the judge never sees until the rubric is finished |

#### Task 3. The split, the rubric and the judge (Claude Code)

*Goal:* Ana's marked answers split before any rubric exists, then a judge that returns a verdict your code parses strictly.

*Where:* `brightline-ap/`. Replay first, then one live step.

**Predict:** the judge is asked about an answer and cannot tell whether it is right. Which is safer for Brightline: a guess of `correct`, or `unknown`? What happens to the pull request in each case?

**In plain words.** This task builds the judge, in an order that keeps its later measurement fair. First, 10 of Ana's marked answers are set aside, where neither you nor the agent will look at them. Only then is the rubric written. The agent asks you for Ana's reasons, and you answer as Ana, from her labels. The judge is a separate model from the one that wrote the answers. At the end you see a table of where the judge and Ana disagree on the other 30 answers.

> Read 24.4 and 24.5 in `docs/chapter-24/`.
>
> 1. **Before anything else,** split the answers in `data/golden/marks.csv` by question: 15 questions, 30 answers, to calibrate, and 5 questions, 10 answers, held out, so no question is on both sides and at least 3 of the held-out answers are Ana's fails. Write the split to `data/golden/split.yaml` and commit it. From now on, do not open, print or summarize a held-out answer or its mark until I say "measure".
> 2. Interview me, one question at a time, as Ana: for five of her fails among the calibration answers, show me the answer and her label, and ask why it failed. Write `prompts/judge-rubric.md` from my reasons, in plain rules.
> 3. Write `src/eval/judge.ts` and its Python twin. The judge gets the question, Ana's label for that case, the worker's answer and the rubric. It returns JSON with exactly two fields: `explanation`, one or two sentences, and `verdict`, one of `correct`, `incorrect` or `unknown`. Do not name any field `reasoning`. Parse strictly: any other reply counts as `unknown`. Read the judge's model from a settings file, and fail at start if it is the worker's model or is not set.
> 4. Add the judge to the suite for the 25 question answers, one trial each. The judge never marks an extraction. An answer marked `incorrect` or `unknown` waits for Ana's mark in `data/golden/marks.csv`, stored by case and by the commit whose answer she read. Her pass passes it, and her fail fails the suite. Without her mark, the suite stays red.
> 5. Run the judge on the 30 calibration answers, on replay, and show me a table: Ana's mark, the judge's verdict, and the explanation for every disagreement.

**Live step, optional.** Run the judge live on the 30 calibration answers: about 30 requests.

**Check before you approve.** Predict first: what does the parser do with a reply of `{"verdict": "Correct"}`? Then ask the agent to show the parsing lines, and to run them on three bad replies: a missing field, a fourth verdict, and plain text.

**What good looks like:** `data/golden/split.yaml` is committed before `prompts/judge-rubric.md` exists, and git's history shows that order. The held-out side has 10 answers from 5 questions, with at least 3 fails. The parser turns all three bad replies into `unknown`. The table shows the judge agreeing with Ana on most of the 30, and disagreeing on some. Your counts can differ from the key's. Your prediction: `unknown` is safer. A guessed `correct` passes a wrong answer with nobody reading it. `unknown` holds the pull request until Ana marks the answer.

**Saves:** `data/golden/split.yaml`, `prompts/judge-rubric.md`, `src/eval/judge.ts` and its Python twin, the judge's settings file.

**Check it now.** Download [Task 3's answer key](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24-key-task-3.md).

#### Task 4. Calibrate once, measure once, read every disagreement (Claude Code)

*Goal:* the judge calibrated once against the 30, its agreement measured once on the 10, and every disagreement explained in writing.

*Where:* `brightline-ap/`. Replay first, then one live step.

**Predict:** the judge disagrees with Ana on a calibration answer. Which file may change: the rubric, or her mark?

**In plain words.** This task finds out how far the judge can be trusted. You deal with its disagreements on the 30 answers once, and then you measure it once on the 10 held-out answers. You will see one agreement line in the report, and you write down what that number does and does not show. Each of Ana's fails already carries one of six failure names, which 24.7 teaches. The lab's file holds the tags the builder and Ana agreed. For now they are only categories to count.

> Read 24.5 and 24.6 in `docs/chapter-24/`.
>
> 1. For each disagreement on the 30 calibration answers, tell me which rubric rule let the judge mark it that way. Propose one revision of `prompts/judge-rubric.md` that covers them all, and wait for my approval. Never change `data/golden/marks.csv` or a label.
> 2. Run the judge again on the 30 with the revised rubric, and show me the table again. Commit the rubric. It is now finished.
> 3. When I say "measure", run the judge once on the 10 held-out answers. Report its agreement with Ana as counts: on her passes and on her fails apart, and by the failure category each of her fails carries in `data/golden/marks.csv`. Give no percentage alone.
> 4. Write `docs/judge-calibration.md`: the judge's model, the rubric's commit, the counts, and one paragraph for every held-out disagreement, with the answer, Ana's mark, the judge's verdict and why they differ. End it with two lines: what 40 cases can show, and what they cannot.
> 5. Make the suite's report print the held-out agreement beside every judge number.
> 6. Add a note to `docs/judge-calibration.md`: the 10 held-out answers are now used. A later change to the rubric needs new held-out answers from Ana.

**Live step, optional.** The second run on the 30 and the one run on the 10: about 40 requests.

**What good looks like:** one rubric revision, committed before the held-out run. `data/golden/marks.csv` is unchanged since `lab24-start`. The report carries a line in the form "agreed with Ana on 9 of her 10 held-out answers: 6 of 6 passes, 3 of 4 fails". Your counts can differ. Every held-out disagreement has its paragraph. The last two lines say that 40 cases teach the method and find failures, and do not give production-level confidence. You and Ana read the number together before anyone trusts the judge: no source gives a pass figure for it. Your prediction: the rubric. Her marks are what the judge is measured against, so changing one to match the judge would measure nothing.

**Saves:** `prompts/judge-rubric.md` (revised once), `docs/judge-calibration.md`, the report's new line.

**Check it now.** Download [Task 4's answer key](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24-key-task-4.md).

**Checkpoint 2.** Before Sitting 3, check that you can do these without looking back.

- Say why the split comes before the rubric (24.5).
- Say what happens to an answer the judge marks `unknown` (24.4).
- Read your report's agreement line aloud, and say who marked what (24.6).

### Sitting 3: a broken prompt, six traces and the port

**Before you start, answer in a line each:** What are the six names for a failure (24.7)? What do you read before you blame the model (24.8)? What does a fix for the cause add to the golden set (24.9)?

**New words in this sitting's prompts.**

| Word in a prompt | What it means |
| --- | --- |
| Trace | The record of one run: the request, the tool calls, the tool results and the answer |
| Integration layer | The code around the model: what builds the request and hands results on (24.8) |
| Required check | A CI check that must pass before a pull request can merge |
| Open-weight model | A model whose trained numbers you can download and run on your own computer (24.10) |

#### Task 5. The suite in CI, and a prompt it catches (Claude Code, then you as Ana)

*Goal:* the suite runs on every pull request, and you watch it hold a pull request that breaks one answer in a way code cannot see.

*Where:* your private `brightline-ap` repository on GitHub, and `brightline-ap/` on your computer.

**Predict:** a pull request cuts one line from the worker's prompt. It is the line that tells it to keep a rule's conditions when it quotes the rule. The answer to "Who approves a $12,000.00 invoice?" still cites line 8 and still says "controller". Who or what catches it?

**In plain words.** This task puts the suite where every change must pass it, and then tests it with a real mistake. You open a pull request that makes one answer wrong in a way a word check cannot see. Then you watch what each part of the suite does with that answer, and you take Ana's part yourself. At the end you read the answer's trace to find where the fault began.

<!-- EDITOR: this task must say how a pull request's live job gets its credential, since 23.13's workload identity rule accepts only the main branch and gives a pull request no key and no platform token. The prompt below still says "as the project's other CI job gets its credential", which that rule does not allow for a pull request. The spec's "the key and spending cap Lab 23's CI uses" is the other option, and Lab 23's CI stores no key. -->
<!-- EDITOR: both jobs are required checks, so the broken pull request is held while the suite is red, as 24.3 and 24.4 say. The other option: keep the replay job as the one required check, and have it read the live job's stored answers and verdicts for the commit. The lab must still say how the required live job passes for a reader with no key, who does steps 3 to 6 on the recorded run. -->
<!-- EDITOR: the live job runs all 40 cases, as the spec's worked run says ("The suite runs live on the 40 cases"). The other option: run only the 25 questions live and replay the 15 extractions. -->

> Read 24.3, 24.4 and 24.8 in `docs/chapter-24/`.
>
> 1. Make a private GitHub repository `brightline-ap` if I have none, and push `main` and the tag.
> 2. Write `.github/workflows/eval.yml` with two jobs. **On every pull request:** the suite on replay, with no key, failing below the threshold. **Only when a pull request changes the worker's prompt, the model setting, `data/golden/cases.yaml` or `data/golden/labels.csv`:** run all 40 cases live, the 15 extractions and the worker on the 25 questions, then the judge, in the staging workspace under its spending limit, as the project's other CI job gets its credential. Make both jobs required checks, set up so that a job that does not run for a pull request counts as passed, and tell me the branch setting to turn on. A commit that changes only `data/golden/marks.csv` starts no live run. It replays the answers of the commit her mark names.
> 3. Open a pull request that shortens the worker's prompt and cuts the line about keeping a rule's conditions. Show me its checks, the report, and every answer the judge flagged.
> 4. Stop and wait. I will read each flagged answer as Ana and add my mark to `data/golden/marks.csv` myself, by case and by the commit whose answer I read, in the same pull request.
> 5. After my mark, show me the checks again. Then open the trace of the failed answer. Show me the request the code sent, the tool result that came back, and the answer. Tell me whether line 8 with its condition was in the tool result.
> 6. Put the cut line back in a new commit, and show me the checks, the judge's new verdict and the report. I will merge.

**Live step, optional.** Step 2's second job runs on this pull request twice. Each time that is about 15 extraction requests, 25 worker sessions and 25 judge requests, and each session has a budget of at most 10 cents. To skip it, ask the agent to run steps 3 to 6 on the recorded run in `tests/fixtures/broken-prompt/`.

**What good looks like:** on the broken pull request, the checks by code pass at 39 of 40, with the one known extraction case named. The judge marks the approver answer `incorrect`: the worker now says "The controller, after payment", citing `ap-triage-rules.md`, line 8. The suite is red, so the pull request cannot merge, and it stays red until your mark. You mark it fail, and the suite fails. Your mark starts no new live run. The trace shows the tool returned line 8 with "before payment". So the fault began in the model's output, and its cause is the line the pull request cut. With the line back, the judge marks the answer `correct`, and the pull request can merge. The mark you gave belongs to the old commit, so it does not decide the new answer. Your answers can differ in wording, and the judge may flag a different answer: record what you saw. Your prediction: the judge flags it, and Ana's mark decides it. Code passed it, because the line and the word were both there.

**Saves:** `.github/workflows/eval.yml`, one new row in `data/golden/marks.csv`, the merged pull request.

**Check it now.** Download [Task 5's answer key](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24-key-task-5.md).

#### Task 6. Six traces, named, and one added back (Claude Code)

*Goal:* each of six recorded traces named with one of the six words, sorted by where it began, with a fix for its cause. One becomes a case in the golden set, and the lab ends tagged `ch24`.

*Where:* `brightline-ap/`. Replay first, then one live step. Reading and naming the traces makes no model call.

**Predict:** in one trace the answer names a purchase order that the tool results never returned. Is that enough to call it a model fault?

**In plain words.** This task is practice at naming a failure and finding where it began. `traces/failure-modes/` holds six real runs, each recorded with its request. The agent shows you each trace, and you decide its name, its place and its fix. Then one of the six failures goes back into the golden set as a new case. The case is red when you add it, because its recorded answer is the failure. You apply the fix, the case passes, and it stays in the set so that the failure stays fixed.

<!-- EDITOR: step 3 now bars a trace whose question is already one of the 40 cases, such as the approver trace, because the loader's test fails on a repeated case. The spec says only that the lab adds back "the live failure Ana marked". The other option: name the one trace that goes back. -->
<!-- EDITOR: the main path stays on replay. The new case is first checked against the trace's recorded answer, which fails, so the case is red when added, as 24.6 and 24.9 say. Then the fix goes in, and the suite replays the answers recorded after it. The live run is an optional step for a reader with a key. The other option: the pull request's live run is the main path, as the page said before, and the new case passes when it is added. The fixture folder `tests/fixtures/new-case/` is a proposed name. It must hold the answers recorded after the fix for each trace a reader may choose. -->

> Read 24.7 to 24.9 in `docs/chapter-24/`.
>
> 1. For each of the six traces in `traces/failure-modes/`, show me four things in order: the request the code sent, each tool call and its result, the answer, and Ana's label for that question. Do not name the failure. Ask me for three answers in one line: the name, from hallucination, the model declines, under-acting, context loss, format drift and inconsistent output, then "integration" or "model output", then the fix for the cause.
> 2. Write my answers to `docs/failure-modes.md` as a table: the trace, the name, what in the trace shows it, where it began, and the fix.
> 3. For the trace I choose, one whose question is not already a case in the set, write a new case in `data/golden/cases.yaml` from its question. Stop and wait: as Ana, I will add its label to `data/golden/labels.csv` and change the threshold file from 39 of 40 to 40 of 41 myself. Then update the counts in the loader's test.
> 4. Run the suite on replay, with the trace's recorded answer as the new case's answer, and show me the report. The new case must be red.
> 5. Apply the fix I gave for that trace as one change. Run the suite on replay again, on the answers recorded after that fix in `tests/fixtures/new-case/`, and show me the report case by case.
> 6. Update `README.md`. Open a pull request, wait for its checks and show me them. After I merge, tag the merge `ch24`, push the tag, and run the offline tests from a clean clone of the tag.

**Live step, optional.** This pull request changes the golden set, so its second job runs live once: about 15 extraction requests, 26 worker sessions and 26 judge requests. To skip it, ask the agent to make that job replay the recorded run in `tests/fixtures/new-case/` for this pull request, and to say so in its report.

**What good looks like:** six rows, and each of the six names used once. At least one failure began in the integration layer: the request the code sent was already wrong, and the model answered it exactly as given. The golden set has 41 cases, and the new one has Ana's label, typed by you. The threshold was 39 of 40, and now reads 40 of 41: still every case but the one it names. The first report is red at 39 of 41. The new case fails, because its recorded answer is the failure you named. After the fix, the report shows every case passing except the one extraction case the threshold names: its total is still read as the subtotal. The tag `ch24` passes its offline tests from a clean clone. That red case stays red on purpose. Lab 25 starts from it. Your prediction: no. Read the request first. If the code sent the wrong purchase order, the model answered correctly about the wrong order, and the fix is in the code.

**Saves:** `docs/failure-modes.md`, one new case and its label, the tag `ch24`.

**Check it now.** Download [Task 6's answer key](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24-key-task-6.md).

#### Task 7. The port: a new judge is measured again (Codex, then OpenCode for the advanced part)

*Goal:* the same golden set and the same marks on a second AI vendor, with that judge's agreement with Ana measured before its marks count.

*Where:* `brightline-ap/ports/`. Replay first, then one live step.

**Predict:** you move the suite to another vendor's judge and keep the rubric. Which files move unchanged, and which number do you have to earn again?

**In plain words.** This task moves the suite to a second AI vendor, to show what the move changes and what it leaves alone. The worker's OpenAI version is already in the repository. You run the suite against it with Promptfoo, the tool OpenAI now points to, with an OpenAI model as the judge. At the end you write down what moved unchanged, what changed, and why. The developer exam does not examine this task. It is practice.

**By hand first.** This is for the live step only. In the OpenAI dashboard, set the project's monthly spend limit to $5 with a hard limit, make a project key, and paste it into `.secrets/openai.env` with your editor.

> Read 24.10 in `docs/chapter-24/`.
>
> 1. In `ports/openai/`, write `promptfooconfig.yaml`. Its test cases come from `data/golden/cases.yaml` and `data/golden/labels.csv`, unchanged. Its checks by code are the same as the suite's: each extracted field against Ana's value, and for a question, her line and her words.
> 2. Add a judge with `llm-rubric`, using `prompts/judge-rubric.md` unchanged. Name the judge's model in the file, a different model from the one that answers. Record what the judge returns, and how you map it to `correct`, `incorrect` and `unknown`.
> 3. Run it on the recorded answers in `tests/fixtures/openai/`, with no key, and show me the report.
> 4. Measure this judge once on Ana's 10 held-out answers, with the rubric unchanged. Report the counts on her passes and her fails apart, beside the Claude judge's counts from `docs/judge-calibration.md`.
> 5. Add to `ports/ch24.md`: what moved unchanged, what changed, and why. If the rubric would need a change for this judge, do not make it: write that it needs new held-out answers from Ana.

**Live step, optional.** Run steps 3 and 4 live on the staging OpenAI project: about 25 answers and 35 judge requests.

**Advanced path, optional (OpenCode).** Judge the same 10 held-out answers with an open-weight model on your own computer, through `src/eval/judge.ts`, with the verdict held to a JSON schema and the temperature at 0. Report its counts beside the other two.

**What good looks like:** `data/golden/` is unchanged by the port. The Promptfoo run on the fixtures gives the same marks by code as `npm run eval`. `ports/ch24.md` has three agreement lines, or two without the advanced path, each as counts on Ana's passes and fails. It says what Promptfoo's judge returns, and that a judge with no model named may be the model that wrote the answers. If you ran the open-weight judge, compare its fails line with the others: a small judge often agrees on passes and misses fails. Your prediction: the cases, labels, marks and rubric move unchanged. The agreement with Ana is earned again by every new judge.

**Saves:** `ports/openai/promptfooconfig.yaml`, `ports/ch24.md`.

**Check it now.** Download [Task 7's answer key](https://github.com/panaversity/agentfactory-v2-resources/releases/latest/download/brightline-lab-ch24-key-task-7.md).

### Required and optional

*Required:* Tasks 1 to 6, on replay. *Practice:* Task 7's OpenAI part, on replay. *Optional:* every live step, and Task 7's open-weight judge.

### Apply it to your vertical (optional)

Pick a worker you know, and the one person whose judgment decides whether its answers are right. Write five cases with that person: three usual and two hard, each with the expected answer. For each, say whether code can mark it or only reading can.

### If something goes wrong

| What you see | Why | What to do |
| --- | --- | --- |
| The suite is red and no test failed | The judge flagged an answer, and it has no mark from Ana for this commit | Read the answer as Ana, and add your mark to `data/golden/marks.csv` yourself |
| A mark you gave no longer passes the answer | Marks are stored by case and commit, and the answer changed | Read the new answer and mark it again |
| The judge fails at start | Its model is not set, or it is the worker's model | Name a different model in the judge's settings file |
| Many verdicts are `unknown` | The judge's replies do not parse | Ask the agent to show one raw reply beside the parser's rule |
| The suite passes at 38 of 40, or at 39 of 41 | The threshold file was changed | Restore it from `lab24-start`. Only Ana changes it |
| The agent printed a held-out answer before "measure" | The split was not kept | Say so in `docs/judge-calibration.md`. Those answers are used, and a clean number needs new ones from Ana |
| A live step stops with a spending error | The staging workspace reached its limit | Finish on replay. Do not raise the limit to finish a lab |

### Artifact checklist

- [ ] `data/golden/cases.yaml`, `data/golden/labels.csv` and `data/golden/marks.csv`, with one new case, drafted by the agent, and one new label and one new mark, each typed by you as Ana
- [ ] `data/golden/split.yaml`, committed before `prompts/judge-rubric.md`
- [ ] `src/extract/extract-invoice.ts`, `src/eval/golden.ts`, `src/eval/run.ts` and `src/eval/judge.ts`, with their Python twins and tests
- [ ] `docs/judge-calibration.md` and `docs/failure-modes.md`
- [ ] `.github/workflows/eval.yml`, with both jobs as required checks
- [ ] `ports/openai/promptfooconfig.yaml` and `ports/ch24.md`
- [ ] The tag `ch24`, with 41 cases and one named extraction case still red. The threshold was 39 of 40, and is 40 of 41 once Ana's new case is in
