Measure this visit?
Accept allows Google Analytics, Microsoft Clarity and PostHog, including session recording. Reject stops their recording. Cookieless counts and server request logs stay on. What we measure
// open source
npx answer-crawler-checkanswer-crawler-check fails your build when robots.txt blocks an AI answer crawler from any page in your sitemap.
npx answer-crawler-check https://example.com/sitemap-index.xml
Each AI engine reads robots.txt through its own crawler names. OpenAI documents OAI-SearchBot for search and GPTBot for training, each with its own robots.txt entry. Block the first by mistake and ChatGPT search can’t fetch the page it would have cited.
We saw the gap on this site. In a review of the build, someone added
User-agent: Claude-SearchBot and Disallow: / to the built file, and every
other check passed.
Since then the build tests every page for every answer crawler we allow. This
tool is that test, for any site.
A check of your home page, or of one URL you paste in, misses a rule like
Disallow: /docs/ in one crawler’s group, or /*.html in another. Those block
some pages and leave the home page open. This tool reads every URL in the sitemap.
https://example.com: robots.txt from dist/robots.txt, local file, 3 page(s)
ok OAI-SearchBot (no group of its own, uses *)
BLOCKED Claude-SearchBot 1 URL(s)
https://example.com/docs/setup/ Disallow: /docs/ (line 9)
...
answer-crawler-check: FAILED, 2 problem(s)
Each blocked page comes with the rule and line that blocked it.
By default it checks 11 crawlers. They fetch pages while an answer is written, or build the index the answers cite. They are OAI-SearchBot, ChatGPT-User, Claude-SearchBot, Claude-User, PerplexityBot, Perplexity-User, DuckAssistBot, MistralAI-User, Applebot, Googlebot and Bingbot.
Training crawlers such as GPTBot and CCBot are left out. Blocking them is a fair
choice, and it doesn’t take you out of search answers. Name them with --agents
if you want them checked too.
The crawler names come from ai.robots.txt,
the community list of AI crawlers, used under its MIT licence. A copy ships with
the tool, and --list latest fetches the current one.
npm run build
npx answer-crawler-check dist/sitemap-index.xml --site-dir dist
With --site-dir, the sitemaps and robots.txt come from your build folder, so a
bad rule fails the build before it reaches the live site.
Every job below fails when a crawler is blocked. The ones that check a build
assume npm run build writes the site to dist/.
- uses: synapsereality/answer-crawler-check@v0.1.2
with:
sitemap: dist/sitemap-index.xml
site-dir: dist
In .gitlab-ci.yml:
answer-crawlers:
image: node:22-slim
script:
- npm ci
- npm run build
- npx --yes answer-crawler-check@0.1.2 dist/sitemap-index.xml --site-dir dist --json crawlers.json
artifacts:
when: always
paths:
- crawlers.json
when: always keeps the JSON report when the job fails. To check the live
site on a schedule, add a job that only runs when $CI_PIPELINE_SOURCE is
"schedule", and create the schedule under Build > Pipeline schedules.
In bitbucket-pipelines.yml:
image: node:22-slim
pipelines:
default:
- step:
name: Check AI answer crawler access
script:
- npm ci
- npm run build
- npx --yes answer-crawler-check@0.1.2 dist/sitemap-index.xml --site-dir dist
For a weekly check of the live site, put the same npx line with your live
sitemap URL in a custom pipeline. Then schedule it under Pipelines,
Schedules.
The repo ships a pre-commit hook, in version 0.1.3
and later. It runs when a commit changes a file named robots.txt, and tests
that file against every page in your live sitemap. In .pre-commit-config.yaml:
repos:
- repo: https://github.com/synapsereality/answer-crawler-check
rev: v0.1.3
hooks:
- id: answer-crawler-check
args: [--robots, public/robots.txt, https://example.com/sitemap.xml]
--robots is the path to your robots.txt from the root of the repo, and the
sitemap gives the list of pages.
The hook needs network access to read a live sitemap. Without it, the sitemap
can’t be read and the commit fails. To check offline, read the sitemap from a
build with --site-dir and keep --robots on the file in your repo:
args: [--robots, public/robots.txt, dist/sitemap-index.xml, --site-dir, dist]
The pages then come from your last build, and the robots.txt you are committing is the one tested.
Anything that runs a shell command and reads its exit code works, with Node 20 or later:
npm run build
npx --yes answer-crawler-check@0.1.2 dist/sitemap-index.xml --site-dir dist
| Code | Meaning |
|---|---|
| 0 | Every crawler can fetch every URL. |
| 1 | A crawler is blocked, a sitemap or robots file couldn’t be read, or there were no URLs to check. The report lists each problem. A crash also gives 1. |
| 2 | The command line was wrong, so nothing was checked. |
The README has the scheduled jobs in full and a shell step that tells codes 1 and 2 apart.
The repo’s CI runs the RFC 9309 test vectors against this tool’s matcher on every push. Its README shows the count as a badge like this one. The cases it misses are the known differences the vectors page lists. The same page has the script, so any robots.txt parser can show its own count.
robots.txt is one of several ways to turn a crawler away. A firewall rule, a bot
challenge or a noindex header can block a crawler this tool calls allowed. Our
free instant audit reads the HTML a crawler receives
for one page.
anthropic-ai and the tokens each vendor documents today