[BUG] PreToolUse hook is given wrong transcript path
Resolved 💬 6 comments Opened Oct 2, 2025 by werdnum Closed Jan 7, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I have a PreToolUse hook that checks for file modifications and ensures that tests have been run since then.
It uses the transcript path provided as input to the PreToolUse hook for this purpose.
I have noticed that recently (in the last ~2 weeks), the hook has been spuriously failing. It appears that this is because the PreToolUse hook is receiving the transcript of an old conversation (seemingly the conversation pre-compaction)
What Should Happen?
The hook should receive the correct transcript path.
Error Messages/Logs
Steps to Reproduce
- Write a PreToolUse hook that reads the transcript path and fails if the transcript hasn't been modified in the last 5 minutes.
- Have a long conversation leading to compaction.
- Trigger the PreToolUse hook.
Hook should succeed but fails.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
1.0.x - not sure which version
Claude Code Version
2.0.2
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗