feat: inject system override message into transcript to prevent claude compaction
Instead of relying solely on CLAUDE.md instructions, inject a synthetic system message directly into the chat history before compaction. This makes the instruction impossible to ignore since it's part of the conversation Claude is being asked to compact. The flow: 1. PreCompact hook reads original transcript 2. Injects system override message into the transcript file 3. Claude's compaction model sees the message and outputs sentinel text only 4. Original unmodified messages are sent to Morph for real compression 5. SessionStart hook injects the Morph summary into the new session This approach proved effective in testing - the model cannot ignore an explicit instruction in its conversation history. Verified with (filtered X lines) markers showing Morph compression is working correctly. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
D
DhruvBhatia0 committed
59fe9418a3c811806843ad51a11cd9ceffc1a615
Parent: a1d6622