cd /news/ai-tools/show-hn-claude-code-routine-session-… · home › topics › ai-tools › article
[ARTICLE · art-144551] src=github.com ↗ pub= topic=ai-tools verified=true sentiment=· neutral

Show HN: Claude Code Routine Session Cleanup Skill

A developer released a Claude Code cleanup skill that removes the leftover sessions created by scheduled routines, after one routine accumulated 618 open sessions. The skill's planner is a single Python file that keeps the newest N sessions and optionally protects any session where the user typed a reply, then has Claude delete sessions through the app's own session tool at 25 per call, each behind an approval card. Deleting session files directly on disk fails because the app keeps the list in memory and writes records back, and the app's delete tool is disabled inside routine runs, so the cleanup command must run from a normal conversation session.

read1 min views1 publishedOct 3, 2026

Claude Code's scheduled tasks (routines) leaves a session behind on every run and in the desktop app you can only delete them one at a time. We had 618 open sessions in just one routine.

The skill plans the clean up (keeps the newest N and protect any sessions where you typed a reply - optional) and then has Claude delete through the apps own session tool, 25 per call each behind an approval card.

I tried just deleting the sessions on disk manually first but deleting the files directly dosnt work because the app keeps the list in memory and writes records back. The apps delete tool is turned off inside routine runs so the clean up command has to run from a normal conversation session.

The planner is a single python file that dosnt delete by itself so you can run it by hand to see where everything exists.

Comments URL: [https://news.ycombinator.com/item?id=49946507](https://news.ycombinator.com/item?id=49946507)

Points: 1

── more in #ai-tools 4 stories · sorted by recency
── more on @claude code 3 stories trending now
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/show-hn-claude-code-…] indexed:0 read:1min 2026-10-03 · —