v2.9.4: a first-read fold, and a freshness check for an index a previous parser wrote
Adds an opt-in fold that removes 43% of what a first read of a source file delivers, teaches token-goat doctor to report how much of an index a previous build of the parser wrote, and repairs both of the read hook's rewrites, which had been parsing a shape Claude Code never sends.
Added
- Long function bodies and long comment blocks fold out of a first read. Every earlier saving needed a previous copy of the file to compare against, and first reads are the large majority of what the read hook sees.
hints.fold_code_bodieskeeps each function's declaration and its first eight lines, and keeps the first two lines of any comment block running twelve lines or more, replacing the rest with one line naming the exact range removed and the command that returns it. Measured on this repository's own source, counting only the first 2,000 lines of each file because that is where a Read stops: 229 of 256 files fold, and 43% of what a read of them delivers is removed. Off by default, and a checked-in.token-goat.tomlcannot switch it on. token-goat doctorreports parser freshness. Every indexed file records which build of the extractor parsed it, and a mismatch already counts as stale everywhere it matters, but nothing said how many files were in that state. On the index this was found on, 95% of one project's 1,155 files were behind, and 71% of 17,508 files across every project. The check warns past a quarter and names the fix.
Fixed
- Both of the read hook's rewrites were dead on Claude Code: they parsed a rendering the hook never receives. All 104 real reads in the sample arrive as raw file content.
- A Read asking for five lines of a compacted document received a summary of the whole document instead.
- The saving claimed for a compacted document was quoted as 80 to 95 percent. Measured over the 44 markdown files in this repository above 4 KB, the median saving is 67% and only 13 of the 44 land inside the range that was advertised. The documentation now says what was measured.
hint-statsprinted two kinds of percentage in one column with nothing to tell them apart. Compared straight across, they said the opposite of what they meant.- Four rows of the architecture doc's component map pointed at files that are not there. A guard now checks every repo-relative link in every living document against
git ls-files, which is the right oracle on a case-insensitive filesystem.
Removed
- A compression path that was built, tested, fixed four times, and never once run. Six tests covered
tryWrapCompoundSegmentsand all six passed, which is equally true of code nothing calls.
Full detail: CHANGELOG.md.