Hacker

Yogi Hrn

@yooghrn

Joined Nov 2026Hunter at YoogIndonesia

Projects

  • Ship It Safely — a Flagsmith Agent Skill

    Flagsmith Experimentation HackathonNov 2026

    The problem: Coding agents can now write and deploy changes end-to-end, but handing an agent unsupervised control of production feature flags is dangerous in two ways. First, safety: a single command can expose a broken change to 100% of users instantly, with no checkpoint, no health verification, and no rehearsed way back. Second, cost: agents that explore flag state by ingesting raw JSON dumps burn enormous amounts of tokens on data they never use — a single unfiltered flag list in our testing was 6,363 bytes, of which the agent actually needed 238. Teams need an agent that ships like a careful release engineer: small steps, checks after every step, a human in the loop before anything risky, and an instant, automatic way back when something fails. What Ship It Safely does: Ship It Safely is an Agent Skill (standard Agent Skills format: a SKILL.md with YAML frontmatter plus bundled helper scripts, loadable in Claude Code and other skills-compatible agents) that runs one complete Flagsmith job for a single code change, using only the Flagsmith CLI v2: (1) Recon (read-only, token-lean) — reads project, environment, and flag state through --json output with targeted --jq filters that return only the fields the next decision needs. (2) Plan + approval stop — before any mutation, the skill presents a short, diff-like ship plan and stops; nothing mutating runs before a human says yes. (3) Create the flag, disabled — a multivariate flag with control and new variants, created disabled with new at weight 0 (the Flagsmith CLI has no percentage switch for boolean flags — gradual rollout is variant weights, and the skill is built around that). (4) Gradual rollout with a health gate after every step — in a non-production environment first, the new weight ramps 10 → 50 → 100; after each step the skill runs the user's configured health check and verifies the flag state with a single filtered read. (5) Automatic rollback — if any health gate fails, the skill immediately sets new=0 and disables the flag, no approval needed, because rolling back is always the safe direction, then verifies and journals the rolled-back state. (6) Promote + run report — production is a separate, second approval stop whose confirmation must name the flag and the production environment; every run ends with a generated report: every step and command, the rollout state after each step, gate results, any rollback, and the run's total token count. Safety model: approval stops before the first mutation and before anything touches production; dry-run (full job in non-prod) always comes first; smallest step first (10 → 50 → 100, never a jump straight to 100); a health gate is mandatory — with no check command configured, the skill refuses to roll out; rollback is automatic and needs no approval; every command, output size, state snapshot, approval, and incident is written to an append-only JSONL run journal; credentials are never printed — auth is flagsmith login or FLAGSMITH_API_KEY from the environment only. Token efficiency (measured, not claimed): the skill reads Flagsmith state only through --json + targeted --jq filters, fetches each list exactly once, verifies mutations with one filtered read instead of polling, and routes CLI output through its journal helper so only one-line statuses enter the agent's context. Token counts are estimated as ceil(output_bytes / 4) from the journalled output sizes — the method is recorded in the journal and labelled in every report. Measured on the bundled demo run (mock CLI, 26 journalled steps covering a full ship and a full rollback): whole demo run — CLI output consumed: 930 bytes ≈ 245 tokens; recon comparison: raw flag list --json dump = 6,363 bytes; the --jq-filtered read the skill actually consumes = 238 bytes (−96%). Measured on the live Flagsmith Cloud run (2026-11-26, project "My first project", Development environment; 25 journalled steps covering recon → create → gated ramp 10 → 50 → 100): whole live run — CLI output consumed: 2,748 bytes ≈ 693 tokens (same ceil(output_bytes / 4) method, recorded in the run report). Judging fit: it completes the whole job end to end (not a single command or wrapper); token efficiency is measured and reproducible; creative use of the CLI (multivariate variant weights as the gradual-rollout mechanism; eval <flag> --test's exit code as a CI-style sanity gate; --json + --jq treated as a token budget); safety around production changes (human approval stops, non-prod dry-run first, mandatory health gates, automatic rollback, complete audit journal). Use of Flagsmith: the CLI is the only tool the skill uses; flags do all the real work. Tagline: An Agent Skill that takes a coding agent through the complete safe-ship job for one code change — wrap it in a Flagsmith flag, roll it out gradually, gate every step on a health check, and promote it or roll it back automatically — with a human approval stop before anything production-affecting. Technologies used: Flagsmith CLI v2, Agent Skills format (SKILL.md), Python 3 (journal/report helpers, stdlib only), Bash, jq-style CLI filtering (--jq) Team: Solo — yooghrn Demo instructions: No Flagsmith account or credentials are needed. Clone the repo, then run: bash demo/run-demo.sh — This replays the whole job against a bundled stateful mock of the Flagsmith CLI: Scenario A ships a flag (new_checkout) cleanly through a 10 → 50 → 100 weight ramp with a health gate after every step; Scenario B (risky_pricing) hits a forced health-gate failure at weight 10 and the automatic rollback fires, ending in a verified disabled state. Outputs: demo/runs/demo-journal.jsonl and demo/demo-report.md (steps, states, gate results, and the token count — ~245 tokens for the full run). Approvals are auto-granted in the demo and journalled as such; with real credentials (flagsmith login or FLAGSMITH_API_KEY, then flagsmith init), the identical workflow runs against Flagsmith Cloud and stops for a human at exactly those points. Notes for judges: The skill is MIT-licensed and follows the standard Agent Skills format, so it is ready to merge into a skills collection as-is. Token counts are estimates of CLI output consumed (ceil(bytes/4)), labelled as such in every report — not provider billing figures. Also demonstrated live against Flagsmith Cloud (project 'My first project', Development environment) on 2026-11-26: flag ship_it_safely_demo shipped 10 → 50 → 100 with all health gates green — see the run report in the repo (runs/real-2026-11-26-report.md).