---
id: "action-tool-call-offloading"
type: "action-item"
source_timestamps: ["§ Battling Context Rot"]
tags: ["context-management"]
related: ["concept-tool-call-offloading", "concept-context-rot", "concept-filesystem-primitive"]
action: "Truncate large tool outputs in context to head/tail tokens, saving the full output to disk."
outcome: "Prevents context rot while preserving access to full tool output data."
speakers: ["Vivek Trivedy"]
---
# Implement Tool Call Offloading

## Action

**Truncate large tool outputs in context to head/tail tokens, saving the full output to disk.**

## How

Configure the harness middleware so that whenever a tool output exceeds a size threshold:

1. Only the **head and tail tokens** are kept in the active context window.
2. The **full output is written to the [[concept-filesystem-primitive|filesystem]]** at a known path.
3. The model is shown the path / handle so it can re-read the full data on demand.

This is the operational expression of [[concept-tool-call-offloading]].

## Expected Outcome

Prevents [[concept-context-rot|context rot]] from noisy or oversized tool outputs while preserving full data access on demand.

## Tuning Notes

- The size threshold and head/tail token counts should be tuned per domain (logs differ from code dumps differ from API JSON).
- Pair with [[concept-compaction]] for older-context summarization and [[concept-progressive-disclosure]] for tool-catalog management.
