Shopfloor Lab GitHub ↗

Toggle Wars · Flagsmith Experimentation

This week’s promo might be losing you money.

Rehearse Flagsmith promotions on calibrated synthetic shoppers before committing customer traffic.

  • 26,865 synthetic shoppers
  • −28.50% margin caught
  • 4 tracks 1 project
weekly_promo Store replay · 4×
Pixel-art shoppers visiting two stores, one for each promotional offer
Offline replay · separate synthetic cohortOpen replay →

Flagsmith Cloud / Experiment #956

The half-price offer cut margin.

Synthetic shoppers calibrated to dunnhumby’s Complete Journey. Flagsmith assigned the offers and reported each metric per exposed shopper.

Control

Spend $50, save $10

13,440 exposures

Challenger

Second item half price

13,425 exposures

Challenger lift Point estimate and 95% CI
  • 0% no lift
  • +3% revenue target
  • −1% margin guardrail
  • Revenue−6.66% [−10.73%, −2.58%]
  • Gross margin−28.50% [−31.55%, −25.45%]
  • Store visits+1.36% [−0.54%, +3.26%]
Don’t ship.Experiment completed with control.

How it works

Retail and growth teams can screen offers for margin risk and size a customer test before allocating traffic.

  1. Rehearse

    Define the offers and guardrails in YAML. Simulate baskets, visits, and offer uptake.

    python -m shopfloor rehearse \
      --config examples/weekly_promo.yaml
  2. Run on Flagsmith

    Attach the multivariate flag and metrics to a Flagsmith experiment. The SDK assigns shoppers and the Results API returns warehouse outcomes.

    flag_key: weekly_promo
    primary:
      event: purchase
    guardrails:
      - event: gross_margin
    secondary:
      - event: store_visit
  3. Ship or kill

    Review the guardrails before approving a rollout. Operators can also approve a pause with promo_kill_switch.

    python scripts/ship_winner.py \
      --experiment 956 \
      --run runs/rehearsal-live-956

Four tracks, four proofs

T1 / Test Something Real

−6.66% revenue lift

Keep the better grocery offer

Experiment #956 kept control. A/A #1026 served the same offer to both arms, and the final intervals all spanned zero.

T2 / AI Agents

4.29 s approve and start

Take an agent’s proposal to Smoke

The agent ranked offers, sized the leading candidate, and started Smoke #1508 after a GitHub issue approval. Synthetic revenue lift was +7.70% (inconclusive) and gross margin lift was +18.08%. The owner closed with control at 1:37 PM PST on 2026-11-27.

Hark posted the approval comment from Frank’s account at his explicit instruction. The agent process had no GitHub write access.

T4 / Agent Skills

788 tokens in SKILL.md

Bind approval to the experiment write

flagsmith-prove-it-works uses a 788-token SKILL.md. The same Smoke reads used 197 tokens with --jq and 2,025 with full JSON. A hash-bound manifest refused the tampered #1500 payload before any write.

Watch the demo

Open on YouTube ↗

Run it yourself

Offline with no keys

From the repository root in Bash, with Python 3.12 installed.

python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements-dev.txt
python -m shopfloor rehearse --backend offline --config examples/weekly_promo.yaml

Self-host Flagsmith Retail Edition

From the repository root with Docker Compose.

docker compose -f retail/docker-compose.yml up
Retail setup and experimentation ↗

Honest limits