Context re-read every turn
IF a session's input tokens climb sharply turn over turn, or plateau at a large context → THEN cap the context at the session median and stop re-sending the whole transcript → RESULT the tokens above the median are no longer paid on every turn, and the projection is attributed to the recommendation.
The signal in the agentic log
The sub-agent context reduction detector looks at each session's per-turn input size.
- Growth signal: last-turn input > 3× the first turn and a slope > 5,000 tokens/turn.
- Plateau signal: a plateau of ≥ 3 turns at an average context of ≥ 20,000 tokens.
- Field source:
TurnSeq,Tokens.InputTokens,SessionId,ToolCalls.
The setup
- Accept the sub-agent context reduction recommendation.
- The recommended cap is the session median token level — prune tool output and resend only what the next turn needs, rather than the full transcript.
- Apply the policy so the SDK enforces the cap.
The result
- Tokens above the median are removed from subsequent turns.
- Projected monthly savings = excess tokens × the input price, and the actual reduction appears in the savings view once sessions run under the cap.
Behind it
- Detector: sub-agent context reduction.
- Related: Context cap tuning for the per-read variant, and Cache written but never read if the same prefix is re-sent.