Skip to content

feat(llms): serve an /AGENTS.md agent guide - #85

Merged
nibzard merged 1 commit into
mainfrom
feat/agents-md-route
Jul 29, 2026
Merged

feat(llms): serve an /AGENTS.md agent guide#85
nibzard merged 1 commit into
mainfrom
feat/agents-md-route

Conversation

@nibzard

@nibzard nibzard commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Final slice of the agent-docs effort. Adds a `/AGENTS.md` route serving the shared `AGENT_INSTRUCTIONS` block (install, auth config, usage code) as markdown with the `llms.txt` index pointer prepended. `/AGENTS.md` previously 404'd; this satisfies the AGENTS.md convention and Vercel's agent-readability check.

The non-obvious part: the markdown-negotiation middleware was already intercepting `/AGENTS.md` — its `.md`-suffix handler stripped the suffix to `/AGENTS`, found it negotiable, and rewrote the request to `/llms.mdx/AGENTS` (404). So `/AGENTS` and `/AGENTS.md` are added to `EXCLUDED_EXACT_PATHS` to let the route handler own the request. A `/.well-known/agents.md` -> `/AGENTS.md` permanent redirect covers the spec's alternate location (mirroring the existing `/.well-known/llms.txt` redirect).

Reuses `AGENT_INSTRUCTIONS` (`lib/agent-instructions.ts`) and `LLMS_INDEX_POINTER` (`lib/get-llm-text.ts`) — no new content.

Testing

  • Unit: `resolveMarkdownPath('/AGENTS.md')` -> `null`.
  • Integration: middleware returns no `x-middleware-rewrite` for `/AGENTS.md` (browser and markdown user-agent).
  • E2E: `GET /AGENTS.md` -> 200 `text/markdown`, body starts with the index pointer and contains `npm install steel-sdk` + `STEEL_API_KEY`; `GET /.well-known/agents.md` -> 308 to `/AGENTS.md`.
  • `bun test tests/` (205 pass), Biome (`--error-on-warnings`), `tsc --noEmit`, `bun run build` all clean.

This completes the agent-docs roadmap (.md suffix #81, index pointer #82, markdown cleanup #83, index hygiene #84, /AGENTS.md here).

Add a /AGENTS.md route that serves the shared AGENT_INSTRUCTIONS block
(install, auth config, and usage code) as markdown with the llms.txt
index pointer prepended. This satisfies the AGENTS.md convention and
Vercel's agent-readability check; until now /AGENTS.md 404'd.

The markdown-negotiation middleware previously rewrote /AGENTS.md to
/llms.mdx/AGENTS (stripping the .md suffix), so /AGENTS and /AGENTS.md
are now excluded from negotiation to let the route handler own the
request. A /.well-known/agents.md -> /AGENTS.md permanent redirect
covers the alternate location, mirroring the existing llms.txt one.
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 29, 2026 6:50pm

Request Review

@nibzard
nibzard merged commit 0371edd into main Jul 29, 2026
3 checks passed
@nibzard
nibzard deleted the feat/agents-md-route branch July 29, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant