r/LocalLLM • • May 26 '26

Project Compressing LLM tool/terminal outputs by 74% using a 42-layer pipeline

https://github.com/MrGray17/opentoken

Messy terminal outputs (git diff, huge JSON logs) constantly bloat LLM context windows. To solve this without ruining model reasoning, I built an open-source, bidirectional pipeline using TypeScript/Bun:

​35 Input Layers: Uses LZ77-style compression (LTSC), LZW token substitution, AST skeleton extraction, and JSON-to-tabular conversion.

​7 Output Layers: Strips conversational AI boilerplate and intro/outro fluff on the response side.

​0-Risk Guardrail: Every stage checks filtered vs. original string length. If a rule makes things worse, it rolls back instantly.

​It achieves a 74% overall token saving rate (up to 93% on repetitive logs). Open-source (MIT) code is here:

https://github.com/MrGray17/opentoken

​I'm currently wrapping this into a standalone library and an MCP server. I'd love to hear your thoughts on the architecture!

4 Upvotes

Duplicates

opencode • • May 25 '26

OpenToken v1.2.0 — token-saving plugin for OpenCode with 42 compression layers

69 Upvotes

SoftwareEngineering • • May 25 '26

[ Removed by moderator ]

2 Upvotes

commandline • • May 25 '26

Terminals [ Removed by moderator ]

1 Upvotes

opensource • • May 25 '26

OpenToken v1.2.0 — token-saving plugin for OpenCode with 42 compression layers

1 Upvotes

programming • • May 25 '26

[ Removed by moderator ]

0 Upvotes

opensource • • May 25 '26

Promotional I built the best token-saving plugin for OpenCode

1 Upvotes

vibecoding • • May 25 '26

[ Removed by moderator ]

1 Upvotes

compsci • • May 26 '26

Applying LZ77-style sequence compression and LZW substitution to LLM context reduction

0 Upvotes

opensource • • May 26 '26

Promotional OpenToken: A 42-layer bidirectional pipeline to compress terminal and tool outputs for LLMs

1 Upvotes

opensource • • May 26 '26

Promotional Open-Source Utility to Slash AI Agent API Bills by ~74%

1 Upvotes

typescript • • May 25 '26

OpenToken v1.2.0 — token-saving plugin for OpenCode with 42 compression layers

1 Upvotes

typescript • • May 25 '26

The best token-saving tool for OpenCode

1 Upvotes

opencode • • May 25 '26

I built the best token-saving tool/plugin for OpenCode

1 Upvotes

devtools • • May 25 '26

I built the best token-saving tool/plugin for OpenCode

1 Upvotes

projects • • May 25 '26

I built the best token-saving tool/plugin for OpenCode

1 Upvotes

vibecoding • • May 25 '26

I built the best token-saving tool/plugin for OpenCode

0 Upvotes

creativecoding • • May 25 '26

I built the best token-saving tool/plugin for OpenCode

1 Upvotes

AiAutomations • • May 26 '26

[ Removed by moderator ]

1 Upvotes

sideprojects • • May 26 '26

Showcase: Open Source Open-Source Utility to Slash AI Agent API Bills by ~74%

1 Upvotes

Software_Finder • • May 26 '26

Others Built an open-source utility that cuts AI agent API costs by up to 74% natively

1 Upvotes

AppBuilding • • May 26 '26

​I built a 42-layer compression pipeline that cuts LLM token usage by 74%

1 Upvotes

Aitoolsubs • • May 26 '26

Built an open-source utility that cuts AI agent API costs by ~74% natively

2 Upvotes