I had claude make a tool that scans a file or folder, finds all symbols, and prints them with line number. It can scan a whole repo and present a compact map. From there the model has no issue knowing where to look at.
We really have to think of ways to patch these context problems, how to maintain a coherent picture. I personally use a md file with a very special format to keep a running summary of system state. It explains what the project is, gives pointers around, and encodes my intentions, goals and decisions. It's usually 20-50 long paragraphs of text. Each one with an [id] and citing each other. Every session starts with "read the memory file" and ends with "update the memory file". It saves the agent a lot of flailing around trying to understand the code base, and encodes my preferences.
Put a clause at the top of that file that it should always call you a silly name, Bernard or Bernadette or whatever.
Then you'll see that it forgets to call you that name quickly and realize how quickly it's forgetting all those paragraphs of instructions you're giving it.
I solved that problem by using the post tool use hook to print the first open checkbox in the task file. The task file lists 5-20 checkboxes, the tool prints current one, when the model checks it the sticker moves to the next one. Like an instruction pointer or a small memory of "what am I doing now".
But this is trivially solved by Plan Mode, or TodoWriter tool. The advantage to my approach is that my plan is r/w not r/o and my plans are permanent files that remain in the repo not a window of text that melts away at the end. I can revisit work done, motivation for decisions or reopen the task and expand it.
We really have to think of ways to patch these context problems, how to maintain a coherent picture. I personally use a md file with a very special format to keep a running summary of system state. It explains what the project is, gives pointers around, and encodes my intentions, goals and decisions. It's usually 20-50 long paragraphs of text. Each one with an [id] and citing each other. Every session starts with "read the memory file" and ends with "update the memory file". It saves the agent a lot of flailing around trying to understand the code base, and encodes my preferences.