---
name: scratchpad-target-trees-eat-the-box
description: "NEVER point CARGO_TARGET_DIR into session scratchpad — each session mints a private ~7 GB tree, 112 GB fleet-wide killed the v0.50.0 golden floor; junction onto .worktrees/gate-target instead"
metadata: 
  node_type: memory
  type: project
  originSessionId: b34cabf6-2098-41af-b492-dc8e22aa8675
  modified: 2026-08-02T04:00:40.794Z
---

2026-08-01: hfenduleam's C: hit ZERO free with golden held. Root cause (deployah, measured): 112 GB of `Temp/claude/<project>/<session>/scratchpad/{tgt,target,target-merge}/` — agents redirecting CARGO_TARGET_DIR into their own scratchpads to avoid shared-target contention. The instinct (avoid contention, avoid locking target/debug/spt.exe) is right; the private-tree mechanism is wrong — a green build whose cost lands on the whole box hours later as a dispatch that cannot link (LNK1318 "wearing a linker error's clothes").

**How to apply:** builds outside the main checkout junction their worktree `target` onto `.worktrees/gate-target` ([[worktree-target-junction]]) — one warm shared cache, zero private trees. Cleanup of scratch targets is per-agent only (all agents run as one OS user; ownership is not tellable from outside — never bulk-sweep another's). spt-core/target (main checkout) is authorized-spendable cache when the floor is threatened: 156 GB reclaimed 2026-08-01, rail = by-path process sweep for executables under it first. AGENTS.md guidance owed next batch.

**Reap the tgt subtree, NEVER the session dir** (todlando, v0.51.0 reclaim): a session can be dead in `scratchpad/` and ALIVE in `tasks/` at the same moment — todlando's live harness wrote a background-task output into `<session>/tasks/` minutes before its 30 GB `scratchpad/tgt` was correctly reaped. Parent-dir mtime tells you nothing about which half is live; "not the active session" invites deleting a dir a running task depends on. Also: junction-vs-real check runs as a REFUSAL (script throws on non-empty LinkType or ReparsePoint attr), not a look — every doorbell/gate worktree target except doorbell-w4's was a junction onto gate-target, and a recursive delete through one destroys the shared build tree.

Related: [[free-space-floor-blocks-golden]], [[live-agents-lock-target-debug-spt-exe]], [[session-id-owner-mapping]].
