Short answer
Use trim-1 to evaluate local line selection for long documents; skip it if you require guaranteed output sizing or large savings from dense coding-agent output. The authors' balanced benchmark removed 88.9% of tokens from long-document cases and only 1.9% from agent traces. Our sandbox installed the project in 1 second, built it in 11 seconds and completed its recorded test step in 4 seconds. The workload is the useful starting point for an adoption decision.
trim-1 is a query-aware line filter: it keeps selected input lines in their original order and inserts markers for removed passages. It preserves retained text verbatim. That makes it interesting for logs, paths and identifiers whose spelling matters. The trim-1 README recommends balanced for long documents and balanced or conservative for coding-agent results. Start with those settings and compare the reader's answer with the answer produced from the original context.
What people use trim-1 for
The project authors report much larger balanced cuts on long documents than on coding-agent traces, with retrieved-code results between those workloads. Their evidence labels make the distinction useful: agent traces track information used in later turns, retrieved code tracks lines edited by a gold patch, and document QA tracks supporting facts. Each row names the source and the outcome so that a token cut stays attached to the task it describes.
| Use | Who did it and what happened | Decision it supports |
|---|---|---|
| Filter long documents before question answering | The authors report 88.9% token reduction and a 94.4% evidence-case pass rate on 90 long multi-hop QA cases at balanced. Model card | Start with documents containing a small amount of query-relevant material. |
| Trim coding-agent tool output | The authors report 1.9% token reduction with all labelled evidence retained in 200 agent-trace cases at balanced. Model card | Accept small cuts when the next agent turn needs most of the output. |
| Select lines from retrieved code | The authors report 21.8% token reduction and a 90.7% evidence-case pass rate on 150 retrieved-code cases at balanced. Model card | Check whether lines needed for the eventual edit survive selection. |
| Trim a log containing Windows newlines | The reporter of issue #3 reproduced mixed CRLF/LF output through Policy.Apply and Compress. CRLF report | Include newline-sensitive consumers in an integration check. |
Keeping an edited line answers a different question from completing a coding task correctly. Likewise, retaining supporting facts and producing a correct answer are separate outcomes. The authors' model card reports both evidence retention and reader answers, allowing a developer to compare them rather than choosing an operating point from compression alone. For retrieved code, the practical question is whether selection preserves the material the eventual edit needs.
What happened when we ran it
Our source-check sandbox at commit 293d1fd on November 15, 2026 recorded a successful 1-second install, 11-second build and 4-second test step. The configuration was 3 CPUs, 8 GB RAM and image label golang:1.24-bookworm. The checkout scan recorded 16 files, about 1,823 source lines and 1.6 MB checked out. It found 0 CI workflow files, no Dockerfile and no tests directory.
| Source-check step | Recorded result | Duration |
|---|---|---|
| Install | Succeeded; 1 dependency recorded | 1 second |
| Build | Succeeded | 11 seconds |
| Tests | Succeeded; go test summary: 1 passed, 0 failed of 1 | 4 seconds |
The passing test step and absent tests directory are compatible observations: Go test files can sit alongside implementation files. The recorded result is the harness summary of 1 passed, 0 failed of 1. The README separately names TestPredictionParity, which compares tree predictions, and TestGolden, which pins sample-log output. Those descriptions explain the project's documented checks; they do not change the count recorded by our source-check harness.
A separate CLI run record names commit 293d1fd91d1b and a fresh, unprivileged container configured with 2 CPUs, 4 GB RAM, no published ports and no secrets. Its quickstart-cli recipe recorded cloning in 1 second, then installing 4.2 MB in 13.7 seconds through the README's Go command. These are separate measurements from the 3-CPU source checks, with their own diagnostic steps and outcomes.
| CLI check | Recorded outcome | What it tells you |
|---|---|---|
| Clone | The quickstart-cli recipe recorded 1 second. | The recipe obtained the checkout. |
| Install | The runner used go install github.com/caveman-ai/trim-1/cmd/trim@latest and recorded 4.2 MB installed in 13.7 seconds. | This installation belongs to the separate CLI recipe. |
| Version flag | trim --version failed in 0.1 seconds and exited 2 with "flag provided but not defined: -version". | This invocation returns a flag error and usage text. |
| Help flag | trim --help exited 0 in 0.1 seconds and printed query, point and file usage. | The installed command exposed its documented input controls. |
| Usage discovery | The runner marked usage FAILED: no runnable trim command in the README's usage/examples sections. | The recipe stopped at usage discovery. |
| Teardown | The record says teardown: ok. | Cleanup completed according to the runner. |
The printed usage was trim --query QUERY [--point POINT] [FILE], with stdin used when FILE is omitted. The pack also records a version-failed finding: the version invocation prints usage and exits with code 2. An inventory script expecting a successful --version response would encounter that error. The Go API separately documents ModelInfo for describing the embedded model in logs and reports.
The usage-discovery result conflicts with the visible README examples. One command passes a query and build.log, then redirects output to build.trimmed.log; another pipes long-document.md through stdin with balanced selected. The runner's failure therefore describes its recipe outcome. The supplied README contains both file-input and stdin commands, and its output instructions distinguish trimmed text on stdout from a summary on stderr.
Read token cuts alongside answer accuracy
The authors' long-document answer evaluation scored 85.6% at balanced, compared with 88.9% using full context. That is the useful companion to the large token cut: the reader received much less text and also answered fewer questions correctly. The author benchmark reports evidence retention and answer outcomes separately, so a developer can decide which outcome matters for the application before selecting a compression setting.
| Author answer evaluation | Cases | Full context | Balanced | Aggressive |
|---|---|---|---|---|
| Long multi-hop QA | 90 | 88.9% | 85.6% | 76.7% |
| Agent traces | 100 | 100% | 99% | 98% |
| Haystack | 60 | 91.7% | 70.0% | 48.3% |
The authors' model card dates this benchmark run to October 11, 2026. Its evidence-retention table uses 200 agent-trace cases, while its answer table uses 100. Those denominators describe separate evaluations. On the 60 haystack cases, full context scored 91.7% and balanced scored 70.0%, making full context the stronger starting baseline for that reported workload even though balanced reduced the input.
The authors identify later hops without shared query words as the main cause of their haystack losses. A retained line can be copied exactly while a supporting relationship disappears elsewhere in the document. That distinction matters for questions requiring several connected facts: evaluate whether the reader can still follow the chain, rather than judging the selected output only by its length or by the accuracy of individual retained strings.
Where people get stuck: output size and no-op results
Issue #2 requests a byte cap because choosing an operating point does not guarantee an output size. Its author proposes --max-bytes and Options.MaxBytes and asks for feedback before sending a PR. The supplied byte-budget thread describes a proposed interface. For a caller with a fixed allowance, checking the rendered output size remains a separate integration step from choosing conservative, balanced or aggressive.
| Symptom or requirement | What the evidence says | Practical response |
|---|---|---|
| Output must fit a fixed byte allowance | Issue #2 requests a cap and asks about fallback behavior. | Enforce your caller's size policy separately. |
| Input comes back unchanged | The README lists blank queries, small or oversized contexts, removal markers and cuts below the minimum threshold as pass-through cases. | Read stderr, or inspect Unchanged and Reason in Go. |
| CRLF input gets mixed newlines | Issue #3 reports retained CRLF lines alongside LF-only markers. | Include a newline-sensitive fixture in an integration check. |
| One enormous line stays enormous | The model card describes whole-line selection only. | Split or preprocess that input when the application permits it. |
The CRLF reporter describes keeping the first line of a Windows-format input and removing the following lines. The retained line keeps its carriage return and newline, while a removal marker ends with a newline alone. Issue #3 includes a reproduction for Policy.Apply and reports the same result through Compress. The reporter proposes detecting CRLF before rendering markers so that their line endings match the retained lines.
Pass-through results are part of the documented API. With the default policy, contexts under 2,000 bytes, over 8 MiB or over 200,000 lines return unchanged; cuts removing less than 10% of bytes also return unchanged. The command rejects a missing query or unknown point with exit status 2. Handle those argument errors separately from a successful call whose selection policy returns the original input.
Go integration exposes selection policy and no-op reasons
The Go API allows a custom Policy to replace the named operating point. That gives an integrator control when a named setting retains too much surrounding material or omits a useful header. The API documentation exposes Floor, TopK, Context, Headers, Gap, MinChars and MinCut. These fields adjust how line scores become a selection, while Score provides per-line probabilities for callers making their own selections.
Floor is relative to the best line's score. TopK keeps the best-scoring lines, Context expands around selections, and Headers retains enclosing structure. Gap fills short removed runs where a marker would cost about as much as the missing lines. Together, these controls explain why selecting useful lines involves more than setting one probability threshold. In structured logs or source files, a nearby header can explain the error or function that survives.
A Go Result includes Output, kept and removed line counts, the selected policy, Unchanged and Reason. Record the reason alongside input and output sizes when evaluating the package. A collection of short tool responses can otherwise look like a filter that has stopped making selections, although the default policy returns inputs under 2,000 bytes unchanged. Structured results let the caller distinguish that case from a selected output and retain the relevant diagnostic information.
Local filtering keeps the compression step off a service
The documented runtime performs no network call and uses an embedded model. You can place the filter before a reader call without adding a hosted compression endpoint. The trim-1 README requires Go 1.23 or newer for installation and describes file input, stdin and a Go package. The CLI writes selected text to stdout and its summary to stderr, which gives a calling process separate content and diagnostic streams.
Apache-2.0 covers the project, with a separate BSD notice for the copy of Go's math.Exp in model.go. The README also identifies trim-1 as the model inside Caveman. For a Go integration, the documented package accepts context, query and Options, then returns a Result containing the output and selection details. The CLI exposes the same basic query-and-context workflow through flags and file input or stdin.
trim-1 vs full context, summarization, LLMLingua and ripgrep
Full context gives the reader the uncompressed input, while trim-1 selects original lines and summarization rewrites information. Those choices change the reader's evidence in different ways. The authors' model card supplies the full-context answer baseline, and HotRepo's overview describes the distinction between exact line retention and rewriting. LLMLingua and ripgrep add two other choices: token selection and explicit pattern search.
| Approach | What changes | Choose it when |
|---|---|---|
| trim-1 | Keeps selected original lines and inserts removal markers. | Exact retained wording matters and you can evaluate what selection loses. |
| Full context | Gives the reader the uncompressed input. | The evidence chain matters more than cutting input, especially for the reported haystack workload. |
| Model-side summarization | Rewrites information into a shorter account. | You need a condensed explanation and can check the rewritten account against its source. |
| LLMLingua | Uses a language model to identify and remove non-essential prompt tokens. | You want to evaluate token-level prompt compression instead of whole-line selection. |
| ripgrep | Searches files for a regex pattern. | You already know the error text, identifier or pattern you want to retrieve. |
LLMLingua's README documents language-model-based token removal. That makes LLMLingua a relevant compression candidate with a different selection unit from trim-1. ripgrep's README describes recursive, line-oriented regex search. For a known error string, ripgrep gives the caller an explicit search rule. A natural-language question spanning several sections asks more of the caller's choice of patterns; trim-1 instead scores lines against the query and applies its selection policy.
What the other reviews get wrong
HotRepo's claim that improving selection requires a new model release overlooks the documented custom Policy. Its overview conflates changing the model with changing how scores become retained lines. The Go API explicitly says Policy replaces the named point for tuning. That permits local selection-policy changes through fields such as Floor and Context, which answers a practical integration question missing from HotRepo's account.
Mindpattern's long-document summary describes 94.4% as the amount of evidence kept. The model card defines it as a case pass rate: every labelled evidence item must survive for the case to pass. The Mindpattern overview therefore gives readers the wrong denominator. A fraction of successful cases answers a different question from a fraction of individual facts retained; the model card's definition supplies the correct reading.
The model card also labels floor 0.06 as intermediate between balanced and aggressive, while its operating-point table gives balanced as 0.008 and aggressive as 0.035. Numerically, 0.06 exceeds both listed floors. Read that row's reported 27.1% cut and 92.0% evidence-case pass rate as results at the stated floor. The numeric floor and the reported outcomes are usable details even though the parenthetical ordering is inconsistent.
Questions people ask
trim-1 is a local, query-aware model that keeps selected original lines for an AI agent's current question. Its public code is caveman-ai/trim-1, and its model card is caveman-so/trim-1 on Hugging Face. The README describes both the command-line tool and Go package. The questions below come from the supplied search intents and issue discussions and focus on identifying the project and understanding its interfaces.
What is the trim-1 model?
The authors describe trim-1 as an embedded gradient-boosted-tree model that scores context lines against a query. It returns selected lines verbatim, in their original order, with removal markers. A reader model then answers from that selected context. The model card describes 712 trees and line features based on lexical matches, line structure, position and neighbouring lines; operating points turn those scores into retained text.
Where is the trim-1 GitHub repository?
The trim-1 GitHub repository is caveman-ai/trim-1. The model card identifies that code repository explicitly, and the README gives the Go installation path github.com/caveman-ai/trim-1/cmd/trim. Use that owner and repository name when looking for the project. The source-check measurements on this page refer to commit 293d1fd, while the separate hands-on record names commit 293d1fd91d1b.
Can trim-1 guarantee output below a fixed byte budget?
Issue #2 requests a byte-budget feature because choosing an operating point does not guarantee the required size. Its author proposes Options.MaxBytes and --max-bytes, then asks whether an unsatisfied cap should return the original context or the tightest oversized selection. The same proposal asks how a cap should interact with MinChars and seeks agreement on the new field and flag. These are design questions in the byte-budget request, so keep the output-size decision in the calling application.
Why does trim-1 produce mixed line endings from CRLF input?
The issue #3 reporter says retained lines keep their trailing carriage returns, but rendered removal markers omit them. That creates CRLF on retained lines and LF on marker lines. The CRLF report includes a reproduction using Policy.Apply and reports the same outcome through Compress. Its proposed change is to detect CRLF and add a carriage return after each marker so that the output uses matching endings.
What we have not tested yet
Our recorded source checks and CLI diagnostics contain no completed real-document trimming task, answer-quality replication or provider-billing measurement. The installation, build and test timings describe the source-check harness; they are not compression latency, memory measurements or deployment requirements. The image label does not establish actual runtime or operating-system versions. The separate CLI recipe stopped at usage discovery, which gives no completed execution result for the README's trimming examples.
The authors' quantitative quality evidence comes from one run. Their model card says the judge model was not validated against human labels and that clustered suites make per-case intervals understate uncertainty. The multi-hop QA evaluation uses a validation split from a dataset whose training split appears in training. Token cuts are local benchmark counts rather than provider-billing measurements. The supplied records also leave independent production adoption and comparative speed or quality against LLMLingua, ripgrep or summarization unmeasured.
Multilingual documents, concurrent workloads, the oversized-input boundary and custom-policy quality remain outside our recorded checks. Training and evaluation used English text and source code. The closed CRLF issue extract supplies no merged-fix or release reference, and the byte-budget proposal leaves fallback behavior and its interaction with MinChars unresolved. Rendered layout, accessibility, automatic related links and recommendation modules are outside this text-and-evidence review. Local line selection also supplies no evidence that retained document instructions have been sanitized.
For a next evaluation, keep the original document, run balanced with a real query, and compare the reader's answer against the full-context answer and supporting lines. Include a question whose supporting fact uses different words from the query. The authors identify that failure mode in their entity-chain results. A useful integration decision depends on whether the selected evidence supports the answer your reader needs, alongside the reduction in input size.


