Feature flag debt
Every flag is a decision you already made. The rollout finished, the losing branch deleted, and the flag stayed. It's still evaluating though, and it's cluttering your codebase. This scout finds the flags you forgot and opens the pull request that takes them out.
What the scout looks at
The scout looks for patterns like Fig. 1: a rollout hit 100% four months ago, and the evaluations never stopped. A decision you already made and moved on with is still being asked ~52,000 times a day.
| Flag | Rollout | Age | In code | Verdict |
|---|---|---|---|---|
| new-checkout-flow | 100% | 4 mo | 3 files | Remove |
| beta-nav | 0% | 5 mo | 1 file | Remove |
| legacy-export | 100% | 7 mo | not found | Ask first |
If the rollout were still moving, this would be a live experiment, not debt. This is how the scout determines what to act on.
The report in your inbox
When your product emits signals that indicate flags have gone stale, a scout opens a report – and Fig. 2 breaks the card down part by part. Click Review and the report opens into Fig. 3: the full evidence, the raw signals, and the button that turns it into a pull request. Yours would name your flags, your repos, your call sites.
Safe to clean up. new-checkout-flow has been at 100% for four months with no edits, and its key still appears in three files – all of them taking the same branch every time. beta-nav has been at 0% for five months, with its key in one file behind a conditional that never fires. Neither is experiment-linked, and no other flag depends on them.
Open question. legacy-export is at 100% and still evaluated ~11,000 times a day, but its key doesn't appear in any connected repo. 94% of those evaluations come from posthog-android versions older than the cleanup release, so this looks like shipped clients rather than live code – deleting it would flip them to the off path. Worth confirming before anything is removed.
3 flags · ~52,000 evaluations/day
Suggested fix: Remove the call sites for new-checkout-flow and beta-nav. Once that's deployed and evaluations stop, you can delete the flags themselves – that's the follow-up, not this diff.
The pull request you merge
When you're ready to open a pull request, the agent does it for you, attaching the evidence along the way. You review and merge it like any other – nothing merges without you.
Reports are free. Pull requests are $15 each, with your first three a month free. See self-driving Pricing.
The scout itself
Scouts are the heart of the self-driving system – they're instructions an agent follows on a schedule – Fig. 4 is the actual file for this guide's custom scout.
It reads more than one signal source, so the report can name a likely cause, not just a number that moved.
Which flags still evaluate, how often, at what rollout, and how long they've sat there.
Your repo is a signal source too. Whether the flag key still appears in code decides between cleanup and a question.
The schedule it runs on
This custom scout runs daily by default. You can choose to run it every 30 minutes up to once a day. It only writes when something is wrong, so most days it's silent.
Add this to your scout troop
This is how the scout appears in PostHog once it's running – a scheduled agent that files a report when it finds something.
Preview
- RequiredFeature flags in use
- RequiredYour codebase connected via GitHub – every repo that evaluates flags, not just the main one. A repo the scout can't see looks exactly like code that no longer exists.
Not set up yet? One command installs PostHog, connects GitHub, and turns on a default troop of scouts. That troop doesn't include this one – add it above once you're set up.
npx @posthog/wizard self-driving