research/which-ai-crawlers-can-read-your-site

Which AI Crawlers Can Read Your Site? Testing robots.txt the Way the Standard Says

Engineering Note · November 13, 2026 · 8 minute read · robots.txt · AI Search · Node.js · Testing

To find out whether an AI crawler may read a page, apply RFC 9309, the robots.txt standard, in two steps. First pick the group whose User-agent line names the crawler, or the * group if none does. Then take every Allow and Disallow rule in that group that matches the path, and let the longest one win, with Allow winning a tie. We wrote that as a 44-line Node.js module, checked it against 2,000 randomly generated cases, and found one rule that catches site owners out: a crawler with its own group ignores everything in the * group.

Everything below was run with Node.js 22.23.4, Python 3.13.18 and Protego 0.7.0 on Linux. The outputs are the real ones from this run.

Which crawler names matter?

Each AI company runs several crawlers, and they do different jobs. The ones that decide whether you can be found and cited are the search crawlers. Training crawlers are a separate choice.

CompanySearch and citationsModel trainingFetches a page a user asked for
OpenAIOAI-SearchBotGPTBotChatGPT-User
AnthropicClaude-SearchBotClaudeBotClaude-User
PerplexityPerplexityBotnone listedPerplexity-User

OpenAI says robots.txt rules “may not apply” to ChatGPT-User, and Perplexity says its user fetcher “generally ignores robots.txt rules,” because a person asked for the page. So robots.txt controls automatic crawling. It is not an access control. Pages that must stay private need a login.

What does the standard say?

RFC 9309 settles the questions that older, informal robots.txt advice left open:

  • Crawlers “MUST use case-insensitive matching to find the group that matches the product token.” If several groups name the same crawler, their rules are combined.
  • If no group names the crawler, it “MUST obey the group with a user-agent line with the ’*’ value.”
  • “The most specific match found MUST be used,” measured by the length of the rule’s path. If an Allow and a Disallow are equally specific, the Allow should win.
  • * matches any run of characters, and a $ at the end anchors the rule to the end of the path.

Google’s own robots.txt documentation describes the same order of precedence: the most specific rule by length of the rule path, and the least restrictive rule when they conflict.

What does the code look like?

// RFC 9309 robots.txt matcher: group selection by product token, longest match wins, allow wins ties.
export function parse(text) {
  const groups = [];
  let current = null, lastWasAgent = false;
  for (const raw of text.split(/\r?\n/)) {
    const line = raw.replace(/#.*$/, '').trim();
    const m = line.match(/^([A-Za-z-]+)\s*:\s*(.*)$/);
    if (!m) continue;
    const key = m[1].toLowerCase(), value = m[2].trim();
    if (key === 'user-agent') {
      if (!lastWasAgent) groups.push(current = { agents: [], rules: [] });
      current.agents.push(value.toLowerCase());
      lastWasAgent = true;
    } else if ((key === 'allow' || key === 'disallow') && current) {
      if (value) current.rules.push({ allow: key === 'allow', path: value });
      lastWasAgent = false;
    } else lastWasAgent = false;
  }
  return groups;
}

function rulesFor(groups, token) {
  const t = token.toLowerCase();
  const named = groups.filter(g => g.agents.includes(t));
  const chosen = named.length ? named : groups.filter(g => g.agents.includes('*'));
  return chosen.flatMap(g => g.rules); // groups for the same agent are merged
}

function toRegex(path) {
  const anchored = path.endsWith('$');
  const body = (anchored ? path.slice(0, -1) : path)
    .split('*').map(s => s.replace(/[.+?^${}()|[\]\\]/g, '\\$&')).join('.*');
  return new RegExp('^' + body + (anchored ? '$' : ''));
}

export function isAllowed(groups, token, urlPath) {
  let best = null;
  for (const r of rulesFor(groups, token)) {
    if (!toRegex(r.path).test(urlPath)) continue;
    const len = r.path.length;
    if (!best || len > best.len || (len === best.len && r.allow)) best = { len, allow: r.allow };
  }
  return best ? best.allow : true;
}

Consecutive User-agent lines share one group, which is how one block can cover both OAI-SearchBot and PerplexityBot. An empty Disallow: adds no rule, so it allows everything, as the standard intends. A path that no rule matches is allowed.

A five-line runner reads a robots.txt file and checks agent and path pairs:

import { readFileSync } from 'node:fs';
import { parse, isAllowed } from './robots.mjs';
const groups = parse(readFileSync(process.argv[2], 'utf8'));
const checks = process.argv.slice(3).map(s => s.split(' '));
for (const [agent, path] of checks) console.log(`${agent.padEnd(16)} ${path.padEnd(22)} ${isAllowed(groups, agent, path) ? 'allow' : 'BLOCK'}`);

What does it say about a realistic file?

This test file blocks GPTBot from training, lets two search crawlers in except for one folder, and gives everyone else a few rules, including a wildcard for PDFs:

User-agent: GPTBot
Disallow: /

User-agent: OAI-SearchBot
User-agent: PerplexityBot
Disallow: /private/
Allow: /private/menu.pdf

User-agent: *
Disallow: /admin
Disallow: /*.pdf$
Allow: /admin/help
$ node run.mjs cases.txt "GPTBot /services" "OAI-SearchBot /services" "oai-searchbot /private/notes" "PerplexityBot /private/menu.pdf" "ClaudeBot /admin/help" "ClaudeBot /admin/users" "ClaudeBot /files/price-list.pdf" "ClaudeBot /files/price-list.pdf?v=2"
GPTBot           /services              BLOCK
OAI-SearchBot    /services              allow
oai-searchbot    /private/notes         BLOCK
PerplexityBot    /private/menu.pdf      allow
ClaudeBot        /admin/help            allow
ClaudeBot        /admin/users           BLOCK
ClaudeBot        /files/price-list.pdf  BLOCK
ClaudeBot        /files/price-list.pdf?v=2 allow

/private/menu.pdf is allowed for PerplexityBot because Allow: /private/menu.pdf is longer than Disallow: /private/. /admin/help is allowed for ClaudeBot for the same reason. The last line shows what the $ anchor does: adding a query string means the path no longer ends in .pdf, so the rule no longer applies.

Our own robots.txt is simpler. It allows everything except /admin and /api/, for every crawler:

$ node run.mjs site.txt "GPTBot /research/the-shortlist-is-back" "OAI-SearchBot /pricing" "ClaudeBot /admin" "PerplexityBot /api/contact"
GPTBot           /research/the-shortlist-is-back allow
OAI-SearchBot    /pricing               allow
ClaudeBot        /admin                 BLOCK
PerplexityBot    /api/contact           BLOCK

Which mistake should you watch for?

Suppose a site starts with a * group that keeps crawlers out of /admin and /api/, then adds two groups to block GPTBot and welcome OAI-SearchBot:

User-agent: *
Disallow: /admin
Disallow: /api/

User-agent: GPTBot
Disallow: /

User-agent: OAI-SearchBot
Allow: /
$ node run.mjs gotcha.txt "GPTBot /pricing" "OAI-SearchBot /pricing" "OAI-SearchBot /admin" "ClaudeBot /admin"
GPTBot           /pricing               BLOCK
OAI-SearchBot    /pricing               allow
OAI-SearchBot    /admin                 allow
ClaudeBot        /admin                 BLOCK

OAI-SearchBot may now crawl /admin. Once a group names a crawler, that crawler reads only that group, so the * rules no longer reach it. ClaudeBot, which has no group of its own, still falls back to * and stays out. Protego gave the same four answers:

GPTBot           /pricing   BLOCK
OAI-SearchBot    /pricing   allow
OAI-SearchBot    /admin     allow
ClaudeBot        /admin     BLOCK

The fix is to repeat the shared rules inside each named group, for example Disallow: /admin and Disallow: /api/ under User-agent: OAI-SearchBot.

How do we know the matcher is right?

We generated 2,000 random robots.txt files with a fixed seed (9309). Each had one to three groups naming one or two of GPTBot, OAI-SearchBot, ClaudeBot, PerplexityBot and *, with one to three rules per group built from short path pieces, about one in five containing * and some ending in $. Each file came with a random crawler and path. We asked three implementations for an answer: our module, the Protego 0.7.0 library (a pure-Python robots.txt parser), and the urllib.robotparser module in Python 3.13.18.

$ python3 -I gen.py && node eval_node.mjs && python3 -I compare.py
2000 cases
cases: 2000  disagree with protego: 0  disagree with urllib.robotparser: 22

Our module and Protego agreed on every case. The 22 disagreements with urllib.robotparser came down to two behaviors, which we reproduced with two-line files:

$ cat tie.txt
User-agent: X
Allow: /a
Disallow: /*
$ node run.mjs tie.txt "X /a/b"
X                /a/b                   allow
$ python3 -I run.py tie.txt "X /a/b"
X                /a/b                   BLOCK

$ cat sub.txt
User-agent: Bot
Disallow: /
$ node run.mjs sub.txt "GPTBot /page"
GPTBot           /page                  allow
$ python3 -I run.py sub.txt "GPTBot /page"
GPTBot           /page                  BLOCK

Protego returned True (allowed) for both, matching our module. run.py is the same runner written against urllib.robotparser.

In the first, Allow: /a and Disallow: /* are the same length, so the standard says allow. The urllib.robotparser in this Python build scores a match by how much of the URL it covered (its source returns m.end() + 1), so /* covering all of /a/b beats /a. In the second, urllib decides whether a group applies by checking whether the group’s name appears inside the crawler’s name, so a group for Bot catches GPTBot. RFC 9309 matches the product token itself.

Neither behavior matters for most real files. Both matter if you are writing a test that decides whether an AI search crawler can see your pages.

Sources

Limitations

  • Agent matching is exact on the product token. Google also describes choosing “the most specific user agent,” which matters for crawlers with families of names such as Googlebot-News. Our module does not do prefix matching.
  • Rule length is measured in JavaScript string length, not octets, so a rule with non-ASCII characters can be scored differently. We did not test percent-encoding normalization.
  • The module answers what a file says. It does not fetch robots.txt, follow redirects, or apply the standard’s rules for missing (4xx) and failing (5xx) robots.txt responses.
  • The random test used a small alphabet of path pieces. It exercises ordering, ties, wildcards, anchors and group merging well, and long or unusual paths poorly.
  • What a crawler actually does is up to its operator. We tested the rules, not any company’s crawler.

Frequently asked questions

How do I check whether GPTBot or OAI-SearchBot can crawl my site?

Find the group in robots.txt whose User-agent line names the crawler, case-insensitively. If no group names it, use the group for *. Then find every Allow and Disallow rule in that group that matches the path, and the longest one wins, with Allow winning a tie. Our 44-line matcher does exactly this and agreed with the Protego library on 2,000 random cases.

If I add a group for one AI crawler, do my User-agent: * rules still apply to it?

No. A crawler that finds a group naming it uses only that group. In our test, a file that disallowed /admin for * and then said Allow: / for OAI-SearchBot let OAI-SearchBot into /admin. Repeat any rule you still want in each named group.

Which AI crawlers should a business allow?

The search crawlers, if you want to be found and cited: OAI-SearchBot for ChatGPT search, Claude-SearchBot for Claude, PerplexityBot for Perplexity, and Googlebot for Google Search and its AI features. Training crawlers such as GPTBot and ClaudeBot are a separate decision, and blocking them does not remove you from search.

Does robots.txt stop ChatGPT from opening my page when a user asks?

Not reliably. OpenAI says robots.txt rules may not apply to ChatGPT-User, because a person asked for the page, and Perplexity says its user fetcher generally ignores robots.txt. robots.txt governs automatic crawling, not every fetch.

Can I use Python's urllib.robotparser to test robots.txt?

With care. The version that shipped with Python 3.13.18 in our environment disagreed with the standard on 22 of 2,000 random cases. It scored wildcard rules by how much of the URL they matched, and it applied a group for Bot to GPTBot by substring. Protego 0.7.0 matched our RFC 9309 reading on every case.

More from Research

← All research