Context Mode Purge

SkillDocs & knowledge

This skill purges the context-mode knowledge base for a project. It permanently deletes indexed content and resets session stats, either for one session or for the entire project. The agent confirms the scope with you first, warns that project-wide deletion is irreversible, then calls the purge tool and reports exactly what was removed. There is no undo, so deleted content must be re-indexed if it is needed again.

Then ask your AI: use the Context Mode Purge skill

Details

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Have the context-mode knowledge base set up for the project you want to purge.

What your AI can do with it

  • Delete all indexed content in the context-mode knowledge base for a project
  • Wipe a single session's rows and FTS5 chunks while keeping sibling sessions
  • Reset in-memory and persisted session stats
  • Remove the session events database and markdown file for a project
  • Report exactly what was deleted after a purge

Getting started

  1. Have the context-mode knowledge base set up for the project you want to purge.
  2. Decide with the agent whether to wipe one session or the whole project.
  3. For a single session, provide the sessionId; for the whole project, confirm project scope.
  4. Run the purge with confirm set to true and the chosen parameters.
  5. Read the result to see what was removed and whether other sessions were preserved.

What this skill tells your AI

The instructions your AI receives, as published by mksglu/context-mode in skills/ctx-purge/SKILL.md and read by Ahel’s review.

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.

Signals

GitHub stars
26k
Forks
2k
Last commit
Oct 2026

Questions

Can I undo a purge?
No. There is no undo. Deleted content must be re-indexed if you need it again.
Does /clear or /compact affect context-mode data?
No. /clear and /compact do not affect any context-mode data. ctx_purge is the only way to delete session data.
What is the difference between session scope and project scope?
Session scope wipes only the matching session's rows and FTS5 chunks, preserving sibling sessions, project stats, and the FTS5 store file. Project scope wipes everything: the knowledge base, all session DB rows, events markdown, and stats.
Advanced
Item type
skill
Key
ctx-purge
Source
github.com/mksglu/context-mode