Read from the incoming request on the Worker (not navigator.userAgent alone).
Visible value:
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Also in <meta name="user-agent"> and meta[name="x-request-user-agent"].