← ClaudeAtlas

rtklisted

Reduce to the minimum the tokens of a text, a command output, a report, a log or a program's output so it costs the least in an AI context - every human-readable part dropped (colors, ANSI, tables, rulers, banners, prose, repeated fields, absolute paths), only the signal kept in a compact machine-oriented form (legend once, one record per line, shared values written once, counters on one line), even if unreadable for a human - and design / implement an --rtk mode (flag + env var) on a program or script, like xstyle --rtk. Use whenever the user asks to compact / minify / compress a text or an output for an AI, to save tokens or context, for an "rtk" / "AI" / "token-optimized" output or mode, to add such a flag to a binary or a script, or to write a file only an AI will read.
TsukiNi22/ai-utils · ★ 1 · Data & Documents · score 74
Install: claude install-skill TsukiNi22/ai-utils
# rtk: token-minimal text for an AI `SKILL_DIR` = the directory of this file. Helper: `python3 SKILL_DIR/scripts/compact.py [files] [--stats] [--max-line N] [--head N]` (stdin -> stdout): strips ANSI / OSC 8 links / rulers / box lines / runs of spaces, merges identical consecutive lines (`xN`), factors the common directory (`# $P=<dir>` then `$P/...`); `--max-line` and `--head` are lossy, only on request. It is the generic first pass; a format designed for the content (sections 2-3) always gets much further (xstyle: 147 KB -> 29 KB). Unrelated to the `rtk` CLI of `RTK.md` (proxy that condenses the outputs of the shell commands Claude runs): this skill **produces** compact formats; that tool consumes them. ## 1. Rules (the reader is an AI, never a human) - **Keep every signal**: identifiers, locations (`file:line:col`), codes, exact error messages, numbers, counts, versions, what changes a decision. **Drop the rest**: colors, ANSI, hyperlinks, banners, boxes, tables (-> one record per line), alignment spaces, blank lines, progress bars, timestamps that don't matter, greetings / prose, repeated headers, the source line when the file can be read. - **Legend once** in a first `#` line (field order, abbreviations: `U/M/m/n`, `a=auto -=manual`); never per record. - **Write once what repeats**: a key heading its records (`>file` then `line:col ...`), a text shared by every record of a group written once at the end (`* CODE message => hint`), a common prefix as `$P`, `xN`