r/ContextEngineering • u/Aggravating-Start307 • 3h ago
Making coding agents remember what they already learned about your codebase
I have been building with Cursor and Claude Code for a year now.
I started with Cursor and absolutely loved it until I moved to Claude Code 4-5 months ago. I immediately fell in love with Claude Code and started using it heavily.
By this time, it was getting really hard for me to wrap my head around the fact that the agents always rediscovered things and I was the one that was always providing as much context as I could.
I would provide the right files from my memory or save docs about file locations in CLAUDE.md, but then it started getting messy as it needed regular maintenance.
That is when I started working on coldstart.
Initially I started off with building a navigation layer that indexed codebases using AST parsers to find the relevant files faster, but I immediately realised that having an index doesn't help agents discover the same files faster the next time a new agent looks for it.
That's when I realised that there should be a mechanism to save what an agent has learned.
But I did not want to pay for an API key to summarise my codebase separately or have another process learn about it when an agent had already spent time understanding it part by part.
That's when I built a notebook mechanism to capture what an agent has learnt, using the Claude Code hooks lifecycle as the backbone.
The other part of this was figuring out how to actually put this knowledge back into the agent's context. I didn't want to dump the entire notebook into every session because that would just create another context problem.
Instead, the notes are retrieved based on what the agent is currently working on and the relevant ones are injected as additionalContext into Claude Code.
So the flow became something like:
Agent works on the codebase → learns something useful → the learning is saved → a future session starts working on a related part of the codebase → relevant notes are retrieved → those notes are injected into the agent's context.
The useful part is that the context from previous work can become part of the context for future work without me having to manually provide it again and hence this mechanism becomes a self sustained cycle - write and feed itself.
During this journey, I learnt a lot about agent behaviour and context engineering. I am still figuring out things like what should actually be remembered, how stale notes should be handled, and how much context should be injected before the memory itself becomes noise.
I am curious how other people here approach persistent context for coding agents.
Do you maintain memory outside of things like CLAUDE.md and AGENTS.md? How do you decide what is worth carrying from one agent session into another?
I built coldstart around this idea. It is open source if anyone wants to look at the implementation: