compact

compact is a command for Claude Code from alexmond/alexmskills. It costs 35 tokens per session (1,174 once invoked), scanned A, original, MIT.

A command that reviews the Decisions & Learnings section of a project's CLAUDE.md file, which stores instructions and lessons for coding agents. It proposes ways to keep lasting rules, archive old entries, and remove duplicates before applying approved edits.

In plain words
What is it for?
Use it to compact and maintain the Decisions & Learnings log in CLAUDE.md. It can graduate lessons into rules, merge or split entries, and archive outdated material after review.
Why use it?
It reduces clutter in the agent's working notes without silently changing or deleting information. Archived lessons keep a trace, while lasting rules remain easy to find.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the evolving-claude-md plugin — 1 skill, 1 command shipped together

Good fit Use it to compact and maintain the Decisions & Learnings log in CLAUDE.md. It can graduate lessons into rules, merge or split entries, and archive outdated material after review.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add alexmond/alexmskills
Claude Code
/plugin install evolving-claude-md

Made for: Claude Code.

Or install evolving-claude-md, the plugin that ships this one along with the rest of its 1 skill, 1 command.

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 compact

README.md
[![agentmods](https://agentmods.dev/badge/commands/alexmond/alexmskills/compact/github.svg)](https://agentmods.dev/commands/alexmond/alexmskills/compact)
Your own site
<a href="https://agentmods.dev/commands/alexmond/alexmskills/compact"><img src="https://agentmods.dev/badge/commands/alexmond/alexmskills/compact/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 compact

Your own site · 80×15
<a href="https://agentmods.dev/commands/alexmond/alexmskills/compact"><img src="https://agentmods.dev/badge/commands/alexmond/alexmskills/compact.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 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,174 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.00035 $0.01174
Opus 5.5 $0.00014 $0.00470
Sonnet 5.5 $0.00007 $0.00235
Haiku 4.5 $0.00003 $0.00117

Measured 16d ago against content hash eda6092b9682, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

compact 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 16d 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.

plugins/evolving-claude-md/commands/compact.md · 98 lines

How it starts

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

/evolving-claude-md:compact

Run the four downward pressures on this repo's Decisions & Learnings log as one reviewed edit. plan stops after showing the plan. yes skips the approval step. Anything else (or nothing) proposes, then waits.

CLAUDE.md is the project's working memory, so nothing is rewritten unseen, and nothing is deleted without a trace: archived entries go to docs/decisions/, graduated ones leave a line pointing at the rule.

1. Get the plan

From the directory holding CLAUDE.md, run the planner (read-only):

python3 "${CLAUDE_PLUGIN_ROOT}/skills/evolving-claude-md/compact-claude-md.py"

If CLAUDE_PLUGIN_ROOT is unset, use the newest installed copy: ls ~/.claude/plugins/cache/*/evolving-claude-md/*/skills/evolving-claude-md/compact-claude-md.py | sort -V | tail -1.

No ### Decisions & Learnings section → stop and offer the skill's setup ("make CLAUDE.md evolve") instead; there is nothing to compact.

Then read the whole Decisions & Learnings section and the Conventions / Gotchas sections — every judgment below needs the actual text, not the planner's previews.

2. Draft the edits, in this order

The order is the point. Graduation must happen before age-out, or a lesson that should be a standing rule goes into the quarterly archive instead.

  1. Supersede gaps — strike the named target, or fix the link.
  2. Release mirrors — an entry that names a version CHANGELOG.md already documents. Keep what the release taught — a constraint, a trap, a reversal, usually the Why: — and drop what it shipped. Rewrite the entry to the lesson, or drop it outright when it only says what shipped.
  3. Same-day clusters — collapse to one entry only if it really was one piece of work. A busy day spanning unrelated tickets is not a cluster. Per-aspect detail goes to docs/decisions/{date}-{topic}.md.
  4. Graduation — two sources:
    • the planner's tag candidates (same tag 3+ times, stable), and
    • your review of every age-out entry. The planner lists them because a lesson recurring by theme under different tags never trips the tag rule, and a log that tags each entry uniquely would otherwise graduate nothing. Ask of each: would a future session make a mistake without it? Each graduation is a one-line rule in Conventions (or Gotchas for a trap). Merge with an existing rule rather than adding a near-duplicate. If the file has neither section, propose adding the one you need.
  5. Mega entries — keep a one-line teaser, move the detail to docs/decisions/{date}-{topic}.md.
  6. Stale candidates — check the cited artifacts against the tree (grep, git log -- <path>). Fix the entry, strike it, or keep it with a note.
  7. Age-out — last, mechanically: archive-decisions.py --cutoff <date> (the planner prints the exact command). It moves every entry on or before the cutoff to docs/decisions/{YYYY-QN}.md and leaves one teaser per quarter, merging with a teaser from an earlier run.

Read the full file on GitHub · 98 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. 16d ago First seen · 98 lines · 35 tokens per session scan A eda6092b9682

Subscribe to this mod's changes

compact is a command published in the GitHub repository alexmond/alexmskills (9 stars, last pushed 6d ago), licensed MIT. It adds 35 tokens to every session and 1,174 once invoked, about $0.0001 per session on Opus 5.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-10-03.