---
title: "Brief shared by every glance rule agent · glance"
description: "Read docs/design/implementer-brief.md first and follow it exactly. Then this."
canonical: "https://glance.avarok.net/docs/design/rule-agent-brief/"
lastmod: "2026-11-29T22:33:35Z"
tokens: 1095
---

1. [Docs](https://glance.avarok.net/docs/)
2. [Design](https://glance.avarok.net/docs/design/)

# Brief shared by every glance rule agent

@avarok/glance@0.1.0·Updated 2026-11-29·2 min read·[View as markdown](https://glance.avarok.net/docs/design/rule-agent-brief/index.md)

Read docs/design/implementer-brief.md first and follow it exactly. Then this.

## What exists (read the code on your branch before writing any)

- crates/glance-a11y/src/engine/: the registry, dispatch, aggregation and ordering. Do not change their semantics. If you think a semantic is wrong, show it with a failing differential case and report it; change engine code only when the case proves it and no other rule regresses.
- crates/glance-a11y/src/facts/: visibility, at, roles, focus, name, labels, lang, ids, images. Use these; never re-derive a fact inside a rule. Add a missing fact as a new facts/ file.
- crates/glance-a11y/src/rules/checks/: shared checks (aria-label, aria-labelledby, non-empty-title, has-visible-text, implicit/explicit-label, presentational-role, has-alt, …). Reuse; add new shared checks in a new file of that module.
- crates/glance-a11y/src/{aria,css,lang}/: T's tables and maths.
- Example rules: src/rules/ (document-title, html-has-lang, blink, image-alt, button-name). Copy their shape: one rule per file, its checks beside it unless shared.
- rules.json: fill each rule's checks and messages in your own words; `npm run gen` regenerates the Rust and TS views and the COMPAT.md table.
- Page facts: add a snapshot column (schema/snapshot.json) or a Host method only when no existing one gives the fact; extend js/src/collector or js/src/host to supply it; `npm run gen`.

## Definition of done for each rule

1. Every black-box case in its spec chapter is an HTML file under conformance/cases// (sidecar .json for configure/options/context), plus any extra case you need to pin a behaviour.
2. Rust tests over hand-built or recorded snapshots for its checks.
3. `node conformance/differential/run.mjs --rule <id>` agrees 100% in rule and default modes.
4. `implemented: true` in rules.json, the COMPAT.md row regenerated.

## Targets are owned by the selector agent

If a case's only difference is `target`/`ancestry`/`xpath`, it is a selector-heuristic issue owned by the selector agent on branch r-select. Do not edit src/select/. List those cases in your report; mark them in the case's sidecar with `"knownTargetDiff": true` only if the harness supports it, otherwise keep the case and report it.

## Gates before each commit

`CARGO_BUILD_JOBS=4 cargo test`, `cargo clippy --all-targets -- -D warnings`, `cargo fmt --all --check`, `npm run gen:check`, `node scripts/check-lines.mjs`, `npm run typecheck`, `npm test` (at most 4 workers), and the differential suite for every rule you touched plus the existing rules (it must stay 100%). Negative-control each new rule once (break one check, watch the differential and the unit test fail, restore, re-run).

## Concurrency

Five rule agents work in parallel on separate branches and merge into main through PRs. Keep edits to shared files (rules.json, facts/mod.rs, checks/mod.rs, schema/\*.json) small and local so merges are trivial. Never reformat a shared file wholesale.

```json
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@id": "https://thomaspbraun.com/#person",
      "@type": "Person",
      "name": "Thomas Braun",
      "sameAs": [
        "https://github.com/tbraun96",
        "https://x.com/tbraun96"
      ],
      "url": "https://thomaspbraun.com",
      "worksFor": {
        "@type": "Organization",
        "name": "Avarok",
        "url": "https://avarok.net"
      }
    },
    {
      "@id": "https://glance.avarok.net/docs/design/rule-agent-brief/",
      "@type": "WebPage",
      "author": {
        "@id": "https://thomaspbraun.com/#person"
      },
      "dateModified": "2026-11-29T22:33:35Z",
      "description": "Read docs/design/implementer-brief.md first and follow it exactly. Then this.",
      "inLanguage": "en",
      "isPartOf": {
        "@id": "https://glance.avarok.net/#website",
        "@type": "WebSite",
        "name": "glance",
        "url": "https://glance.avarok.net/"
      },
      "name": "Brief shared by every glance rule agent · glance",
      "url": "https://glance.avarok.net/docs/design/rule-agent-brief/"
    }
  ]
}
```
