Scratchpad
Write working memory to a file instead of carrying it in context — then read back only what the current step needs.
When to use
- A multi-step task where state accumulates (research findings, a todo list, partial results).
- Long agentic runs with many tool calls, where early findings would scroll out of the window.
- The user asks to "track", "remember", or "take notes" across steps.
- You need durability across a context compaction or a fresh session.
When NOT to use
- A short, single-shot task — the file is overhead with no payoff.
- Truly ephemeral scratch math that's consumed in the very next step.
- Secrets or sensitive data that shouldn't be written to disk.
The method (numbered, concrete — the heart)
- Create one canonical file. Pick a stable path and stick to it (e.g.
scratchpad.md or NOTES.md in the working dir). One file the agent always knows where to find.
- Structure it for selective reads. Use clear headed sections —
## Goal, ## Decisions, ## Todo, ## Findings, ## Open questions, ## Dead ends — so you can pull back one section without loading the whole file.
- Write as you go, not at the end. Append a finding the moment you discover it. The point is to get it out of context, so don't hoard it in the conversation first.
- Record decisions with reasons and timestamps. "Chose X over Y because Z" — future reads (and a future you) need the rationale, not just the verdict.
- Keep a live todo with status. Mark items
[ ] / [x] / [blocked]. This is the agent's task ledger; update it after each step.
- Log dead ends. Write down what didn't work and why, so neither you nor a successor repeats it.
- Read back surgically. When you need state, read the relevant section — not the entire file. Treat the file as a database you query, not a blob you reload.
- Reconcile before finishing. At the end (or before a handoff/compaction), make sure the file reflects final reality, then it doubles as your summary source.
What good looks like
- At any moment you could lose the conversation and reconstruct the task from the file.
- The file is the source of truth for todos and decisions; the conversation just acts on it.
- Reads are targeted (one section), keeping live context lean.
- Dead ends and rationales are captured, so the same mistake never gets made twice.
Anti-patterns
- Notes that never leave context — narrating findings in chat but never writing them, so they vanish on compaction.
- Many scattered files — losing track of where state lives; keep it canonical.
- Reloading the whole file every step — re-bloating the window you were trying to protect.
- Write-only scratchpad — recording but never reading back, so the notes do no work.
- Stale ledger — a todo list that no longer matches reality, which is worse than none.
Example (short, vivid)
A migration touching 40 files. Instead of holding progress in context:
# scratchpad.md
## Goal: migrate all API routes from v1 → v2 auth middleware
## Todo
- [x] users.ts
- [x] orders.ts
- [blocked] billing.ts — uses removed `legacyToken`; need product decision
- [ ] 37 remaining (see grep results below)
## Decisions
- 2026-06-28: keep v1 shim for `/webhook/*` (third parties pin old format)
## Dead ends
- Codemod via regex broke template strings — doing AST-based pass instead
The agent appends after each file, reads only ## Todo to pick the next one, and the run survives any reset.
1---2name: scratchpad3description: Offloads notes, todos, decisions, and intermediate findings to an external file outside the context window, then pulls only the relevant pieces back when needed — giving the agent persistent memory that survives context limits and resets. Use this skill when the user says "take notes", "keep track of", "remember this for later", or "make a checklist"; when a task is multi-step or spans many tool calls (roughly 20+); when intermediate findings would otherwise be lost; or whenever you're accumulating state that doesn't need to sit live in the context window.4---56# Scratchpad78Write working memory to a file instead of carrying it in context — then read back only what the current step needs.910## When to use11- A multi-step task where state accumulates (research findings, a todo list, partial results).12- Long agentic runs with many tool calls, where early findings would scroll out of the window.13- The user asks to "track", "remember", or "take notes" across steps.14- You need durability across a context compaction or a fresh session.1516## When NOT to use17- A short, single-shot task — the file is overhead with no payoff.18- Truly ephemeral scratch math that's consumed in the very next step.19- Secrets or sensitive data that shouldn't be written to disk.2021## The method (numbered, concrete — the heart)221. **Create one canonical file.** Pick a stable path and stick to it (e.g. `scratchpad.md` or `NOTES.md` in the working dir). One file the agent always knows where to find.232. **Structure it for selective reads.** Use clear headed sections — `## Goal`, `## Decisions`, `## Todo`, `## Findings`, `## Open questions`, `## Dead ends` — so you can pull back one section without loading the whole file.243. **Write as you go, not at the end.** Append a finding the moment you discover it. The point is to get it *out* of context, so don't hoard it in the conversation first.254. **Record decisions with reasons and timestamps.** "Chose X over Y because Z" — future reads (and a future you) need the rationale, not just the verdict.265. **Keep a live todo with status.** Mark items `[ ]` / `[x]` / `[blocked]`. This is the agent's task ledger; update it after each step.276. **Log dead ends.** Write down what didn't work and why, so neither you nor a successor repeats it.287. **Read back surgically.** When you need state, read the relevant section — not the entire file. Treat the file as a database you query, not a blob you reload.298. **Reconcile before finishing.** At the end (or before a handoff/compaction), make sure the file reflects final reality, then it doubles as your summary source.3031## What good looks like32- At any moment you could lose the conversation and reconstruct the task from the file.33- The file is the source of truth for todos and decisions; the conversation just acts on it.34- Reads are targeted (one section), keeping live context lean.35- Dead ends and rationales are captured, so the same mistake never gets made twice.3637## Anti-patterns38- **Notes that never leave context** — narrating findings in chat but never writing them, so they vanish on compaction.39- **Many scattered files** — losing track of where state lives; keep it canonical.40- **Reloading the whole file every step** — re-bloating the window you were trying to protect.41- **Write-only scratchpad** — recording but never reading back, so the notes do no work.42- **Stale ledger** — a todo list that no longer matches reality, which is worse than none.4344## Example (short, vivid)45A migration touching 40 files. Instead of holding progress in context:4647```markdown48# scratchpad.md49## Goal: migrate all API routes from v1 → v2 auth middleware50## Todo51- [x] users.ts52- [x] orders.ts53- [blocked] billing.ts — uses removed `legacyToken`; need product decision54- [ ] 37 remaining (see grep results below)55## Decisions56- 2026-06-28: keep v1 shim for `/webhook/*` (third parties pin old format)57## Dead ends58- Codemod via regex broke template strings — doing AST-based pass instead59```60The agent appends after each file, reads only `## Todo` to pick the next one, and the run survives any reset.