<< Home | Work
Reduced token usage from 169k to 2.9k
| Area | Work |
| AI used | Claude Code |
| Source | r/claudeskills |
| Posted | 2026-10-25 |
The move
Create a local AST code map and add a rule to CLAUDE.md to force the AI to query the map before reading project files.Steps
- Install a local AST code mapping tool like graphify in your project directory.
- Generate a code map of your project structure.
- Add a rule to your CLAUDE.md file instructing the AI to consult the map before reading individual files.
- Execute the mapping command whenever the project structure changes.
Prompt for your AI
Analyze my project structure using the provided code map. Before reading any files, identify the specific file paths required to answer this question: [Insert your technical question here].
What happened
The user found that Claude Code was consuming excessive tokens by reading entire project files to locate information. They integrated a local AST code map tool called graphify into a custom skill. By running this map, the AI now references the code structure first, significantly reducing token consumption for complex queries.Watch out
The code map may become outdated if you do not regenerate it after significant file changes. It does not index documentation files.Give it to your agent
Read https://howtheyuse.ai/p/reduced-token-usage-from-169k-to-2-9k.md and help me do this.