Does my codebase fit in context?
This is one of the first dev tools I created - for me was in the "Openclaw days" - early February into March of this year, was using Codex and some local Ollama; where I kept hitting the wall: context limits were rigid and often insufficient. Now with 1M token contexts, and more robust frontier models, etc - the need for the tool is less. I'm now largely using frontier models and honestly use it nearly never. But it was helpful at a moment in time. Might still have value for those running local LLMs with limited contexts.
Also, for full transparency - I snafu'd on my first public project - came up with the name quite organically - "context lens" - searched out ctxlens on npm, found the space open - built the tool. Published it, started getting downloads on day one. Odd. Turns out dabit3 (a real dev) had created a project with the same name on GH and pointed to an npm package he never published. I reached out and offered the namespace to him, and created "tokendu" as a backup repo/package. No response as the interest in the project had presumably faded, so I kept the name. Maintained, for now. ;)
Problems it hoped to solve:
- "Will my project fit in context?" — Instant answer across 23 models from 7 providers. Know you're safe on Claude, tight on GPT-4o, and blown past Grok — without switching tools.
- "Which files are eating my budget?" — Ranked breakdown by file and directory, with bar charts. Find the token hogs the same way du finds disk hogs.
- "How much would I save by stripping comments?" — The diff command shows exact token savings before you change anything. Budget simulation, not guesswork.
- "Can I gate PRs on context budget?" — --ci flag exits non-zero when a threshold is exceeded. Same pattern as bundle size checks.
- "Which tokenizer should I care about?" — Side-by-side comparison of cl100k_base vs o200k_base. Relevant when switching between Claude and GPT families.
- "Is my repo getting bloated for AI?" — Real-time monitoring with watch mode. See utilization change as you code.
ctxlens
Token budget analyzer for AI context windows — like du for tokens.
Every developer using AI coding tools hits the same wall: "Does my codebase fit in context?" You paste files until the model complains, guess at what to include, and hope for the best. ctxlens gives you the answer in one command.
npx ctxlens scan
Why ctxlens
You can't optimize what you don't measure. AI models have hard context limits — 128k, 200k, 1M tokens — and your codebase is competing for space with prompts, conversation history, and tool output. ctxlens tells you exactly where your token budget goes.
Problems it solves
- "Will my project fit in context?" — Instant answer across 23 models from 7 providers. Know you're safe on Claude, tight on GPT-4o, and blown past Grok — without switching tools.
- "Which files are eating my budget?" — Ranked breakdown by file and directory, with bar…
Onward and upward.
Top comments (0)