# PostCompact Hook

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

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** PostCompact, compact_summary

## Think of it like

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

## 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

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

## Example code

```json
{
  "hooks": {
    "PostCompact": [
      { "hooks": [{ "type": "command", "command": "./log-summary.sh" }] }
    ]
  }
}
```

Log each summary Claude made.

## Why it matters

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

## Common mistake

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

## Three principles

- **After compaction.** Manual or auto.
- **Gets the summary.** To log.
- **Cannot block.** Already done.

## Related terms

- [PreCompact Hook](https://learn.benibix.com/term/ai/precompact-hook)
- [Auto-Compact](https://learn.benibix.com/term/ai/auto-compact)

---

Source: https://learn.benibix.com/term/ai/postcompact-hook
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
