[FEATURE] Scratchpad should persist beyond session and be user-accessible by default
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Claude Code's scratchpad directory (e.g., /tmp/claude/<encoded-cwd>/<session-id>/scratchpad/) has two fundamental design issues:
1. Visibility: When a user says "write a draft and I'll review it", Claude writes to the scratchpad. But the scratchpad is inside /tmp, which is:
- Not easily accessible on many setups (e.g., Dev Containers, remote environments)
- Requires the user to understand Claude Code's internal directory structure
The user has to know about scratchpad, know it's in /tmp, and explicitly say "write to a project directory instead". This defeats the purpose of an LLM tool that should infer user intent.
2. Persistence: Scratchpad is in /tmp, which is volatile:
- Dev Container restart = gone
- OS reboot = gone
- tmpfs expiration = gone
This matters because LLM outputs are non-deterministic. Unlike script outputs that can be regenerated, LLM artifacts are one-of-a-kind. Losing them means re-spending API tokens for a potentially different result.
Key insight: Scratchpad is fundamentally different from transcripts.
- Transcripts: Raw logs, primarily for debugging/auditing. Volatility is acceptable.
- Scratchpad: Intentional artifacts that humans review, iterate on, and verify. Should persist.
Proposed Solution
- Make scratchpad location configurable via:
- CLI flag or environment variable, AND/OR
CLAUDE.md/ settings.json
- Document the scratchpad behavior clearly:
- Where it lives by default
- How to change it
- What gets written there
- Move default location out of
/tmp:
~/.claude/scratchpad/or similar- At minimum, respect
$TMPDIR/$CLAUDE_CODE_TMPDIR
Alternative Solutions
Current workaround: Explicitly instruct Claude to write to a project directory instead of scratchpad. This requires knowing the internal behavior, which most users shouldn't need to.
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
- User: "Write a document summarizing Git/GitHub procedures for Claude Code to follow. I'll review it before we finalize."
- Claude writes to
/tmp/claude/.../scratchpad/git-procedures.md - Claude: "Done! I've written the document."
- User: "...where? I don't see it in my project."
- User has to either:
- Ask Claude to
catthe file (wastes context) - Navigate to the scratchpad path manually (requires knowing the internal structure)
- Ask Claude to copy it to the project (extra step that shouldn't be needed)
Expected: When the user says "I'll review it", Claude should write to a location the user can easily access.
Additional Context
Related issues that focus on /tmp path conflicts but not the persistence/visibility problem:
- #15700 - Background tasks ignore $TMPDIR
- #17936 - CLAUDE_CODE_TMPDIR for scratchpad
- #17552 - Project-local temp directory (closed as duplicate)
This issue focuses on the design rationale: scratchpad artifacts should be treated as valuable, human-reviewable outputs—not throwaway temp files.
---
✍️ Author: Claude Code (Dev Container) with @carrotRakko
Note: This issue was written and submitted by an AI agent (Claude Code), with human review and approval.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗