Temporary File Management
Keep transient artifacts out of the project root and final deliverable directories.
Classify Before Writing
Before creating a file, decide whether it must survive after the task:
- Keep requested deliverables and maintained project files in their intended locations.
- Treat downloads, extracted archives, intermediate JSON, screenshots, renders used only for QA, debug logs, test outputs, scratch scripts, and conversion intermediates as temporary.
- When uncertain, use temporary storage until the artifact is promoted explicitly to a deliverable.
Choose a Temporary Location
Prefer an existing project convention. Otherwise choose according to lifetime:
- Task-local and briefly inspectable:
./tmp/YYYYMMDD-task-name/. - Disposable during the current run: an agent-specific directory under the operating system's temporary directory, such as
/tmp/<agent-name>/or$env:TEMP\<agent-name>\. - Reusable across tasks but not a deliverable:
~/.cache/<agent-name>/or the platform-equivalent cache directory.
Use descriptive artifact names inside the task directory, for example:
tmp/
20260903-pdf-parser/
extracted_text.json
page_001.png
Never place temporary files directly in the repository root. Redirect automatic tool output to the selected temporary directory whenever the tool permits it.
Protect the Workspace
The repository root may contain maintained source code, configuration, documentation, and user-requested final outputs. Do not leave transient screenshots, data dumps, logs, extracted directories, generic output/ folders, test artifacts, or generated intermediates there unless the user explicitly requests that location.
Do not commit temporary files. Prefer an already ignored temporary location; do not modify ignore rules unless that change is appropriate to the project or requested.
Clean Up
At task completion, remove temporary artifacts created by the current task and keep only requested deliverables and maintained project files. Delete only paths whose ownership and scope are known. If temporary evidence must remain because work is incomplete or the user needs it for inspection, keep it in the temporary directory and report its location.