My challenge is revisiting AI-gen code months later and making sure the AI has the context from our previous work.
How do people handle this?
Do you keep everything in the same conversation thread?
You don't.
The context should be self-evident from the code alone, and if it is not, it should be in your head and you should write it down again so that you do not forget it yourself.
Being forced to re-explain stuff to the LLM is good, actually, as that way, one actually thinks about the architecture, choices and limitations.
Try to keep context shoved in a conversation thread under a token limit to save tokens.
Ask AI to record in a projects directory memory: LOG.md, HANDOFF.md, DECISIONS.md, a plan folder. Reference code with absolute paths. Keep repeatable processes in skills. Version control it all, and use a dreaming process across multiple sessions to stop repeat mistakes.
That's what's worked for me, but there's many variations of this.
Have your agents keep contexts of tasks up to date as they work on stuff.
I've been iterating on this approach for about a year—it makes switching between agents and harnesses trivial.
I usually have a “close out” routine that’s something like telling it to record hints to the project’s agents.md. It’s usually pretty good at figuring out what to save, and I usually set up the prompt to point the thing’s attention at the part of the process that made me most frustrated.
First off, I cannot pretend I have this solved. But I can share one thing that has worked for me, along with codex maintaining it's own local memory (turn it on).
Have your agent maintain a task journal. It is like a more detailed commit history, that includes tribal knowledge gained during the task and additional context, eg.
Reset your context frequently instead of only relying on compaction. Use the following prompt to summarize the current context for the new agent: Give it a try and feel free to share any improvements.