跳到正文
Skillpedia
智能体33k · #8514

ctx-purge

它能做什么

这个技能清除 context-mode 为项目保存的搜索索引和会话数据。适合想清除旧的索引内容或重新开始的人。

适用场景

  • ✓当有人想删除某次过去会话中的索引内容的时候。
  • ✓当项目的搜索索引很杂乱,需要全部清除的时候。
  • ✓当有人想在重新索引项目之前干净地重新开始的时候。

技能链接

https://github.com/mksglu/context-mode/blob/main/skills/ctx-purge/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mksglu/context-mode/blob/main/skills/ctx-purge/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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>" or scope: "session"): wipes ONLY the matching session's rows + FTS5 chunks. Sibling sessions, project stats, and the FTS5 store file are preserved.

Instructions

  1. 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).
  2. 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
  3. Call the mcp__context-mode__ctx_purge MCP 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.
  4. 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: true is always required.
  • sessionId and scope: "project" together is REJECTED as ambiguous (the sessionId implies session scope; combining with project scope contradicts intent).
  • scope: "session" without sessionId throws — 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_purge is the only way to delete session data. No other mechanism exists.
  • ctx_stats is read-only — shows statistics only.
  • /clear and /compact do 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能