
Ctx Purge
- 799 installs
- 19.6k repo stars
- Updated August 4, 2026
- mksglu/context-mode
ctx-purge is an agent skill that permanently resets or cleans an accumulated Context Mode knowledge base when it has become bloated or contaminated for developers who use context-mode indexing and need destructive sessio
About
ctx-purge is a Context Mode agent skill triggered via /context-mode:ctx-purge that permanently deletes indexed content and resets session stats. Two scopes are supported: project scope wipes the entire knowledge base, all session DB rows, events markdown, and stats; session scope wipes only one session's rows and FTS5 chunks while preserving sibling sessions and the FTS5 store file. The operation is destructive and cannot be undone. Developers reach for it when agent context has grown stale, duplicated, or polluted and a full or selective reset is required.
- Supports two purge scopes: project (full wipe) and session (targeted cleanup)
- Destructive project scope deletes FTS5 knowledge base, all session DB rows, events markdown, and stats
- Session scope preserves sibling sessions, project stats, and the main FTS5 store file
- Requires explicit user confirmation before any deletion
- Triggered via /context-mode:ctx-purge command
Ctx Purge by the numbers
- 799 all-time installs (skills.sh)
- +90 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #1,323 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mksglu/context-mode --skill ctx-purgeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 799 |
|---|---|
| repo stars | ★ 19.6k |
| Last updated | August 4, 2026 |
| Repository | mksglu/context-mode ↗ |
How do you reset a bloated Context Mode knowledge base?
Permanently reset or clean an accumulated Context Mode knowledge base when it has become bloated or contaminated.
Who is it for?
Developers using Context Mode whose indexed agent knowledge base is bloated, duplicated, or contaminated and needs a irreversible reset.
Skip if: Developers who only need to inspect or incrementally update context without deleting all indexed session data.
When should I use this skill?
A developer invokes /context-mode:ctx-purge or asks to permanently reset, wipe, or clean a Context Mode knowledge base.
What you get
Cleared Context Mode knowledge base entries, deleted session DB rows, removed FTS5 chunks, and reset session statistics for the chosen scope.
- cleared knowledge base
- reset session statistics
Files
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>"orscope: "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: trueis always required.sessionIdandscope: "project"together is REJECTED as ambiguous (the sessionId implies session scope; combining with project scope contradicts intent).scope: "session"withoutsessionIdthrows — 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_purgeis the only way to delete session data. No other mechanism exists.ctx_statsis read-only — shows statistics only./clearand/compactdo NOT affect any context-mode data.- There is no undo. Re-index content if you need it again.
Related skills
How it compares
Pick this over incremental context edits when the indexed knowledge base is contaminated and needs a full or per-session wipe.
FAQ
What is the difference between project and session purge in ctx-purge?
ctx-purge project scope wipes the entire knowledge base, all session DB rows, events markdown, and stats. Session scope deletes only the matching session's rows and FTS5 chunks while preserving sibling sessions and the FTS5 store file.
Can ctx-purge be undone?
ctx-purge permanently deletes indexed Context Mode content and resets session stats. The purge is destructive and cannot be undone, so developers should confirm scope before running it.