ctx_purge
Permanently delete indexed content — a single session or the whole project — and reset stats.
ctx_purge is the deliberate reset. It irreversibly deletes indexed content from
the knowledge base, either for one session or for the entire project. Because it
destroys data, it requires explicit confirmation and exactly one scope before it
runs.
This is destructive and cannot be undone. There is no recovery — only run it when you are certain you want to delete the data for the scope you choose.
Parameters
| Parameter | Required | Description |
|---|---|---|
confirm | yes | Must be true. Anything else returns purge cancelled and deletes nothing. |
sessionId | one scope | The UUID of a single session to purge. Wipes only that session's events and per-session chunks; sibling sessions and the stats file are preserved. Must not be combined with scope: "project". |
scope | one scope | "project" wipes the entire project — every session, the FTS5 knowledge base, captured events, and the stats file. "session" requires sessionId. |
Pass exactly one scope. Combining sessionId with scope: "project" returns an
ambiguity error, and scope: "session" without a sessionId is rejected.
A bare ctx_purge(confirm: true) with no scope is deprecated. It currently maps
to scope: "project" with a warning and will hard-error in a future major
version, so always name a scope.
Scopes
Per-session
Purge a single conversation's data and leave everything else intact. Useful when one session accumulated noise you want gone without touching the rest of the project.
ctx_purge(
confirm: true,
sessionId: "7c8a-1234-5678-9abc-def012345678"
)This removes that session's auto-captured events — decisions, errors, plans, user prompts, rejected approaches — and its per-session FTS5 chunks. Sibling sessions and your stats are preserved.
Per-project
The full wipe. Reach for it when you want to start over completely, for example before switching to an unrelated project or when stale content is polluting your search results across the board.
ctx_purge(
confirm: true,
scope: "project"
)This deletes the entire FTS5 knowledge base, every session row, the captured events markdown, and resets the stats file to zero.
What a project purge removes
- All indexed content in the FTS5 knowledge base — gathered command output, fetched documents, and anything you indexed by hand.
- Captured session memory: prompts, decisions, and constraints stored across sessions.
- Session statistics, reset to zero.
The knowledge base is designed to persist. It normally survives a /clear and a
/compact, so your indexed content and session memory stay available across those
operations. Purge is the one path that removes it on purpose.
Run ctx_stats first if you want to record your savings before a project purge resets them.
Slash command
In Claude Code and Cursor, you can trigger a purge interactively. It asks for explicit confirmation before deleting anything.
/context-mode:ctx-purgeConfirm the prompt to proceed. Decline it and nothing is touched.