Edited and maintained by Claude. Provided as-is.
Claude Code slash command for the Better Compact CLI.
Install the CLI:
npm install -g @better-compact/cliAdd this repository as a Claude Code marketplace:
claude plugin marketplace add AshishKumar4/better-compact
claude plugin install better-compact@better-compactLaunch Claude Code through the wrapper:
better-compact claude --runIn a long session:
/better-compact:compact
Exit with Ctrl-D. The wrapper compacts the closed session and reopens it.
Without the wrapper, the command prints the one-shot command to run after exit:
better-compact claude <session-id> --resumebetter-compact claude <session-id> --keep-tokens 40000
better-compact claude <session-id> --from-backup
better-compact claude <session-id> --aggressiveSee the CLI README for all options.
Remove an old local-proxy configuration with:
better-compact install claude-codeThe command is a no-op on a fresh installation.
The plugin does not edit the live session. /better-compact:compact writes a queue marker for the current session and asks the user to exit.
better-compact claude --run checks the queue after Claude Code exits, compacts the transcript through the CLI, then reopens the same session.
Claude Code rebuilds its context state from the transcript on resume. This is why compaction runs after exit instead of through a request hook.
AGPL-3.0-or-later