Purge Knowledge Base
ctx_purgePermanently deletes indexed content for a specific session or entire project. Specify with confirm:true and either sessionId or scope:'project'.
Instructions
DESTRUCTIVE — permanently delete indexed content. CANNOT be undone.
You MUST specify exactly ONE scope:
• { confirm: true, sessionId: "" } Deletes ONLY that session's events + per-session FTS5 chunks. Preserves stats file and ALL other sessions.
• { confirm: true, scope: "project" } Wipes the ENTIRE project: FTS5 knowledge base, every session DB row, events markdown, AND resets the stats file.
REFUSAL RULES (tool returns an error): • confirm: false → 'purge cancelled' • Both sessionId AND scope:'project' provided → 'ambiguous — pick one' • scope:'session' without sessionId → throws (sessionId required) • Neither sessionId NOR scope provided → DEPRECATED: maps to scope:'project' with a deprecation warning to stderr. Will be a hard error in a future major.
Use sessionId when the user asks to clear a specific conversation's data. Use scope:'project' ONLY when the user explicitly asks to reset everything. NEVER call with bare {confirm:true} — always specify the scope.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | Yes | MUST be true. Destructive operation; false returns 'purge cancelled'. | |
| sessionId | No | UUID of a single session. Pairs with confirm:true to wipe only that session's events + per-session FTS5 chunks. Sibling sessions and the stats file are preserved. MUST NOT be combined with scope:'project'. | |
| scope | No | Explicit scope selector. 'session' REQUIRES sessionId. 'project' wipes the entire project (FTS5 + every session + stats). Omit only for the deprecated bare-{confirm:true} back-compat path. |