# After a Delete, I Kill the Session

> Source: <https://dev.to/eyesofish/after-a-delete-i-kill-the-session-1h4a>
> Published: 2026-05-27 17:07:57+00:00

The longer a Claude Code session runs, the worse the model’s judgment gets. Anthropic calls it “context rot.” In one dissected 70 MB session dump, **93 % was noise**: redundant JSON envelope metadata, stale tool results, old base64 screenshots. Only 3 % was actual conversation.

Clouded judgment while editing yields messy diffs. During deletions, it can destroy the project. Incident reports: December 2025, a user saw Claude run `rm -rf … ~/`

where the trailing `~/`

expanded to the entire home directory. October 2025, another user watched `rm -rf /`

execute from root; only file permissions saved the system. Deletion risk isn’t linear—it’s explosive.

My hard rule: **if a session has ever run a delete command, I kill it and start fresh.**

Instead of just exiting, I first ask the model to summarize where we are—what we’ve built, what’s left, key decisions. Then I run `/compact`

. `/compact`

compresses hundreds of messages into a short summary; the signal survives, the noise is dropped.

After that, I start a new session and feed it the summary. Fresh context means the model’s full attention is available. It won’t confuse “delete that config file” with “delete the project root.”

Many already adopt a plan‑then‑new‑session workflow. I make the trigger explicit: if a session has been in YOLO mode and a remove command has been issued, I start a new conversation. No exceptions.

The steps:

`rm`

, etc.), ask the model: `/compact`

to distill the session into a high‑signal, compact context.It takes a couple of minutes and drives the risk of destructive misjudgment close to zero.

This practice aligns with Anthropic’s five‑pronged context‑rot strategy: `/rewind`

(roll back), `/clear`

(wipe), `/compact`

(compress), subagents (isolate tasks), and `Continue`

(pick up where you left off with less noise). Combining `/compact`

with a manual fresh start is essentially `Continue`

with an explicit summary handoff.

The community agrees this is a pain point: Cozempic, an open‑source context‑pruning tool, has **35,000+ users** and offers **18 pruning strategies** across three tiers.

I can’t quantify “fewer catastrophic deletions,” but the mechanism is sound. `/compact`

strips away over 90 % of the noise. A fresh session eliminates residual context confusion—the model sees only the essential summary, not thousands of stale tool outputs. In a long‑running session, “delete that test file” might match a dozen paths the model saw earlier; a fresh session has no such memory.

Editing risk is linear: mess up one file, you lose one file; `git diff`

catches it. Deletion risk is exponential—one command can destroy the entire project. Treating them the same is a mistake.

`rm -rf ~/`

or `rm -rf /`

.
