Token map

--token-map prints a directory tree to the terminal with a token weight on every file and folder, so instead of guessing what's bloating a 291k-token run you can see it:

gnaw . --token-map
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ components/   180,000 tokens
    โ”œโ”€โ”€ lib.rs          4,200 tokens
    โ””โ”€โ”€ main.rs           900 tokens

The weight on a directory is the sum of its contents, so the heavy subtrees are obvious at a glance โ€” and that's usually your cue for what to --exclude or compress next.

Tuning the output

FlagEffect
--token-mapEnable the token-weighted tree
--token-map-lines <N>Cap the tree at roughly N lines
--token-map-min-percent <P>Hide entries below P percent of the total
# Top of the tree only, hiding anything under 1% of the total
gnaw . --token-map --token-map-lines 40 --token-map-min-percent 1

--token-map-min-percent is the quickest way to cut noise: set it to 1 and the map collapses to just the files and folders actually worth your attention.