Scratchpad Pattern
Definition
A durable-context pattern where the agent actively maintains a dense, structured file (e.g. Scratchpad.md) of key findings, architectural maps, and decisions, and references it instead of raw message history.
Key points
- The decay it fixes: in extended sessions (30+ minutes) accumulated token bloat causes the agent to give inconsistent answers about early discoveries; engineers end up repeating information.
- The pattern: the agent records Key Findings, an Architectural Map, and Decisions into a structured file and re-reads that dense file for later questions — not the full transcript.
- A form of external memory that sidesteps Context Rot, Lost In The Middle, and Progressive Summarisation Risk by keeping a compact source of truth.
- Complements Server-side Compaction and
/compact; also used to persist state across context windows and for crash recovery (structured state exports / manifests loaded on resume).
Why it matters for the exam
- Long-session / extended-exploration scenarios: the right fix for "inconsistent answers about early findings" is a scratchpad file, not re-reading everything.
Common gotchas
- Re-reading the whole transcript (or re-summarising it) instead of a dense scratchpad — reintroduces the very bloat you're fighting.
- Note: "inconsistent answers" caused by token bloat over a long session points to a scratchpad; "inconsistent answers" from a missing/incomplete system prompt is a different diagnosis (see the quick map).
See also
Sources
Referenced by
Practice questions optional · AI
Generate fresh practice questions about this concept with AI. These are not vault-verified.