feat: add PreCompact hook support #267

Open
opened 2026-05-06 12:24:14 -07:00 by hikari · 0 comments
Owner

Overview

CLI v2.1.105 added PreCompact hook support. Hooks can now block compaction by exiting with code 2 or returning {"decision":"block"}. This is a new hook event type that should be parsed and handled in the Rust backend.

Changes Required

  • Add PreCompact to the recognised hook event types in src-tauri/src/wsl_bridge.rs
  • Parse and emit the appropriate event (e.g. update character state, emit to frontend)
  • Add any relevant display logic for when compaction is blocked

Context

From the v2.1.105 changelog:

Added PreCompact hook support: hooks can now block compaction by exiting with code 2 or returning {"decision":"block"}

The existing PostCompact hook is already implemented — PreCompact is the complement that fires before compaction occurs.

References

  • Claude Code CLI v2.1.105 changelog

This issue was created with help from Hikari~ 🌸

## Overview CLI v2.1.105 added `PreCompact` hook support. Hooks can now block compaction by exiting with code 2 or returning `{"decision":"block"}`. This is a new hook event type that should be parsed and handled in the Rust backend. ## Changes Required - Add `PreCompact` to the recognised hook event types in `src-tauri/src/wsl_bridge.rs` - Parse and emit the appropriate event (e.g. update character state, emit to frontend) - Add any relevant display logic for when compaction is blocked ## Context From the v2.1.105 changelog: > Added PreCompact hook support: hooks can now block compaction by exiting with code 2 or returning `{"decision":"block"}` The existing `PostCompact` hook is already implemented — `PreCompact` is the complement that fires before compaction occurs. ## References - Claude Code CLI v2.1.105 changelog ✨ This issue was created with help from Hikari~ 🌸
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#267