II.
HookSurface overview
Reference · livehook-surface:pre-compact
PreCompact (canonical) overview
Fires before a context-compaction step; can block or alter the compaction. Claude Code 1.0+.
Attributes
eventName
PreCompact (canonical)
displayName
PreCompact (canonical)
kind
canonical
direction
pre
blocking
true
family
in-process
payloadSchema
type
object
required
- session_id
- transcript_path
- trigger
properties
session_id
type
string
transcript_path
type
string
trigger
type
string
enum
- manual
- auto
description
manual = /compact slash command; auto = context-window pressure.
custom_instructions
type
string
description
Free-form user instructions accompanying a manual compaction.
description
Fires before a context-compaction step; can block or alter the compaction. Claude Code 1.0+.
Outgoing edges
None.
Incoming edges
canonicalized_to1
- hook-surface:claude.pre-compact·HookSurfacePreCompact (Claude)
exposes1
- agent-runtime-impl:claude-code.runtime@1.x·AgentRuntimeImplClaude Code Runtime (1.x)
fires_hook2
- agent-core-impl:claude-agent-sdk.core@current·AgentCoreImplClaude Agent SDK Core (current)
- agent-core-impl:claude-code.core@1.x·AgentCoreImplClaude Code Core (1.x)
maps_hook3
- hook-mapping:pre-compact-claude-code·HookMapping
- hook-mapping:pre-compact-gemini·HookMapping
- hook-mapping:compact-before-copilot·HookMapping