Hacker
sera mar
@seranov67
Elsewhere
Projects
FlagGuard — Safe Feature Flag Promotion Rehearsal Skill for Flagsmith CLI
Flagsmith Experimentation HackathonNov 2026
Promoting feature flags through AI coding agents is risky: a single wrong CLI call, stale context, or leaked management credential in chat can flip the wrong environment without verification or a clean rollback path. FlagGuard is an Agent Skill (skills/flagguard/SKILL.md) paired with a compact Python workflow (rehearse.py) built around the official Flagsmith CLI v2.0.0 and self-hosted Flagsmith 2.295.2. Platform engineers, SREs, and developers using AI agents (Codex CLI, Claude Code, Antigravity) use FlagGuard before promoting boolean flags across environments: 1. Read-only preflight (rehearse.py plan): Verifies expected source and target environment names via `flagsmith environment get --jq .name`, reads current flag states (`flagsmith flag get checkout_banner --jq .enabled`), and outputs a concise 2-line plan (`staging=true, demo=false`, `Plan: demo false -> true -> false`) without exposing management keys in chat. 2. Explicit human gate (rehearse.py rehearse): The agent never pipes or enters approval on the operator's behalf. The operator runs the command in their own terminal and must type `APPROVE`; any other input, empty line, EOF, or Ctrl+C exits cleanly with zero writes. 3. Drift recheck, verified apply & SIGINT-safe rollback: After `APPROVE`, FlagGuard re-reads both environments to prevent TOCTOU drift, promotes the target flag via `flagsmith flag enable/disable --yes`, verifies readback, and immediately restores and verifies the original state inside a SIGINT-masked `finally` block so rollback cannot be interrupted mid-flight.