compress

compress is a command for Claude Code from anshss/shiploop. It costs 28 tokens per session (1,958 once invoked), scanned A, original, Apache-2.0.

A manual command that shortens how project rules are delivered to the coding agent by moving mechanically triggered rules out of CLAUDE.md into rule packs. CLAUDE.md is a project instruction file read during agent sessions.

In plain words
What is it for?
Reducing the per-turn context cost of a large CLAUDE.md file while preserving its rules.
Why use it?
It reduces repeated context sent on every turn without deleting the rules. Rules that matter only for certain file changes can be loaded only when needed.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; mentions subagents; positional $N argument.

Part of the shiploop plugin — 2 skills, 7 commands, 3 agents shipped together

Good fit Reducing the per-turn context cost of a large CLAUDE.md file while preserving its rules.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/anshss/shiploop/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/anshss/shiploop

Made for: Claude Code.

Or install shiploop, the plugin that ships this one along with the rest of its 2 skills, 7 commands, 3 agents.

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/anshss/shiploop/compress/github.svg)](https://agentmods.dev/commands/anshss/shiploop/compress)
Your own site
<a href="https://agentmods.dev/commands/anshss/shiploop/compress"><img src="https://agentmods.dev/badge/commands/anshss/shiploop/compress/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for compress

Your own site · 80×15
<a href="https://agentmods.dev/commands/anshss/shiploop/compress"><img src="https://agentmods.dev/badge/commands/anshss/shiploop/compress.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,958 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.00028 $0.01958
Opus 5 $0.00014 $0.00979
Sonnet 5 $0.00006 $0.00392
Haiku 4.5 $0.00003 $0.00196

Measured today against content hash 74dd1296b02c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, 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 today.

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 · 157 lines

How it starts

The opening of the file, as written. The whole thing — 157 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/shiploop:compress

The ONLY thing that compresses CLAUDE.md. Nothing automatic ever edits that file. The run-end pass detects and reports only (`trim: CLAUDE.md / chars, compression candidate(s)

  • run /shiploop:compress), and scripts/govern/claudemd-trim.sh --apply ` moves one pre-approved block. Everything else happens here, with an operator watching.

CLAUDE.md is re-sent to the model in full on every turn, so a rule that only matters while editing a shell script is charged to every session that never opens one. This command reduces that per-turn tax without deleting a single rule.

The lever is delivery, not prose. On the workspace this method came from, a wording-only pass over the whole file bought 759 chars (2.9%) because the file was already at its hand-compressed floor. The same file then dropped 26,511 -> 18,830 chars (-29%) with no rule removed, purely by moving mechanically-triggered rules into scripts/rules-on-touch.sh. Do not open this command by rewriting sentences.

Sort by DETECTABILITY, never by frequency. Frequency was tested as a sort key and rejected: a rule that fires rarely but prevents a destroyed box is high value precisely because nobody recalls it, which argues for just-in-time delivery, not against it. The only question that decides a block is whether its trigger is mechanically detectable from a tool call.


Step 1 - Measure composition per section

Do not skip this. It is what proves where the mass actually is, and it usually contradicts the guess.

awk '/^## /{if(h)printf "%6d  %s\n",n,h; h=$0; n=0} {n+=length($0)+1} END{if(h)printf "%6d  %s\n",n,h}' CLAUDE.md | sort -rn
wc -c CLAUDE.md

Report the table to the operator before touching anything.

Step 2 - Read the candidates the automatic pass already found

governor/claudemd-trim-proposals.md. Each proposal carries a Class: field:

Class Meaning
dead-citation every path or knob it cites is provably gone
duplicate an exact duplicate of another block
jit-candidate mechanically detectable trigger: it can become a rule pack
judgment judgment-call trigger: never a candidate, it stays resident

Read the full file on GitHub · 157 lines

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. today First seen · 157 lines · 28 tokens per session scan A 74dd1296b02c

Subscribe to this mod's changes

compress is a command published in the GitHub repository anshss/shiploop (7 stars, last pushed today), licensed Apache-2.0. It adds 28 tokens to every session and 1,958 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-09-09.

Related

Other commands, from other repositories

polisade-review-pr

Run a quality review on an open pull request (by PR number or linked TASK) via an independent clean-context subagent and post the verdict (self-review path only on opencode; the self flag is accepted for Claude/Codex parity and is a no-op here). Use when PM mentions "review PR", "PR review", "review pull request"…

cryndoc/polisade-orchestrator · 102 tokens

polisade-review

Run a second-opinion quality review on a completed TASK via an independent clean-context subagent (self-review path only on opencode; the self flag is accepted for Claude/Codex parity and is a no-op here). Use when PM mentions "review TASK", "second opinion", "check my implementation", "codex review", "self-review"…

cryndoc/polisade-orchestrator · 99 tokens

rekindle

Recover a fellowship after a session crash. Scans worktrees and quest state, presents a recovery dashboard, and re-spawns Gandalf with recovered quest context. Use when returning to a crashed or expired fellowship session.

justinjdev/fellowship · 43 tokens

context

Analyze and optimize Claude Code's context configuration (analyze, optimize, or reset).

komluk/scaffolding · 19 tokens

pin

Break checkpoint — status display, session log, optional MEMORY.md update.

gf-labs/claude-toolbox · 0 tokens

atlas

Cross-project atlas with an adaptive render — ≤4 projects in scope get detail cards, more get one aligned digest line each, grouped by domain. Facets projects · sessions · memory · plans · specs · plugins · claude.md; a bare run renders all of them except plugins (opt-in, machine-global). --dir NAME|PATH anchors the…

gf-labs/claude-toolbox · 0 tokens