--- title: Legibl emoji: "🤖" colorFrom: blue colorTo: indigo sdk: docker app_port: 8000 pinned: false license: mit --- # Legibl [![CI](https://github.com/legiblhq/legibl/actions/workflows/ci.yml/badge.svg)](https://github.com/legiblhq/legibl/actions/workflows/ci.yml) **Make your website legible to AI agents.** Point Legibl at a domain and it crawls the site, scores its **agent-readiness** honestly, and generates the machine-facing artifacts agents need — an **`llms.txt`**, a **markdown mirror**, and **schema.org JSON-LD** suggestions — plus a prioritized fix list. *Legibl **measures and generates** agent readiness. Where most scanners check *which protocols a site exposes*, Legibl also scores whether an agent can actually **read and use** your content — then **generates the fixes** (a real `llms.txt`, a markdown mirror, JSON-LD), not just a checklist. It's an independent, open implementation of the [AgentReady standard](https://www.agentready.org) (agentready.org) — not affiliated with that project.* > Status: **0.2.0 (alpha)** — a ground-up v2 rework. ## What it does 1. **Crawl** — polite, same-origin crawl with an **SSRF-safe** fetcher, a `robots.txt` **AI-bot access matrix** (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, CCBot, Bingbot, …), and sitemap discovery. 2. **Extract** — `selectolax` parse with **main-content isolation** and a full block model (headings, paragraphs, lists, tables, code, quotes) plus render-mode detection (is the content there without running JS?). 3. **Score** — an honest **Agent-Readiness Score (0–100)** across **Access, Renderability, Structure, Meaning, and Machine artifacts**. Access is a **gate**: a great page that blocks AI crawlers scores near zero. 4. **Generate** — `llms.txt`, a per-page markdown mirror + index, JSON-LD suggestions, and a manifest with per-page source hashes. Two ways to run the same core: a **CLI/library** and a **FastAPI** hosted audit. ## Install ```bash pip install -e ".[dev]" # dev extras: pytest, ruff, mypy legibl --version ``` Requires Python 3.11+. Runtime deps: httpx, selectolax, pydantic, FastAPI, uvicorn. ## CLI ```bash # Audit a site and print a report legibl audit --url https://example.com --pages 10 # Write artifacts (llms.txt, markdown mirror, JSON-LD, manifest) + audit.json legibl audit --url https://example.com --out ./out # Machine-readable output legibl audit --url https://example.com --json ``` ### Use in CI (gate + drift) Turn agent-readiness into a check that blocks merges, the same way linters do — any non-zero exit fails the build: ```bash # Fail the build if the score drops below 80 legibl audit --url https://staging.example.com --fail-under 80 # Baseline now, then fail if a later run regresses (score, checks, or AR conformance) legibl audit --url https://example.com --out ./baseline legibl audit --url https://example.com --baseline ./baseline/audit.json --fail-on-regression ``` ## Hosted audit (web app + API) ```bash legibl serve --port 8000 # then open http://127.0.0.1:8000 # or docker compose up --build ``` API: `POST /api/audits {url, pages}` → job id; `GET /api/audits/{id}` → status + result; `GET /api/audits/{id}/artifacts.zip` → all artifacts; `GET /healthz`. The hosted path always runs with SSRF protection on and per-IP rate limiting. ## Scoring Deterministic and transparent — weights live in a versioned [`scorespec.json`](src/legibl/score/scorespec.json) and every check emits evidence and a fix. See [`docs/scoring.md`](docs/scoring.md) for the calibration notes (why a site scores what it does, and why Access is a gate). ## Layout ``` src/legibl/ contracts/ # pydantic models (PageDoc, SiteDoc, CrawlResult, Check, SiteAudit, Artifact, ScoreSpec, JobEvent) crawl/ # SSRF-safe fetch, robots AI-bot matrix, sitemap, frontier, crawler extract/ # selectolax parse, block model, markdown mirror, render-mode score/ # checks + engine + scorespec.json artifacts/ # llms.txt, markdown mirror, JSON-LD, manifest service/ # audit orchestration (crawl -> score -> artifacts) api/ # FastAPI job API + static UI cli.py eval/ # labeled extraction eval + F1 gate scripts/ # benchmark fixtures/sites # perfect, js-shell, blocked, legacy-messy, docs-site tests/ # pytest (crawl/extract/score/artifacts/service/api/eval) ``` ## Development ```bash make test # pytest make lint # ruff make typecheck # mypy make eval # extraction precision/recall + F1 gate make benchmark DOMAINS="example.com python.org" ``` ## Security The fetcher validates every resolved IP against private/loopback/link-local/ reserved/metadata ranges on each redirect hop, so hosting the audit does not turn it into an internal-network scanner. Only audit domains you own or are authorized to scan. ## Not yet (roadmap) Optional JS-render path (Playwright), visibility monitoring across assistants, multi-tenant billing/auth, CMS plugins, and the MCP action layer. Deferred until the hosted audit is proven — see the implementation plan. ## License [MIT](LICENSE). Changelog in [CHANGELOG.md](CHANGELOG.md).