The review report for a candidate Nous.Profile: what text changed, what
the evidence says, and every line of text the candidate removes.
{:ok, report} = Nous.Eval.ProfileReport.build(current, candidate, comparison: cmp, split: "test")
IO.puts(Nous.Eval.ProfileReport.render(report, format: :markdown))It is what a human reads before promoting a profile
(mix nous.profile.promote), and what mix nous.profile.diff prints.
Sections
- Title and lineage - both profiles (name, version, id) and the
candidate's
parent_id,provenancesource and optimizer summary. - Verdict (only with evidence) - ACCEPT or REJECT with the split, k,
the number of comparable cases and the test used (paired cluster
bootstrap, Holm over the gate metrics; see
Nous.Eval.Compare), the gate metric table, mean tokens per sample, hard gates and the reasons for a rejection. - Components changed - per added, removed or changed component, a
line diff (
List.myers_difference/2) with the line counts, the character delta and an estimated token delta (characters / 4). - Per-case evidence (only with a comparison) - fixed / broken /
flaky / unchanged counts (descriptive labels, not per-case
significance), every broken case in full, fixed cases up to
:max_cases, each with its pass counts and arun_id#case_idtrace reference. - Removed text (safety review) - every non-blank line the candidate deletes from the instructions or a tool or parameter description, verbatim. An optimizer is rewarded for deleting rules that cost it points, and its guard gates only catch what they measure, so this section is always rendered, even when empty. Lines with wording that usually carries a rule ("never", "do not", "must", "refuse", "confirm", "always", "only", "forbidden", secrets/safety/policy terms) are flagged high attention.
Base text
A profile replaces the agent's base text, and a candidate usually starts
from no profile at all. Pass the agent as agent: so a component one side
does not set is compared against the agent's base text (see
Nous.Profile.components/1); otherwise it is compared against nothing,
and a candidate that rewrites the base instructions shows no removed
lines.
Untrusted text
Component text, case ids, run ids, names and provenance come from
optimizer output and stores, so they are untrusted. Markdown escapes them
with Nous.Eval.Reporter.Markdown.escape/1 (a | cannot break a table, a
backtick cannot open code, @ cannot mention); diff blocks are fenced
with a run of backticks longer than any in the text. Control characters
are removed in every format, so text cannot carry terminal escapes.
Summary
Functions
The names of the high-attention patterns text matches (see "Sections"),
[] for none.
Builds the report for candidate against base (a profile, or nil for
the agent's base text).
Renders report as a string.
The report as JSON-native data (string keys, strings for atoms),
marked "schema" => "nous.profile_report/1".
Types
@type t() :: %Nous.Eval.ProfileReport{ base: map() | nil, base_text?: boolean(), candidate: map(), cases: map() | nil, diff: map(), lineage: map(), removed: [map()], verdict: map() | nil }
:base/:candidate-%{id, name, version, parent_id}of each profile (:baseis nil without a base profile):base_text?- whether the agent's base text filled the components a profile does not set:diff-Nous.Profile.diff/2of the compared texts:removed- the removed lines:%{key, line, text, attention}withlinethe 1-based line number in the old text andattentionthe matched pattern names ([]when none):verdict- nil without evidence, else the decision, split, k, n, gate metrics, gates and reasons:cases- nil without a comparison, else counts and per-case rows:lineage- the candidate'sparent_id, provenancesourceandoptimizersummary
Functions
The names of the high-attention patterns text matches (see "Sections"),
[] for none.
@spec build( Nous.Profile.t() | nil, Nous.Profile.t(), keyword() | map() | nil, keyword() ) :: {:ok, t()} | {:error, term()}
Builds the report for candidate against base (a profile, or nil for
the agent's base text).
evidence is nil (a pure text diff) or a keyword list or map:
:comparison- aNous.Eval.Compareof the base run (baseline) against the candidate run:decision-:accept | :reject; defaults to:acceptwhen the comparison's verdict is:passand:rejectotherwise. An optimizer that runs its own acceptance test passes its decision here:split- the dataset split the evidence ran on, e.g."test":gates- hard gates,[%{name: String.t(), passed?: boolean(), detail: String.t() | nil}]; a failed gate makes the default decision:reject
Options:
:agent- a%Nous.Agent{}whose base text fills the components a profile does not set (see "Base text")
Renders report as a string.
Options:
:format-:markdown(default),:consoleor:json(canonical JSON ofto_map/1):max_cases- fixed cases listed, default20(broken cases are always listed in full):heading- Markdown heading level of the title, default1:context- unchanged lines shown around each change, default2
The report as JSON-native data (string keys, strings for atoms),
marked "schema" => "nous.profile_report/1".