Skip to content

cli compression for agentic pipelines

LogStrip: send agents the failure, not the log.

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
  • offline
  • no model
  • deterministic
  • zero dependencies
  • MIT
raw.log - logstrip.log
[INFO] boot ok
[ERROR] request 123e4567-e89b-12d3-a456-426614174000 failed
[ERROR] request 987e6543-e21b-42d3-b456-526614174111 failed
[x2] [ERROR] request [ID] failed

agents pay for every line.

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
From 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.

measured, not promised.

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.

all 51 fixtures and the method

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%.

  1. apache-httpd-noisy485 to 6287.2% saved
  2. docker-build309 to 6479.3% saved
  3. jest-noisy284 to 6377.8% saved
  4. maven-downloads-failure124 to 3274.2% saved
  5. java-spring-boot-realistic305 to 9568.8% saved
  6. vitest-failure257 to 9164.6% saved
  7. node-crash-realistic181 to 10144.2% saved
  8. mocha-spec-failure236 to 13642.4% saved
  9. server-json43 to 3420.9% saved
  10. kubernetes-crashloop150 to 12516.7% saved

kept stripped

five stages, one pass.

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.

How LogStrip processes a logA raw log of 47 lines passes through 5 stages: classify, sanitize, score, dedupe, budget. The clean log has 8 lines.raw log47 lines1classifylog or text?prose passes throughtext | log2sanitizemask secretsids become [ID][TIME] [IP]3scorerank every linekeep the contextERROR at app4dedupefold repeatshide library frames[x3] [... hidden]5budgetcap at --max-tokensbest lines, in order--max-tokens Nclean log8 linesHow LogStrip processes a logA raw log of 47 lines passes through 5 stages: classify, sanitize, score, dedupe, budget. The clean log has 8 lines.raw log 47 lines1classifylog or text?prose passes throughtext | log2sanitizemask secretsids become [ID][TIME] [IP]3scorerank every linekeep the contextERROR at app4dedupefold repeatshide library frames[x3] [... hidden]5budgetcap at --max-tokensbest lines, in order--max-tokens Nclean log 8 lines
  1. classify. Samples the start of the stream. Prose, markdown, source and config pass through with secrets masked. Logs continue.
  2. sanitize. Masks tokens, keys and passwords. Replaces ids, timestamps and addresses with placeholders, so repeats can fold.
  3. score. Rates each line by level, keywords, stack frames and scanner findings. Keeps the context around a failure and drops the routine.
  4. dedupe. Folds repeats into [x3], hides internal library frames and refers back to blocks that already appeared.
  5. budget. With --max-tokens N, keeps the highest scoring lines that fit, in their original order.

the full flow, step by step

not a model, on purpose.

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.

LogStrip compared with model-based prompt compressors
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

built for three jobs.

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

agent hooks

Plugins teach the agent to run it. Hooks compress a log when the agent reads it or you paste it.

npm i -g logstrip

incident triage

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.

705+ sources, named in the output.

LogStrip recognises the tools that wrote a log and lists them, so an agent knows what it is reading.

all 705+ sources add your own

install in one command.

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

questions.

What is LogStrip?

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.

How many tokens does it save?

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.

How is it different from LLMLingua and other prompt compressors?

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.

Does it send my logs anywhere?

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.

Does it remove secrets?

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.

What does it change in my log?

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.

Which agents and CI systems does it work with?

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.

What happens if the input is not a log?

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.

Can it handle very large logs?

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.

What does it cost and what does it need?

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.