Your experiment is flatlining.
Find out why.
An open-source debugger that diagnoses broken Flagsmith experiments, verifies repairs against real stored events, and catches regressions before they ship.
Open source · Runs locally · No credentials uploaded
6/6 vs 3/6game bugs fixed, with vs without the Doctor3/3root causes on a real self-hosted setup~54%lower agent cost on that setupClaude Sonnet 5.5, small samples, losses included. Easy cases are faster without it.
Experiment / checkout_v2
CriticalExposures
248
Conversions
000
Diagnosis
Waiting
$ npx experiment-doctor check
248 exposures, 0 conversions. Something is broken.
- AppApp: verified
- SDKSDK: verified
- FlagsmithFlagsmith: broken
- WarehouseWarehouse: not verified
- ResultsResults: not verified
Simulated demonstration of a real failure: a metric that expects purchase receiving Purchase.
How the Doctor works
Every green check is backed by evidence.
A broken experiment fails silently: SDKs skip events instead of throwing. The Doctor follows an event from your app to the results and tells you exactly where it disappears.
- 01
Diagnose, read-only
The Doctor reads your experiment, flag, metrics and warehouse through the official Flagsmith CLI, and scans your code for the SDK calls. Nothing is changed.
flagsmith api …/experiments/ --json - 02
One patch, your approval
You get the single most likely cause with the evidence behind it and the exact diff. Nothing is written until you say yes. Production needs an extra flag.
- trackEvent("Purchase") + trackEvent("purchase") - 03
Verified, or honestly pending
After the fix, the Doctor checks that exposure and conversion join for the same identity. Slow processing reads PENDING, never a fake green check.
VERIFIED · FAILED · PENDING
CI Gate
Never ship a silently broken experiment again.
Renaming purchase to Purchase passes every build, test and review, and the experiment quietly stops counting. The Doctor's GitHub Action fails the pull request that breaks it. No secrets needed.
- uses: actions/checkout@v5
with: { fetch-depth: 0 }
- uses: Mohammad-Umar7/experiment-doctor@v0.2.0See it fail a real pull request →#1 Demo: capitalize analytics event names
Check failing- ✓Build and unit testspassed
- ✕Experiment Doctor / Experiment integrityfailed in 3s
demo/checkout-app/src/checkout.js:12
Experiment regression: conversion event renamed
− flagsmith.trackEvent("purchase");+ flagsmith.trackEvent("Purchase");
The metric still listens for "purchase". Conversions will silently stop counting. Also reported as ED-004 at 97% confidence.
$ node packages/action/dist/main.js --base origin/mainSelf-hosted rescue lab
Proof per identity, not a green checkmark.
On self-hosted Flagsmith the events land in your own Postgres. The lab reads them for one identity and only says verified when that identity's exposure and the metric's exact event were both stored, in order. Aggregate counters going up is never treated as proof.
Three commands
1 $ docker compose -p doctor-lab -f selfhost/docker-compose.yml up -dself-hosted Flagsmith, Experimentation on, events in its own Postgres
2 $ node selfhost/seed.mjsflag, metric and a running experiment
3 $ node selfhost/lab.mjs brokenreal SDK traffic from the shipped bug
Before the fix
events stored for lab-broken-mwzesjta-3: 20:03:28.150Z $flag_exposure (checkout_button) = control 20:03:28.150Z Purchase FAILED conversion stored as "Purchase", the metric counts "purchase"
After the approved patch
events stored for doctor-probe-mwzet3ec: 20:03:53.170Z $flag_exposure (checkout_button) = control 20:03:53.170Z purchase PIPELINE_VERIFIED exposure and "purchase" stored for the same identity, in order
Human vs Doctor
Beat the machine.
A broken experiment, a code editor and three minutes. The Doctor fixed this one in 00:37.48. The server checks your fix, and the fastest humans go on the board.
This game is a Flagsmith experiment.
Half the players get a full report as their hint, half get one fix. Flagsmith measures which one helps more people finish in time.
Case 001 / missing conversions
UnhealthyYour time
03:00
Doctor's record
00:37.48
10 agent turns · Claude Sonnet 5.5
1 await flagsmith.identify(user.id);
2 const flag = flagsmith.getExperimentFlag("checkout_button");
3 renderCheckout(flag.value);
4 flagsmith.trackEvent("Purchase");What it checks
Twelve ways an experiment dies quietly.
Each one comes from the Flagsmith Experimentation docs and the beta's open issues. If your symptoms match a known upstream bug, the Doctor says so instead of inventing a fix.
- ED-001Configuration
Variation without a key
Give every variation a key. Exposures are attributed by label.
- ED-002Identity
Flag fetched before identify()
Call identify() before getExperimentFlag(). Anonymous exposures are skipped.
- ED-003Identity
Two different identities
Use one identifier for the flag and the event, not user.id then user.email.
- ED-004Results
Metric event name mismatch
Event names are case-sensitive. 'Purchase' is not 'purchase'.
- ED-005Transport
Events never flushed
Call flushEvents() before unload or process exit. Events buffer for 10s.
- ED-006Transport
Events sent to the wrong place
Set the SDK events URL to your own API, ending in /api/.
- ED-007Ingestion
No warehouse connected
Connect a warehouse to the environment before starting the experiment.
- ED-008Configuration
Experiment not running
Start the experiment. Drafts and completed experiments enrol nobody.
- ED-009Instrumentation
Events not enabled in the SDK
Pass enableEvents: true when you initialise the SDK.
- ED-010Instrumentation
SDK too old for experiments
Upgrade, e.g. @flagsmith/flagsmith 12.4.0 or @flagsmith/nodejs 9.1.0.
- ED-011Instrumentation
Flag read without an exposure
Use getExperimentFlag(), or trackExposureEvent() at the point of display.
- ED-012Results
Still collecting data
Each variation needs 50 identities and 5 conversions. Results refresh every 5 minutes.
Run it on your experiment
Three ways in. Same diagnosis.
Uses your own flagsmith login. No keys are uploaded, nothing is sent anywhere unless you run the canary probe and say yes.
CLI
Run it in the repo that has the broken experiment. Read-only until you approve a fix.
$ npx -y --package=https://experimentdoctor.vercel.app/doctor.tgz experiment-doctor checkAgent Skill
Give Claude Code or any coding agent the whole diagnose, approve, fix, verify workflow.
$ cp -r skills/flagsmith-experiment-doctor ~/.claude/skills/CI Gate
Fail the check on pull requests that would silently stop an experiment from counting.
$ uses: Mohammad-Umar7/experiment-doctor@v0.2.0Source, setup and the benchmark are on GitHub.