summarizeHistory
Purpose and behavior
Section titled “Purpose and behavior”Create a context strategy that, once the serialized history exceeds triggerCharacters, replaces the older messages with a model-written summary and keeps the first prompt and the recent messages. Each summary is one extra model request counted in usage and budgets; an empty or cut-off summary fails the turn with code response.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”optionsOptionalSummarizeHistoryOptions | undefinedHistory size that triggers a summary and number of recent messages kept.options.triggerCharactersOptionalnumber | undefinedLength of the JSON-serialized history above which a summary is made, default 400000 characters. Exact injected text and customization limits.options.keepRecentMessagesOptionalnumber | undefinedMinimum number of recent messages kept after the summary, default 6; the cut moves back to the previous assistant message.
Instructions added by Outpost
Section titled “Instructions added by Outpost”Templates below preserve the English text sent to the model. ${…} marks runtime substitutions, not brief template syntax.
When compaction triggers, Outpost sends this system instruction to the active agent model in a separate summary request:
The user prompt contains the older messages, separated by blank lines. Each message starts with User: or Assistant: . Text blocks are kept; tool calls become [tool call ${name} ${inputJSON}]; results become [tool result] ${content} or [tool error] ${content}. Reasoning blocks are omitted. An empty message list is rendered as (no earlier messages).
The result is inserted into the effective history as a user message, after the first message and before the retained recent messages:
The summary instruction and prefix are fixed. triggerCharacters and keepRecentMessages control when and how much to summarize. A custom context strategy can replace the compaction mechanism, but calling input.summarize() still uses this fixed instruction. The built-in summary request counts toward usage and budgets.
Implementation: context.constants.ts · harness-context.ts · context.ts.

