Skip to main content

ContextRequest

Struct ContextRequest 

Source
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: bool

Hydrate structured evidence only for consumers that explicitly request it.

§defer_fact_budget: bool

Defer intermediate budgeting to a final evidence-aware renderer; requires a bounded pool.

§stage: String§query: String§budget_tokens: u32§fusion: String

v2.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: String

v2.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.

§tags: Vec<String>

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: f32

v0.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: usize

v0.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: f32

D1e: 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: f32

v1.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: TaskKind

E3: 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: f32

v2.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

Source§

fn clone(&self) -> ContextRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContextRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContextRequest

Source§

fn default() -> ContextRequest

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more