Command Palette

Search for a command to run...

Back to skills
skill № 03276

Protect

Checked-in CI performance guardrail ceiling on a verified MET performance counter win: regressions fail CI and lower counts propose a lower ceiling by PR…

FreeNo executable scripts
melodic-softwareby melodic-software★ 34 GitHub stars

Install Protect in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Protect

Arguments. [<counter or claim>]. e.g. /performance:protect the 4-to-1 spawn reduction

Purpose

Answers "what keeps this win from eroding?"

Nothing asserts a new cost, so the next change that adds it back passes every test. A checked-in counter ceiling, checked in CI, makes that change fail the build.

Run it once, after /performance:verify reports MET on a counter. For a change shipped behind a flag, run it only after the field read that verify's Next routes to shows the gain; if the read shows no gain, turn the flag off instead. It proposes files; a human approves them. It never merges, and no model runs in CI: the check is a script and a number.

Read ${CLAUDE_PLUGIN_ROOT}/reference/techniques.md#g-protect-the-win for the technique entries this skill applies.

1. Choose the counter

  • Counters only, never durations. A duration ceiling moves with runner load, fails at random, and teaches people to raise it. Ratchet the headline counter from the verify report.
  • Measure it in the state CI will see. A counter behind a cache has a cold value and a warm value; a guard with a per-user cache can count 6 spawns cold and 1 warm. CI runners start cold, so a ceiling measured warm fails there. Pin the state in the command (unset or empty the cache location), and measure that.
  • It must be deterministic. ratchet.py add measures twice by default and refuses a counter whose runs disagree (${CLAUDE_PLUGIN_ROOT}/reference/harness-integrity.md rule 1). --runs N sets the run count, at least 1. Fix what varies before ratcheting.
  • A vendored copy may predate --runs. A copy of ratchet.py from before plugin 0.5.0 exits 2 on it. Re-copy ratchet.py, ab.sh and summarize.py from ${CLAUDE_PLUGIN_ROOT}/scripts/ before using the new flags.

Who writes the ceiling

Check whether /toolchain:ratchet (if enabled) is available in this session.

  • It is available: hand it the counter's name, command, field and goal (with its Correlation value), and skip §2-§4 here. It picks the ceilings file the repository's CI already checks, or proposes one, and writes the CI step and the tightening plan. Then continue at §5.
  • It is not available: run §2-§4 below against .performance/ratchets.json with ${CLAUDE_PLUGIN_ROOT}/scripts/ratchet.py. Nothing here needs the toolchain plugin.

2. The ceilings file

Propose .performance/ratchets.json, created by python3 ${CLAUDE_PLUGIN_ROOT}/scripts/ratchet.py add --name <n> --field <f> --goal <g> --command <cmd> from the repository root:

{"counters": [{"name": "guard-spawns", "command": "<shell command>", "field": "spawns",
               "ceiling": 6, "goal": "<the verified goal this protects>. Correlation: unproven: <reason>"}]}
  • command runs through the shell from the repository root and prints a <field>=<number> token.
  • --goal names the verified goal and ends with the goal's Correlation value, copied as Correlation: <pointer> or Correlation: unproven: <reason>.
  • The command must exit non-zero when the subject fails. A subject that errors out early spends fewer spawns and passes any ceiling. spawn-census.sh exits 0 whatever the subject did and prints rc=<n>, so append | grep -F ' rc=0 '.
  • The ceiling is the measured value, never a round number above it. Headroom is room for a regression.
  • CI has no plugin installed, so the proposal vendors ratchet.py (one stdlib file) into the repository, for example .performance/ratchet.py, unless the repository already carries it.

Telemetry-derived counters

A count that lives in a telemetry store (spans, events, a log) is measured by a command that flushes, queries, and prints the token itself; ratchet.py only runs the command and parses stdout.

{"name": "tool-calls", "field": "calls", "ceiling": 12,
 "goal": "<the verified goal this protects>. Correlation: <pointer>",
 "command": "id=$(uuidgen); RUN_ID=$id ./run-subject.sh && ./flush-exporter.sh && ./count-run.sh $id"}
  • Scope the query to the run the command started, by an id it generates, never a time window. A late batch from the previous run lands in a window and inflates the count.
  • Exit non-zero when the run record is missing, not when the count is zero. count-run.sh is the counter's query step: it checks for a completion record the subject emits for that id and exits non-zero without it, so lost telemetry fails the command instead of reading as 0. With the record present it prints calls=<n>, and calls=0 is valid, since a zero ceiling is legitimate. The subject's own failure must also fail the command.
  • Force the exporter to flush, or poll until the run's record is complete, before printing. add and propose-tighten measure twice by default, and --runs tunes the count. A read taken before the flush sees a partial count: the
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • evals/evals.json

FAQ

What does the Protect skill do?

Checked-in CI performance guardrail ceiling on a verified MET performance counter win: regressions fail CI and lower counts propose a lower ceiling by PR (proposes files only; human approves and merges). Use when: 'protect this win', 'ratchet this counter', 'stop this regressing'. Not for duration-only or NOT MET results.

How do I install the Protect skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the Protect skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare Protect with