Skip to content

[FEATURE] Scratchpad should persist beyond session and be user-accessible by default #21248

Description

@carrotRakko

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • 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

  1. Make scratchpad location configurable via:

    • CLI flag or environment variable, AND/OR
    • CLAUDE.md / settings.json
  2. Document the scratchpad behavior clearly:

    • Where it lives by default
    • How to change it
    • What gets written there
  3. 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

  1. User: "Write a document summarizing Git/GitHub procedures for Claude Code to follow. I'll review it before we finalize."
  2. Claude writes to /tmp/claude/.../scratchpad/git-procedures.md
  3. Claude: "Done! I've written the document."
  4. User: "...where? I don't see it in my project."
  5. User has to either:
    • Ask Claude to cat the 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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions