Live data from Hacker News

Local LLM compresses long prompts before they reach Claude – MCP server

github.com

1–3 of 3 posts

Re: Local LLM compresses long prompts before they reach Claude – MCP server

#2
I built a two-stage prompt compressor that runs entirely locally before your prompt hits any frontier model API.

  How it works:
  1. llama3.2:1b (via Ollama) compresses the prompt to its semantic minimum
  2. nomic-embed-text validates that the compressed version preserves the original meaning (cosine ≥ 0.85)
  3. If validation fails → original is returned unchanged. No silent corruption.

  When it actually helps:
  The effect is meaningful only on longer inputs. Short prompts are skipped entirely — no cost, no risk.

  ┌─────────────────────────────────┬────────────┬────────┐
  │              Input              │   Tokens   │ Saving │
  ├─────────────────────────────────┼────────────┼────────┤
  │