Server data from the Official MCP Registry
Tests a model or prompt change on your own evals and says if it holds, before your agent ships it.
About
Tests a model or prompt change on your own evals and says if it holds, before your agent ships it.
Remote endpoints: streamable-http: https://trymargin.io/api/mcp?tools=core streamable-http: https://trymargin.io/api/mcp/agent?tools=core
Security Report
Valid MCP server (1 strong, 0 medium validity signals). No known CVEs in dependencies. Imported from the Official MCP Registry.
16 tools verified · Open access · No issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Permissions Found in Source Code
Found by scanning the linked source code. This listing connects to a hosted endpoint, so none of this runs on your machine: it describes what the server software does where it is hosted.
How to Connect
Remote Plugin
No local installation needed. Your AI client connects to the remote endpoint directly.
Add this to your MCP configuration to connect:
{
"mcpServers": {
"io-trymargin-margin": {
"url": "https://trymargin.io/api/mcp?tools=core",
"headers": {
"Authorization": "Bearer <YOUR_TOKEN>"
}
}
}
}This server needs this header. Replace each <YOUR_...> placeholder with your own value:
Authorization(required): Your project's ingest key (mgk_...), from trymargin.io/start, sent as a bearer token. Reads only.
Documentation
View on GitHubFrom the project's GitHub README.
margin-referee
The verdict on an AI change, from your own eval cases: holds up, got worse, or too close to call. A free CLI your agent or CI can call; Margin is the hosted version with receipts, agent keys and spend caps.
A new model, prompt or tool can pass your evals and still break a customer, and two scores side by side cannot tell a real change from noise. Eval platforms now label their own compares better or worse; this is a second opinion from a tool that sells no model and no eval platform, with its method stated (https://trymargin.io/methods).
margin-referee sits on top of the eval tool you already use. It reads the cases you have (a
promptfoo results file, a Braintrust, LangSmith or Langfuse dataset export, or JSONL) and tests a
change on them: a new model, a new system prompt, a changed tool list, or the same model on another
endpoint. It runs what you use today and the candidate, grades both with each case's own check, and
answers holds up, got worse, or too close to call when there are too few cases to tell. check gives
the same verdict on two experiments you already scored (Braintrust, LangSmith, Inspect, MLflow,
promptfoo or DeepEval),
and runs nothing. noise shows how often your own "it scored 3 points higher" rule fires between
two runs of the same system. What the change does to
cost is one line of the answer. No account, no backend, no telemetry.
Published on PyPI (https://pypi.org/project/margin-referee/) and GitHub (https://github.com/trymargin/margin-referee).
What is free and what Margin charges for
Free, MIT, and runs on your machine: this CLI, the verdict math (the same code the hosted product
runs, pinned by parity tests), and the receipt format
(https://trymargin.io/verdict-receipt/v1), including verify.
Paid, on the hosted product: receipts signed with Margin's key, scheduled drift checks that alert only on a proven drop, the history of every verdict and what teams reported after shipping, the opt-in pooled outcomes report, and replays run on Margin's side. Prices are at https://trymargin.io/pricing.
The JSON keeps a decision field for scripts (ship, ship_if_worth_the_cost, do_not_ship,
not_enough_evidence); answer says the same in the words used everywhere else: holds up (at a
higher cost), got worse, too close to call.
pip install margin-referee
margin-referee fit cases.jsonl
OPENROUTER_API_KEY=... margin-referee replay cases.jsonl \
--baseline openai/gpt-4.1 --candidate openai/gpt-6-luna --cap 1
Why another eval tool
Because "the candidate scored higher on our evals" is how most bad switches start. Three things make it unreliable, and this tool corrects for each:
- Small sets lie. The verdict is a paired test on the cases both models ran. Only the cases
they disagree on carry evidence, and a clean sweep on 20 cases proves nothing.
fittells you, for free and before anything runs, how many cases you need: about 100 against a current model that passes everything, and more as its pass rate falls. - The best of several looks better than it is. Try four models on the same cases and keep the
winner, and you have mostly found noise. The 0.97 bar stays put, but the confidence it must be
shown at rises with every candidate you try on overlapping cases (remembered in
~/.margin-referee/ledger.json), so renaming or trimming the cases does not reset it. To confirm a winner, replay it alone on cases none of them saw. - Half-graded cases flatter the candidate. A case with a check this tool cannot run (an LLM rubric, say) is left out and counted, never half-graded. An answer cut off by the output limit, or a call that errored, is unanswered, not a fail, and any unanswered case stops it holding up. It does not hide a loss: if the change is still worse than the bar allows with every unanswered case counted as a win for the candidate, the answer is got worse, not too close to call.
What the bound covers
The bound is a paired test on the cases, so by default it covers which cases were drawn and
nothing else. It does not cover variation from running the system again (a judge, rubric, harness
or sampler that gives a different answer the second time), and that part does not shrink as you add
cases. Give it repeated runs (replay --repeats 2 or more) and it measures that spread: it takes
each side's pass rate in each run, estimates the variance between runs, and adds it to the case
variance before taking the one-sided 95% bound. The verdict then carries rerun_variance with the
runs per side and the size in points, and the receipt says so. With one run per side nothing about
the verdict changes. It still does not cover anything that was the same in every run, such as a
grader that is wrong the same way each time, and the estimate from two or three runs is rough.
It is a margin that widens the bound by the spread the runs showed, not a calibrated coverage
guarantee for the strict all-runs-pass statistic.
What replay also does
- It stops paying once the answer is clear. From 40 cases on, the replay stops as soon as the
answer is already got worse: even the reading most favourable to the candidate misses the
bar. Each look is held to a stricter test (Bonferroni across the planned looks), so looking often
cannot manufacture a loss. It never stops early for ship;
stopped_earlysays when it stopped, and--no-early-stopruns every case. (Borrowed from VERDICT,verdict-gate.) - Reliability, with
--repeats 3(1 to 5). Each case runs that many times per side and passes only if every run passed (pass^k); the paired test reads that strict result.reliabilitygives pass@1 and pass^k per side, the cases that flipped between runs, and an estimate of the repeats needed to see a 1-point gap. Spend scales with the repeats. - Traffic weights. Give a case a
weight(ormetadata.weight: its share of traffic, or a count) andweightedreports the same cases weighted by traffic, including the share of traffic on the cases that got worse. It is a weighting of the same cases, not a new test: the decision stays on the unweighted paired test. - The verdict explains itself. On too close to call,
settlerepeats the plan's case counts (how many cases would show it holds or is worse at the observed rates) and, with repeats, says whether the gap is smaller than the share of cases that flipped between runs.capped_failureslists the candidate's cases cut off by the output limit; those cases are left unanswered, never graded as fails, andwhysays to re-run with a higher--max-tokens. Neither field changes the decision.
Runs that cannot reach a verdict are refused before they spend
A paid replay that ends too close to call for a reason you could have known first is wasted
money. replay checks for those reasons in order and stops at the first one it finds. The
decision is then refused_before_spend, the reason is the first line printed, and the exit
code is 3.
- Size, free. If you have fewer gradable cases than the gate needs (
cases_needed, 100 for one candidate), no result could beship, so nothing runs.--anywayruns it as a check that can only find a loss, and the output says so. - Smoke, a few cents. The first two cases run on both models. If a call errors (a model
id that does not exist, a 4xx or 5xx, a schema the endpoint rejects, an answer the check
cannot read), the run stops with the exact error and what it spent. An answer cut off by
the output limit is retried once at double the limit, up to 32768 tokens. If it is still
cut off, the run stops and names the limit. Set the limit with
--max-tokens. - Budget. The full run is estimated from the two smoke cases plus 20%. If that is more
than
--cap, the run stops and names the cap it would need. On OpenRouter it also reads what your key can still spend. If the estimate is more than that, the run stops. If the balance cannot be read, the output saysbalance not checkedand the run goes on.
The two smoke cases are the first two cases of the full run, so a run that goes ahead pays for nothing twice.
Three more guards work during the run:
- A 402 (out of credit) stops the run at once. Every later call would fail the same way.
- A case lost to a 429, a 5xx, a timeout or a dropped connection is tried once more when the run ends. So is an answer cut off by the output limit, at double the limit. A 400, 401, 403, 404 or 422 is not retried: the same call would fail again.
- If so many cases have no answer that the rest cannot reach
cases_needed, the run stops and says so. No later case could have made the verdictship.
Every verdict carries a preflight block: size, smoke, budget, estimate_usd,
balance_usd and the max_tokens the run ended up using.
Exit codes for replay: 0 holds up, 1 got worse, 2 too close to call or no case can be graded,
3 refused before spend (see Exit codes).
Per-case results: --cases-out
replay --cases-out runs.jsonl writes one JSONL row for every case, side and run: id,
segment, side (baseline or candidate), model, run (1 to --repeats), passed and
cost in USD. A case a side could not answer has passed: null and an error. With --models,
each model gets its own file, runs.<model>.jsonl.
noise and check read that file as it is, so you never write a runner:
margin-referee replay cases.jsonl --baseline openai/gpt-4.1 --candidate openai/gpt-6-luna \
--cap 1 --repeats 2 --cases-out runs.jsonl
margin-referee noise runs.jsonl # the baseline's two runs (--side candidate for the other)
margin-referee check runs.jsonl runs.jsonl --scorer passed
margin-referee fit cases.jsonl --results runs.jsonl
noise needs two runs of one side, so replay with --repeats 2 or more. check takes the file
twice: its first argument reads the baseline rows and its second the candidate rows.
Case file format
A case file is JSONL, one case a line. Every case needs an id, an input (a string, or messages
in the OpenAI shape) and a deterministic check. segment, group, weight and tags are
optional. A case with free-text expected output and no check is left out and counted as ungraded,
because a string compare cannot grade it.
{"id": "t1", "input": "Is claim 4471 covered, denied or needs_review? One word.", "check": "equals", "expected": "covered", "segment": "triage"}
{"id": "t2", "input": "Extract claim 4471 as JSON with claim_id, status, peril. No code fences.", "expected": {"claim_id": "4471", "status": "covered", "peril": "burst pipe"}, "segment": "extraction"}
{"id": "t3", "input": "Look up claim 4471.", "tools": [{"type": "function", "function": {"name": "lookup_claim", "description": "Fetch a claim.", "parameters": {"type": "object", "properties": {"claim_id": {"type": "string"}}}}}], "check": "tool-call", "expected": "name=lookup_claim;args.claim_id=4471", "segment": "tools"}
An expected object with two or more fields and no check is a json-match. A bare expected
string and no check is an equals label of up to 80 characters. Every check the package grades:
check | expected | passes when |
|---|---|---|
equals | the label | the answer equals it, ignoring case, spaces and surrounding quotes or full stops |
contains | text | the answer contains it, case sensitive |
icontains | text | the answer contains it, ignoring case |
regex | a Python regex | the regex matches somewhere in the answer |
is-json | none | the answer parses as JSON |
json-field | field=value | that field of a JSON answer equals the value, ignoring case |
json-match | a JSON object | every field of the object equals the answer's field, ignoring case |
tool-call | tool or name=tool;args.field=value | the model's first tool call is that tool with those arguments |
The JSON checks parse the answer as it comes. An answer wrapped in a code fence is a fail, so say "no code fences" in the prompt your cases use, or the check will grade the fence.
examples/cases.example.jsonl has one case for each check above (eight, so you can copy the line
you need). margin-referee fit examples/cases.example.jsonl runs on it.
Testing a tool change
A tool description is a prompt the model reads on every call. Rewrite one, or add or remove a tool, and the agent may start calling the wrong tool. To test that before it ships, give each JSONL case the tools the call offers and say which tool it should call:
{"id": "refund-policy", "input": "How long do I have to return shoes?",
"tools": [{"type": "function", "function": {"name": "search_kb", "description": "Search.",
"parameters": {"type": "object", "properties": {"query": {"type": "string"}}}}}],
"check": "tool-call", "expected": "search_kb"}
toolsis an OpenAI-style function tool list, andtool_choiceis optional. Both are sent with every call, as they are.check: "tool-call"passes when the model's first tool call is theexpectedtool. To check arguments too, write pairs separated by;, such asname=lookup_order;args.order_id=A1042. Values compare as text, ignoring case.- No tool call is a fail. A call whose arguments cannot be read, or an endpoint that does not report tool calls, leaves the case unanswered. It is never counted as a pass.
Then put the new tool list in a file and replay with --candidate-tools. The candidate gets
that list in place of each case's tools; the baseline keeps the case's own. The model can stay
the same:
cd examples/tool_change
OPENROUTER_API_KEY=... margin-referee replay cases.jsonl \
--baseline openai/gpt-4.1 --candidate openai/gpt-4.1 \
--candidate-tools candidate_tools.json --cap 1 --anyway
examples/tool_change has three cases and a candidate_tools.json that rewrites two vague
descriptions. Three cases show the format and prove nothing: without --anyway the replay is
refused before it spends, with it the verdict is not_enough_evidence, and fit says how many
cases you need. Each tool list you try counts as
a candidate, the same as a prompt. Tool cases run on OpenRouter and on OpenAI-compatible, Azure
OpenAI and Vertex AI endpoints; a Bedrock endpoint leaves them unanswered for now. A promptfoo
results file carries no tool list, so write tool cases as JSONL.
For MCP and tool vendors
You publish a tool list. Other teams' agents read it on every call, so a rewritten description or a renamed tool changes how those agents behave, and you do not hold their eval cases. You do hold your own logs: what was asked, and which tool was called. That is enough to gate a change.
1. Draft cases from your log. Give draft-tool-cases the tool list callers get today and a
JSONL file with one real request per line:
{"request": "Where is my order A1042?", "tool": "lookup_order", "args": {"order_id": "A1042"}}
{"request": "Do you ship to Canada?"}
cd examples/tool_vendor
margin-referee draft-tool-cases requests.jsonl --tools tools_list.json
It calls no model and costs nothing. It writes two files:
draft_cases.jsonl: onetool-callcase for each request whose log line names the tool that was called. The case expects that tool, plus the arguments the log recorded.needs_review.jsonl: the requests with no recorded tool, or with a tool that is not in the list. These rows have no check. The drafter never picks a tool for them, and a replay grades none of them.
The request can be under request, input, messages, prompt, query or question. The
call can be tool with args, or tool_call / tool_calls in the OpenAI shape. A line that
is not JSON is read as the request text. segment and group are kept: set group to the
user or conversation when one sent many requests, because the gate counts those as one.
Every row carries draft: true and source_line, the line of your log it came from. Read each
case against that line before you rely on it. A logged call is what the agent did, which is
not always what it should have done. Delete an argument from expected when it is free text
(a search query, say), since no two runs word it the same way. replay warns while any case
is still marked as a draft.
The output says how many drafts are gradable and how many the gate needs (100 for one
candidate, more for each extra one; pass --candidates). It exits 0 when you have enough and
2 when you do not. The files are written either way.
2. Use your MCP tools/list response as the tool list. --tools and --candidate-tools
both take OpenAI function tools or an MCP tools/list response: the JSON-RPC reply, its
result, or the bare tools array. Each {name, description, inputSchema} becomes a function
tool with inputSchema as its parameters. A tool with no name, an inputSchema that is not
a JSON Schema object, more than 64 tools, or one page of a paged list (nextCursor) is refused
with the reason. Nothing is repaired or trimmed.
3. Get one verdict per caller model. Your callers run different models, and a description
that reads well to one can mislead another. --models runs the same change on each:
OPENROUTER_API_KEY=... margin-referee replay draft_cases.jsonl \
--models openai/gpt-4.1,anthropic/claude-haiku-4.5,google/gemini-2.5-flash \
--candidate-tools tools_list_new.json --cap 3
Each model is its own baseline: the model with the tools in the cases, against the same model
with the new list. The output is one JSON object with a verdict for each model and a summary
line, such as 2 of 3 caller models: ship; not: google/gemini-2.5-flash.
--capis the limit for the whole command. It is split evenly between the models.- Every verdict is held to all the models in the run. Three models are three tries at the same
change, so each verdict carries
candidates_tried: 3and needs more cases than one model alone would. Earlier tool lists tried against a model on these cases are added on top. - Exit codes: 0 when every model's answer is holds up, 1 when any model's is got worse, else 3 when a model was refused before spend, else 2 when any is too close to call (or no case can be graded).
--receipt out.jsonwrites one unsigned receipt per model, namedout.<model>.json.
--models needs --candidate-tools or --candidate-system, and it runs on OpenRouter. For a
model in your own account, run replay once with --baseline-endpoint and
--candidate-endpoint.
A second opinion on a comparison you already ran
Ran the baseline and a cheaper model as two Braintrust experiments (by hand, or with Loop)?
check reads both, pairs the cases, and gives the same verdict, without calling a model:
margin-referee check baseline.jsonl candidate.jsonl --scorer correct
BRAINTRUST_API_KEY=... margin-referee check bt:<baseline id> bt:<candidate id> --scorer correct
A pass is the named score at or above --threshold (default 1.0, full credit only). Pass
--candidates N when several models were tried on the same cases. A case one experiment lacks
stops it holding up. With no metrics.estimated_cost in the exports, it says whether quality
held but claims no saving. Exit code 0 means it holds up (with or without a saving), 1 got worse,
2 too close to call, 3 an input it refused.
The same command covers a change the referee cannot make itself: a new version of your agent
framework, harness or SDK. Run your suite once on each version, write one JSON line per case
with the same input on both sides and the score under scores, and compare the two files:
{"input": {"task": "refund-17"}, "scores": {"correct": 1}, "metrics": {"estimated_cost": 0.004}}
margin-referee check before_upgrade.jsonl after_upgrade.jsonl --scorer correct
The bar, and --max-drop
By default the candidate must keep 97% of the baseline's pass rate. That is a share, not a fixed number of points: against a baseline that passes 92% of cases it allows a drop of 2.76 points, and against one that passes 60% it allows 1.8. Two identical runs that both pass 92 of 100 cases are too close to call at that bar, because 100 cases cannot rule out a drop of 3 points and the bar allows 2.76. The output says so, and says how many cases would settle it:
Why too close to call: 100 cases are too few for this bar. At the rates seen here, about 109 cases would read holds up (9 more)
Bar: the candidate keeps at least 97% of the baseline's pass rate; here a drop of at most 2.76 points
TOO CLOSE TO CALL: the quality bound is 3.0% behind, the bar allows 2.8%. Passed 92 -> 92 of 100; 0 lost, 0 fixed
What drop is acceptable is a business call, and it differs by task: giving up 5 points for a
model that costs a fifth as much may be fine for one and not for another. --max-drop POINTS on check
and replay sets it: the largest drop in pass rate your team accepts, in points, whatever the
baseline's rate. The same two runs at --max-drop 5:
Bar: the candidate's pass rate falls at most 5 points below the baseline's (a bar the team set)
HOLDS UP: the candidate held the pass rate at the bar and costs less per case. Passed 92 -> 92 of 100; 0 lost, 0 fixed
- It takes 0 to 20 points. Below 0, above 20, or exactly 0 (a bar no finite suite can meet) is refused with a message, and nothing is read.
- The case floor follows the bar: 100 cases at the default, 60 at 5 points, 300 at 1 point, read
off the same bound.
replayrefuses a suite too small for the bar you set before it spends. - The bar is in the JSON (
bar, andquality_gap.bar_allows_points), on theBar:line, and in the receipt:decisionRule.maxDropPointswithsetBy: "--max-drop"andbar: null. A loose bar is visible to whoever verifies the receipt; a default receipt keepsbar: 0.97. - It does not combine with
--judge-false-pass-rate. Holding a drop in points on true pass rates needs the judge's false-fail rate as well, which nothing here measures, so the pair is refused. - Set the bar before you look at the result. A bar loosened until the answer turns into holds up measures how far you were willing to move it, not the change.
Too close to call says what to do next
A too close to call carries next, one plain step, and changed_cases, the cases that passed
before and fail now and the reverse; both are printed above the answer line. The step is picked
in this order: fix the cases that got no gradable answer (raise --max-tokens only when the
output limit cut answers off), then fix the flaky cases when the gap is smaller than the run-to-run
flips, then add about N more cases. It ends by saying that keeping what you use today is the safe
default when the switch is optional.
When it is not optional, because the model you use is being retired, pass --forced to replay or
check. The step then says what to do before the deadline: review the changed cases, run any
other replacements and prefer the one with the smallest worst-case drop, and ship with a way to
roll back. --forced changes the advice only, never the answer or the exit code.
Judging two promptfoo runs
promptfoo shows each provider's pass rate side by side and leaves the call to you. check --source promptfoo reads the file promptfoo eval -o results.json writes and gives the verdict. A case
passes when promptfoo's own success is true (every assertion passed) on every repeat; an errored
test is unanswered, never a fail; cost is read when promptfoo recorded it. Cases pair by test
description, else by test index.
Both providers in one results file, the usual way to compare models in promptfoo:
margin-referee check results.json --source promptfoo \
--baseline-provider openai:gpt-4.1 --candidate-provider openai:gpt-4.1-mini
Or one file per run:
margin-referee check before.json after.json --source promptfoo
A provider is named by its label, else its id. A file holding several providers needs the side's
provider named; the error lists the ones in the file. --scorer and --rules are refused here:
the pass comes from promptfoo's own assertions, and release rules are not read from promptfoo
output yet. A test that appears twice for one provider and run (two prompts in one file, or a
description used twice) is refused: compare one prompt at a time. examples/promptfoo/results.json
holds the two identical 92-of-100 runs used in the bar section above.
OpenAI's Evals dashboard and API shut down on 2026-11-30 and point their users to promptfoo. For a team making that move, this is the command that turns promptfoo's two columns into an answer.
Judging two DeepEval test runs
Ran deepeval test run (or evaluate()) on the model you use today and on the candidate?
check --source deepeval reads both saved runs and gives the verdict:
margin-referee check baseline.json candidate.json --source deepeval
margin-referee check baseline.json candidate.json --source deepeval --scorer "Answer Relevancy"
A run is the JSON DeepEval saves (field names from deepeval 4.3.6's own source): the
test_run_<timestamp>.json it writes to DisplayConfig(results_folder=...) or
DEEPEVAL_RESULTS_FOLDER, .deepeval/.latest_run_full.json, .deepeval/.latest_test_run.json
(the same run under testRunData), or evaluate()'s test_results dumped as JSON.
- A case passes on DeepEval's own
successfor the metric--scorernames (DeepEval sets it against the metric's threshold). Without--scorer, every metric must pass, and both runs must carry the same metrics. - A metric that errored, recorded no
success, or was skipped (DeepEval leaves a skipped metric out ofmetricsData) leaves the case unanswered, never a fail. A determined fail on any required metric is a fail. - Cases pair by
input, else by test casenamewhen inputs repeat. When both repeat, the run is refused: two cases with one id cannot be paired. So is a metric no case carries, by name. - The cost per case is
tokenCost, the cost of the call under test, when you recorded it.evaluationCostis what the judge cost and is not read as a saving. --rulesare checked on each case'sactualOutput. Conversational test cases are not read yet.
examples/deepeval/ holds two runs of a support bot on 64 questions, scored with
Answer Relevancy and Correctness [GEval]; one candidate case has an errored GEval judge.
Every metric: too close to call (exit 2), because that case is unanswered. --scorer "Answer Relevancy" --max-drop 5: holds up and cheaper (exit 0). --scorer Faithfulness: refused, the
runs carry no such metric (exit 3).
Exit codes
Every verdict command exits by the answer it prints, so CI can branch on the code:
| code | answer |
|---|---|
| 0 | holds up, with or without a cost saving (a holds up at a higher cost per case is 0 too) |
| 1 | got worse |
| 2 | too close to call or not enough evidence (replay: also no case can be graded) |
| 3 | nothing was judged: a replay refused before spend, or an input refused (a metric no case carries, duplicate case ids, a flag pair that does not fit), with the reason on stderr |
This is replay, check, hurdle and ontology-sql. A usage error argparse catches before
anything is read (a missing required flag) exits 2, as every Python CLI does. Whether the change also saves money is in
the JSON, never in the code: promoted is true only when it holds up and costs less per case,
and cost says cheaper, same, dearer, unknown or not_recorded. Through 0.1.12 the code
followed promoted, so a run with no cost data could print HOLDS UP and exit 1; it no longer can.
The other commands keep their own codes: fit and draft-tool-cases 0 ready, 2 not yet;
audit 0 nothing found, 1 issues, 2 a file could not be read; judge 0 comparable, 1 moved, 2 cannot tell; noise 0
report, 2 nothing to compare; verify 0 verified, 1 not, 2 cannot be checked.
Testing the eval itself: a new judge, rubric or parser
The judge is part of the instrument. A new judge model, a cheaper judge, or a reworded rubric moves
scores even when the system under test did not change, and scores across the swap then compare two
graders, not two setups. Grade the same saved outputs with the old grader and the new one, and
judge puts the two gradings through the same paired test as check, in both directions:
margin-referee judge old_judge.jsonl new_judge.jsonl --scorer pass
margin-referee judge results.jsonl --old-scorer judge_v1 --new-scorer judge_v2 # one file, both scores
It answers that the judge change alone moves scores (stricter or more lenient), no proven effect, or not enough evidence (too few cases, or a case only one grader scored). Exit code 0 means scores are comparable across the two graders, 1 that the grader moved them, 2 that it cannot tell. Run the old judge twice on the same outputs to measure how often it disagrees with itself.
A planted regression is the other half: score a deliberately worse system and run
check baseline.jsonl degraded.jsonl --scorer pass. If it does not say got worse, the suite cannot
see a drop that size, and fit says how many cases it would need.
Judging a LangSmith Engine fix or a SmithTune model
LangSmith Engine proposes a fix as a pull request and "can test that fix against an eval set
before your team ever sees it". SmithTune fine-tunes a model, then "compares it against the base
model in LangSmith" (The Agent Lake, LangChain,
November 2026). In both, the tool that proposed the change also graded it. check reads the two
experiments LangSmith already holds, the baseline and the candidate, and gives the same verdict
it gives everywhere else. It calls no model.
LANGSMITH_API_KEY=... margin-referee check ls:<baseline experiment> ls:<candidate experiment> --key correctness
margin-referee check baseline.json candidate.json --source langsmith --key correctness
ls: takes an experiment id or its name. Use a read-only key. Set LANGSMITH_ENDPOINT for the
EU region or a self-hosted install (the default is https://api.smith.langchain.com). --key is
the feedback key that decides pass or fail, and --threshold is the score a pass needs (default
1.0, so a 0/1 score passes at 1).
How an experiment is read:
- Cases are paired by
reference_example_id, the dataset example a run answered. A root run with no example is left out and counted undercounts.unlinked. - A run passes only on a numeric or boolean
scorefor the key, at or above the threshold. - A run with no feedback for the key, feedback with only a category label, a run that errored and a run that did not finish are unanswered. Each is listed with its reason. Unanswered is not a fail, and it stops it holding up.
- With repetitions, a case passes only if every repeat passed. One failed repeat fails the case.
- Cost is the runs' recorded
total_cost. A run with none, or with zero, has no recorded cost. A fine-tune LangSmith has no price for is not free, so the verdict then says whether quality held and claims no saving (cost: not_recorded). - Segments come from a run's
metadata.segmentormetadata.category, else from the example's dataset split when it has exactly one.
An exported file is one JSON object, {"runs": [...], "feedback": [...], "examples": [...]}, or
JSONL with one run or feedback row per line. Only the root runs and their feedback rows are
needed. examples is optional and only supplies the splits. From the LangSmith Python SDK:
runs = [r.dict() for r in client.list_runs(project_name="my-experiment", is_root=True)]
feedback = [f.dict() for f in client.list_feedback(run_ids=[r["id"] for r in runs])]
json.dump({"runs": runs, "feedback": feedback}, open("candidate.json", "w"), default=str)
Not yet confirmed against a live LangSmith account (the reader was built from LangSmith's published OpenAPI document and tested against responses shaped like it):
- that
POST /api/v2/runs/querywithinclude_subtree_usageputs the whole trace's cost on the root run. If it does not, cost reads as not recorded and no saving is claimed. - what
total_costholds for a model LangSmith has no price for (the reader treats zero and null the same way: not recorded). - that every evaluator's feedback row carries the root run's id in
run_id. Feedback written to a child run would leave the case unanswered. - self-hosted installs older than v0.16, which do not serve the v2 endpoints. Export to a file there.
Judging two Inspect eval logs
Ran an Inspect task (UK AISI's inspect_ai) on the model you use
and on the one you want to try? check reads the two logs and gives the same verdict. It calls no
model.
margin-referee check logs/baseline.eval logs/candidate.eval --source inspect --scorer match
margin-referee check baseline.json candidate.json --source inspect --scorer model_graded_qa
--scorer is the scorer's name as it appears in each sample's scores. How a log is read
(field names from inspect_ai 0.3.292's own source):
- A
.jsonlog is oneEvalLog; a.evallog is the zip Inspect writes (header.jsonplus onesamples/<id>_epoch_<n>.jsonper sample and epoch). Inspect compresses.evalwith zstd. Python reads that from 3.14; on older Pythons it is read throughzipfile_zstdwhen installed (inspect_aiinstalls it). Otherwise the error says to runinspect log convert --to json. - Samples are paired by
id. A sample one log has and the other lacks is unanswered. - A score value is read the way Inspect reads it:
Cis 1,Pis 0.5,IandN(no answer) are 0,yes/true1,no/false0. A pass is a value at or above--threshold(default 1, so partial credit is not a pass). - With several epochs, a case passes only if every epoch passed. Inspect itself reports the mean over epochs; the referee is stricter.
- A sample with no score for the scorer, a list or dict value, or an
erroris unanswered, with its reason. Unanswered is never a pass or a fail, and it stops it holding up. - Cost is each sample's
model_usagetotal_cost. A model with none leaves no recorded cost, and then the verdict says whether quality held and claims no saving. - A log whose
statusis notsuccessis incomplete evidence, and the verdict says so.
Judging two MLflow evaluation runs
Evaluated two versions with MLflow? check reads each run's per-row results from a file and
gives the same verdict:
margin-referee check baseline.json candidate.json --source mlflow --scorer correctness
The file is either of these (field names from mlflow 3.18.0's own source):
mlflow.genai.evaluate: the result'sresult_df, ormlflow.search_traces(run_id=...), saved withdf.to_json("run.json", orient="records")(orient="split"also reads). The score is the<scorer>/valuecolumn, else the row'sassessmentsof that name.mlflow.evaluate: theeval_results_table.jsonartifact it logs, with a<metric>/scorecolumn per metric. Pass the metric name as--scorer.
Rows are paired as mlflow.genai.compare_evaluations pairs them: by the trace's eval request id
(the mlflow.eval.requestId tag), else by the row's inputs (or request). A row with neither is
counted under counts.unkeyed. yes/true is 1 and no/false is 0. A row with no score, a
score that is not a number or yes/no, a scorer error or a trace in state ERROR is unanswered,
never a pass or a fail. Two rows with the same key in one run are repeats: the case passes only if
both passed. MLflow records tokens but not prices, so check says whether quality held and claims
no saving (cost: not_recorded).
The verdict on a Hurdle suite
Ran a Hurdle suite with and without a skill, or on
two models? hurdle reads the runs it saved and says whether the difference is real:
margin-referee hurdle .hurdle --compare condition --baseline baseline --candidate with-skill
margin-referee hurdle .hurdle --compare model --baseline <model now> --candidate <model to try>
A task passes only if every repeat passed, and repeats_passed shows each side's count. A run
Hurdle marked incomplete or unknown leaves its task unanswered, which stops it holding up.
Judging an ontology layer: NVIDIA ontology-sql-eval
Ran ontology-sql-eval to compare a schema-only
prompt with the ontology-grounded agent? ontology-sql reads the two arms' result files and
says whether to ship the layer. It calls no model and needs nothing of NVIDIA's installed:
margin-referee ontology-sql runs
margin-referee ontology-sql runs/full_20261126 --price-in 5 --price-out 25 --price-cached 0.5 --json
It reads <run>/control/<dataset>.jsonl and <run>/treatment/<dataset>.jsonl, pairs the
questions by task_id, and applies the referee's rules, which are stricter than the harness's
own report:
- A pass is the verifier's positive verdict. A wrong result, a query that errored or timed out, or no SQL in the answer is a fail.
- A gold query that did not run, a run with no model output, an unknown error, or a question one arm has no row for is unanswered. It is listed with its reason, counts as neither a pass nor a fail, and stops it holding up. The harness scores some of these as misses, so its accuracy and this one can differ on the same run.
- Tokens per question come from the per-call capture block on each row when the run recorded
one, otherwise from the ontology arm's own totals. Cost is those tokens times the
--price-inand--price-outyou give (USD per million tokens). The files carry no price, so without both flags cost readsnot_recordedand nothing is guessed. - Cached input is read per call (
cached_tokensin the capture block, otherwise the ontology arm'sagent_cached_input_tokens) and is part of the input count. Give--price-cached(USD per million cached input tokens) to price it at its own rate. Without that flag cached input is priced as fresh, and the cost basis says so. The cached rate is used only when both arms recorded the split; if either did not, the output sayscache split not recordedand all input is priced as fresh. No split is guessed. - The cache-hit share (cached input over all input) is printed for each arm, and the JSON has
cache: {baseline: {fresh_in, cached_in, share}, candidate: {...}, line}, totals over the paired questions. When the two arms differ by ten points or more you get a line such asthe candidate's cache-hit share fell from 80% to 12%, so a change that breaks prompt caching shows up. The share changes cost only. It never changes a pass, a fail or the quality verdict. - The ontology arm makes many more calls per question. If the pass rate only holds, the answer
is
not_enough_evidence: a layer that is not cheaper ships on a proven gain. If the gain is proven it readsship_if_worth_the_cost, with the questions won and lost and the 95% bound on the gain, and the decision to pay is yours. - Results are also read per
difficulty(ordb_id; choose with--segment-by), so a gain overall cannot hide a loss on the hard questions.
--baseline-arm and --candidate-arm name the two folders, or two rollout files, if yours are
called something else. Swap them to ask the opposite question: can the layer be dropped?
Documentation truncated — see the full README on GitHub.
Reviews
No reviews yet
Be the first to review this server!
More Developer Tools MCP Servers
Rea
Freeby Morluto · Developer Tools
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
Paperclip
Freeby Paperclipai · Developer Tools
Trending hip-hop artist momentum scores across four cultural dimensions.
Scrapling
Freeby D4Vinci · Developer Tools
Web scraping with stealth HTTP, real browsers, and Cloudflare bypass. CSS selectors supported.
Server Time
Freeby Modelcontextprotocol · Developer Tools
Current time lookup and conversion between IANA timezones
Toleno
Freeby Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
MCP Marketplace
Freeby mcp-marketplace · Developer Tools
Search and install MCP servers from inside your AI client.
