# tokenu

A command-line tool, modeled on the Unix du command, that reports how many language-model tokens each file and directory in a project consumes, to help budget context before feeding a folder to an LLM or coding agent.

tokenu counts token usage per file and directory, the way du reports disk usage, to answer how much of a language model's context window a given folder would consume. It is run with npx and prints a directory tree of token counts, so a developer can see before pasting a folder into a prompt which parts of a project are the most expensive.

Its output helps find unexpectedly large files such as generated JSON, lockfiles or bundles, and a JSON output mode lets the counts be piped into an autonomous agent so it can plan which files to read within a set token budget, or used as a pre-read hook that warns or blocks before a tool like Claude Code loads an oversized file. It can also compare how the same files tokenize under different model encodings, to estimate cost differences before switching models.

Website: https://github.com/lirantal/tokenu
