Smart Compact

    1

    Hooks that save changed files, open todos and recent commands before Claude Code compacts, then re-inject them afterwards.

    $4

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Smart Compact

    Example session with this skill installed

    A 3-hour refactor session hits auto-compact at 85% context.

    • Read your context and instructions
    • Compiled the smart compact

    After compaction the session starts with: Current task, Open todos ([in_progress] Migrate auth middleware), Files modified (src/auth.ts, tests/auth.test.ts), Recent shell commands, Last 3 user messages.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Compaction drops detail. Smart Compact keeps the parts of a long session you need to resume.

    How it works

    • A PreCompact hook's output is display-only, so it cannot carry state into the compacted context. Only SessionStart additionalContext can.
    • So one script handles three hooks: Stop (silent refresh each turn, gated by a context-usage threshold) and PreCompact (final refresh) write a summary to a sidecar file; SessionStart with source compact/resume reads it, injects it as additionalContext and deletes it.
    • The summary lists: current task, open TodoWrite items, files modified, recent shell commands and the last user messages. It is built by rules from the transcript, not by an LLM, so it costs no tokens.

    What you get

    • smart_compact.py, a single stdlib-only Python file.
    • --preview to see what would be preserved, with no install.
    • Config file for threshold, list sizes and context window size.

    Tested with a synthetic transcript: preview, Stop writes the sidecar, PreCompact prints a message, SessionStart(compact) emits additionalContext and removes the sidecar, SessionStart(startup) stays silent.

    The summary is rule-based: it lists facts (files, commands, todos, messages), not reasoning. Open todos come from the most recent TodoWrite call only. If a future Claude Code version changes the transcript format the summary becomes empty and the hooks stay silent; they never block. Set context_window_tokens to your model's real window or the threshold percentage will be wrong. The summary quotes recent shell commands and messages, so review it before sharing.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 13 days ago

    Requires

    Python 3.9+
    Claude Code with hooks support

    Permissions

    File Scopes

    claude
    config
    dir
    /projects/**/*.jsonl
    (read)
    /.smart-compact/
    (read/write)
    /smart-compact.config.json

    No network access. Hooks always exit 0.

    Listed13 days ago

    What's inside

    Frequently Asked Questions

    Hooks that save changed files, open todos and recent commands before Claude Code compacts, then re-inject them afterwards.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use Smart Compact on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in LLM Ops