Session tracking with CLAUDE_CODE_SESSION_ID
A PostToolUse hook that logs tool calls with the session ID for audit trails.
{
"hooks": {
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "echo \"$(date -Iseconds) session=$CLAUDE_CODE_SESSION_ID tool=$CLAUDE_TOOL_NAME\" >> ~/.claude/audit.log"
}
]
}
]
}
}