npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vercel/agent-readability

v0.2.1

Published

Detect AI agents. Serve them markdown. Audit your site against the Agent Readability Spec.

Maintainers

sebastianromingsebastianromingcraigandrewscraigandrewsgkaragkiaourisgkaragkiaourisdglsparsonsdglsparsonsbvred4244bvred4244dummdidummdummdidummadriancooney_verceladriancooney_verceleveporcelloeveporcellobcorn-celybcorn-celyatinuxatinuxdvoytenkodvoytenkoamyeganamyeganbrookemosbybrookemosbyfeugyfeugyswarnavasenguptaswarnavasenguptaraunofreibergraunofreibergmamusomamusogoncygoncysmaeda-kssmaeda-kshenryheffernanhenryheffernangargis5gargis5wycatswycatsyvonnezhouyvonnezhouchibicodechibicodeandybitzandybitziamevilrabbitiamevilrabbittootallnatetootallnatestyflestyflematthewbinshtokmatthewbinshtokmglagolamglagolajavivelascojavivelascoluimeyluimeytimertimerlucleraylucleraymatheussmatheussanatrajkovskaanatrajkovskan0rlant1sn0rlant1sjooliashijooliashitimneutkenstimneutkenselsighelsighwitswitslpalmeslpalmescl3arglasscl3arglasssamsislesamsislechriswdmrchriswdmrrizbizkitsrizbizkitsismaelrumzanismaelrumzanrich.davis.vercelrich.davis.vercelcreationixcreationixfeedthejimfeedthejimcasey.gowriecasey.gowrierauchgrauchghuozhihuozhialdoschaldoschlfadeslfadesokbelokbeljerilynzjerilynzhedyzandihedyzandipadmaiapadmaiadelbadelbasokrasokragsandhugsandhudbredvickdbredvickhungrybearstudiohungrybearstudiocalebboydcalebboydhellojennifertranhellojennifertranmarcgreenstockmarcgreenstockagadzikagadziktknickmantknickmanjanoryjanoryjeffreyarnesonjeffreyarnesonmattjaredmattjaredmsimulcikmsimulcikgdbortongdbortoncorrettojscorrettojscramforcecramforcekakadiadarpankakadiadarpankit-fosterkit-fostertilly3gtilly3gecklfecklfhealeycodeshealeycodesdferber90dferber90epallerolsepallerolsnicolas-webdevnicolas-webdevschlezschleznpm_bot_vercel_supportnpm_bot_vercel_supportpieparkerpieparkerjtaylor0196jtaylor0196javierbytejavierbyteemeraldsantoemeraldsantogaspar09gaspar09mmastracmmastracsr_internsr_interngudmundurgudmundurnick.traceynick.traceybmealeybmealeydoquedoqueaaorrisaaorrisnutanutadaniel.campbelldaniel.campbellquiibzquiibzchloe.tedderchloe.teddermjakobismjakobismehulkarmehulkartcc-sejohnsontcc-sejohnsonfiliphassonfiliphassonlubakravchelubakravchegnoffgnoffmatt.strakamatt.strakawbinnssmithwbinnssmithofhouseofhousemknichel-vercelmknichel-vercelvvovvovercel-release-botvercel-release-botrob-peters-vercelrob-peters-vercelgt-codesgt-codestobiaslinstobiaslinstiago-loureirotiago-loureirombrakkenmbrakkentimolinstimolinsanthonyshewanthonyshewcmeyer_vercelcmeyer_vercelmiguelalcaldemiguelalcaldelaugharnlaugharnviekoviekorobin-vercelrobin-vercelwude935wude935zach-baldazach-baldaah100101ah100101quietshuquietshuijjkijjkvercelbenvercelbenzharichzharichjoey.berkowitzjoey.berkowitzdfeindfeinanbuzinanbuzinashok.gurumurthyashok.gurumurthydavidverceldavidverceldiscepolidiscepoliowoceowoceergun1017ergun1017shaper42shaper42ademauademaulayonthebeechlayonthebeechjeffsee55jeffsee55zeejabzeejabacdliteacdlitemcabs3mcabs3msemperemsempereaayush-kapooraayush-kapoormelkeymelkeykldavis4kldavis4lukahartwiglukahartwigbgwbgwmikevercelmikevercelsipexsipexjeremyphilemonjeremyphilemoneprosimoneprosimonrithmicrithmicdanmfoxdanmfoxn-vigiern-vigiervercelmattvercelmattjudegaojudegaovercel-ctatevercel-ctatesjoedwardssjoedwardsalbanesealbanesesceilersceilerlgrammellgrammeljamesvclementsjamesvclementstomocchinotomocchinoaryamankhaaryamankhatechwraithtechwraithmattfroggettmattfroggetteps1loneps1lonleorrr2leorrr2pbzonapbzonamalewis5malewis5ekarandreasekarandreasdevjiwonchoidevjiwonchoitwwrighttwwrightbstrehlbstrehlkuhristie-vercelkuhristie-vercelwilson-w-vercelwilson-w-vercelralph_02ralph_02konstvkonstvcarbonrobotcarbonrobotfantixkingfantixkingjohnlindquistjohnlindquistzacktannerzacktannergabenunezgabenunezshadcnshadcnmsully4321msully4321unstubbableunstubbablebrandon.tuttle-vercelbrandon.tuttle-vercelfelixarntzfelixarntzmario.lopez.arturomario.lopez.arturodangershfielddangershfieldalexander-dolphin-vercelalexander-dolphin-vercelsueplexsueplexaurorascharff_npmaurorascharff_npmbensabicbensabicwentsulwentsulvikhyathvikhyathdanielparkverceldanielparkvercelshay.cichockishay.cichockimischnicmischnichgstrmhgstrmdcampvc01dcampvc01mitul-smitul-sjonpheyjonpheyannagzhannagzhrich_harrisrich_harrisandrewbarbaandrewbarbabcjrobertsbcjrobertsmarc-vercelmarc-vercelali-vercelali-vercelplmrryplmrryqiaoqiaomartinsionemartinsionetmdotmdonatemcgrady-vercelnatemcgrady-verceljulianbenegasjulianbenegasrao.chandanrao.chandanthebigsadowskithebigsadowskigovind-vercelgovind-verceltomjohndesigntomjohndesignbshanzbshanzaubreychamberlainaubreychamberlaindidemigueldidemiguelkmiddleton14kmiddleton14yavoryavorgracelliugracelliu1st11st1whatplanwhatplanfmoorfmoorvercel-eddievercel-eddietristantcoopertristantcooperrklaeserrklaesermerycodesmerycodesnmelmsnmelmsyasoobr0yasoobr0m7rcelom7rceloestebansuarezestebansuarezbobmshannonbobmshannoncaseyokeefecaseyokeefebhrigubhrigulaksshhlaksshhzackelanzackelankelzceanakelzceanahannah.hearthhannah.hearthfalcoagustin.vercelfalcoagustin.vercelnpasquinzonpasquinzokobologkobologtimwhite96timwhite96jnsahajjnsahajastephen100astephen100sylviezhangsylviezhangmatiasgfmatiasgflukesheardlukesheardadrientheboadrienthebokarthiklangtracekarthiklangtraceelpranselpransrihanarfanrihanarfanolivercarmontolivercarmontjjdopkinjjdopkinvercel_it_service_accountvercel_it_service_accountadamdongadamdongvalerian-rochevalerian-rocheallen-vercelallen-vercelalli-vercelalli-vercelscotttrinhscotttrinhjaclarkejaclarkebkonklebkonkleseverinlandoltseverinlandoltkevinjosethomaskevinjosethomasjaygengelbachjaygengelbachchriskindlchriskindltk04tk04gschogschokavinvallikavinvallinsidnevnsidnevyash-kothari-vercelyash-kothari-vercelrobherleyrobherleymingchungxmingchungxmbaizambaizabenyebaibenyebaitristano45tristano45andyw22andyw22shagrawalshagrawalneil-vercelneil-vercelskullfaceskullfacefernandorojofernandorojokevin.corbettkevin.corbettzacowanzacowanjoelhooksjoelhookswillvileswillvilesmarkandrusmarkandrusloganliffickloganliffickyoungbloodcybyoungbloodcybquuuquuujteesangjteesangpckirklandpckirklanddavid_keefedavid_keefejeffreypojeffreypodarafshehdarafshehmarkpython86markpython86tonypantonypanjackjacksonverceljackjacksonvercelseif.ghezalaseif.ghezalamiksumiksuwillsatherwillsatheramanazadamanazadjacobparisjacobparisicyjosephicyjosephvercelliotvercelliotlukesandberglukesandbergnicolasmontonenicolasmontonevoodootikigodvoodootikigodsatya-callstacksatya-callstackchristianhubbardchristianhubbardwoshuajolkwoshuajolkbennorbennorstranglestranglebmishkinbmishkinmshepaneshmshepaneshkarimhaseboukarimhasebouwilliamboutwilliamboutpranaygppranaygpalex-groveralex-groverchrmcd-verchrmcd-verallenzhou101allenzhou101dmoridmoriiansbrashiansbrashalice-wonderedalice-wonderedmatchaimatchaivishalyathishvishalyathishsamselikoffsamselikoffmrsasuu_ckmrsasuu_ckmtoth-vercelmtoth-vercelanshuman71anshuman71runewolf7runewolf7rohantaneja-vercelrohantaneja-vercelhp_arorahp_arorajoyboy-0joyboy-0matiasperzmatiasperzjverceljverceltannerverceltannervercelgi_wrightygi_wrightymatthewstanciumatthewstanciurickeymcgregorrickeymcgregorrichardkunklirichardkunklibwalvoordbwalvoorddanielroedanielroety37zhangty37zhangjohnphamousjohnphamous6ary6aryricardo-agzricardo-agzaej11aaej11amclenhardmclenhardreynaldo-vercelreynaldo-verceljaredthompson22jaredthompson22jetthenjetthenrobkebabrobkebabraidaltraidaltcodyellowcodyellowpablostanleypablostanleyronnie-hanifronnie-hanifzypxzypxtheclethecleandy.rianchoandy.rianchojonasherrjonasherrvanessaxteovanessaxteotomdaletomdalevincent-derksvincent-derksgrappeggiagrappeggiavaguelyseriousvaguelyseriousmkrrmkrrdalyd14dalyd14kaciebkaciebgr2mgr2mkarim_v1karim_v1simhskalsimhskal

Readme

@vercel/agent-readability

Detect AI agents. Serve them markdown. Audit your site against the Agent Readability Spec.

Install

npm install @vercel/agent-readability

Or run the audit CLI directly without installing:

npx @vercel/agent-readability audit https://vercel.com/docs

Quick Start

Add AI agent detection to your Next.js middleware in three lines:

// middleware.ts
import { withAgentReadability } from '@vercel/agent-readability/next'

export default withAgentReadability({
  rewrite: (pathname) => `/api/docs-md${pathname}`,
})

export const config = {
  matcher: ['/docs/:path*'],
}

AI agents hitting /docs/* now receive markdown instead of HTML.

What It Does

Three-layer detection identifies AI agents from HTTP request headers:

  1. Known UA patterns. 40+ agents including ClaudeBot, GPTBot, Cursor, and Perplexity.
  2. Signature-Agent header. Catches ChatGPT agent (RFC 9421).
  3. sec-fetch-mode heuristic. Catches unknown bots that lack browser fingerprints.

The detection optimizes for recall over precision. Serving markdown to a non-AI bot is low cost. Missing an AI agent means a worse experience.

Core API

isAIAgent(request)

Detect AI agents from request headers.

import { isAIAgent } from '@vercel/agent-readability'

const result = isAIAgent(request)
// { detected: true, method: 'ua-match' }

Accepts any object with a headers.get() method: Request, NextRequest, or a custom wrapper.

Returns a discriminated union:

  • { detected: true, method: 'ua-match' | 'signature-agent' | 'heuristic' }
  • { detected: false, method: null }

When detected is true, method is always non-null. TypeScript narrows automatically.

acceptsMarkdown(request)

Check if the request prefers markdown via the Accept header.

import { acceptsMarkdown } from '@vercel/agent-readability'

if (acceptsMarkdown(request)) {
  return new Response(markdown, {
    headers: { 'Content-Type': 'text/markdown', 'Vary': 'Accept' },
  })
}

shouldServeMarkdown(request)

Combines agent detection and content negotiation into one call.

import { shouldServeMarkdown } from '@vercel/agent-readability'

const { serve, reason } = shouldServeMarkdown(request)
// serve: true, reason: 'agent' | 'accept-header'

generateNotFoundMarkdown(path, options?)

Generates a markdown body for missing pages. Return this with a 200 status (not 404) because agents discard 404 response bodies.

import { generateNotFoundMarkdown } from '@vercel/agent-readability'

const md = generateNotFoundMarkdown('/docs/missing', {
  baseUrl: 'https://example.com',
})
// Return as 200 so agents read the body
return new Response(md, {
  headers: { 'Content-Type': 'text/markdown' },
})

Pattern Exports

AI_AGENT_UA_PATTERNS, TRADITIONAL_BOT_PATTERNS, SIGNATURE_AGENT_DOMAINS, and BOT_LIKE_REGEX are exported for consumers who need to extend or inspect them.

Next.js Adapter

withAgentReadability(options, handler?)

Middleware wrapper that detects AI agents and rewrites matching requests to markdown routes. Compatible with Next.js 14 and 15 (Pages and App Router).

import { withAgentReadability } from '@vercel/agent-readability/next'

export default withAgentReadability({
  docsPrefix: '/docs',
  rewrite: (pathname) => `/en/llms.mdx/${pathname.replace('/docs/', '')}`,
  onDetection: async ({ path, method }) => {
    await trackMdRequest({ path, detectionMethod: method })
  },
})

The onDetection callback runs via event.waitUntil() and does not block the response.

Composing with other middleware

Pass your existing middleware as the second argument:

export default withAgentReadability(
  {
    rewrite: (p) => `/md${p}`,
  },
  (req, event) => i18nMiddleware(req, event),
)

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | docsPrefix | string | '/docs' | URL prefix to intercept | | rewrite | (pathname: string) => string | required | Maps request path to markdown route | | onDetection | (info) => void \| Promise<void> | - | Analytics callback (runs in waitUntil) |

agentReadabilityMatcher

A pre-built matcher that excludes Next.js internals and static files. Use this for site-wide agent detection instead of scoping to a prefix:

import { withAgentReadability, agentReadabilityMatcher } from '@vercel/agent-readability/next'

export default withAgentReadability({
  docsPrefix: '/',
  rewrite: (pathname) => `/md${pathname}`,
})

export const config = {
  matcher: agentReadabilityMatcher,
}

Audit CLI

Check your site against the Agent Readability Spec.

npx @vercel/agent-readability audit https://sdk.vercel.ai

Runs 16 weighted checks across three categories. Returns a score from 0 to 100. Failed checks include fix suggestions that can be copy-pasted into your coding agent.

CI Integration

- name: Audit agent readability
  run: npx @vercel/agent-readability audit ${{ env.SITE_URL }} --min-score 70 --json

Exits with code 1 if the score is below the threshold.

CLI Options

| Flag | Description | |------|-------------| | --json | Output as JSON | | --min-score <n> | Exit with error if score < n |

Caching

When the same URL serves HTML to browsers and markdown to AI agents, CDN caching must include the Accept header in the cache key.

Set Vary: Accept on all markdown responses. Without it, CDNs may serve cached HTML to agents or cached markdown to browsers.

The withAgentReadability middleware handles detection and rewriting. Your markdown route handler is responsible for setting response headers including Vary: Accept and Content-Type: text/markdown.

Edge Runtime

The core library and Next.js adapter use only Web APIs. They work in Vercel Edge Runtime, Cloudflare Workers, and any standard Request/Response environment.

The CLI runs on Node.js 20+.

License

MIT