Ctx Purge

by mksglua6c43765d26bNo license25K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated today

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

Instructions onlyDevOps & Cloud
AI-generated overview

Purges a context-mode knowledge base, deleting indexed content and session data by project or session scope.

What it does
This skill guides an agent through permanently deleting context-mode session data for a project. It supports two scopes: project scope, which wipes the knowledge base, all session database rows, the events markdown file and stats, and session scope, which removes only one session's rows and FTS5 chunks while preserving sibling sessions and project stats. It instructs the agent to confirm scope with the user, warn about destructive project-wide deletion, call the ctx_purge MCP tool with confirm set to true, and report what was deleted.
When to use it
Use it when indexed context-mode content is stale or incorrect and pollutes search results, when starting completely fresh, or when isolating a single polluted session without losing the main working session's statistics.
Requirements
Requires the context-mode MCP server exposing the ctx_purge tool; no scripts are shipped, and the skill is instructions only.

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.

Source and attribution

Source:mksglu/context-modeinskills/ctx-purgeat commita6c4376

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal