Use when creating any file for Claude's own use - scripts, generated artifacts, intermediate outputs, analysis files, or any persistent file not part of the user's project. Triggers on file creation outside project scope.
All files Claude creates for its own use (not part of the user's project) go in ~/projects/claude_scratch/. This keeps Claude's working artifacts separate from the user's codebase.
digraph file_placement {
"Creating a file?" [shape=diamond];
"Part of user's project?" [shape=diamond];
"Truly temporary? (gone after task)" [shape=diamond];
"Write in project directory" [shape=box];
"Use tempfile/tempdir" [shape=box];
"Write to ~/projects/claude_scratch/" [shape=box];
"Creating a file?" -> "Part of user's project?" [label="yes"];
"Part of user's project?" -> "Write in project directory" [label="yes"];
"Part of user's project?" -> "Truly temporary? (gone after task)" [label="no"];
"Truly temporary? (gone after task)" -> "Use tempfile/tempdir" [label="yes"];
"Truly temporary? (gone after task)" -> "Write to ~/projects/claude_scratch/" [label="no"];
}
Organize files so they're findable across sessions:
~/projects/claude_scratch/
{project-name}/ # Match the project being worked on
{date-YYYY-MM-DD}/ # Date of creation
{descriptive-name}/ # What the files are for
file1.py
file2.txt
_shared/ # Cross-project utilities
{descriptive-name}/
tool.sh
Example:
~/projects/claude_scratch/
my-web-app/
2026-04-01/
api-load-test/
test_script.py
results.json
schema-migration-draft/
migration.sql
_shared/
json-formatter/
format.py
claude_scratch/tempfile/tempdir for throwaway work - if the file won't be needed after the current task step, use the system temp directoryclaude_scratch/ once the task they support is complete| File type | Location |
|---|---|
| User's source code, configs, tests | Project directory |
| Throwaway intermediate output | tempfile/tempdir |
| Analysis scripts Claude wrote | ~/projects/claude_scratch/{project}/{date}/{desc}/ |
| Generated test data | ~/projects/claude_scratch/{project}/{date}/{desc}/ |
| Draft migrations, schemas | ~/projects/claude_scratch/{project}/{date}/{desc}/ |
| Comparison benchmarks | ~/projects/claude_scratch/{project}/{date}/{desc}/ |
| Cross-project utilities | ~/projects/claude_scratch/_shared/{desc}/ |
At session start, if working in claude_scratch/:
_shared/ — this contains persistent cross-project tools (e.g., gpu-orchestrator) that must survive across sessions indefinitely