Compaction: the model's notes replace the middle of a long run (#158)
Before each driver call, over compact_at (0.6) of the prompt budget, the same model is asked for notes over the very request it was about to get, plus one message, so the server's cache covers all but the notes. The notes, with code's list of the calls they replace, become a compaction event that renders in place of its range, keeping word for word what started the work and the last few turns. Rare, large steps keep the prompt's start unchanged between them. A later compaction folds in the earlier; one from an earlier run's view is hidden. Failed notes are logged and fitting takes over. Fitting now applies compactions before it measures, records what it cuts (Trim) and logs each cut as context.trimmed. Wired into both agents' drivers and the benchmark; nisse-dev's helper loop is a follow-up. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk
This commit is contained in:
1 parent
fa8d93cf41
commit
cb638fe687
20 files changed
+952
-44
No files matched your search
@@ -332,9 +332,15 @@ logs the outage; interrupted outbound effects are covered by intents (L8).
|
||||
### L6. Context and memory
|
||||
|
||||
**1. The working context of one model call** is rendered from the log at call time
|
||||
for one role, fitted to that model's window, and never stored. Fitting never drops
|
||||
the system prompt, the current plan or the most recent turns; a call that still
|
||||
doesn't fit fails (L9).
|
||||
for one role, fitted to that model's window, and never stored.
|
||||
- **A long run is compacted:** well before the window fills, the model's own
|
||||
notes replace the middle of its run in one step (a `compaction` event, L7),
|
||||
keeping word for word what started the work and its last few turns. Rare,
|
||||
large steps keep the start of the prompt unchanged between them, so the
|
||||
model server reuses its cache.
|
||||
- **Fitting is the last guard:** it never drops the system prompt, the current
|
||||
plan or the most recent turns, and a call that still doesn't fit fails (L9).
|
||||
Each cut it makes is logged; after compaction one is a sign of trouble.
|
||||
|
||||
**2. The work-item transcript** (the log, L7) is durable and scoped to one item:
|
||||
nothing crosses items, and agent-level calls (switching, duty runs) see other items
|
||||
|
||||
Reference in new issue
Block a user