
Trimwise
Smart text trimming for LLM prompts backed by research.
- Open source
- yes
“GitHub - tenwritehq/trimwise: Smart, source-faithful text trimming for high-signal LLM prompts. · GitHub”its own headline
⚿ 8 contact fields stay closed. Everything it says about itself is open; how to reach it needs an account. Open them →
What it says it will not do
“It does not install FastEmbed or download an embedding model.”Built on
How it runs1
“Trimwise is available under the MIT License .”
What it offers as proof2
“EXPLORE BY TYPE Customer stories”
“…trimwise.readthedocs.io/ -> https://trimwise.readthedocs.io/”
What it names2
“Token budgets use Tiktoken and the o200k_base encoding by default:”
“It does not install FastEmbed or download an embedding model.”
What it calls itself1
“Trimwise is a light-weight, extractive Python library for creating compact, high-signal excerpts from documents, blog posts, search results, logs, and tool outputs when assembling a LLM prompt.”
About
Trimwise is a light-weight, extractive Python library for creating compact, high-signal excerpts from documents, blog posts, search results, logs, and tool outputs when assembling a LLM prompt. Instead of the usual `text[:N]` which keeps only the first N characters or tokens, Trimwise selects useful fragments from across the document, returns them in source order, and guarantees that the measured result stays within your token, word, or character limit. This is especially useful when an agent has several sources but cannot place every source in the context window. Rather than assume the first N characters have all the information in each article, report, note, or search result, Trimwise gives each source a smarter evidence budget while leaving your system prompt, instructions, examples, and output schema untouched. Trimwise also allows you to trim text according to a given query - that means, the parts of the text kept in the final excerpt will adjust so that it provides the richest signal for that query. This allows you to improve your response quality when working with RAG systems where long form documents dominate without needing to write a separate layer to handle what gets kept from a retrieved source. Trimwise borrows heavily from established research. Read more on that [here](https://trimwise.readthedocs.io/en/latest/research-foundations/). Questions, feedback and feature requests are welcome! Do star the repo if you find it useful.



