Know who a flag change hits before you ship it.
FlagTwin runs your Flagsmith change against your real users first, warns when an override will quietly undo it, waits for a human yes, then applies, verifies against the live server and keeps an undo.
$ flagtwin preview new-checkout --disable
Change: disable new-checkout (environment default) [Development]
Impact: 0 of 21 sampled users flip
WARNING [SHADOWED] 8 user(s) stay ON: segment
premium-users takes priority over this change.
WARNING [NO_OP] This change flips nobody in the sample.
Preview id: 20261129-144642-61b5
$ flagtwin preview new-checkout \
--segment premium-users --remove-override
Impact: 8 of 21 sampled users flip
8 ON -> OFF
No warnings.8 of 21
users would still have seen the new checkout after someone “turned it off”. The default was already off; a segment override for premium users kept it on, and the Flagsmith dashboard would have shown the change as done.
A flag change is a production deploy with no diff and no review. FlagTwin gives it both, using the same environment document and evaluation engine the Flagsmith SDKs use, so the preview matches the server for every user and flag we tested.
Five steps, one engine
- 01Preview
flagtwin preview new-checkout --disableSimulate the change on a copy of the environment document with the Flagsmith engine, for every real identity. Nothing is written.
- 02Approve
“Apply this to Development?” / /approveA human reads who flips and every warning, then says yes. Agents and the bot cannot skip this.
- 03Apply
flagsmith flag delete new-checkout --segment premium-users --yesRefused if the flag changed since the preview. Otherwise runs exactly the command that was reviewed.
- 04Verify
POST /api/v1/identities/ (transient)Waits for the change to land, then asks the live server how it evaluates a sample of users and compares.
- 05Undo
flagtwin undo lastEvery preview stores its reverse change, with the same drift check and verification.
Where it runs
Three front ends share the engine. Every write goes through the Flagsmith CLI v2.
| Form | Where | Start with | Track |
|---|---|---|---|
| Agent skill | Claude Code, OpenCode, Kiro, any agent that reads SKILL.md | skills/flagsmith-safe-change | Track 04 |
| GitHub bot | Comments on issues and pull requests, run by GitHub Actions | /flagtwin turn off new-checkout for everyone | Track 02 |
| CLI | Your terminal or CI | uv tool install git+https://github.com/Sarcastic-Soul/flagtwin | Both |
The agent cannot write
The bot's LLM gets four tools: list flags, list overrides, list segments, preview. Nothing that changes Flagsmith. A change is applied only when someone with write access to the repository replies /approve, and only the exact change that was previewed.
Tested on three agents
Claude Code with Sonnet and Kiro with GPT 5.6 Luna caught the shadowed override and stopped for approval. A small model in OpenCode ignored the skill and tried direct writes; the shipped permission allowlist blocked every one. That is why the skill comes with allowlists, not just instructions.