One snapshot — five machine surfaces. AHTML collapses MCP, OpenAPI 3.1, JSON-LD, llms.txt and a token-optimal semantic snapshot into a single declarative artifact that lives next to your existing HTML. Browsers still see pixels. Agents see typed entities, typed actions, signable provenance.
@ahtmljs/*Same page. Same content. One serialization for browsers, one for agents. Generated by the live toCompact() in @ahtmljs/schema.
@ahtml 0.1 @url https://github.com/DibbayajyotiRoy/AHTML @fetched 2026-06-15T17:54:00.404Z @ttl 600 @etag W/"15eeb6dc" @page_type home [document:ahtml-landing] title: AHTML — the HTML of the agent web author: Dibbayajyoti Roy published: 2026-05-12T00:00:00Z summary: Write your page once. AHTML emits MCP, OpenAPI, JSON-LD, llms.txt, and a typed semantic snapshot that uses 5-10× fewer tokens than HTML on lean pages, 50-100× on production-bloated pages. Drops into Next.js, Vite, SvelteKit. No migration. language: en tags: ahtml, agent-web, mcp, llms-txt, jsonld, openapi canonical_url: https://github.com/DibbayajyotiRoy/AHTML freshness: static (action) install label: Install via npm category: read method: GET execute: https://npmjs.com/package/@ahtmljs/next auth: none cost: free (action) join_waitlist label: Join waitlist category: send method: POST execute: /api/waitlist auth: none cost: free reversible: unsubscribe side_effects: create_subscription, send_email (action) run_benchmark label: Run the benchmark locally category: read method: GET execute: https://github.com/DibbayajyotiRoy/AHTML/tree/main/examples/benchmark cost: free (action) view_spec label: View v0.1 spec category: read method: GET execute: /spec cost: free @links canonical: https://github.com/DibbayajyotiRoy/AHTML related: product:mbp-14-m3, product:mbp-16-m3, product:aw-ultra-2, product:ipad-pro-m4 @meta generated_by: @ahtmljs/next 0.1.0
A typical product page ships 80–300 KB of nav, footer, tracking, and ad chrome. Less than 1% is the part an agent needs. Every token burned is paid for.
Schema.org describes what something is. It does not describe what you can do with it — cost, reversibility, side effects, auth, freshness. Agents guess.
A delete button and a $50,000 wire transfer look identical to a crawler. Without typed cost, reversibility, and confirmation, autonomous agents are one prompt injection from disaster.
AHTML compiles to every existing agent-web standard. You don't pick a side. You don't run a parallel server. You don't migrate.

Same content. Four serializations. Measured with the same tokenizers OpenAI and Anthropic use internally — gpt-tokenizer and @anthropic-ai/tokenizer. No text.length / 4 guesswork.
| Format | Bytes | Bytes (gzip) | Tokens o200k | Tokens Claude | × smaller (tokens, o200k) |
|---|---|---|---|---|---|
| HTML (server-rendered) | 28,400 | 6,240 | 6,810 | 6,412 | 1.0× |
| llms.txt | 476 | 361 | 147 | 158 | 46× |
| AHTML compact | 1,507 | 775 | 502 | 512 | 14× |
| AHTML JSON (pretty) | 1,728 | 835 | 508 | 542 | 13× |
Reproduce in 60 seconds: git clone github.com/DibbayajyotiRoy/AHTML && cd ahtml/examples/benchmark && npm install && npm run start. If gpt-tokenizer or @anthropic-ai/tokenizer is not installed, the corresponding column shows "—" rather than a fudged estimate.
The @ahtmljs/* scope splits cleanly into four layers — one schema everyone shares, three server adapters that emit it, two clients that consume it, and a CLI that validates the whole chain.
Full per-package endpoints, download counters, and STAR breakdowns in PACKAGES.md.
The canonical snapshot schema. Everything else depends on it.
For: Anyone authoring or validating AHTML — server, client, or tooling.
$ npm install @ahtmljs/schema
import { snapshot, toCompact, lint } from '@ahtmljs/schema';Next.js plugin. One route, every well-known endpoint.
For: App Router or Pages Router sites on Next 14+ that want agent traffic.
$ npm install @ahtmljs/next
import { createAHTMLRoute } from '@ahtmljs/next/handler';Vite plugin. Same bytes as the Next adapter, every Vite framework.
For: SvelteKit, SolidStart, Astro, Remix, or vanilla Vite projects.
$ npm install @ahtmljs/vite
import { ahtml } from '@ahtmljs/vite';Client SDK for AI agents that consume AHTML sites.
For: Anyone building an agent, scraper, or automation that calls AHTML endpoints.
$ npm install @ahtmljs/agent
import { AHTMLClient } from '@ahtmljs/agent';LangChain.js document loader. URL → embeddings in three lines.
For: RAG pipelines, vector stores, and retrieval chains on LangChain.js.
$ npm install @ahtmljs/langchain
import { AHTMLLoader } from '@ahtmljs/langchain';Hono adapter. The same emitter on every JavaScript runtime.
For: Hono apps on Node, Bun, Deno, Cloudflare Workers, or AWS Lambda.
$ npm install @ahtmljs/hono
import { ahtml } from '@ahtmljs/hono';ahtml doctor. Validate the whole discovery chain from CI.
For: Anyone shipping AHTML who wants the discovery chain checked on every build.
$ npm install -g @ahtmljs/cli
$ ahtml doctor https://example.comThe dependency graph: schema ← next / vite (emit) · schema ← agent / langchain (consume). One contract on both sides of the wire.
Each package is additive. Your existing pages keep rendering, your existing API keeps running — agents get an extra lane on the same origin.
Next.js sites — one route, every machine surface.
For: Next 14+ App Router or Pages Router projects.
npm install @ahtmljs/next @ahtmljs/schemaimport { withAHTML } from '@ahtmljs/next';
export default withAHTML({}, {
site: 'https://shop.com',
policy: { agents_welcome: true },
});import { createAHTMLRoute } from
'@ahtmljs/next/handler';
import { buildSnapshot } from
'@/lib/ahtml';
export const { GET, HEAD } =
createAHTMLRoute(buildSnapshot);Your snapshot now serves at:
/ahtml/* — typed snapshot per route (compact or JSON via Accept)/ahtml/mcp.json — auto-generated MCP tools manifest/ahtml/openapi.json — auto-generated OpenAPI 3.1 document/.well-known/ahtml.json — site-wide discovery manifest/llms.txt — compatibility shim for Cursor / Continue / ClineYour snapshot's actions become MCP tool definitions at /ahtml/mcp.json. No separate MCP server.
Actions with execute_url become full OpenAPI 3.1 operations. Codegen-ready.
Existing schema.org blocks become a Level-0 snapshot with zero developer work.
Auto-emit a clean llms.txt from registered routes. Free interop with Cursor / Continue / Cline.
Conditional GET via If-None-Match. ?since=<etag> returns just the change list.
Compact text for LLMs by default. Canonical JSON for signing and programmatic clients.
Every action carries auth, cost, reversibility, side effects, and confirmation level.
Token-bucket rate limit at the edge. Sites stay in control of what agents can do.
Snapshots can be signed against a did:web identity (v0.2). Agents detect tampering.
We're not a competitor to any of them. AHTML compiles to MCP, OpenAPI, JSON-LD, and llms.txt — and ingests from schema.org as a free Level-0 source.
| HTML | llms.txt | AHTML compact | AHTML JSON | |
|---|---|---|---|---|
| Token efficiency for agents | baseline | good | best | good |
| Typed entities | implicit | text only | ✓ | ✓ |
| Typed actions | implicit | text only | ✓ | ✓ |
| Cost / reversibility | — | — | ✓ | ✓ |
| Side-effect declarations | — | — | ✓ | ✓ |
| Site-wide policy | — | partial | ✓ | ✓ |
| Freshness / TTL | — | — | ✓ | ✓ |
| Conditional fetch (ETag) | partial | — | ✓ | ✓ |
| Pagination semantics | — | — | ✓ | ✓ |
| MCP-emittable | — | — | ✓ | ✓ |
| OpenAPI-emittable | — | — | ✓ | ✓ |
| Cryptographically signable | — | — | digest | ✓ |
= AHTML
Each card below is a real Next.js route on this site. Click it to see the regular HTML view. Then append /ahtml/ to the URL to see the same data as a typed snapshot. Or fetch it with Accept: application/ahtml+text.
TypeScript schema + Next.js plugin + agent SDK + benchmark. The artifact you are looking at.
Port parser, validator, serializer, signer, and LSP to Rust via napi-rs and wasm-bindgen. 10×+ faster internals; same npm API.
Real .ahtml files. Chumsky parser. Tower-LSP server. Tree-sitter grammar. VS Code extension. Neovim + Helix + Zed via tree-sitter.
Component compilers (React / Solid / Svelte). Signed snapshots. Streaming + diff subscriptions. Hosted snapshot CDN with edge cache + agent-readiness scoring.
Full plan with risk register, prior art, and tech selections in PLAN.md.
Three files. Three minutes. Your existing app speaks the agent web.