diff --git a/AGENTS.md b/AGENTS.md
index 7f82ea0..17c90a6 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -2,7 +2,7 @@
> Static site for aienos.com. One Rust program, `crates/site-builder`, renders every page from Maud templates, copies hand-written files from `public/`, then rewrites every head and writes the machine surface. GitHub Pages serves the output; `.github/workflows/pages.yml` builds and deploys it on every push to `main`.
-Shared rules: read https://www.aienos.com/agents/RULES.md first. This file adds what is specific to this repository; where the two differ, this file wins here. The rules live in `public/agents/RULES.md`; every public repository is listed at https://www.aienos.com/agents/ (`components/agents.rs`, data refreshed by `site-builder agents`). The catalog follows every GitHub API page, includes archived repositories as read-only references, and links the actual `AGENTS.md` or `CLAUDE.md` when present. Missing instructions are marked explicitly. AienOS is the whole system at its current `aien-dev/aienix` URL until renamed; aienux is the separate kernel.
+Shared rules: read https://www.aienos.com/agents/RULES.md first. This file adds what is specific to this repository; where the two differ, this file wins here. The rules live in `public/agents/RULES.md`; every public repository is listed at https://www.aienos.com/agents/ (`components/agents.rs`, data refreshed by `site-builder agents`). The catalog follows every GitHub API page, includes archived repositories as read-only references, and links the actual `AGENTS.md` or `CLAUDE.md` when present. Missing instructions are marked explicitly. Sovereign Intelligence (SI) is the whole system. AienOS is only the operating-system layer. aienux is the kernel. `aien-dev/aienix` is retired and is not the core tree or the entry point. `aien-dev/sovereign-intelligence` is where releases are assembled, install starts, and the signed Spark test runs. Other repositories keep their own parts.
## Scope
@@ -78,7 +78,7 @@ Open `http://127.0.0.1:8080/` after the preview server starts. GitHub Pages serv
- Voice: Drake writes this site alone, in first person singular (I, me, my). Never a plural first-person word (the list is the regex in `voice::plural`). Where agents did the work, say so ("my agents", "I build this with AI agents"); never credit Drake with an agent's work, and never imply a team. Shared human claims use "everyone" or "people". `components::voice::verify_singular_voice` fails the build on any plural first-person word in rendered `dist` text (`.html` visible text, `.md`, `.txt`). Not counted: markup, scripts, styles, link targets, path/identifier parts (`how-we-did-it`), `50 us`, and on the ledger pages (`voice::LEDGER_PAGES`) text found verbatim in `data/now.tsv`, which is a dated record. Quotes of other people go in `voice::ALLOW` as (file, exact phrase); keep it small. Repository descriptions render on /agents/, so fix the GitHub description, not just `agent-repos.json`.
- Names and headings: headings are sentence case; titles of works, job titles and nav section names keep their own casing. Visible copy uses one spelling per name:
- Aien, for both the assistant and the project. "Allen" was the assistant's old name and "AIEN" the project's old spelling.
- - AienOS, aienux (the kernel), aienix (the core tree), aienos.com, Omega and CUDA++.
+ - Sovereign Intelligence (SI) for the whole system, AienOS for the operating-system layer only, aienux (the kernel), aienos.com, Omega and CUDA++. aienix is the retired repository name, not the core tree.
- GitHub, NVIDIA, WebAssembly, iMac, Zenodo, OpenCL, PoCL, SPIR-V, UEFI, DGX, GB10, Qwen, and X (formerly Twitter).
`components::names::verify_canonical_names` fails the build on any other spelling in rendered `.html` copy. It does not check:
@@ -90,7 +90,7 @@ Open `http://127.0.0.1:8080/` after the preview server starts. GitHub Pages serv
- the phrases in `names::ALLOW`: published paper titles ("The AIEN Papers", "The Atemporal AIEN Postulate", "...Emerging from AIEN") and the CI check "AIEN Verification".
Add to `ALLOW` only for a published title or a record, never for copy.
-- Copy rules: no em dashes, no en dashes, no outside fonts or unconditional third-party scripts/trackers. The sole tracking exception is X pixel `rfrlz`, loaded from the first-party `public/js/allen-intro.js` only after explicit consent to the Aien introduction. Never embed `uwt.js` as a script source in HTML, inline its bootstrap, or preconnect/prefetch X hosts. The verifier rejects outside script sources on every emitted HTML page; `node scripts/test-allen-intro.cjs` exercises refusal, consent, reload and revocation.
+- Copy rules: no em dashes, no en dashes, no outside fonts or unconditional third-party scripts/trackers. Comparisons with other projects are allowed when they are honest, dated, and backed by a receipt or the other project's own published numbers. Overclaims stay banned (for example, a claim to be a replacement for CUDA, or to give everything CUDA gives you). The sole tracking exception is X pixel `rfrlz`, loaded from the first-party `public/js/allen-intro.js` only after explicit consent to the Aien introduction. Never embed `uwt.js` as a script source in HTML, inline its bootstrap, or preconnect/prefetch X hosts. The verifier rejects outside script sources on every emitted HTML page; `node scripts/test-allen-intro.cjs` exercises refusal, consent, reload and revocation.
- Keep one source for machine-readable state. `status.json`, the status section, and the current-state lines in `llms.txt` all read `components::status::layer_states()`.
- Tests live beside the code in `#[cfg(test)]` modules. Add a test when a rule can regress silently.
- The final shared `components::allen_intro::enrich` pass in `seo::enrich` adds one local consent loader, a native modal dialog and a privacy link to generated, hand-written and translated pages. `404.html` gets the same pass. `/privacy/` stays readable without an automatic modal and provides review and refusal controls. No and Escape persist refusal, with no automatic re-prompt. Stored Yes permits one initialization per document; refusal of an active pixel reloads without it. Local storage holds the choice; a session-storage refusal and `#allen-intro-no` protect reload if persistent storage fails. Storage clearing or another browser resets the choice, not consent.
diff --git a/README.md b/README.md
index 0c65727..830e92f 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
The source of the AienOS website. A Rust program builds the pages, GitHub Pages serves their origin, and the existing nginx edge adds Markdown negotiation and the opt-in live Hive feed.
-Part of [Aienix](https://github.com/aien-dev/aienix), the core tree of AIEN: start there for what the project is and how the pieces fit.
+Part of [Sovereign Intelligence](https://github.com/aien-dev/sovereign-intelligence), the whole system: releases are assembled there, install starts there, and the signed Spark test runs there. AienOS is only the operating-system layer. [aienix](https://github.com/aien-dev/aienix) is retired. Other repositories keep their own parts.
Live: [https://www.aienos.com](https://www.aienos.com), rebuilt hourly from the repository's own facts.
diff --git a/crates/site-builder/data/cudaplusplus.json b/crates/site-builder/data/cudaplusplus.json
index 1adb9d3..3db35f9 100644
--- a/crates/site-builder/data/cudaplusplus.json
+++ b/crates/site-builder/data/cudaplusplus.json
@@ -75,7 +75,7 @@
"cuda": "nothing: left to you",
"ours": "The motor, the ++ in CUDA++: one schedule built before anything runs, movement engines that check every weight part, and the stroke, many conversations on one read of the weights.",
"status": "PASS",
- "note": "live on port 18091; 1.80x to 1.98x the same conversations taken in turn; on branches, not on omega main yet",
+ "note": "On 2026-10-21, live on port 18091; a factor of 1.80 to 1.98 over the same conversations taken in turn (https://github.com/aien-dev/aien-sovereign-core-mv/tree/9c62690a252ab1c0b75eb8933c550316b5c50d52/evidence/q36-batch-20261021); on branches, not on omega main yet",
"links": [["the motor on /omega/", "/omega/#motor"], ["design", "om@:89aad7c99b4fced80f92b656d2a3f350699456f0/docs/OMEGA.md#6-cuda-the-motor"]],
"box": "sc@/:9c62690a252ab1c0b75eb8933c550316b5c50d52/evidence/q36-batch-20261021"
},
diff --git a/crates/site-builder/data/machines.json b/crates/site-builder/data/machines.json
index 6c0e82e..6936b7d 100644
--- a/crates/site-builder/data/machines.json
+++ b/crates/site-builder/data/machines.json
@@ -1,7 +1,7 @@
{
"as_of": "2026-10-19",
"source": "Spark ~/handoffs/2026-10-19-site-inventory.md and .json (ledger L057). Every row carries a public link; a fact without a link is not on the page.",
- "judging": "Every number on this page is judged against two things only: the physical ceiling of the machine it ran on, and my own previous run. Nothing here is compared with anyone else's software. End to end means wall time through the server as a client sees it, prompt reading included. Chip time means the GPU's own time per generated token, decode only, with prompt reading excluded. For the 35B, the gap between chip time and end-to-end time comes from prompt reading. The two are labelled and never mixed.",
+ "judging": "Every number on this page is judged against the physical ceiling of the machine it ran on, and against my own previous run. A comparison with another project is allowed when it is honest, dated, and backed by a receipt or that project's own published numbers. Overclaims stay off this page. End to end means wall time through the server as a client sees it, prompt reading included. Chip time means the GPU's own time per generated token, decode only, with prompt reading excluded. For the 35B, the gap between chip time and end-to-end time comes from prompt reading. The two are labelled and never mixed.",
"ceilings": [
{
"id": "qwen38-27b-fp8-gb10",
diff --git a/crates/site-builder/src/collector.rs b/crates/site-builder/src/collector.rs
index 4a45dd1..4395536 100644
--- a/crates/site-builder/src/collector.rs
+++ b/crates/site-builder/src/collector.rs
@@ -74,8 +74,10 @@ const EXCLUDED_DIRS: &[&str] = &[
"vendor", "vendored", "third_party", "third-party", "node_modules", "target", "dist", "build", "generated",
"evidence", "receipts", "artifacts", "data", "results", "fixtures",
];
-/// `aienux` is the kernel; `aienos` is the whole system (today GitHub's aien-dev/aienix). Once
-/// that repository is renamed aienos, the name rule reads it as its own Core project.
+/// `aienux` is the kernel. A repository named `aienos` is still read as its own
+/// Core project. ADR 0045 retired aien-dev/aienix: it is not the core tree.
+/// Sovereign Intelligence (aien-dev/sovereign-intelligence) is the whole system,
+/// and AienOS is only the operating-system layer.
const CORE_NAMES: &[&str] = &["aien-sovereign-core", "aienux", "aienos", "omega", "physics", "forge", "atlas", "aien-protocols", "aien-architecture", "benchmarks"];
const SITE_NAMES: &[&str] = &["aienos.com", "drakestapleton.com", "interplane.io", ".github", "aien-dev"];
@@ -1512,8 +1514,10 @@ mod tests {
}
#[test]
- fn the_kernel_and_the_whole_system_are_two_projects() {
- // aien-dev/aienix is renamed aienos (the whole system) while aienux stays the kernel.
+ fn the_kernel_and_a_repository_named_aienos_are_two_projects() {
+ // A repository named aienos is its own Core project beside the kernel.
+ // ADR 0045 retired aien-dev/aienix. This snapshot does not treat that
+ // repository as the whole system.
let mut rows = LISTING_2026_10_17.to_vec();
rows.push("aien-dev aienos - -");
let (targets, missing) = select_repos(&listing(&rows));
diff --git a/crates/site-builder/src/components/agents.rs b/crates/site-builder/src/components/agents.rs
index 28afb78..3d486ea 100644
--- a/crates/site-builder/src/components/agents.rs
+++ b/crates/site-builder/src/components/agents.rs
@@ -43,7 +43,7 @@ pub const TOUR: &[(&str, &[(&str, &str, &str)])] = &[
("/llms.txt", "llms.txt", "every page with a one-line description, the place to start"),
("/llms-full.txt", "llms-full.txt", "the full text of every page in one file"),
("/sitemap.md", "sitemap.md", "every page grouped by section"),
- ("/start/", "Start here", "the shortest route: what AienOS is, what exists today and how to check it"),
+ ("/start/", "Start here", "the shortest route: Sovereign Intelligence is the whole system, AienOS is only the operating-system layer, and here is how to check a claim"),
]),
("What I build", &[
("/omega/", "Omega", "the language for all computing, GPU to CPU"),
@@ -192,8 +192,9 @@ fn gather_from_pages(
break;
}
}
+ let description = if name == "aienix" { AIENIX_NOTE.to_string() } else { s(v, "description") };
repos.push(Repo {
- description: s(v, "description"),
+ description,
url: s(v, "html_url"),
fork: v.get("fork").and_then(|x| x.as_bool()).unwrap_or(false),
archived: v.get("archived").and_then(|x| x.as_bool()).unwrap_or(false),
@@ -224,13 +225,19 @@ pub fn prompt(repo_url: &str) -> String {
)
}
+/// Site-owned note for the retired repository. GitHub's description can still
+/// call it a front door; the page and the collected catalog do not.
+pub const AIENIX_NOTE: &str = "Retired. It is not the core tree or the entry point. Sovereign Intelligence (aien-dev/sovereign-intelligence) is the whole system: releases are assembled there, install starts there, and the signed Spark test runs there. AienOS is only the operating-system layer. Other repositories keep their own parts.";
+
fn repo_card(r: &Repo) -> Markup {
html! {
li class="hub-card agents-card" id=(format!("repo-{}", r.name)) {
a href=(r.url) target="_blank" rel="noopener noreferrer" {
@match r.name.as_str() {
- "aienix" | "aienos" => { "AienOS (whole system)" }
+ "sovereign-intelligence" => { "Sovereign Intelligence (whole system)" }
+ "aienix" => { "aienix (retired)" }
"aienux" => { "aienux (kernel)" }
+ "AienOS-nv" => { "AienOS (operating system)" }
_ => { span data-verbatim { (r.name) } }
}
}
@@ -240,8 +247,10 @@ fn repo_card(r: &Repo) -> Markup {
@if r.fork {
p class="agents-tag" { "Fork" }
}
- @if !r.description.is_empty() {
- p data-verbatim { (r.description) }
+ @if r.name == "aienix" {
+ p { (AIENIX_NOTE) }
+ } @else if !r.description.is_empty() {
+ p class="agents-verbatim" data-verbatim { (r.description) }
}
@match r.brief_url() {
Some(href) => {
@@ -386,6 +395,7 @@ mod tests {
repo("omega-mv", Some("AGENTS.md"), "2026-10-25T18:00:00Z"),
repo("translate", Some("CLAUDE.md"), "2026-10-24T18:00:00Z"),
repo("aien-edge", None, "2026-10-22T18:00:00Z"),
+ repo("sovereign-intelligence", Some("AGENTS.md"), "2026-10-26T18:00:00Z"),
repo("aienix", Some("AGENTS.md"), "2026-10-23T18:00:00Z"),
],
}
@@ -399,7 +409,7 @@ mod tests {
assert!(page.contains(">CLAUDE.md on GitHub"));
assert!(!page.contains("aien-edge/blob/main/AGENTS.md"), "a brief that does not exist is never linked");
assert!(page.contains("No AGENTS.md or CLAUDE.md yet"));
- assert_eq!(crate::components::boxlink::check_boxes(&page), Ok(5), "the rules box and every listed repository have a GitHub link");
+ assert_eq!(crate::components::boxlink::check_boxes(&page), Ok(6), "the rules box and every listed repository have a GitHub link");
}
#[test]
@@ -426,9 +436,25 @@ mod tests {
#[test]
fn whole_system_keeps_its_real_url_and_current_label() {
let page = render_agents_page(&sample()).into_string();
- assert!(page.contains("href=\"https://github.com/aien-dev/aienix\""));
- assert!(page.contains("AienOS (whole system)"));
- assert!(page.contains("4 public repositories, 3 with their own instructions"));
+ assert!(page.contains("href=\"https://github.com/aien-dev/sovereign-intelligence\""));
+ assert!(page.contains("Sovereign Intelligence (whole system)"));
+ assert!(page.contains("aienix (retired)"));
+ assert!(page.contains(AIENIX_NOTE));
+ assert!(!page.contains("AienOS (whole system)"));
+ assert!(!page.contains("aienix does a thing"), "a stale front-door description is not shown");
+ assert!(page.contains("5 public repositories, 4 with their own instructions"));
+ }
+
+ #[test]
+ fn aienix_catalog_description_is_the_retirement_note() {
+ let pages = serde_json::json!([[{
+ "name": "aienix",
+ "description": "AienOS front door: pinned repositories",
+ "html_url": "https://github.com/aien-dev/aienix",
+ "default_branch": "main"
+ }]]);
+ let repos = gather_from_pages(&pages, |_, _, _| Ok(false)).unwrap();
+ assert_eq!(repos.repos[0].description, AIENIX_NOTE);
}
#[test]
diff --git a/crates/site-builder/src/components/agents_knowledge.rs b/crates/site-builder/src/components/agents_knowledge.rs
index d9cc052..276977b 100644
--- a/crates/site-builder/src/components/agents_knowledge.rs
+++ b/crates/site-builder/src/components/agents_knowledge.rs
@@ -133,9 +133,10 @@ pub fn render_agents_knowledge_page() -> Markup {
section class="hub-section" id="verification-and-evidence" aria-labelledby="evidence-title" {
h2 id="evidence-title" class="hub-h2" { "How to verify claims" }
p {
- "AienOS adheres to strict verification doctrine: no claim without a public receipt. "
- "Speeds are never compared to arbitrary claims from other labs. Every measurement stands "
- "strictly beside the physical ceiling of that machine."
+ "Sovereign Intelligence is the whole system, and AienOS is only the operating-system layer. No claim without a public receipt. "
+ "A comparison with another project is allowed when it is honest, dated, and backed by a receipt "
+ "or that project's own published numbers. Overclaims stay banned. Every measurement stands "
+ "beside the physical ceiling of that machine."
}
ul class="agents-tour" {
li {
diff --git a/crates/site-builder/src/components/evidence.rs b/crates/site-builder/src/components/evidence.rs
index 2272c1d..a8c46d7 100644
--- a/crates/site-builder/src/components/evidence.rs
+++ b/crates/site-builder/src/components/evidence.rs
@@ -197,10 +197,8 @@ mod tests {
for must in ["7.63 tok/s", "FAIL AS WRITTEN", "24 of 24", "Raspberry Pi 5", "iMac", "install.sh exits 101"] {
assert!(page.contains(must), "missing {must}");
}
- let lower = page.to_ascii_lowercase();
- for w in crate::components::machines::FORBIDDEN {
- assert!(!lower.contains(w), "forbidden word {w}");
- }
+ let problems = crate::components::machines::comparison_errors(&page);
+ assert!(problems.is_empty(), "comparison problem on /evidence/: {problems:?}");
assert_eq!(crate::components::boxlink::check_boxes(&page), Ok(6), "every receipt card links to GitHub");
}
}
diff --git a/crates/site-builder/src/components/follow.rs b/crates/site-builder/src/components/follow.rs
index fe192c8..954bb17 100644
--- a/crates/site-builder/src/components/follow.rs
+++ b/crates/site-builder/src/components/follow.rs
@@ -27,7 +27,7 @@ pub fn render_follow() -> Markup {
"GitHub: aien-dev"
}
a href="https://github.com/aien-dev/aien-sovereign-core" target="_blank" rel="noopener noreferrer" style="background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: 4px; padding: 12px 22px; font-family: var(--font-mono); font-size: 13px; font-weight: 600;" {
- "Aien core tree"
+ "Sovereign core runtime"
}
a href="/now/" style="background: transparent; color: var(--text-primary); border: 1px solid var(--accent-green); border-radius: 4px; padding: 12px 22px; font-family: var(--font-mono); font-size: 13px; font-weight: 600;" {
"Now: what is being done today"
diff --git a/crates/site-builder/src/components/machines.rs b/crates/site-builder/src/components/machines.rs
index 49789fe..c5898dc 100644
--- a/crates/site-builder/src/components/machines.rs
+++ b/crates/site-builder/src/components/machines.rs
@@ -5,8 +5,11 @@
//! and validated at build time and in the tests. Every machine and every
//! speed row must carry a public link; a row without one fails the build.
//! Numbers stand beside the physical ceiling of the machine they ran on
-//! and beside our own previous run, never beside anyone else's system,
-//! and the data is checked for the words that would break that rule.
+//! and beside my own previous run. A comparison with another project is
+//! allowed when the same sentence has a real ISO date and a link to an
+//! aien-dev receipt or to that project's own published numbers. Overclaims
+//! and unsourced comparisons are refused. The one allowlisted sentence is
+//! "Slower than I want."
//! The homepage shows both sections; /machine/ shows the machines first,
//! before the theory, so the page describes real hardware.
@@ -20,12 +23,1942 @@ use super::boxlink::{foot, Target};
/// The raw data file, compiled into the binary.
pub const RAW: &str = include_str!("../../data/machines.json");
-/// Words that compare us with other people's systems. None may appear in
-/// the data or on the rendered sections.
-pub const FORBIDDEN: [&str; 7] = [
- "faster than", "x faster", "llama.cpp", "vllm", "ollama", "beats ", "beat the",
+/// Phrases matched case-insensitively, with a word boundary on each side.
+/// These are claims on their own. "faster than", "half", "twice", "parity",
+/// and "beat" are context-bound: they count only in `context_is_claim`.
+pub const COMPARISON_PHRASES: &[&str] = &[
+ "better than",
+ "worse than",
+ "slower than",
+ "level with",
+ "ahead of",
+ "same speed as",
+ "as fast as",
+ "factor of",
+ "comparable to",
+ "competitive with",
+ "edges out",
];
+/// Whole words, case-insensitively. Not stems. A claim on their own.
+/// Bare "behind" is ordinary English, so it is not a claim.
+/// "match", "matched", "tie", "ties", "tied", "equal", "equals", "equaled",
+/// "equalled", "tied with", "equal to" and "on par with" are context-bound,
+/// in `TIE_WORDS` and `TIE_PHRASES`: they count beside an outside name, a
+/// rival noun, a multiplier, or the "best measured CUDA number" bar.
+/// "rivals", "rivaled" and "rivalled" are comparison words on their own.
+/// Superlatives ("fastest", "slowest", "quickest", "best", "worst") count only
+/// beside a project name, in `has_guarded_word`.
+/// "beat", "parity", "trails" and "lags" are context-bound, in `CONTEXT_WORDS`.
+pub const COMPARISON_WORDS: &[&str] = &["outdoes", "tops", "rivals", "rivaled", "rivalled"];
+
+/// Count only when the same sentence also names an outside system, a rival
+/// noun, or a number glued to the comparative ("2x faster", "half as fast").
+const CONTEXT_PHRASES: &[&str] = &[
+ "faster than",
+ "quicker than",
+ "cheaper than",
+ "more efficient than",
+];
+
+const CONTEXT_WORDS: &[&str] = &[
+ "half", "twice", "double", "parity", "trails", "lags",
+ "beat", "beats", "beating", "beaten",
+];
+
+/// Tie words. Same targets as the other context words, plus a multiplier
+/// or the bar phrase "best measured CUDA number". A different word in a
+/// CUDA bar sentence does not stay on the exact-sentence list.
+const TIE_WORDS: &[&str] = &[
+ "match", "matches", "matching", "matched",
+ "tie", "ties", "tied",
+ "equal", "equals", "equaled", "equalled",
+];
+
+const TIE_PHRASES: &[&str] = &["tied with", "equal to", "on par with", "on a par with"];
+
+/// Connectors. They count when the same sentence names a rival.
+const CONNECTORS: &[&str] = &[
+ "versus",
+ "compared with",
+ "compared to",
+ "relative to",
+ "speedup over",
+];
+
+/// A generic rival. Not a project name. Context-bound words count beside one of these.
+const RIVAL_NOUNS: &[&str] = &[
+ "competitors",
+ "the competition",
+ "alternatives",
+ "other systems",
+ "other frameworks",
+ "other stacks",
+ "other compilers",
+ "other runtimes",
+ "the industry",
+ "state of the art",
+ "sota",
+ "incumbent",
+ "leader",
+ "leading",
+ "market leader",
+ "gpu stack",
+ "gpu stacks",
+ "the field",
+ "everyone else",
+ "existing tools",
+ "rival",
+];
+
+/// A word that starts with one of these, case-insensitively: outperforms,
+/// outpaced, surpasses, exceeded. "rival" is a noun in `RIVAL_NOUNS`, not a
+/// stem: "holds back every rival" is not a comparison. The verb "rivals" is
+/// a comparison word on its own.
+pub const COMPARISON_STEMS: &[&str] = &["outperform", "outpace", "surpass", "exceed"];
+
+/// Overclaims. These stay banned even when a date and a link sit beside them.
+/// Phrases are lowercase; callers compare a lowercased string.
+pub const OVERCLAIMS: [&str; 5] = [
+ "replacement for cuda",
+ "everything cuda gives you",
+ "omega's replacement and its status",
+ "beating cuda",
+ "matching and then",
+];
+
+/// The only sentence that may say "slower than" with no date and no link.
+const OWNED_SLOWER: &str = "Slower than I want.";
+
+fn is_owned_slower(s: &str) -> bool {
+ let t = s.trim();
+ t == OWNED_SLOWER || t == "Slower than I want"
+}
+
+fn is_real_date(year: i32, month: u32, day: u32) -> bool {
+ if !(1..=9999).contains(&year) || !(1..=12).contains(&month) || day == 0 {
+ return false;
+ }
+ let leap = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
+ let dim = match month {
+ 1 | 3 | 5 | 7 | 8 | 10 | 12 => 31,
+ 4 | 6 | 9 | 11 => 30,
+ 2 if leap => 29,
+ 2 => 28,
+ _ => return false,
+ };
+ day <= dim
+}
+
+/// A real calendar date written YYYY-MM-DD. `2026-02-31` and `2026-13-01`
+/// do not count. A digit glued on either side does not count.
+fn has_real_iso_date(s: &str) -> bool {
+ let b = s.as_bytes();
+ if b.len() < 10 {
+ return false;
+ }
+ for i in 0..=b.len() - 10 {
+ if i > 0 && b[i - 1].is_ascii_digit() {
+ continue;
+ }
+ if i + 10 < b.len() && b[i + 10].is_ascii_digit() {
+ continue;
+ }
+ let w = &b[i..i + 10];
+ if w[4] != b'-' || w[7] != b'-' {
+ continue;
+ }
+ if !w[..4].iter().all(u8::is_ascii_digit)
+ || !w[5..7].iter().all(u8::is_ascii_digit)
+ || !w[8..10].iter().all(u8::is_ascii_digit)
+ {
+ continue;
+ }
+ let year: i32 = std::str::from_utf8(&w[..4]).unwrap().parse().unwrap();
+ let month: u32 = std::str::from_utf8(&w[5..7]).unwrap().parse().unwrap();
+ let day: u32 = std::str::from_utf8(&w[8..10]).unwrap().parse().unwrap();
+ if is_real_date(year, month, day) {
+ return true;
+ }
+ }
+ false
+}
+
+/// GitHub orgs whose repositories are the other project's own published record.
+pub const PROJECT_GITHUB_ORGS: &[&str] = &[
+ "ggml-org",
+ "ggerganov",
+ "vllm-project",
+ "NVIDIA",
+ "triton-lang",
+];
+
+/// Domains that publish the other project's own numbers.
+pub const PROJECT_SOURCE_DOMAINS: &[&str] = &[
+ "docs.vllm.ai",
+ "vllm.ai",
+ "developer.nvidia.com",
+ "pytorch.org",
+ "huggingface.co",
+];
+
+/// Outside systems. "cuda" does not match when "++" follows it: CUDA++ is this project.
+/// "nvidia" is an outside system only when the sentence compares against it
+/// (`nvidia_is_target`). A descriptive mention ("NVIDIA GPUs", "no NVIDIA software")
+/// does not, by itself, turn "half" or "parity" into a claim. Superlatives and
+/// "vs" still see every token here, including a descriptive NVIDIA.
+const PROJECT_TOKENS: &[&str] = &[
+ "cuda", "nvidia", "vllm", "llama.cpp", "llama", "tensorrt", "pytorch", "triton", "cudnn",
+ "chatgpt", "openai", "gemini", "claude", "tgi", "sglang", "cutlass",
+ "ollama", "mlx", "rocm", "groq",
+];
+
+/// Multi-word rival names. "onnx runtime" is not a single token.
+const PROJECT_PHRASES: &[&str] = &["onnx runtime"];
+
+fn url_is_allowed(url: &str) -> bool {
+ let lower = url.to_ascii_lowercase();
+ let Some(rest) = lower
+ .strip_prefix("https://")
+ .or_else(|| lower.strip_prefix("http://"))
+ else {
+ return false;
+ };
+ let rest = rest.strip_prefix("www.").unwrap_or(rest);
+ let cut = rest.find(|c: char| c.is_whitespace() || matches!(c, '"' | '\'' | '<' | '>')).unwrap_or(rest.len());
+ let rest = &rest[..cut];
+ let (host, path) = match rest.find('/') {
+ Some(i) => (&rest[..i], &rest[i..]),
+ None => (rest, ""),
+ };
+ let host = host.split('@').next_back().unwrap_or(host);
+ let host = host.split(':').next().unwrap_or(host);
+ if (host == "github.com" || host == "raw.githubusercontent.com")
+ && (path.starts_with("/aien-dev/") || path == "/aien-dev")
+ {
+ return true;
+ }
+ if host == "github.com" {
+ for org in PROJECT_GITHUB_ORGS {
+ let prefix = format!("/{}/", org.to_ascii_lowercase());
+ if path.starts_with(&prefix) || path == format!("/{org}").to_ascii_lowercase() {
+ return true;
+ }
+ }
+ }
+ PROJECT_SOURCE_DOMAINS.iter().any(|d| host == *d || host.ends_with(&format!(".{d}")))
+}
+
+fn each_url(s: &str, mut f: impl FnMut(&str)) {
+ let lower = s.to_ascii_lowercase();
+ let bytes = lower.as_bytes();
+ let mut i = 0;
+ while i < bytes.len() {
+ let rest = &lower[i..];
+ let http = rest.find("http://");
+ let https = rest.find("https://");
+ let at = match (http, https) {
+ (Some(a), Some(b)) => Some(a.min(b)),
+ (Some(a), None) => Some(a),
+ (None, Some(b)) => Some(b),
+ (None, None) => None,
+ };
+ let Some(at) = at else { break };
+ let start = i + at;
+ let url = &s[start..];
+ let end = url.find(|c: char| c.is_whitespace() || matches!(c, '"' | '\'' | '<' | '>')).unwrap_or(url.len());
+ f(&url[..end]);
+ i = start + end.max(1);
+ }
+}
+
+/// A receipt on an aien-dev host, or the other project's own domain, in this same sentence.
+/// The bare words "receipt" and "published" are not a link. An unrelated https URL is not a source.
+fn has_allowed_source(s: &str) -> bool {
+ let mut ok = false;
+ each_url(s, |url| {
+ if url_is_allowed(url) {
+ ok = true;
+ }
+ });
+ ok
+}
+
+fn is_word_char(c: char) -> bool {
+ c.is_ascii_alphanumeric() || c == '_'
+}
+
+fn boundary_phrase(lower: &str, phrase: &str) -> bool {
+ let mut from = 0;
+ while let Some(at) = lower[from..].find(phrase) {
+ let i = from + at;
+ let before_ok = i == 0 || !is_word_char(lower.as_bytes()[i - 1] as char);
+ let after = i + phrase.len();
+ let after_ok = after >= lower.len() || !is_word_char(lower.as_bytes()[after] as char);
+ if before_ok && after_ok {
+ return true;
+ }
+ from = i + phrase.len();
+ }
+ false
+}
+
+fn has_word_form(lower: &str) -> bool {
+ for word in lower.split(|c: char| !is_word_char(c)) {
+ if word.is_empty() {
+ continue;
+ }
+ if COMPARISON_WORDS.contains(&word) || COMPARISON_STEMS.iter().any(|stem| word.starts_with(stem)) {
+ return true;
+ }
+ }
+ false
+}
+
+/// A project token on a word boundary. "cuda" followed by "++" is CUDA++, this project, and does not count.
+fn token_present(lower: &str, token: &str) -> bool {
+ let mut from = 0;
+ while let Some(rel) = lower[from..].find(token) {
+ let i = from + rel;
+ let before_ok = i == 0 || !is_word_char(lower[..i].chars().next_back().unwrap());
+ let after = i + token.len();
+ let after_ok = after >= lower.len() || !is_word_char(lower[after..].chars().next().unwrap());
+ let cuda_plus = token == "cuda" && lower[after..].starts_with("++");
+ if before_ok && after_ok && !cuda_plus {
+ return true;
+ }
+ from = i + token.len().max(1);
+ }
+ false
+}
+
+fn word_ending_at(lower: &str, at: usize) -> Option<(usize, &str)> {
+ let trimmed = lower[..at].trim_end_matches(|c: char| !is_word_char(c));
+ if trimmed.is_empty() {
+ return None;
+ }
+ let start = trimmed
+ .rfind(|c: char| !is_word_char(c))
+ .map(|i| i + trimmed[i..].chars().next().unwrap().len_utf8())
+ .unwrap_or(0);
+ Some((start, &trimmed[start..]))
+}
+
+/// NVIDIA is the thing being compared, not a description of hardware or a missing stack.
+/// "faster than NVIDIA", "parity with NVIDIA", "twice NVIDIA", and "half of NVIDIA" count.
+/// "NVIDIA GPUs", "no NVIDIA software", and "with no NVIDIA user-space" do not.
+fn nvidia_is_target(lower: &str) -> bool {
+ const MARKERS: &[&str] = &[
+ "than", "with", "versus", "against", "vs", "of",
+ "twice", "double", "half",
+ "beat", "beats", "beating", "beaten",
+ "parity", "trails", "lags",
+ "faster", "quicker", "cheaper",
+ ];
+ let mut from = 0;
+ while let Some(rel) = lower[from..].find("nvidia") {
+ let i = from + rel;
+ let before_ok = i == 0 || !is_word_char(lower[..i].chars().next_back().unwrap());
+ let after = i + "nvidia".len();
+ let after_ok = after >= lower.len() || !is_word_char(lower[after..].chars().next().unwrap());
+ if before_ok && after_ok {
+ let mut word = word_ending_at(lower, i);
+ if matches!(word, Some((_, "the" | "a" | "an"))) {
+ if let Some((start, _)) = word {
+ word = word_ending_at(lower, start);
+ }
+ }
+ if let Some((_, w)) = word {
+ if MARKERS.contains(&w) {
+ return true;
+ }
+ }
+ }
+ from = i + "nvidia".len();
+ }
+ false
+}
+
+/// A comparison word other than "half", "twice" or "double". Those three stay
+/// descriptive in "GPU half" and do not, by themselves, make a nearby NVIDIA a rival.
+fn comparison_word_activates_nvidia(lower: &str) -> bool {
+ const WORDS: &[&str] = &[
+ "parity", "trails", "lags",
+ "beat", "beats", "beating", "beaten",
+ "match", "matches", "matching", "matched",
+ "tie", "ties", "tied",
+ "equal", "equals", "equaled", "equalled",
+ "slower", "faster", "quicker", "cheaper",
+ ];
+ if lower.split(|c: char| !is_word_char(c)).any(|word| {
+ WORDS.contains(&word)
+ || COMPARISON_WORDS.contains(&word)
+ || COMPARISON_STEMS.iter().any(|stem| word.starts_with(stem))
+ }) {
+ return true;
+ }
+ if CONTEXT_PHRASES.iter().any(|phrase| boundary_phrase(lower, phrase))
+ || TIE_PHRASES.iter().any(|phrase| boundary_phrase(lower, phrase))
+ || COMPARISON_PHRASES.iter().any(|phrase| boundary_phrase(lower, phrase))
+ || CONNECTORS.iter().any(|phrase| boundary_phrase(lower, phrase))
+ {
+ return true;
+ }
+ has_attached_comparative(lower) || has_vs(lower)
+}
+
+fn has_outside_system(lower: &str) -> bool {
+ if nvidia_is_target(lower) || (token_present(lower, "nvidia") && comparison_word_activates_nvidia(lower)) {
+ return true;
+ }
+ PROJECT_TOKENS.iter().any(|token| *token != "nvidia" && token_present(lower, token))
+ || PROJECT_PHRASES.iter().any(|phrase| boundary_phrase(lower, phrase))
+}
+
+/// Every rival name, in any position. NVIDIA counts here too. Used when the
+/// sentence already has a connector or a `: Nx` multiplier, so a
+/// descriptive NVIDIA sentence with no comparison word never reaches this.
+fn names_rival(lower: &str) -> bool {
+ PROJECT_TOKENS.iter().any(|token| token_present(lower, token))
+ || PROJECT_PHRASES.iter().any(|phrase| boundary_phrase(lower, phrase))
+ || has_rival(lower)
+}
+
+fn has_rival(lower: &str) -> bool {
+ RIVAL_NOUNS.iter().any(|noun| boundary_phrase(lower, noun))
+}
+
+fn project_near(lower: &str, at: usize) -> bool {
+ let start = lower.floor_char_boundary(at.saturating_sub(48));
+ let end = lower.ceil_char_boundary((at + 48).min(lower.len()));
+ let window = &lower[start..end];
+ PROJECT_TOKENS.iter().any(|token| token_present(window, token))
+}
+
+/// Superlatives only when a project name sits nearby.
+/// Bare uses ("the quickest walkthrough", "the best way") are not claims.
+/// "twice", "double", and "half" are context-bound, not superlatives.
+fn has_guarded_word(lower: &str) -> bool {
+ const GUARDED: &[&str] = &["best", "worst", "fastest", "slowest", "quickest"];
+ let mut from = 0;
+ while from < lower.len() {
+ let rest = &lower[from..];
+ let mut found: Option<(usize, usize)> = None;
+ for word in GUARDED {
+ if let Some(at) = rest.find(word) {
+ let i = from + at;
+ let before_ok = i == 0 || !is_word_char(lower.as_bytes()[i - 1] as char);
+ let after = i + word.len();
+ let after_ok = after >= lower.len() || !is_word_char(lower.as_bytes()[after] as char);
+ if before_ok && after_ok && found.map(|(p, _)| at < p).unwrap_or(true) {
+ found = Some((at, word.len()));
+ }
+ }
+ }
+ let Some((at, len)) = found else { break };
+ let i = from + at;
+ if project_near(lower, i) {
+ return true;
+ }
+ from = i + len;
+ }
+ false
+}
+
+fn has_vs(lower: &str) -> bool {
+ let b = lower.as_bytes();
+ let mut i = 0;
+ while i + 2 <= b.len() {
+ if &b[i..i + 2] == b"vs" {
+ let before = i == 0 || b[i - 1].is_ascii_whitespace();
+ let mut end = i + 2;
+ if end < b.len() && b[end] == b'.' {
+ end += 1;
+ }
+ let after_ok = end >= b.len()
+ || b[end].is_ascii_whitespace()
+ || matches!(b[end], b')' | b']' | b',' | b';' | b':' | b'!' | b'?');
+ if before && after_ok && project_near(lower, i) {
+ return true;
+ }
+ }
+ i += 1;
+ }
+ false
+}
+
+fn has_within_percent(lower: &str) -> bool {
+ let bytes = lower.as_bytes();
+ let mut from = 0;
+ while let Some(at) = lower[from..].find("within") {
+ let i = from + at;
+ let before_ok = i == 0 || !is_word_char(bytes[i - 1] as char);
+ let mut j = i + "within".len();
+ if !before_ok || j >= bytes.len() || !bytes[j].is_ascii_whitespace() {
+ from = i + "within".len();
+ continue;
+ }
+ while j < bytes.len() && bytes[j].is_ascii_whitespace() {
+ j += 1;
+ }
+ if j >= bytes.len() || !bytes[j].is_ascii_digit() {
+ from = i + "within".len();
+ continue;
+ }
+ while j < bytes.len() && bytes[j].is_ascii_digit() {
+ j += 1;
+ }
+ if j + 1 < bytes.len() && bytes[j] == b'.' && bytes[j + 1].is_ascii_digit() {
+ j += 2;
+ while j < bytes.len() && bytes[j].is_ascii_digit() {
+ j += 1;
+ }
+ }
+ while j < bytes.len() && bytes[j].is_ascii_whitespace() {
+ j += 1;
+ }
+ if j < bytes.len() && bytes[j] == b'%' {
+ j += 1;
+ while j < bytes.len() && bytes[j].is_ascii_whitespace() {
+ j += 1;
+ }
+ if lower[j..].starts_with("of") {
+ let after = j + 2;
+ if after >= lower.len() || !is_word_char(lower.as_bytes()[after] as char) {
+ return true;
+ }
+ }
+ }
+ from = i + "within".len();
+ }
+ false
+}
+
+fn is_timezone(word: &str) -> bool {
+ matches!(word, "cdt" | "cst" | "edt" | "est" | "mdt" | "mst" | "pdt" | "pst" | "utc" | "gmt")
+}
+
+/// `19:3x`, `~19:30` and a trailing timezone are clock tokens. They are not
+/// multipliers. A later `3x faster` in the same sentence still counts.
+fn is_clock_multiplier(chars: &[char], number_start: usize, after_mark: usize) -> bool {
+ if number_start > 0 && chars[number_start - 1] == ':' {
+ let mut k = number_start - 1;
+ if k > 0 {
+ k -= 1;
+ if chars[k].is_ascii_digit() {
+ let mut digits = 1usize;
+ while k > 0 && chars[k - 1].is_ascii_digit() && digits < 2 {
+ k -= 1;
+ digits += 1;
+ }
+ let before = if k == 0 { None } else { Some(chars[k - 1]) };
+ if matches!(before, None | Some('~')) || before.is_some_and(|c| c.is_whitespace()) {
+ return true;
+ }
+ }
+ }
+ }
+ let mut m = after_mark;
+ while m < chars.len() && chars[m] == ' ' {
+ m += 1;
+ }
+ if m >= chars.len() {
+ return false;
+ }
+ let rest: String = chars[m..].iter().collect();
+ let word = rest.split(|c: char| !is_word_char(c)).next().unwrap_or("");
+ is_timezone(word)
+}
+
+fn is_x_tail(c: char) -> bool {
+ c.is_whitespace()
+ || matches!(c, '.' | ',' | ';' | ':' | '!' | '?' | ')' | ']' | '"' | '\'' | '\u{201d}' | '\u{2019}')
+}
+
+fn without_urls(s: &str) -> String {
+ let mut out = String::with_capacity(s.len());
+ let mut rest = s;
+ loop {
+ let http = rest.find("http://");
+ let https = rest.find("https://");
+ let i = match (http, https) {
+ (Some(a), Some(b)) => Some(a.min(b)),
+ (Some(a), None) => Some(a),
+ (None, Some(b)) => Some(b),
+ (None, None) => None,
+ };
+ let Some(i) = i else {
+ out.push_str(rest);
+ break;
+ };
+ out.push_str(&rest[..i]);
+ rest = &rest[i..];
+ let end = rest.find(char::is_whitespace).unwrap_or(rest.len());
+ rest = &rest[end..];
+ out.push(' ');
+ }
+ out
+}
+
+fn negated_before(lower: &str, at: usize) -> bool {
+ let start = lower.floor_char_boundary(at.saturating_sub(48));
+ let mut window = &lower[start..at];
+ if let Some(i) = window.rfind(['.', '!', '?']) {
+ window = &window[i + 1..];
+ }
+ for word in ["not", "never", "no"] {
+ if boundary_phrase(window, word) {
+ return true;
+ }
+ }
+ false
+}
+
+fn phrase_claim(lower: &str) -> bool {
+ for phrase in COMPARISON_PHRASES {
+ let mut from = 0;
+ while let Some(at) = lower[from..].find(phrase) {
+ let i = from + at;
+ let before_ok = i == 0 || !is_word_char(lower.as_bytes()[i - 1] as char);
+ let after = i + phrase.len();
+ let after_ok = after >= lower.len() || !is_word_char(lower.as_bytes()[after] as char);
+ if before_ok && after_ok {
+ // "ahead of time" is an idiom, not a comparison. "ahead of NVIDIA" still is.
+ if *phrase == "ahead of" {
+ let rest = lower[after..].trim_start();
+ if rest.starts_with("time") {
+ let n = "time".len();
+ let boundary = n >= rest.len() || !is_word_char(rest[n..].chars().next().unwrap());
+ if boundary {
+ from = i + phrase.len();
+ continue;
+ }
+ }
+ }
+ let denial = (*phrase == "comparable to" || *phrase == "competitive with") && negated_before(lower, i);
+ if !denial {
+ return true;
+ }
+ }
+ from = i + phrase.len();
+ }
+ }
+ false
+}
+
+fn has_context_word(lower: &str) -> bool {
+ lower.split(|c: char| !is_word_char(c)).any(|word| CONTEXT_WORDS.contains(&word))
+}
+
+fn has_context_phrase(lower: &str) -> bool {
+ CONTEXT_PHRASES.iter().any(|phrase| boundary_phrase(lower, phrase))
+}
+
+fn adjective_at(rest: &str, words: &[&str]) -> bool {
+ words.iter().any(|adj| {
+ rest.starts_with(adj)
+ && (adj.len() >= rest.len() || !is_word_char(rest[adj.len()..].chars().next().unwrap()))
+ })
+}
+
+/// "half as fast", "2x faster", "40% cheaper", "N times faster".
+/// A bare "2x" or "137 times" is not attached.
+fn has_attached_comparative(lower: &str) -> bool {
+ const LOOSE: &[&str] = &[
+ "faster", "slower", "cheaper", "quicker", "more efficient",
+ "fast", "slow", "cheap", "quick", "efficient",
+ ];
+ for lead in ["half as", "twice as", "double as"] {
+ let mut from = 0;
+ while let Some(rel) = lower[from..].find(lead) {
+ let i = from + rel;
+ let before_ok = i == 0 || !is_word_char(lower[..i].chars().next_back().unwrap());
+ let after = i + lead.len();
+ let after_ok = after >= lower.len() || !is_word_char(lower[after..].chars().next().unwrap());
+ if before_ok && after_ok {
+ let rest = lower[after..].trim_start_matches(' ');
+ if adjective_at(rest, LOOSE) {
+ return true;
+ }
+ }
+ from = i + lead.len().max(1);
+ }
+ }
+ const TIGHT: &[&str] = &["faster", "slower", "cheaper", "quicker", "more efficient"];
+ let chars: Vec = lower.chars().collect();
+ let mut i = 0;
+ while i < chars.len() {
+ let start_ok = chars[i].is_ascii_digit() && (i == 0 || !is_word_char(chars[i - 1]));
+ if !start_ok {
+ i += 1;
+ continue;
+ }
+ let mut j = i + 1;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ if j + 1 < chars.len() && chars[j] == '.' && chars[j + 1].is_ascii_digit() {
+ j += 2;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ }
+ let mut k = j;
+ while k < chars.len() && chars[k] == ' ' {
+ k += 1;
+ }
+ let rest_at = |m: usize| chars[m..].iter().collect::();
+ if chars.get(k) == Some(&'%') {
+ let mut m = k + 1;
+ while m < chars.len() && chars[m] == ' ' {
+ m += 1;
+ }
+ if adjective_at(&rest_at(m), TIGHT) {
+ return true;
+ }
+ }
+ if k < chars.len() && (chars[k] == 'x' || chars[k] == '\u{00d7}') {
+ let mut m = k + 1;
+ while m < chars.len() && chars[m] == ' ' {
+ m += 1;
+ }
+ if adjective_at(&rest_at(m), TIGHT) {
+ return true;
+ }
+ }
+ if k > j {
+ let rest = rest_at(k);
+ if rest.starts_with("times") {
+ let after_times = "times".len();
+ let boundary = after_times >= rest.len()
+ || !is_word_char(rest[after_times..].chars().next().unwrap());
+ if boundary {
+ let mut m = k + "times".chars().count();
+ while m < chars.len() && chars[m] == ' ' {
+ m += 1;
+ }
+ if adjective_at(&rest_at(m), TIGHT) {
+ return true;
+ }
+ }
+ }
+ }
+ i = j;
+ }
+ false
+}
+
+fn has_nx_own(lower: &str) -> bool {
+ let chars: Vec = lower.chars().collect();
+ let mut i = 0;
+ while i < chars.len() {
+ let start_ok = chars[i].is_ascii_digit() && (i == 0 || !is_word_char(chars[i - 1]));
+ if !start_ok {
+ i += 1;
+ continue;
+ }
+ let mut j = i + 1;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ if j + 1 < chars.len() && chars[j] == '.' && chars[j + 1].is_ascii_digit() {
+ j += 2;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ }
+ let mut k = j;
+ while k < chars.len() && chars[k] == ' ' {
+ k += 1;
+ }
+ if k < chars.len() && (chars[k] == 'x' || chars[k] == '\u{00d7}') {
+ let mut m = k + 1;
+ while m < chars.len() && chars[m] == ' ' {
+ m += 1;
+ }
+ let rest: String = chars[m..].iter().collect();
+ for phrase in ["its own", "our own"] {
+ if rest.starts_with(phrase) {
+ let n = phrase.len();
+ let after_ok = n >= rest.len() || !is_word_char(rest[n..].chars().next().unwrap());
+ if after_ok {
+ return true;
+ }
+ }
+ }
+ }
+ i = j;
+ }
+ false
+}
+
+/// "faster than its own frozen starting point" and "20.3x its own baseline".
+/// A word such as "frozen" may sit between "own" and the baseline noun.
+fn is_self_baseline(lower: &str) -> bool {
+ for phrase in ["than its own", "than our own"] {
+ let mut from = 0;
+ while let Some(rel) = lower[from..].find(phrase) {
+ let i = from + rel;
+ let before_ok = i == 0 || !is_word_char(lower[..i].chars().next_back().unwrap());
+ let after = i + phrase.len();
+ let after_ok = after >= lower.len() || !is_word_char(lower[after..].chars().next().unwrap());
+ if before_ok && after_ok {
+ let end = (after + 80).min(lower.len());
+ let window = &lower[after..end];
+ if ["starting point", "baseline", "previous"].iter().any(|noun| boundary_phrase(window, noun)) {
+ return true;
+ }
+ }
+ from = i + phrase.len();
+ }
+ }
+ has_nx_own(lower)
+}
+
+/// A bare `20x`, `3 times`, or `20.3-fold` names a rival only when that rival
+/// follows the number. "2x vLLM" and "20.3-fold vLLM" count. "Claude Max 20x plan"
+/// does not: Claude is the product, and 20x is the plan name.
+fn bare_multiplier_targets_rival(lower: &str) -> bool {
+ let chars: Vec = lower.chars().collect();
+ let mut i = 0;
+ while i < chars.len() {
+ let start_ok = chars[i].is_ascii_digit() && (i == 0 || !is_word_char(chars[i - 1]));
+ if !start_ok {
+ i += 1;
+ continue;
+ }
+ let mut j = i + 1;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ if j + 1 < chars.len() && chars[j] == '.' && chars[j + 1].is_ascii_digit() {
+ j += 2;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ }
+ let mut k = j;
+ while k < chars.len() && chars[k] == ' ' {
+ k += 1;
+ }
+ let mut tail_at: Option = None;
+ if chars.get(j) == Some(&'-') {
+ let rest: String = chars[j + 1..].iter().collect();
+ if rest.starts_with("fold") {
+ let after = "fold".len();
+ if after >= rest.len() || !is_word_char(rest[after..].chars().next().unwrap_or(' ')) {
+ tail_at = Some(j + 1 + "fold".chars().count());
+ }
+ }
+ }
+ if k < chars.len() && (chars[k] == 'x' || chars[k] == '\u{00d7}') {
+ let zero = chars[i..j].iter().all(|c| *c == '0' || *c == '.');
+ let hex = zero && chars[k] == 'x';
+ if !hex {
+ let after = k + 1;
+ if (after >= chars.len() || is_x_tail(chars[after])) && !is_clock_multiplier(&chars, i, after) {
+ tail_at = Some(after);
+ }
+ }
+ }
+ if k > j {
+ let rest: String = chars[k..].iter().collect();
+ if rest.starts_with("times") {
+ let after = "times".len();
+ if after >= rest.len() || !is_word_char(rest[after..].chars().next().unwrap_or(' ')) {
+ tail_at = Some(k + "times".chars().count());
+ }
+ }
+ }
+ if let Some(at) = tail_at {
+ let tail: String = chars[at..].iter().collect();
+ if names_rival(&tail) {
+ return true;
+ }
+ }
+ i = j;
+ }
+ false
+}
+
+fn has_tie(lower: &str) -> bool {
+ lower.split(|c: char| !is_word_char(c)).any(|word| TIE_WORDS.contains(&word))
+ || TIE_PHRASES.iter().any(|phrase| boundary_phrase(lower, phrase))
+}
+
+fn has_multiplier(lower: &str) -> bool {
+ let chars: Vec = lower.chars().collect();
+ let mut i = 0;
+ while i < chars.len() {
+ if !(chars[i].is_ascii_digit() && (i == 0 || !is_word_char(chars[i - 1]))) {
+ i += 1;
+ continue;
+ }
+ let mut j = i + 1;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ if j + 1 < chars.len() && chars[j] == '.' && chars[j + 1].is_ascii_digit() {
+ j += 2;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ }
+ let mut k = j;
+ while k < chars.len() && chars[k] == ' ' {
+ k += 1;
+ }
+ if k < chars.len() && (chars[k] == 'x' || chars[k] == '\u{00d7}') {
+ let after = k + 1;
+ if after >= chars.len() || is_x_tail(chars[after]) {
+ let zero = chars[i..j].iter().all(|c| *c == '0' || *c == '.');
+ if !(zero && chars[k] == 'x') && !is_clock_multiplier(&chars, i, after) {
+ return true;
+ }
+ }
+ }
+ if chars.get(j) == Some(&'-') {
+ let rest: String = chars[j + 1..].iter().collect();
+ if rest.starts_with("fold") {
+ let n = "fold".len();
+ if n >= rest.len() || !is_word_char(rest[n..].chars().next().unwrap_or(' ')) {
+ return true;
+ }
+ }
+ }
+ if k > j {
+ let rest: String = chars[k..].iter().collect();
+ if rest.starts_with("times") {
+ let n = "times".len();
+ if n >= rest.len() || !is_word_char(rest[n..].chars().next().unwrap_or(' ')) {
+ return true;
+ }
+ }
+ }
+ i = j;
+ }
+ false
+}
+
+/// `: Nx`, including `llama.cpp: 1.8x` and `speedup over vLLM: 2x`.
+/// The rival sits before the colon. A colon that is not followed by a multiplier
+/// is not this form, so "Game 2: Beat the memorizer" is not a multiplier claim.
+fn colon_nx_targets_rival(lower: &str) -> bool {
+ let chars: Vec = lower.chars().collect();
+ let mut i = 0;
+ while i < chars.len() {
+ if chars[i] != ':' {
+ i += 1;
+ continue;
+ }
+ let mut k = i + 1;
+ while k < chars.len() && chars[k] == ' ' {
+ k += 1;
+ }
+ if k >= chars.len() || !chars[k].is_ascii_digit() {
+ i += 1;
+ continue;
+ }
+ let mut j = k + 1;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ if j + 1 < chars.len() && chars[j] == '.' && chars[j + 1].is_ascii_digit() {
+ j += 2;
+ while j < chars.len() && chars[j].is_ascii_digit() {
+ j += 1;
+ }
+ }
+ let mut m = j;
+ while m < chars.len() && chars[m] == ' ' {
+ m += 1;
+ }
+ let times = m < chars.len() && (chars[m] == 'x' || chars[m] == '\u{00d7}');
+ if !times || is_clock_multiplier(&chars, k, m + 1) {
+ i += 1;
+ continue;
+ }
+ let after = m + 1;
+ if after < chars.len() && !is_x_tail(chars[after]) {
+ i += 1;
+ continue;
+ }
+ let before: String = chars[..i].iter().collect();
+ if names_rival(&before) {
+ return true;
+ }
+ i += 1;
+ }
+ false
+}
+
+fn has_connector(lower: &str) -> bool {
+ CONNECTORS.iter().any(|phrase| boundary_phrase(lower, phrase)) && names_rival(lower)
+}
+
+fn context_is_claim(lower: &str) -> bool {
+ let tie = has_tie(lower);
+ let word_or_phrase = has_context_word(lower) || has_context_phrase(lower) || tie;
+ let attached = has_attached_comparative(lower);
+ let aimed = bare_multiplier_targets_rival(lower) || colon_nx_targets_rival(lower);
+ if !word_or_phrase && !attached && !aimed {
+ return false;
+ }
+ if is_self_baseline(lower) && !has_outside_system(lower) && !has_rival(lower) {
+ return false;
+ }
+ if attached {
+ return true;
+ }
+ let bar = lower.contains("best measured cuda number");
+ if word_or_phrase && (has_outside_system(lower) || has_rival(lower) || (tie && (bar || has_multiplier(lower)))) {
+ return true;
+ }
+ aimed
+}
+
+fn is_comparison_claim(s: &str) -> bool {
+ let scanned = without_urls(&s.to_ascii_lowercase());
+ if phrase_claim(&scanned)
+ || has_word_form(&scanned)
+ || has_guarded_word(&scanned)
+ || has_vs(&scanned)
+ || has_connector(&scanned)
+ || has_within_percent(&scanned)
+ {
+ return true;
+ }
+ context_is_claim(&scanned)
+}
+
+/// One exact sentence the checker allows, with the source and the reason.
+/// A different wording is not on the list, so it is checked like any other sentence.
+struct FixedSentence {
+ sentence: &'static str,
+ source: &'static str,
+ reason: &'static str,
+ /// The omega page prints these bars as `Done when: {sentence}`.
+ done_when_prefix: bool,
+ /// Dist paths where this exact sentence is allowed. `public/` and a
+ /// trailing slash are the same page. A llms.txt catalogue line is allowed
+ /// only when its URL maps to one of these pages.
+ pages: &'static [&'static str],
+}
+
+/// CUDA performance bars from omega.json, then two published chemistry results,
+/// then the planned same-Spark benchmark named in the gpu-head-to-head
+/// repository description. A tie does not pass a CUDA bar: each bar sentence
+/// must require a beat, and a different sentence with the same words does not.
+/// The chemistry sentences match only as written. They are the scholar body in
+/// public/data/engineer.json. Line 89 of that file is the description. Both
+/// sentences are in body_html on line 91, and the link for each one is in the
+/// next paragraph. The benchmark sentence matches only as written. It names a
+/// plan. A result or a different comparative is not on the list.
+/// Three call-to-humanity sentences stay as written, and only on that page:
+/// the HTML file, its llms-full section, and its llms.txt catalogue entry.
+/// Each matches only as that sentence. One changed word is not on the list,
+/// and neither is "a replacement for CUDA". The other allowances are scoped
+/// to the page that publishes them.
+const FIXED_SENTENCES: &[FixedSentence] = &[
+ FixedSentence {
+ sentence: "Omega's best format beats the best measured CUDA number at one conversation, with golden tokens identical to my host reference.",
+ source: "https://github.com/aien-dev/aienos.com/blob/main/crates/site-builder/data/omega.json",
+ reason: "Omega performance bar from omega.json. A different wording does not pass, so a tie does not pass.",
+ done_when_prefix: true,
+ pages: &["omega/index.html"],
+ },
+ FixedSentence {
+ sentence: "Omega prefill beats the best measured CUDA number at 512 and 8k.",
+ source: "https://github.com/aien-dev/aienos.com/blob/main/crates/site-builder/data/omega.json",
+ reason: "Omega performance bar from omega.json. A different wording does not pass, so a tie does not pass.",
+ done_when_prefix: true,
+ pages: &["omega/index.html"],
+ },
+ FixedSentence {
+ sentence: "Omega total words per second beats the best measured CUDA number at 8 and 32 conversations.",
+ source: "https://github.com/aien-dev/aienos.com/blob/main/crates/site-builder/data/omega.json",
+ reason: "Omega performance bar from omega.json. A different wording does not pass, so a tie does not pass.",
+ done_when_prefix: true,
+ pages: &["omega/index.html"],
+ },
+ FixedSentence {
+ sentence: "Platinum deposited this way outperformed organic-solvent materials in photocatalytic dye degradation.",
+ source: "https://doi.org/10.3762/bjnano.10.71",
+ reason: "published chemistry result, sourced in the next paragraph",
+ done_when_prefix: false,
+ pages: &["engineer/scholar/index.html"],
+ },
+ FixedSentence {
+ sentence: "Ionic-liquid synthesis outperformed organic-solvent routes in photocatalytic methylene blue degradation.",
+ source: "https://digitalcommons.wku.edu/theses/2101/",
+ reason: "published chemistry result, sourced in the next paragraph",
+ done_when_prefix: false,
+ pages: &["engineer/scholar/index.html"],
+ },
+ FixedSentence {
+ sentence: "Same-Spark end-to-end head-to-head: aien-serve-http vs vLLM vs llama.cpp, Qwen3.6-35B-A3B (bar P0).",
+ source: "https://github.com/aien-dev/aienos.com/blob/main/crates/site-builder/data/omega.json",
+ reason: "planned same-Spark benchmark; no result claimed until a receipt exists. omega.json bar P0, status MISSING, receipt null.",
+ done_when_prefix: false,
+ pages: &["agents/index.html"],
+ },
+ FixedSentence {
+ sentence: "An open letter on breaking the CUDA stranglehold on the hardware market: a clean-room replacement for the CUDA user stack, built in the open, with public receipts.",
+ source: "https://github.com/aien-dev/aienos.com/blob/main/crates/site-builder/src/seo.rs",
+ reason: "Drake's decision 2026-10-30 (relayed by Aien): keep these three call-to-humanity sentences as written.",
+ done_when_prefix: false,
+ pages: &["call-to-humanity/index.html"],
+ },
+ FixedSentence {
+ sentence: "I intend to break it, and this letter is how I am starting: a working replacement for the CUDA user software layer, built in the open, with receipts anyone on Earth can check.",
+ source: "https://github.com/aien-dev/aienos.com/blob/main/public/call-to-humanity/index.html",
+ reason: "Drake's decision 2026-10-30 (relayed by Aien): keep these three call-to-humanity sentences as written.",
+ done_when_prefix: false,
+ pages: &["call-to-humanity/index.html"],
+ },
+ FixedSentence {
+ sentence: "What exists today is a clean-room replacement for the CUDA user stack on the GB10, with no nvcc, no libcuda, and no cuBLAS at run time.",
+ source: "https://github.com/aien-dev/aienos.com/blob/main/public/call-to-humanity/index.html",
+ reason: "Drake's decision 2026-10-30 (relayed by Aien): keep these three call-to-humanity sentences as written.",
+ done_when_prefix: false,
+ pages: &["call-to-humanity/index.html"],
+ },
+];
+
+/// Game title. It names a memorizer, not another project's system.
+const TURING_GAME_SENTENCE: &str = "Game 2: Beat the memorizer";
+
+fn plain_sentence(s: &str) -> String {
+ s.replace("'", "'")
+ .replace("'", "'")
+ .replace("'", "'")
+ .split_whitespace()
+ .collect::>()
+ .join(" ")
+}
+
+/// A dist path, a `public/` path, and a directory path are one page.
+fn normalize_page(path: &str) -> String {
+ let path = path.trim().replace('\\', "/");
+ let path = path.strip_prefix("./").unwrap_or(&path);
+ let path = path.strip_prefix("public/").unwrap_or(path);
+ let path = path.trim_start_matches('/');
+ if path.is_empty() {
+ return String::new();
+ }
+ if path.ends_with('/') {
+ return format!("{path}index.html");
+ }
+ if !path.contains('.') {
+ return format!("{path}/index.html");
+ }
+ path.to_string()
+}
+
+fn page_is(page: &str, allowed: &str) -> bool {
+ normalize_page(page) == normalize_page(allowed)
+}
+
+/// `llms.txt` writes `- [Name](https://...): {sentence}`. Returns that sentence
+/// only when the URL maps to `page`. A different page's entry does not match.
+fn llms_catalogue_sentence<'a>(page: &str, prepared: &'a str) -> Option<&'a str> {
+ let (target, body) = catalogue_parts(prepared)?;
+ if page_is(page, &target) { Some(body) } else { None }
+}
+
+/// The page an llms.txt catalogue line points at, and the sentence after it.
+fn catalogue_parts(prepared: &str) -> Option<(String, &str)> {
+ let rest = prepared.strip_prefix("- [")?;
+ let marker = rest.find("](https://")?;
+ let after = &rest[marker + 2..];
+ let split = after.find("): ")?;
+ let url = &after[..split];
+ if !url.starts_with("https://") || url.chars().any(char::is_whitespace) {
+ return None;
+ }
+ let target = map_aienos_page(url)?;
+ Some((target, &after[split + 3..]))
+}
+
+fn sentence_page(file_page: &str, prepared: &str) -> String {
+ if let Some((target, _)) = catalogue_parts(prepared) {
+ return target;
+ }
+ normalize_page(file_page)
+}
+
+fn is_fixed_sentence(page: &str, s: &str) -> bool {
+ let n = plain_sentence(s);
+ if n == TURING_GAME_SENTENCE {
+ return true;
+ }
+ let here = normalize_page(page);
+ if let Some(body) = llms_catalogue_sentence(&here, &n) {
+ if FIXED_SENTENCES.iter().any(|row| {
+ body == row.sentence && row.pages.iter().any(|allowed| page_is(&here, allowed))
+ }) {
+ return true;
+ }
+ }
+ FIXED_SENTENCES.iter().any(|row| {
+ let bare = n == row.sentence
+ || (row.done_when_prefix && n == format!("Done when: {}", row.sentence));
+ bare && row.pages.iter().any(|allowed| page_is(&here, allowed))
+ })
+}
+
+/// `None` when the text is not a comparison, or is one honest sentence
+/// with a real ISO date and a source link. Overclaims always return
+/// "overclaim". A comparison with no date or no link in this same text
+/// returns "unsourced comparison".
+fn decode_nbsp(s: &str) -> String {
+ let lower = s.to_ascii_lowercase();
+ let mut out = String::with_capacity(s.len());
+ let mut i = 0;
+ while i < s.len() {
+ let ch = s[i..].chars().next().unwrap();
+ if ch == '\u{00a0}' {
+ out.push(' ');
+ i += ch.len_utf8();
+ continue;
+ }
+ let rest = &lower[i..];
+ let entity = [" ", " ", " ", " "]
+ .into_iter()
+ .find(|entity| rest.starts_with(entity));
+ if let Some(entity) = entity {
+ out.push(' ');
+ i += entity.len();
+ continue;
+ }
+ out.push(ch);
+ i += ch.len_utf8();
+ }
+ out
+}
+
+fn strip_tags_to_space(s: &str) -> String {
+ if !s.contains('<') {
+ return s.to_string();
+ }
+ let mut out = String::with_capacity(s.len());
+ let mut rest = s;
+ while let Some(start) = rest.find('<') {
+ out.push_str(&rest[..start]);
+ if let Some(end) = rest[start..].find('>') {
+ out.push(' ');
+ rest = &rest[start + end + 1..];
+ } else {
+ out.push_str(&rest[start..]);
+ return out;
+ }
+ }
+ out.push_str(rest);
+ out
+}
+
+/// NBSP and ` ` become spaces, inline tags become spaces, and whitespace collapses.
+fn prepare_sentence(s: &str) -> String {
+ decode_nbsp(&strip_tags_to_space(s))
+ .split_whitespace()
+ .collect::>()
+ .join(" ")
+}
+
+/// "replacement for" then a CUDA token within four words. A period, semicolon,
+/// colon, comma, parenthesis, em dash or en dash in that gap ends the search.
+/// "not a replacement" and "isn't a replacement" are not the claim.
+/// "replacement for the CUDA user stack" and "a replacement for CUDA" are
+/// the same overclaim. CUDA++ is this project's GPU half.
+fn replacement_for_cuda(lower: &str) -> bool {
+ let phrase = "replacement for";
+ let mut from = 0;
+ while let Some(rel) = lower[from..].find(phrase) {
+ let i = from + rel;
+ let before_ok = i == 0 || !is_word_char(lower.as_bytes()[i - 1] as char);
+ let after = i + phrase.len();
+ let after_ok = after >= lower.len() || !is_word_char(lower.as_bytes()[after] as char);
+ if before_ok && after_ok && !replacement_is_negated(lower, i) && cuda_within_four_words(&lower[after..]) {
+ return true;
+ }
+ from = i + phrase.len().max(1);
+ }
+ false
+}
+
+/// The word immediately before "replacement", skipping one "a", "an" or "the".
+fn replacement_is_negated(lower: &str, phrase_at: usize) -> bool {
+ let Some((start, end)) = previous_word_span(lower, phrase_at) else {
+ return false;
+ };
+ let mut word = &lower[start..end];
+ if matches!(word, "a" | "an" | "the") {
+ let Some((start, end)) = previous_word_span(lower, start) else {
+ return false;
+ };
+ word = &lower[start..end];
+ }
+ matches!(word, "not" | "isn't" | "isnt")
+}
+
+fn previous_word_span(lower: &str, at: usize) -> Option<(usize, usize)> {
+ let mut i = at;
+ while i > 0 {
+ let ch = lower[..i].chars().next_back()?;
+ if negation_word_char(ch) {
+ break;
+ }
+ i -= ch.len_utf8();
+ }
+ if i == 0 {
+ return None;
+ }
+ let end = i;
+ while i > 0 {
+ let ch = lower[..i].chars().next_back()?;
+ if !negation_word_char(ch) {
+ break;
+ }
+ i -= ch.len_utf8();
+ }
+ Some((i, end))
+}
+
+fn negation_word_char(c: char) -> bool {
+ is_word_char(c) || c == '\''
+}
+
+/// At most four words between "for" and the CUDA token. Zero words counts:
+/// "replacement for CUDA" is the claim. A clause break stops the gap,
+/// including an en dash.
+fn cuda_within_four_words(tail: &str) -> bool {
+ let mut words = 0u32;
+ let mut i = 0;
+ while i < tail.len() {
+ let c = tail[i..].chars().next().unwrap();
+ let clen = c.len_utf8();
+ if c.is_whitespace() {
+ i += clen;
+ continue;
+ }
+ if matches!(c, '.' | ';' | ':' | ',' | '(' | ')') || c == '\u{2014}' || c == '\u{2013}' {
+ return false;
+ }
+ if tail[i..].starts_with("cuda") {
+ let after = i + "cuda".len();
+ let before_ok = i == 0 || !is_word_char(tail[..i].chars().next_back().unwrap());
+ let next = tail[after..].chars().next();
+ let plus = tail[after..].starts_with("++");
+ let after_ok = next.map(|ch| !is_word_char(ch)).unwrap_or(true);
+ if before_ok && after_ok && !plus {
+ return words <= 4;
+ }
+ }
+ if is_word_char(c) {
+ words += 1;
+ if words > 4 {
+ return false;
+ }
+ i += clen;
+ while i < tail.len() {
+ let n = tail[i..].chars().next().unwrap();
+ if !is_word_char(n) {
+ break;
+ }
+ i += n.len_utf8();
+ }
+ continue;
+ }
+ i += clen;
+ }
+ false
+}
+
+/// "beating cuda" is an overclaim. "beating cuda++" is this project's GPU half, not that claim.
+fn has_overclaim(lower: &str) -> bool {
+ for w in OVERCLAIMS {
+ if w == "beating cuda" {
+ let mut from = 0;
+ while let Some(at) = lower[from..].find(w) {
+ let i = from + at;
+ let before_ok = i == 0 || !is_word_char(lower[..i].chars().next_back().unwrap());
+ let after = i + w.len();
+ let plus = lower[after..].starts_with("++");
+ let after_ok = after >= lower.len() || !is_word_char(lower[after..].chars().next().unwrap());
+ if before_ok && after_ok && !plus {
+ return true;
+ }
+ from = i + w.len();
+ }
+ continue;
+ }
+ if w == "replacement for cuda" {
+ if replacement_for_cuda(lower) {
+ return true;
+ }
+ continue;
+ }
+ if lower.contains(w) {
+ return true;
+ }
+ }
+ false
+}
+
+pub fn comparison_problem(s: &str) -> Option<&'static str> {
+ comparison_problem_on("", s)
+}
+
+/// Same check as `comparison_problem`, on one page. An exact fixed sentence
+/// is allowed only on a page named by that sentence. A llms.txt line uses the
+/// page its catalogue URL maps to. Any other wording stays banned.
+pub fn comparison_problem_on(page: &str, s: &str) -> Option<&'static str> {
+ let prepared = prepare_sentence(s);
+ let lower = prepared.to_ascii_lowercase();
+ let page = sentence_page(page, &prepared);
+ if is_owned_slower(&prepared) || is_fixed_sentence(&page, &prepared) {
+ return None;
+ }
+ if has_overclaim(&lower) {
+ return Some("overclaim");
+ }
+ if is_comparison_claim(&prepared) && !(has_real_iso_date(&prepared) && has_allowed_source(&prepared)) {
+ return Some("unsourced comparison");
+ }
+ None
+}
+
+fn href_in_tag(tag: &str) -> Option<&str> {
+ let tag_l = tag.to_ascii_lowercase();
+ for key in ["href=\"", "href='"] {
+ if let Some(i) = tag_l.find(key) {
+ let value = &tag[i + key.len()..];
+ let quote = if key.ends_with('"') { '"' } else { '\'' };
+ let end = value.find(quote)?;
+ return Some(&value[..end]);
+ }
+ }
+ None
+}
+
+fn closes_block(tag_l: &str) -> bool {
+ tag_l.starts_with("
bool {
+ matches!(
+ open_name(tag_l),
+ Some(
+ "a" | "abbr" | "b" | "bdi" | "bdo" | "br" | "cite" | "code" | "data" | "dfn" | "em" | "i"
+ | "mark" | "q" | "s" | "small" | "span" | "strong" | "sub" | "sup" | "time" | "u"
+ | "var" | "wbr"
+ )
+ )
+}
+
+fn open_name(tag_l: &str) -> Option<&str> {
+ let t = tag_l.strip_prefix('<')?;
+ if t.starts_with('/') || t.starts_with('!') {
+ return None;
+ }
+ let end = t.find(|c: char| !c.is_ascii_alphanumeric()).unwrap_or(t.len());
+ if end == 0 {
+ return None;
+ }
+ Some(&t[..end])
+}
+
+/// Skip a balanced element. `rest` begins just after the opening tag.
+fn skip_balanced<'a>(rest: &'a str, name: &str) -> &'a str {
+ let lower = rest.to_ascii_lowercase();
+ let open = format!("<{name}");
+ let close = format!("{name}");
+ let mut depth = 1usize;
+ let mut i = 0usize;
+ while depth > 0 && i < lower.len() {
+ let rel_open = lower[i..].find(&open);
+ let rel_close = lower[i..].find(&close);
+ match (rel_open, rel_close) {
+ (Some(o), Some(c)) if o < c => {
+ depth += 1;
+ i += o + open.len();
+ }
+ (_, Some(c)) => {
+ depth -= 1;
+ i += c + close.len();
+ if depth == 0 {
+ let after = rest.get(i..).unwrap_or("");
+ let gt = after.find('>').map(|n| n + 1).unwrap_or(0);
+ return after.get(gt..).unwrap_or("");
+ }
+ }
+ _ => return "",
+ }
+ }
+ ""
+}
+
+/// Ledger and roster classes. `data-verbatim` alone does not opt out.
+const VERBATIM_CLASSES: &[&str] = &[
+ "now-item",
+ "now-note",
+ "now-done",
+ "now-queue-item",
+ "now-tl-item",
+ "now-tl-evidence",
+ "now-model-role",
+ "agents-verbatim",
+];
+
+fn has_verbatim_class(tag: &str) -> bool {
+ let lower = tag.to_ascii_lowercase();
+ let Some(i) = lower.find("class=") else { return false };
+ let rest = &tag[i + 6..];
+ let Some(quote) = rest.chars().next() else { return false };
+ if quote != '"' && quote != '\'' {
+ return false;
+ }
+ let rest = &rest[1..];
+ let end = rest.find(quote).unwrap_or(rest.len());
+ rest[..end].split_whitespace().any(|c| VERBATIM_CLASSES.iter().any(|v| c.eq_ignore_ascii_case(v)))
+}
+
+/// Program text in `pre` (and therefore `pre > code`) is not prose.
+/// A bare inline `` is prose. `data-verbatim` opts out only for the fixed class list.
+fn skip_whole_element(tag: &str, tag_l: &str) -> bool {
+ matches!(
+ open_name(tag_l),
+ Some("script" | "style" | "pre" | "textarea" | "kbd" | "samp")
+ ) || has_verbatim_class(tag)
+}
+
+/// Keep link targets, drop tags, and break on block ends so a date in one
+/// element does not license a claim in the next. Script, style, comments,
+/// program text (`pre`, so `pre > code`, plus `textarea`, `kbd`, `samp`), and a
+/// fixed verbatim class are not page prose. Inline `code` is prose.
+fn readable_text(text: &str) -> String {
+ if !text.contains('<') {
+ return text.to_string();
+ }
+ let mut out = String::with_capacity(text.len());
+ let mut rest = text;
+ while let Some(start) = rest.find('<') {
+ out.push_str(&rest[..start]);
+ rest = &rest[start..];
+ if rest.starts_with("").map(|end| &rest[end + 3..]).unwrap_or("");
+ continue;
+ }
+ let Some(end) = rest.find('>') else {
+ out.push_str(rest);
+ return out;
+ };
+ let tag = &rest[..=end];
+ let tag_l = tag.to_ascii_lowercase();
+ if !tag_l.ends_with("/>") && skip_whole_element(tag, &tag_l) {
+ if let Some(name) = open_name(&tag_l) {
+ rest = skip_balanced(&rest[end + 1..], name);
+ continue;
+ }
+ }
+ if let Some(url) = href_in_tag(tag) {
+ out.push(' ');
+ out.push_str(url);
+ out.push(' ');
+ }
+ if is_inline_join(&tag_l) {
+ out.push(' ');
+ }
+ if closes_block(&tag_l) {
+ out.push('\n');
+ }
+ rest = &rest[end + 1..];
+ }
+ out.push_str(rest);
+ out
+}
+
+fn is_closer(c: char) -> bool {
+ matches!(c, ')' | ']' | '"' | '\'' | '\u{201d}' | '\u{2019}')
+}
+
+/// A sentence ends at `.`, `!`, or `?` followed by whitespace, or at the
+/// end of the text. A closing `)` or quote may sit between the mark and
+/// the whitespace. The next sentence may start with a digit or a lowercase
+/// letter. A mark with no whitespace after it stays inside the sentence,
+/// so llama.cpp, URLs, and 21.95 stay whole.
+fn split_sentences(text: &str) -> Vec {
+ let chars: Vec = text.chars().collect();
+ let mut out = Vec::new();
+ let mut cur = String::new();
+ let mut i = 0;
+ while i < chars.len() {
+ let c = chars[i];
+ if matches!(c, '.' | '!' | '?') {
+ let mut j = i + 1;
+ while j < chars.len() && is_closer(chars[j]) {
+ j += 1;
+ }
+ if j >= chars.len() || chars[j].is_whitespace() {
+ for ch in chars.iter().take(j).skip(i) {
+ cur.push(*ch);
+ }
+ let sentence = cur.trim().to_string();
+ if !sentence.is_empty() {
+ out.push(sentence);
+ }
+ cur.clear();
+ i = j;
+ while i < chars.len() && chars[i].is_whitespace() {
+ i += 1;
+ }
+ continue;
+ }
+ }
+ cur.push(c);
+ i += 1;
+ }
+ let sentence = cur.trim().to_string();
+ if !sentence.is_empty() {
+ out.push(sentence);
+ }
+ out
+}
+
+/// Sentence-sized check. A date or a link in another sentence does not
+/// license a comparison in this one.
+pub fn comparison_errors(text: &str) -> Vec {
+ comparison_errors_on("", text)
+}
+
+fn comparison_errors_on(page: &str, text: &str) -> Vec {
+ let mut errors = Vec::new();
+ // Block ends already become newlines in `readable_text`. A newline ends a
+ // sentence so a claim in the next block does not inherit the previous line.
+ for line in readable_text(text).split('\n') {
+ for sentence in split_sentences(line) {
+ if let Some(kind) = comparison_problem_on(page, &sentence) {
+ errors.push(format!("{kind} in {sentence:?}"));
+ }
+ }
+ }
+ errors
+}
+
+/// Published papers and receipts, by exact repo path. Live pages are not on
+/// this list: `/omega/`, `omega.json`, and the `/engineer/` tree are scanned.
+/// A path matches only when the whole string equals an entry.
+pub const PROSE_EXEMPT_PATHS: &[&str] = &[
+ "public/engineer/papers/the-continuation-test.md",
+ "crates/site-builder/data/models.json",
+ "public/research/aien-research-plan.md",
+ "public/research/computing-machinery-and-understanding-emergence/index.html",
+ "public/research/the-stapleton-doctrine/index.html",
+];
+
+pub fn is_prose_exempt(path: &str) -> bool {
+ let norm = path.replace('\\', "/");
+ PROSE_EXEMPT_PATHS.contains(&norm.as_str())
+}
+
+/// Same check as `comparison_errors`, except a path on `PROSE_EXEMPT_PATHS` is skipped.
+pub fn comparison_errors_at(path: &str, text: &str) -> Vec {
+ if is_prose_exempt(path) {
+ Vec::new()
+ } else {
+ comparison_errors_on(path, text)
+ }
+}
+
+fn section_is_exempt(rel: &str) -> bool {
+ is_prose_exempt(&format!("public/{rel}")) || is_prose_exempt(rel)
+}
+
+/// `https://www.aienos.com/now/` becomes `now/index.html`. Anything else is unmapped.
+fn map_aienos_page(url: &str) -> Option {
+ let url = url.trim().trim_end_matches(|c: char| c == '.' || c == ')');
+ let rest = url
+ .strip_prefix("https://www.aienos.com")
+ .or_else(|| url.strip_prefix("http://www.aienos.com"))
+ .or_else(|| url.strip_prefix("https://aienos.com"))
+ .or_else(|| url.strip_prefix("http://aienos.com"))?;
+ let path = rest.split(['?', '#', ' ']).next().unwrap_or("");
+ if !path.is_empty() && !path.starts_with('/') {
+ return None;
+ }
+ let rel = path.trim_matches('/');
+ if rel.is_empty() {
+ Some("index.html".to_string())
+ } else if rel.ends_with(".html") || rel.ends_with(".md") || rel.ends_with(".json") || rel.ends_with(".tsv") {
+ Some(rel.to_string())
+ } else {
+ Some(format!("{rel}/index.html"))
+ }
+}
+
+fn norm_ws(s: &str) -> String {
+ s.split_whitespace().collect::>().join(" ").to_ascii_lowercase()
+}
+
+/// Fields from the public ledger long enough to identify a row. A sentence that
+/// contains one of these is that row, not a new claim on the page.
+fn ledger_fields(ledger: &str) -> Vec {
+ let mut out = Vec::new();
+ for line in ledger.lines() {
+ for field in line.split('\t') {
+ let n = norm_ws(field);
+ if n.chars().count() >= 40 {
+ out.push(n);
+ }
+ }
+ }
+ out
+}
+
+fn is_ledger_excerpt(sentence: &str, fields: &[String]) -> bool {
+ let s = norm_ws(sentence);
+ let n = s.chars().count();
+ if n < 40 {
+ return false;
+ }
+ fields.iter().any(|field| s.contains(field.as_str()) || field.contains(s.as_str()))
+}
+
+/// `llms-full.txt` is one file with one section per page. Each section is
+/// checked under its own source path. An exempt paper, receipt or ledger
+/// section is skipped. A sentence copied from the public ledger stays with
+/// the ledger. A section with no mappable source fails closed. A second
+/// `Source:` line stays on the first path and is an error. `Published:` is
+/// skipped only when it is the header line directly after `Source:`. The
+/// file as a whole is not exempt.
+fn push_line_problems(problems: &mut Vec, n: usize, label: &str, line: &str, fields: &[String]) {
+ if is_ledger_excerpt(line, fields) {
+ return;
+ }
+ for sentence in split_sentences(line) {
+ if is_ledger_excerpt(&sentence, fields) {
+ continue;
+ }
+ if let Some(kind) = comparison_problem_on(label, &sentence) {
+ problems.push(format!("llms-full.txt:{n} ({label}): {kind} in {sentence:?}"));
+ }
+ }
+}
+
+/// `Published: YYYY-MM-DD. Last changed: .` as `seo::llms_full` writes it.
+/// The timestamp is `YYYY-MM-DDTHH:MM:SSZ` or the same clock with a numeric offset.
+fn is_published_header(line: &str) -> bool {
+ let Some(rest) = line.strip_prefix("Published: ") else {
+ return false;
+ };
+ let Some((date, changed)) = rest.split_once(". Last changed: ") else {
+ return false;
+ };
+ let Some(stamp) = changed.strip_suffix('.') else {
+ return false;
+ };
+ is_exact_iso_date(date) && is_exact_timestamp(stamp)
+}
+
+fn is_exact_iso_date(s: &str) -> bool {
+ let b = s.as_bytes();
+ if b.len() != 10 || b[4] != b'-' || b[7] != b'-' {
+ return false;
+ }
+ if !b[..4].iter().all(u8::is_ascii_digit)
+ || !b[5..7].iter().all(u8::is_ascii_digit)
+ || !b[8..10].iter().all(u8::is_ascii_digit)
+ {
+ return false;
+ }
+ let Ok(year) = s[..4].parse::() else {
+ return false;
+ };
+ let Ok(month) = s[5..7].parse::() else {
+ return false;
+ };
+ let Ok(day) = s[8..10].parse::() else {
+ return false;
+ };
+ is_real_date(year, month, day)
+}
+
+fn is_exact_timestamp(s: &str) -> bool {
+ let b = s.as_bytes();
+ if b.len() != 20 && b.len() != 25 {
+ return false;
+ }
+ if !is_exact_iso_date(&s[..10]) || b[10] != b'T' || !is_hh_mm_ss(&b[11..19]) {
+ return false;
+ }
+ if b.len() == 20 {
+ return b[19] == b'Z';
+ }
+ (b[19] == b'+' || b[19] == b'-')
+ && b[22] == b':'
+ && is_two_digits(&b[20..22], 23)
+ && is_two_digits(&b[23..25], 59)
+}
+
+fn is_hh_mm_ss(b: &[u8]) -> bool {
+ b.len() == 8
+ && b[2] == b':'
+ && b[5] == b':'
+ && is_two_digits(&b[0..2], 23)
+ && is_two_digits(&b[3..5], 59)
+ && is_two_digits(&b[6..8], 59)
+}
+
+fn is_two_digits(b: &[u8], max: u32) -> bool {
+ if b.len() != 2 || !b.iter().all(u8::is_ascii_digit) {
+ return false;
+ }
+ let Ok(n) = std::str::from_utf8(b).unwrap_or("").parse::() else {
+ return false;
+ };
+ n <= max
+}
+
+pub fn llms_full_problems(text: &str, ledger: &str) -> Vec {
+ let fields = ledger_fields(ledger);
+ let mut problems = Vec::new();
+ // None: file banner, before the first section. Some(None): section not yet
+ // mapped. Some(Some(path)): mapped page.
+ let mut section: Option