logoalt Hacker News

socketcluster • today at 2:32 AM • 0 replies • view on HN

If your files are named well and codebase is of reasonable size, it will find them and re-use them. I haven't experienced the problem of duplicate functions at all on any of my personal projects. The trick is that my code is separated into distinct modules in a clear hierarchy with one-way dependency; no module has more than 5k lines total, no more than 20 files or so. Basically, I treat every part of my system as an independent, fully self-contained black-box product which could potentially be used by third-parties in different business domains. The interface of each module is generally quite simple and it doesn't expose any internal details.

My AI agent never has to work with more than 5k lines of code and like 20 files at a time; and most are much smaller than that; like 1k or 2k lines... Even though one of my projects is almost 30k lines, my AI agent never has to consider more than 5k.

It's a very different experience in my day job because the project has more lines, more files and all the files for the entire project are in the same repo and naming is not as clear. In this case, I have to point to the relevant files/context in every session.