Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Scratchpad

The scratchpad is a session-scoped working memory that the agent can use to store, retrieve, edit, and manage content without consuming conversation context. Entries are identified by string names and persist across turns within a session.

When the Scratchpad is Used

  • Proactively: The agent stores intermediate results (extracted text, API responses, research notes) for later use.
  • Via scratchpad parameter: Any tool can save its output directly to the scratchpad by including a scratchpad parameter in the tool call.
  • Automatically: When a tool’s output exceeds 30,000 characters, it is saved to the scratchpad under an auto-generated name (e.g., execute_command_1) and replaced with a preview in the conversation.

Tools

All five tools below ship default-active; no load_tool round-trip is required to use any of them.

scratchpad_write

Store content in the scratchpad. If the name already exists, the content is overwritten.

Permission: Read

NameTypeRequiredDescription
namestringyesName for the entry
contentstringyesThe content to store

scratchpad_read

Read or search a scratchpad entry by name.

Permission: Read

NameTypeRequiredDescription
namestringyesThe entry name
offsetintegernoCharacter offset to start reading from (default: 0)
limitintegernoMaximum characters to return; no hard cap. Pass the entry’s size to load all content in one call. (Default and exact value are advertised in the tool’s parameter schema.)
regexstringnoSearch the entry and return matching lines (capped, exact value advertised in the tool’s parameter schema).

scratchpad_edit

Edit a scratchpad entry in place. Provide content for a full overwrite, or old_string/new_string for targeted replacement.

Permission: Read

NameTypeRequiredDescription
namestringyesThe entry name
contentstringnoFull replacement (mutually exclusive with old/new)
old_stringstringnoString to find
new_stringstringnoReplacement string
replace_allbooleannoReplace all occurrences (default: false)

scratchpad_list

List all scratchpad entries with their name, size, and creation time. No parameters.

Permission: Read

scratchpad_delete

Delete a scratchpad entry by name.

Permission: Read

NameTypeRequiredDescription
namestringyesThe entry name to delete

Lifecycle

  • Entries are scoped to the session and persist across turns.
  • Entries survive session compaction (/compact).
  • Entries are deleted when the session is deleted.
  • Two sessions can have entries with the same name without conflict.
  • Writing to an existing name overwrites it silently.