← Back to Plugins
Tools

Compact Notify

unblocklabs-ai By unblocklabs-ai 👁 6 views ▲ 0 votes

OpenClaw plugin hook pack for session compaction notifications

GitHub

Configuration Example

{
  "enabled": true,
  "onlySlack": true,
  "minTokenCount": 12000,
  "beforeMessage": "Compacting context to stay responsive…",
  "afterMessage": "Compaction finished. Kept {{messageCount}} messages and saved {{tokensSaved}} tokens."
}

README

# OpenClaw Compact Notify

User-visible compaction notifications for OpenClaw sessions.

This plugin registers compaction hooks and sends lightweight messages when session compaction starts and finishes.

## What it does

- hooks `session:compact:before`
- hooks `session:compact:after`
- injects user-visible messages via `event.messages.push(...)`
- supports editable message templates through plugin config

This is especially useful in Slack threads, where long compaction pauses can otherwise look like the agent has stopped responding.

## Install

Load the plugin like any other OpenClaw native plugin package.

## Config

Available config fields:

- `enabled`
- `onlySlack`
- `minTokenCount`
- `minMessageCount`
- `suppressAfterIfBeforeNotSent`
- `beforeMessage`
- `afterMessage`

### Template variables

Templates may include placeholders like:

- `{{sessionKey}}`
- `{{timestamp}}`
- `{{messageCount}}`
- `{{tokenCount}}`
- `{{messageCountOriginal}}`
- `{{tokenCountOriginal}}`
- `{{compactedCount}}`
- `{{summaryLength}}`
- `{{tokensBefore}}`
- `{{tokensAfter}}`
- `{{tokensSaved}}`
- `{{firstKeptEntryId}}`

Example config:

```json
{
  "enabled": true,
  "onlySlack": true,
  "minTokenCount": 12000,
  "beforeMessage": "Compacting context to stay responsive…",
  "afterMessage": "Compaction finished. Kept {{messageCount}} messages and saved {{tokensSaved}} tokens."
}
```

## Notes

- The plugin uses OpenClaw's internal hook registration surface so it can push user-visible messages.
- It does not perform routing, orchestration, or channel-specific delivery logic itself.
- Slack-only behavior is implemented by checking whether the session key is Slack-backed.
tools

Comments

Sign in to leave a comment

Loading comments...