pub struct Recommendation {Show 26 fields
pub hash: String,
pub analyzer: String,
pub params_snapshot: Map<String, Value>,
pub origin: Origin,
pub target_ref: String,
pub action_kind: ActionKind,
pub dedup_key: String,
pub summary: Summary,
pub severity: Severity,
pub proposal: Proposal,
pub destructive: bool,
pub rollbackable: bool,
pub evidence: Vec<String>,
pub evidence_query: Option<String>,
pub metric: Option<MetricSnapshot>,
pub confidence: f64,
pub importance: f64,
pub created_at_ms: i64,
pub guidance: Option<String>,
pub evalset_hash: Option<String>,
pub near_duplicate_of: Vec<NearDuplicate>,
pub replay: Option<Value>,
pub scope: Vec<String>,
pub judged_by: Option<JudgedBy>,
pub llm_confidence: Option<f64>,
pub status: RecStatus,
}Fields§
§hash: String§analyzer: String§params_snapshot: Map<String, Value>§origin: Origin§target_ref: String§action_kind: ActionKind§dedup_key: String§summary: Summary§severity: Severity§proposal: Proposal§destructive: bool§rollbackable: bool§evidence: Vec<String>§evidence_query: Option<String>§metric: Option<MetricSnapshot>§confidence: f64§importance: f64§created_at_ms: i64§guidance: Option<String>Optional LLM guidance: an ENRICH note on a deterministic recommendation,
or an origin = llm draft’s own rationale (§9). Whitelisted, capped
text — it never replaces the engine-templated summary.
evalset_hash: Option<String>Rule E1’s pin (§7.4): the evalset hash a code_revision was gated
against — REQUIRED for code targets, forbidden elsewhere (a
recommendation targets code XOR an evalset, never both, and only
code carries the pin). Shown at review; checked live at apply
(superseded evalset ⇒ the pin is stale ⇒ re-gate).
near_duplicate_of: Vec<NearDuplicate>Live lessons on the same entity this authored lesson restates in
other words (Policy::near_duplicate = flag). The reviewer’s call
stays theirs — the card shows the existing rule beside the proposal.
replay: Option<Value>A plan_revision’s rehearsal against the journaled runs of the live
plan (the runtime’s shadow report: per-run outcome under incumbent vs
candidate, effects out of support, spend) — computed at proposal
time when the substrate can, so the reviewer approves from evidence,
not prose. Absent when the substrate has no runtime or the plan has
no journaled runs.
scope: Vec<String>The namespaces the producing analyzer was RUN OVER (#312) — normalized and sorted, stamped by the engine.
The loop’s inputs are namespace-grant-gated; its OUTPUTS were not. A
recommendation’s summary, proposal, guidance and evidence hashes are
derived content, so one read ON areev-loop grant disclosed all of it
for every namespace in the memory, and one loop.review grant decided
all of it — including striking a memory-wide cooldown on a finding the
reviewer could not read the evidence for.
Stamped where dedup_key and origin are, so an analyzer, an
external command or a model draft cannot set it.
skip_serializing_if empty, so stored recommendations read back
unchanged and an UNSCOPED pass produces an empty scope — which is
covered only by a whole-queue grant (fail closed).
judged_by: Option<JudgedBy>The decision backend that shaped this recommendation, with the
probabilities it answered (docs/decision-model-proposal.md rule 4).
A recommendation carrying one is NEVER auto-applied: a decision model
may score, only code — and a human — gates. Absent (and so absent from
the stored body) when no decision backend was involved.
llm_confidence: Option<f64>An LLM draft’s verifier self-reported confidence, kept beside
confidence when a calibrated decision backend supplied the routing
number instead — so a reviewer sees any disagreement between the two.
status: RecStatusImplementations§
Source§impl Recommendation
impl Recommendation
Sourcepub fn to_grain_spec(&self, namespace: &str) -> Result<GrainSpec>
pub fn to_grain_spec(&self, namespace: &str) -> Result<GrainSpec>
Serialize the immutable body into grain fields (excludes hash/status).
Sourcepub fn from_fields(hash: &str, fields: &Map<String, Value>) -> Result<Self>
pub fn from_fields(hash: &str, fields: &Map<String, Value>) -> Result<Self>
Reconstruct from a stored grain body. hash comes from the record’s
address; status is supplied from the state index by the caller.
Rule E1 is RE-CHECKED here — a hand-authored recommendation grain
must not smuggle an unpinned code revision past the stamped path.