ctx-purge
它能做什么
这个技能清除 context-mode 为项目保存的搜索索引和会话数据。适合想清除旧的索引内容或重新开始的人。
适用场景
- ✓当有人想删除某次过去会话中的索引内容的时候。
- ✓当项目的搜索索引很杂乱,需要全部清除的时候。
- ✓当有人想在重新索引项目之前干净地重新开始的时候。
技能链接
https://github.com/mksglu/context-mode/blob/main/skills/ctx-purge/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请清除这个项目的 context-mode 索引,让我可以重新开始。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能会先询问你是清除某个会话还是整个项目,然后警告你将被删除的内容。只有在你确认范围之后,它才会执行清除。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Context Mode Purge
Permanently deletes session data for this project. Two scopes are supported (issue #520):
- Project scope (
scope: "project"): wipes EVERYTHING — knowledge base, all session DB rows for every session, events markdown, and stats. - Session scope (
sessionId: "<id>"orscope: "session"): wipes ONLY the matching session's rows + FTS5 chunks. Sibling sessions, project stats, and the FTS5 store file are preserved.
Instructions
- Decide the scope first with the user:
- "Wipe just one session?" → ask for the
sessionId. - "Wipe the whole project?" → confirm scope:'project' (this is the destructive, irreversible default).
- "Wipe just one session?" → ask for the
- Warn the user about scope:'project'. Everything will be deleted:
- FTS5 knowledge base (all indexed content from
ctx_index,ctx_fetch_and_index,ctx_batch_execute) - Session events DB (analytics, metadata, resume snapshots) for ALL sessions in the project
- Session events markdown file
- In-memory session stats + persisted stats file
- FTS5 knowledge base (all indexed content from
- Call the
mcp__context-mode__ctx_purgeMCP tool with the chosen parameters:- Scoped:
{ confirm: true, sessionId: "<id>" }— implies scope:'session'. - Project:
{ confirm: true, scope: "project" }— explicit destructive form. - Bare
{ confirm: true }still works but emits a deprecation warning. Prefer the explicit forms.
- Scoped:
- Report the result to the user — the response lists exactly what was deleted and (for scoped purges) confirms that other sessions and project stats were preserved.
Schema rules
confirm: trueis always required.sessionIdandscope: "project"together is REJECTED as ambiguous (the sessionId implies session scope; combining with project scope contradicts intent).scope: "session"withoutsessionIdthrows — sessionId is required.
When to Use
- Scoped (per-session): scratch acceptance scenarios, drill replays, isolating a polluted session without losing the main working session's stats.
- Project: KB contains stale or incorrect content polluting search results, switching between unrelated projects in the same session, completely fresh start.
Important
ctx_purgeis the only way to delete session data. No other mechanism exists.ctx_statsis read-only — shows statistics only./clearand/compactdo NOT affect any context-mode data.- There is no undo. Re-index content if you need it again.
常见问题
清除之后能撤销吗?
不能。清除会永久删除数据,无法恢复。
项目范围和会话范围有什么区别?
项目范围会清除所有内容,而会话范围只删除该会话的记录,保留其他内容。
它会重置使用统计吗?
项目清除会同时清除统计,而会话清除会保留项目的统计。
详情
作者的原始描述
Purge the context-mode knowledge base. Permanently deletes all indexed content and resets session stats. This is destructive and cannot be undone. Trigger: /context-mode:ctx-purge
repo: mksglu/context-mode
热度
- GitHub 星标
- 33k
- 排名
- #8514
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
context-mode
33k教你的智能体使用 context-mode 工具来读取、搜索和运行大量数据的任务,让大型输出不占用主对话空间。
context-mode
33k教你的智能体在沙箱中处理数据密集型的工作,只输出答案,让原始文件和网页不会淹没对话。
context-mode
33k教你的智能体在输出可能很大时(例如日志、JSON 或构建结果),使用 context-mode 工具代替普通的 shell 命令。
ctx-doctor
33k运行 context-mode 诊断,检查运行环境、钩子、搜索存储、插件设置和版本,然后显示清晰的通过或失败报告。