PreCompact hook receives empty transcript_path
Resolved 💬 4 comments Opened Dec 11, 2025 by multimonty Closed Feb 27, 2026
Description
The PreCompact hook receives an empty string for transcript_path instead of the actual path to the conversation transcript file.
Expected Behavior
According to the hooks documentation, the PreCompact hook should receive:
{
"session_id": "abc123",
"transcript_path": "~/.claude/projects/.../session-id.jsonl",
"trigger": "manual",
...
}
Actual Behavior
The hook receives:
{"transcript_path": ""}
Steps to Reproduce
- Configure a PreCompact hook in
~/.claude/settings.json:
{
"hooks": {
"PreCompact": [
{
"hooks": [
{
"type": "command",
"command": "INPUT=$(cat); echo \"$INPUT\" >> /tmp/precompact-debug.log"
}
]
}
]
}
}
- Start a Claude Code session
- Run
/compactcommand - Check the log -
transcript_pathis empty
Environment
- OS: macOS (Darwin 25.0.0)
- Claude Code: Latest version
Use Case
I'm trying to backup conversation transcripts before compaction. The hook logic is correct but fails because it receives no path to the transcript file.
🤖 Generated with Claude Code
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗