Exposure is a claim. Exposcope checks it.
- Live demo: exposcope.vercel.app
- Demo video (3 min): youtu.be/4ZX8p3DSI10
- Detailed demo video (6 min): youtu.be/WhsfsVSQDP4
- npm: npmjs.com/package/exposcope (
npx -y exposcope --help)
Start here
- Problem: Flagsmith counts a visitor as exposed when the SDK sends
$flag_exposure, not when the visitor sees the change. Exposures fired too early dilute both arms equally, so the sample-ratio check still passes while the lift shrinks.- What Exposcope does: crawls your app in a real browser as real Flagsmith identities and compares every exposure with what was on screen. It scores the experiment out of 100, names each problem (
XS-01–XS-14) with its file and line, and can fix it behind a human "yes".- Proof: 10/10 planted bugs caught with 0 false positives; Flagsmith Cloud counts matched exactly; Flagsmith's own PayPal tutorial scores 60/100. See Measured, not claimed.
- Try it: the live console, or run it in 2 minutes on your own app.
If you have 60 seconds:
- Open exposcope.vercel.app (overview)
- Open
/audits/buglab-b1(fullXS-01audit report) - Explore
/lab, then/live→ Replay last run - Or replay locally in one command:
pnpm demo:replay(http://127.0.0.1:4791)
Flagsmith's experiment results count everyone who sent a $flag_exposure event. Most tools check the events Flagsmith received. Exposcope checks them against what a real browser actually showed. It crawls your app as real Flagsmith identities, finds every place where "exposed" and "seen" disagree (XS-01–XS-14), estimates how much that distorts your result, and opens a fix PR after a human approves.
At a glance
| The result | The work behind it | How you can check it |
|---|---|---|
| 10/10 planted exposure bugs caught, 0 false positives on the clean build | A bug-lab of 11 cases (10 bugs + clean) on real self-hosted Flagsmith 2.295.2, each crawled as real Flagsmith identities across 6 visitor profiles | bug-lab/RESULTS.md, or pnpm bug-lab on your machine |
75% of "exposed" B1 sessions never saw the banner (XS-01, 55/100) |
14 detectors (XS-01–XS-14), each tied to the file and line responsible |
The B1 audit on the live console |
Flagsmith Cloud /exposures/ matched the plan exactly: 190 per arm |
Crawled on api.flagsmith.com, cross-checked with Flagsmith's own /exposures/ and /results/ |
The unedited Flagsmith response |
Flagsmith's own PayPal tutorial scores 60/100 (XS-07) |
Rebuilt as written; the SDK's 10 s flush loses visitors who leave early | docs/validation.md and flagsmith-js-client#445 |
| The same verdicts on Chromium, Firefox and WebKit, and on React, Next.js and Node SSR | exposcope run --browser chromium/firefox/webkit, and record-server for SSR |
Cross-browser, Next.js, SSR |
| The verdict is written back into Flagsmith: Feature Health and a note on the experiment | Every write goes through approve(), Development only, with its undo command |
Feature Health, exposure quality |
One line to try it: npx -y exposcope, npx -y exposcope mcp, or the Docker image |
npm exposcope, ghcr.io/devprashant19/exposcope:1.0.0 and a GitHub Action |
Run it in 2 minutes |
Entered in Track 02, Track 03 and Track 04.
| Track or criterion | Start here |
|---|---|
| Track 02, AI Agents and Feature Flags | Human approval gate: the fix agent rewrites the code, re-crawls, and blocks its own bad fix when it would break the split; every Flagsmith write needs a typed "yes" and prints its undo. Six write commands run live: docs/evidence/cli-writes/ |
| Track 03, Build on Open Source Flagsmith | Full stack in one command: self-hosted Flagsmith 2.295.2, the Brewbox bug-lab and a real audit. Exposcope reads Flagsmith's own Postgres events table as a cross-check. Reuse guide: docs/use-on-your-app.md |
| Track 04, Flagsmith Agent Skills | Track 04: flagsmith-verified-experiment gates the experiment on exposure integrity before anyone reads the lift; transcript and token counts in EVIDENCE.md |
| Use of Flagsmith | How we use Flagsmith: every Flagsmith surface used, where in the code, and the evidence |
| Impact | Why this matters, Measured, not claimed, What we found in Flagsmith |
| Creativity | What makes this different |
| Demo video | 3 minutes · in depth, 6 minutes |
Contents
- See it: Demo · Screens
- Why it matters: The problem · What makes it different · Measured · By the numbers · Not verified
- Use it: Quick Start · Agent Skill · How we use Flagsmith
- Under the hood: Architecture · Bug-lab · Safety · Docs · Limitations · What we found in Flagsmith
Run the console locally over bundled real runs. No Flagsmith or Docker needed:
pnpm install
pnpm demo:replay # builds once, then serves the consoleThen open http://127.0.0.1:4791:
| Page | What you'll see |
|---|---|
/audits/buglab-b1 |
The case file for planted bug B1: score 55, finding XS-01, sessions and screenshots |
/lab |
Ten planted bugs and a clean build, expected against detected |
/live |
Press Replay last run to watch each session land, claim against screen |
With the self-hosted Flagsmith running (see Quick Start), pnpm demo audits planted bug B1 live and streams every session to /live.
The hosted console replays recorded runs. To run a real audit yourself, pick one:
One-command via npm/npx (no clone needed, runs on Node >= 20):
# Run help
npx -y exposcope --help
# Audit any reachable app
export FLAGSMITH_ENVIRONMENT_KEY=<client-side key of the environment running your experiment>
npx -y exposcope run --url https://your-app.example.com -f <feature> --no-llm --ciAdd --selector '<css>' if the variant's element has no data-flag="<feature>" marker. Self-hosted Flagsmith: add --api-url http://<host>/api/v1/.
Run as an MCP server:
Add to your Claude Code, Cursor, or Cline configuration:
{
"mcpServers": {
"exposcope": {
"command": "npx",
"args": ["-y", "exposcope", "mcp"]
}
}
}On any app you can reach, with Docker only (the published image is read-only: it never writes to Flagsmith or git):
export FLAGSMITH_ENVIRONMENT_KEY=<client-side key of the environment running your experiment>
docker run --rm --init --shm-size=1gb -e FLAGSMITH_ENVIRONMENT_KEY \
ghcr.io/devprashant19/exposcope:1.0.0 run --url https://your-app.example.com -f <feature> --no-llm --ciAdd --selector '<css>' if the variant's element has no data-flag="<feature>" marker. Self-hosted Flagsmith: add --api-url http://<host>/api/v1/.
In the browser, with nothing installed: . The codespace installs and builds everything; then run
pnpm demo:replay and open the forwarded port 4791.
A banner below the fold that records its exposure at page load counts every visitor as exposed, including the ones who never scrolled to it. Both arms are diluted equally, so:
- the sample ratio check passes (equal dilution keeps the split 50/50),
- the aggregate counts look healthy,
- and the measured lift shrinks toward zero.
Measured, not illustrated: on planted bug B1, 75% of exposed sessions never saw the banner (XS-01, skill evidence). If people who never saw it behave like control (the assumption behind Exposcope's corrected lift, Δ / (1 − d)), any real effect among viewers shows up at about a quarter of its size. The hero's "+7.4% shows as +3.1%" is an illustration of this, not a measurement.
| Check | Catches equal dilution? | Catches lost-on-exit? | Says where in the code? |
|---|---|---|---|
| Flagsmith's SRM check | No: the split is still even | No | No |
| Auditing the event stream / aggregates | No: the counts are internally consistent | Only indirectly | No |
| Static lint of SDK calls | Sometimes: it can't know what's below the fold | Partly | Yes |
| Exposcope (browser vs events, per session) | Yes (XS-01) |
Yes (XS-07) |
Yes: file and line, plus a codemod |
- It checks the claim, not the counts. Other checks (Flagsmith's SRM test, event-stream audits) read the events Flagsmith received. Exposcope compares each
$flag_exposurewith what a real browser showed in that session, so it catches dilution that leaves the counts internally consistent. - Flagsmith picks the visitors. The crawl uses real Flagsmith identities planned with
flagsmith evaluate, so each session lands in the arm Flagsmith itself assigns, and the result is cross-checked against Flagsmith's own/exposures/,/results/and Postgres events table. - It names the line, then proves the fix. Each finding points at the file and line responsible. The fix agent applies a codemod and re-crawls, and a fix that would expose one arm but not the other is blocked even when its score improves.
- The verdict lives in Flagsmith.
--report-healthmarks the feature unhealthy in Feature Health and--annotate-qualitywrites "x% of exposures never on screen" onto the experiment, behindapprove()with a printed undo. - It prevents the bug as well as detecting it.
useExposureOnViewrecords the exposure only once the variant is on screen, and the Playwright matchers fail a test when exposure and visibility disagree. - Every number has a receipt. Each figure in this README links to the run, transcript or Flagsmith response that produced it, including first runs that were wrong.
| What | Result | Evidence |
|---|---|---|
| Planted-bug lab (10 bugs + clean build, real Flagsmith 2.295.2) | 10/10 recall, 100% precision, 0 false positives on clean | bug-lab/RESULTS.md |
Flagsmith Cloud (api.flagsmith.com) |
B1 → XS-01 (60/100); clean → 100/100; Flagsmith's /exposures/ matched the planned identities exactly (190 per arm: 40 crawled + 150 seeded). Crawl only, no seeding: all 40 crawled identities per arm were counted |
docs/evidence/cloud/ |
| Flagsmith's own PayPal tutorial, rebuilt verbatim | 60/100: placement is sound, but with SDK defaults anyone who leaves within 10 s is never counted (XS-07) |
docs/validation.md |
Server-rendered (SSR) Node app via record-server |
Clean SSR → 100/100; dropped fragment → 50/100 (XS-13, 100%) across 16 sessions |
docs/evidence/ssr/ |
Third-party app: AJ1904/poemdle-app (MIT, flagsmith@3.23.2) |
40/100 (XS-02, 100% of visible full sessions): <footer> below the fold, SDK predates Experimentation, and the app never calls identify() (mystery-pokemon skipped: requires missing external backend) |
docs/evidence/third-party/poemdle-app/ |
| Fix agent safety | A correct fix passed (control 33.3% vs treatment 33.3%); a naive fix that still scored 70 was blocked (0% vs 33.3%, SRM risk) | docs/findings.md |
| Time saved | 48 browser sessions in 43.9 s end to end, against about 106 s for the same 48 checks run one at a time at machine speed (2,212 ms each), before any human DevTools work | docs/benchmark.md |
Every number above was produced by a run you can reproduce. Where a first run was wrong, the docs keep it and say why (for example the Cloud clean run's first 96/100, and the superseded PayPal reproduction).
The Flagsmith Cloud account is private, so everything from that run is in the repo:
- Read Flagsmith's own answer.
results-2026-11-26T17-07-34-169Z.jsonis the unedited/exposures/and/results/response for experiment 694:banner: 190, control: 190(per arm: 40 crawled + 150 seeded). - See the pages. Screenshots of the real experiment, results and exposures pages, every call the run made in
calls.log, and the full write-up in docs/evidence/cloud/. - Reproduce it on your own free Flagsmith Cloud account. Run
setup-cloud.shto create the same feature, metric and experiment, thenexposcope runagainst it: steps in Quick Start → Flagsmith Cloud. Planted bug B1 should come back asXS-01, and the clean build (lab=none) at 100/100.
- Real users. Every audit here used synthetic identities (
xs-<runId>-<n>) on our own demo apps, plusSEEDEDvisitors on Cloud. No production app with real traffic has been audited, so how often each bug occurs in the wild is not measured. - Other browsers.
exposcope run --browser chromium|firefox|webkitsupports all three Playwright engines.B1(XS-01,55/100) and clean (100/100, 0 false positives) are verified on Firefox and WebKit (bug-lab/RESULTS.md);B2–B10are measured on Chromium only. - Other frameworks. The bug-lab and the PayPal reproduction are React single-page apps; SSR is measured on our minimal Node HTTP example (
docs/evidence/ssr/) and Next.js App Router is measured onapps/next-example(B140/100XS-01, clean100/100,docs/evidence/nextjs/). Remix and Django are not in the measured results. - The corrected lift.
Δ / (1 − d)includes a seeded 95% bootstrap confidence interval (correctedCiLow..correctedCiHigh, flagging when it crosses zero), but it still relies on the stated assumption that unexposed-but-counted users behave like control. - Live streaming on the hosted demo. exposcope.vercel.app is a static build: it replays recorded runs, and streaming needs
exposcope run --watchon your machine.
| What | Count |
|---|---|
| Detectors | 14 (XS-01–XS-14) |
| Visitor profiles per identity | 6: no scroll, half, full, 3-second bounce, mobile, repeat visit |
| Bug-lab | 11 cases (10 planted bugs + clean), 10/10 recall, 0 false positives on clean |
| One default audit | 48 browser sessions in 43.9 s (benchmark) |
| Flagsmith Cloud | 190 exposures per arm, matched exactly (40 crawled + 150 seeded) |
| Browsers / app kinds measured | 3 (Chromium, Firefox, WebKit) / 3 (React SPA, Next.js App Router, Node SSR), plus one third-party app |
| Flagsmith write commands run live | 6, each behind approve(), plus one Flagsmith Cloud write verified by read-back |
| Unit tests | 195, on Node 20 and 22 in CI, with a format check, a static-site check and a gitleaks scan |
| Packages | 10 workspace packages, published as npm exposcope and ghcr.io/devprashant19/exposcope |
| Real runs bundled with the live console | 15 |
| Issues reported to Flagsmith | 3 filed, and 1 existing issue extended with our reproduction (below) |
| Skill token cost | 6,800 tokens for the read-only demo run (EVIDENCE.md) |
skills/flagsmith-verified-experiment is an Agent Skill that takes a coding agent through a Flagsmith experiment end to end with the Flagsmith CLI v2:
- Inventory the flag and its call sites (
flagsmith ... --jq+git grep). - Set the experiment up outside Production.
- Gate on Exposcope's Exposure Integrity Score before anyone reads the lift.
- Read a compact verdict.
- Complete the experiment with the winner, open a dead-code PR with
ghand archive the flag.
Every production-affecting step stops and asks first, and each one has a rollback.
Measured with a real isolated no-MCP Claude Code (claude-opus-5-5) session in EVIDENCE.md: 6,800 context tokens above baseline (32,236 peak − 25,436 baseline; ~413 chars ÷ 4 vs ~7.5k unfiltered) for the read-only run (shipped 100/100 vs B1 55/100 XS-01), and 23,965 above baseline (49,786 peak − 25,821 baseline) for the full Development end-to-end run through merged cleanup PR #1 and flag archive.
flowchart LR
Config["exposcope.yml + Flagsmith API/CLI"] --> Plan["1. Plan: enrolled identities per variant"]
Plan --> Crawl["2. Crawl: Playwright profiles + visibility script + SDK call tracer + X-ray"]
Crawl --> Capture["Intercept POST /v1/events + /identities/ + CDP frames"]
Capture --> Diagnose["3. Diagnose: XS-01..XS-14 + Delta/(1-d) + SRM + Score (0-100)"]
Warehouse["Postgres warehouse, or Cloud /exposures/ API"] --> Diagnose
Diagnose --> Reports["4. Console + offline HTML + Terminal + SARIF + Markdown + JSON"]
Diagnose --> Agent["5. Fix agent: CM-1..CM-8 -> re-crawl -> per-arm parity check"]
Agent --> Gate{"approve() gate (default No, refused in CI)"}
Gate -->|Approved locally| PR["Branch + draft PR"]
Diagnose --> LC["6. Lifecycle: Gated Start / Safe Restart / Seen metric"]
LC --> Gate
Using Exposcope on your own app? See docs/use-on-your-app.md:
exposcope init, run against any URL, read the score, add the GitHub Action.
Pick the lightest path that answers your question:
| Path | Needs | Download | What you get |
|---|---|---|---|
| Hosted console | A browser | None | Every page over recorded real runs |
pnpm demo:replay |
Node 22, pnpm 10 | npm packages only | The same console locally |
| Published image | Docker | One image | A real, read-only audit of any URL you point it at |
| Codespaces | A GitHub account | None locally | The full repo, built, in the browser |
| Full stack (below) | Docker | About 4 GB | Self-hosted Flagsmith + demo store + a live audit |
Needs only Docker (no Node, pnpm or browser download on the host). This is the heaviest path:
docker compose -f infra/docker-compose.demo.yml up --buildIt boots self-hosted Flagsmith 2.295.2 (same services as infra/docker-compose.yml), runs a one-shot setup that bootstraps the org, project, environments, keys and the two experiments (idempotent; keys live in a Docker volume, never in the repo), serves Brewbox, then runs one real audit of planted bug B1 (XS-01) and keeps the console up.
| What | URL |
|---|---|
Console (/live streams the audit, then /audits) |
http://localhost:4791 |
Brewbox demo store (/?lab=B1 shows the bug) |
http://localhost:5183 |
Flagsmith (admin@exposcope.local / ExposcopeDevPassword!2026, local dev-only default) |
http://localhost:8000 |
Ports taken? FLAGSMITH_PORT=8100 BREWBOX_PORT=5193 EXPOSCOPE_UI_PORT=4891 docker compose -f infra/docker-compose.demo.yml up --build. Reset with docker compose -f infra/docker-compose.demo.yml down -v. First run pulls about 4 GB of images (the official Playwright image brings Chromium); the audit itself takes about 80 s.
exposcope.vercel.app is the console built as a static site from the committed runs in examples/runs: every page works, and Live replays recorded runs (streaming a crawl needs exposcope run --watch on your machine). How it is built and deployed: docs/deployment.md.
Needs Node 22, pnpm 10 and Docker (for the self-hosted Flagsmith).
pnpm install
pnpm exec playwright install chromium # the browser Exposcope crawls with (not needed for demo:replay)
pnpm build # CLI + packages + console; then use `pnpm exposcope <command>`docker compose -f infra/docker-compose.yml up -d
./infra/bootstrap.sh # PowerShell: infra/bootstrap.ps1
./apps/brewbox/scripts/setup-experiments.shPorts already taken? BREWBOX_PORT=5183 pnpm bug-lab (also BREWBOX_CLOUD_PORT, PAYPAL_PORT).
# All experiments, with X-ray overlays and a live stream (--no-llm works fully offline)
pnpm exposcope run --all --xray --watch --no-llm
pnpm exposcope ui # the console at http://127.0.0.1:4791docker run --rm --init --shm-size=1gb -e FLAGSMITH_ENVIRONMENT_KEY \
ghcr.io/devprashant19/exposcope:1.0.0 run --url https://preview.example.com -f <feature> --no-llm --ciTo build it yourself instead: docker build -t ghcr.io/devprashant19/exposcope:local .
Built and run locally against Brewbox (100/100). .github/workflows/docker-publish.yml published ghcr.io/devprashant19/exposcope:1.0.0 (also tagged 1.0 and latest) from the v1.0.0 tag. Details: docs/deployment.md.
# Deterministic codemods, verified by re-crawl and a per-arm exposure parity check
pnpm exposcope fix free_shipping_banner --run <runId> --with-seen
# Preview Safe Restart (dry run by default; executing needs two typed approvals)
pnpm exposcope restart free_shipping_banner --after-score 100
# Gate a new experiment before starting it in Flagsmith
pnpm exposcope start <feature>
# Install the informational Seen: <feature> metric in Flagsmith
pnpm exposcope metrics install <feature># 1. Fill infra/flagsmith.cloud.env (gitignored): Development client-side key + personal API token
# 2. Create the experiment on Cloud (idempotent, refuses Production, logs calls to docs/evidence/cloud/calls.log)
./apps/brewbox/scripts/setup-cloud.sh # PowerShell: apps/brewbox/scripts/setup-cloud.ps1
# 3. Serve Brewbox against Cloud on :5175 and audit it (no Postgres: the cross-check uses the API)
pnpm --filter brewbox exec vite --mode cloud --port 5175 --strictPort &
EXPOSCOPE_ENV_FILE=infra/flagsmith.cloud.env pnpm exposcope run -c exposcope.cloud.yml --query-extra lab=B1 --xray --no-llm
# 4. Cloud computes results asynchronously: read /exposures/ + /results/ later
node scripts/check-cloud-results.mjs --refreshEndpoints, auth and differences: docs/flagsmith.md.
| Exposcope Stage | Flagsmith Integration Used | Purpose |
|---|---|---|
| Identity planning | flagsmith evaluate <feature> --identity xs-<runId>-<n> -e <key> --json (CLI v2) for the variant; SDK flags endpoint metadata.experiment.in_experiment for enrolment |
Plan balanced, enrolled synthetic identities per variant (partial rollouts included) |
| Browser capture | @flagsmith/flagsmith 12.6.0 (POST /api/v1/events, /api/v1/identities/, flushEvents(), eventProcessor.flushInterval) |
Capture natural vs exit-flush batches, loadingState.source per SDK call, the real flush interval |
| Cross-check & stats | GET .../experiments/{id}/, /results/, /exposures/, experiment-metrics/ |
Compare crawl vs Flagsmith counts, pull lift/CI, check case-sensitive metric names |
| Warehouse check | PostgreSQL experimentation_sdkexperimentationevent (self-hosted) or /exposures/ (Cloud) |
Row-level verification; API-only fallback on Cloud |
Exposcope Seen (U1) |
POST .../experiment-metrics/ + trackEvent("seen_<feature>") via @exposcope/seen |
Track real viewport visibility as an informational Seen: <feature> metric attached to the experiment. Flagsmith's /results/ API returns it and Exposcope reads it into the report's Seen comparison (evidence) |
| Lifecycle safety | complete, mv-options/, experiments/, start/, pause/ behind approve() |
Freeze a diluted v1 as control, key unkeyed variations, launch v2 with a readout date |
| Feature Health | run --report-health: Webhook provider under projects/{id}/feature-health/providers/, then the signed /api/v1/feature-health/... webhook. Development only, behind approve() |
Mark each feature unhealthy below the score threshold, healthy otherwise (evidence) |
| Exposure Quality | run --annotate-quality: PATCH .../experiments/{id}/ hypothesis annotation behind approve(). Development only |
Writes the measured share of $flag_exposure events never on screen directly into the Flagsmith experiment hypothesis (evidence) |
| Results Watcher | exposcope watch-results -f <feature>: polls /results/ (read-only), hashes inference output, re-evaluates Exposure Integrity Gate |
Reactive results gate: outputs ship/wait/stop verdicts on update and dispatches to --notify <url> while Flagsmith lacks native webhooks (evidence) |
From docs/evidence/phase-02/cli-calls-sample.log and docs/evidence/phase-06/lifecycle-cli-calls.log (X-Environment-Key scrubbed automatically):
{"t":"2026-11-26T08:23:56.070Z","cmd":"flagsmith evaluate free_shipping_banner --identity xs-benchmark-auto-2 -e [REDACTED] --json","ok":true,"durationMs":209}
{"t":"2026-11-26T08:37:50.154Z","cmd":"flagsmith api api/v1/environments/[REDACTED]/experiments/6/complete/ -X POST --input -","ok":true,"durationMs":576}
{"t":"2026-11-26T08:37:50.824Z","cmd":"flagsmith api api/v1/environments/[REDACTED]/experiments/ -X POST --input -","ok":true,"durationMs":591}
{"t":"2026-11-26T08:37:51.521Z","cmd":"flagsmith api api/v1/environments/[REDACTED]/experiments/7/start/ -X POST --input -","ok":true,"durationMs":695}On self-hosted Flagsmith 2.295.2 (Development environment only), exposcope metrics install free_shipping_banner attached metric #5 (Seen: free_shipping_banner, informational) to experiment #2. The Development Metrics page shows it as "Used in: 1 experiment": docs/evidence/phase-08/flagsmith-metrics-seen.png.
The /results/ API returns it as metric_id: 5 (banner 65 / 1961, control 63 / 1948): docs/evidence/phase-08/e1-results-snapshot.json.
Flagsmith 2.295.2's experiment results UI renders only metrics[0] (the primary metric, with the selector disabled), so the Seen metric does not appear on that screen: docs/evidence/phase-08/flagsmith-seen-results.png.
All 10 planted exposure bugs (B1–B10) plus a clean build (?lab=none), across 6 behaviour profiles (no-scroll, half, full, bounce-3s, mobile, repeat-visit), against real Flagsmith 2.295.2 (bug-lab/RESULTS.md):
- Recall (
B1–B10): 10 / 10 (100%) - Precision (all cases): 10 / 10 (100%): every planted bug produced exactly its own finding and nothing else.
- Clean build false positives: 0 (
free_shipping_banner100/100,checkout_cta_copy100/100)
| Case | Planted Defect | Expected | Detected | Score | Status |
|---|---|---|---|---|---|
B1 |
Eager exposure for a banner 1,400 px down, below the fold | XS-01 |
XS-01 |
55 | PASS |
B2 |
Plain getValue() on the mobile layout |
XS-02 |
XS-02 |
70 | PASS |
B3 |
getExperimentFlag on mount, before server flags (silently skipped) |
XS-03 |
XS-03 |
60 | PASS |
B4 |
250 ms control flicker before settling on the server variant | XS-04 |
XS-04 |
85 | PASS |
B5 |
Email identity passed to the conversion event | XS-05 |
XS-05 |
40 | PASS |
B6 |
Empty/unkeyed variation value |
XS-06 |
XS-06 |
20 | PASS |
B7 |
No exit flush (SDK default 10 s buffer) | XS-07 |
XS-07 |
60 | PASS |
B8 |
Event name case mismatch (Checkout_Completed) |
XS-12 |
XS-12 |
20 | PASS |
B9 |
Conversion tracked before the exposure | XS-09 |
XS-09 |
70 | PASS |
B10 |
Mid-session exposure flip (quarantined identity) | XS-11 |
XS-11 |
60 | PASS |
none |
Clean useExposureOnView + exit flush |
(none) | (none) | 100 / 100 | PASS |
How precision got to 100%, honestly. An earlier run measured 10/14. Each extra finding was audited:
- B3's extra XS-07 was a real false positive: "lost on exit" was counted when no exposure had ever been queued. Fixed with a generation guard.
- B3's extra XS-02 came from imprecise lab code, now modelling the real pattern (evaluate once on mount, before server flags).
- B4 and B9's extra XS-03 came from a loose rule that flagged late-but-recorded exposures, which are not a bias.
What makes this exact rather than heuristic is the SDK call tracer. It records every getExperimentFlag / trackExposureEvent / getValue / hasFeature call with the SDK's loadingState.source, plus the SDK's real flush interval. So "asked too early" (XS-03), "never asked" (XS-02) and "asked but lost on exit" (XS-07) are told apart from evidence (how it works). Regression tests: packages/core/test/detect-trace.test.ts.
- Read/write separation:
plan,crawl,diagnose,run,@exposcope/mcpand the GitHub Action (--ci) never write to Flagsmith or git remotes. Two opt-in flags do send data elsewhere, outsideapprove():run --notify <url>POSTs the redacted summary to that webhook, andrecord-server --forward <url>relays the SDK event batches it records to the Flagsmith events URL you give it. - Explicit confirmation: every
git push,gh pr createand Flagsmith mutation goes throughapprove()(packages/agent/src/approve.ts): full payload preview, default No, typed confirmation, a SHA-256 preview hash in.exposcope/audit.log, and hard refusal in CI. - SRM-safe fixes: after patching, the fix agent re-crawls and compares each arm's exposure rate. If the fix would make arms differ by more than 10 points, it refuses to open the PR.
- Offline first: every detector, codemod, report and lifecycle workflow runs with
--no-llm. Optional Claude helpers are checked for numeric fidelity. - Privacy & secrets: synthetic identities only (
xs-<runId>-<n>); email-like IDs are refused. Keys are masked across JSON, SARIF, HTML, logs and MCP output. CI runsgitleaksover the full history. - Honest statistics: the corrected lift
Δ / (1 − d)is labelled an estimate, not a significance-tested effect. Seeded demo data is taggedSEEDED/ "demo data".
| Package | What it does |
|---|---|
exposcope (packages/cli) |
The CLI: run, fix, restart, trend, drift, record-server (SSR batches), the ui console, the --watch live stream and the mcp server. Subpath exports ./seen, ./react and ./test |
apps/console |
The interactive console: hero demo, audits, live, bug-lab and "how it breaks" |
@exposcope/core |
Crawl, capture, detect and estimate, plus the Flagsmith client |
@exposcope/report |
Reports as terminal, HTML, Markdown, JSON and SARIF |
@exposcope/agent |
The fix agent: codemods, the approval gate and fix PRs |
@exposcope/lifecycle |
Experiment lifecycle actions, including Safe Restart |
@exposcope/seen |
Records an exposure when the change is actually on screen |
@exposcope/react |
The <Exposure> component and useExposureOnView hook for React |
@exposcope/test |
Playwright helpers and matchers for checking exposures in your own tests |
@exposcope/mcp |
The read-only MCP server |
@exposcope/action |
The GitHub Action: PR score, SARIF upload, failing check |
All docs, grouped by reader: docs/README.md
| Start here | Using it | Background |
|---|---|---|
| Testing: how to check every claim | CLI | Architecture |
| How It Works | Flagsmith Integration | Validation |
| Findings Catalogue | Deployment | Decisions Log |
| FAQ | Environment | Contributing |
| Troubleshooting | Ownership |
- Flagsmith
2.295.2/results/returnssrm_p_value: nullwhen expected shares fall back to environment defaults; Exposcope computes its own chi-squared SRM preview alongside. - Flagsmith refreshes
/exposures/and/results/at most every ~5 minutes; Cloud computes them asynchronously. - With an empty control slot, the fix agent's parity check measures anchor
boundingBoxdimensions during re-crawl and fails if one arm collapses to0pxwidth or height while another renders non-zero size; the PR still lists aminHeightcheck for visual layout parity. - Third-party auth walls or CAPTCHAs need a configured storage, cookie or query identity adapter.
Building and running Exposcope against real Flagsmith turned up behaviour worth knowing before you plan an experiment. Each point has a reproduction in this repo.
- An exposure means "evaluated", not "seen". Anything below the fold that records its exposure at load dilutes both arms equally, and Flagsmith's SRM check cannot see it. Reference fix:
useExposureOnView(packages/react). - Early leavers are never counted. The JS SDK flushes events every 10 s and not on
pagehide, so 3-second visits are lost. Flagsmith's own PayPal tutorial scores 60/100 because of it (docs/validation.md). getValue()records no exposure;getExperimentFlag()does. Easy to miss: it produced zero exposures in our first Next.js example (docs/evidence/nextjs/).srm_p_valuecan benull. On 2.295.2 it is null when the expected shares fall back to the environment defaults, so the SRM check disappears.warehouse-connectionsreturns a plain array while most list endpoints are paginated, which broke a generic--jqfilter (EVIDENCE.md).- There is no results webhook yet.
exposcope watch-resultsprototypes what one would enable, with the payload we would want (docs/evidence/results-watch/).
What we found while building Exposcope, reported to Flagsmith with reproductions:
- Flagsmith/flagsmith-js-client#445: exposure events are lost when a visitor leaves before the 10 s flush (we added the PayPal-tutorial result, 60/100).
- Flagsmith/flagsmith-js-client#449: docs,
getExperimentFlag()records an exposure butgetValue()does not. - Flagsmith/flagsmith-js-client#450: feature request, record the exposure when the variant is actually on screen (reference:
useExposureOnView). - Flagsmith/flagsmith#9128:
srm_p_valueis null with default variant weights (the same behaviour we saw on 2.295.2; already reported). - Flagsmith/flagsmith#9179:
warehouse-connectionsreturns a plain array while most list endpoints are paginated.
- Built for Toggle Wars: The Flagsmith Experimentation Hackathon (WeMakeDevs × Flagsmith): Track 02 (AI agents and feature flags), Track 03 (built on open-source, self-hosted Flagsmith) and Track 04 (Flagsmith Agent Skill).
- Live demo: https://exposcope.vercel.app (static build of the bundled example runs).
- Uses Flagsmith (
BSD-3-Clause): Flagsmith CLI v2, the@flagsmith/flagsmithJS SDK and the Python SDK. - Released under the MIT License.






