DEV Community

hiam
hiam

Posted on

Local AST scanner that reduces AI coding agent token costs

Current AI coding agents (Cursor, Claude Code, Codex) re-read entire repositories on every new session or follow-up question, which increases token costs. Having large repos in context windows can also reduce output quality as models get distracted by irrelevant files.
I built a lightweight open-source tool to address this. It runs a local AST and dependency scan to map files, symbols, and code relationships first, then routes the agent only to files needed for a specific task instead of the whole repo.

On our repos, we're seeing ~60% lower token costs and more focused code output. It's local-first, works with MCP setups, and is open-source.

Would appreciate feedback on the architecture and how others are handling context limits on larger codebases.

GitHub: https://github.com/kunal12203/Codex-CLI-Compact

Top comments (0)