Hacker
Komal Pawar
@komalwork286_max
Elsewhere
Projects
Flag Doctor
Flagsmith Experimentation HackathonNov 2026
Flag Doctor is a command-line AI agent that cleans up feature flags and finished A/B tests in Flagsmith projects. The problem: flags and experiments are meant to be temporary, but nobody removes them. After an A/B test picks a winner, the losing variant's code stays in the repo forever. Old flags pile up as dead code that confuses developers and can bring back old bugs if someone flips them by mistake. "Ghost" flags (code reading a flag that no longer exists in Flagsmith) silently get the default value forever. Who would use it: any team using Flagsmith that runs experiments or has more than a handful of flags, as a regular clean-up step (for example after each experiment ends, or once per sprint). How it works: 1. flagdoctor scan reads every flag, its state in every environment, and every experiment from Flagsmith, scans the codebase, and gives each flag a verdict: experiment-done, stale-on, stale-off, unused, ghost, needs-human or healthy. These are plain rules, so every verdict is explainable. 2. flagdoctor fix sends each affected file to an AI (Gemini free tier or Claude) with exact instructions, e.g. "the experiment rolled out plan_visit: keep that path and delete the losing variant and its exposure tracking". Flag Doctor checks the rewritten code still parses, shows a colored diff, and a human approves every file. Then it creates a git branch and commit and can open a GitHub PR. 3. flagdoctor archive archives flags that no code uses, again only after approval. We tested it end to end: we ran a Flagsmith Experimentation A/B test on a pet-store website (hero button "Visit Our Store" vs "Plan Your Visit", metric: Get Directions clicks, with simulated traffic). Flagsmith reported plan_visit as the winner with 91% probability, and we rolled it out. Flag Doctor then read the completed experiment from Flagsmith and removed the losing variant's code in a reviewed commit.