Compress large tool results, files and terminal output with trimtok and pull the raw original back from CCR only when needed. Use before reading big files, after any tool result that looks like hundreds of lines, when the context is filling up, or when the user asks about token savings.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Trimtok Compress?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/stxyu-p-trimtok-compress)
---
name: trimtok-compress
description: >-
Compress large tool results, files and terminal output with trimtok and pull
the raw original back from CCR only when needed. Use before reading big files,
after any tool result that looks like hundreds of lines, when the context is
filling up, or when the user asks about token savings.
---
# Trimtok compression protocol
trimtok is a deterministic compressor with a lossless escape hatch: it shrinks
text and stores the untouched original in CCR (content-addressed store) under a
`#ref`. Markers in compressed text mean:
| Marker | Meaning |
| --- | --- |
| `[tt:terminal kind=… hidden=N #c2Ab]` | N lines were folded away; raw text is `#c2Ab` |
| `[repeated 1998x]` | 1998 identical lines collapsed |
| `[template ×12]` | 12 lines differed only in numbers/ids |
| `[@#ref] (xN = N lines)` | pointer to a folded block |
## Do this, in this order
1. **Big file, no question yet** → `trimtok_compress_tool(file_path="C:/abs/path", min_chars=0)`.
The reply is a skeleton (signatures, headings, keys) plus a `#ref`. Then read
only the line ranges you actually need.
2. **Huge tool/MCP result already in context** →
`trimtok_compress_tool(result="<paste>", tool_name="grep_search")`. JSON
becomes a TOON table, grep hits become grouped-by-file, code becomes an AST
skeleton.
3. **Noisy command you are about to run** → `trimtok wrap -- pytest -q` (or just
run it: allowlisted commands are compressed by the plugin hook).
4. **Need a specific answer from a `#ref`** →
`trimtok_exec(hash="#c2Ab", code="import os,json;print(json.load(open(os.environ['TRIMTOK_PAYLOAD'])).keys())")`
— only stdout returns.
5. **Need the raw lines** → `trimtok_retrieve(hash="#c2Ab", grep="Traceback",
context_lines=5)`, or `section="errors" | "diff" | "summary" | "tail"`, or
`intent="<question>"` for ranked lines.
## Rules
- Never compress a payload under 2KB — there is nothing to win.
- Never re-run a command or re-read a file to recover content you already have
in a `#ref`.
- Never paste `[tt:...]` markers into files or commits; run `trimtok guard-check`
before finishing a task that involved compression.
- `trimtok_status(action="gain", days=7)` answers "how much did this save?".