Table of Contents

Context cap tuning

IF a turn's input dwarfs its output and the turn is issuing a read-like tool call → THEN enforce a per-file read cap → RESULT the heavy-read tokens are cut, with a larger recovery when the session failed.

The signal in the agentic log

  • Signal: a turn whose input tokens exceed 10× its output tokens and which issues a read-like tool call.
  • Field source: Tokens.InputTokens, Tokens.OutputTokens, ToolCalls.

The setup

  1. Accept the read / context-cap tuning recommendation.
  2. Enforce a 2,000-line-per-file read cap for the tool.

The result

  • The detector recovers 50% of the heavy-read tokens when the session failed (the read did not help it finish) and 20% when it succeeded (some of the read was useful).
  • The cap is a per-file limit, so it does not block the legitimate wide reads that actually matter.

Behind it