ctx-purge

ctx-purge is a skill for Claude Code from opencue/cuecards. It costs 42 tokens per session (630 once invoked), scanned A, original, MIT.

A cleanup tool that permanently removes indexed Context Mode data and resets its session statistics. It can target one session or the whole project.

In plain words
What is it for?
Use it to erase a selected session's data or wipe the entire project's Context Mode knowledge base and related records after confirming the scope.
Why use it?
It provides a way to delete stored processing data when it is no longer needed, but deletion cannot be undone.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to erase a selected session's data or wipe the entire project's Context Mode knowledge base and related records after confirming the scope.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/opencue/cuecards/ctx-purge
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add opencue/cuecards --skill ctx-purge
Clone the repo
git clone --depth 1 https://github.com/opencue/cuecards

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ctx-purge

README.md
[![agentmods](https://agentmods.dev/badge/skills/opencue/cuecards/ctx-purge.svg)](https://agentmods.dev/skills/opencue/cuecards/ctx-purge)
Your own site
<a href="https://agentmods.dev/skills/opencue/cuecards/ctx-purge"><img src="https://agentmods.dev/badge/skills/opencue/cuecards/ctx-purge.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 630 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.00630
Opus 5 $0.00021 $0.00315
Sonnet 5 $0.00008 $0.00126
Haiku 4.5 $0.00004 $0.00063

Measured 7d ago against content hash 1961df70dcdd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

ctx-purge scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/ctx-purge/SKILL.md · 50 lines

How it starts

The opening of the file, as written. The whole thing — 50 lines — stays where its author put it; the contents beside it link to each section on 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>" 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.

Read the full file on GitHub · 50 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 50 lines · 42 tokens per session scan A 1961df70dcdd

Subscribe to this mod's changes

ctx-purge is a skill published in the GitHub repository opencue/cuecards (5 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 630 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

atomic-wiki

Conversational wiki and capture-bucket routing. Fires when the user wants a place, space, or folder for notes, research, tickets, raw dumps, or knowledge capture — checks the block in /.claude/CLAUDE.md; if the cwd is under a registered realm, creates the folder as a bucket via atomic wiki bucket add rather than a…

damusix/atomic-claude · 204 tokens

next

Produce a clean handoff to a fresh Claude Code window. Use when the current conversation is too long (>400K tokens, hallucinations, lost context, or the user wants to close the window). "/next" produces a handoff, "/next list" shows all pending, "/next remove X" deletes one.

llmapi-pro/claude-next · 66 tokens

durable-session-state

Persist plans, scope decisions, evidence, and reviewer/critic verdicts to durable files during long or multi-phase tasks so work survives context compaction, session resumes, and handoffs. Use for swarm-mode tasks, before context grows large, when recording approval gates, and when resuming after compaction or a…

ZaxbyHub/opencode-swarm · 70 tokens

token-optimization

Use when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity. Covers TokenStack, the built-in compression proxy that shrinks Claude Code tool output before it reaches the Anthropic API. Do NOT use for…

cwinvestments/memstack · 79 tokens

state

Use when the user says 'update state', 'project state', 'where was I', or at session start to load current context.

cwinvestments/memstack · 29 tokens

memory

Persistent, token-efficient project memory. When ON, maintains a .shob/memory/ folder of structured .md files so the full context of the project is NEVER lost across responses, sessions, or context compaction. Uses progressive disclosure — routes through a lightweight INDEX and loads only the files a task needs…

shobcoder/shob · 146 tokens