terseness-compressor
A Claude Skill: filler/hedging prose compression with a hard safety
exemption list. No dependencies beyond Python 3's standard library.
Provenance
Ported from packages/engine/src/terseness_compressor/mod.rs (task
E29-T08) — same 12 filler phrases, same 6 never-compress markers, same
blank-line collapsing.
One deliberate simplification from the source, stated plainly: the
source module's doc describes exempting "inline code spans" specifically
(the text between a pair of backticks on a line). This port takes the
more conservative route of exempting the entire line if it contains
any backtick at all, rather than attempting span-precise editing around
inline code. Simpler, safer (never risks a mangled partial edit next to
code), at the cost of also leaving prose on a line that happens to mention
a backtick uncompressed. Given the whole point of this tool is "never trade
trust for a token count," that tradeoff is the right one for a standalone
port.
What it removes (and what it never touches)
Filler/hedging openers stripped when they lead a line — "I will now …",
"Let me …", "It's worth noting that …", "In order to …", "Please note
that …", and eight more (see compress.py's FILLER_PHRASES) — plus
collapsing runs of blank lines to one.
Left completely untouched, always:
- Fenced code blocks (
``` … ```)
- Any line containing a backtick (see the simplification note above)
- Any line containing
security, warning, advisory, caveat,
error, or warn: (case-insensitive)
Why --measure exists
The source module's own doc frames this honestly: pinky "cannot rewrite
Claude's own generated output after the fact," so this exists so a claimed
compression percentage can be checked against a real run on real text
instead of asserted. --measure prints an actual before/after byte count
— use it, and report the number it printed, not an estimate.
Verification
tests/test_compress.py covers: each filler phrase (including the
"stacks with itself" repeated-filler case), the fence/backtick/marker
exemptions (each proven to leave a line byte-for-byte unchanged), blank-
line collapsing, trailing-newline preservation, and the measure() byte
math including the zero-length edge case. Run:
cd community-skills/terseness-compressor
python3 -m pytest tests/ --cov=compress --cov-report=term-missing
License
See LICENSE (included alongside this skill in its download).