lavish-axi
Turns complex or visual agent responses, such as plans and comparisons, into HTML artifacts you can annotate and send feedback on, using the lavish-axi CLI.
Claude Code
> /plugin marketplace add kunchenguid/compact-adviser> /plugin install compact-adviser@compact-adviser
Codex
$ npx skills add kunchenguid/compact-adviser -a codex
Cursor
$ npx skills add kunchenguid/compact-adviser -a cursor
Gemini CLI
$ npx skills add kunchenguid/compact-adviser -a gemini-cli
GitHub Copilot
$ copilot plugin marketplace add kunchenguid/compact-adviser$ copilot plugin install compact-adviser@compact-adviser
OpenCode
$ npx skills add kunchenguid/compact-adviser -a opencode
Windsurf
$ npx skills add kunchenguid/compact-adviser -a windsurf


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.
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 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).
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 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.
Codex is hint-only: it has no surface that lets another process run /compact, so there is
no automatic mode there. Settings live in a small CLI instead of a slash command; ask Codex for
"compact-adviser status" and the bundled skill runs it, or run it yourself:
node "$(ls -d "${CODEX_HOME:-$HOME/.codex}"/plugins/cache/*/compact-adviser/*/ | tail -1)src/cli.ts" status
Grok is hint-only: nothing outside a running session can trigger /compact, so there is no automatic mode here. The hint is painted on the status row and never enters the model's context.
grok plugin install kunchenguid/compact-adviser#packages/grok-plugin --trust
(Install from the subdirectory, not the repository root: Grok also reads the Claude marketplace index in this repo, so a plain grok plugin marketplace add offers two plugins of the same name and refuses an unqualified install.)
Then two one-time steps, because Grok does not let a plugin do either of them for you. Start Grok and run:
/compact-adviser-install
That writes ${GROK_HOME:-~/.grok}/hooks/compact-adviser.json, because Grok 1.0.34 lists a plugin's own hooks/hooks.json but never loads it into a session. Hooks in your own Grok home are always trusted, so nothing else is needed; delete that file to remove them. From a shell it is node "$(node -e 'const l=JSON.parse(require("child_process").execFileSync("grok",["plugin","list","--json"],{encoding:"utf8"})); const p=(Array.isArray(l)?l:[]).find(x=>x&&x.name==="compact-adviser"); if(!p||typeof p.path!=="string") throw new Error("compact-adviser is not installed"); process.stdout.write(p.path)')/bin/adviser.ts" install. After install, ${GROK_HOME:-~/.grok}/compact-adviser/adviser.sh resolves the currently installed plugin the same way.
Then paste the [ui.status_line] block install printed into the config.toml path it named and restart Grok. The status row is off by default and only your own config can turn it on - a plugin cannot, and neither can a repository. Grok has one status row, so this script paints the built-in segments (cwd, model, context) too. Minimal render mode has no status row at all.
On Grok, save the TypeSafe key as TYPESAFE_API_KEY or a cwd .env, or with the CLI key command from a shell outside Grok. Do not type secrets after a Grok slash command; Grok appends those words to the model.
| Symptom | Cause |
|---|---|
| TypeSafe requires payment (HTTP 402) | Check the TypeSafe account's billing and credits; waiting alone will not resolve a payment requirement. Context stays unchanged. |
Key: missing in /compact-adviser status (Pi, Claude Code) or /compact-adviser (Grok) | No TYPESAFE_API_KEY in the launch environment, saved settings, or the session cwd's ./.env |
No /compact-adviser command in Claude Code | CLAUDE_CODE_ENABLE_FUNCTION_HOOKS is not exactly 1 |
| Command exists, no hint | Context is below the constant 40,000-token minimum, the session is not idle, or the last turn was not a settled final answer |
| Claude Code: "nonessential traffic" | CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC blocks plugin network requests |
| No hint in Codex | The hook is untrusted (review it in /hooks), Node is older than 22.18, or the hook cannot find Node at all - Codex rebuilds its PATH, so set COMPACT_ADVISER_NODE to an absolute node path |
| Grok: no hint row at all | [ui.status_line] is not set in the config.toml install named, or Grok is in minimal render mode |
| Grok: no hint after a completed turn | /compact-adviser-install has not run, so no Stop hook is judging |
Pi print / RPC / JSON, Claude -p, or codex exec | The adviser stays inert in reliably detected non-interactive sessions |
| Nothing at all, in any host | COMPACT_ADVISER_DISABLE is set to a truthy value |
| Variable | Effect |
|---|---|
TYPESAFE_API_KEY | The Jev key; a saved key or the session cwd's ./.env is used when this is unset |
TYPESAFE_BASE | Replaces the TypeSafe API base URL, https://api.typesafe.ai by default; the request goes to <base>/v1/systemone with a trailing slash dropped. Read from the launch environment only, never a saved setting or ./.env. It must be an https URL; plain http is accepted only for a loopback host (127.0.0.1, [::1], localhost). Any other value, or one that carries credentials, a query or a fragment, is a configuration error: no request and no advice |
COMPACT_ADVISER_DISABLE | 1, true, yes or on (any case) makes the session inert: no TypeSafe request, no hint, no automatic compaction, no command. It wins over a saved hint or auto mode |
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS | Claude Code only; must be exactly 1 for the mod to load |
COMPACT_ADVISER_NODE | Codex only; absolute path to a Node 22.18 or newer executable when the hook cannot find one on its rebuilt PATH |
Export COMPACT_ADVISER_DISABLE=1 for unattended agent sessions, where advice has nobody to read it.
| Included | Not sent |
|---|---|
| Bounded user constraints, up to the last 64 visible replies and tool results (clipped), short tool-result excerpts, an existing summary, saved-artifact names, omission markers | System prompts, hidden reasoning, images, environment variables, the API key in the model context and request body, complete transcripts |
| Best-effort redaction of known key patterns and obvious sensitive-file results | A guarantee. Uninstall or set mode Off for material that must not leave the machine |
Requests go to https://api.typesafe.ai/v1/systemone, or <TYPESAFE_BASE>/v1/systemone when that is set, are capped at 32,000 serialized UTF-8 bytes, and never treat an error as an affirmative judgment.
The TypeSafe API key never enters the model context or the request body; it is sent as the Authorization header to authenticate the call.
Details: SECURITY.md.
settled turn
│
▼
┌───────────────────┐
│ cheap local gates │ mode, 40k minimum, idle session, key, cooldowns
└─────────┬─────────┘
▼
┌───────────────────┐
│ TypeSafe Jev │ done × shape score, floor slides 0.90→0.50 with usage
└─────────┬─────────┘
▼
hint: run /compact or, with explicit auto, native compaction
Automatic compaction is available on Pi and Claude Code. On Codex the same judgment only ever
produces the hint, as a ↳ Hook · line in the scrollback. On Grok the two halves are separate
processes: a Stop hook judges and records a verdict, and the [ui.status_line] script reads
that verdict and paints the hint. The Grok hook always allows the stop and prints nothing, so a
hint can never be fed back to the model.
On Claude Code, an optional beforeCompactPrompt setting (empty by default; set it in /config)
runs one turn before that automatic compaction, and only after auto mode is confirmed. Set it to
/stow to run the stow command first. Claude Code does not expand slash commands or @file
mentions in a prompt a plugin submits, and it rejects a plugin prompt that starts with /, so a
value that starts with / is run as a command instead of being sent to the model as text. If you
send your own prompt or run a command in between, or that turn is interrupted, errors, or does not
finish within 5 minutes, nothing is compacted. Hint mode, off, and an empty setting are unchanged. Pi, Codex, and
Grok do not have this setting.
| Command | Effect |
|---|---|
/compact-adviser (Pi and Claude Code) | Settings (mode, minimum, request log, TypeSafe API key) |
Turns complex or visual agent responses, such as plans and comparisons, into HTML artifacts you can annotate and send feedback on, using the lavish-axi CLI.
Lets Claude Code control a Chrome browser session through the chrome-devtools-axi CLI, to navigate pages, read accessibility snapshots, click, fill forms, run JavaScript, inspect console and network activity, take screenshots, and audit performance.
Coordinates a crew of AI coding agents from a single conversation, dispatching parallel tasks into isolated git worktrees, automating pull requests, and supervising progress. It also includes a stow skill that files durable project knowledge.
Captures what your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions so work carries over. Works with Claude Code and several other coding agents.
Local-first memory for Claude Code. It stores conversations verbatim in a private palace you can search before answering about past work, people, projects, or decisions, with optional shared-brain hub setup.
Gives Claude Code long-term memory through Hindsight. It recalls relevant past context before answering, retains durable facts as the agent learns them, and reflects over stored memory.
Gives Claude Code a private memory that stays on your machine. It stores past conversations word for word, so you can ask what was decided, what happened before, or who was involved and get the original context back. It can also hand tasks to other agents.
compact-adviser is indexed on Flowy in the Agent Memory category. Install it with the command on its page. It includes compact-adviser. Its skills do not fire on their own yet. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it