跳到主要内容
知仓学习社ZHICANG

ctx-purge

|

不碰外部(只输出文字)无严重或高危命中mksglu/context-mode

它会碰到什么

扫了多少1 个文本文件,3 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

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).
  1. 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
  1. 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.
  1. 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.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

它属于哪个仓库

星标★ 23,197
本站分层T1
该仓技能数11
原文件路径skills/ctx-purge/SKILL.md

同一个仓库里的其他技能

看这个仓库的全部 11 个技能