session-cleanup
Identify stale and empty Claude Code sessions in the Agent Monitor and explain the cleanup endpoint (POST /api/settings/cleanup), always showing the exact list of what WOULD be removed before anything is deleted.
Install / Use
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-cleanupInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
OperationsSupported Platforms
Our assessment of session-cleanup
session-cleanup scores 81/100 on our quality scale, 625th of 751 Operations skills we index.
Its SKILL.md is 3.3 KB long, well organised into 11 sections and no code examples: a solid amount of guidance for an agent.
With 1,015 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 10 days ago, so session-cleanup is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
session-cleanup compared with similar skills
All 4 of these similar skills score higher than session-cleanup; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| session-cleanup (this skill)by hoangsonww | 81 | 1.0k | 10d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 89.8k | 18d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.4k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 85.5k | today | MCP Server |
| crawl4aiby unclecode | 100 | 84.7k | 8d ago | MCP Server |
Frequently asked questions
- How do I install session-cleanup?
- Run
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-cleanup. The install tabs above show the steps for each supported agent. - Which AI agents does session-cleanup work with?
- It is written for Claude Code, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is session-cleanup safe to use?
- It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is session-cleanup still maintained?
- The repository was last updated 10 days ago, so session-cleanup is actively maintained.
Skill content
View source on GitHubname: session-cleanup description: > Identify stale and empty Claude Code sessions in the Agent Monitor and explain the cleanup endpoint (POST /api/settings/cleanup), always showing the exact list of what WOULD be removed before anything is deleted. Cleanup permanently deletes data, so this skill previews first and requires explicit user confirmation. Use when tidying the monitoring database.
Session Cleanup
Find prune-worthy sessions and explain cleanup — preview first, delete only on explicit confirmation.
Input
The user provides: $ARGUMENTS
- Empty /
preview→ only show what would be removed (the safe default). confirm→ the user has reviewed the preview and explicitly authorizes deletion.- An optional staleness threshold (e.g.
older than 7d) for what counts as stale.
Data Sources
| Endpoint | Returns |
|----------|---------|
| GET /api/sessions?limit=N | session list: id, status, model, cwd, started_at, ended_at, cost, metadata (turn_count, total_turn_duration_ms) |
| GET /api/stats | totals: total_sessions, active_sessions, total_events, events_today, sessions_by_status, agents_by_status |
| POST /api/settings/cleanup | runs the cleanup routine and returns what was removed — DESTRUCTIVE, only after confirmation |
Report Sections
1. Baseline
GET /api/stats — record total_sessions, sessions_by_status, total_events. This is
the before-state to compare against.
2. Identify candidates
GET /api/sessions?limit=1000. Flag sessions that are:
- Empty — zero events and
turn_count0 / null andcost0 (started but never did anything). - Stale active —
statusactive/working but last activity older than the threshold (default 24h), i.e. never cleanly stopped. - Truncated — no
ended_atand no recent events.
3. Preview table (ALWAYS shown)
List every candidate with the reason it qualifies. State the total count and confirm that nothing has been deleted yet.
4. Explain the endpoint
Describe POST /api/settings/cleanup: it prunes empty / orphaned sessions and their
dangling events server-side and returns a summary of removed rows. Make clear this
is permanent and not reversible from the dashboard.
5. Execute only on confirmation
If — and only if — $ARGUMENTS is confirm (or the user has explicitly approved
this run), call POST /api/settings/cleanup, then re-read /api/stats and report
the before → after delta. Otherwise stop after the preview and tell the user to
re-run with confirm.
Output
A preview Markdown table: id (short) | status | reason | cwd basename | started_at | cost,
then a one-line count and the explicit "nothing deleted — re-run with confirm to
proceed" notice. On a confirmed run, add a before → after summary using ▲/▼ on the
counts. Currency as USD to 4 decimal places.
Safety
- This is the ONLY skill in the plugin that mutates data, and only via the one documented endpoint.
- NEVER call
POST /api/settings/cleanupwithout an explicitconfirmfrom the user in this turn — previewing is the default. - Never widen scope to
POST /api/settings/clear-dataor any other destructive endpoint; cleanup of stale/empty sessions only. - If the dashboard is unreachable, tell the user to start it with
npm startfrom the repo root.
Related Skills
Agent-Reach
89.8kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
74.4kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
85.5k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
crawl4ai
84.7kOpen-source web crawler and scraper for LLMs and AI agents: any website into clean, LLM-ready Markdown. Run it yourself, or use Crawl4AI Cloud with one key.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
