Manage context and skills
Keep model history within bounds and load task-specific instructions when needed.
Limit history size
Section titled “Limit history size”Choose a context strategy to reduce the history sent to the model as a conversation grows. Outpost can summarize older messages or keep only a bounded part of the history; the stored transcript remains available.
Once the serialized history exceeds 200,000 characters, the model summarizes the older messages. The next request carries the first prompt, the summary and at least the six most recent messages.
Choose a strategy
Section titled “Choose a strategy”API reference: summarizeHistory, truncateToolResults and HarnessContextStrategyOptions.
A summary uses the agent’s model and provider. Its tokens count in the turn’s usage and in the harness limits.usage budget.
Write a custom strategy
Section titled “Write a custom strategy”Compose strategies when a conversation needs both shorter tool results and a summary. This example applies the two in that order.
API reference: HarnessContextStrategyOptions and HarnessContextInput.
The returned list must start and end with a user message and keep each tool call with its result. Outpost validates it and removes replayed reasoning blocks before the next request.
Compaction and the stored transcript
Section titled “Compaction and the stored transcript”Compaction changes what the model receives, not what is stored. The transcript keeps every earlier message and records each compaction; continuing the conversation resumes from the compacted history. Observers receive a compaction event with the strategy name and the message count.
Write the system instructions
Section titled “Write the system instructions”API reference: HarnessInstructionsOption and HarnessSkillOptions.
Load the project’s AGENTS.md from the borrowed sandbox to build the system instructions. The example uses its content when the file can be read, and returns an empty string otherwise.
Pass instructions: ["Answer with evidence.", projectGuidance]. The resolver receives the borrowed sandbox, the signal, the model and, when the harness declares MCP servers, an mcp accessor for their prompts.
Load skills on demand
Section titled “Load skills on demand”A skill is guidance and tools the model loads only when it needs them. Its instructions stay out of the system prompt until then.
The script prints review [ 'git' ]: the skill name and the tools it unlocks. Pass it with createHarness({ skills: [review] }).
API reference: HarnessInstructionsOption and HarnessSkillOptions.
Limits
Section titled “Limits”summarizeHistory()measures serialized characters, not tokens. Leave a margin when you sizetriggerCharactersfrom the model’s window.- An incomplete or empty summary fails the turn with code
response. - A compaction that removes the
load_skillcall locks that skill’s tools again until the model reloads it. - Skill tool definitions are sent with every request, loaded or not; skills save instruction text, not tool schemas.
conversations: falsestops storing the transcript and disables continuation and response repairs (Conversations).
API: summarizeHistory · truncateToolResults · defineHarnessContextStrategy · defineHarnessInstructions · defineHarnessSkill · HarnessOptions.