promptthrift_compress_historyLABSCO SUMMARY
Compression pays off on long conversations, and barely registers on short ones.
The publisher's own rule of thumb is to start after 8-10 turns: a short, dense technical exchange has little filler to strip and gives back 15-25%, while a 30-turn debugging session where only the conclusion matters is where the 70-90% figures come from. The Gemma 4 path costs nothing but spends roughly 10-15 seconds per call, which suits a background trim rather than something sitting in the user's critical path. Pin the facts that must survive before the first compression rather than after it, since the pinned list is what guarantees they appear in every summary that follows.
What it is
A local MCP server aimed at the cost of resending conversation history on every API call. Four tools: compress the older turns into a summary, keep a never-compress list of facts, count tokens and cost across 14 models, and suggest a cheaper model for a simple task. Everything runs on your machine — with Ollama present it compresses using Gemma 4, and without it falls back to rule-based extraction.
What you get
- promptthrift_compress_history replaces older turns with a summary and leaves the recent ones intact
- Two compression modes, picked automatically: rule-based extraction is instant and typically removes 50-60%, while Gemma 4 through Ollama takes roughly 10-15 seconds and typically removes 70-90%
- promptthrift_pin_facts keeps named facts — a customer's allergy, a decision already taken — present in every future summary rather than at the mercy of the compressor
- promptthrift_count_tokens reports usage and cost across 14 models, from the local Gemma 4 builds at $0.00 up to claude-opus-4.6 at $5.00 per million input tokens
- promptthrift_suggest_model recommends the cheapest model that still fits the task
- A post-compression sanitizer strips prompt-injection patterns out of the generated summary before it is fed back into a conversation
Requirements
Python 3.10+. Clone the repository, run pip install -e . inside it, and launch server.py from that folder over stdio. Gemma 4 compression is optional: install Ollama, pull gemma4:e4b, and the server detects it with no configuration. PROMPTTHRIFT_OLLAMA_MODEL, PROMPTTHRIFT_OLLAMA_URL (default http://localhost:11434) and PROMPTTHRIFT_DEFAULT_MODEL (default claude-sonnet-4.6) are all optional. Nothing leaves the machine: no persistent storage, no telemetry, no third-party calls. MIT.
Setup effort
Build from source — git clone https://github.com/woling-dev/promptthrift-mcp.git
USE CASES
Stopping a long chat from getting more expensive every turn
Fold the earlier turns into a summary while the recent ones stay verbatim. Worth doing once a conversation passes eight to ten turns, not before.
Making sure a critical detail is never summarised away
Add it to the never-compress list and it appears in every future summary, independent of what the compressor decides is important.
Working out where the token budget is actually going
Count the conversation against 14 models and compare what the same history would cost on each, including the local builds that cost nothing.
Routing simple requests to a cheaper model
Ask for the cheapest model that fits the task instead of sending everything to the largest one by default.
4 tools
Listed in project docs. Your client may show a different list.
promptthrift_count_tokenspromptthrift_suggest_modelpromptthrift_pin_factsBEFORE YOU INSTALL
What to know first
Tools you get
4 tools named in the project's documentation.
Requires
- Python 3.10+
- git on PATH
Where it runs
All 3 documented clients run the server on your machine.
INSTALLATION
Connect your client
You clone this one yourself.
Server setup
git clone https://github.com/woling-dev/promptthrift-mcp.git
cd promptthrift-mcp
pip install -e .Optional, for Gemma 4 compression: install Ollama from https://ollama.com, then run ollama pull gemma4:e4b
Add the mcpServers block to claude_desktop_config.json (Claude Desktop) or to your MCP settings (Cursor / Windsurf), pointing args at server.py in the promptthrift-mcp folder you cloned.
MCP Clients
Claude Desktop, Cursor, Windsurf
{
"mcpServers": {
"promptthrift": {
"command": "python",
"args": [
"<YOUR_PATH_TO_PROMPTTHRIFT_MCP>/server.py"
]
}
}
}