Structured Notes, Attention Recitation, and Recursive Slicing
Explore how to maintain structured notes across agent turns, keep the current plan near the end of context, and verify completed tasks against tool traces. Learn to process oversized documents with map-reduce, recursive slicing, token checks, and save-first model output.
We'll cover the following...
In the previous lesson, we compacted a long session by saving the older turns to a file and replacing them with a summary. This reduces the number of tokens in the active conversation history. However, compaction does not explicitly track task progress. Suppose an engineer asks, “What’s left before we can close this incident?” The information needed to answer this question is distributed across recent turns and the compacted summary. The assistant would need to reconstruct its task progress from the conversation history each time.
In this lesson, we'll introduce a structured notes file that stores the assistant's findings and task list and is updated after every turn. We'll append the contents of the notes file to the model's input context on each call, placing the current plan at the end of the context. We'll also verify that each completed task is supported by evidence from a corresponding tool call. We'll then address another context management challenge: processing documents that exceed the available token budget for a single model call. We'll split the document into chunks, summarize each chunk independently, and combine the resulting summaries.
Keep the plan in notes
Before closing an incident, the on-call engineer must complete a checklist: identify the change responsible for the latency spike, verify that latency has returned to acceptable levels and that the required runbook steps were completed, page the owning team, and determine whether a rollback is necessary. We'll use this checklist as the assistant's task list.
The notes file holds two sections:
Findings: One entry per completed task, with supporting evidence such as a document ID or a reference to the relevant tool result.
To-do: All checklist items, marked
[x]when completed and[ ]when pending. Pending items appear at the end of the list.
This approach is commonly referred to as structured note-taking. The agent persists notes in external storage and loads them into its context on subsequent turns. The key implementation detail is the file update strategy. After each turn, we regenerate the entire notes file from the current state rather than append new entries.