Agent Skillsmksglu/context-mode › ctx-purge

ctx-purge

GitHub

用于永久删除上下文模式知识库及会话数据,支持项目或单会话范围。需确认操作并调用MCP工具执行,提供详细清理报告,不可撤销。

skills/ctx-purge/SKILL.md mksglu/context-mode

Trigger Scenarios

用户需要清理上下文知识库 会话数据污染需要重置 切换项目需清除旧数据

Install

npx skills add mksglu/context-mode --skill ctx-purge -g -y
More Options

Use without installing

npx skills use mksglu/context-mode@ctx-purge

指定 Agent (Claude Code)

npx skills add mksglu/context-mode --skill ctx-purge -a claude-code -g -y

安装 repo 全部 skill

npx skills add mksglu/context-mode --all -g -y

预览 repo 内 skill

npx skills add mksglu/context-mode --list

SKILL.md

Frontmatter
{
    "name": "ctx-purge",
    "description": "Purge the context-mode knowledge base. Permanently deletes all indexed content\nand resets session stats. This is destructive and cannot be undone.\nTrigger: \/context-mode:ctx-purge\n",
    "user-invocable": true
}

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.

Version History

  • 6aad62f Current 2026-07-24 17:38

Same Skill Collection

configs/antigravity-cli/skills/context-mode/SKILL.md
configs/copilot-cli/skills/context-mode/SKILL.md
skills/ctx-doctor/SKILL.md
skills/ctx-index/SKILL.md
skills/ctx-insight/SKILL.md
skills/ctx-search/SKILL.md
skills/ctx-stats/SKILL.md
skills/ctx-upgrade/SKILL.md
.claude/skills/context-mode-ops/SKILL.md
skills/context-mode/SKILL.md

Metadata

Files
0
Version
a029670
Hash
1961df70
Indexed
2026-07-24 17:38

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 20:11
浙ICP备14020137号-1 $mapa de visitantes$