ctx-purge
🤖 AI Summary
**`ctx-purge`** permanently deletes session data for a project. It supports two scopes: `scope: "project"` (wipes everything: knowledge base, all session DB rows, events, and stats) or `scope: "session"` / `sessionId: "
How to Install
Claude Code:
git clone --depth 1 https://github.com/mksglu/context-mode.git && cp context-mode/skills/ctx-purge ~/.claude/skills/ctx-purge -r# 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: ""` 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: "" }` — 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.
Details
| Category | Data → data_proc |
| Source | mksglu/context-mode |
| SKILL.md | View on GitHub → |
| Repo Stars | ★ 18.0K |
| Est. per Skill | ~2.0K (shared across 9 skills from this repo) |
| Difficulty | Intermediate |
| Risk Level | N/A |
Related Skills
monte-carlo-prevent
Monte Carlo Prevent Skill This skill brings Monte Carlo's data observability context directly into y
pdf-conversion-router
PDF Conversion Router Route every PDF conversion through a short analysis step before choosing tools
sql-pro
You are an expert SQL specialist mastering modern database systems, performance optimization, and ad
postgresql-optimization
PostgreSQL Optimization Workflow Overview Specialized workflow for PostgreSQL database optimization
Works Well With
Skills from the same repository — often designed to work together
context-mode
Context Mode: Default for All Large Output MANDATORY RULE Default to context-mode for ALL commands.
ctx-doctor
Context Mode Doctor Run diagnostics and display results directly in the conversation. Instructions 1
ctx-index
Context Mode Index Index local project content for later search. Instructions 1. Prefer the ctxindex