Ctx PurgeSAFE
Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.
Overview
Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.
a972bcb29455OBSERVED · 2026-10-07What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
---
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.Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | NA |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (0)
No findings outside the package's declared scope.
Gates applied: no_behavioural_pass.
a972bcb29455full audit observations/trust-audit/skill/mksglu__ctx-purge.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-07 | a972bcb29455 | SAFE | B | 89 | first audit |
Questions
What does the Ctx Purge skill do?
Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.
Is Ctx Purge safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can Ctx Purge access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
How current is this page?
The grade is for one exact copy of the source (a972bcb29455), read on 2026-10-07. The repository is watched, and a new audit runs when it changes — this is the first audit.