Repository navigation
fix(skill-token-count): stamp token counts into each SKILL.md instead of a shared table - #1394
Merged
Merged
Conversation
… of a shared table The generated table in docs/mode-economics.md carried a measurement date and a manifest hash that changed on every regeneration, and the hook regenerates on any SKILL.md edit, so any two skill PRs conflicted (adjacent rows did too). Stamp each count into the skill's own frontmatter as measured_tokens (measured excluding that line, placed after license: so it never reorders surface_hash), print the table on demand with --table, and stop committing it. The website build renders the table from the stamps. Generated-by: Claude Opus 5
Member
Author
|
This should completely remove the constant need of resolving conflicts in mode_economics.md |
Merged
3 tasks done
potiuk
added a commit
to apache/magpie-site
that referenced
this pull request
Sep 26, 2026
…amps (#203) apache/magpie#1394 moved each skill's token count into its own measured_tokens frontmatter stamp and replaced the committed table in docs/mode-economics.md with a marker. Render the table from the stamps during sync-docs, before the link rewrite, so the page keeps its table and the rows link to GitHub as before. Generated-by: Claude Opus 5
3 tasks done
potiuk
added a commit
to potiuk/magpie
that referenced
this pull request
Sep 26, 2026
Pick up today's merges (apache#1390, apache#1391-apache#1394, apache#1398, apache#1399) in a fresh marketplace build. pyproject.toml, uv.lock and every generated plugin/marketplace manifest move from 0.9.0.dev202609251939. Generated-by: Claude Opus 5
3 tasks done
potiuk
added a commit
that referenced
this pull request
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/mode-economics.md. The generated table there had two lines, the measurement date and the manifest SHA-256, that changed on every regeneration. Theskill-token-counthook forces a regeneration on anySKILL.mdedit, so any two skill PRs rewrote the same lines. Alphabetically adjacent rows collided as well. 58 of 213 commits onmainthis month touched the file.measured_tokens:frontmatter line, stamped the same way assurface_hash:. It's measured over the full file with its own line excluded, so writing the stamp never changes the count it records. Two PRs now conflict on a stamp only if they edit the same skill, which they would anyway.skill-token-count --tableprints it;docs/mode-economics.mdexplains where the numbers live and carries a marker the website build replaces with the rendered table (follow-up PR onapache/magpie-site).license:;surface_hash:sits immediately before it. Anchoring on opposite sides keeps the two stampers from reordering each other's line, so each is idempotent whichever runs last.Type of change
tools/*/withpyproject.toml) —skill-token-count(stamp / check / table),skill-and-tool-validator(format check for the new key)SKILL.mdgain a generatedmeasured_tokens:line (no prose change)docs/mode-economics.md,tools/skill-token-count/README.md,AGENTS.md(Keeping evals and mode-economics in sync)files:, theskill-token-countworkflow path filter, the dependabot / pyproject comments on thetiktokenpinTest plan
prek run --all-filespassesuv run --directory tools/skill-token-count pytest— rewritten suite covers:--checknever writes;--writeis idempotentlicense:, and a restamp replaces rather than duplicates--tablewrites nothinglicense:are handleduv run --directory tools/skill-and-tool-validator pytest— new tests reject a malformedmeasured_tokens(0,-5,1,234,many) and accept a valid oneskill-surface-hash.pystays in sync after stamping, and a second--writechanges nothing, so the two stampers don't fightaudit-finding-fix/ci-runner-audit) and restamping merge cleanly, and--checkpasses on the merge result. Before this change that pair always conflicted.Notes for reviewers (optional)
tiktokenpin; a bump that changes tokenization fails--checkon every skill until restamped, as before.SKILL.mdwill needskill-token-count --writeonce after rebasing onto this. That's the last time the table conflicts.🤖 Generated with Claude Code