Spaces:
Sleeping

app / README.md
sk1999's picture
deploy L1-D: aha surface (agent's-eye view, stakes hero, cached example audits)
5953557 verified
|
Raw History Blame Contribute Delete
5.5 kB
metadata
title: Legibl
emoji: πŸ€–
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 8000
pinned: false
license: mit

Legibl

CI

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 (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

pip install -e ".[dev]"     # dev extras: pytest, ruff, mypy
legibl --version

Requires Python 3.11+. Runtime deps: httpx, selectolax, pydantic, FastAPI, uvicorn.

CLI

# 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:

# 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)

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 and every check emits evidence and a fix. See 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

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. Changelog in CHANGELOG.md.