--json output schemas

Most Roteiro reporting commands accept --json for machine consumption (some — init, render, load, spec scaffold — have no JSON form). The graph-data outputs carry a top-level schema tag of the form roteiro.<name>/vN; these are the stable, versioned contracts and are frozen for v1.0. Operational summaries (sync/check/import/infer/config/model) are stable in shape but untagged (see below).

Compatibility policy

What is covered — and what is not

The contract is the presence, name, type, and meaning of documented fields under a given schema tag. It deliberately does not cover:

For consumers

Versioned schemas (frozen)

Each tag is a const in the code, so the emitter and the freeze test share one source of truth:

Schema tagConstEmitted byPayload
roteiro.query/v1rto_graph::SCHEMAquery, query --kind, context, path, debt, duplicatesThe query surface: an explained node, a node context bundle, a kind listing, a path, a debt report, and the duplicate report (all share the query schema).
roteiro.review/v1review::REVIEW_SCHEMA (in the roteiro crate)reviewThe graph-grounded review of a change (changed files with per-symbol context, authored-layer drift, blast radius) and the change itself: each file carries an optional diff holding its unified hunks. It is present by default, and absent under --no-diff, in a bare repository reviewing the working tree, or whenever git declines to produce one — so a consumer must treat a missing diff as not supplied, never as no change. An empty string is the distinct case of git producing no text for that path — an empty new file, or a path whose content already matches the range's base. Mode changes, renames and binary files all emit headers, so they arrive as ordinary non-empty diffs. A range review also carries base, saying what --base resolved to: the spec as typed, the full ref it bound to (absent for a raw sha, which names none), and the commit that was actually diffed. base is absent for a working-tree review, which compares against HEAD and has no spec to resolve. When the resolved ref is a local branch with a configured upstream, base.upstream carries that ref, its commit, and the two reachability counts behind and ahead — read both: behind alone means the review covers a superset of the change, while behind and ahead together mean the two have forked and the diff may omit it.
roteiro.review-run/v1rto_graph::review_score::RUN_SCHEMAreview --replay, consumed by review --scoreA candidate reviewer's run over the adjudicated corpus: the commits it was run against (attempted_shas), its findings, and anything it suppressed. It may also carry verdicts — at most one whole-change judgement per attempted commit (reviewed_sha, stance of clean or concerns, and a summary), so a candidate's summaries can be adjudicated like its findings rather than shipping unmeasured. A verdict is deliberately not a finding: it is anchored to no line and never enters the recall figures. The field is additive and omitted when empty, so a document written before it existed still parses. --replay emits one from Roteiro's own reviewer (Stage 35b); the format stays deliberately not private to it, so a candidate of any provenance can still be scored.
roteiro.review-score/v1rto_graph::review_score::SCORE_SCHEMAreview --scoreThe score: per-defect-class recall (never averaged), the known-false claims reproduced, and the findings the corpus cannot judge. per_class always carries every class, so two scores line up row for row. Whole-change verdicts are scored separately and never move a recall figure: verdicts counts them, verdicts_contradicted counts those that declared a change clean over a commit the corpus knows carries a real defect — the one thing the corpus can adjudicate about a summary — and verdicts_unadjudicated is the rest.
roteiro.graph/v1rto_graph::ARTIFACT_SCHEMAexport (and consumed by load)The portable, content-addressed graph artifact (schema, tree, facts).
roteiro.spec/v1rto_spec::SPEC_SCHEMAspec context, spec scaffoldGraph-grounded spec/blueprint authoring context and skeletons.
roteiro.check/v1rto_spec::TOOL_CHECK_SCHEMAthe MCP and served-chat check tools (not check --json)The authored-layer drift verdict as data: gate (pass | fail | not-run), a report (a CheckReport) present only when the check ran, checked_against, and not_run_reason. A not-run document carries no report at all, so 0 violations and nothing was checked cannot be confused. The CLI's check --json is unchanged and still emits a bare, untagged CheckReport — a gate whose real answer is its exit code.
roteiro.oracle/v1rto_graph::ORACLE_SCHEMAimport codegraphThe codegraph validation-oracle comparison report.

Operational summaries (stable shape, untagged)

These --json outputs are human-oriented run summaries with a stable field shape, but do not (yet) carry a schema tag:

The same additive-within-a-release promise applies to them: within a released Roteiro major version (semver, not a schema /vN) their documented fields keep their name, type, and meaning, and only grow. Giving them explicit versioned schema tags is a small, additive follow-up; until then, pin to a Roteiro major version if you parse them.