After optimizing my CI logs for AI agents, I found myself looking for tokens everywhere.
Then I had another idea.
Many of my files and directories used kebab-case.
My assumption was simple: if - increases token count, then switching everything to camelCase might reduce the amount of context an AI agent has to process.
So instead of guessing, I measured it.
I wrote a script to tokenize my entire repository before and after renaming every kebab-case path to camelCase.
- Repository before: 376,553 tokens
- Repository after: 376,204 tokens
Total reduction: 349 tokens.
Honestly? That was much smaller than I expected.
At first glance, this looks like a classic micro-optimization. But I don't think the story ends there.
Why File Paths Matter More Than You Think
Unlike source code, file and directory names have a very different lifecycle during an AI coding session.
An agent doesn't read them just once. They appear repeatedly in:
- imports and exports
- directory listings
- search results
- git diffs
- stack traces
- test output
- formatter and linter logs
- tool responses from the IDE
In other words, file paths are part of the agent's working context over and over again.
So while the repository itself became only 349 tokens smaller, the cumulative savings across a long coding session could be noticeably larger because those same paths are processed repeatedly.
I haven't measured that part yet, so I won't claim any specific numbers.
Conclusion
This experiment reminded me of something more important:
Measure first. Optimize second.
Some optimizations that sound brilliant turn out to be negligible. Others—like reducing unnecessary tool output—have a much larger impact than you'd expect.
AI-assisted development is creating a whole new class of performance optimizations. The only way to know which ones matter is to measure them.
What micro-optimizations have you tested for your AI coding agents? Did they actually move the needle, or did the data surprise you? Let me know in the comments!
Top comments (0)