Make the structured history limits configurable (64 tool entries / 256 KiB)
Summary
When a user sends a follow-up message, the chat client carries over at most 64 earlier tool calls and 256 KiB of earlier tool calls, results and text. Anything older is replaced by "Some history was omitted to keep structured history within 256 KiB and 64 tool entries." Both limits are fixed constants.
I would like to configure both per app. The defaults can stay as they are.
Environment
- Agent Native Core: 0.229.0 (latest stable on 2026-11-18)
- Surface: chat client runtime (sidebar and chat)
Example
A working turn in our app makes 40 to 115 tool calls and returns 280 to 630 KiB of tool results. It starts by reading several instruction files. On the user's next message those earliest reads are the first to be omitted, so the agent reads the same files again on every follow-up. We measured this on an earlier version; the constants are the same in 0.229.0.
Expected behavior
An app can set the maximum tool entries and the maximum bytes of history carried into a follow-up message. Leaving them unset keeps 64 and 256 KiB.
Impact
- Long, tool-heavy turns lose their earliest context on every follow-up, and the agent spends calls and tokens reading it again.
- A third fixed limit conflicts with a setting that is configurable.
toolLimits.maxResultCharscan be raised above 64 KiB, but a single result over 64 KiB is then dropped whole from the next message ("Tool result omitted from history because it exceeds 64 KiB.").
Relevant code (published 0.229.0, read from source)
dist/client/chat/runtime.jsline 1068:const MAX_TOOL_HISTORY_CALLS = 64;- Line 1069:
const MAX_ADDED_TOOL_HISTORY_BYTES = 256 * 1024; - Line 1065:
const MAX_TOOL_HISTORY_VALUE_BYTES = 64 * 1024; boundStructuredToolHistory(line 1470) keeps entries newest first until either limit is reached.
Thanks for the detailed example. The request to configure structured history limits is logged for a maintainer to review.