On this page

On this page

Tools

Tokenjuice

tokenjuice is an optional external plugin that compacts noisy exec and bash tool results after the command has already run.

It changes the returned tool_result, not the command itself. Tokenjuice does not rewrite shell input, rerun commands, or change exit codes.

Today this applies to OpenClaw embedded runs and OpenClaw dynamic tools in the Codex app-server harness. Native codex-rs shell (bash/exec) results returned to the model are not compacted. Native PostToolUse events can run the middleware for observers, but Codex does not accept a replacement tool response.

Enable the plugin

Install once:

bash
openclaw plugins install @openclaw/tokenjuice

Then enable it:

bash
openclaw config set plugins.entries.tokenjuice.enabled true

Equivalent:

bash
openclaw plugins enable tokenjuice

If you prefer editing config directly:

json5
{  plugins: {    entries: {      tokenjuice: {        enabled: true,      },    },  },}

What tokenjuice changes

  • Compacts noisy exec and bash results before they are fed back into the session.
  • Keeps the original command execution untouched.
  • Applies a safe-inventory policy: exact file-content reads stay raw, standalone repository-inventory commands can compact, and unsafe mixed command sequences stay raw.
  • Stays opt-in: disable the plugin if you want verbatim output everywhere.

The plugin releases Tokenjuice's compiled rule cache after results have used 128 distinct selected working directories. Ignored fallback directories do not count toward this limit. This bounds retained rule sets from old worktrees while preserving reuse for repeated results within the current set. After a release, active projects reload their rules on the next eligible result. Rule selection still uses the command's working directory.

Verify it is working

  1. Enable the plugin.
  2. Start a session that can call OpenClaw's exec tool, either in an embedded run or as a dynamic tool in the Codex app-server harness.
  3. Run a noisy command such as git status.
  4. Check that the returned tool result is shorter and more structured than the raw shell output.

Native codex-rs shell results stay unchanged, so this check does not apply to them.

Disable the plugin

bash
openclaw config set plugins.entries.tokenjuice.enabled false

Or:

bash
openclaw plugins disable tokenjuice
Was this useful?