Context Mode Purge

VerifiedCaution

Permanently deletes all session data and knowledge base for context mode, with project or session scope.

Sby Skills Guide Bot
Data & AIBeginner
7/23/2026
Claude Code
#context-management#knowledge-base#data-deletion#session-management#mcp

Recommended for

Automated summary

Permanently deletes the context-mode knowledge base and session data, either for the whole project or for a single session, through the ctx_purge MCP tool.

Strengths

  • Two distinct scopes: session scope preserves sibling sessions, project stats and the FTS5 store file, while project scope wipes everything
  • Requires confirm: true and rejects ambiguous (sessionId plus project scope) or incomplete (session scope without sessionId) parameter combinations
  • The returned result lists exactly what was deleted and, for scoped purges, confirms what was preserved
  • Explicitly states that /clear and /compact do not touch context-mode data, correcting a common misconception

Limitations

  • Irreversible: there is no undo, so content must be re-indexed if it is needed again
  • Depends on the context-mode MCP server and its ctx_purge tool, the only deletion mechanism available
  • The bare { confirm: true } call still works but emits a deprecation warning, which can mask an unclear intent
When to use it

Use it when the index holds stale or incorrect content that pollutes search results, or to clean up a scratch session in isolation without losing project-level statistics.

When not to use it

Avoid it when you only need to inspect statistics (ctx_stats is read-only) or when you might later want the deleted data back, since no restore path exists.

Security analysis

Caution
Quality score90/100

The skill invokes a legitimate MCP tool to purge context-mode data, which is a powerful but clearly scoped destructive operation. It mandates explicit confirmation, warns about irreversibility, and documents schema rules to prevent ambiguity. This is a caution rather than risky because it does not target system files, exfiltrate data, or bypass safety mechanisms; however, the irreversible deletion of all project knowledge warrants caution.

Findings
  • •Permanently deletes all indexed knowledge base content, session database rows, events markdown, and stats.
  • •Destructive action cannot be undone; requires explicit user confirmation via `confirm: true`.
  • •Project scope wipes all sessions for the entire project, not just the current one.
How this analysis is made

Examples

Full project reset
The context-mode index for this project is full of stale docs and search results are useless. Purge the whole project knowledge base with ctx_purge, scope project — and tell me exactly what got deleted.
Clean one session only
Wipe just session 7f3a-... from context mode so the other sessions and project stats stay intact. Ask me to confirm the sessionId before calling ctx_purge.
Start from scratch
I'm switching to an unrelated project in this session. Clear all context-mode data: knowledge base, session rows, events markdown and stats.

name: ctx-purge description: | 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 user-invocable: true

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.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/context-mode-purge-mrx3xyim/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/context-mode-purge-mrx3xyim' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/context-mode-purge-mrx3xyim/download' --output '.skill-downloads/context-mode-purge-mrx3xyim/SKILL.md.part' && mv '.skill-downloads/context-mode-purge-mrx3xyim/SKILL.md.part' '.skill-downloads/context-mode-purge-mrx3xyim/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/context-mode-purge-mrx3xyim/SKILL.md' && test -s '.skill-downloads/context-mode-purge-mrx3xyim/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/ctx-purge' && cp -R '.skill-downloads/context-mode-purge-mrx3xyim' '.claude/skills/ctx-purge'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/context-mode-purge-mrx3xyim'

openskills read 'context-mode-purge-mrx3xyim'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/context-mode-purge-mrx3xyim/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills