brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Use this skill whenever the user needs to reduce context bloat, lower token usage, summarize large code/docs corpora, run FTS plus embeddings retrieval, rerank top chunks, and produce compact context packets before implementation work. Also trigger when users say context is too
Claude Code
$ npx -y skills add Madhan230205/token-reducer --skill token-reducer --agent claude-code
Codex
$ npx skills add Madhan230205/token-reducer --skill token-reducer -a codex -y
Cursor
$ npx skills add Madhan230205/token-reducer --skill token-reducer -a cursor -y
Gemini CLI
$ npx skills add Madhan230205/token-reducer --skill token-reducer -a gemini-cli -y
GitHub Copilot
$ npx skills add Madhan230205/token-reducer --skill token-reducer -a github-copilot -y
OpenCode
$ npx skills add Madhan230205/token-reducer --skill token-reducer -a opencode -y
Windsurf
$ npx skills add Madhan230205/token-reducer --skill token-reducer -a windsurf -y
name: token-reducer description: Use this skill whenever the user needs to reduce context bloat, lower token usage, summarize large code/docs corpora, run FTS plus embeddings retrieval, rerank top chunks, and produce compact context packets before implementation work. Also trigger when users say context is too long, reduce tokens, optimize prompt size, retrieve top chunks, compress context, or ask for cost-saving prompt workflows. license: MIT compatibility: Python 3.10+ with SQLite FTS5. Fully local and free by default. Context7 MCP is optional. allowed-tools: [Read, Glob, Grep, Bash, Task] metadata: author: Madhan230205 version: "1.0.0"
Cut context size without cutting answer quality.
Claude Code often answers code questions with native **Read** / **Grep** on whole files, which loads raw text into the model and **bypasses** this pipeline. Long **chat history** is re-sent every turn, so costs compound even when code is compressed.
1. **Do not paste large code or logs into chat** — that bypasses reduction and burns tokens. 2. **Run the slash command first** so the pipeline runs before reasoning, for example: use `/token-reducer` with a short objective and paths (defaults come from plugin `settings.json`: small chunks, low `--top-k`, word budget, `relevanceFloor`). 3. **CLI (same pipeline)** when you want a packet on disk or in a script:
`python "${CLAUDE_PLUGIN_ROOT}/scripts/context_pipeline.py" run --inputs ./src --query "Locate JWT validation" --top-k 3`
Use a **specific query** (not “auth stuff”) so low-scoring chunks are dropped by the **relevance floor** before summarization.
4. **Session hygiene**: around **10** turns the hook suggests `/compact`; by **40–50** turns start a **new chat** for coding after planning.
1. Preprocess large/noisy corpus into overlap-aware chunks (size/overlap from `settings.json` → `chunkSizeWords` / `chunkOverlapWords`). 2. Index chunks into SQLite FTS5 and local embeddings. 3. Retrieve with BM25-first policy; vector fallback when configured. 4. Merge + rerank; keep top **K** (default **3** from `defaultTopK` in `settings.json`). 5. Compress with TextRank/word budget; drop chunks below **`relevanceFloor`**. 6. Emit citation-rich packet + savings telemetry.
`python "${CLAUDE_PLUGIN_ROOT}/scripts/context_pipeline.py" run --inputs . --query "${ARGUMENTS}" --hybrid-mode fallback --top-k 3`
`python "${CLAUDE_PLUGIN_ROOT}/scripts/context_pipeline.py" self-test`
Session reminders: top-level **`promptGuard`** (`autoCompactTurn`, `autoResetTurn`, `criticalResetTurn`, `reminderTurns`) plus `historyCompactReminderTurns` inside `tokenReducer`.
⚡ Cut Claude token usage by 90%+ — free, open-source, local-first context compression for Claude Code. Hybrid RAG (BM25 + ONNX vectors), AST chunking, reranking. No API needed.
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.