feat(core): elide historic video-mode frames from model context

Video-mode webcam and screen-share frames matter for the response they
were captured for; afterwards the assistant's own text carries the
takeaway and fresh frames arrive with every new call message, yet each
message's frames (~10k tokens) were resent on every subsequent model
call. The elision decorator now strips image parts from prior-turn user
messages, leaving a text part recording how many frames of each kind
were dropped. The current turn's just-captured frames are always sent
verbatim, and the policy generalizes the existing config
(elideHistoricImages, default on).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Arjun 2026-07-07 03:24:44 +05:30 committed by Ramnique Singh
parent 99f196e16c
commit 05d7fa41cf
3 changed files with 182 additions and 43 deletions

View file

@ -393,14 +393,18 @@ Rules:
The app wires the resolver through a decorator (`context-elision.ts`) that
applies transmit-time elision to the materialized prefix: tool results from
prior turns above a size threshold are replaced with a short placeholder
telling the model to re-run the tool if it needs the output. The durable log
is untouched; only the transmitted bytes change. Elision is a pure function
of each message, so resolved prefixes stay byte-stable across calls (provider
prefix caches keep working), and the current turn's own in-flight tool
results never pass through the resolver, so they are always sent verbatim.
Policy lives in `config/context.json` (`elideHistoricToolResults`, default
true; `elideHistoricToolResultsThresholdChars`, default 10000). The inspect
CLI composes through the same decorated resolver.
telling the model to re-run the tool if it needs the output, and inline
image parts from prior turns (video-mode webcam and screen-share frames) are
replaced with a text part recording how many frames of each kind were
dropped. The durable log is untouched; only the transmitted bytes change.
Elision is a pure function of each message, so resolved prefixes stay
byte-stable across calls (provider prefix caches keep working), and the
current turn's own messages never pass through the resolver, so in-flight
tool results and just-captured frames are always sent verbatim. Policy lives
in `config/context.json` (`elideHistoricToolResults`, default true;
`elideHistoricToolResultsThresholdChars`, default 10000;
`elideHistoricImages`, default true). The inspect CLI composes through the
same decorated resolver.
### 6.7 Agent snapshot inheritance