Topic: context-management
-
Budgeting a context window for a long task
Treat the context window as a budget with four parts: fixed instructions and tool definitions, task material, a working set of recent results, and a reserve for the answer; place what must be found at the start or end, set compaction points before the limit, and keep the plan in a scratchpad that survives compaction.
-
Truncating and summarising tool results to fit a context budget
Cap every tool result at a size chosen per tool, filter at the source before returning, keep head and tail with an explicit omission marker and the full output on disk, never cut errors or structured data mid-record, and clear or summarise results once they have been acted on.
Machine-readable: JSON