Introduction
Contextwaise removes the context your model doesn't need before you pay for it. Your retrieval, prompts and model stay exactly as they are.
What Contextwaise does#
Most of what an LLM application sends is context: retrieved chunks, tool output, web pages, memory. Much of it is noise for the question at hand: near-duplicate chunks, background that isn't needed, passing test lines, HTML markup, empty JSON fields. You pay for every one of those tokens, on every request.
Contextwaise sits between building that context and calling your model. For each request it:
- Cleans structured noise (markup, progress bars, empty fields) without touching plain text.
- Scores every item for relevance to the question.
- Keeps what the answer needs, within a token budget, and drops duplicates.
- Reports what it kept, what it removed and why, with tokens and cost saved.
It never calls your model and never rewrites your prompts. It only decides which context is worth sending.
Two ways to integrate#
One HTTP call for RAG, search results, memory or any context you assemble. Works from any language.
For TypeScript and Python agents: one line for the Vercel AI SDK, one call per turn on the Anthropic and OpenAI SDKs. Every tool result is trimmed the moment it returns.
Both report to the same dashboard, and you can use both in one application: the API for retrieval, the SDK for the agent loop.
Where it fits#
Contextwaise is a filter at the door of the conversation. New context passes through it once, the first time it enters, and the optimized version is what you store and resend:
Design principles#
- Fail open. If Contextwaise is unreachable, send your original context. It is never the reason an LLM call fails.
- Your order, your format. Kept items come back in the order you sent them, unchanged except for cleanup.
- Explainable. Every item carries a score and a reason, visible in the response and in the dashboard.
- Cache-safe. Decisions are stable, so prompt caching keeps working across turns.
- Self-tuning. A quality check after each response adjusts how much each agent cuts.