SimonHarris.co

The emergence of LLM sympathy in our codebases

When you get to a certain level in programming you start thinking about ‘mechanical sympathy’ while writing your code. This is where you consider the underlying architecture of the computer when you write your code to maximise performance. You learn, for example, that iterating forward through arrays is faster than iterating through objects because the contiguous memory layout allows for the CPU L2 cache to prefetch information.

With modern LLM code-gen tooling powered by a ‘next wave’ of IDEs like Cursor we are starting to see a new type of sympathy in our codebases - an LLM sympathy. I first noticed this on a personal project I was making, experimenting with ClaudeAI’s ‘projects’ feature whilst refactoring a codebase. I was looking for a way to load this into the Claude project so it had the context for the entire codebase and came across Repopack. This lets you combine all of your code into a well structured text file that you can feed to an LLM for context. I realised while using this that the LLM was getting confused as to what was refactored code architecture and what was original code architecture. To combat this I restructured my project to have the old code in a completely separate directory and used Repopack on each code directory separately so I ended up with effectively old_code.txt and new_code.txt.

It wasn’t until later that it occurred to me that I had restructured my project to make it more LLM understandable - and this is likely my first instance of ‘LLM sympathy’. Structuring my code specifically to help the LLM tooling I was using to build it. I've noticed other people doing this too:

@marckohlbrugge says that he has found himself structuring his code better to make it more understandable to LLMs https://x.com/marckohlbrugge/status/1832926383376379947

photograph of jrr tolkien

@mikker is hiding prompts inside his codebase: https://x.com/mikker/status/1830958966936924475

photograph of jrr sympathy

@zbeyens is cooking up entire project frameworks based on LLM sympathy https://x.com/zbeyens/status/1832345581617926231

photograph of jrr sympathy

I think this concept will only grow going forward, with LLM code-gen already so powerful and likely going to get better in the future. Something worth keeping an eye on if you're interested in the future of coding.

Thanks for reading. Get in touch if you want to chat. @simonharrisco