Lean into your Agentic Coder's Mistakes
By Ben Houston, 2025-03-06
This essay expands on an important insight from my original blog post, Agentic Coding Best Practices.
I've recently been experimenting with agentic coding tools like mycoder.ai. Initially, I found myself constantly correcting my AI assistant as it struggled with parts of my codebase I thought were well-organized.
Then I realized something important: instead of making the AI adapt or criticizing it for not being "smart enough", why not learn from its mistakes?
Learning from AI Mistakes
When mycoder.ai repeatedly struggled with deeply nested folders, complex re-export patterns, or too many small packages, I reorganized my projects to fit its expectations.
Human developers usually don't speak up every time they hit confusing parts of the code. Instead, they quietly spend extra time figuring things out. Using AI helps bring these hidden issues into the open. If the AI gets stuck, a human developer probably would too.
It's like compression algorithms: code that's predictable and easy to understand has less "information," making it simpler to work with.
Practical Suggestions to Improve Your Codebase
To make your code more AI-friendly (and more human-friendly too), consider these concrete suggestions:
- Simplify your folder structures by avoiding deep nesting.
- Reduce indirect imports by importing directly from the original files.
- Consolidate functionality into fewer, clearer packages.
- Keep documentation close to the code it describes (not in disconnected Notion docs or Google docs that quickly get out of sync).
- Standardize file organization and naming conventions across your project.
For more details and examples, check out my previous post: Agentic Coding Best Practices.
Reducing the Information Content of Your Code
One way to think about this is from the perspective of compression algorithms. When the AI makes a prediction about your code and it is wrong, it is revealing that the information content of your code base is higher than it was expecting thus forcing a correction. Do you really need a high information content code base? Or could you achieve the same results with something that the AI can more easily predict?
I would argue that you want as low entropy code base, e.g. simple straight forward code, as you can while still solving your problem.
Try It Yourself
Next time your agentic coder struggles, don't just dismiss it. Ask yourself if the AI is pointing out hidden complexity. AI mistakes can help you simplify your codebase for everyone.
Have you experienced something similar? I'd love to hear your thoughts.