Skip to content

feat(plugin): add tmp-cleanup plugin for /tmp/claude-*-cwd file accumulation#30721

Open
niceysam wants to merge 1 commit intoanthropics:mainfrom
niceysam:feat/tmp-cwd-cleanup-plugin
Open

feat(plugin): add tmp-cleanup plugin for /tmp/claude-*-cwd file accumulation#30721
niceysam wants to merge 1 commit intoanthropics:mainfrom
niceysam:feat/tmp-cwd-cleanup-plugin

Conversation

@niceysam
Copy link
Copy Markdown

@niceysam niceysam commented Mar 4, 2026

Addresses #8856.

Every Bash tool invocation creates a /tmp/claude-{hex}-cwd file to track the working directory, but these are never cleaned up. Heavy users end up with hundreds or thousands of orphaned files in /tmp.

This adds a small tmp-cleanup plugin that hooks into the Stop event to delete all /tmp/claude-*-cwd files when a session ends normally. Files left behind by crashed sessions get picked up on the next clean exit.

The plugin is minimal — one Python script, one hook config — and never blocks the stop event even if cleanup fails.

…-cwd files

The Bash tool creates /tmp/claude-*-cwd temp files to track working directory
state across commands but never deletes them. This causes hundreds to thousands
of orphaned files to accumulate over time (issue anthropics#8856).

Add a new tmp-cleanup plugin with a Stop hook that removes these files when a
session ends cleanly. Files from crashed/interrupted sessions are collected on
the next normal exit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant