cd /news/large-language-models/after-a-delete-i-kill-the-session · home topics large-language-models article
[ARTICLE · art-15567] src=dev.to pub= topic=large-language-models verified=true sentiment=↓ negative

After a Delete, I Kill the Session

An Anthropic engineer has documented a critical safety practice for Claude Code sessions: immediately terminating any session that has executed a delete command. The engineer's analysis of a 70 MB session dump revealed that 93% was noise—redundant metadata, stale tool results, and old base64 screenshots—with only 3% being actual conversation, contributing to what Anthropic calls "context rot" that degrades model judgment over time. The practice involves using the `/compact` command to distill the session into a high-signal summary before starting a fresh session, reducing the risk of catastrophic deletions like the December 2025 incident where `rm -rf ~/` expanded to a user's entire home directory.

read2 min publishedMay 27, 2026

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 /

.

── more in #large-language-models 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/after-a-delete-i-kil…] indexed:0 read:2min 2026-05-27 ·