---
name: eval-refresh
description: "Refresh a Recipe's fakes from live traffic: find the answers its approved cases rely on that were never observed, read the servers' real calls, simulate only what is still missing, and fix the fakes. Use only when asked."
metadata:
  min-cli-version: "0.102.0"
  next: "eval-users"
---

# Eval: refresh

This step replaces the approximated answers the approved cases rely on with what the real servers answered. It changes only `fakes/` and the provenance in Part B and the pull request: never the agent, an approved case, a binding or a runtime.

For standalone runs, read `introspection operator build/draft/runs-directory`.

## Before you start

Start only when the owner asks, or says yes when `deploy-test` offers it.

You need the `introspection` CLI at this skill's `min-cli-version`, logged in to the agent's project, and the Recipe checked out on its branch: the `pr/<name>` branch deploy tested, or, for a Recipe deployed from `main`, a new branch cut from `main` and named as the repository's AGENTS.md says (`pr/fakes-<id>` when it says nothing). Never commit to `main`.

```sh
introspection whoami
introspection bindings mcp list --runtime <runtime> --environment staging -o table
(cd fakes && pnpm test)
```

`<runtime>` is the Runtime's slug, or its group id when several share the slug. Staging is the staging environment of the login's platform. Each faked server needs a `CONNECTED` binding. Not connected: stop, and ask the owner to connect it with `deploy-connect`. Never bind or connect a server yourself.

When the fakes' checks fail before any change, report what fails and ask the owner before fixing it.

Give the run an id, the UTC time it starts (`20261125-0930`), and keep its files in `<runs>/eval-refresh/<id>/`.

**Your first message to the owner gives the bindings and how long this takes,** before anything is observed: a few minutes with nothing to observe; about 15 to 30 minutes when live traffic covers the gaps; about 20 to 40 minutes with a simulation, plus the time they take to approve it.

## 1. Find the gaps from the cases

Read the approved cases (`evals/cases/`) for the tools, failures and paging they use, then each server's `fakes/mcp/<server-id>/observed.ts`, and list the gaps into `<runs>/eval-refresh/<id>/gaps.md` as [the gaps](references/gaps.md) says. A gap is one of:

- **Too few answers:** a tool a case uses with `sampled` below 3, or whose calls all failed.
- **An unobserved failure:** a failure a case uses with no observed error class for it.
- **Unobserved paging:** paging a case relies on that no observed call shows.

A tool no case uses is never a gap. A stub fake stays a stub. No gaps: go to step 4, which still checks the fakes against what was observed.

## 2. Read the live traffic first

Observe each server with a gap from the Recipe's root, merged with its committed `observed.ts`. Start the window at that file's earliest window start, as [the window](references/gaps.md#the-window) says, and end it now (UTC):

```sh
introspection bindings mcp observe <server-id> --runtime <runtime> \
  --from <from> --to <now> --merge fakes/mcp/<server-id>/observed.ts \
  --out <runs>/eval-refresh/<id>/observed/<server-id>.ts
```

A server with no `observed.ts` takes `--lookback 30d` in place of `--from`, `--to` and `--merge`. A note that it discarded new samples means the window was too narrow. Work out the gaps again from step 1, from the merged file, into `gaps.md`. Credit a simulation's calls to it, never to live traffic ([simulated calls](references/gaps.md#simulated-calls)).

- **No gaps left:** go to step 4.
- **No live calls:** its gaps stay. Report what the window held as [no live calls](references/gaps.md#no-live-calls) says, then go on to step 3.
- **The command fails:** report the server and the error, and keep its gaps.

## 3. Simulate only what is still missing

First check, read-only, that each gap can close, as [checking a gap](references/gaps.md#checking-a-gap-before-planning) says. Then plan about one conversation per gap that can, from the approved cases behind it, with their test data and limits, into `<runs>/eval-refresh/<id>/simulation.md`, as [the simulation plan](references/gaps.md#the-simulation-plan) says. Never offer a conversation that sends to or writes for anyone but the owner's test records.

They write to the owner's real accounts: before any runs, show the owner the plan, the bound accounts it writes to, each call that cannot be undone, such as a send, and the task and time of any earlier read the check rests on.

Run them only on the owner's yes, and only on staging. An answer that changes the plan: rewrite `simulation.md`, show it again, and wait for a second yes before any conversation starts. No: the gaps stay; go to step 4.

On a yes, run them with `eval-users` in evidence mode, giving it the plan. When it hands back, observe again as in step 2, over the whole window from its earliest start to now, never only since the last read, and work out the gaps once more. A conversation that never reached the tool its gap needs: record it, and don't run it again without the owner. One that failed to start isn't a gap: record `startup_failed` or `local_start_failed` and its error apart. When `eval-users` stopped on one, stop too and tell the owner; never go on to step 4 by yourself.

## 4. Refresh the fakes

Copy each merged observation over the committed `observed.ts`. Run the checks in place, on the Recipe's branch, never through `git stash`:

```sh
(cd fakes && pnpm test)
```

Fix each difference `checkRecipeFakes` lists in that fake's `answers.ts`, and in `entities.ts` where a record lacks the field, as `eval-simulate`'s write reference says. Add a contract test for each tool `observed.ts` now lists that has none, and an injected failure for each newly observed error class a case uses. Never edit `tools.ts` or `observed.ts` by hand. Rerun the checks until they pass.

Then run any Vitest cases locally as `eval-run` says, and compare them with their baseline as `eval-compare` says. Harbor cases only: say they didn't run, since Harbor runs only in the cloud, and leave them to `eval-run`. A case that now fails though the fakes' diff changed none of its answers is variance: run it again before reporting it. One that still fails shows the agent relied on an approximation: report it, and never change the case to pass. Its fix waits for the owner and `build-draft`.

## 5. Report and commit

For each faked server, write the provenance of every tool a case uses into Part B's "Data during development", as [the report](references/gaps.md#the-report) lays it out: every input, what moved to observed, and what stays approximated and why. Edit Part B in place, never through a copy in `/tmp`.

Commit `fakes/` and Part B on the Recipe's branch, and add the same table to its pull request, if any. Push only on the owner's go-ahead when the push can move staging, as [before pushing](references/gaps.md#before-pushing) says.

Then tell the owner how each gap closed or why it stays, and how the cases did.

## Done when

- The owner had the time estimate before anything was observed.
- `<runs>/eval-refresh/<id>/gaps.md` lists every gap from the approved cases, and how each closed or why it stays.
- Any simulation ran with the owner's yes, on staging, through `eval-users` in evidence mode, and was observed afterwards.
- `(cd fakes && pnpm test)` passes, and any Vitest cases ran locally against the refreshed fakes.
- Part B, and the pull request description when there is one, give each tool's provenance, committed on the Recipe's branch. This step ends here.
