ClaudeMap

compact-adviser

An agent plugin that answers one question — should I /compact now? — with a Jev judgment of whether the session sits at a safe boundary.

Plugins & Agentscontextcompactionpluginjevtoken-savings

compact-adviser watches each settled turn and asks TypeSafe's Jev two one-sentence questions — is the unit of work finished, and is this hands-on work or coordination — composed in code into one score. The hint floor slides from 0.90 while the context is mostly empty (through about 10% used) to 0.50 by about 90% full, because a wrong hint costs most when there is still room. It can stop at a hint, or on Pi and Claude Code, with your explicit opt-in, run the compaction itself at the right moment; Codex CLI and Grok Build are hint-only because nothing outside their sessions can trigger /compact. Local gates keep it inert below a 40,000-token minimum, in non-interactive sessions, and whenever COMPACT_ADVISER_DISABLE is set.

What it does

  • Four hosts, one judgment: Pi 0.82+, Claude Code 2.1.274+, Codex CLI 0.153+, Grok Build 1.0.34 (Node 22+; 22.18+ for Codex and Grok)
  • Claude Code installs as a plugin (marketplace add kunchenguid/compact-adviser) and needs the experimental Claude Mod flag CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1
  • Evaluated on a follow-up-aware gold set (96 checkpoints, 40 sessions): the loosening floor raises recall as the window fills while precision stays high
  • Privacy is bounded and documented: up to the last 64 visible replies, clipped excerpts, a 32,000-byte cap, best-effort key redaction, key only in the Authorization header — and Off mode or uninstall for material that must not leave the machine

When to use it

Long agent sessions where compaction timing is a judgment call: compact too early and you lose working context, too late and the host force-compacts mid-task. Also for unattended runs — export COMPACT_ADVISER_DISABLE=1 and the adviser stays completely inert.

Getting started

claude plugin marketplace add kunchenguid/compact-adviser
claude plugin install compact-adviser@compact-adviser
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude
# then /compact-adviser (status shows Key: env / saved / .env)
# requires a TypeSafe API key (TYPESAFE_API_KEY)

Things to know

Requires a TypeSafe API key, and installing the package is consent to send eligible checkpoint context to TypeSafe — the README's table spells out what is and is not sent, but it is explicitly not a guarantee: use Off mode for material that must stay local. The Claude Code path depends on CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1, an experimental feature. Automatic compaction exists only on Pi and Claude Code (behind a first-use confirmation); Codex and Grok can only hint. MIT.

Repository

kunchenguid/compact-adviser

Charted

Related on the map

  • CometixCode

    Plugin / Agent

    An unofficial Rust 1:1 reimplementation of the Claude Code terminal UI, ported file-for-file onto an iocraft TUI framework.

    • terminal-ui
    • rust
    • reimplementation
    • unofficial
  • Abide

    Plugin / Agent

    Hook-level enforcement for the natural-language rules in AGENTS.md and CLAUDE.md — every edit is judged and violations are repaired in the same turn.

    • hooks
    • code-review
    • rules
    • agents-md
  • fast-jev-compaction

    Plugin / Agent

    A Claude Code plugin that replaces the lossy compaction summary with Jev-scored pruning: stale tool calls are dropped, and everything kept stays verbatim.

    • plugin
    • context-management
    • compaction
    • function-hooks