AI agent storage incident
Parallel Agent Worktrees Cargo target Disk Full
When Base Studio Code, Claude, or another agent fleet builds isolated Rust worktrees at the same time, each worktree can create a separate target/ tree. Dozens of app-owned worktrees under paths like ~/.base-studio-code/worktrees can quietly grow into hundreds of GB before the code is wrong. Measure the per-worktree peak first, then choose lifecycle cleanup, shared target, pruning, or concurrency caps deliberately.
Find what the AI tool can delete.
Copy the read-only check first. If the output still needs judgment, leave your email and we send the free SafeDisk AI deletion trial step only when the agent cache or session state needs review.
Evidence To Capture First
Before changing Cargo or deleting directories, prove the disk peak per agent. This keeps the fix focused on workflow policy rather than hiding a real test or linking failure.
Measure each worktree and target directory.
Run this from the repo or project directory. It checks both Base Studio Code fleet worktrees and Claude-style worktree folders without deleting anything.
df -h . "$HOME" /tmp 2>/dev/null
df -i . "$HOME" /tmp 2>/dev/null
du -sh "$HOME/.base-studio-code/worktrees" .claude/worktrees 2>/dev/null || true
du -sh "$HOME/.base-studio-code/worktrees"/*/*/target "$HOME/.base-studio-code/worktrees"/*/target .claude/worktrees/*/target 2>/dev/null | sort -hr | head -30 || true
du -sh target "$CARGO_TARGET_DIR" "$HOME/.cargo" "$HOME/.cache/sccache" 2>/dev/null || true
find "$HOME/.base-studio-code/worktrees" .claude/worktrees -maxdepth 5 -type d -name target -print 2>/dev/null | head -80
Policy Options
- Shared
CARGO_TARGET_DIR: best disk reduction, but validate concurrent Cargo lock behavior and cross-branch artifact invalidation. - Per-agent target cleanup: safe when the branch is pushed, tests are done, and no later step needs the compiled outputs.
- Concurrency cap: choose
floor((free_gb - reserve_gb) / peak_target_gb)for heavy Rust builds instead of a fixed agent count. - Larger session volume: useful for burst capacity, but still keep telemetry so target growth does not silently return.
Do Not Delete First
- Do not delete active
target/directories while a Cargo process is compiling or linking. - Do not delete the worktree itself before the branch is pushed or the agent's diff is saved.
- Do not share
CARGO_TARGET_DIRwithout a rollback path; subtle build-script or feature differences can make failures hard to attribute. - Do not treat disk expansion as the only fix; the workflow still needs a reserve and cleanup contract.
Need a delete / confirm / protect answer for AI tool files?
Submit the form first; the command output or one-line agent storage symptom can follow. We check whether free guidance is enough before asking for the free SafeDisk AI deletion trial.