[BUG] Interactive mode: manual /compact fires PreCompact but never PostCompact (print mode fires both) — v2.1.214, macOS

Status Fixed / completed
Reported on v2.1.214
Maintainer reply None cached
Activity 2 comments · opened Jul 18, 2026 · closed Aug 16, 2026

Summary

In interactive (TUI) mode, a manual /compact fires PreCompact but never fires PostCompact when compaction completes. In print mode (claude -p) the same operation fires the full sequence (PreCompactSessionStart(source:"compact")PostCompact with trigger:"manual" and compact_summary). Same machine, same version, same settings.

Environment

  • Claude Code 2.1.214 (also reproduced on 2.1.212)
  • macOS 26.5 (Darwin 25.5.0), Apple Silicon host running x86_64 CC binary
  • Hooks registered in ~/.claude/settings.json for both PreCompact and PostCompact (simple command hooks)

Reproduction A — print mode (works)

Project-level logging hooks (cat >> hooks-fired.log for PreCompact/PostCompact/SessionStart/Stop/UserPromptSubmit), then:

claude -p "seed some context" ; claude -p --continue "/compact"

Hooks observed during the /compact invocation (full stdin payloads captured):

  1. SessionStart source:"resume"
  2. PreCompact trigger:"manual", custom_instructions:null
  3. SessionStart source:"compact"
  4. PostCompact trigger:"manual", compact_summary:"..."

Reproduction B — interactive mode (broken)

Interactive session (started same day, hooks present in settings at startup), user types /compact. Hook receiver timeline (receiver process stderr, timestamps local):

| time | event |
|---|---|
| 13:34:49.983 | PreCompact received ✅ |
| 13:34:50 – 13:36:58 | compaction runs, no hook events |
| 13:36:58.621 | compact_boundary system entry written to the session transcript (compaction done) |
| — | PostCompact: never fired (checked 20s+ after completion) |
| — | SessionStart(source:"compact"): never fired either |

The session transcript entries for the compact window all carry "version":"2.1.214".

Reproduced twice on two different interactive sessions (an earlier one at 12:56–13:00 behaved identically: PreCompact only).

Expected

PostCompact (and presumably SessionStart with source:"compact") should fire on manual compaction completion in interactive mode, matching print-mode behavior and the hooks documentation.

Impact

Any tooling that reacts to compaction completing (notifications, status displays, external memory layers) silently never triggers for interactive users — manual compactions of large contexts run for minutes and end with no observable hook signal. Possibly related: #77832 (PostCompact silent-miss on Windows).

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗