Skip to main content
The feature flag hygiene example finds old Unleash release flags that remain in a repository and prepares one small cleanup pull request per eligible flag. It combines an interactive agent, remote MCP servers, code-defined tools, and a schedule in one project.

OpenComputer × Unleash feature flag hygiene

Clone the complete agent, schedule, and fixture application from GitHub.

How it works

For each exact feature-flag reference found in executable code, the agent:
  1. inspects the flag’s production state through the Unleash MCP server;
  2. checks whether it has been live for the configured minimum age;
  3. determines the behavior that should survive removal;
  4. finds an owner through CODEOWNERS or recent file history;
  5. runs the narrowest relevant tests;
  6. opens one focused pull request per eligible flag and requests the identified owner as a reviewer.
The agent does not disable, archive, or delete flags in Unleash. Flag retirement remains a separate action after the cleanup pull request has been reviewed and deployed.

Select the capabilities

The agent function attaches the model and capabilities needed by the managed harness:
The Unleash MCP server supplies feature-flag state. The GitHub MCP server and code-defined tools supply repository search, an authenticated source snapshot, ownership evidence, branch creation, file updates, pull requests, and reviewer selection. Both credentials are managed by OpenComputer. They are not placed in agent source, prompts, commands, tool input, or repository URLs.

Skip unsafe candidates

The agent refuses to open a pull request when a flag:
  • is younger than the minimum-age threshold;
  • is not enabled in production;
  • appears only in documentation;
  • has ambiguous surviving behavior;
  • has failing tests;
  • has no evidence for an owner; or
  • already has an open cleanup branch or pull request.
The screenshot below shows a real interactive run in which all four flags were skipped. Three were enabled but too young, while one was not enabled in production. The session reports the evidence instead of making a change.
OpenComputer feature flag hygiene session showing four Unleash flags skipped because they were too young or not enabled in production

Run it on a schedule

The example includes a code-defined weekday schedule:
Development discovers the schedule but keeps it manual-only by default. Use Run now to test the exact dispatch safely. Production runs it at 9:00 AM Pacific on weekdays and skips an occurrence when an earlier run is still active. The payload’s mode selects unattended behavior. The transport provenance in input.source remains available for observability, but it is not used as the agent’s business-mode switch.

Try the fixture safely

After cloning the repository and configuring the documented GitHub and Unleash development secrets:
Start with the included fixture and a dry run:
The repository README documents the required token permissions, production deployment, fixture tests, and the deliberate step from dry-run analysis to pull-request creation.