一键导入
scratchpad
Use a notes file in your workspace as working memory during a task
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use a notes file in your workspace as working memory during a task
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Systematically investigate a bug or unexpected behaviour to identify the root cause
Improve the structure of existing code without changing its external behaviour
Perform a structured, constructive code review of the provided changes
| name | Scratchpad |
| description | Use a notes file in your workspace as working memory during a task |
You don't have unlimited short-term memory. A multi-step task — a bug hunt, a refactor, a code review — benefits from externalising what you've learned so you can come back to it later in the same task, even after a context compaction.
The convention in this codebase: use the file tools. There is no separate scratchpad tool. Pick a filename, write Markdown to it, read it back when you need to.
Find your identifier. Your system prompt's runtime-metadata
layer contains a line like Agent ID: <id>. Copy that <id>
verbatim — it uniquely identifies you across all concurrent tasks
in this workspace. If for some reason you don't see an Agent ID
line (legacy config, local dev), fall back to any other stable
identifier you have access to: the thread timestamp the user's
message came from, a short slug you invent and stick with for the
whole task, or a bash date +%s epoch. Whatever you pick, use
the same identifier everywhere in this task — filename and
file header.
Check what's already there, then pick a task-specific path that embeds your identifier. The workspace is shared across sessions — other agents (or past runs of you) may have left notes files behind. Before you write anything:
list_directory on the workspace root to see existing
files. Look for anything matching notes*.md or *-notes.md.notes-<task-slug>-<agent-id>.md. The task slug is a short
lowercase-kebab-case description of the work; the agent id is
the identifier from step 1 (truncate long UUIDs to 8 chars for
readability). Examples:
notes-auth-refactor-a3f1b9c2.mdnotes-flaky-ci-1729531200.mdnotes-review-cl-12345-a3f1b9c2.mdnotes-bug-slow-startup-a3f1b9c2.mdnotes.md. It's guaranteed to collide
the moment a second agent runs in the same workspace, and
concurrent appends without locking silently lose writes.read_file it,
check the Owner: line in the header (step 3), and decide:
Start the file with an ownership header. The first thing you write should be a small metadata block so anyone (including future you) reading this file can tell at a glance whose it is and what task it's tracking:
# notes-auth-refactor-a3f1b9c2.md
Owner: a3f1b9c2
Task: Consolidate session-token validation helpers
Started: 2026-04-15T14:32:00Z
The Owner: line is the contract. It lets step 2.4 work — any
agent reading a notes file can compare Owner: against its own
identifier and know immediately whether the file is theirs.
Write structured Markdown with ##-level sections so you (and
the compactor) can scan it later:
## Goal — what you're trying to accomplish.## Plan — numbered steps you intend to execute.## Evidence — raw observations from read_file, grep, bash.## Hypotheses — candidate explanations during debugging.## Decisions — choices you've made and why, so you don't
re-litigate them later.## Open questions — things you couldn't resolve alone.Append as you go (edit_file with a small old_string / larger
new_string, or write_file with the full updated contents). Don't
wait until the end of the task — intermediate notes are the whole
point.
Re-read the file whenever you resume work, re-plan, or get confused about where you are.
read_file or grep.| Do | Don't |
|---|---|
list_directory first, inspect what's already there | Write blindly and hope for the best |
notes-<task-slug>-<agent-id>.md | notes.md or notes-<task>.md without an id |
Copy your Agent ID from the runtime-metadata layer of the system prompt | Invent a new id on every round — use one identifier per task |
First line after the title: Owner: <agent-id> | Skip the header and rely on the filename alone |
read_file a pre-existing match and check its Owner: line | Overwrite an existing notes file without reading it |
lowercase-kebab-case slug (notes-auth-refactor-a3f1b9c2.md) | PascalCase / spaces / emoji in the filename |
| One notes file per distinct task | One shared notes file across unrelated tasks |
If two concurrent tasks ever land in the same workspace without unique ids, one will silently clobber the other's working memory. There are no locks on these files and no warning on overwrite — the identifier is your only safety net.
Assume your system prompt contains Agent ID: a3f1b9c2-7d4e-4a11-….
You truncate to the first 8 chars, pick a task slug, and write:
# notes-auth-refactor-a3f1b9c2.md
Owner: a3f1b9c2
Task: Consolidate session-token validation helpers
Started: 2026-04-15T14:32:00Z
## Goal
Consolidate the three copies of session-token validation into a single
helper in `auth/session.py`.
## Plan
1. Read call sites (`grep "validate_token" src/`)
2. Identify the common contract
3. Write the helper + tests
4. Update call sites one by one, run tests after each
## Evidence
- 3 copies: `auth/login.py:45`, `api/middleware.py:78`, `admin/session.py:22`
- The admin copy has a bug: it forgets to check expiry. Track this separately.
## Decisions
- Keep the signature boolean-returning (not exception-raising) to match
the two correct call sites.
That file — written with write_file, updated with edit_file, read
with read_file — is your scratchpad. No special tooling required.
The filename stem (a3f1b9c2) and the Owner: line inside are the same
identifier; either alone tells anyone who opens this file that it
belongs to you.