Menu

How do you keep an agent's early constraints alive after the context gets compacted?

#golang#redditgolang#suga#long#handoff
Reading 0:00
15s threshold

I maintain suga, a coding agent written in Go that I use for my own work every day. The thing I keep running into is long sessions: once the context fills up and gets summarized, the constraint I gave in turn 1 ("don't touch vendor/") is exactly what disappears.

What I ended up doing in suga: instead of summarizing, it starts a new segment that opens with a handoff in a fixed shape. The section with hard constraints and the user's own words is copied verbatim with no size limit. Every other section has a byte budget. Before the budgets, the handoff in one 14-turn session grew from 4.7 KB to 16 KB, because each one folded in the whole previous one.

Two things that surprised me:

I capped the output of the model call that writes the handoff. Unit tests and fake-model evals passed.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.