Skip to content
BENIBIX Learn

PostCompact Hook

AI⌨️ Claude CodeConfiguration

Also known as PostCompact, compact_summary

The event after the chat is cut down. A hook can log the summary.

Think of it like

It is like you read the short notes. They were cut down from the long ones.

Example

Emma logs each summary from her PostCompact hook. Later she can see what Claude kept and what it lost.

Why it matters

It shows you exactly what Claude will remember from here on.

Definition

PostCompact is the hook event that fires once Claude Code has cut the chat down to a summary. It uses the same manual and auto matcher as PreCompact. The hook gets the new summary in a compact_summary field. So it can log it, or update a record kept outside. It cannot block a thing, since the summary is made.

Example code

json
{
  "hooks": {
    "PostCompact": [
      { "hooks": [{ "type": "command", "command": "./log-summary.sh" }] }
    ]
  }
}
Log each summary Claude made.

Common mistake

Trying to stop Claude from here with continue set to false. That field is thrown away on this event.

Key takeaways

  1. 1
    After compaction. Manual or auto.
  2. 2
    Gets the summary. To log.
  3. 3
    Cannot block. Already done.