logoalt Hacker News

tiffanyh • today at 4:35 AM • 5 replies • view on HN

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?


Replies

sheepscreek • today at 4:51 AM

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.

    X is incorrect but we cannot change it due to some other service depending
    on it, don't use Y as it is deprecated in favor of Z.
Reset your context frequently instead of only relying on compaction. Use the following prompt to summarize the current context for the new agent:

    Describe the current project or larger task in progress, then give a 
    breakdown of all the planned sub-tasks with status, explain any learnings,
    then note what work is remaining. Write this in a file called HANDOFF.md
Give it a try and feel free to share any improvements.
hypfer • today at 7:28 AM

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.

bottom999mottob • today at 4:40 AM

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.

➕ show 3 replies
mceachen • today at 6:28 AM

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.

https://photostructure.com/coding/claude-code-tpp/

coeneedell • today at 4:41 AM

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.