Skip to content

feat(measure): answer or vet a number with its spread and limiter - #72

Merged
mastro993 merged 5 commits into
mainfrom
feat/measure-skill
Dec 3, 2026
Merged

mastro993 merged 5 commits into
mainfrom
feat/measure-skill

Conversation

@mastro993

Copy link
Copy Markdown
Owner

Why

A number such as a speedup, a size, a memory figure or an eval score means little on its own. It needs to come with how many runs produced it, how much it moves between runs, and what limits it. A reported speedup often turns out to be noise, or the "faster" side skipped part of the work. No fstack skill handled this until now. Chef's explain-the-number principle stated the rule, but only chef loads it, and it gives no steps to follow. This PR adds measure. It answers a question about a number, or checks a number someone else reported, and puts the verdict first: faster, slower, no difference or inconclusive. Later flows, such as finding a root cause or improving performance, can use it, and users can call it directly.

What

  • New skill skills/measure/ (SKILL.md, 40 lines, plus agents/openai.yaml). The agent can start it on its own when a question needs a number measured, or when someone else's number needs checking. Its steps:
    1. Claim: before running anything, write the expected result as one sentence naming the metric, the statistic, the size of the effect and the workload. Write down the decision the number feeds. When checking someone else's number, collect their evidence.
    2. Script: one script runs both sides, alternating A and B. It checks each run's output (row counts, checksums, samples) so skipped or cached work shows up, and prints the raw values with each side's median and range.
    3. Run: check the machine's load first. Run each side at least 5 times. When the gap between the sides is close to the run-to-run spread, keep adding runs and pool them into one median and range per side. A deterministic number, such as a file's size in bytes, needs only two identical runs.
    4. Question the number, answering each question with evidence: what limits it, was each side set up like production, does it break physical limits, were there errors, does it reproduce, does it matter end to end, did the work actually run.
    5. Verdict: a gap smaller than the spread counts as no difference. When the number judges a change the agent wrote, a fresh subagent gives the verdict. Without subagents, the reply says the verdict isn't independent.
    6. Report: one number in the reply or PR. The run details go in a file next to the script.
  • Eval scores follow the same steps, with each trial counting as a run.
  • chef: one new routing line, "A number to measure, compare, or vet → measure". Chef's explain-the-number.md principle keeps its rule, its four bullets and its Test. Its performance and eval checklists moved into the skill, so they now live in one place.
  • Registration: .claude-plugin/plugin.json and the README skills table.
  • Three eval cases, each with a small Node fixture whose timings were checked before the cases were written:
    • vet-speedup-inside-noise: a PR claims a 14% speedup from one run per side. The change can't affect the benchmark, so repeated runs show no difference.
    • vet-faster-side-skipped-work: a streaming export claims to be 13x faster. It actually stops at the first bad row and writes 5% of the rows, while printing the same warning as main.
    • measure-dedupe-gap: a real quadratic-to-linear speedup. On the new side, most of the whole-command time is Node starting up.

Choices made:

  • Name. measure is the plan's name for this flow and the word users say.
  • Eval scores are in scope. The steps are the same, and chef's principle already covered eval results. That coverage needed a home once it moved out of chef.
  • Left out: the plan's default models and effort levels for checking skills. Skills name no models, and the harness picks them. The skill keeps only the rule that a fresh agent gives the verdict on the agent's own change.

Merge danger

Reversible: yes. The PR only adds skill text and eval fixtures.

Blast radius: small. Questions about speed, size, memory or eval scores, and requests to check a reported number, will now load measure. The only existing files that change are chef's routing line and its explain-the-number principle.

How to test

Automated: markdownlint-cli2 finds 0 issues across 97 files. The skills-listed manifest check passes.

Evals: round 1 had 3 runs per case per configuration, 18 runs in total. Each case had one blind grader that saw shuffled labels and action logs with every read of the skill removed. "Without skill" means the same skill folder with measure removed.

With skill Without skill
Assertions passed 39/39 37/39
Correct verdict 9/9 9/9
Mean blind rank (1 best of 6): dedupe / skipped work / noise 2.0 / 3.3 / 5.0 5.0 / 3.7 / 2.0
False claims found by graders 2 6
Wall time, median (range) 137 s (113–162) 116 s (78–145)
Output tokens, median (range) 10.7k (8.3k–14.0k) 5.4k (4.7k–7.4k)

Round 1 lost the noise case. Runs without the skill did 30 to 60 alternating runs and gave one pooled answer. Runs with the skill stopped at 15 to 20 runs, and one reported two rounds with no combined result. The fix in the last commit makes runs keep adding alternating runs near the noise and pool them. Round 2 reran the noise case on the final wording, 3 runs per configuration in one wave. Assertions were 12/12 in both configurations. Mean blind rank was 3.7 with the skill and 3.3 without, compared with 5.0 and 2.0 in round 1. At 3 runs, that remaining gap is within noise. Wall time was a median of 139 s with the skill and 87 s without.

Round 1 also had one run that applied the fresh-agent rule to the user's own change and printed a stray note about it. The rule now applies only to a change the agent wrote in this session, and 0 of 2 reruns printed the note.

The skill was loaded from its description in all 14 runs that had it. A grep of every transcript found no Skill tool calls and no reads of the graders.

Cost: with the skill, runs take about 20% more wall time and write about twice the output tokens, mostly for the script and the details file.

Not covered by the evals: size, memory and eval-score questions. Every case measures speed.

A number such as a speedup, a size, or an eval score means little
without its run count, spread, and what limits it, and a reported
speedup often turns out to be noise or skipped work. The measure skill
answers a question about a number, or vets one someone else reported:

- Write the claim sentence and the decision it feeds before running.
- Script the comparison: both sides alternating, each run's output
  checked so skipped or cached work shows up, raw values plus median
  and range. A deterministic number needs two identical runs.
- Check the machine's load, run each side at least 5 times, and record
  the baseline's spread as the noise floor.
- Answer seven questions with evidence: limiter, production tuning,
  physical limits, errors, reproduction, end-to-end effect, and whether
  the work ran.
- Lead with the verdict (faster, slower, no difference, inconclusive);
  a number about the agent's own change gets its verdict from a fresh
  subagent. One number in the reply, run details in a linked file.
- Eval scores follow the same steps, with trials as runs.

Chef routes a number to measure, compare, or vet to the new skill. Its
explain-the-number principle keeps the rule and its Test; the
performance and eval checklists moved into the skill, so the two don't
hold the same checklist twice.
- vet-speedup-inside-noise: a PR claims 14% from one run per side; the
  change can't move the number, so repeated runs show no difference.
- vet-faster-side-skipped-work: a streaming export claims 13x, but it
  stops at the first malformed row and writes 5% of the rows.
- measure-dedupe-gap: a real quadratic-to-linear speedup, where the
  whole-run time of the new side is mostly process startup.
Eval runs on a speedup inside the noise stopped at 15 to 20 runs per
side, and one reported two rounds with no combined answer; runs without
the skill did 30 to 60 runs and won the blind ranking. Runs now keep
adding alternating runs while the gap is close to the spread and pool
every round into one median and range per side.

The fresh-subagent verdict now applies to a change the agent wrote in
this session; one run applied it to the user's own change and printed
a stray note about it.

The claim and report examples no longer use an export, which an eval
fixture also uses.
@mastro993
mastro993 marked this pull request as ready for review December 3, 2026 10:13

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No blocking issues — two non-blocking findings below.

Approach: sound — a dedicated skill with an explicit verdict, a script, and a spread and limiter check fills a gap chef only stated as a principle, and the change is additive.

Reviewed changes

Reviewed all 34 files across the 3 commits.

  • skills/measure/SKILL.md — six-step flow (claim, script, run, question the number, verdict, report) plus an eval-score section; the performance and eval checklists moved here from chef.
  • Registration — .claude-plugin/plugin.json entry (satisfies the skills-listed check), README Building row, and agents/openai.yaml.
  • chef routing — one new routing line in skills/chef/SKILL.md; explain-the-number.md keeps its rule, bullets, and Test.
  • Eval cases — vet-speedup-inside-noise, vet-faster-side-skipped-work, and measure-dedupe-gap, each with a Node fixture built by build.sh, lib.sh, place-files.sh, and graders.

Non-blocking

  • Chef's principle and measure disagree on what to do near the noise. skills/chef/references/explain-the-number.md line 5 still says "Stop when the run-to-run spread is larger than the effect", while skills/measure/SKILL.md step 3 says to keep adding alternating runs when the gap is close to the spread. An agent that loads only chef gets the opposite instruction, and round 1 of the PR's own evals lost the noise case over this stopping behaviour. Consider rewording the chef bullet to defer to measure (for example "…the effect is inside the spread: add runs, see measure").
  • The "gap smaller than the spread is no difference" rule has no run cap and drifts toward "no difference". In skills/measure/SKILL.md steps 3 and 5, the pooled range can only widen as runs are added. A real but small effect therefore never separates from the range, and "keep adding runs until the verdict stops moving" has no stopping point. A run cap, or an interval or quantile-based spread, would make the rule terminate and keep it from always settling on "no difference".

Pullfrog  | Fix it ➔ | View workflow run | Using claude-sonnet-5-5 | 𝕏

… half

A pooled min-to-max range only widens as runs are added, so a small
real effect could never clear it and the run had no stopping point.
Near the noise, runs now stop at 30 per side and the gap is judged
against the middle half of each side's runs.

Chef's explain-the-number principle no longer says to stop when the
spread is larger than the effect, which contradicted the measure
skill; the procedure lives in the skill.
@mastro993

Copy link
Copy Markdown
Owner Author

Thanks, both findings checked against the code and fixed in fe5419f:

  • Chef vs measure near the noise: dropped "Stop when the run-to-run spread is larger than the effect" from skills/chef/references/explain-the-number.md. The measure skill owns the procedure, and chef routes numbers to it.
  • No run cap, range only widens: step 3 now adds alternating runs up to 30 per side near the noise, and judges the gap against the middle half of each side's runs instead of the full range. Two reruns of the noise eval with this wording stopped at 30 runs per side and both answered "no difference".

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No blocking issues — one non-blocking finding below.

Reviewed changes

Reviewed the one commit added since the prior pullfrog review (fe5419f), which addresses both earlier non-blocking notes.

  • Capped the near-noise run loop — skills/measure/SKILL.md step 3 now adds alternating runs up to 30 per side instead of "until the verdict stops moving".
  • Judged the gap by the middle half of runs — step 3 compares the medians' gap against the middle half of each side's runs, since the full range only widens as runs are added.
  • Aligned chef's principle with measure — skills/chef/references/explain-the-number.md drops "Stop when the run-to-run spread is larger than the effect", so chef no longer contradicts measure.

Non-blocking

  • "Spread" is defined three ways, and the cap has no stated outcome. Step 3 judges the gap against the middle half, but step 2's script prints the "range", step 5 says "a gap smaller than the run-to-run spread is no difference", and step 6's example reports ranges, so an agent can still apply the full range the new text warns against. Step 3 also doesn't say what the verdict is when 30 runs per side leave the gap near the spread (presumably inconclusive). Naming the middle half in steps 2 and 5, and the cap outcome in step 3, would close both.

Pullfrog  | Fix it ➔ | View workflow run | Using claude-sonnet-5-5 | 𝕏

The verdict rule said "spread" while the run step judged near the noise
by the middle half, so an agent could still compare against the full
range. The script now prints each side's middle half, and the verdict
step judges the gap against it, including after the 30-run cap.
@mastro993

Copy link
Copy Markdown
Owner Author

Fixed in 36aa22a: the script in step 2 now prints each side's middle half (25th to 75th percentile) next to the median and range. Step 3 adds runs while the gap is close to the middle half, and step 5 states the verdict rule once: a gap inside the middle half is no difference, including after 30 runs per side. The report still shows the range, as the plan asks.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No blocking issues — one non-blocking finding below.

Reviewed changes

Reviewed the one commit added since the prior pullfrog review (fe5419f), which addresses both points from that review.

  • Named the middle half in the script step — skills/measure/SKILL.md step 2 now has the script print median, middle half (25th to 75th percentile) and range, and step 3's "done" condition lists the middle half.
  • Judged the verdict by the middle half — step 5 compares the gap between medians against each side's middle half, replacing "run-to-run spread".
  • Stated the cap outcome — a gap inside the middle half is "no difference, also after 30 runs per side", so the run cap now ends in a verdict.

Non-blocking

  • The report still shows ranges while the verdict is judged on the middle half. Step 6's example reports "ranges 798–830 ms and 560–592 ms" and step 3's noise floor says "run-to-run spread", so a reader can't check the verdict from the number in the reply. Reporting the middle half next to the median (or saying which statistic the quoted range is) would let the report back the verdict. Related: the middle half doesn't shrink as runs are added, so an effect smaller than it always lands on "no difference"; that looks like an intended trade-off, but worth being deliberate about.

Pullfrog  | Fix it ➔ | View workflow run | Using claude-sonnet-5-5 | 𝕏

@mastro993

Copy link
Copy Markdown
Owner Author

Leaving this one as is, on purpose:

  • Range in the report: the reply format follows the plan for this flow, one number with its median and range. The middle half that decides the verdict is printed by the script (step 2), and that output goes in the details file the reply links to, so the verdict can be checked from there.
  • Effects smaller than the middle half: deliberate. An effect smaller than the typical run-to-run variation is what the skill reports as no measurable difference; the 30-run cap keeps the run from chasing it.

@mastro993
mastro993 merged commit c447a6c into main Dec 3, 2026
6 checks passed
@mastro993
mastro993 deleted the feat/measure-skill branch December 3, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant