compact

compact is a skill for Claude Code, Codex from gabrielmoreira/agent-skills-mirror. It costs 38 tokens per session (472 once invoked), scanned A, a copy of compact, MIT.

A tool for checking conversation context usage and scheduling compaction. Compaction replaces older conversation history with a shorter summary so the session can continue with more room.

In plain words
What is it for?
Use it to check context usage and schedule a summary that preserves important plans, handles, file paths, and next steps.
Why use it?
It helps long coding sessions continue when the conversation is approaching its context limit.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to check context usage and schedule a summary that preserves important plans, handles, file paths, and next steps.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/gabrielmoreira/agent-skills-mirror/compact
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.

Any agent
npx skills add gabrielmoreira/agent-skills-mirror --skill compact
Clone the repo
git clone --depth 1 https://github.com/gabrielmoreira/agent-skills-mirror

Made for: Claude Code, Codex.

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/skills/gabrielmoreira/agent-skills-mirror/compact/github.svg)](https://agentmods.dev/skills/gabrielmoreira/agent-skills-mirror/compact)
Your own site
<a href="https://agentmods.dev/skills/gabrielmoreira/agent-skills-mirror/compact"><img src="https://agentmods.dev/badge/skills/gabrielmoreira/agent-skills-mirror/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/skills/gabrielmoreira/agent-skills-mirror/compact"><img src="https://agentmods.dev/badge/skills/gabrielmoreira/agent-skills-mirror/compact.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 472 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 100% copy Near-identical to another mod 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.00038 $0.00472
Opus 5.5 $0.00015 $0.00189
Sonnet 5.5 $0.00008 $0.00094
Haiku 4.5 $0.00004 $0.00047

Measured 21d ago against content hash 195611c0759a, 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 21d 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.

Origin

This is a copy

100% identical to compact — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

mirrors/repos/7df-lab@claw-code-rust/crates/skills/assets/bundled/compact/SKILL.md · 47 lines

What it actually says

Compact

Compaction replaces older conversation history with a dense summary, freeing context so long-running work can continue. The implementation lives in the host (the same one behind the user's /compact command); this skill is the kernel-side interface to it. Call it directly from the Python REPL:

await compact.status()
await compact.run()
await compact.run("keep the failing test names and the migration checklist")

API

  • await compact.status() — current context usage as a dict: tokens, context_window, and percent (None right after a compaction until the next model response), plus scheduled (whether a requested compaction is already pending).
  • await compact.run(instructions=None) — schedule compaction. Returns {"scheduled": True}, or {"scheduled": False, "reason": ...} when there is nothing to compact yet. Optional instructions focus the summary on what matters for the remaining work.

Rules

  • Compaction never runs mid-cell. A scheduled compaction runs when the current turn ends, and the turn then stays ended — you are not resumed automatically. Before scheduling, record the state the summary must carry (plan, handles, file paths, the concrete next step) and tell the user how to pick the work back up. Work continues from the summary on the next instruction.
  • Conversation compaction does not itself prune the live Python namespace. Kernel snapshots and restores are separate: oversized or unserializable values may not be saved (the default per-variable limit is 16 MiB). Keep large or essential source data on disk and record how to reload it.
  • Compact at a natural boundary — a milestone reached, results saved, the next step easy to state — rather than mid-analysis. Check await compact.status() when unsure.
  • One request per turn is enough; calling run again before the turn ends only updates the instructions.
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. 21d ago Changed · +2 lines 195611c0759a
  2. 23d ago Changed · +14 lines 2509daf15b77
  3. 1mo ago First seen · 31 lines · 38 tokens per session scan A 7ea696d94cc9

Subscribe to this mod's changes

compact is a skill published in the GitHub repository gabrielmoreira/agent-skills-mirror (23 stars, last pushed yesterday), licensed MIT. It adds 38 tokens to every session and 472 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to compact, differing in 0 lines, and is treated as a copy.

Related

compact compared with skills from other repositories

compact next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
compactgabrielmoreira/agent-skills-mirrorSkill23yesterdayMITA38Claude Code, Codex
orbit-notionnexu-io/open-designSkill110ktodayApache-2.0A117Claude Code, Codex
agentmailpaperclipai/paperclipSkill118kyesterdayMITA30Claude Code, Codex
rowboat-spacesrowboatlabs/rowboatSkill18kyesterdayApache-2.0A60Claude Code, Codex
Cortexdanielmiessler/LifeOSSkill20k12d agoMITA184Claude Code
feishuHmbown/CodeWhaleSkill41kyesterdayMITA33Claude Code, Codex
pinchtab-mcppinchtab/pinchtabSkill11k5d agoMITA52Claude Code, Codex