caveman-compress
Use when the user wants to shrink a long markdown file like AGENTS.md, CLAUDE.md, a README, or a runbook to roughly half its size while keeping code blocks, headings, URLs, and file paths intact.
- License 许可
- MIT
- 最近更新
- 2026-11-09
- Stars
- ★ 6
- Forks
- 1
01 前言 Front Matter
- name
- caveman-compress
- license
- MIT
- metadata
- { "author": "ai-playbook (ported from JuliusBrussee/caveman, MIT)", "version": "1.0" }
- description
- Use when the user wants to shrink a long markdown file like AGENTS.md, CLAUDE.md, a README, or a runbook to roughly half its size while keeping code blocks, headings, URLs, and file paths intact.
03 SKILL.md 正文
caveman-compress — shrink memory files
Rewrite long markdown documents in caveman style, byte-preserving everything that must not change.
When to fire
User intent triggers (any of):
- "/caveman-compress <file>"
- "compress AGENTS.md", "shrink this README", "make CLAUDE.md smaller"
- "trim the docs", "reduce the runbook"
Preconditions
- Target file is markdown (
.md). - Caller has read+write access to the file.
- Working tree is clean for the target file (otherwise refuse and ask the user to stash or commit first — accidentally overwriting uncommitted edits would be hard to recover).
Steps
-
Confirm the target. Echo
<file>: <bytes> bytes, <lines> linesto the user. If the file is < 200 bytes, refuse — not worth a roundtrip. -
Backup. Copy the original to
<file>.original.md. Refuse if a backup already exists with content different from the current file — that indicates an earlier compression session was not finalized. -
Invoke the compressor:
python -m scripts.caveman compress <file> --mode fullModes:
lite,full(default),ultra. The compressor calls the LLM with the caveman ruleset and a strict preservation contract. -
Validate the output. The compressor enforces, and fails the run if violated:
- Every fenced code block (
```...```) is byte-identical to the original. - Every heading (
#,##,###, …) text and level is identical (order preserved). - Every URL (
https?://...) appears in the output exactly once and unchanged. - Every file path (
/-containing tokens) appears in the output exactly once and unchanged. - Every bash command line (lines starting with
$or insidebashfenced blocks) is byte-identical.
- Every fenced code block (
-
Retry on validation failure. Up to 2 retry passes with targeted patches — only the violated tokens are sent back to the LLM with the instruction to restore them. After 2 retries, restore from
<file>.original.mdand exit 1. -
Report. Print:
<file>: <orig_bytes> → <new_bytes> ({pct}% saved) backup: <file>.original.md
Output shape
After completion, summarise to the user:
- Original size, compressed size, percent saved.
- Backup path.
- Whether any retries were needed.
- A two-line diff sample (first preserved heading, first prose paragraph compressed).
Trust boundary
- Never overwrite the original without writing a backup first.
- Never run a third retry — bail out and restore.
- If the LLM call errors out (network, quota), do NOT touch the original file. The compressor handles this; this skill only orchestrates and reports.
Guardrails
- Do not compress files that aren't markdown (refuse with
Only .md supported). - Do not compress files inside
.git/,node_modules/,__pycache__/, ordist/. - Do not compress files larger than 100 KB without explicit
--forcefrom the user — a single LLM call may not fit them and partial compression risks data loss.
See also
- scripts/caveman/compress.py — the compressor implementation.
- docs/runbooks/caveman-toggle.md — how compression fits the broader caveman feature.
04 同仓库更多 Skills
sweep
Use when the user wants to find code that has quietly stopped being used — types /sweep, asks for a "dead code sweep", "repo entropy", "what can we delete", "orphan files", "unused code", or asks to review a sweep ledger. Adjudicates candidates a deterministic scanner already produced; it never deletes anything and never re-derives findings from raw source. Pairs with ponytail, which gates what gets written rather than what rots.
ponytail
Use when the user wants the laziest solution that actually works — types /ponytail, says "be lazy", "lazy mode", "simplest solution", "minimal solution", "yagni", "do less", or "shortest path", or complains about over-engineering, bloat, boilerplate, or unnecessary dependencies. Supports intensity levels lite, full, ultra (default). Pairs with caveman, which compresses prose, not code.
ponytail-review
Use when the user wants a code review focused exclusively on over-engineering — says "review for over-engineering", "what can we delete", "is this over-engineered", "simplify review", or invokes /ponytail-review. Complements correctness/security review; this one only hunts complexity in the current diff. Gated by the ponytail review_ponytail component.
ponytail-debt
Use when the user wants to harvest every `ponytail:` comment in the codebase into a tracked debt ledger — says "ponytail debt", "/ponytail-debt", "what did ponytail defer", "list the shortcuts", "ponytail ledger", or "what did we mark to do later". One-shot report, changes nothing. Gated by the ponytail debt_ponytail component.
ponytail-audit
Use when the user wants a whole-repo audit for over-engineering — says "audit this codebase", "audit for over-engineering", "what can I delete from this repo", "find bloat", or invokes /ponytail-audit. Like ponytail-review but scans the entire tree, not a diff. One-shot report, applies no fixes. Gated by the ponytail audit_ponytail component.
openspec-propose
Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.