Skip to content

docs: name the prior art on token measurement, and state the estimator's real error - #119

Open
singhharsh1708 wants to merge 3 commits into
mainfrom
fix/measurement-claim-vs-prior-art
Open

docs: name the prior art on token measurement, and state the estimator's real error#119
singhharsh1708 wants to merge 3 commits into
mainfrom
fix/measurement-claim-vs-prior-art

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Retracts a claim the README should not have been making, and replaces an error bar that was measured on the wrong corpus.

skills-check counts tokens per skill with a real cl100k_base tokenizer, breaks them down per section, and fails a build over a ceiling, so "I have not found another tool that surfaces that number" is no longer true. What survives is the per-target half: the same skill has a different standing cost on every agent because each one loads it differently, and that falls out of a compile step which already knows each target's loading mode. skills-check measures the file; Kitbash measures the pair.

The estimator's stated error, "about 2-11% high", was measured over SKILL.md, README.md, spec/SPEC.md and docs/roadmap.md, then attached to the benchmark table, whose numbers come from entirely different bytes. Measured over the artifacts the benchmark actually emits, length / 4 runs 7% low to 36% high, and the direction flips with content: prose over-counts, while the repetitive review-checklist body under-counts by 7%. So the claim that the bias runs in the safe direction for budget enforcement was wrong, and a skill shaped like that one can pass a budget it actually exceeds with --strict none the wiser. The ratio holds up better but is not exact either: prereview's 14x is 14.7x under a real tokenizer, and review-checklist's 47x is 68x, so "within half a multiple" was wrong too.

npm run tokencheck regenerates all of it from the same artifacts the benchmark measures, so the next figure that drifts fails visibly instead of sitting in a paragraph. gpt-tokenizer is a devDependency and runs in no shipped code path, leaving the runtime dependency count at zero; its counts were cross-checked against tiktoken on four artifacts and matched exactly.

The corpus moved into scripts/bench-fixtures.mjs so the table and its error bar cannot describe different bytes again, which is the mistake that produced the wrong number in the first place. benchmark.mjs regenerates docs/benchmarks/README.md byte-identically across that refactor.

Suite green on macOS, Ubuntu and Windows. Merge after #118 to avoid a changelog collision.

…r's error

The README claimed no other tool surfaces a skill's token cost. That is
no longer true: skills-check (npx skills-check budget) counts tokens per
skill with a real cl100k_base tokenizer, breaks them down per section,
detects redundancy between skills, and fails a build over a ceiling.
Leaving the claim up would be the same credibility problem the 0.11.0
pass existed to fix, on the one number this project is known for.

Corrected to what is still specific here: the per-target half. The same
skill has a different standing cost on every agent because each loads it
differently, and that falls out of a compile step that already knows each
target's loading mode — skills-check measures the file, not the pair.

Also states the estimator's real error rather than "a few percent".
Measured against o200k_base: length/4 runs 2-11% high on this corpus
(prereview 567 vs 515, stub 40 vs 35), biased toward failing budgets
early, and the 14x ratio is 14.7x under a real tokenizer.
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kitbash Ready Ready Preview Aug 29, 2026 2:35pm

@github-actions github-actions Bot added documentation Docs, spec, RFCs, README, site benchmark Benchmark script or measured numbers labels Aug 22, 2026
…ng one

The previous wording said length/4 runs 'about 2-11% high' and called that
the safe direction for budget enforcement. Measuring it against o200k_base
over the artifacts the benchmark emits, neither half holds:

  prereview stub          40 est   35 real   1.14x
  prereview body         567 est  515 real   1.10x
  review-checklist stub   19 est   14 real   1.36x
  review-checklist body  880 est  942 real   0.93x

The range is 7% low to 36% high, not 2-11% high, and the direction flips
with content: prose over-counts, repetitive numbered lists under-count. A
skill shaped like review-checklist can therefore pass a budget it actually
exceeds, which is the opposite of the claimed bias, and --strict will not
catch it.

The ratio is more robust but not exact either: prereview's 14x is 14.7x,
and review-checklist's 47x is 68x — the estimator understates that gap by
a third, so 'within half a multiple' was wrong too.

Says how the comparison was taken and that it is a one-off, since kitbash
ships no tokenizer and cannot regenerate it.
…ring it

The error bar the benchmark quotes was a number someone measured once and
typed in. It was wrong — 'about 2-11% high' against a real range of -7% to
+36% — and nothing in the repo could have caught that, which is the same
class of problem as a hand-maintained copy of the loading-mode table.

Adds scripts/tokenizer-check.mjs (npm run tokencheck): measures the
artifacts the benchmark emits against o200k_base and prints the range and
both standing-tax ratios, so the figures in docs/benchmarks/README.md are
regenerable. gpt-tokenizer is a devDependency and runs in no shipped code
path; runtime dependency count is still zero. Cross-checked against
tiktoken on four artifacts — identical counts.

Extracts the corpus into scripts/bench-fixtures.mjs so the table and its
error bar describe the same bytes rather than two copies of the fixture
setup. benchmark.mjs regenerates docs/benchmarks/README.md byte-identically
across the refactor.
@github-actions github-actions Bot added the dependencies Dependency or action version bumps label Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

benchmark Benchmark script or measured numbers dependencies Dependency or action version bumps documentation Docs, spec, RFCs, README, site

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant