ai-cli-cleaner

中文文档
0.1.0-beta.6发布于 2026/11/03MITES Module

Safely delete local conversations from Codex, Copilot, Antigravity, OpenCode, Grok, and Claude Code.

原始使用文档
文档目录7 节
  1. Install
  2. Quick start
  3. Supported agents
  4. Commands
  5. Data handling and limits
  6. Terminal and scripting
  7. Documentation and community

AI CLI Cleaner

CI npm License: MIT Platform: macOS 26+ Node.js: 22 / 24 / 26

Review and remove local AI agent conversations on macOS. Select individual conversations or clean an agent's local history, including supported indexes and related data. Memories are kept by default. Known sign-in, settings, MCP, skill, and plugin paths are preserved; process, open-file, path, ownership, and format checks can refuse an operation.

This is beta software. Keep an independent backup, review the preview and format limits, and close the selected agent before deletion. Files move to macOS Trash; supported index changes have backups and an operation journal. Recovery is manual, and Trash is not secure erasure.

Install

Requires macOS 26 or later, Node.js ^22.22.2, ^24.15.0, or ^26.0.0, and npm 10, 11, or 12; the npm bundled with those Node.js versions works. Node.js and npm must already be installed.

npm install --global ai-cli-cleaner@latest
ai-cleaner --version
ai-cleaner doctor --all

The package includes the compiled CLI, native helpers, and bundled runtime dependencies; no source build is required. Every release, including betas, is published with npm's latest tag, so rerunning the same command installs the newest version. The built-in updater uses separately published GitHub releases, so it does not follow npm dist-tags. See installation and updates for runtime setup, source/archive installation, and removal.

Quick start

Check your environment, preview the full scope, and review individual conversations in an interactive terminal:

ai-cleaner doctor --target codex
ai-cleaner clean --target codex --dry-run
ai-cleaner clean --all --dry-run --verbose
ai-cleaner conversations --target codex --dry-run

Close the selected agent, then run the picker again and confirm the conversations to delete:

ai-cleaner conversations --target codex

For the agent's local conversation history and related data, review the preview, keep the agent closed, and run:

ai-cleaner clean --target codex

Memories stay intact by default, including with --all, --yes, or --force-stop. Add --include-memories only when you also want to remove supported memory stores. Preview that larger scope before running it:

ai-cleaner clean --all --include-memories --dry-run --verbose
ai-cleaner clean --all --include-memories --force-stop

The default retains Codex's memory databases and memories/, Grok's memory/, and Claude's project and subagent memory directories. Retained memories can still contain information from deleted conversations. conversations also keeps memories by default; its --include-memories option removes only supported records attributable to the selected conversations, currently Codex database records. Shared memory files and other agents' memory stores remain intact during selected deletion. See memory scope for exact paths.

Codex full cleanup also removes valid YYYY-MM-DD directories directly inside ~/Documents/Codex, with everything inside them—including project source files. It also removes that root's .DS_Store Finder metadata. It preserves the Codex root, ordinary named project directories, invalid dates, and date-named files. Selected-conversation deletion does not remove these workspaces. Full cleanup can also include attachments, voice records, goals, queues, generated images, visualizations, logs, and caches. Review the actual paths before confirming.

Supported agents

Agent--targetSelected conversationsFull cleanup
Codex CLI / AppcodexSupported local records and indexesIncludes dated workspaces described above
GitHub Copilot CLIcopilotSupported session records and indexesSupported local history and related data
Google Antigravity CLI / IDEantigravityBlocked when either shared protobuf summary is nonemptyIncludes both known CLI and IDE roots
OpenCodeopencodeSupported SQLite formatsPreserves supported account/configuration data in mixed databases
Grok Build CLIgrokSupported sessions and indexesLocal history; memories only with --include-memories
Claude CodeclaudePreview only; use full cleanup to deleteLocal history, artifacts, and supported Desktop Code sidebar records; memories only with --include-memories

Support depends on storage format and ownership checks. Compatibility defines validation cases, roots, legacy storage, and refusals; desktop GUI behavior and cloud models are outside those CLI cases. When Antigravity's shared summaries block individual deletion, use its built-in /resume interface. OpenCode legacy JSON supports full cleanup of known conversation subdirectories, but not selected deletion.

Commands

CommandPurpose
ai-cleaner conversationsChoose an agent, then select conversations interactively; --target selects one agent directly.
ai-cleaner clean --target codex,copilotClean full local histories for selected agents.
ai-cleaner clean --all --dry-runPreview a cleanup summary across all six agents.
ai-cleaner clean --all --include-memories --dry-runPreview all agents with supported memory stores included.
ai-cleaner clean --target claudeClean Claude Code's supported local history and related data.
ai-cleaner doctor --allCheck platform, tools, data roots, and running agents.
ai-cleaner recovery listList local operation records.
ai-cleaner recovery inspect <id>Inspect backups, integrity, and manual recovery guidance.
ai-cleaner updateCheck public GitHub releases for a newer stable version.
ai-cleaner update --installVerify and install a published update in a supported global installation.

Run ai-cleaner <command> --help for options. Conversation and recovery lists use the system time zone; --timezone Asia/Taipei or another IANA zone overrides it. doctor, recovery list, and recovery inspect <id> support --json; see recovery for operation states, retained copies, and manual restoration.

clean shows a short summary by default, including whether memories are kept or included. Add --verbose (or -v) for the full scope, paths, and index updates; clean --all --dry-run --verbose previews those details without stopping agents or deleting originals. Shutdown impacts, dated Codex workspace contents, errors, and recovery paths remain visible without verbose output.

Data handling and limits

Cleanup acts on known local paths. It does not call provider cloud-history APIs, discover arbitrary workspaces, or search the disk. An external service syncing affected files may propagate their local deletion. Custom roots such as a different CODEX_HOME are refused; symbolic-link or relocated document roots are unsupported for Codex full cleanup.

--force-stop requests shutdown and may close the ChatGPT/Codex or Claude desktop app when selected. --yes skips full-cleanup confirmation but preserves process and data checks. Open SQLite databases or sidecars, unknown formats, ambiguous ownership, and changes since discovery can block deletion; preserve the data and investigate the refusal.

A dry run does not delete original data or stop agents. SQLite inspection uses private temporary copies, which may contain sensitive data and sidecars; those copies move to Trash afterward. Trash, backups, and journals retain data until you handle them; the tool never empties Trash or erases backups. Selected deletion follows supported IDs, owned paths, and database relationships, without inferring ownership from text mentions.

Terminal and scripting

Conversation selection and confirmation require an interactive terminal on standard input and standard error. Prompts and errors go to standard error; results go to standard output. For scripts, preview with clean --dry-run, then use clean --yes only when skipping confirmation is intentional. Piping y into an interactive command is refused before discovery or mutation.

Exit codes are 0 for success or deliberate No/Escape cancellation, 1 for errors or incomplete operations, and 130 for Ctrl-C during an interactive prompt.

Documentation and community

Installation · Compatibility · Recovery · Contributing · Security

Report reproducible bugs and feature requests through GitHub Issues, using synthetic examples and redacted output. Keep conversations, raw databases, account identifiers, full personal paths, secrets, and complete logs out of reports. Follow the security policy for vulnerability disclosure.

Licensed under MIT. The bundled native Trash helper includes its own MIT license and provenance. The project-owned claim helper has separate source and binary provenance.

版本与发布记录

ai-cli-cleaner 共发布 7 个版本,首次发布于 2026/10/18;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.1.0-beta.6latest2026/11/03今天
0.1.0-beta.52026/11/021 天前
0.1.0-beta.42026/11/021 天前
0.1.0-beta.32026/10/286 天前
0.1.0-beta.22026/10/277 天前
0.1.0-beta.12026/10/1816 天前

关于 ai-cli-cleaner 的常见问题

ai-cli-cleaner 是什么?

安全地从Codex, Copilot, Antigravity, OpenCode, Grok和Claude Code中删除本地对话。

如何安装 ai-cli-cleaner?

在项目目录运行 npm install ai-cli-cleaner,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ai-cleaner,可以用 npx ai-cleaner 直接运行。

ai-cli-cleaner 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ai-cli-cleaner 是否存在。

ai-cli-cleaner 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

ai-cli-cleaner 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^22.22.2 || ^24.15.0 || ^26.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

ai-cli-cleaner 可以商用吗?

ai-cli-cleaner 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

ai-cli-cleaner 还在维护吗?

最新版本 0.1.0-beta.6 发布于 2026/11/03(今天);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/10/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。