Your Flagsmith A/B test says a variant won. Notary checks whether you can believe it, before you ship.
![]() |
![]() |
| Flagsmith: “97% winner, consider rolling it out to all users.” | Notary, same experiment: the split came out 103 vs 290 instead of 50/50, so don't ship. |
The same experiment, run on RealWorld Conduit with a realistic tracking bug. Both versions really convert at 10%.
Built for Toggle Wars, the Flagsmith Experimentation Hackathon: Track 02, AI Agents and Feature Flags.
Flagsmith runs your experiment and reports a winner, but it trusts whatever your app tells it about who saw which variant. One instrumentation bug, like a flag read before it loaded or an exposure logged at the wrong moment, and Flagsmith confidently crowns a winner that isn't real.
Notary is the check between "Flagsmith says B won" and "ship B to everyone."
Notary recomputes the result from Flagsmith's own data, then runs it through a set of checks. These five frames show one audit of the demo storefront (experiment 59), where Flagsmith reported a 99.5% win:
The full set of checks:
- reported vs. assigned variants
- the result recomputed on corrected data
- sample ratio
- correction for multiple comparisons
- guardrail metrics Flagsmith doesn't look at
- a false-win-rate simulation
Every audit ends in one verdict: CERTIFIABLE, DON'T SHIP or NO WINNER.
When a result can't be trusted, Notary does three more things:
- Contains the damage. It lowers the experiment's rollout, so fewer users get an unproven variant. It never raises the rollout and never pauses the experiment.
- Finds the cause. An AI agent reads your app's source, using the audit's evidence, and drafts the smallest fix on a branch.
- It type-checks the patched app first.
- Then it runs a fresh experiment on a throwaway copy, and keeps the fix only if the new audit passes.
- Leaves the decision to a person. Approving and shipping a winner only happen when a human types the approval at a terminal. Notary can't ship anything on its own.
The RealWorld "Conduit" blogging API was given a Flagsmith experiment: does a "write your first article" card make new users publish? Each run sends 600 synthetic users through the real API. These runs are from 2026-11-29:
| Run | Flagsmith says | Notary says |
|---|---|---|
| Card really works (10% → 18%) | 98.7% winner | CERTIFIABLE: every check passes |
| Bug: exposure logged at login; both versions equal | 97.1% winner | DON'T SHIP: split 103 vs 290, p = 4.0×10⁻²¹ |
| Same bug, one-line fix | 90.2%, inconclusive | NO WINNER, which is the truth |
Across 110 paired audits on Conduit, Notary blocked all 40 buggy experiments and wrongly blocked none of the 64 correct ones.
This testing used the improved checks from PR #2. The harness is on the cloud/stats-run branch, and the benchmark data is on cloud/notary-improvements.
Flagsmith is the subject of every check:
- Experiments (beta): Notary reads the experiment, its split, its metrics and the on-demand results through the admin API.
- Bucketing: Notary recomputes who got what with the Flagsmith Node SDK's own local evaluation engine, so the assignments are Flagsmith's own, not a reimplementation.
- Raw events:
$flag_exposureand conversion rows come from Flagsmith's Postgres, so the results can be rebuilt from scratch. - Containment and shipping go through the admin API. Containment lowers the rollout; shipping completes the experiment with the approved variant.
- MCP: the MCP server makes all of this available to any AI agent.
You need Docker, Node 24+ and jq.
# 1. A local Flagsmith, seeded
cd infra
docker compose -p flagsmith up -d
./bootstrap.sh # org, project, environments, keys → infra/flagsmith.env
# 2. Install
cd ../notary && npm install
# 3. Audit an experiment (its numeric id)
set -a; source ../infra/flagsmith.env; set +a
node src/cli.ts audit <experiment id>The audit's exit code is 0 for certifiable, 1 for don't ship and 2 for no winner.
notary audit <id> check an experiment
notary guard <id> --contain-to <pct> audit, and lower the rollout if it fails
notary diagnose <report> --repo <dir> find the cause and draft a fix
notary approve <report> --variant <key> --by <name> a person signs off (terminal only)
notary ship <certificate> --report <report> complete the experiment
cd demo-app && npm install && cd ../demo-offers && npm install && cd ..
./demo.sh all # about 13 minutesThe demo runs on two apps:
- A storefront (
demo-app/, React) with a planted tracking bug.- Flagsmith calls a tied button a 99% winner.
- Notary blocks it and cuts the rollout, and the agent fixes the one bad line.
- A re-run on the fixed store comes back inconclusive, which is correct.
- Then a genuinely better button is certified.
- An offers service (
demo-offers/, Node) with a different bug and a three-way test with a guardrail.- One offer really wins.
- Another sells more but breaks payments, and Notary rules out just that one.
The script never merges a fix or approves a winner; those are left to a person. Run ./demo.sh with no argument to list the stages, or see exp.md for a hands-on walkthrough.
Beyond the demo apps, Notary was tested against the open-source RealWorld "Conduit" app across 56 experiments. It caught every planted instrumentation bug, including 10 runs where Flagsmith reported a 97–99.9% false winner, and never blocked a correctly instrumented experiment. The weaknesses found are written up too. See REAL_APP_TEST.md.
{
"mcpServers": {
"notary": {
"command": "node",
"args": ["--env-file=infra/flagsmith.env", "notary/src/mcp/server.ts"]
}
}
}It has four tools: list_experiments, audit_experiment, contain_experiment and failure_evidence. On purpose, there is no tool to approve, ship or raise a rollout; those stay with a person.
notary/ checks, audit, verdict, containment, the agent, the approval gate, the MCP server
demo-app/ React storefront with a planted exposure bug
demo-offers/ Node offers service: a different bug, three arms, a guardrail
infra/ docker-compose and a bootstrap script for a local Flagsmith
demo.sh the end-to-end demo
exp.md a step-by-step walkthrough
It's TypeScript, run directly on Node 24. Run the tests with cd notary && npm test.
- Self-hosted Flagsmith only. Notary reads raw event rows, and Flagsmith Cloud only exposes totals.
- No completed experiments. Flagsmith removes a completed experiment's rollout, so assignments can't be recomputed.
- The agent drafts; a person decides. Every fix is checked against a fresh run, but a human still reviews it.
- The approval is a recorded sign-off, not a cryptographic signature.







