Skip to content

Compact Adviser

"Work appears completed or recorded. Run /compact to save tokens."

Install: claude plugin install compact-adviser@compact-adviser

Works with Claude Code · 234 GitHub stars

Install

$claude plugin install compact-adviser@compact-adviser

Install command taken from the project's README or registry entry. Always review code before running it.

compact-adviser

compact-adviser is an agent plugin that answers a single question: should I /compact now?

It uses Jev to instantly judge whether the current session is likely at a boundary that's safe to compact.

It can give you a hint to run /compact - or, on Pi and Claude Code, if you opt in, it can run it for you at the right time automatically. Codex CLI and Grok are hint-only: nothing outside their sessions can trigger /compact.

Judgment is two one-sentence Jev questions in one request (is the unit finished; is this hands-on work or coordination), composed in code into one score. The hint floor is 0.90 while the context is mostly empty (through about 10%) and relaxes toward 0.50 by about 90% full - a wrong hint costs most when there is still room. "Full" means the point where the host compacts: on Claude Code that is its auto-compact threshold when enabled, elsewhere the model's window. If you would rather compact well before that (long contexts cost more every turn), set a context budget: the floor then relaxes as the context approaches the smaller of your budget and that point. Automatic mode is the same gate, plus a first-use confirmation.

Quick Start

Prerequisites: Node 22+ (22.18+ for Codex and Grok), and one of Pi 0.82.0 or newer (verified on 0.85.1), Claude Code 2.1.274 or newer (verified on 2.1.275), Codex CLI 0.153.0 or newer (verified on 0.153.4), or Grok Build 1.0.34 or newer (verified on 1.0.34), plus a TypeSafe API key. Supply it as TYPESAFE_API_KEY in the launch environment or put it in the session cwd's ./.env; Pi and Claude Code can also save it through their settings, while Codex and Grok provide an external compact-adviser CLI. Jev is TypeSafe's structured decision model; this package asks it two one-sentence classification questions and never asks it to write a summary.

Installing the package is consent to send eligible checkpoint context to TypeSafe when a key is available and the other product gates pass. With TYPESAFE_BASE set, that context and the key go to that base instead.

Pi

pi install npm:compact-adviser

Restart Pi or run /reload, then /compact-adviser. /compact-adviser status should say Key: env, Key: saved, or Key: .env.

To install from git: pi install git:github.com/kunchenguid/compact-adviser (add -l for project-local).

Claude Code

This plugin uses Claude Mod which is an experimental feature that requires CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 in your environment.

claude plugin marketplace add kunchenguid/compact-adviser
claude plugin install compact-adviser@compact-adviser
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude

Then /compact-adviser.

Codex CLI

Codex support is macOS and Linux only. The plugin's hooks run through POSIX sh, matching this repository's platform badge; Windows is not supported this ship.

codex plugin marketplace add kunchenguid/compact-adviser
codex plugin add compact-adviser@compact-adviser

Restart Codex and review the hook in /hooks once, so it is trusted. After a completed checkpoint the advice appears as a ↳ Hook · Compact adviser: ... line under the answer.

Similar plugs

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

PluginDev tools+6,803 this week

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies

Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro…

Explore related