---
title: "Remove flags that never change · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/dead-code/remove-stale-flags
updated: 2026-10-20
licence: "All rights reserved"
---

# Remove flags that never change

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Dead code](https://agentwranglers.se/playbook/architecture/dead-code)
- Rule: Delete a feature flag once it is fully on or fully off, along with the branch that no longer runs.
- How: Keep every flag in one file, with an owner and an end date set when you add it. When the date passes, remove the flag, its setting and the losing branch in one change.
- Check: A script lists flags past their end date and fails the build. In review, every flag has an owner and a date.

Example:

```python
# Bad: on for everyone since last year
if flags.enabled("new_checkout"):
    new_checkout(cart)
else:
    old_checkout(cart)

# Good: the flag and the old branch are gone
new_checkout(cart)
```

```ts
// Bad
if (flags.enabled('new_checkout')) newCheckout(cart);
else oldCheckout(cart);

// Good
newCheckout(cart);
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/dead-code/remove-stale-flags`.

- Previous: [Delete code that nothing uses](https://agentwranglers.se/playbook/architecture/dead-code/delete-unused-code)
- Next: [Remove unused dependencies](https://agentwranglers.se/playbook/architecture/dead-code/remove-unused-dependencies)
- [Dead code](https://agentwranglers.se/playbook/architecture/dead-code)
