Teams check daily and ship the first green. In an A/A simulation, a fixed 0.95 bar checked every few minutes ships a false winner about 14% of the time.
ExPilot requires 0.995 before the maximum sample. False ships drop to about 5%.
Experiment decisions for Flagsmith
Starting an A/B test is easy; deciding it honestly is where teams slip. ExPilot locks the Experiment Plan by sha256, runs the statistics in code, and stops at two typed Approval Gates: one to launch, one to close.
Runs offline in ~20s against a bundled mock Flagsmith (simulated traffic). Node 22+.
Collecting traffic. No decision before the minimum sample.
● Gate 2 · awaiting a human · type complete_secure_checkout
Most “AI + feature flags” demos stop at describe a flag, get a flag. The trouble starts after creation. Four failure modes, four fixes.
Teams check daily and ship the first green. In an A/A simulation, a fixed 0.95 bar checked every few minutes ships a false winner about 14% of the time.
ExPilot requires 0.995 before the maximum sample. False ships drop to about 5%.
Nobody checks that traffic really split 50/50. A sample ratio mismatch silently invalidates everything downstream.
ExPilot runs a chi-square test on exposed identities at every readout. Below p = 0.001 the result is INVALID and shipping is blocked.
Refunds get a look, not a rule. A “winner” that quietly raises refunds still ships.
ExPilot forces ROLL_BACK once P(harm beyond tolerance) ≥ 0.95, even before the minimum sample.
The losing branch stays in the code forever, one more dead branch nobody dares delete.
ExPilot writes a cleanup patch, proves it applies and typechecks, and hands it over without applying it.
Six commands from Experiment Plan to Audit Record. At each Approval Gate, ExPilot stops until a human types the exact confirmation into a real terminal or the approval console. Output is verbatim from expilot demo, trimmed for width.
Deterministic code runs these rules in order; first match wins. Each arm gets an independent Beta-Binomial posterior from Flagsmith’s raw counts. Code, never the model, sets the sample size with a two-proportion z calculation (α 0.05, power 0.8, 20% baseline, 25% minimum detectable effect): 1094 identities per arm, capped at 2188.
scripts/peek-calibration.tsWhat Flagsmith computes, and what ExPilot recomputes. Read from the Flagsmith 2.295.2 source and confirmed against a live self-hosted instance.
| Flagsmith | ExPilot | |
|---|---|---|
| Model | Normal approximation, each variant vs control | Independent Beta-Binomial posteriors from raw counts |
| Win probability | chance_to_win, pairwise vs control | P(beats control) per variant, plus P(best of all arms) |
| Expected loss | not provided | computed |
| SRM | srm_p_value, null on the API rollout path | chi-square on exposed identities, every readout |
| Guardrails | no concept | tolerance and P(harm) per guardrail, enforced |
| Floors | hidden below 50 identities per arm | mirrors the same floors, so harm cannot hide |
The model only gets read and propose tools. Only a human can mint an Approval, and it is verified at runtime on every mutating Flagsmith Admin API call. Against live Flagsmith there is no bypass flag; a non-TTY stdin exits with code 2.
Greps for real trackEvent names, drafts the Experiment Plan, narrates the memo.
create start complete update
A CLI prompt on a real TTY, or the console with session cookie, CSRF token and typed text.
› checkout_cta_copy
Signature, single-use nonce, action, target, plan sha256, TTL. Only then the Flagsmith Admin API.
→ Flagsmith Admin API
Self-hosted and free-plan Flagsmith return zero audit rows, so ExPilot keeps its own Audit Record: every Experiment Plan lock, approval, amendment and API call (keys redacted) is appended to audit.jsonl as a sha256 hash chain, with an HMAC-keyed head anchor so truncation is detected.
audit chain OK: 55 events, each hashed to the previous
Approval Gate 2 is not a rubber stamp. Type the winning Variant key from the close dossier below to roll it out, or type control first and watch ExPilot refuse it without a logged --override reason.
cleanup.patch · CheckoutButton.tsx git apply --check: ok typecheck: ok
export function CheckoutButton({ total, onPay }) { - // Experiment: which call-to-action copy converts better? - const flag = useExperiment("checkout_cta_copy"); - const variant = flag?.variant ?? "control"; - const isSecure = variant === "complete_secure_checkout"; const [busy, setBusy] = useState(false); … - <button className={isSecure ? "cta cta--benefit" : "cta"} …> - {isSecure ? "Complete secure checkout" : "Buy now"} + <button className="cta cta--benefit" …> + Complete secure checkout
ExPilot does not apply this. It prints the git and gh commands, and a human opens the pull request.
Audit tail
Reproduces offline against a bundled mock Flagsmith matching the source-verified API contract (41 endpoints), with the real @flagsmith/nodejs SDK sending simulated traffic. Only expilot demo auto-answers both Approval Gates, and it prints each as [demo] human typed: ….
[demo] human typed: checkout_cta_copy DECISION: SHIP complete_secure_checkout rule PRIMARY_WIN [demo] human typed: complete_secure_checkout Closed: rolled out complete_secure_checkout (decision SHIP). audit chain OK: 55 events, each hashed to the previous
The live path ran end to end (plan, preflight, launch, simulate, readout, close, audit verify) against a self-hosted Flagsmith 2.295.2 brought up from infra/. Flagsmith Cloud has not been tried.
docker compose -f infra/docker-compose.yml up -d
npx tsx infra/bootstrap.ts
infra/ex.sh plan "<hypothesis>" --repo demo/checkout-app
infra/ex.sh launch checkout_cta_copy # Gate 1 needs a real terminal
That is the point.
ExPilot finishes what Flagsmith Experimentation starts. It calls the start/, results/refresh/ and complete/ endpoints that agents otherwise cannot reach, enforces the statistics teams skip, and keeps a human’s fingers on the only two keys that change production.