You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/09/22 14:52:20 UTC

[PR] feat(utilities): give optimize-skill budgets and an eval gate, and run it from write-skill [magpie]

potiuk opened a new pull request, #1332:
URL: https://github.com/apache/magpie/pull/1332

   ## Summary
   
   Three gaps in `optimize-skill`, all the same shape: it knew how to make a skill smaller, but not **how small**, not **whether it still worked**, and not **when to bother**.
   
   - **Budgets** — 5,000 tokens for a `SKILL.md` body, 200 for `description` + `when_to_use`. Set at the catalogue median, so half the skills already met them.
   - **An eval gate** — Step 4 runs the target's suite, and runs it before the first pass too.
   - **It always runs** — optimization is now Step 7 of `write-skill`, before shipping, unconditionally.
   
   ## Type of change
   
   - [x] Skill change — `optimize-skill` and `write-skill`
   - [x] Documentation — `mode-economics.md` regenerated
   
   ## The budgets, and why they are these numbers
   
   Measured across the 75 skills in the tree: median body **4,614** tokens, p90 10,613, largest 28,346; median always-on 200, largest 398. The targets sit at those medians, so they are achievable by construction rather than aspirational, and the distribution is recorded in the skill so a later reader can tell whether the target still means what it meant.
   
   **The frontmatter budget is the one that matters**, and the skill now says why. A body costs when its skill runs. `description` and `when_to_use` cost in *every session, for every skill at once*, invoked or not — so a wordy description taxes people who will never use the skill. Two hundred tokens saved there beat two thousand saved in a body nobody triggers this week.
   
   `PRINCIPLES.md` P14's 500-line cap still stands as the structural limit; these are the context budgets underneath it.
   
   ## The eval gate
   
   Step 4 runs `tools/skill-evals/magpie-run-evals.sh` against the target's suite where one exists — **and runs it before the first pass as well**. A suite you only ran afterwards cannot tell a regression from a case that was already failing.
   
   Where a suite is non-deterministic, and some in this repo are, the skill says so and hands the flipped case to the maintainer rather than picking whichever run supports the conclusion. Claiming a rewrite is proven safe on a suite that cannot hold still is worse than admitting the gap.
   
   A skill with no suite is not blocked, but the absence gets stated — that is the maintainer's cue that the validator is the only gate on the change.
   
   ## Running it automatically
   
   Optimization was something someone might do later, which is to say it did not happen. It is now Step 7 of `write-skill`, unconditional, before Step 8 ships.
   
   The reasoning in the step is that first drafts explain too much — a property of drafts, not of careless authors — so the pass is part of writing a skill rather than a cleanup someone may get to. A new skill that cannot get under both budgets is usually doing two jobs, and the step says to consider splitting it rather than accepting the size.
   
   ## Test plan
   
   - [x] `prek run --all-files` clean.
   - [x] `skill-and-tool-validate` — only the pre-existing `override-contract` finding, unrelated.
   - [x] Both skills meet the budgets they now impose: bodies 1,873 and 2,465 against 5,000; frontmatter 120 and 170 against 200.
   
   ## Notes for reviewers
   
   The budgets are deliberately median-derived rather than chosen. If you want them tighter, the number to argue about is the frontmatter one — it is the only figure in the framework that is multiplied by every skill in every session.
   
   Follow-on, not in this PR: the setup family is being optimized against these budgets on a separate branch, and `Adopter overrides` (169 tokens × 55 skills) plus `Snapshot drift` (141 × 51) remain the largest duplicated preamble the pre-flight now largely covers.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(utilities): give optimize-skill budgets and an eval gate, and run it from write-skill [magpie]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #1332:
URL: https://github.com/apache/magpie/pull/1332


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org