
Cornea, deterministic visual inspection
io.github.AbduljabbarBXR由 GitHub 账号 AbduljabbarBXR 发布v0.2.2更新于 Oct 24, 2026
Deterministic visual inspection for AI agents. Overlap, overflow, contrast, quality.
发布方自己的服务:Deterministic
概览
Cornea 为编程智能体提供确定性的 HTML 页面布局检查:重叠、溢出、WCAG 对比度与质量评分,且 token 消耗低。
- 可以做什么
- 对页面做完整视觉检查,返回紧凑的几何模型与报告
- 列出相互碰撞的元素框,以及被裁剪、塌陷或超出屏幕的元素
- 检查文本元素的 WCAG AA 对比度比值
- 给出 0 到 1 的布局健康分与问题清单
- 说明哪些 CSS 特性是精确计算、哪些只是近似
- 检查本地 HTML 文件或在线 URL,可选择先执行内联脚本
- 适用场景
- 适合智能体在编写或修改网页时验证布局,无需把截图或原始 DOM 塞进上下文,例如在编码循环中按指定视口宽度检查本地开发服务器页面。
- 运行要求
- 以本地 stdio 进程运行。可通过 cargo(需 Rust 工具链)安装,或使用提供 cornea 命令的 npm 包;Rust 构建不需要浏览器或 Node。未声明账号、API 密钥或环境变量。URL 抓取需要访问目标页面的网络;HTTPS 页面需要二进制未内置的 TLS 支持。
安装
在 SourceWeft 中
- 打开 控制台中的 Cornea, deterministic visual inspection,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Cornea
Deterministic visual inspection for AI agents. The eyes a coding agent never had.
Cornea gives a coding agent that builds web pages a real way to see them. As a token-cheap, deterministic structural model it can reason over exactly, instead of megabytes of screenshots and raw DOM dumped into context.
An agent doesn't need a photo of a page. It needs to know is my layout broken, and how. Cornea computes an abstract visual geometry model of every element (box, position, z-order, computed styles) and derives inspection conclusions. overlap, overflow, contrast, quality. Then exposes them as native tools on three surfaces: CLI, MCP, and HTTP API.
One promise holds everything together: same input → byte-identical output. No Chromium, no sub-pixel variance, no server. A single ~1.4 MB binary.
Quick start
Requires only
cargo. No browser, no Node, no system dependencies. Builds fine on a phone-class device.
Or install the cornea command from npm (no Rust toolchain needed):
Visual guide: what Cornea does
Take this page below. It looks fine as source. But it's hiding four layout bugs. Cornea finds every one.
Run it and Cornea reports the damage instantly:
Each finding is precise and actionable:
That is the value: hundreds of tokens, not hundreds of kilobytes, and a deterministic answer the agent can act on and re-verify.
Visual guide: the three surfaces
Cornea is one engine, three doors. All three returns identical inspection JSON because they funnel through a single shared dispatch.
1. CLI. Inspect a file
2. MCP. Native agent tools over stdio
An agent calls layout.* tools directly; it passes the page source, or a
live URL (see URL capture below), per call:
3. HTTP API. Call from anything
Watching a live page (URL capture)
Every surface accepts a URL where the HTML would go. Cornea fetches the page, inlines its external stylesheets and external scripts (relative URLs resolved against the page), then inspects what a browser would actually show. That is the live coding session loop: run your dev server, point cornea at it, read the layout verdict.
Honesty around capture:
- Failed fetches leave the original tag in place and record a note, so the report warnings still flag what did not load.
- A positive
heightemulates a fixed viewport (screenshot frame, iframe, email) and enables below the fold clipping checks. Default 0 means an unbounded scrolling page. - Capture is a snapshot in time. Determinism holds engine side: the same fetched bytes always produce the same report.
- Plain HTTP is supported natively. HTTPS pages need a TLS stack, which the binary does not carry; capture from a local http dev server or pre inline the page with a fetch layer of your own.
Architecture
Read the full technical spec: CORNEA-ARCHITECTURE.md
Fidelity. Honest about what's approximate
Cornea never silently fakes precision. layout.fidelity tells an agent exactly what it can trust, and every report carries its own warnings for sources the engine saw but did not apply (external stylesheets, external scripts, media queries, unresolved colors):
JavaScript built-in pages (Phase A)
Cornea can execute inline <script> that builds its DOM via a minimal shim,
then run the result through the same deterministic layout engine:
- Static HTML is mirrored into the shim before scripts run, so scripts can
attach to existing nodes via
document.getElementById, andinnerHTMLparses real markup into elements. Static content survives script runs. style.*assignments are serialized back tostyle="…"and participate in overlap/contrast checks.- Async APIs are rejected (
setTimeout,fetch, …) rather than hung. Any such use is surfaced in the report'sjs_notes, so determinism stays a guarantee. - External
<script src>runs only when a capture layer (URL capture) inlined its body first. - Full React/SPA mounting is Phase B (experimental). Tracked in
ROADMAP-JS.md.
Visual guide: testing (battle-tested)
54 tests run clean with cargo test; CI enforces fmt, clippy -D warnings, release build, tests, and a CLI smoke test on every push.
- Determinism. Same page inspected twice gives byte-identical JSON (the core thesis).
- Bug detection. The fixture's overlaps, overflows, and contrast failures are all asserted.
- End-to-end. The compiled binary is spawned and
layout.*is called over real stdio MCP. - HTTP. The TCP server boots on an ephemeral port and real requests are made.
- Live capture. A real page is served over a local socket; linked CSS must change a contrast verdict.
- Edge cases. Empty HTML, deep nesting (no crash),
display:none, long text, flex row/col, inline wrapping.
Layout support (v1 scope)
Repository layout
Status
Working MVP, hardened and battle-tested. Deterministic inspection engine with CLI + MCP + HTTP API, live URL capture, below the fold checks, report warnings, 54 passing tests, green CI, plus Phase A inline-script rendering (--js). The roadmap builds toward giving Cornea (and the sibling Crayon text-to-image project) an even richer perception over subsequent phases.
Publishing
Cornea is distributed four ways: npm (npm install -g optrex, gives the cornea command), crates.io (cargo install cornea), GitHub Release + Homebrew (brew install), and the MCP Registry (layout.* tools discoverable by agents). All are staged in this repo. See PUBLISHING.md for the tokens, server.json manifest, and the release/tag recipe.
mcp-name: io.github.AbduljabbarBXR/cornea
License
MIT. See LICENSE.
来源:README.md,提交 97cae15
工具
0版本历史
1- v0.2.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
其他 Deterministic 集成
Deterministic
sh.deterministic官方发布者
一个远程 MCP 服务器,让助手对仿真结果进行基于物理的校验,并返回带有逐项检查结论的回执。
EU EN-16931 & XRechnung Deterministic Validator
eu.iotpay
远程 MCP 端点,用于校验 EN 16931 与 XRechnung 电子发票 XML,并签发 Ed25519 签名的可验证凭证。

Website Change Monitor & Deterministic Diff
由 GitHub 账号 industrial-platform-ai 发布
付费远程 MCP 服务,用于检测公开网页的确定性变化,返回哈希与文本差异,适合周期性监控。

SQAI — deterministic, read-only structured data
由 GitHub 账号 thyn-ai 发布
本地 stdio MCP 服务器,为助手提供受治理、确定性、只读的结构化数据查询与计算工具,可读取 CSV 等数据源。

Deterministic
由 GitHub 账号 archradhq 发布
ArchRAD Deterministic 用确定性规则校验架构图(IR),可从代码仓库草拟 IR,并检查设计与实际代码的偏差。