v0.4.0 — May 2026 · MIT

The HTML of the agent web.

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.

5packages under @ahtmljs/*
1shared schema · server adapters · agent + RAG clients
0migration — your existing pages, routes, and APIs are untouched
This page also serves/ahtml (compact)/ahtml (json)/ahtml/mcp.json/ahtml/openapi.json/llms.txt/.well-known/ahtml.json
Live · agent view of this page

This is what the agent actually reads.

Same page. Same content. One serialization for browsers, one for agents. Generated by the live toCompact() in @ahtmljs/schema.

1,507bytes56lines
@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

This page as HTML

~28,400 bytes
The chrome an agent has to skim past.

This snapshot

1,507 bytes
18.8× smaller — and includes typed actions HTML never had.
The problem

The agent web's HTML problem.

01 — Tokens

Massive semantic noise.

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.

02 — Meaning

Intent is implicit.

Schema.org describes what something is. It does not describe what you can do with it — cost, reversibility, side effects, auth, freshness. Agents guess.

03 — Safety

No action contract.

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.

The solution

One source. Every protocol downstream.

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.

AHTML architecture: your page (Next.js, Vite, SvelteKit, Astro, Nuxt, Remix) compiles through the @ahtmljs/next plugin into five outputs — HTML for browsers, /ahtml/* compact + JSON for agents (~100× cheaper), /ahtml/mcp.json for Claude, ChatGPT, Gemini, Cursor, Copilot, /ahtml/openapi.json for REST clients and codegen, and /llms.txt for Cursor, Continue, Cline.
One source · one plugin · zero migration. Every consumer below gets its native format.
Benchmark · live, from this page

The receipts.

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.

FormatBytesBytes (gzip)Tokens o200kTokens Claude× smaller (tokens, o200k)
HTML (server-rendered)28,4006,2406,8106,4121.0×
llms.txt47636114715846×
AHTML compact1,50777550251214×
AHTML JSON (pretty)1,72883550854213×
HTML (server-rendered)
6,810
o200k tokens
6,412
Claude tokens
28,400
bytes
6,240
bytes gzip
llms.txt
46× smaller
147
o200k tokens
158
Claude tokens
476
bytes
361
bytes gzip
AHTML compact
14× smaller
502
o200k tokens
512
Claude tokens
1,507
bytes
775
bytes gzip
AHTML JSON (pretty)
13× smaller
508
o200k tokens
542
Claude tokens
1,728
bytes
835
bytes gzip

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 packages

Seven packages, one contract.

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.

Contract layer · npm

@ahtmljs/schema

The canonical snapshot schema. Everything else depends on it.

For: Anyone authoring or validating AHTML — server, client, or tooling.

  • ·TypeScript types + JSON Schema + builder + validator + linter
  • ·Dual serializers — token-optimal compact text and lossless JSON
  • ·Deterministic ETags, structural diffing, and apply-patch helpers
  • ·Document.chunks primitive — byte ranges and stable IDs for RAG
$ npm install @ahtmljs/schema
import { snapshot, toCompact, lint } from '@ahtmljs/schema';

Quickstart flow for @ahtmljs/schema

Adapter layer · npm

@ahtmljs/next

Next.js plugin. One route, every well-known endpoint.

For: App Router or Pages Router sites on Next 14+ that want agent traffic.

  • ·Single route emits AHTML compact + JSON, MCP, OpenAPI 3.1, JSON-LD, llms.txt
  • ·Auto-discovers routes; no need to maintain a separate manifest
  • ·q-value Accept negotiation, ETag/If-None-Match, ?since=<etag> diffs
  • ·Token-bucket policy enforcement at the edge
$ npm install @ahtmljs/next
import { createAHTMLRoute } from '@ahtmljs/next/handler';

Quickstart flow for @ahtmljs/next

Adapter layer · npm

@ahtmljs/vite

Vite plugin. Same bytes as the Next adapter, every Vite framework.

For: SvelteKit, SolidStart, Astro, Remix, or vanilla Vite projects.

  • ·Mounts the well-known + /ahtml/* routes as Vite middleware
  • ·Byte-identical output to @ahtmljs/next — cross-framework parity is real
  • ·Serves /ahtml/openapi.json + /ahtml/mcp.json out of the box
  • ·One line in vite.config.ts; Vite 5+ peer dep
$ npm install @ahtmljs/vite
import { ahtml } from '@ahtmljs/vite';

Quickstart flow for @ahtmljs/vite

Consumer layer · npm

@ahtmljs/agent

Client SDK for AI agents that consume AHTML sites.

For: Anyone building an agent, scraper, or automation that calls AHTML endpoints.

  • ·Typed fetch + ETag cache; validates server snapshots before they enter the cache
  • ·Structured runAction() with auth, cost, reversibility, and confirmation gates
  • ·Dry-run mode that never hits execute_url even under adversarial overrides
  • ·Optional tokenizer adapters (OpenAI o200k_base, Anthropic) for real-cost reporting
$ npm install @ahtmljs/agent
import { AHTMLClient } from '@ahtmljs/agent';

Quickstart flow for @ahtmljs/agent

Consumer layer · npm

@ahtmljs/langchain

LangChain.js document loader. URL → embeddings in three lines.

For: RAG pipelines, vector stores, and retrieval chains on LangChain.js.

  • ·Returns LangChain Document[] preserving Document.chunks as separate records
  • ·Citation anchors, byte ranges, and source URLs in per-chunk metadata
  • ·No re-chunking — splits at server-declared boundaries deterministically
  • ·@langchain/core 0.3+ peer dep
$ npm install @ahtmljs/langchain
import { AHTMLLoader } from '@ahtmljs/langchain';

Quickstart flow for @ahtmljs/langchain

Adapter layer · npm

@ahtmljs/hono

Hono adapter. The same emitter on every JavaScript runtime.

For: Hono apps on Node, Bun, Deno, Cloudflare Workers, or AWS Lambda.

  • ·Mounts the well-known + /ahtml/* routes on any Hono app
  • ·Byte-identical output to the Next and Vite adapters — true parity
  • ·Runs on Node, Bun, Deno, Cloudflare Workers, and AWS Lambda
  • ·One line; Hono 4+ peer dep
$ npm install @ahtmljs/hono
import { ahtml } from '@ahtmljs/hono';

Quickstart flow for @ahtmljs/hono

Tooling layer · npm

@ahtmljs/cli

ahtml doctor. Validate the whole discovery chain from CI.

For: Anyone shipping AHTML who wants the discovery chain checked on every build.

  • ·Walks /.well-known/ahtml.json → snapshot → MCP → OpenAPI → llms.txt
  • ·Validates each endpoint against the AHTML lint rules
  • ·Exits non-zero on failure — wire it straight into CI
  • ·Zero-config; reads the site like an agent would
$ npm install -g @ahtmljs/cli
$ ahtml doctor https://example.com

Quickstart flow for @ahtmljs/cli


The dependency graph: schemanext / vite (emit) · schemaagent / langchain (consume). One contract on both sides of the wire.

Quickstart

Pick a package. Follow three steps.

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.

Step 01 · npm

Install

npm install @ahtmljs/next @ahtmljs/schema
Step 02 · next.config.mjs

Wrap next.config

import { withAHTML } from '@ahtmljs/next';

export default withAHTML({}, {
  site: 'https://shop.com',
  policy: { agents_welcome: true },
});
Step 03 · app/ahtml/[[...path]]/route.ts

Add the route

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.jsonauto-generated MCP tools manifest
  • /ahtml/openapi.jsonauto-generated OpenAPI 3.1 document
  • /.well-known/ahtml.jsonsite-wide discovery manifest
  • /llms.txtcompatibility shim for Cursor / Continue / Cline
What you get

One plugin. Nine outputs.

01

MCP, emitted

Your snapshot's actions become MCP tool definitions at /ahtml/mcp.json. No separate MCP server.

02

OpenAPI, emitted

Actions with execute_url become full OpenAPI 3.1 operations. Codegen-ready.

03

JSON-LD, ingested

Existing schema.org blocks become a Level-0 snapshot with zero developer work.

04

llms.txt, shimmed

Auto-emit a clean llms.txt from registered routes. Free interop with Cursor / Continue / Cline.

05

ETag + diff

Conditional GET via If-None-Match. ?since=<etag> returns just the change list.

06

Content negotiation

Compact text for LLMs by default. Canonical JSON for signing and programmatic clients.

07

Typed actions

Every action carries auth, cost, reversibility, side effects, and confirmation level.

08

Policy enforcement

Token-bucket rate limit at the edge. Sites stay in control of what agents can do.

09

Provenance

Snapshots can be signed against a did:web identity (v0.2). Agents detect tampering.

Where AHTML fits

Above llms.txt. Below MCP. Beside schema.org.

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.

HTMLllms.txtAHTML compactAHTML JSON
Token efficiency for agentsbaselinegoodbestgood
Typed entitiesimplicittext only
Typed actionsimplicittext only
Cost / reversibility
Side-effect declarations
Site-wide policypartial
Freshness / TTL
Conditional fetch (ETag)partial
Pagination semantics
MCP-emittable
OpenAPI-emittable
Cryptographically signabledigest
Token efficiency for agents
HTML
baseline
llms.txt
good
AHTML compact
best
AHTML JSON
good
Typed entities
HTML
implicit
llms.txt
text only
AHTML compact
AHTML JSON
Typed actions
HTML
implicit
llms.txt
text only
AHTML compact
AHTML JSON
Cost / reversibility
HTML
llms.txt
AHTML compact
AHTML JSON
Side-effect declarations
HTML
llms.txt
AHTML compact
AHTML JSON
Site-wide policy
HTML
llms.txt
partial
AHTML compact
AHTML JSON
Freshness / TTL
HTML
llms.txt
AHTML compact
AHTML JSON
Conditional fetch (ETag)
HTML
partial
llms.txt
AHTML compact
AHTML JSON
Pagination semantics
HTML
llms.txt
AHTML compact
AHTML JSON
MCP-emittable
HTML
llms.txt
AHTML compact
AHTML JSON
OpenAPI-emittable
HTML
llms.txt
AHTML compact
AHTML JSON
Cryptographically signable
HTML
llms.txt
AHTML compact
digest
AHTML JSON

= AHTML

Live demo

Four products. Eight endpoints each.

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.

Roadmap

Where this goes.

P0 · shipping now

Phase 0 — Prototype

TypeScript schema + Next.js plugin + agent SDK + benchmark. The artifact you are looking at.

P1 · months 4–9

Phase 1 — Rust core

Port parser, validator, serializer, signer, and LSP to Rust via napi-rs and wasm-bindgen. 10×+ faster internals; same npm API.

P2 · months 6–12

Phase 2 — .ahtml language

Real .ahtml files. Chumsky parser. Tower-LSP server. Tree-sitter grammar. VS Code extension. Neovim + Helix + Zed via tree-sitter.

P3 · months 10–18

Phase 3 — Ecosystem & SaaS

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.

Ship it

Your next visitor might be Claude.

Three files. Three minutes. Your existing app speaks the agent web.

$npm install @ahtmljs/next
Score your site firstCompare to llms.txtNext.js guide
MIT licensed · zero migration · v0.1 May 2026
Made byDibbayajyoti Roy