ci pipelines
Compress the log in the step before the one that reads it.
npm test > raw.log 2>&1 || true
logstrip raw.log -o clean.log --stats
cli compression for agentic pipelines
LogStrip cuts CI, server and scanner logs down to the lines an agent needs: errors, the first occurrence of each event, context and your stack frames. No model, no network, the same output every time.
npx -y logstrip raw.log --stats
[INFO] boot ok [ERROR] request 123e4567-e89b-12d3-a456-426614174000 failed [ERROR] request 987e6543-e21b-42d3-b456-526614174111 failed
[x2] [ERROR] request [ID] failed
A failing job prints hundreds of lines. Your agent reads all of them, and each token costs money and attention. Most lines are boot messages, health checks, passing tests and the same stack trace again. The few that explain the failure sit somewhere in the middle.
Cutting by hand means writing a new grep for every tool. Pasting it all means
paying for the noise.
1[INFO] 2026-05-15T08:01:00.000Z jest worker booted pid=4011 jobId=ae9c1d2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f
2[INFO] 2026-05-15T08:01:00.001Z runner using 4 workers
3[DEBUG] 2026-05-15T08:01:00.002Z transformer cache hit src/index.ts hash=9f8e7d6c5b4a39281706f5e4d3c2b1a0
4[DEBUG] 2026-05-15T08:01:00.003Z transformer cache hit src/api.ts hash=8e7d6c5b4a39281706f5e4d3c2b1a0f9
5[DEBUG] 2026-05-15T08:01:00.004Z transformer cache hit src/db.ts hash=7d6c5b4a39281706f5e4d3c2b1a0f9e8
6[INFO] 2026-05-15T08:01:00.500Z PASS src/api.test.ts (123ms)
7[INFO] 2026-05-15T08:01:00.600Z PASS src/util.test.ts (87ms)
8[INFO] 2026-05-15T08:01:00.700Z FAIL src/payments.test.ts (412ms)
9[ERROR] TypeError: Cannot read properties of undefined (reading 'amount') at request d1b3a8f7-2e4c-4b9a-9d2e-1c4a5b6c7d8e
10 at Payments.charge (/repo/src/payments.ts:42:18)
11 at Object.<anonymous> (/repo/src/payments.test.ts:31:25)
12 at Promise.then.completed (/repo/node_modules/jest-circus/build/utils.js:298:28)
... 35 more lines
jest-noisy.log, one of our test fixtures: 47 lines,
284 tokens. LogStrip keeps the lit lines and a marker for the library
frames. Output: 8 lines, 63 tokens.
Each bar is one test fixture. The solid part is what LogStrip keeps. The hatched part is what it strips. Tokens are LogStrip's own estimate, words times 1.3.
These are small logs that we wrote, not production traffic. Run
logstrip --stats on one of yours before you trust any number here.
51.3% fewer tokens across all 51 fixtures, 42,705 to 20,805. The median fixture saves 42.0%, the lowest 16.7%, the highest 87.2%.
kept stripped
LogStrip reads the log line by line and never holds all of it in memory. Each line goes through the same stages, so the same input gives the same output.
[x3], hides internal library
frames and refers back to blocks that already appeared.
--max-tokens N, keeps the highest scoring lines
that fit, in their original order.
Prompt compressors in the LLMLingua family run a language model to drop low-information tokens. That suits prose. A log needs whole lines, frames you can follow and the same answer every time.
This describes the approach in general. We have not benchmarked other tools, and we say where the answer depends.
| Question | model-based compressors | logstrip |
|---|---|---|
| needs a model | yes | no |
| same input, same output | depends on model, hardware and settings | yes, pinned by snapshot tests |
| lines stay whole | not guaranteed, tokens are removed inside lines | yes: kept, folded or marked |
| repeats | removed, no count | [x412] and the values that differed |
| prose and documents | what they are built for | passed through untouched |
why logs are not prose compare with grep, platforms and more
Compress the log in the step before the one that reads it.
npm test > raw.log 2>&1 || true
logstrip raw.log -o clean.log --stats
Plugins teach the agent to run it. Hooks compress a log when the agent reads it or you paste it.
npm i -g logstrip
Pipe what you pulled straight into a size your model can afford.
kubectl logs deploy/checkout --since=1h \
| logstrip --max-tokens 4000
Plugins ship for six agents. Five of them also get a hook that compresses logs without being asked.
LogStrip recognises the tools that wrote a log and lists them, so an agent knows what it is reading.
Needs Node.js 22+. No account, no model, no config file.
npm install --global logstrip
Or run it once without installing:
npx -y logstrip raw.log -o clean.log --stats
LogStrip is a command-line tool, a TypeScript library and a GitHub Action that cut noisy CI, server, scanner and container logs down to the lines an AI agent needs. It keeps errors, the first occurrence of each event, context and application stack frames, folds repeats into [xN], and masks secrets.
It depends on the log. On the 51 test fixtures in the repository, savings range from 16.7% to 87.2% per fixture, with a median of 42.0%, measured with LogStrip's own word-based token estimate. The fixtures are small and written by us, so run logstrip with --stats on your own log.
Prompt compressors use a language model to remove low-information tokens, which suits prose. LogStrip works on whole log lines with fixed rules: no model, no network, and the same output for the same input. A line is kept, folded into a count, or hidden behind a marker, never cut in the middle. It does not suit prose, which it passes through untouched.
No. Compression runs on your machine with no model and no network. In an interactive terminal the CLI checks npm once a day for a newer version. That check does not run when stderr is redirected, as in CI, and LOGSTRIP_NO_UPDATE_CHECK=1 turns it off. Usage statistics stay in a local file.
It masks tokens, JWTs, connection-string passwords, authorization headers, PEM private keys and high-entropy strings in every mode, including when text is passed through. It is not a secret scanner, so run one before you share logs outside your organization.
Ids, hashes, timestamps and IP addresses become placeholders such as [ID] and [TIME], and line and column numbers in stack frames become [NN], so that repeated events fold into one. The raw file is never modified. Use --preserve-id-suffix to keep the tail of each id.
Plugins exist for Claude Code, Cursor, GitHub Copilot, Codex, OpenCode and Factory Droid. All except OpenCode also get a hook that compresses logs automatically. There is a GitHub Action, and any CI system can call the CLI. It detects 705+ log sources.
LogStrip looks at the start of the input. Prose, markdown, source code and configuration are copied through with only secrets masked. Pass --force when you want it compressed anyway.
Yes. It reads line by line with bounded memory, so a log does not have to fit in memory. The one exception is a whole JSON report, which is parsed in memory up to 8 MiB. Larger ones use the line pipeline.
It is free and MIT licensed. It needs Node.js 22 or newer and has no runtime dependencies. Install it with npm install --global logstrip, or run it once with npx -y logstrip.