Function-hook session.compact replacement re-saves kept messages as new entries, so the desktop app shows them duplicated
Version: Claude Code 2.1.295, desktop app (Code tab), Windows 11. Function hooks are on (CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1) and a plugin handles session.compact by returning a reduced list of kept messages.
What happens: after each hook-driven compaction, Claude Code writes a compact_boundary entry ("Conversation compacted") and then appends every kept message to the session log again. The copies are exact: same message.id, requestId and timestamp, with only new uuid/parentUuid. Nothing marks them as copies. The desktop transcript shows entries from before and after the boundary, so a message kept through N compactions appears N+1 times. In one session, 114 of 123 distinct assistant text blocks were repeated, some up to 16 times.
Expected: kept messages are either not re-saved, or the copies are marked so the transcript view hides them (or the view collapses entries that share a message.id).
Repro: run a plugin whose session.compact hook returns a subset of messages, trigger several compactions, then scroll the desktop transcript. The same assistant text repeats once per compaction.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗