Memory and compaction
A session can run for months. Two things keep its history useful: the agent saves what matters, and newt compacts the rest when it grows too long.
Saving facts
Section titled “Saving facts”The built-in remember tool saves one durable fact per call (“Lives in Lisbon”). It is kept in history as an append, like any durable tool.
Compaction
Section titled “Compaction”When live history passes history_budget tokens (60,000 by default, set in the bootstrap), newt compacts right after a turn commits:
- The agent’s own model gets the same prompt plus one instruction.
- It saves anything not yet recorded.
- It calls
checkpointwith its memory, open threads, commitments, decisions and tone.
Nothing is sent while compacting: no outward call runs.
Commitments cannot vanish
Section titled “Commitments cannot vanish”newt refuses a checkpoint that drops a commitment from the previous one, unless the checkpoint lists it as resolved. It also refuses an empty checkpoint, or one longer than a quarter of the budget. The agent gets the refusal as a tool result and tries again.
What later turns see
Section titled “What later turns see”checkpoint → the most recent whole turns that fit in a quarter of the budget → anything saved during the flushRaw history is never deleted. The checkpoint is a cut point, not a replacement. A compaction that fails waits before the next try (ten minutes, doubling, at most a day) and the session keeps running on its long history meanwhile.