Home / Claude Code mods / Cost & usage / smart-compact

smart-compact

smart-compact is a Claude Code mod by ZH-L1N that compacts at the right moment: after a commit or green tests, a minute before the prompt cache expires, or when Claude asks for it with its own request_compact tool.

Updated 2026-11-17

What is smart-compact?

smart-compact is a Claude Code mod by ZH-L1N that compacts at the right moment: after a commit or green tests, a minute before the prompt cache expires, or when Claude asks for it with its own request_compact tool. It is listed under Cost & usage and has no public popularity data yet.

TypeClaude code mod
AuthorZH-L1N
RepositoryZH-L1N/agent-window-mods
Popularityno public popularity data yet
CategoryCost & usage
SecurityReview before installing (68/100)
Rank#9,353 of 9,397 Claude Code mods; #1,876 in Cost & usage
Last commit2026-11-17
Hooks8 events
SeesBash calls, PowerShell calls, classic hooks, every prompt, mcp__smart-compact__request_compact calls
Draws onPane, AbovePrompt

Is smart-compact safe to install?

smart-compact scores 68/100 on the MCPMods security check: Review before installing. Things to review: starts processes outside the sandbox; watches every prompt or event. It passed 4 of 8 checks.

Mod footprints come from claude plugin validate, which lists every event a mod hooks and every API call it makes without running it.

CheckResult
No network accessPass
Starts processes outside the sandboxReview
Writes no files or configPass
Doesn't read environment variablesPass
Watches every prompt or eventReview
Doesn't drive ClaudePass
Validator reported problemsNote
No license detectedNote

API calls in its code

CallWhat it means
$.clock.after
$.clock.now
$.command.register
$.command.rundrives Claude
$.process.runruns processes
$.session.compactdrives Claude
$.session.usage
$.state.get
$.state.set
$.tool.registerdrives Claude
$.ui.closedraws interface
$.ui.opendraws interface
$.ui.resolvedraws interface
$.ui.toastdraws interface

How do I install smart-compact?

  1. Check your Claude Code version. Mods need Claude Code 2.1.287 or later and are on by default.
    claude --version
  2. Read its footprint. This lists every event it hooks and every API call it makes, without running it.
    git clone https://github.com/ZH-L1N/agent-window-mods
    claude plugin validate ./agent-window-mods/smart-compact
  3. Install it. Run this in your terminal, then /reload-plugins in an open session.
    claude plugin marketplace add ZH-L1N/agent-window-mods && claude plugin install smart-compact@zehui-mods

Or ask Claude to set it up

Paste this into Claude Code and it installs smart-compact for you:

Install the "smart-compact" Claude Code mod from https://github.com/ZH-L1N/agent-window-mods/tree/main/smart-compact. Run claude plugin validate on it first and show me what it can access before you enable it.

More from ZH-L1N/agent-window-mods

This repository has at least 9 Claude Code mods on MCPMods.

  • agents: Live subagents, background shells, Monitor watches and cron timers: an AGENTS band above the prompt (main model, each ru (Review before installing)
  • blast-radius: Holds risky shell commands (rm -rf, git reset --hard, git clean, force push, migrations) and shows what they would chang (Review before installing)
  • breathe: Guided breathing exercises above the prompt while Claude works: coherent, box, 4-7-8 and the physiological sigh, sevente (Low risk)
  • cache-clock: A CACHE band above the prompt: how long the prompt cache stays warm, how much of the last request it served, and what re (Low risk)
  • filetree: A small tree of the working folder in a Files pane: folders open and close, git marks changed files, and the files read (Low risk)
  • goal-meter: A GOAL band above the prompt that reads Claude's own task list: the goal's name, a 6-cell bar of tasks done, percent, ti (Low risk)
  • handoff: A HANDOFF band above the prompt: the context bar stacked by /context category, fill against the compaction point, and at (Low risk)
  • here: A HERE band above the prompt that says where the session is, with no model call by default (option rewrite=haiku makes o (Low risk)