How it works

How it works.

loam.dev loads your whole Dart/Flutter project the way the compiler sees it, runs its rules across every library at once, and turns the result into a clear pass or fail for CI. A baseline accepts the code you already have, so only problems added after that can block a merge. Six stages, no guessing, no text matching.

  1. Loader

    The ProjectLoader hands your entire project to Dart’s own AnalysisContextCollection. Every file is parsed and resolved into a typed element model — the same one the Dart SDK works with. So the rules know which declaration a name points to, not just which text matches.

  2. Rules

    Each Rule is a self-contained unit behind one shared interface and runs over the resolved project. A new capability is a new rule; the pipeline itself never changes. All live rules are deterministic: offline, free and reproducible. A planned, optional LLM-assisted rule will only reach CI through a verdict cache.

  3. Findings

    Every rule reports Findings of the form { ruleId, severity, location, message, fingerprint }. The Fingerprint is a stable hash that survives reformatting and shifted line numbers, so the same problem stays the same Finding. Each Finding also names what kind of problem it is and what to do about it — written so an AI agent can act on it without guessing.

  4. Baseline

    The Baseline holds the Findings you accept, in baseline.json. To bring an existing project in, run a full audit, fix what matters and freeze the rest with loam baseline --write. From then on the Gate only cares about new Findings — not the ones you already know.

  5. Gate

    The Gate is the decision for CI: it compares the current Findings with the Baseline and answers with an exit code. Nothing new: exit 0. A new Finding: exit 1. Rule profiles decide what may block — core rules by default, strict ones when you opt in.

  6. Report

    The Reporter writes for whoever reads it: human in the terminal, json / sarif / markdown for CI and tools, agent for a compact, capped list of Findings, and html for a self-contained report in which you select Findings and copy a ready-made fix-prompt. After a run with Findings, loam.dev adds one preventive recommendation per rule class that fired — deterministic, no LLM call — for your agent to propose for its standing instructions.

Live demo

See a real report

This is the exact html report loam.dev writes — rendered from a small, deliberately messy demo project. It is live, not a screenshot: filter by rule or severity, pick the Findings you care about, and copy the assembled, versioned fix-prompt for your agent.

loam-report.html — shopcartOpen in new tab

Two commands

loam scan vs. loam gate

Two commands, two jobs. Pick the one that fits the moment.

Full audit · ignores the baseline

loam scan

Runs every active Rule over the whole project and shows all Findings, whatever the Baseline says. Use it when you bring loam.dev into an existing repo: see the full picture, fix what matters, then freeze the rest with loam baseline --write.

CI gate · ratchet by default

loam gate

The everyday command for CI. In ratchet mode, the default, only Findings that are not in the Baseline fail the build — the code can only get better over time. For new projects or pipelines that allow no Findings at all, --absolute ignores the Baseline and applies a fixed threshold instead.

A typical start: loam scan → fix what matters → loam baseline --write → loam gate in CI from then on. While you code, loam watch repeats the full audit after every saved change and shows what is new or resolved.

Design decision

Semantics over syntax.

A central design decision in loam.dev is what the analysis runs on.

dart analyze is good at what it checks: type errors, missing imports, lint rules — mostly one declaration or file at a time. It doesn’t follow the graph of references across your whole project: which public members are used anywhere at all, which libraries import each other in a circle, which helper exists twice under different names.

Text matching can’t answer those questions reliably. A regex can’t tell a declaration from a reference, a local variable from a public export, or generated code from code you wrote.

loam.dev works on the resolved element model: every symbol is a typed element with one identity, and every reference points to exactly that element. The rules work on that model, not on raw text. In practice:

  • A name that merely looks like another one is never mistaken for it.
  • Generated files and code-generator inputs are recognised automatically.
  • Renaming a class changes nothing — what counts is whether it is referenced, not what it is called.
  • References across libraries and packages are followed correctly.

That is what “semantics over syntax” means: the rules see your code the way the compiler does, not the way a text editor does.

Get started

Try it on your project

dart pub global activate loam
loam scan # in your project

The Developer Guide covers the full CLI reference, output formats, configuration and worked examples — including the complete onboarding sequence and how to run loam gate in CI. Every rule, with examples, is on the rules page.