ctx-purge
What it does
This skill erases the search index and session data that context-mode saved for a project. It is for people who want to clear old indexed content or start fresh.
When to use it
- ✓When someone wants to remove indexed content from one past session.
- ✓When a project's search index is cluttered and everything should be cleared.
- ✓When someone wants a clean start before indexing the project again.
Skill link
https://github.com/mksglu/context-mode/blob/main/skills/ctx-purge/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Clear the context-mode index for this project so I can start fresh.”
5 new skills a week. 1 minute to read.
How it works
The skill first asks whether to wipe one session or the whole project, then warns you about what will be deleted. It runs the purge only after you confirm the scope.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
- 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).
- "Wipe just one session?" → ask for the
- 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
- FTS5 knowledge base (all indexed content from
- Call the
mcp__context-mode__ctx_purgeMCP 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.
- Scoped:
- 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.
FAQ
Can I undo a purge?
No. Purging permanently deletes the data, so it cannot be recovered.
What is the difference between project and session scope?
A project scope wipes everything, while a session scope removes only that session's rows and keeps the rest.
Does it reset usage stats?
A project purge also clears the stats, while a session purge keeps the project stats.
Details
Original description by the author
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
repo: mksglu/context-mode
Popularity
- GitHub stars
- 33k
- Ranking position
- #8514
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
context-mode
33kTeaches your agent to use context-mode tools for reading, searching and running data-heavy tasks, so large outputs stay out of the main conversation.
context-mode
33kTeaches your agent to run data-heavy work in a sandbox and print only the answer, so raw files and web pages do not flood the conversation.
context-mode
33kTeaches your agent to use context-mode tools instead of plain shell commands when output may be large, such as logs, JSON or build results.
ctx-doctor
33kRuns context-mode diagnostics that check runtimes, hooks, search storage, plugin setup and versions, then shows a clear pass or fail report.
Similar skills
add-model-provider
394kLets your agent connect a new AI model provider to OpenClaw using safe setup commands, keep API keys out of plain text, and run a live test.
acp-router
394kHelps your agent send a task to a coding assistant such as Claude Code or Cursor through OpenClaw, so the work runs in that tool.
browser-automation
394kTeaches your agent to control web pages step by step, including logins, tabs, and recovery when a page stops responding.