[BUG] Windows: running session's temp/scratchpad directory deleted while the session is still active (parallel Claude Code instance)

Status Open
Reported on v2.1.296
Maintainer reply None cached
Activity 1 comment · opened Oct 14, 2026

Environment

  • Windows 11 Pro 10.0.26300
  • Claude Code VS Code extension 2.1.296 (native binary); the session's process has been running continuously since 2026-10-11
  • In parallel: Claude Code CLI (native install) in a terminal, working on a different project; it auto-updated to 2.1.299 on 2026-10-14 04:57
  • cleanupPeriodDays not set (default 30); Windows Storage Sense disabled; the OS SilentCleanup task only removes temp files older than 7 days

What happened

  • The VS Code session's scratchpad %TEMP%\claude\<project>\<session-id>\scratchpad had files written on 2026-10-13 around 13:00 (a data snapshot and helper scripts the session was using).
  • On 2026-10-14 at 10:38 the whole <session-id> directory was gone, while the VS Code session was still running (same conversation, its transcript still being appended).
  • The temp directory of the process's original session id (from before /clear) was gone as well; it was re-created only when a background task wrote to <id>\tasks.
  • In the same time window the terminal CLI started several new sessions (/clear at 13:17, 14:17 and 16:37 on 2026-10-13) and auto-updated (2026-10-14 04:57).
  • No session ran a command deleting anything in TEMP: I checked the transcripts of all sessions active in that window for Remove-Item / rm -r / rmdir / rd /s / del on Temp paths - none.
  • An older session directory containing only an empty scratchpad folder (from 2026-09-22) survived.
  • The same loss happened twice between 2026-10-09 and 2026-10-12 (scripts in the scratchpad disappeared mid-work).

Expected

A running session's scratchpad and background-task output are never deleted. According to the docs, the retention sweep should only remove data of sessions whose transcript is older than cleanupPeriodDays.

Related

#78475 (closed as not planned due to inactivity) describes the same consequence, but there a session explicitly cleaned TEMP. Here no such command was found, so it looks like Claude Code's own cleanup (possibly another instance's startup/update sweep) not checking whether a session is still alive.

Workaround

Keep anything important outside the scratchpad.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗