You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Add preCompact hook event for context refresh before token compaction #1138
Copilot CLI hooks are missing a preCompact event type that exists in Claude Code. This creates a gap for workflows that need to refresh context before token compaction (like Gas Town projects).
Background
Claude Code's .claude/settings.json supports a PreCompact hook that runs before context compaction:
This is critical for projects like Gas Town where agents (mayor, deacon, refinery, witness, crew, polecats) need to:
Inject fresh context via gt prime --hook on session start (sessionStart)
Refresh that context right before compaction (PreCompact) to ensure accurate state before tokens are compressed
Problem
Copilot CLI currently supports:
sessionStart
sessionEnd
userPromptSubmitted
preToolUse
postToolUse
errorOccurred
But NOT preCompact. This means agents running in Copilot CLI have stale context after compaction, which breaks multi-hour workflows.
Request
Add support for a preCompact hook event (or expose the internal compaction_start event) in Copilot CLI's .github/hooks/*.json configuration format, matching Claude Code's behavior.
Impact
Enables Gas Town and similar systems to work reliably with Copilot CLI for long sessions
Maintains parity with Claude Code's hook ecosystem
This was added in v1.0.5. The preCompact hook event is now available in the hooks configuration, so commands can run before context compaction starts. If you believe this isn't resolved, please feel free to reopen this issue.
Activity
examon commentedon Apr 7, 2026
This was added in v1.0.5. The
preCompacthook event is now available in the hooks configuration, so commands can run before context compaction starts. If you believe this isn't resolved, please feel free to reopen this issue.