PluginBench
Skill
Pass
Audit score 90

ctx-purge

mksglu/context-mode

Permanently delete context-mode knowledge base and session data with project or session scope.

What is ctx-purge?

ctx-purge irreversibly wipes indexed content, session analytics, and stats from context-mode. Use it to reset a polluted knowledge base, isolate a single session, or start fresh with a new project. This is destructive and cannot be undone.

  • Delete all indexed content (FTS5 knowledge base) at project or session scope
  • Wipe session events database, analytics metadata, and resume snapshots
  • Clear in-memory and persisted session statistics
  • Preserve sibling sessions and project stats when using session-scoped purge
  • Require explicit confirmation to prevent accidental data loss

How to install ctx-purge

npx skills add https://github.com/mksglu/context-mode --skill ctx-purge
Prerequisites
  • context-mode skill installed and initialized
  • MCP tool `mcp__context-mode__ctx_purge` available
Claude Code
Cursor
Windsurf
Cline

How to use ctx-purge

  1. 1.Decide whether to purge a single session or the entire project scope
  2. 2.For session scope: obtain the sessionId of the session to delete
  3. 3.For project scope: confirm with the user that ALL project data will be permanently deleted
  4. 4.Call the MCP tool with `confirm: true` and either `sessionId: "<id>"` (session scope) or `scope: "project"` (project scope)
  5. 5.Review the response to confirm what was deleted and what was preserved

Use cases

Good for
  • Reset a knowledge base polluted with stale or incorrect indexed content
  • Isolate and delete a single session's data without affecting other working sessions
  • Perform a complete fresh start when switching between unrelated projects
  • Clean up after acceptance test scenarios or drill replays
  • Remove analytics and metadata for a specific session while keeping project history
Who it's for
  • Developers managing context-mode knowledge bases
  • Teams switching between unrelated projects in the same session
  • QA engineers running isolated test sessions
  • Anyone needing to permanently delete sensitive or outdated indexed content

ctx-purge FAQ

Can I undo a purge?

No. ctx-purge is irreversible. If you need the content again, you must re-index it.

What is the difference between session and project scope?

Session scope deletes only one session's rows and FTS5 chunks; sibling sessions and project stats are preserved. Project scope deletes everything: the entire knowledge base, all sessions' data, events, and stats.

Do /clear or /compact affect context-mode data?

No. Only ctx-purge can delete context-mode data. /clear and /compact do not affect the knowledge base or session analytics.

What happens if I specify both sessionId and scope:'project'?

The request is rejected as ambiguous. Choose one: either sessionId (implies session scope) or scope:'project' (explicit project scope).

Is confirm:true always required?

Yes. confirm: true is mandatory to prevent accidental deletion.

Full instructions (SKILL.md)

Source of truth, from mksglu/context-mode.


name: ctx-purge description: | 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 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.