compress

compress is a command for Claude Code from 0xhimanshu/governor. It costs 20 tokens per session (413 once invoked), scanned A, original, MIT.

A command that shortens CLAUDE.md and other memory files while preserving marked important text.

In plain words
What is it for?
Use it to compress memory files at light, medium, or aggressive levels, with checks and backup recovery if compression fails.
Why use it?
It reduces the amount of repeated context the coding agent reads, helping save tokens without losing critical instructions.

Command for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: mentions CLAUDE.md.

Part of the governor plugin — 1 skill, 11 commands, 5 hooks shipped together

Good fit Use it to compress memory files at light, medium, or aggressive levels…

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/0xhimanshu/governor/compress
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/0xhimanshu/governor

Made for: Claude Code.

Or install governor, the plugin that ships this one along with the rest of its 1 skill, 11 commands, 5 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for compress

README.md
[![agentmods](https://agentmods.dev/badge/commands/0xhimanshu/governor/compress.svg)](https://agentmods.dev/commands/0xhimanshu/governor/compress)
Your own site
<a href="https://agentmods.dev/commands/0xhimanshu/governor/compress"><img src="https://agentmods.dev/badge/commands/0xhimanshu/governor/compress.svg" alt="Measured on agentmods" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 413 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00413
Opus 5 $0.00010 $0.00206
Sonnet 5 $0.00004 $0.00083
Haiku 4.5 $0.00002 $0.00041

Measured 7d ago against content hash 5346dfe65007, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

compress scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/compress.md · 61 lines

What it actually says

Governor Compress

Automatically compress memory files with dense professional prose while strictly protecting critical spans.

Usage:

/governor:compress [light|medium|aggressive] [file]

Default target: CLAUDE.md
Default level: medium

Compression targets:

  • light: remove filler/repetition; target 15-30% savings outside protected spans.
  • medium: collapse narrative into decision bullets; target 35-55% savings outside protected spans.
  • aggressive: keep only rules, facts, commands, risks, decisions; target 50-70% savings outside protected spans.

One-command rule: do not ask the user to edit drafts, copy paths, or run follow-up commands unless manual mode is explicitly requested or a safety fallback is required.

Internal flow:

  • Run Governor auto mode.
  • Parse the returned JSON payload.
  • Rewrite the protected payload internally.
  • Run the JSON finalize command, then inspect status.
  • If status=quality_guard_failed and next_level is present, retry once at the stronger level using retry_auto_command.
  • Finalize, validate, recover if needed, and restore the backup on unrecoverable failure.
  • Reject low-savings output with a quality guard.
  • Return only the result summary.

Manual mode (manual or --manual) is only for very large files or explicit user request.

Protected spans are never modified:

  • Code blocks and inline code.
  • Paths, URLs, commands, env vars.
  • API names, model names, versions, dates.
  • Headings, frontmatter, tables.
  • Warnings and irreversible rules.
  • Brand and design tokens.

After compression, report:

  • Original vs compressed token estimate.
  • Memory saved percentage.
  • Validation status.
  • Quality-guard status.
  • Backup location.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 61 lines · 20 tokens per session scan A 5346dfe65007

Subscribe to this mod's changes

compress is a command published in the GitHub repository 0xhimanshu/governor (133 stars, last pushed 2mo ago), licensed MIT. It adds 20 tokens to every session and 413 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.