Compact

From gabrielmoreira/agent-skills-mirror · View interactive version

Compact is an AI agent skill from the GitHub repository gabrielmoreira/agent-skills-mirror. Check context usage and compact the conversation from the Python REPL. Use when context is filling up, so the session is summarized and context is freed for the next stretch of work.

How to use this skill

Skill file

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

context_window, and percent (None right after a compaction until the

next model response), plus scheduled (whether a requested compaction is

already pending).

{"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

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.

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.

next step easy to state — rather than mid-analysis. Check

await compact.status() when unsure.

only updates the instructions.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.