claude-cleanup
Skill428 starsChanged 7 months agoMITView on GitHub
在 macOS 上安全审计、完整备份、清理或重置 Claude Code 与 Claude Desktop 本机状态。适用于清理可再生缓存和日志、轮换本地 ID、重置桌面端登录态、移除应用、继承现有遥测状态、启用最小提示词模式或修改台北时区;不用于规避封禁或平台风控。
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Eason412/how-to-use-claudetheir own version, first seen Oct 11, 2026
- Danservfinn/claude-skillstheir own version, first seen Feb 5, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Eason412/how-to-use-claude★ 4same name
- Danservfinn/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- break-ai-slopSkill
- get-bijiSkill
- whatisSkill
The file
Files
Claude 本机清理
使用随附脚本执行,不要临时拼接 rm。脚本采用窄白名单、完整备份、一次最终知情确认和失败即停止。
运行顺序
如果当前执行者就是 Claude Code,只运行只读审计并提醒用户切换到 Codex 或普通终端。不要让正在使用
~/.claude的 Claude Code 自己修改该目录。python3 scripts/claude_cleanup.py --audit- 如果由 Codex 或普通终端执行,先运行审计并向用户说明:
- 第一个写操作是完整复制并校验
~/.claude,同时备份~/.claude.json; - 可再生缓存和日志会自动纳入最终清单,不逐项询问;
- 身份、钥匙串、桌面端登录态、应用、精简模式和时区属于风险操作,仍由用户选择;
- 所有移除只进入时间戳废纸篓目录,不会永久删除或清空废纸篓;
- 保护路径和遥测设置保持不变。
- 第一个写操作是完整复制并校验
用户明确要求继续后,在真实终端运行:
python3 scripts/claude_cleanup.py不要用管道代答,不要增加跳过确认参数。若只有自动安全清理且 Claude 正在运行,脚本直接跳过安全目标,不要求退出;若用户选择风险操作,再交由用户正常退出并复检。脚本不能自动结束进程。
- 脚本显示展开后的完整清单。用户输入一次
CONFIRM后才开始写盘。若需要修改时区,开机密码只能由用户在 macOS 原生sudo隐藏提示中输入;不要让用户把密码发给执行者,也不要读取或保存。 - 结束后报告备份路径、废纸篓批次、实际选择、遥测继承结果和时区。任何中途停止都报告为部分完成,不能笼统声称清理成功。
自动安全清理
在 Claude Code 和 Claude Desktop 都已退出后,自动把下列现存目标纳入最终清单,无需逐项提问:
~/.claude/cache
~/.claude/stats-cache.json
~/.claude/telemetry
~/.claude/usage-data
~/.claude/usage.jsonl
~/.claude/usage.with-fix.jsonl
~/Library/Caches/claude-cli-nodejs
~/Library/Caches/com.anthropic.claudefordesktop*
~/Library/Logs/Claude
~/Library/Logs/DiagnosticReports/Claude*
~/Library/Application Support/CrashReporter/Claude*这些目标必须仍通过脚本白名单检查,并且只移入废纸篓。
绝对保护范围
绝不删除或移动:
~/.claude/projects、sessions、history.jsonl、file-history、debug
~/.claude/skills、plugins、hooks、commands、scripts、agents、mcp-servers
~/.claude/backups、CLAUDE.md、settings.json、settings.local.json
任何项目目录、Git 仓库、Codex 会话,以及未明确列入白名单的路径settings.json 只允许结构化修改被用户明确选择的键。保留其他 env、hooks、plugins、权限、模型、MCP、状态栏和秘密。目标与保护路径重叠时立即停止。
风险操作
- 本地身份轮换:轮换
~/.claude.json的userID、machineID,清除已知账号缓存字段,并把同一组新值同步到~/.claude/backups/.claude.json.backup.*。仅用于隐私和排障,不宣称能改变平台关联判断。 - 钥匙串:删除
Claude Code-credentials会退出 CLI 登录,单独选择。 - Claude Desktop:可选择仅清持久数据与登录态,或连
/Applications/Claude.app一并移入废纸篓。不能自动结束应用进程。 - 最小提示词模式:在
settings.json的env中设置或移除CLAUDE_CODE_SIMPLE=1。启用后使用最小系统提示词和有限工具,并跳过 hooks、skills、plugins、MCP、自动记忆及CLAUDE.md自动发现;这些资产不会被删除。一次性脚本调用优先考虑claude --bare。 - 台北时区:仅在 macOS 当前不是
Asia/Taipei时询问。使用sudo systemsetup修改并验证。
遥测继承
逐值保存以下键:
DISABLE_TELEMETRY
DISABLE_ERROR_REPORTING
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC当前关闭就保持关闭;当前未关闭就不主动关闭。改变遥测状态不属于本 skill 的清理范围。
本 skill 不用于规避封禁、支付检查、设备或 IP 信誉、浏览器指纹或任何平台风控。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

