I just want to talk about failure for a bit. One of the best parts of working with Embedded systems (Arduino and PlatformIO for me) is when you get things right. Somehow all of the fails make it that much more satisfying when things do work.
Example: AI programming
I have been using AI programming heavily for more than two years now. Coding assistants such as GitHub Co-Pilot, Cursor IDE, Cline, Roo Code, gemini-cli, claude-code, opencode and aider (and many more!). All of these have their own way of doing things and take time to set up correctly. When things fail to work you always have to check: is this a failure in my understanding or the tool itself?
The most recent issue I have been addressing with various tools is “Context overrun” – basically the AI coding assistant has a limited amount of tokens or memory which it can use to do it’s text prediction (writing code). Once you fill the context up, the coding assistant needs to either drop some of the text (code) from the “context window” or the response from the associated LLM will be an error.
Some of the assistants have tools to deal with this – which can be simply dropping important files or compressing (summarising) the full text, OR just informing the user (me) that we have an issue. There is no good way to deal with this. We can lose important information either way.
SmartPoi-JS-Utilities
In it’s current form, SmartPoi-js-utilities is mostly a very large html/css/js file which takes up 30 000 tokens of an LLM context window. To put that into perspective, DeepSeek has a Total context window or 65 000 tokens, so just one file is using up half.
I had to re-factor (split the file up) in order to be able to make changes with AI without running out of context. I tried claude, gemini and opencode but none of these worked. They all ran out of context while trying to keep all old and new files in memory simultaneously.
Aider-ce is the best?
Aider is my favourite AI coding assistant. Recently, developments in AI coding such as MCP and LSP meant that Aider was falling behind. So the community came together and added those to a forked version (which is currently still compatible with original aider version): aider-ce (Aider Community Experimentation). This version has a very sophisticated method of tool calls which enable very fine grained edits, something not seen in other AI editing packages – as well as MCP integration and access to built-in language packs (rules about how computer languages are supposed to work.)
In addition to the upgrades mentioned above, the new version incorporates a “todo” system which keeps track of progress (adding Agentic behaviour previously lacking in Aider) – sometimes you want the AI to just “get on with it” and complete a bunch of steps – like re-factoring 30 000 token file!
It’s not perfect, a work in progress actually, but with this new /navigator mode fine-tuned editing capabilities in combination with Aider’s already amazing multi-file editing with git integration I think I have the tools to do almost any job. Certainly we are getting much closer to the ultimate tool for AI assisted coding – for people who care about:
- Open Source
- User Control (you can check every step, /undo at any point)
- Choice (choose MCP service, whether to edit whole or just tiny parts of the file, coose LLM)
Thanks to the Devs at Aider and Aider-CE
I can’t name everyone (Dustin Washington is the maintainer of aider-ce, original Aider created and maintained by Paul Gauthier), but their handles are in the commit messages attached to each painstaking line of code. Making my code almost effortless. It’s not about the code after all, it’s about getting a job done. Teamwork and never giving up.
Conclusion:
I should have called this blog post “A peek under the hood” because that is what we are doing here. At the end of the day the users of SmartPoi don’t care HOW the code is produced, just that it works. If I did it right, the fact that I totally re-factored the entire codebase of SmartPoi-js-utilities should be completely impossible to see from the front end. There is effectively no difference, all it means is that it is now easier for me to work on the code.
The point is that I spent a week doing this so we can move forward with better things – and by the way I did the same for the Magic Poi website. I guess you could say that I just suck at JavaScript.. after all, the Python back-end is just perfect, as-is :-p
Notes:
Even with Aider a full re-factor is not smooth sailing. I used a clever trick to fix the problems after completing the upgrade (problems like missing functions, incorrect addressing..)
git diff main -- Combined_APP/main.js > gitdiff.txt
Then just get the AI to reference the diff and search for any missing functions – or if any errors come up at least we have a working code reference point.
I really must look at the possibility of adding this as a tool to aider-ce. Git is already integrated, so it might just be a simple job to include diff checking for re-factor, which after all is a very common thing for developers to have to do.