# AI use cases for Compact Adviser (kunchenguid/compact-adviser)

Repo: [kunchenguid/compact-adviser](https://github.com/kunchenguid/compact-adviser) | Use cases: 4 | Page: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/

compact-adviser is an agent plugin for Pi, Claude Code, Codex CLI, and Grok Build that uses the TypeSafe Jev model to judge whether a session is at a safe point to run /compact.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Get safe /compact hints or automatic compaction in Pi: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/get-compact-hints-in-pi/
- Add /compact advice and optional auto-compact to Claude Code: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/add-compact-advice-to-claude-code/
- Get hint-only /compact advice in Codex CLI on macOS or Linux: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/get-compact-hints-in-codex-cli/
- Turn off Compact Adviser for unattended agent runs: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/silence-compact-advice-in-unattended-runs/

## How to get safe /compact hints or automatic compaction in Pi with Compact Adviser

Repo: [kunchenguid/compact-adviser](https://github.com/kunchenguid/compact-adviser) | Difficulty: Intermediate | Time: 15 minutes | Basis: From the README

Install Compact Adviser in Pi so it suggests or runs /compact at good stopping points.

**Who it is for:** A developer working in a long Pi coding session whose context keeps growing and who wants to know when compacting is safe.

**The problem:** Long sessions carry more context every turn, and compacting at the wrong moment can lose useful working state.

**The outcome:** Pi shows a hint to run /compact when a turn looks finished and the context is large enough, or compacts on its own in auto mode after first-use confirmation.

### Steps

1. Confirm Node 22 or newer is installed and that Pi is version 0.82.0 or newer.
2. Run `pi install npm:compact-adviser`.
3. Provide your TypeSafe key with TYPESAFE_API_KEY in the launch environment, or save it through the /compact-adviser settings.
4. Restart Pi or run `/reload`, then run `/compact-adviser status` and confirm it shows `Key: env`, `Key: saved`, or `Key: .env`.
5. Run `/compact-adviser hint` for suggestions only, or `/compact-adviser auto` to allow automatic compaction after the first-use confirmation. (inferred, check the README)

### Prompt to paste into your agent

```text
Install the compact-adviser package in Pi on <target machine>: run `pi install npm:compact-adviser`, set TYPESAFE_API_KEY, then run `/compact-adviser status`. Expected output: a status line reporting a key source of env, saved, or .env. Verify that the key source is not missing before reporting success.
```

### Caveat

Pi is only one of four hosts, and the README says the install counts as consent to send eligible checkpoint context to TypeSafe.

Risk, credentials: The TypeSafe API key is kept in the launch environment, saved settings, or a .env file, and eligible checkpoint context is sent to TypeSafe once a key is available.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/get-compact-hints-in-pi/

## How to add /compact advice and optional auto-compact to Claude Code with Compact Adviser

Repo: [kunchenguid/compact-adviser](https://github.com/kunchenguid/compact-adviser) | Difficulty: Intermediate | Time: 15 minutes | Basis: From the README

Install the Compact Adviser plugin in Claude Code with function hooks enabled.

**Who it is for:** A developer using Claude Code on long tasks who wants compaction timed to natural break points instead of guesswork.

**The problem:** Claude Code's context fills up during long tasks, and compacting in the middle of unfinished work can cost context that the next turn needs.

**The outcome:** Claude Code shows /compact-adviser settings, and the adviser hints or compacts at a settled turn depending on the mode you pick.

### Steps

1. Confirm Claude Code is version 2.1.274 or newer and Node 22 or newer is installed.
2. Run `claude plugin marketplace add kunchenguid/compact-adviser`.
3. Run `claude plugin install compact-adviser@compact-adviser`.
4. Start Claude Code with `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude`, since the variable must be exactly 1 for the mod to load.
5. Run `/compact-adviser`, save your TypeSafe key through the settings or environment, then run `/compact-adviser status` to check the key source.

### Prompt to paste into your agent

```text
In Claude Code on <target machine>, add the kunchenguid/compact-adviser marketplace, install compact-adviser@compact-adviser, and start claude with CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1. Expected output: the /compact-adviser command appears and /compact-adviser status reports a key source. Verify that the environment variable is exactly 1 before reporting success.
```

### Caveat

The README marks Claude Mod as an experimental feature, and CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC will block the plugin's network requests.

Risk, credentials: Your TypeSafe key is saved through Claude Code settings or the environment, and checkpoint context is sent to TypeSafe for judgment.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/add-compact-advice-to-claude-code/

## How to get hint-only /compact advice in Codex CLI on macOS or Linux with Compact Adviser

Repo: [kunchenguid/compact-adviser](https://github.com/kunchenguid/compact-adviser) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Install the Compact Adviser hook in Codex CLI to see a compact hint after each finished turn.

**Who it is for:** A developer on macOS or Linux using Codex CLI for long sessions who wants a prompt to compact without giving up manual control.

**The problem:** Codex CLI sessions grow over time, and there is no built-in signal for when compacting would be safe.

**The outcome:** After a completed checkpoint, Codex shows a hint line under the answer. Codex never compacts on its own, so the decision stays with you.

### Steps

1. Confirm you are on macOS or Linux, Node is 22.18 or newer, and Codex CLI is 0.153.0 or newer.
2. Run `codex plugin marketplace add kunchenguid/compact-adviser`.
3. Run `codex plugin add compact-adviser@compact-adviser`.
4. Restart Codex and review the hook in `/hooks` once so it is trusted.
5. Finish a turn and look for the `↳ Hook · Compact adviser:` line under the answer. If the hook cannot find Node, set COMPACT_ADVISER_NODE to an absolute node path.

### Prompt to paste into your agent

```text
Install compact-adviser in Codex CLI on <target macOS or Linux machine>: add the kunchenguid/compact-adviser marketplace, add compact-adviser@compact-adviser, then restart and trust the hook in /hooks. Expected output: a Compact adviser hint line appears after a completed turn. Verify the hook is trusted before reporting success.
```

### Caveat

Codex support is limited to macOS and Linux, and Windows is not supported in this release.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/get-compact-hints-in-codex-cli/

## How to turn off Compact Adviser for unattended agent runs with Compact Adviser

Repo: [kunchenguid/compact-adviser](https://github.com/kunchenguid/compact-adviser) | Difficulty: Beginner | Time: 15 minutes | Basis: From the README

Set COMPACT_ADVISER_DISABLE so scripted or background sessions skip all advice and compaction.

**Who it is for:** An engineer running agent sessions unattended, such as scheduled or batch jobs, where nobody reads a hint and no one can confirm auto mode.

**The problem:** Hints and automatic compaction are aimed at a person, so unattended sessions can waste TypeSafe requests or compact at a point no one reviews.

**The outcome:** The adviser stays inert in that session: no TypeSafe request, no hint, no automatic compaction, and no command, even if a mode was saved.

### Steps

1. Export `COMPACT_ADVISER_DISABLE=1` in the shell or job configuration that starts the unattended agent session.
2. Confirm the variable is set in that environment with `echo $COMPACT_ADVISER_DISABLE` before the job starts. (inferred, check the README)
3. Start the agent session from that same environment.
4. Keep the variable set for the whole run, since it wins over any saved hint or auto mode.

### Prompt to paste into your agent

```text
For the unattended agent job on <target host>, export COMPACT_ADVISER_DISABLE=1 in the job environment before launching the session. Expected output: the echoed variable value is 1 and the session produces no compact-adviser hints. Verify the value is 1 before the session starts.
```

### Caveat

The variable only switches the adviser off, so it does not change how the host decides when to compact on its own.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/kunchenguid-compact-adviser/silence-compact-advice-in-unattended-runs/
