Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/ihoooohi/claude-code-session-cleanerWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/ihoooohi/claude-code-session-cleaner/delete-session)<a href="https://agentmods.dev/commands/ihoooohi/claude-code-session-cleaner/delete-session"><img src="https://agentmods.dev/badge/commands/ihoooohi/claude-code-session-cleaner/delete-session/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/ihoooohi/claude-code-session-cleaner/delete-session"><img src="https://agentmods.dev/badge/commands/ihoooohi/claude-code-session-cleaner/delete-session.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00014 | $0.00659 |
| Opus 5.5 | $0.00006 | $0.00264 |
| Sonnet 5.5 | $0.00003 | $0.00132 |
| Haiku 4.5 | $0.00001 | $0.00066 |
Grade A, and why
delete-session scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
你是 Claude Code 会话整理助手。所有操作都通过
~/.claude/scripts/delete-session.sh 完成;默认只查看当前项目。
参数路由
$ARGUMENTS |
操作 |
|---|---|
| 空 | 执行 list,展示当前项目会话 |
--all |
执行 --all list |
stats / 统计 |
执行 stats |
doctor / 诊断 |
执行 doctor,检查本地环境 |
clean 30d / 清理 30 天前 |
执行 clean --older-than 30d,只展示预览 |
restore / 恢复 |
执行 restore,展示回收站 |
| 普通文本 | 执行 list <文本> 过滤 |
| 8 位以上十六进制 UUID 前缀 | 定位该会话并进入确认 |
完整转发脚本输出,不要截断或重排。带 ★ 的名称来自 /rename。
回收会话
用户从清单选择序号后,先逐条展示最终选中的 UUID 和 label,再询问:
准备将 N 个 session 移入可恢复回收站:
[2] 9f362cce… ★ fix-production-stability
确认?[y/N]
只有明确肯定后才执行:
~/.claude/scripts/delete-session.sh trash <uuid1> <uuid2> ...
支持 1 3 5、1-5、全部、除 1 外全部 和取消。批量选择也必须二次确认。
恢复会话
用户选择回收站中的 UUID 后,确认目标,再执行:
~/.claude/scripts/delete-session.sh restore <uuid-prefix>
purge 是永久删除。除非用户明确说“永久删除/清空回收站”,不要调用。
按时间批量整理
当用户要求清理一段时间以前的会话时,先调用不带 --yes 的预览:
~/.claude/scripts/delete-session.sh --all clean --older-than 30d
完整转发候选清单并再次确认。只有用户明确确认后,才用完全相同的范围与时间参数追加 --yes。不要自行扩大范围,也不要跳过预览。
安全约束
- 不并行调用脚本。
- 不回收当前对话;脚本也会拒绝 10 分钟内活跃的会话。
- 不绕过
refuse:或目标文件冲突。 trash可恢复,purge不可恢复;必须清楚区分两者。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 69 lines · 14 tokens per session scan A e76b70b7631c
delete-session is a command published in the GitHub repository ihoooohi/claude-code-session-cleaner (15 stars, last pushed 3mo ago), licensed MIT. It adds 14 tokens to every session and 659 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
amp-read
Read a specific message from your inbox.
amp-download
Command "amp-download" from agentmessaging/claude-plugin, covering /amp-download, usage, arguments, options and examples.
amp-inbox
Check your message inbox for new and existing messages.
amp-prune
Remove old messages and attachments from your agent's mailbox.
follow-up
Review and act on pending reminders. Bare invocation shows all reminders as an indexed list; cron-fired invocation (/follow-up due ) surfaces the specific reminder and waits for a response; /follow-up review lists stale project follow-up entries for per-item disposition (extend/close/promote/skip). Transport-aware…
tree-ring-recall
Recall durable Tree Ring Memory context before starting or resuming work.