Reducing Token Usage for Claude Code with Codesight
The author created a tool called Codesight that generates a compact context pack for AI assistants like Claude, reducing token usage by up to 12.3x on real-world codebases.
Why it matters
This tool can significantly reduce the token usage and time required for AI assistants like Claude to understand and work with codebases, making them more efficient and cost-effective.
Key Points
- 1Codesight scans a project and generates files like CODESIGHT.md, routes.md, schema.md, etc. to provide an overview of the codebase
- 2Adding a line to CLAUDE.md tells Claude to read the Codesight files first, avoiding the need to rediscover everything
- 3Codesight uses AST/structured parsing to build accurate routes, schema, components, env vars, and import graph information
- 4Real-world benchmarks show 12.3x reduction in token usage compared to Claude exploring the codebase from scratch
Details
The author found that their Claude Code sessions were burning 25K-60K tokens just to get oriented on medium to large projects, before even starting the actual task. To address this, they built Codesight - a zero-dependency CLI that scans a project and writes a compact context pack for AI assistants. This includes files like CODESIGHT.md (1-2K token overview), routes.md (API routes), schema.md (DB models), components.md (UI components), and more. By adding a line to CLAUDE.md to read these Codesight files first, future conversations can start from a pre-computed map instead of rediscovering everything. Codesight uses AST/structured parsing to build accurate information, not just filename heuristics. Real-world benchmarks show a 12.3x reduction in token usage compared to Claude exploring the codebase from scratch.
No comments yet
Be the first to comment