pub struct ContextRequest {Show 19 fields
pub include_fact_evidence: bool,
pub defer_fact_budget: bool,
pub stage: String,
pub query: String,
pub budget_tokens: u32,
pub fusion: String,
pub normalization: String,
pub tags: Vec<String>,
pub min_score: f32,
pub max_capsules: usize,
pub prefer_roles: Vec<String>,
pub kinds: Vec<String>,
pub min_semantic_score: f32,
pub min_semantic_score_override: Option<f32>,
pub min_lexical_coverage: f32,
pub min_lexical_coverage_override: Option<f32>,
pub task_kind: TaskKind,
pub abstain_evidence: f32,
pub abstain_evidence_override: Option<f32>,
}Fields§
§include_fact_evidence: boolHydrate structured evidence only for consumers that explicitly request it.
defer_fact_budget: boolDefer intermediate budgeting to a final evidence-aware renderer; requires a bounded pool.
stage: String§query: String§budget_tokens: u32§fusion: Stringv2.6: per-request override for how the lexical and semantic rankings
are merged ("linear" / "rrf"; see crate::fusion).
Empty (the default) means “use [broker] fusion”. This exists so
kimetsu brain tune can sweep the two rules against one corpus in one
process — the reason the shipped default is still linear is that
nothing had measured the alternative on a real brain.
normalization: Stringv2.6: per-request override for how raw_relevance is normalized into
the relevance term ("per_kind" / "global"; see
Normalization).
Empty (the default) means “use [broker] normalization”. Exists for
the same reason fusion does: the alternative had to be measurable on
one corpus in one process before it could be argued for.
v0.6: domain-hint tags. Capsules whose text or kind contains any
of these strings receive a 1.4× score boost, pushing on-domain
capsules above the min_score threshold when they would otherwise
be filtered out.
min_score: f32v0.6: minimum composite score for inclusion. When > 0.0 and the
top-scoring capsule falls below this threshold, ContextBundle
is returned with skipped: true and an empty capsule list —
zero tokens injected. 0.0 (default) disables the check.
max_capsules: usizev0.6: hard cap on returned capsules regardless of token budget. 0 = no cap (budget-only limit, prior behaviour).
prefer_roles: Vec<String>v0.6: role-preference boost. Capsules whose kind matches one
of these strings receive an additional 1.3× multiplier after the
tag boost (e.g. ["semantic_operator", "anti_pattern"] for bench).
kinds: Vec<String>v0.8: hard kind filter applied BEFORE scoring + capping. When
non-empty, only candidates whose capsule kind is in this list
survive — so a higher-ranked repo file or off-kind memory can’t
consume a (often single) slot. Used by the proactive engine to
restrict recall to actionable kinds (failure_pattern, command,
convention). Empty (default) keeps all kinds, prior behaviour.
min_semantic_score: f32D1e: absolute cosine-similarity floor. On embeddings builds,
memory candidates whose cosine to the query is below this
threshold are dropped before budgeting. 0.0 (default) disables
the floor — matches pre-D1e behaviour. Repo-file and manifest
candidates are unaffected (they have no cosine score). Populated
from BrokerSection.min_semantic_score by the pipeline; callers
that don’t set it get the prior behaviour automatically.
min_semantic_score_override: Option<f32>Explicit public override: None preserves legacy zero=inherited; Some(0) disables, Some(-1) selects model auto, Some(positive) sets a floor.
min_lexical_coverage: f32v1.0.0: absolute lexical relevance floor for memory candidates,
as the fraction of the query’s IDF-weighted discriminating power a
memory must cover. Unlike min_semantic_score this needs no query
embedding, so it protects the FTS-only hook path. When > 0.0, memory
candidates below the floor are dropped BEFORE scoring (so they don’t
even set the per-kind normalization max). Repo-file/manifest
candidates are unaffected. 0.0 (default) disables it — every existing
..Default::default() construction is unchanged. Populated from
BrokerSection.min_lexical_coverage by the pipeline.
min_lexical_coverage_override: Option<f32>Some(0) explicitly disables the lexical floor; None inherits legacy behavior.
task_kind: TaskKindE3: inferred kind of the current task. Defaults to Feature
(the neutral kind) so every existing ..Default::default()
construction is unchanged — Feature does NOT alter weights or
prefer_roles. Set by the pipeline via classify_task at intake.
abstain_evidence: f32v2.7: ABSOLUTE abstention floor. min_score above compares against the
normalized composite, whose top candidate always carries relevance 1.0
— it can rank candidates but cannot express “nothing here is genuinely
relevant”, so it never abstains on a plausible-but-wrong corpus (the
workflow benchmark measured false-injection 1.00 at a 60-memory brain).
This floor gates on absolute evidence instead: the best raw cosine any
memory candidate achieved. When > 0.0 and no cosine-backed memory
candidate clears it — and the bundle would contain only memory capsules
— the retrieval returns skipped: true with zero tokens injected.
Lexical-only and cross-model candidates are unmeasured on this scale and
therefore exempt. Repo-file/manifest capsules also suppress the gate: an
FTS hit on real repo content is its own evidence the bundle is useful.
0.0 (default) disables the gate. Populated from
BrokerSection.abstain_min_score by the pipeline.
abstain_evidence_override: Option<f32>Some(0) disables abstention; Some(-1) uses model auto; None inherits.
Trait Implementations§
Source§impl Clone for ContextRequest
impl Clone for ContextRequest
Source§fn clone(&self) -> ContextRequest
fn clone(&self) -> ContextRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more