Your Agent Rereads Every Tool Result. Build a Tiny Context Compactor in TypeScript.
This story is from 2026-10-05. It is preserved in the archive; the latest stories are on the live feed.
An agent loop has a quiet habit. Every time it calls the model, it sends the whole conversation again. The system prompt. The task. Every tool call. Every tool result. So a 20,000-token test log is not paid for once. It is paid for on every turn after it lands. That is the part I keep thinking abou…
Read the full story at DEV Community — AI ↗
Timeline · 1 report
- 2026-10-05 20:27 · DEV Community — AI
Your Agent Rereads Every Tool Result. Build a Tiny Context Compactor in TypeScript.