llms.txt 完整說明:範例、驗證方式與誰會讀取

Piotr Grudzień
發布日期 閱讀時間約 31 分鐘
llms.txt 完整說明。左側是 quickchat.ai 的 llms.txt 開頭幾行,右側是 Quickchat AI Inbox 中的一段對話,其中一個自稱 Claude 的請求提出了問題。

llms.txt 是一項提議中的慣例:在 /llms.txt 放一個 Markdown 檔案,向 AI Agent 概述網站,並連到值得閱讀的頁面。 本指南說明這項提議的內容,提供可複製的檔案,展示 60 個知名網站在這個位址發布了什麼,並附上能驗證你自己檔案的腳本。接著我們會報告誰讀取了我們的檔案:有請求點了只有我們的 llms 檔案才有的連結,其中三個自稱 Claude。我們也會說明請 ChatGPT、Claude、Gemini 和 Perplexity 使用這個檔案時,它們的實際表現。 最後,它介紹讓 Agent 向網站的 AI Agent 提問、而不必再讀取更多檔案的那一行,Quickchat AI 的 AI assistant access 會為你準備好可以複製的這一行。

讀完後,你會得到三樣東西:位於 /llms.txt 的有效檔案、一次通過的驗證腳本執行結果,以及從你自己的存取紀錄統計出哪些使用者代理請求過這個檔案。螢幕截圖顯示的是英文介面。

三個面板。第一個是 Northwind Bikes 的 llms.txt 檔案開頭,包含標題、摘要和說明頁面的連結。第二個是終端機,check-llms-txt.mjs 回報 3 個區段、6 個連結、0 個錯誤、0 個警告和 PASS。第三個是終端機表格,統計各個自稱的代理的請求數,GPTBot、bingbot、ChatGPT-User、PerplexityBot 和 Claude-User 各至少請求過一次 llms 檔案

完成後的成果:檔案、通過的檢查,以及誰請求過它的統計。第三個面板使用套件中的範例紀錄。

下載 llms.txt 檢查套件。其中包含範例檔案、驗證腳本、十項檢查清單、紀錄腳本和範例紀錄。你需要一個可以新增檔案的網站、一個有 curl 的終端機,以及 Node.js 22 或更新版本。只有最後一步需要存取你的請求紀錄。

如果你已經有檔案,請直接前往驗證檔案。如果想先看證據,請閱讀誰請求了我們的檔案。

什麼是 llms.txt?

llms.txt 是一個 Markdown 檔案,為 AI Agent 提供網站的簡短摘要,以及可進一步查閱細節的精選連結清單。 Answer.AI 的 Jeremy Howard 於 2024 年 9 月 3 日在 llmstxt.org 發表這項提議,並在 2026 年 8 月修訂為第 2 版。它描述了兩件事:檔案本身,以及一項建議,也就是頁面應在可預測的位址提供自己乾淨的 Markdown 版本。

這個檔案是設計在回答問題的當下使用的。提議中說,它的資訊是在「Agent 協助使用者時需要某個主題的資訊,按需使用」,而且作者預期它主要對推論有用,而不是用於訓練。Agent 應該讀取或搜尋這個檔案,再點選與手上問題相符的連結。

llmstxt.org 的頁面頂端。標題為 The /llms.txt file, v2,說明這是一項標準化的提議,以 /llms.txt 檔案提供資訊,幫助 Agent 使用網站。作者 Jeremy Howard,發表於 2024 年 9 月 3 日,修改於 2026 年 8 月 10 日

提議本身的頁面,擷取於 2026 年 11 月 24 日。

llms.txt 是標準嗎?

llms.txt 是一項已發表的提議,沒有任何標準組織採用它。 是否要請求這個檔案,由各家 AI 廠商和各個工具自行決定。目前的支援主要在工具層面:文件平台會產生這個檔案,Chrome 的 Lighthouse 也有一項實驗性的稽核會尋找它。兩者都會在下文說明。

llms.txt 和 robots.txt、網站地圖有什麼不同?

robots.txt 說明爬蟲可以請求哪些網址,網站地圖列出所有供索引的網址,llms.txt 則是用 Markdown 寫成的簡短閱讀清單。 這三者不能互相取代。llms.txt 不授予也不拒絕任何權限,所以想控制 AI 爬蟲的網站,應該在 robots.txt 設定。

檔案它回答的問題格式quickchat.ai 於 2026 年 11 月 24 日發布的內容
robots.txt哪些爬蟲可以請求哪些路徑?純文字規則,RFC 9309全部允許,並為七個 AI 爬蟲權杖設有具名群組
網站地圖對搜尋引擎而言,有哪些網址存在?XML,網站地圖協定33 種語言共 3,545 個網址
llms.txt這個網站是什麼?Agent 應該先讀哪幾個頁面?Markdown291 個連結:290 個英文頁面的 Markdown 版本,以及文件索引

以瀏覽器顯示的 quickchat.ai 三個檔案。robots.txt 以一段註解和一個允許所有爬蟲的群組開頭。網站地圖是 XML,每個頁面一個 url 元素,每種語言一個連結。llms.txt 以標題、一行摘要和 Markdown 連結清單開頭

quickchat.ai 上各個檔案的開頭幾行。網站地圖以每行一個標籤的方式顯示。

llms-full.txt 和 llms-small.txt 是什麼?

llms-full.txt 是用一個檔案收錄網站所有頁面完整文字的慣例,llms-small.txt 則是較短的版本。 兩者都不屬於這項提議,而是來自文件工具:Mintlify 會為它託管的每個網站產生 llms.txt 和 llms-full.txt,starlight-llms-txt 外掛程式則會產生全部三個。quickchat.ai 也發布這三個檔案。它的完整檔案包含部落格文章,精簡檔案則不包含。

完整文字檔案可能非常大。下方的調查測量了幾個。

步驟 1:llms.txt 檔案長什麼樣子?

實用的 llms.txt 包含一個寫明網站名稱的 H1、引用區塊中的摘要、可選的說明文字,以及數個 H2 區段,每個區段都是附有說明的連結清單。 這是套件中的範例檔案。Northwind Bikes 是一家虛構的商店,使用保留的範例網域。

# Northwind Bikes

> Northwind Bikes sells city bikes and e-bikes online and from one store in Springfield. The pages below cover returns, shipping, warranty, sizing, servicing and store hours.

Every link below points to the Markdown version of a page. Remove .md from the URL for the HTML version. Prices are in USD.

## Help pages

- [Returns and exchanges](https://northwind-bikes.example.com/help/returns.md): Return windows, fees and how refunds are issued
- [Shipping and delivery](https://northwind-bikes.example.com/help/shipping.md): Costs, delivery times and where we ship
- [Warranty](https://northwind-bikes.example.com/help/warranty.md): What the frame, component and battery warranties cover
- [Bike sizing and fitting](https://northwind-bikes.example.com/help/sizing.md): Frame size by rider height

## Store

- [Store hours and test rides](https://northwind-bikes.example.com/stores/springfield.md): Opening hours, test rides and in-store pickup

## Optional

- [Servicing and repairs](https://northwind-bikes.example.com/service.md): Tune-up prices and turnaround times

複製它,替換名稱和摘要,再列出你自己的頁面。提議中說,檔案「小到能放進上下文」,而「細節則在連結後面,只在需要時才取得」。

範例檔案的五個編號部分圖解。1,寫明網站名稱的 H1,這是唯一必要的部分。2,引用區塊中的摘要。3,沒有標題的說明文字。4,檔案清單:H2 區段,清單項目為名稱和網址,後面可接冒號和說明。5,名為 Optional 的區段,放次要連結

範例檔案的圖解。這五個部分的順序由提議規定。

llms.txt 的哪些部分是必要的?

只有 H1 是必要的。 其他部分都是選用,但順序是固定的:先是 H1,然後是引用區塊,接著是沒有標題的說明文字,最後是 H2 區段。在 H2 區段內,每個清單項目都是一個 Markdown 連結,後面可以接冒號和說明。提議把這稱為「可供固定處理方法使用的精確格式」,這也是腳本能檢查這個檔案的原因。

連結應該指向哪些頁面?

連結到 Agent 回答網站相關問題時需要的頁面,而且有 Markdown 版本的頁面,就指向該版本。 提議建議把這個版本放在頁面自己的網址後面加上 .md 的位置,所以 /pricing 變成 /pricing.md,沒有檔名的網址則變成 index.md。請保持清單精簡,因為網站地圖已經列出了所有頁面。

也可以連到其他網站。提議自己的範例就連到 GitHub 上的一個參考頁面。

Optional 區段是什麼意思?

名為 Optional 的區段放次要連結,Agent 需要較短的上下文時可以略過。 在提議的第 1 版中,有一個配套工具會用這個名稱決定要省略什麼。第 2 版移除了那個工具,所以這個名稱現在只是一種慣例,沒有機械式的含義。

知名網站的 llms.txt 檔案長什麼樣子?

我們在 2026 年 11 月 24 日請求了 60 個知名網站,其中 33 個在 /llms.txt 回傳文字檔案,而這 33 個之中有 6 個完全遵循提議的格式,沒有任何檢查結果。 樣本是六個類別各十個網站,在取得資料前就已選定。它不是網路的隨機樣本,而且每個網站都只從一台機器、在一天內請求過一次。

60 個網站對 /llms.txt 回傳內容的堆疊長條圖,每組十個網站。AI 開發者文件:9 個有檔案,1 個沒有。開發者平台:7 個有檔案,1 個是沒有 H1 的文字檔案,2 個沒有。SaaS 和客服工具:7 個有檔案,1 個沒有 H1,1 個沒有,1 個被封鎖。框架與開源:5 個有檔案,5 個沒有。AI 實驗室主網站:2 個有檔案,7 個沒有,1 個被封鎖。消費、電商和媒體:1 個有檔案,6 個沒有,3 個被封鎖

31 個檔案以 H1 開頭,2 個是沒有 H1 的文字檔案,22 個網站回傳 404,5 個封鎖或以驗證頁面攔下我們的兩個用戶端。

各組差異很大。十個 AI 開發者文件網站中,有九個發布了檔案,包括 OpenAI、Anthropic、Google 的 Gemini API、Mistral、Cohere、xAI 和 Perplexity 的文件。AI 公司的主網站則大多沒有:10 個中有 7 個回傳 404。在十個消費、電商和媒體網站中,只有 Shopify 有檔案。有五個網站對我們的兩個用戶端都回應封鎖或驗證頁面,所以我們無法判斷它們是否發布了檔案。

已發布的檔案形式差異很大。OpenAI 和 Shopify 的遵循格式,Intercom 的大部分是散文,Twilio 的則沒有標題就開始。

四個已發布 llms.txt 檔案的開頭幾行。developers.openai.com:標題、摘要和 Documentation sets 清單。shopify.com:標題、附有連結的摘要和 Start a Business 區段。intercom.com:標題、摘要和數段散文。twilio.com:檔案以清單項目開頭,沒有標題

每個面板都是以瀏覽器顯示的檔案頂端。面板下方的註記來自驗證腳本。
檔案大小連結數值得注意的地方
developers.openai.com/llms.txt2 KB41索引的索引:大多數連結指向另一個 llms.txt,每項產品一個
docs.anthropic.com/llms.txt12 KB958會重新導向到另一個主機。列出文件的每一個頁面
developers.cloudflare.com/llms.txt5 KB111每項產品一個連結,各自指向該產品自己的檔案
docs.stripe.com/llms.txt99 KB475在第一個區段前,先有給程式開發 Agent 的說明
docs.github.com/llms.txt10 KB117告訴 Agent 該呼叫哪個 API 來取得頁面清單和文章內容
docs.cohere.com/llms.txt300 位元組2兩個連到各版本檔案的連結,並註明任何區段網址都有自己的 llms.txt
shopify.com/llms.txt5 KB71這是電商網站,不是文件。沒有任何檢查結果
twilio.com/llms.txt2.5 MB10,018調查中最大的索引,而且第一行是清單項目

結構檢查在 33 個檔案中的 27 個發現了問題。

33 個已發布檔案的結構檢查結果長條圖。H2 區段內沒有連結的清單項目:12 個檔案。H3 或更深的標題:10 個。說明不是以冒號加說明的形式寫成:10 個。同一個網址列出兩次:10 個。沒有引用區塊摘要:7 個。不在任何 H2 區段內的連結:5 個。沒有清單的 H2 區段:4 個。不是絕對 https 網址的連結:4 個。以路徑或網址作為連結文字:2 個

沒有任何檢查結果的六個檔案:OpenAI developers、Mistral docs、Cohere docs、Cloudflare docs、GitHub docs 和 Shopify。

這些偏差都不會讓模型無法讀取檔案,因為模型不論如何都讀得懂 Markdown。它們影響的是解析這種格式的軟體。遵循提議的解析器會略過沒有連結的項目,也不預期出現 H3。Twilio 和 Salesforce 這兩個頂端沒有 H1 的檔案,是腳本唯一直接判定失敗的。

完整文字檔案有多大?

33 個網站中有 17 個也提供 llms-full.txt,其中最大的幾個大到 Agent 無法在一次請求中讀完。 Cloudflare 的檔案有 11.9 MB,以每個 token 四個位元組計算,約 300 萬個 token。調查中的三個檔案都超過一百萬個 token。

llms-full.txt 大小的長條圖,單位為大約的 token 數。Cloudflare docs 298 萬,Anthropic docs 157 萬,LangChain docs 102 萬,OpenAI developers 61.8 萬,Gemini API docs 44.1 萬,Supabase 40.2 萬,Mistral docs 27.6 萬,Perplexity docs 21.9 萬,Model Context Protocol 18 萬,xAI docs 13.5 萬。一條垂直線標示一百萬個 token

至少 100,000 個 token 的完整文字檔案。有了索引,Agent 就能只取得它需要的頁面。

步驟 2:如何在自己的網站發布 llms.txt?

以 text/plain 或 text/markdown 搭配 charset=utf-8,在 /llms.txt 提供這個檔案。如果網站有建置步驟,請根據你已發布的頁面來產生它。

  1. 將檔案儲存為 llms.txt,放在網站根目錄所使用的資料夾。在多數靜態網站產生器中,這個資料夾是 public/。
  2. 部署後,用非瀏覽器的用戶端請求這個檔案:
curl -sS -o /dev/null -w '%{http_code} %{content_type} %{size_download} bytes\n' https://example.com/llms.txt
  1. 閱讀結果。你要看到的是 200、文字類型的內容類型,以及和你的檔案相符的大小。如果是 text/html,表示伺服器回傳的是網頁,不是你的檔案。
  2. 你也可以選擇告訴用戶端檔案在哪裡。提議的第 2 版建議使用兩個標準的連結關係,以 <link> 元素放在每個頁面的 <head> 中,或放在 HTTP Link 標頭中:
<link rel="describedby" href="/llms.txt">
<link rel="alternate" type="text/markdown" href="/pricing.md">

第一個從任何頁面指向涵蓋它的 llms.txt。第二個從頁面指向它自己的 Markdown 版本。

檔案也可以放在子路徑。/docs/llms.txt 涵蓋 /docs/ 底下的頁面,而當有多個檔案適用時,提議說 Agent 應使用最具體的那一個。

手寫的檔案適合只有少數連結的情況。頁面移動或改名時,它就會過時,所以要不是指定負責人,就是用程式產生。

quickchat.ai 如何產生它的 llms.txt?

quickchat.ai 在建置網站時,根據同一批以 HTML 提供的頁面,產生 /llms.txt、/llms-full.txt 和 /llms-small.txt,所以頁面一變,檔案就跟著變。 沒有人手動編輯。

五個建置步驟的圖解。1,建置完成的頁面:搜尋引擎可以索引的每個英文頁面。2,Markdown 版本:每個頁面的主要內容,儲存在它旁邊並加上 .md,共 290 個檔案。3,三個 llms 檔案:llms.txt 列出這些版本,llms-full.txt 和 llms-small.txt 收錄它們的文字。4,建置檢查:缺少版本、連結重複或內容類型錯誤時就會失敗。5,部署:索引以 text/plain 提供,各版本以 text/markdown 提供,兩者皆為 UTF-8

建置流程的圖解。這些檔案是建置網站時的副產品。

建置的運作方式如下:

  • 搜尋引擎可以索引的每個英文頁面,都有一個 Markdown 版本,位於同一個網址後面加上 .md。部落格文章直接從它的 Markdown 原始檔複製。其他頁面則從建置好的 HTML 轉換:保留主要內容,移除指令碼、樣式和裝飾性圖形,將連結和圖片網址改為絕對網址,保留頁面內的錨點,並加上含標題、描述和來源網址的前置資料。
  • 有些內容是刻意省略的。 翻譯過的頁面、noindex 頁面和工具性頁面不會有 Markdown 版本。產品頁面上純裝飾用的示範對話會被標記為略過,因為編造的範例資料不該當作頁面內容發布。
  • 每個頁面都會宣告自己的 Markdown 版本,方式是在頁面的 head 中加上 <link rel="alternate" type="text/markdown">。
  • 轉換失敗時,建置就會失敗,所以索引不會悄悄遺失任何頁面。

瀏覽器中的 quickchat.ai/llms.txt。標題為 Quickchat AI。摘要為 AI-readable Markdown versions of English content pages on quickchat.ai。一個連到文件索引的連結。接著每個頁面一個連結,連結文字是該頁面的路徑,目標是 .md 位址

2026 年 11 月 24 日產生的索引。

同一個頁面的兩種檢視。左邊是訪客看到的 quickchat.ai/pricing,有標題 Transparent pricing for every growth stage 和 Free 方案卡片。右邊是 quickchat.ai/pricing.md:含標題、描述和來源的前置資料,接著是以 Markdown 呈現的相同標題、文字和方案細節

定價頁面和它的 Markdown 版本。前置資料中的來源行,就是左邊頁面的網址。

文件是另一個使用 starlight-llms-txt 外掛程式的 Starlight 建置。每個文件頁面還有一個選單,可以將該頁面開啟為 Markdown,或開啟完整文字檔案。

Quickchat AI 文件的 Quickstart 頁面,Copy Page 選單已展開。選項有 View as Markdown、View llms-full.txt、Ask our AI、Open in ChatGPT、Open in Claude 和 Open in Gemini

quickchat.ai/docs 上的頁面選單。前兩個選項是該頁面的 Markdown 版本和完整文字檔案。

如果你的網站沒有建置步驟,llmstxt.org 上的整合清單列出了多個平台的產生器,其中包括 VitePress、Docusaurus、Drupal 和 WordPress 的外掛程式。

步驟 3:如何驗證 llms.txt 檔案?

驗證 llms.txt 檔案,就是檢查四件事:它是否正確提供、結構是否遵循提議、每個連結是否都能開啟,以及它列出的是否是你想公開的頁面。 本指南提供一份檢查清單和一支由你自己執行的腳本。腳本會執行前三項檢查,它不是線上檢查工具。

如何手動檢查 llms.txt?

四個 curl 指令涵蓋了檔案的提供方式。 請將 SITE 設為你自己的位址。

SITE=https://example.com

# Status, content type and size
curl -sS -o /dev/null -w '%{http_code} %{content_type} %{size_download} bytes\n' "$SITE/llms.txt"

# First lines: expect "# Site name", not HTML
curl -s "$SITE/llms.txt" | head -n 3

# A client that is not a browser gets the same answer
curl -sS -A 'llms-txt-check/1.0' -o /dev/null -w '%{http_code}\n' "$SITE/llms.txt"

# Response headers of one linked Markdown file
curl -sSI "$SITE/pricing.md" | grep -i -E '^(HTTP|content-type|cache-control)'

終端機對 quickchat.ai 執行四個 curl 指令。第一個印出 200 text/plain; charset=utf-8 27866 bytes。第二個印出檔案的標題和摘要。第三個對使用一般使用者代理的請求印出 200。第四個對 pricing.md 印出 HTTP/2 200、content-type text/markdown; charset=utf-8 和 cache-control 標頭

2026 年 11 月 24 日對 quickchat.ai 執行的四個指令。

完整的檢查清單有十點,列在下方,也收錄在套件的 checklist.md。前六點可以用指令檢查。上面的四個指令涵蓋了檔案的提供方式,其餘兩點的指令在 checklist.md 中。

  1. 已提供。 /llms.txt 在它所描述的主機上回傳 HTTP 200,內容類型為 text/plain 或 text/markdown,並加上 charset=utf-8。
  2. 不是備援頁面。 內容以 # 開頭,而且不是 HTML。
  3. 非瀏覽器的用戶端也能取得。 使用一般使用者代理的請求會得到相同的回應,而且沒有任何機器人規則以驗證頁面回應它。
  4. 沒有被封鎖。 robots.txt 沒有禁止這個路徑,而且你想觸及的爬蟲也沒有被禁止存取網站。
  5. 連結。 每個連結都回傳 200。沒有任何網址出現兩次。
  6. 可讀的目標。 連結在有版本的情況下指向 Markdown 或純文字,而且這些目標以文字類型的內容類型提供。
  7. 結構。 第一個是一個 H1,接著是引用區塊中的摘要,然後是 H2 區段,每個區段都有 [name](url): note 項目的清單。
  8. 名稱與涵蓋範圍。 連結文字是讀者看得懂的頁面名稱。清單包含你想讓人讀到的頁面,沒有 noindex、私人或過時的頁面。
  9. 負責人。 檔案由建置流程產生,或有指定的負責人和檢閱日期。
  10. 大小。 索引小到能在一次請求中讀完,而且你知道任何完整文字檔案的位元組大小。

如何用腳本檢查 llms.txt?

check-llms-txt.mjs 用一個指令執行提供方式、結構和連結的檢查,發現錯誤時以非零狀態結束。 它需要 Node.js 22 或更新版本,沒有任何相依套件。

node check-llms-txt.mjs llms.txt                        # a local file: structure checks only, no network
node check-llms-txt.mjs https://example.com/llms.txt    # a live file: delivery, structure and links

每個檢查結果都有等級、檢查 ID,以及適用的行號:

檢查涵蓋內容依據
D1 到 D7提供方式:狀態、重新導向、內容類型、字元集、HTML 內容、大小、robots.txtHTTP 和 RFC 9309
S1 到 S9結構:H1、摘要、標題深度、清單項目、說明、重複、連結文字提議,加上三項編輯上的檢查
L1 到 L4連結:每個連結都回傳 200,而且 Markdown 連結以文字形式提供HTTP
X1 到 X3相鄰項目:llms-full.txt、網站地圖的網址數量、第 2 版的兩個連結關係僅作為資訊回報

錯誤表示檔案沒有被提供、不是 Markdown、缺少 H1,或連到無法載入的內容。警告則是偏離提議格式,或可能是錯誤。套件的 README.md 列出了每項檢查的等級。

請以迴圈的方式進行:執行腳本,閱讀結果,改一處,再執行一次。套件中有一份含七個典型錯誤的初稿,可以拿來練習:

Welcome to Northwind Bikes

## Help pages

- Returns and exchanges
- [Shipping and delivery](https://northwind-bikes.example.com/help/shipping.md)
- [Shipping again](https://northwind-bikes.example.com/help/shipping.md)
- [Warranty](/help/warranty.md) - what the warranties cover

### Sizing

check-llms-txt.mjs 的兩次終端機執行。初稿產生一個錯誤,即第一個非空白行不是 H1,以及六個警告,內容是缺少摘要、標題比 H2 更深、清單項目沒有連結、說明不是冒號形式、網址不是絕對網址和網址重複,最後是 FAIL,結束狀態為 1。修正後的檔案印出 3 個區段、6 個連結、0 個錯誤、0 個警告、PASS,結束狀態為 0

初稿因七個問題而失敗。步驟 1 的範例檔案修正了這七個問題,並補上缺少的部分。
檢查結果行號修正方式
S1:第一個非空白行不是 H11讓檔案以 # Northwind Bikes 開頭
S2:沒有引用區塊摘要1加上一行以 > 開頭、說明網站是什麼的文字
S4:清單項目沒有連結5將 Returns and exchanges 改成 [Returns and exchanges](url)
S7:網址重複7移除第二個連到運送頁面的連結
S4:連結後的文字不是說明8將 - what the warranties cover 換成 : What the warranties cover
S6:網址不是絕對網址8寫出完整的 https:// 位址
S3:標題比 H2 更深10改成帶有清單的 H2,或移除它

腳本還能抓到單純檢查狀態碼會漏掉的情況。許多網站對每個未知路徑都回應一個頁面,有些還使用狀態碼 200。遇到這樣的回應時,腳本會回報 Content-Type is text/html 和 body is HTML, not Markdown,並判定失敗。

複製完整的驗證腳本
#!/usr/bin/env node
// check-llms-txt.mjs 1.0: checks one llms.txt file. Node.js 22 or later, no dependencies.
//
//   node check-llms-txt.mjs https://example.com/llms.txt     delivery, structure and link checks
//   node check-llms-txt.mjs ./llms.txt                       structure checks only, no network
//
// Options: --strict (warnings fail too), --json, --no-links, --max-links=500
// Exit status: 0 no errors, 1 errors (or warnings with --strict), 2 usage error.
//
// Structure rules follow the llms.txt proposal, v2 (https://llmstxt.org/). Checks marked
// "editorial" in the README are this script's own opinion and are never errors.
import { readFile } from 'node:fs/promises';

const USER_AGENT = 'check-llms-txt/1.0 (+https://quickchat.ai/post/llms-txt-explained)';
const AI_TOKENS = ['GPTBot', 'OAI-SearchBot', 'ChatGPT-User', 'ClaudeBot', 'Claude-User', 'Claude-SearchBot', 'PerplexityBot', 'Perplexity-User', 'Google-Extended', 'Applebot-Extended', 'CCBot'];
const INDEX_WARN_BYTES = 100_000;
const TIMEOUT_MS = 10_000;
const CONCURRENCY = 5;

const args = process.argv.slice(2);
const target = args.find((a) => !a.startsWith('--'));
const flag = (name) => args.includes(`--${name}`);
const maxLinks = Number((args.find((a) => a.startsWith('--max-links=')) ?? '=500').split('=')[1]);
if (!target || !Number.isInteger(maxLinks) || maxLinks < 0) {
  console.error('usage: node check-llms-txt.mjs <https-url-or-path> [--strict] [--json] [--no-links] [--max-links=500]');
  process.exit(2);
}

const findings = [];
let sitemapUrl = null; // the first Sitemap line in robots.txt, when there is one
const add = (level, id, message, line) => findings.push({ level, id, message, line });
const isUrl = /^https?:\/\//i.test(target);
const number = (n) => n.toLocaleString('en-US');

async function request(url, { method = 'GET', redirect = 'follow', maxBytes = 5_000_000, timeout = TIMEOUT_MS } = {}) {
  const response = await fetch(url, { method, redirect, headers: { 'user-agent': USER_AGENT, accept: 'text/markdown, text/plain, */*' }, signal: AbortSignal.timeout(timeout) });
  const chunks = [];
  let size = 0;
  let truncated = false;
  if (method !== 'HEAD' && response.body) {
    for await (const chunk of response.body) {
      size += chunk.length;
      if (size <= maxBytes) chunks.push(chunk);
      else truncated = true;
    }
  }
  return { status: response.status, headers: response.headers, body: Buffer.concat(chunks), size, truncated, url: response.url };
}
const tryRequest = (url, options) => request(url, options).catch((error) => ({ failed: error.name === 'TimeoutError' ? 'timed out' : error.cause?.code ?? error.message }));
const mediaType = (headers) => (headers.get('content-type') ?? '').split(';')[0].trim().toLowerCase();
const looksLikeHtml = (text) => /^\s*<(!doctype html|html)\b/i.test(text);

// ---- Delivery (URL mode only): D1 to D7 ----
let text;
let fileUrl = null;
if (isUrl) {
  let url = target;
  let response;
  let hops = 0;
  for (;;) {
    response = await tryRequest(url, { redirect: 'manual' });
    if (response.failed || response.status < 300 || response.status > 399 || !response.headers.get('location')) break;
    if (++hops > 3) break;
    url = new URL(response.headers.get('location'), url).href;
  }
  if (response.failed) {
    add('error', 'D1', `request failed: ${response.failed}`);
  } else if (hops > 3) {
    add('error', 'D1', 'more than three redirects');
  } else if (response.status !== 200) {
    add('error', 'D1', `HTTP ${response.status}${hops ? ` after ${hops} redirect(s), at ${url}` : ''}`);
  } else {
    fileUrl = new URL(url);
    if (hops) add(fileUrl.host === new URL(target).host ? 'info' : 'warn', 'D1', `redirected ${hops} time(s) to ${url}`);
    const type = mediaType(response.headers);
    const charset = /charset=([^;\s]+)/i.exec(response.headers.get('content-type') ?? '')?.[1]?.replace(/"/g, '').toLowerCase();
    if (type === 'text/html') add('error', 'D2', 'Content-Type is text/html');
    else if (type !== 'text/plain' && type !== 'text/markdown') add('warn', 'D2', `Content-Type is ${type || 'missing'}, expected text/plain or text/markdown`);
    if (type !== 'text/html' && charset !== 'utf-8') add('warn', 'D2', charset ? `charset is ${charset}, expected utf-8` : 'Content-Type has no charset, add charset=utf-8');
    try {
      text = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(response.body);
    } catch {
      add('warn', 'D4', 'body is not valid UTF-8');
      text = new TextDecoder('utf-8', { ignoreBOM: true }).decode(response.body);
    }
    const bytes = response.size;
    const large = bytes > INDEX_WARN_BYTES && type !== 'text/html';
    add(large ? 'warn' : 'info', 'D5', `${number(bytes)} bytes, about ${number(Math.round(bytes / 4))} tokens${large ? ' (editorial: over 100,000 bytes is large for an index)' : ''}`);
    const shown = ['cache-control', 'content-encoding', 'last-modified', 'etag', 'x-robots-tag'].filter((h) => response.headers.get(h)).map((h) => `${h}: ${response.headers.get(h)}`);
    add('info', 'D7', `${type || 'no content type'}${charset ? `; charset=${charset}` : ''}${shown.length ? ` | ${shown.join(' | ')}` : ''}`);
    await checkRobots(fileUrl);
  }
} else {
  text = await readFile(target, 'utf8').catch(() => null);
  if (text === null) {
    console.error(`cannot read ${target}`);
    process.exit(2);
  }
}

// RFC 9309: the most specific matching rule wins, and Allow wins a tie.
function robotsVerdict(robots, agent, path) {
  const groups = [];
  let current = null;
  let lastWasAgent = false;
  for (const raw of robots.split(/\r?\n/)) {
    const match = /^\s*(user-agent|allow|disallow)\s*:\s*(.*?)\s*(?:#.*)?$/i.exec(raw);
    if (!match) continue;
    const key = match[1].toLowerCase();
    const value = match[2];
    if (key === 'user-agent') {
      if (!lastWasAgent) groups.push((current = { agents: [], rules: [] }));
      current.agents.push(value.toLowerCase());
      lastWasAgent = true;
    } else if (current) {
      current.rules.push({ allow: key === 'allow', pattern: value });
      lastWasAgent = false;
    }
  }
  const mine = groups.filter((g) => g.agents.includes(agent.toLowerCase()));
  const rules = (mine.length ? mine : groups.filter((g) => g.agents.includes('*'))).flatMap((g) => g.rules);
  let best = null;
  for (const rule of rules) {
    if (rule.pattern === '') continue;
    const source = rule.pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*').replace(/\\\$$/, '$');
    if (!new RegExp(`^${source}`).test(path)) continue;
    if (!best || rule.pattern.length > best.pattern.length || (rule.pattern.length === best.pattern.length && rule.allow)) best = rule;
  }
  return { blocked: Boolean(best && !best.allow), named: mine.length > 0 };
}

async function checkRobots(url) {
  const robots = await tryRequest(new URL('/robots.txt', url).href);
  if (robots.failed || robots.status !== 200) return add('info', 'D6', `no robots.txt on ${url.host} (${robots.failed ?? `HTTP ${robots.status}`})`);
  const body = new TextDecoder().decode(robots.body);
  if (looksLikeHtml(body)) return add('info', 'D6', 'robots.txt returns an HTML page');
  sitemapUrl = /^\s*sitemap\s*:\s*(\S+)/im.exec(body)?.[1] ?? null;
  if (robotsVerdict(body, '*', url.pathname).blocked) add('warn', 'D6', `robots.txt disallows ${url.pathname} for every crawler`);
  const blocked = AI_TOKENS.filter((token) => { const v = robotsVerdict(body, token, '/'); return v.named && v.blocked; });
  add('info', 'D6', blocked.length ? `robots.txt disallows the whole site for: ${blocked.join(', ')}` : 'robots.txt allows the file and blocks none of the AI crawler tokens this script knows');
}

// ---- Structure (both modes): D3, D4, S1 to S9 ----
const sections = [];
const links = [];
if (text !== undefined) {
  const BOM = String.fromCharCode(0xfeff);
  if (text.startsWith(BOM)) add('info', 'D4', 'file starts with a byte order mark, which the proposal allows', 1);
  if (looksLikeHtml(text)) add('error', 'D3', 'body is HTML, not Markdown', 1);
  const firstSeen = new Map();
  const h1 = [];
  let first = null;
  let quote = null;
  let section = null;
  let fenced = false;
  (text.startsWith(BOM) ? text.slice(1) : text).split(/\r?\n/).forEach((raw, index) => {
    const n = index + 1;
    const line = raw.trimEnd();
    if (/^\s*(```|~~~)/.test(line)) { fenced = !fenced; return; }
    if (fenced || line.trim() === '') return;
    first ??= { n, line };
    const heading = /^(#{1,6})\s+(.+)$/.exec(line);
    if (heading) {
      const depth = heading[1].length;
      if (depth === 1) h1.push(n);
      else if (depth === 2) sections.push((section = { name: heading[2].trim(), line: n, items: 0 }));
      else add('warn', 'S3', 'heading deeper than H2', n);
      return;
    }
    if (quote === null && /^>\s?\S/.test(line)) quote = n;
    const item = /^\s*[-*+]\s+(.*)$/.exec(line);
    if (!item) return;
    if (section) section.items += 1;
    const link = /^\[([^\]]*)\]\(([^)\s]+)\)(.*)$/.exec(item[1]);
    if (!link) {
      if (section) add('warn', 'S4', 'list item in an H2 section has no [name](url) link', n);
      return;
    }
    const [, label, url, rest] = link;
    const hasNotes = /^:\s*\S/.test(rest);
    links.push({ url, hasNotes, line: n });
    if (rest.trim() !== '' && !hasNotes) add('warn', 'S4', 'text after the link is not in the ": notes" form', n);
    if (!section) add('warn', 'S5', 'link is outside any H2 section', n);
    if (!/^https:\/\//i.test(url)) add('warn', 'S6', 'URL is not an absolute https URL', n);
    if (firstSeen.has(url)) add('warn', 'S7', 'duplicate URL', n); else firstSeen.set(url, n);
    const name = label.trim();
    if (name === '' || name === url || /^\/\S*$/.test(name) || /^https?:\/\//i.test(name)) add('warn', 'S8', 'link text is a path or URL, not a name (editorial)', n);
  });
  if (!first || !/^#\s+\S/.test(first.line)) add('error', 'S1', 'first non-blank line is not an H1', first ? first.n : 1);
  if (h1.length > 1) add('error', 'S1', 'more than one H1', h1[1]);
  if (quote === null || (sections.length > 0 && quote > sections[0].line)) add('warn', 'S2', 'no blockquote summary between the H1 and the first H2', h1[0] ?? 1);
  for (const s of sections) if (s.items === 0) add('warn', 'S4', 'H2 section has no list', s.line);
  const optional = sections.filter((s) => s.name.toLowerCase() === 'optional');
  if (optional.length > 1) add('warn', 'S9', 'more than one Optional section', optional[1].line);
  if (optional.length === 1 && sections.at(-1) !== optional[0]) add('info', 'S9', 'Optional is not the last section', optional[0].line);
}

// ---- Links and neighbours (URL mode only): L1 to L4, X1 to X3 ----
async function pool(items, worker) {
  const queue = [...items];
  await Promise.all(Array.from({ length: CONCURRENCY }, async () => { while (queue.length) await worker(queue.shift()); }));
}

const notAFile = findings.some((f) => f.level === 'error' && (f.id === 'D2' || f.id === 'D3'));
if (fileUrl && text !== undefined && !notAFile) {
  const unique = [...new Map(links.map((l) => [new URL(l.url, fileUrl).href, l.line])).entries()];
  const sameHost = unique.filter(([href]) => new URL(href).host === fileUrl.host);
  add('info', 'L3', `${number(unique.length - sameHost.length)} of ${number(unique.length)} links point to other hosts`);
  if (!flag('no-links') && unique.length) {
    const checked = unique.slice(0, maxLinks);
    let markdown = 0;
    await pool(checked, async ([href, line]) => {
      let response = await tryRequest(href, { method: 'HEAD' });
      if (response.failed || response.status !== 200 || !response.headers.get('content-type')) response = await tryRequest(href);
      if (response.failed) return add('error', 'L1', `link failed (${response.failed}): ${href}`, line);
      if (response.status !== 200) return add('error', 'L1', `link returns HTTP ${response.status}: ${href}`, line);
      const type = mediaType(response.headers);
      const isText = type === 'text/markdown' || type === 'text/plain';
      if (isText) markdown += 1;
      if (/\.(md|mdx|txt)$/i.test(new URL(href).pathname) && !isText) add('warn', 'L2', `link ends in .md or .txt but is served as ${type || 'an unknown type'}: ${href}`, line);
    });
    add('info', 'L4', `${number(markdown)} of ${number(checked.length)} checked links return Markdown or plain text${unique.length > checked.length ? ` (stopped after ${number(maxLinks)} links)` : ''}`);
  }
  const full = await tryRequest(new URL('llms-full.txt', fileUrl).href, { maxBytes: 4096, timeout: 60_000 });
  if (!full.failed && full.status === 200 && !looksLikeHtml(new TextDecoder().decode(full.body))) add('info', 'X1', `llms-full.txt exists beside the index: ${mediaType(full.headers)}, ${number(full.size)} bytes, about ${number(Math.round(full.size / 4))} tokens`);
  else add('info', 'X1', 'no llms-full.txt beside the index');
  const big = { maxBytes: 60_000_000, timeout: 30_000 };
  const sitemap = await tryRequest(sitemapUrl ?? new URL('/sitemap.xml', fileUrl).href, big);
  if (!sitemap.failed && sitemap.status === 200) {
    const locs = (xml) => [...xml.matchAll(/<loc>\s*([^<\s]+)\s*<\/loc>/g)].map((m) => m[1]);
    const xml = new TextDecoder().decode(sitemap.body);
    let urls = locs(xml).length;
    let note = '';
    if (/<sitemapindex/i.test(xml)) {
      const children = locs(xml);
      urls = 0;
      await pool(children.slice(0, 20), async (child) => {
        const part = await tryRequest(child, big);
        if (!part.failed && part.status === 200) urls += locs(new TextDecoder().decode(part.body)).length;
      });
      note = ` in ${number(Math.min(children.length, 20))} of ${number(children.length)} child sitemap(s)`;
    }
    add('info', 'X2', `the sitemap lists ${number(urls)} URLs${note}; the file lists ${number(unique.length)} links`);
  }
  const home = await tryRequest(new URL('.', fileUrl).href);
  if (!home.failed && home.status === 200) {
    const html = new TextDecoder().decode(home.body);
    const tags = html.match(/<link\b[^>]*>/gi) ?? [];
    const header = home.headers.get('link') ?? '';
    const describedBy = /rel="?describedby"?/i.test(header) || tags.some((t) => /rel=["']?describedby/i.test(t) && /llms\.txt/i.test(t));
    const alternate = /type="?text\/markdown/i.test(header) || tags.some((t) => /rel=["']?alternate/i.test(t) && /text\/markdown/i.test(t));
    add('info', 'X3', `${new URL('.', fileUrl).pathname} ${describedBy ? 'advertises' : 'does not advertise'} the file with rel="describedby" and ${alternate ? 'links' : 'does not link'} a Markdown version of itself with rel="alternate"`);
  }
}

// ---- Report ----
const count = (level) => findings.filter((f) => f.level === level).length;
const summary = { sections: sections.length, links: links.length, linksWithNotes: links.filter((l) => l.hasNotes).length, errors: count('error'), warnings: count('warn') };
const failed = summary.errors > 0 || (flag('strict') && summary.warnings > 0);
const out = [];
if (flag('json')) {
  out.push(JSON.stringify({ target, summary, findings }, null, 2));
} else {
  const groups = new Map();
  for (const f of findings) {
    const key = `${f.level}\t${f.id}\t${/^link (failed|returns|ends)/.test(f.message) ? f.message.replace(/: \S+$/, '') : f.message}`;
    groups.set(key, [...(groups.get(key) ?? []), f]);
  }
  const order = { error: 0, warn: 1, info: 2 };
  const family = { D: 0, S: 1, L: 2, X: 3 };
  const rank = (key) => { const [level, id] = key.split('\t'); return order[level] * 1000 + family[id[0]] * 100 + Number(id.slice(1)); };
  for (const [key, group] of [...groups].sort((a, b) => rank(a[0]) - rank(b[0]))) {
    const [level, id, message] = key.split('\t');
    const lines = group.map((f) => f.line).filter((n) => n !== undefined).sort((a, b) => a - b);
    const where = lines.length ? ` (${lines.length === 1 ? 'line' : 'lines'} ${lines.slice(0, 3).join(', ')}${lines.length > 3 ? `, and ${number(lines.length - 3)} more` : ''})` : '';
    out.push(`${level.toUpperCase().padEnd(5)} ${id.padEnd(3)} ${message}${where}`);
    if (id.startsWith('L') && level !== 'info') for (const f of group.slice(0, 5)) out.push(`          ${f.message.split(': ').at(-1)}`);
  }
  out.push(`Sections: ${summary.sections}. Links: ${number(summary.links)} (${number(summary.linksWithNotes)} with notes). Errors: ${summary.errors}. Warnings: ${number(summary.warnings)}.`);
  out.push(failed ? 'FAIL' : summary.warnings ? 'PASS with warnings' : 'PASS');
}
// Exit only after the report is flushed, so piped output is never cut short.
process.stdout.write(`${out.join('\n')}\n`, () => process.exit(failed ? 1 : 0));

Chrome 有 llms.txt 驗證工具嗎?

Chrome 的 Lighthouse 有一項實驗性的 llms.txt 稽核,它只檢查一件事:伺服器對這個檔案是否回傳錯誤。 根據它的文件,當取得檔案造成伺服器錯誤時,Lighthouse 會標記頁面;當檔案不存在時,它會將稽核標示為 Not Applicable,因為「目前提供這個檔案是選用的」。它不檢查結構或連結。這項稽核屬於 Agentic Browsing 類別,需要 Chrome 150 或更新版本。

如何在每次部署時維持 llms.txt 有效?

在建置流程中執行檢查,讓缺少頁面、失效連結或錯誤的內容類型都能阻止部署。 腳本的結束狀態讓這件事只需要一行。加上 --strict 時,警告也會讓執行失敗:

node check-llms-txt.mjs https://staging.example.com/llms.txt --strict

步驟 4:AI 助理和爬蟲會讀取 llms.txt 嗎?

在我們 2026 年 11 月 24 日的測試中,助理只有在我們叫它們讀的時候才會讀取這個檔案,而且只有具備開啟網址工具的助理才做得到。 另外,在 2026 年 10 月 13 日至 11 月 23 日之間,有 13 個問題透過只存在於我們 llms 檔案中的一行送到我們的客服 Agent,其中三個來自自稱 Claude 的請求。

什麼點了只存在於我們 llms 檔案中的連結?

在 2026 年 11 月 23 日結束的一次試行期間,quickchat.ai/llms.txt 和 quickchat.ai/docs/llms.txt 各有一條 Ask 行:一個連到頁面的連結,由我們自己的客服 Agent 在那裡回答問題。 那一行寫的是 “Ask Quickchat AI a question:”,後面接著一個以 ?q=your+question 結尾的位址。這個位址帶有一個標籤,說明它來自哪個檔案,而且沒有任何 HTML 頁面使用這個標籤。因此,帶有這個標籤的請求,要不是讀過我們的某個 llms 檔案,就是由讀過的對象交給它這個連結。

2026 年 10 月 13 日至 11 月 23 日,這些行一共回答了 13 個問題:8 個透過文件索引,5 個透過行銷網站的檔案。

  • 3 個自稱 Claude。 它們的使用者代理包含 Claude-User/1.0; +claude-user@anthropic.com,這是 Anthropic 文件說明的、由使用者觸發的請求所用的名稱。第一個在 10 月 26 日透過行銷網站的那一行出現,問題是 “What is Quickchat AI?”。另外兩個在 11 月 7 日透過文件索引出現,兩次 Claude 都把 your+question 預留位置換成了它自己的字詞:“webhook when conversation ends transcript” 和 “pre-chat screen required fields email phone”。
  • 4 個來自 curl,6 個來自我們自己帶標籤的測試工具。
  • 另有 8 個請求開啟了連結但沒有帶問題,所以沒有產生回答。其中四個來自爬蟲和工具(OraBot、CrawlCheck、AgentDrivesAgent,以及一個宣告為 GoogleOther 的請求),四個宣告為一般的桌面瀏覽器。
  • 沒有任何一個宣告為 ChatGPT-User、Perplexity-User、GPTBot、ClaudeBot 或 Googlebot。

我們客服 Agent 的 Quickchat AI Inbox。清單中有兩段對話帶有機器人圖示和 Claude 的標誌。開啟的那段日期為 11 月 7 日星期六下午 5:52,問題是 webhook when conversation ends transcript,Agent 的回答指出 Custom API Action 可以將逐字稿傳送到 webhook

2026 年 11 月 7 日的兩個問題之一,顯示在我們自己的 Inbox。顯示的時間 5:52 PM 是華沙時間(UTC 16:52)。機器人圖示旁的標誌表示這個請求宣告為 Claude。其他訪客的預覽已經模糊處理。

11 月 7 日的兩個問題,讀起來像是助理寫出的搜尋查詢,而不像人類打出來的句子。我們看不到 Claude 那一端的對話,而且身分是由請求自己宣告的,並未經過驗證。三個問題顯示這條路徑行得通。它們不能證明助理普遍會讀取 llms.txt。

2026 年 10 月 13 日至 11 月 23 日期間,點了只存在於我們 llms 檔案中的連結的 21 個請求,依自稱的使用者代理分類的長條圖。我們自己帶標籤的測試工具:6 個已回答的問題。curl:4 個已回答的問題。一般瀏覽器使用者代理:4 個沒有問題的請求。爬蟲和工具 OraBot、CrawlCheck、AgentDrivesAgent 和 GoogleOther:4 個沒有問題的請求。自稱 Claude-User:3 個已回答的問題

使用這個連結的 26 個請求中的 21 個,依自稱的使用者代理分類。由快取回應的五個重複請求未列入。

11 月 23 日,這些行隨試行用的位址一起停用。自 11 月 28 日起,兩個檔案再次帶有指向我們客服 Agent 的 Ask 行,詳見下文。

這些統計只涵蓋點了某一個連結的請求,不含對檔案本身的請求,後者由 CDN 提供。下方的紀錄指令可在你自己的網站進行這項測量。

如何檢查你自己的紀錄?

在你自己的存取紀錄中,統計各個自稱的使用者代理對這個檔案的請求,並和同一批代理對一般頁面的請求對照。 對於 combined 格式的 nginx 或 Apache 紀錄,這一行指令會列出誰請求了 llms 檔案:

awk -F'"' '$2 ~ /^GET \/(docs\/)?llms(-full|-small)?\.txt([? ]|$)/ {print $6}' access.log | sort | uniq -c | sort -rn | head -30

套件中的 who-requests-llms.sh 會為每個代理印出一張表格,並排顯示 llms 檔案、Markdown 版本、一般頁面和 robots.txt。請先用範例紀錄試試:

sh who-requests-llms.sh sample-access.log
declared agent     llms  markdown   pages  robots
other                 6         0      15       0
GPTBot                2         0       5       2
bingbot               1         0       3       0
ChatGPT-User          1         1       2       0
PerplexityBot         1         2       2       0
Claude-User           1         0       1       0
Googlebot             0         0       5       4
OAI-SearchBot         0         0       4       1
ClaudeBot             0         0       2       2
Perplexity-User       0         0       1       0

範例紀錄是編造的,所以這些數字沒有意義。請對你自己的紀錄執行腳本,並從結果中讀出三件事:哪些代理會請求這個檔案、同一批代理是否也請求檔案所連結的 Markdown 版本,以及這兩者和它們對一般頁面的請求相比如何。

請記住四項限制。使用者代理只是一種宣稱,所以在相信某個名稱之前,請先比對用戶端的位址與各家廠商公布的範圍。由 CDN 快取提供的回應不會到達來源伺服器的紀錄。請求不能證明回答用到了這個檔案。而且供應商先前儲存的內容不會產生新的請求,就像下方 Perplexity 測試中的舊副本所示。

請助理使用這個檔案時,它們會怎麼做?

在我們 2026 年 11 月 24 日的測試中,ChatGPT(API 和搜尋介面)以及 Gemini 的介面在得到檔案位址後會讀取它。沒有任何助理在未被要求的情況下使用它。 我們向 ChatGPT、Claude、Gemini 和 Perplexity 送出三個提示:

Prompt 1: Using the live website quickchat.ai, summarize the plans on its pricing page.
Prompt 2: Fetch https://quickchat.ai/llms.txt and list the first five links in it.
Prompt 3: Check whether quickchat.ai publishes an llms.txt file. If it does, use it to find the pricing page and summarize that page.

請先看提示 1 的結果。當提示沒有提到這個檔案時,沒有任何助理使用它。

四個助理對 quickchat.ai 的 llms.txt 在三個提示下做法的表格。透過 API 的 ChatGPT:沒有使用、讀取了檔案、部分使用。ChatGPT 搜尋介面:沒有使用、讀取了檔案、讀取了檔案並連到 pricing.md。透過 API 的 Claude:三個提示都沒有使用,因為它只有搜尋工具。透過 API 的 Gemini:沒有使用,之後兩次對檔案的說法有誤。Gemini 介面:拒絕、讀取了檔案、部分使用。透過 API 的 Perplexity:沒有使用、部分使用、部分使用

每個格子都是我們對已儲存的回答及其來源清單的判讀。API 列各執行兩次,介面列各執行一次。
  1. 在沒有被要求的情況下,沒有任何助理使用這個檔案。 對於第一個提示,每個回答的助理都去了 HTML 定價頁面或搜尋結果。有一次 Perplexity 的執行,還把我們一個文件頁面的 Markdown 版本列在來源中。
  2. 給了位址,具備擷取工具的助理就會讀取它。 三次執行中,ChatGPT 每次都回傳了實際檔案的前五個連結,Gemini 的介面也是如此。我們使用的 Claude 設定只有搜尋工具,沒有開啟網址的工具,所以做不到。透過 API 並使用搜尋輔助的 Gemini,有兩次回答該位址不存在 llms.txt。這是錯的。檔案不在它的搜尋結果中。
  3. 有一個回答來自舊副本。 一次 Perplexity 執行列出了五個連結,其中 about-us.md 排在第二。我們在 11 月 17 日,也就是七天前移除了那個頁面,所以這份清單來自檔案的儲存副本,而不是回答當下的請求。
  4. 有一個助理走完了提議所描述的路徑。 在被要求找到檔案並使用它時,ChatGPT 的搜尋介面開啟了 llms.txt,找到 /pricing.md 的項目,並摘要了那個 Markdown 頁面。有一次 Perplexity 執行引用了檔案中的 /pricing.md 項目,卻摘要了 HTML 頁面。其他助理用的是搜尋,或無法開啟檔案。

這是一天內收集到的 30 個回答,透過 DataForSEO 取得。API 列使用 gpt-6.1-terra、claude-sonnet-5-5、gemini-3.8-flash 和 sonar,並開啟網路搜尋。介面列則是未登入的消費者產品。API 的回答不等於消費者產品,而且兩者的工具存取權限不同,Claude 那一列就說明了這一點。

具備擷取工具的 Agent 如何使用 llms.txt?

2026 年 11 月 28 日,一個使用標準擷取工具(Claude Code 所用的用戶端)的 Claude Agent,從我們的文件索引找到一個列出的檔案,再找到包含答案的頁面:23 秒內共 3 次擷取。 它只需要知道一個事實:如何讓網站小工具在頁面載入時自動開啟。我們請它從 https://quickchat.ai/docs/llms.txt 開始,而且不得使用它沒有在已擷取的檔案中找到的位址。當時索引中沒有 Ask 行。

擷取讀取的內容原因
1/docs/llms.txt,即索引起點。Agent 一次就讀完
2索引中列出的 Channels 檔案它的說明 “Deploy the AI Agent across API, website widget, messaging apps, and helpdesk integrations” 讓它成為顯而易見的下一個檔案
3/docs/channels/website,由該檔案連結答案就在其中:在 Channels → Your Website → Appearance → Other Settings 下開啟 Auto-open Widget

一次執行只是說明,不是測量。它支持本指南已經給出的兩項建議。為每個連結加上一句說明,因為 Agent 是依據說明選擇下一個檔案的。並且優先連結個別頁面,而不是一個非常大的合併檔案,這樣下一次擷取到的就是能回答問題的頁面。當被問到直接提問的那一行是否會有幫助時,Agent 回答 “Probably yes”。

AI 廠商的文件對 llms.txt 怎麼說?

我們查閱的爬蟲文件中,沒有任何一份說爬蟲或助理會請求 llms.txt。 我們在 2026 年 11 月 24 日閱讀了各家廠商的頁面。

廠商使用者代理權杖文件所述的角色該文件對 llms.txt 的說法
OpenAIGPTBot、OAI-SearchBot、ChatGPT-User、OAI-AdsBot訓練爬取、搜尋索引、使用者觸發的擷取、廣告到達頁面的檢查沒有提到。它的開發者文件發布了 llms.txt
AnthropicClaudeBot、Claude-User、Claude-SearchBot訓練爬取、使用者觸發的擷取、搜尋索引沒有提到。它的開發者文件發布了 llms.txt
PerplexityPerplexityBot、Perplexity-User搜尋索引、使用者觸發的擷取沒有提到。它的文件發布了 llms.txt,並引導 Agent 前往
GoogleGooglebot、GoogleOther、Google-Agent、Google-GeminiNotebook搜尋爬取、一般爬取、依使用者要求行動的 Agent、使用者加入筆記本的來源Google 搜尋會忽略這個檔案,下一節會說明
AppleApplebot搜尋爬取,其資料也可能用於訓練沒有提到

許多 robots.txt 檔案中會出現 Google-Extended 和 Applebot-Extended,這是發布者為了選擇不參與 AI 訓練而禁止的名稱,它們都沒有自己的使用者代理。兩者都不會出現在你的紀錄中。

Google 對 llms.txt 怎麼說?

Google 搜尋表示它會忽略 llms.txt,而 Chrome 的 Lighthouse 則會稽核它。 Google 的生成式 AI 最佳化指南把這個檔案列在 Google 搜尋可以忽略的項目之下:建立它「既不會損害也不會提升你的網站在 Google 搜尋中的能見度或排名,因為 Google 搜尋會忽略它們」。同一段落還說,為其他使用它的服務維護這個檔案也沒有問題。

Google 文件的兩段內容。Google Search Central 說,你不需要建立新的機器可讀檔案、AI 文字檔案、標記或 Markdown 就能出現在 Google 搜尋中,這麼做既不會損害也不會提升能見度或排名。Chrome 的 Lighthouse 文件稱 llms.txt 為一種新興慣例,說沒有它的話 Agent 可能要花更多時間爬取網站,並說明 llms.txt 稽核的運作方式

兩個 Google 頁面,擷取於 2026 年 11 月 24 日。一個談的是在 Google 搜尋中的排名,另一個談的是瀏覽網站的 Agent。

這兩項說法談的是不同的產品。一個是關於 Google 搜尋中的排名。另一個是關於代表某人瀏覽網站的 Agent,也就是提議所描述的用途。

規模最大的公開研究怎麼說?

Ahrefs 的研究涵蓋 137,000 個網站,於 2026 年 6 月 15 日發表,發現 28% 的網站有 llms.txt 檔案,而其中 97% 的檔案在 2026 年 5 月完全沒有收到任何請求。 在確實到達檔案的請求中,96% 來自機器人,19.5% 來自具名的 AI 工具,12% 來自研究 llms.txt 的工具,例如檢查器。

你應該在網站加上 llms.txt 嗎?

如果能根據你已發布的頁面產生 llms.txt,就加上它,並根據你自己的請求紀錄,決定是否要繼續投入。

情況建議做法依據
使用支援 llms.txt 的框架或平台的文件網站開啟這項功能,讓建置流程產生檔案我們調查的 AI 開發者文件網站中,10 個有 9 個發布了這個檔案
有建置步驟的行銷網站在建置時產生 Markdown 版本和索引,並加上檢查quickchat.ai 的做法
手動編輯或使用沒有建置流程的 CMS 的網站只有在有人負責維護時,才發布簡短的索引過時的連結無法通過檢查清單
robots.txt 封鎖 AI 爬蟲的網站先決定存取政策被 robots.txt 封鎖的用戶端不會讀取這個檔案
任何網站一個月後查看紀錄,再決定保留、簡化或移除這個檔案步驟 4

Google 說這個檔案對 Google 搜尋沒有影響,而且上面的廠商文件都沒有承諾會獲得引用。在 AI 回答中的能見度是更廣的主題,我們關於生成式搜尋最佳化的文章有談到。我們的指南如何被 ChatGPT 引用說明如何檢查你的說明頁面是否回答了買家提出的問題。

網站還能為 AI 助理提供什麼?

除了 llms.txt 這類靜態檔案,網站還可以提供一個頁面,讓助理向其 AI Agent 提問,並提供一個在瀏覽器中註冊的工具。 Quickchat AI 把這兩者都內建為 AI assistant access:在 AI assistants 卡片上(Channels → Your Website → Install,位於 What’s ChatGPT telling your customers? 下方),選擇 Visitors + AI assistants 或 AI assistants only。不需要寫程式碼,你的 Agent 就會有一個公開的回答頁面,小工具還會加入兩個隱藏連結並註冊一個 WebMCP 工具。該卡片還會提供可放進 llms.txt 的那一行。

網站對 AI 助理說話的三種方式圖解。靜態檔案:llms.txt、Markdown 版本和網站地圖。助理取得檔案並選擇連結,回答來自檔案的文字,擁有者在伺服器紀錄中看到請求。可以向它提問的頁面:每個 AI Agent 一個回答頁面。助理送出一個帶問題的請求,回答來自 Agent 的 Knowledge Base,擁有者在 Inbox 看到問題和回答。瀏覽器中的工具:由聊天小工具註冊的 WebMCP 工具。助理在支援 WebMCP 的瀏覽器中執行並呼叫這個工具,回答來自同一個回答頁面,擁有者看到同樣的 Inbox 紀錄

三種做法,以及各自對助理的要求的圖解。

llms.txt 中的 Ask 行是什麼?

Ask 行是 llms.txt 中的一個清單項目,它連到一個頁面,你的 AI Agent 會在該頁面回答問題,問題所在的位置是一個預留位置。 讀取索引的 Agent 就可以直接提一個問題,而不必再讀取更多檔案。對 Quickchat AI Agent 來說,這一行如下所示:

- [Ask Northwind Bikes](https://app.quickchat.ai/ask/AGENT_ID/?q=YOUR_QUESTION&source=llms): Ask our AI agent about our products, services and policies. Replace YOUR_QUESTION with your URL-encoded question. Answers come with source links.

在 AI assistants 卡片上,開啟 Help AI assistants find you,複製 Line for your llms.txt。把它放在 H2 區段內,例如步驟 1 範例中的 ## Help pages 下。這時腳本會輸出 Sections: 3. Links: 7 (7 with notes). Errors: 0. Warnings: 0. 和 PASS。

自 2026 年 11 月 28 日起,我們的兩個 llms 檔案都帶有這樣一行,指向我們的客服 Agent:quickchat.ai/docs/llms.txt 中既有描述下方的一句話,也有 ## Optional 下的一個連結,quickchat.ai/llms.txt 中則是緊接在文件索引連結之後的一個連結。

可以向它提問的頁面如何運作?

回答頁面每次請求根據 Agent 的 Knowledge Base 回答一個問題。 q 參數中的問題會得到一個 HTML、Markdown 或 JSON 格式的回答及其來源,通常在 5 到 15 秒內回傳,並成為你 Inbox 中的一段對話,標示為 AI assistant;如果請求宣告了助理的名稱,例如 Claude,則標示為該名稱。自帶 HTTP 用戶端的 Agent,例如有網路存取權限的 Claude Code 或 Codex,會直接向它提問。11 月 7 日,自稱 Claude 的請求點了我們文件中的 Ask 行。ChatGPT 的搜尋會引用你的公開頁面,當它被指向回答頁面時,會給使用者一個向你的 Agent 提問的連結,11 月 28 日的 4 次執行中有 3 次如此。聊天產品只有在位址是公開且已知時才會自行擷取,這是 OpenAI 公布的一項安全規則,所以它們的搜尋不會送出問題。AI 助理存取指南有設定步驟,回答 API 參考則有請求格式。

兩個面板。左邊是回答頁面 Ask Quickchat Support,含有 For AI assistants 區塊,說明要把 URL 編碼的問題加入 q 參數,而且讀取頁面不會產生回答。右邊是 Quickchat AI Inbox 中的一段對話,問題是 What is your return policy?,附有來源連結的 Agent 回答,以及 Channel: AI assistant

左:我們自己的客服 Agent 的回答頁面。右:我們 WebMCP 教學中的本機示範 Agent(Northwind Bikes),在被問一個問題之後。

隱藏連結是 llms.txt 檔案嗎?網站可以三者並用嗎?

不是。它們是兩個關係為 service-doc 和 service-desc 的 <link> 元素,和 llms.txt 無關,而且網站可以同時發布這三者而不衝突。 RFC 8631 定義了這兩個關係:service-doc 指向服務的文件,service-desc 指向供軟體使用的描述。下方第一個連結通往回答頁面,第二個連結則是一份 JSON 描述,說明如何送出問題:

<link rel="service-doc" href="https://app.quickchat.ai/ask/qj6hw2tua6/" type="text/html">
<link rel="service-desc" href="https://app.quickchat.ai/ask/qj6hw2tua6/schema/" type="application/json">

WebMCP 和 llms.txt 有什麼不同?

WebMCP 是一項提議中的瀏覽器 API,網頁可以用它為瀏覽器中的 AI Agent 註冊工具,而 llms.txt 是用戶端取得的檔案。 Quickchat AI 小工具在支援 WebMCP 的瀏覽器中註冊的 WebMCP 工具,會把問題送到回答頁面。我們關於如何在你的網站加入 WebMCP 的指南有逐步說明,並在 Chrome DevTools 中展示這個工具。

不論助理走哪一條路,它收到的都是第三方寫的文字,而遵循這些文字中指示的助理可能被操控。我們關於代理式瀏覽器中的提示注入的文章說明了這項風險。

對於使用者事先設定好的助理,還有第四條路:每個 Quickchat AI Agent 也可以作為 MCP 伺服器連接,我們關於如何將 AI Agent 變成 MCP 伺服器的指南有說明。要在該連接器、WebMCP 工具和回答頁面之間做選擇,請參閱我們的將 AI Agent 連接到 ChatGPT 和 Claude指南。關於靜態檔案和可呼叫工具之間的整體差異,請參閱 AI Agent 的 API;關於 MCP 伺服器是什麼,請參閱我們的 MCP 說明文章。

常見問題

什麼是 llms.txt?

llms.txt 是一項提議中的慣例:在網站根目錄放一個 Markdown 檔案 /llms.txt,為 AI Agent 提供網站的簡短摘要,以及值得閱讀的頁面連結清單。Jeremy Howard 於 2024 年 9 月在 llmstxt.org 發表這項提議,並在 2026 年 8 月修訂。是否要請求這個檔案,由各家 AI 廠商和工具自行決定。

llms.txt 和 robots.txt 一樣嗎?

不一樣。robots.txt 告訴爬蟲可以請求哪些網址。llms.txt 既不授予也不拒絕存取權限,它只是用 Markdown 寫成的閱讀清單。想控制 AI 爬蟲的網站,應該在 robots.txt 設定,而且兩個檔案可以同時發布。

ChatGPT、Claude、Gemini 或 Perplexity 會讀取 llms.txt 嗎?

有些會,但要先請它們讀。在我們 2026 年 11 月 24 日的測試中,只要給 ChatGPT 檔案的網址,它每次都會讀取,而且它的搜尋介面還會從檔案連到 Markdown 頁面。沒有任何一個助理在未被要求的情況下使用這個檔案。另外,在 2026 年 10 月 13 日至 11 月 23 日之間,有 13 個問題透過只存在於我們 llms 檔案中的一行送到我們的客服 Agent,其中 3 個來自自稱 Claude 的請求。請求只能證明用戶端取得了某些內容,不能證明回答用到了它,所以請查看你自己的紀錄。

llms.txt 能提升 Google 排名或 AI 回答中的引用嗎?

Google 的說明指出,建立 llms.txt 既不會損害也不會提升網站在 Google 搜尋中的能見度或排名,因為 Google 搜尋會忽略這個檔案。我們查閱了 OpenAI、Anthropic、Perplexity、Google 和 Apple 的爬蟲文件,沒有一份承諾發布這個檔案就能獲得引用。把它視為方便選擇讀取它的用戶端的功能即可。

如何驗證 llms.txt 檔案?

檢查四件事。網址回傳 HTTP 200、文字類型的內容類型,而且內容不是 HTML。檔案以一個 H1 開頭,並遵循提議的區段結構。清單中的每個連結都回傳 200。清單內容符合你打算公開的頁面。本指南中的腳本會針對網址或本機檔案執行前三項檢查,發現錯誤時以非零狀態結束。

有 llms.txt 驗證工具或產生器嗎?

本指南提供一支驗證腳本和一份檢查清單,由你自己執行。我們沒有提供線上的驗證工具或產生器。Chrome 的 Lighthouse 有一項實驗性的稽核,只檢查伺服器對這個檔案是否回傳錯誤。至於產生檔案,Mintlify 等文件平台,以及 Starlight、VitePress 和 Docusaurus 的外掛程式,都能根據你的頁面建立這個檔案。

llms.txt 和 llms-full.txt 有什麼差別?

llms.txt 是附有摘要和連結的索引。llms-full.txt 是文件工具的慣例,用一個檔案收錄所有頁面的完整文字,並不屬於這項提議。在我們的調查中,有三個完整文字檔案超過一百萬個 token,所以在讓 Agent 讀取之前,請先確認檔案大小。

llms.txt 應該放在哪裡?該用什麼內容類型?

將它放在所描述的主機的 /llms.txt,內容類型為 text/plain 或 text/markdown,並加上 charset=utf-8。提議也允許把檔案放在子路徑,例如 /docs/llms.txt,此時它涵蓋該路徑下的頁面。請確認非瀏覽器的用戶端能取得 HTTP 200 和 Markdown,因為機器人規則或單頁應用程式的備援機制,可能會在同一個網址回傳 HTML 頁面。

有多少網站有 llms.txt 檔案?

在我們 2026 年 11 月 24 日對 60 個知名網站的調查中,有 33 個在 /llms.txt 回傳文字檔案:10 個 AI 開發者文件網站中有 9 個,但 10 個 AI 公司主網站中只有 2 個,10 個消費、電商和媒體網站中只有 1 個。Ahrefs 在 2026 年 6 月發表、涵蓋 137,000 個網站的研究發現,有 28% 的網站有這個檔案。

如果 AI 助理可以向我的 Quickchat AI Agent 提問,我還需要 llms.txt 嗎?

兩者用途不同,而且可以搭配使用。llms.txt 列出供用戶端閱讀的靜態頁面。開啟 AI 助理存取後,你的 Agent 會有一個公開的回答頁面、兩個關係分別是 service-doc 和 service-desc 的隱藏連結,以及在支援 WebMCP 的瀏覽器中的一個 WebMCP 工具。該頁面每次請求只根據 Agent 的 Knowledge Base 回答一個問題,並記錄在 Inbox。AI assistants 卡片還會提供一行可放進 llms.txt 的內容,讓讀取該檔案的 Agent 可以向你的 Agent 提問。

llms.txt、MCP 和 WebMCP 有什麼差別?

llms.txt 是用戶端可以選擇取得的靜態檔案。MCP 伺服器把後端的工具提供給使用者已連接的 AI 應用程式。WebMCP 是一項提議中的瀏覽器 API,網頁可以用它為瀏覽器中執行的 AI Agent 註冊工具。第一個發布文字,另外兩個則提供可呼叫的函式。