Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Brevity

A minimal cost that snowballs into very large savings.

Seam-aware token compression for autonomous coding agents.
Fewer tokens at every seam — zero loss of quality by design.


Brevity is a Claude Code skill that makes an agentic workflow cost fewer tokens without ever making it worse. It costs almost nothing to run — one skill load plus a tiny per-turn anchor — and that minimal cost snowballs: every command your agent runs, every file it scans, every log it reads comes back compressed, and the savings compound for the entire session.

Here's the data

Same commands, same repo, run twice — raw vs through Brevity's deterministic layer — with real BPE token counts (tiktoken o200k_base). The benchmark session was driven by Claude Fable 5 with the reasoning effort left at its full default — never lowered. That last part is Brevity's prime directive in action: all savings below come from compressing what enters and leaves the context window, and none from making the model think less.

Context Gains benchmark

The snowball Tokens
Brevity's entire overhead (skill load + 80-token anchor × 40 turns) 5,557
Observation tokens on the modeled session — raw 301,564
Observation tokens on the same session — with Brevity 75,418
Context preserved, net of all overhead 220,589 (73.2%)

That ~5.5k investment returns ~40× itself. And the raw version of that session doesn't even fit a 200k context window — it forces at least one lossy compaction. The Brevity version uses 40% of the window and leaves ~119k tokens of headroom for more files, deeper verification, and more independent angles.

Why the zeros are in the chart

Two commands show 0% on purpose — that's the safety design working, not a failure. When a filter isn't confident, the raw output passes through unchanged (never block, never lose), and the default file read is byte-preserving. Anything truncated elsewhere is tee'd to recovery logs on disk, so no detail is ever destroyed — only deferred.

When to use it

The overhead is fixed; the savings scale with how much tool output your task generates. Rule of thumb from the data: if a task will produce more than ~8k tokens of tool output (one medium diff), Brevity is already ahead. For big agentic runs — audits, migrations, autonomous multi-phase sessions — the gains above are the floor, because the behavioral seams add more on top. For a two-line quick question, leave it off; that's why activation is per-session opt-in.

The two things NEVER compressed

  1. The reasoning / thinking channel. Brevity governs only what is written, never how much is thought. Extended thinking stays at full effort, always.
  2. The centralizing goal text (and any order-sensitive step) of an autonomous run. It is a precision instrument — bias it toward clarity, never squeeze it.

If a compression would touch either, it is a bug.

The four seams

Seam What flows through it The lever
1. Observations tool output → context (the biggest lever) Deterministic compression of bulk commands (git/tests/logs/trees), recoverable by design
2. Inter-agent returns sub-agent → orchestrator Structured, compressed findings (path:line — note), not prose essays
3. The plan document re-loaded every phase Dense-precise prose: cut fluff, keep every path/detail/step verbatim
4. The visible answer agent → user Gated terse output: drop filler, preserve code/numbers/errors byte-exact

The Gate — when Brevity stands down

  • Terse turns — nothing to save; answer-compression off.
  • Tightly-coupled sequential work — no parallel fan-out.
  • Reasoning-critical answers — leave verbose. When in doubt, don't compress.
  • User-facing explanations — clarity beats terseness, always.

Usage

Drop SKILL.md into your skills directory (e.g. .claude/skills/brevity/SKILL.md), then:

  • /brevity — on (all four seams, gated + safeguarded)
  • /brevity light — observation-frugality only (seams 1–2)
  • /brevity off — revert

The skill is written to layer over a plan-and-execute autonomous workflow (a plan document with a protected goal line, executed phase-by-phase), but seams 1, 2, and 4 apply to any agentic session as-is.

The deterministic layer

Seam 1 can be upgraded from convention to enforcement: install rtk and gate it behind a session flag — a PreToolUse hook rewrites bulk commands (git statusrtk git status) only while Brevity is active, so normal sessions stay byte-identical. Keep rtk's raw-output recovery on. The benchmark above was measured with this layer installed.

Benchmark methodology (honest numbers)

  • Real repo, real commands, captured outputs; token counts are BPE via tiktoken o200k_base (approximates Claude's tokenizer — ratios are meaningful, absolutes ±~10%).
  • The session model's command mix is a stated assumption (8× status, 3× log, 2× large diff, 6× tree, 3× orientation read, 5× grep over ~40 turns); the per-command numbers are the hard data — reweight them against your own profile.
  • Only seam 1 is measured. Seams 2–4 are behavioral and workload-dependent, so the 73.2% figure is a floor, not a ceiling.
  • More context ≠ more performance: the point of the preserved 220k is headroom and signal density — fitting the session in one window (no lossy compactions), deeper sub-agents, and budget for verification — not stuffing the window fuller.

Credits

Brevity adapts ideas and rules from two excellent open-source projects:

  • caveman by Julius Brussee (MIT) — the terse-answer rules (seam 4) and the dense-doc compression rules (seam 3) are adapted from caveman's caveman and caveman-compress skills.
  • rtk (Apache-2.0) — the observation-side model (seam 1) and the deterministic hook integration.

They stack rather than overlap: rtk compresses what the environment tells the model; caveman compresses what the model says. Brevity wires each to its seam and adds the gate + safeguards.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors