token-compression
Skill2 starsChanged 7 months agoMITView on GitHub
Use to cut the token cost of agents' INTERNAL communication -- inter-agent messages, scratch notes, reasoning notes -- by 'talking like a caveman' WITHOUT touching external output (users, systems, deliverables stay full-quality, TC-1). Engine scripts/token_compression/caveman.py; LLMLingua-style evaluation (TC-3).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- youcisla/Agent-Foundrytheir own version, first seen Nov 16, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- youcisla/Agent-Foundry★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository64 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- api-design-from-frontendSkill
- architect-team-pipelineSkill
- bug-fix-pipelineSkill
- cartographer-teamSkill
- claude-design-importSkill
- claude-md-efficiencySkill
- closeoutSkill
- common-pipeline-conventionsSkill
- contract-first-parallelismSkill
- coverage-mappingSkill
- ct6-agent-coreSkill
- data-annotationsSkill
- data-dictionarySkill
- data-engineering-explorationSkill
- data-eng-pipelineSkill
- data-lineage-mappingSkill
- delivery-manifestSkill
- design-fidelity-mappingSkill
- dev-api-integration-testingSkill
- diagnostic-research-teamSkill
- documentation-currencySkill
- domain-research-teamSkill
- dynamic-value-discoverySkill
- editability-completenessSkill
- email-testingSkill
- endpoint-trace-mappingSkill
- expensive-verification-debuggingSkill
- frontend-route-mappingSkill
- helpdeskSkill
- intake-and-mappingSkill
- interaction-completenessSkill
- interaction-intuitionSkill
- interactive-mockup-discoverySkill
- intuition-map-lifecycleSkill
- mcp-output-contract-designSkill
- mempalace-integrationSkill
- mini-architect-team-pipelineSkill
- page-publishingSkill
- phenotype-absorptionSkill
- phenotypesSkill
- playwright-suite-builderSkill
- playwright-user-flowsSkill
- project-homepageSkill
- project-principlesSkill
- proposal-refinerSkill
- readme-stylingSkill
- reuse-first-designSkill
- root-cause-test-failuresSkill
- structure-optimizationSkill
- team-spawning-and-review-gatesSkill
- test-prod-safety-classifierSkill
- test-run-monitorSkill
- ux-test-builderSkill
- verification-planningSkill
- verified-agent-outputSkill
- The first 60 shown.
The file
Files
Token Compression (TC-1 … TC-3)
Agents spend tokens on two kinds of text: what they say to the OUTSIDE (users, other systems, final deliverables) and what they say to THEMSELVES and EACH OTHER (inter-agent messages, scratch notes, internal summaries). The outside text must stay full-quality; the internal text can be terse. This discipline compresses the internal text to free up context, and draws a hard line so the outside text is never touched.
The deterministic, always-available compressor lives in
scripts/token_compression/caveman.py (stdlib-only, unit-tested). This skill
is the contract + the internal-only boundary. Do not re-implement the transform in
prose — call the module.
The hard boundary (TC-1) — internal only
NEVER compress external output. The caveman transform applies ONLY to:
- inter-agent messages (teammate ↔ teammate, Lead ↔ teammate),
- an agent's own scratch / working notes / internal reasoning summaries,
- internal context an agent re-reads for itself.
It must NOT touch: the final answer to the user, content sent to other systems (API payloads, commits, file contents, PRs, emails), test output, or anything a human or downstream system consumes. Output quality to the outside is preserved verbatim — that is the non-negotiable line TC-1 draws.
The caveman style (TC-2)
compress(text) reduces verbosity meaning-preservingly: it drops pure filler
(articles a/an/the, politeness please/kindly/thanks, intensifiers /
hedges just/really/very/actually/basically/simply/…) and a few wordy
phrases (in order to → to, due to the fact that → because), while
PRESERVING content words, identifiers, numbers, line structure, and — critically
— fenced (```) and inline (`) code VERBATIM. Prepositions,
conjunctions, and copulas are kept (they carry meaning) so the compressed text
stays understandable to the agent that re-reads it.
$(command -v python3 || command -v python) scripts/token_compression/caveman.py stats --json # measure savings
$(command -v python3 || command -v python) scripts/token_compression/caveman.py compress # emit compressedcompression_stats(text) reports the original vs compressed token estimate + the
saved percentage so the win is measurable, not assumed.
Evaluating a heavier package (TC-3)
The stdlib caveman compressor is the FLOOR — always available, zero dependencies,
safe. For larger wins on developer agents while they run, evaluate an ML
token-compression package (e.g. LLMLingua-style prompt compression) and apply it
to the internal channels per the same TC-1 boundary. Such a package is a
third-party dependency (NOT stdlib) and is plugged in at the application layer,
not bundled into this stdlib-only plugin — evaluate it for the specific agent
workload, measure with compression_stats as the baseline to beat, and keep the
caveman transform as the always-on fallback.
Honest boundary
The caveman transform is a lossy-of-FILLER heuristic, not a semantic ML
compressor — it drops a fixed filler list + wordy phrases and collapses
whitespace; it does not understand meaning. Two consequences: (1) any single
token that matches a filler word case-insensitively is dropped, so a single-letter
or short token used as CONTENT outside backticks — a variable a, the grade A,
a drug/vitamin designation A, a list marker — can be lost; wrap such content in
` so the code-preserve path keeps it verbatim; (2) the token counts are
estimates (~4 chars/token), not an exact tokenizer. Never apply it to external
output (TC-1), and measure rather than assume the savings.
Cross-references
scripts/token_compression/caveman.py— the deterministic compressor + stats (the machine).- CT6-6 §3 (TC) — the requirements (internal-comms optimization; "talk like a caveman"; evaluate compression packages).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

