How to Clean Up Working Directories After Video Processing in Claude‑Video
The watch skill in claude‑video creates temporary working directories using tempfile.mkdtemp() but does not automatically delete them, requiring manual cleanup via rm -rf after you finish reviewing the extracted frames and transcripts.
The claude‑video repository provides a powerful watch skill for processing video content, but knowing how to clean up working directories after video processing in claude‑video is essential for effective disk space management. When you execute the skill, it generates a dedicated workspace to store downloaded videos, extracted frames, and intermediate processing files. Unlike many automated tools, this repository intentionally leaves the cleanup responsibility with the user to prevent accidental data loss.
How Working Directories Are Created
Default Temporary Directory Creation
When you run the watch skill without specifying an output location, the system automatically creates a temporary directory. In skills/watch/scripts/watch.py, the code invokes tempfile.mkdtemp(prefix="watch-") to generate a unique path (typically under /tmp/ on Unix systems).
The script immediately prints this path to stderr in the format:
[watch] working dir: /tmp/watch-abcd1234
This directory serves as the container for all processing artifacts, including the downloaded video file, extracted frame images, and any generated transcripts.
Custom Output Directory Option
If you prefer to specify your own workspace, you can provide the --out-dir argument:
watch "https://www.youtube.com/watch?v=example" --out-dir ./my-workdir
When using this option, the skill uses your specified path instead of creating a system temp directory. This gives you direct control over the location and naming convention, but you remain responsible for the eventual deletion of this folder.
The Manual Cleanup Process
Because the claude‑video tool is designed to be harness‑agnostic (working with Claude Code, Codex, Cursor, and other AI assistants), it cannot rely on host‑specific teardown hooks. The cleanup process follows three straightforward steps:
-
Identify the working directory path from the final line of the report, which appears as:
_Work dir: `/tmp/watch-abcd1234` — delete when done._ -
Delete the directory using standard filesystem commands once you have inspected the frames or transcripts:
rm -rf /tmp/watch-abcd1234 -
For custom directories, replace the path with your
--out-dirlocation:rm -rf ./my-workdir
Complete Workflow Example
Here is a full execution including cleanup:
# Run the skill (creates a temp dir automatically)
watch "https://www.youtube.com/watch?v=example"
# Review the output to find the working directory
# [watch] working dir: /tmp/watch-3f9e7c2a
# After reviewing frames/transcript, remove the temp files
rm -rf /tmp/watch-3f9e7c2a
For automated pipelines or scripts, capture the working directory and add a post-processing cleanup step:
WORK_DIR=$(watch "https://example.com/video" 2>&1 | grep "working dir:" | awk '{print $4}')
# ... processing logic ...
rm -rf "$WORK_DIR"
Key Source Files Involved
The working directory management spans several files in the skills/watch/scripts/ directory:
watch.py— The entry point that creates the temporary working directory and prints the cleanup reminder to stderr.download.py— Handles video download into the working directory.frames.py— Extracts frames into thework/framessubdirectory.config.py— Reads configuration settings but does not affect cleanup behavior.
These components work together to populate the workspace, but none implement automatic deletion after processing completes.
Best Practices for Different Scenarios
Interactive Usage (Default Temp Directory)
Delete the printed path immediately after reviewing the report to prevent accumulation of large video files in /tmp.
Development or Reusable Workflows (Custom --out-dir) Keep the directory if you need to reuse the frames or audio for multiple operations, or delete the specific folder path when finished.
CI/CD and Automated Scripts
Always add an explicit post-processing step such as rm -rf "$WORK_DIR" to ensure temporary files do not persist on build runners or consume excessive storage.
Summary
- Temporary directories are created via
tempfile.mkdtemp(prefix="watch-")inskills/watch/scripts/watch.pywhen--out-diris not specified. - No automatic deletion occurs; the tool prints a reminder for manual cleanup to avoid accidental data loss.
- Cleanup command is standard
rm -rf <path>using the directory shown in the final output line. - Custom directories specified with
--out-dirrequire you to delete that specific path manually. - Automation requires explicit post-processing steps since the skill lacks host‑specific teardown hooks.
Frequently Asked Questions
Why doesn't claude‑video automatically delete the working directory?
The skill is designed to be harness‑agnostic and cannot rely on platform‑specific teardown hooks. Additionally, leaving the directory in place prevents accidental data loss if you need to reuse the extracted frames, audio files, or transcripts for subsequent analysis.
How do I find the working directory path if I missed the initial output?
Check the final line of the skill's report, which displays: _Work dir: \` — delete when done._Alternatively, look for the earlier stderr line beginning with[watch] working dir:`.
Can I specify a permanent location for the working directory instead of using a temp folder?
Yes. Use the --out-dir argument followed by your desired path: watch "URL" --out-dir ./my-permanent-folder. The skill will use this location instead of creating a system temporary directory, though you remain responsible for manual deletion.
What happens if I don't clean up the working directory?
The files remain on your filesystem indefinitely. Since video files and extracted frames can consume significant disk space, you should delete these directories when no longer needed, especially if processing multiple videos using the default temporary location.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →