claude.nagdy.me

Session tracking with CLAUDE_CODE_SESSION_ID

A PostToolUse hook that logs tool calls with the session ID for audit trails.

json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "echo \"$(date -Iseconds) session=$CLAUDE_CODE_SESSION_ID tool=$CLAUDE_TOOL_NAME\" >> ~/.claude/audit.log"
          }
        ]
      }
    ]
  }
}
View Full Module