PostCompact
Runs after Claude Code completes a compact operation. Use this event to react to the new compacted state, for example to log the generated summary or update external state. Claude Code discards a PostCompact hook's systemMessage and continue fields.
The same matcher values apply as for PreCompact:
| Matcher | When it fires |
|---|---|
manual | After /compact |
auto | After auto-compact when the conversation reaches the auto-compact window |
PostCompact input
In addition to the common input fields, PostCompact hooks receive trigger and compact_summary. The compact_summary field contains the conversation summary generated by the compact operation.
json
{
"session_id": "abc123",
"transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",
"cwd": "/Users/...",
"hook_event_name": "PostCompact",
"trigger": "manual",
"compact_summary": "Summary of the compacted conversation..."
}PostCompact hooks have no decision control. They can't affect the compaction result but can perform follow-up tasks.