docs(readme): restructure around the pipeline, and re-measure every figure - #63
Merged
Merged
Conversation
…igure The README led with a five-paragraph experimental-Gateway warning before saying what the tool does, and carried its corrections inline as retractions. Restructured to: worked example -> how it works -> install -> usage -> measured savings -> limits -> reference -> project state. Three Mermaid diagrams added, for the three things readers get wrong: the end-to-end pipeline, the planner's three plan shapes (why no budget flag means a guaranteed 0%), and the validation gate (measurement gate and retention gate as two gates, per-item repair, fail-open). All three were rendered before committing rather than assumed to parse. Every figure was re-run against the built artifact at this commit. Two did not survive that: - The knapsack bullet read "31 files in, 15 pruned, 20,540 tokens saved" for `optimize ./src/core --max-input-tokens 4000`. It is now 34 files and 13 pruned for 17,823 tokens, and the run FALLS BACK -- 19 CONSTRAINT_DIRECTIVE_LOST plus drift at 0.42 against the 0.40 gate -- so the caller receives 0.00%. The old number was the pruner's own stage metric quoted as a result: invariant 10's shape, in the docs. - A first draft of the replacement said undeclared TypeScript over stdin "falls back". It does not. `languageSupport.noneSupported` is true, token-hashing finds nothing eligible, and `fallbackUsed` stays false at a silent 0%. Caught by reading the trace rather than the token delta, before it shipped. Also corrected against source: `configSchemaVersion` is 1.1, not 1.0.0; TOKENDAMPER_PLANNER_MODE accepts `pass_through` only and is now documented; Python over stdin is probe-detected without --language, which the old text implied it was not; npm `latest` is 1.7.2 against this repository's v1.7.3. Verified: all 14 linked paths exist, 18 internal anchors resolve, code fences balanced, and the config example in the README runs clean (609 -> 367 tokens). No behaviour changes. Docs only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Documentation only. No source, no tests, no behaviour change —
README.mdand oneCHANGELOG.mdentry.What changed
The README opened with a five-paragraph experimental-Gateway warning before saying what the
tool does, and carried its own corrections inline as retractions. It is restructured to:
The caveats are gathered into one named section instead of scattered, on the view that in this
project they are a feature of the documentation rather than an appendix to it.
Three Mermaid diagrams, chosen for the three things readers actually get wrong:
pass_through, empty stage list)All three were rendered before committing rather than assumed to parse — extracted from the
file, rendered through mermaid 11.15.0, checked for a real SVG: 12/6/12 nodes, 13/5/16 edges,
zero parse errors.
Two measured claims did not survive re-running them
This is the part worth reviewing, and the reason there is a
CHANGELOGentry rather than abare "docs" line.
1. The knapsack bullet was quoting a stage metric as a result. It read "31 files in,
15 pruned, 20,540 tokens saved" for
optimize ./src/core --max-input-tokens 4000. Re-runagainst this commit:
The caller receives 0.00%.
tokensSavedis what the stage computed, upstream of the gate —invariant 10's shape, arriving in the documentation instead of the engine. Now written up
honestly under It will not save you from a comment-heavy codebase, with the fallback shown.
2. My own first draft was wrong in the same family. It claimed undeclared TypeScript over
stdin "falls back". It does not —
languageSupport.noneSupportedis true,compression:token-hashingfinds nothing eligible and skips the item, andfallbackUsedstaysfalseat a silent 0%. Caught by reading the trace rather than the token delta, before itshipped. The section now quotes the real
languageSupport.reasonstring.Corrected against source
configSchemaVersionis1.1, not the1.0.0first written.TOKENDAMPER_PLANNER_MODEacceptspass_throughonly — previously undocumented.--language; the old text implied otherwise. Thegap is TypeScript, and the README now shows the 880 → 880 vs 880 → 739 measurement.
latestis 1.7.2 against this repository'sv1.7.3, recorded as such.Figures now in the README, all re-run at this commit
driftScore 0· no fallback--keep-docstringspass_through·stageCount 0Corpus and Go figures are cited from
docs/audit-remediation-status.md§2 and DECISIONS §61with their frozen commit named, not re-derived from memory.
Checks
<details>balanced.npm teston this branch: 936 of 938 pass. The two failures are timing-sensitive andpre-existing on this machine —
bench.test.tshitting a 5 s timeout while shelling out topython, andgateway-streaming-timeoutreturning 504 instead of 200. The count variedbetween runs (3, then 2), which reads as flakiness on a cold Windows worktree rather than a
regression; nothing in this PR touches
src/.Noted, not fixed (out of scope)
src/adapters/mcp/tools.ts:33still tells MCP callers thattargetReductionRatio"currentlyacts as an on/off switch rather than a proportional target". DECISIONS §48 made it a binding
ceiling. One-line doc-string fix, left for a source PR.
🤖 Generated with Claude Code