From 331a5eda4e32dc81dc4018093940dcf161d3d802 Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Tue, 7 Jul 2026 20:23:18 +0530 Subject: [PATCH] feat(core): lower default tool-result elision threshold to 2500 chars Real session data shows ~5k-char skill bodies are the most common oversized historic result; the 10k default replayed them on every model call for the life of the session. With the head preview in place the model retains enough scent to re-load on demand, so the aggressive default is the right trade. Still tunable via config/context.json. Co-Authored-By: Claude Fable 5 --- apps/x/packages/core/docs/turn-runtime-design.md | 2 +- apps/x/packages/core/src/turns/context-elision.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/x/packages/core/docs/turn-runtime-design.md b/apps/x/packages/core/docs/turn-runtime-design.md index b6bb53b0..620a0ad8 100644 --- a/apps/x/packages/core/docs/turn-runtime-design.md +++ b/apps/x/packages/core/docs/turn-runtime-design.md @@ -405,7 +405,7 @@ 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; +`elideHistoricToolResultsThresholdChars`, default 2500; `elideHistoricImages`, default true; `elideHistoricMiddlePaneContent`, default true). The inspect CLI composes through the same decorated resolver. diff --git a/apps/x/packages/core/src/turns/context-elision.ts b/apps/x/packages/core/src/turns/context-elision.ts index 22ff2d6f..4db63a57 100644 --- a/apps/x/packages/core/src/turns/context-elision.ts +++ b/apps/x/packages/core/src/turns/context-elision.ts @@ -43,9 +43,13 @@ export interface ElisionPolicy { middlePaneContent: boolean; } +// Threshold rationale: ~2,500 chars ≈ 600 tokens. Observed sessions show +// skill bodies at ~5k chars are the most common oversized result, so 10k +// would replay them forever; the head preview plus re-run hint makes the +// lower cut safe. Tunable via config/context.json. export const DEFAULT_ELISION_POLICY: ElisionPolicy = { toolResults: true, - toolResultThresholdChars: 10_000, + toolResultThresholdChars: 2_500, images: true, middlePaneContent: true, };