sandeco-token-reduce-ollama
Skill by sandeco
Compresses prompts with a local Ollama model before they are sent to Claude. Built for users who want to cut token cost and latency and keep the rewrite on their own machine.
Install sandeco-token-reduce-ollama
Built from the published package, never by AI.
git clone --depth 1 https://github.com/sandeco/prompts /tmp/prompts && mkdir -p ~/.claude/skills && cp -r /tmp/prompts/sandeco-token/sandeco-token-reduce-ollama ~/.claude/skills/sandeco-token-reduce-ollamaRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install sandeco-token-reduce-ollama in Claude Code
git clone --depth 1 https://github.com/sandeco/prompts /tmp/prompts && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/prompts/sandeco-token/sandeco-token-reduce-ollama ~/.gemini/antigravity-cli/skills/sandeco-token-reduce-ollamaAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install sandeco-token-reduce-ollama in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
Sandeco Token Reduce Ollama is an agent skill that compresses prompts before they are sent to Claude. It rewrites text with a local Ollama model, qwen3:8b by default, instead of classifying tokens with BERT as the LLMLingua-2 skill does. Input can be direct text, a .txt file, or a PDF. For PDFs, the skill extracts markdown with pymupdf4llm, saves the .md next to the PDF, and then compresses it.
The script reports token counts before and after compression, along with the ratio and saving. It can also send the compressed context and a question to Claude with the --ask option, which needs ANTHROPIC_API_KEY. The skill suits users who want local preprocessing, more fluent output than sentence-level cutting, and privacy, since the source says nothing leaves the machine. Use the LLMLingua-2 skill instead when exact word preservation matters.
Written from the project's SKILL.md and checked against it.
What it can do
- Text compressionRewrites direct text with a local Ollama model to reduce token count.
- File compressionCompresses the contents of a .txt file using the same Ollama rewrite.
- PDF to markdownExtracts a PDF to markdown with pymupdf4llm and saves the .md next to the PDF.
- Compression metricsReturns original and compressed token counts, the ratio and the saving, optionally as JSON.
- Ask ClaudeWith --ask, sends the compressed context and a question to Claude.
- Model selectionSwitches the Ollama model with --ollama-model. Default is qwen3:8b.
- Automatic setupCreates a virtual environment, installs packages and pulls the model on first run.
What you need
- Ollama installed and running (ollama serve)
- Python
- ANTHROPIC_API_KEY set in the environment, for the --ask option
Try asking
- Compress this long text with Ollama at rate 0.4
- Compress the PDF report.pdf locally with Ollama before sending it to Claude
- Summarize notes.txt with the local qwen3 model and ask Claude about it
Good to know
- Compression is approximate. The model may not reach the requested rate.
- Generative rewriting can paraphrase, so original words are not preserved.
- At rate 0.2 the model tends to stop around 30 percent, according to the source.
- If the Ollama daemon is not running, compress.py stops with an error.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: sandeco-token/sandeco-token-reduce-ollama/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to sandeco-token-reduce-ollama
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
sandeco-token-reduce-ollama: common questions
How is this different from LLMLingua-2 compression?
This skill rewrites the text with a generative Ollama model. LLMLingua-2 keeps original tokens by classifying them with BERT-based models.
Does it work with PDF files?
Yes. It converts the PDF to markdown with pymupdf4llm, saves the .md file beside the PDF, and compresses that markdown.
Do I need an Anthropic API key?
Only for the --ask option, which sends the compressed context to Claude. Compression alone runs on the local Ollama model.
How do I install sandeco-token-reduce-ollama?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is sandeco-token-reduce-ollama free?
The code is public, but no licence file was found, so check the repository before commercial use.
Is sandeco-token-reduce-ollama safe to use?
It scores 67 of 100. Grades: maintenance B, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to sandeco-token-reduce-ollama?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
