Primitives
Prose is built from a small set of shared primitives that each carry a single responsibility. A rule reads source through Source, walks the AST through one of the shared walkers, emits Edit lists, and surfaces diagnostics through the Pipeline. Every rule in the catalog composes from the named pieces below, so a new rule lands as a thin walker plus the per-rule decision rather than a from-scratch implementation. The padding math, the comment-attachment, and the conflict discipline live once and downstream rules consume them.
The graph below traces how a source flows through the primitive set, with each node marking one primitive and each edge marking a consumer relationship (A → B reads as "A is consumed by B"). The graph nodes match the registries below, and hovering a node previews the primitive's one-line role.
Hover a tile to see what it draws from and what it feeds into.
The Surface
Public Primitives
Reachable from a downstream Rust consumer in 0.2.x:
Source· parsed-text wrapper bundling original text, AST, tokens, line index, and the suppression / binding tables. Every rule reads through this valuePipeline· runs the registered rules in deterministic order against a Source, reparsing between rulesRuleId· canonical kebab-case slug identifying each rule across CLI flags, config tables, suppression directives, and diagnostic output
Crate-Internal Primitives
pub(crate) in 0.2.x and stabilizing toward 1.0, where consumer-implemented rules become reachable:
BindingAnalysis· per-Source table indexing every write and read of every name in every lexical scopeSuppressionMap· per-Source index of# fmt: off/# fmt: skip/# yapf/# prose: ignore[...]directivesAligner· shared alignment math, consumed by , , , ,Orderer· sibling reorder helper preserving attached comments, consumed byColonTargets· walker that finds every:alignment context, consumed by andEdit· theEdit { range, content }shape every rule emits and the Pipeline appliesDocstring· PEP 257 docstring walker, consumed by , ,Walker· ignore-aware filesystem walker, consumed by the path-mode CLICache· user-level content-addressed cache, consumed byprose checkandprose formatto skip the pipeline on unchanged source
Reading Order
For a downstream Rust consumer integrating Prose through the public surface, the load-bearing reads are Source (input), Pipeline (runner), and RuleId (slug type). The three together cover construction, execution, and the slug shape that flows through every CLI flag and config table.
For a rule author working inside the Prose crate, the reading path starts at Edit (the unit every rule emits) and walks through Pipeline (the runner the rule registers with). From there, the right walker primitive depends on what the rule does:
Alignerfor rules that pad to a column.Ordererfor rules that reorder siblings.ColonTargetsfor rules that align around:contexts.Docstringfor rules over PEP 257 docstrings.BindingAnalysisfor rules that ask binding-shaped questions.
Source is the input every walker reads against, and SuppressionMap is the filter every emission passes through.
The Rules page walks every rule each primitive shows up under, the Configuration reference covers the [tool.prose] table that drives the Pipeline's rule selection, and the Pipeline Order reference covers the deterministic order rules fire in.