/ccam-sessions:session-cleanupfrom ccam-sessions
Identifies stale and empty Claude Code sessions in the Agent Monitor, previews what would be removed, and executes cleanup only on explicit confirmation.
Ships in ccam-sessions. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Find prune-worthy sessions and explain cleanup — preview first, delete only on explicit confirmation.
The user provides: $ARGUMENTS
preview → only show what would be removed (the safe default).confirm → the user has reviewed the preview and explicitly authorizes deletion.older than 7d) for what counts as stale.| 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 |
GET /api/stats — record total_sessions, sessions_by_status, total_events. This is
the before-state to compare against.
GET /api/sessions?limit=1000. Flag sessions that are:
turn_count 0 / null and cost 0 (started but never
did anything).status active/working but last activity older than the
threshold (default 24h), i.e. never cleanly stopped.ended_at and no recent events.List every candidate with the reason it qualifies. State the total count and confirm that nothing has been deleted yet.
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.
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.
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.
POST /api/settings/cleanup without an explicit confirm from the
user in this turn — previewing is the default.POST /api/settings/clear-data or any other destructive
endpoint; cleanup of stale/empty sessions only.npm start from
the repo root.What SKILL.md sets; muted values are Claude Code's defaults
5 plugins ship this exact skill · first indexed Aug 10, 2026
5 skills in this plugin
/cwd-rollupRoll up Claude Code sessions by working directory (project) from Agent Monitor data — session count, total cost, total tokens, and last-active timestamp per cwd — so per-project activity can be compared at a glance. Use when summarizing where effort and spend went across projects.
/session-searchFind Claude Code sessions tracked by the Agent Monitor by project (cwd), model, status, or date, then rank the matches by cost or recency. Pulls the session list and the distinct cwd / facet values so filters use real values rather than guesses. Use when locating a session — "find my EstateWise sessions", "which Opus runs errored this week", "most expensive sessions in /repo".
/npx claudepluginhub hoangsonww/claude-code-agent-monitor --plugin ccam-sessionsOther plugins' skills for the same job