pub struct BrokerSection {Show 18 fields
pub default_budget_tokens: u32,
pub weights: BrokerWeights,
pub max_capsules: usize,
pub min_semantic_score: f32,
pub min_lexical_coverage: f32,
pub fusion: String,
pub normalization: String,
pub abstain_min_score: f32,
pub rerank_min_score: f32,
pub explicit_fact_guard: bool,
pub budget_floor_tokens: u32,
pub budget_run_cap_tokens: u32,
pub ambient: bool,
pub compress_capsules: bool,
pub session_dedupe: bool,
pub warm_start: bool,
pub answer_grade_min_score: f32,
pub proactive_prefetch: bool,
}Fields§
§default_budget_tokens: u32Flat per-stage budget (tokens). Used as a fallback when
task_size == 0 (broker disabled or task-size signal unavailable)
and as the compat default for pre-F3 project.toml files.
For live runs the adaptive budget (adaptive_budget) supersedes this.
weights: BrokerWeights§max_capsules: usizeD1f: hard cap on capsules rendered into a model prompt. The broker may surface more capsules than this (up to the token budget), but the pipeline render step truncates to this cap so a tighter, higher-precision capsule set isn’t silently padded back to a larger number. 0 = disabled (budget-only limit).
Default 8: lower than the old hard-coded 12 so precision from
D1e wins; operators can raise it per-project in project.toml.
#[serde(default)] keeps pre-D1f project.toml files loading.
min_semantic_score: f32D1e: absolute minimum cosine similarity between the query embedding and a candidate embedding required for the candidate to survive budgeting. When > 0.0, candidates whose cosine is strictly below this threshold are dropped BEFORE the MMR pass so a genuinely-irrelevant corpus hits the zero-capsule skipped path more often. Inert on lean (NoopEmbedder) builds because there is no query embedding to compare against.
Default -1.0 = AUTO (v1.0.0): the right floor is MODEL-DEPENDENT,
because cosine scales differ per embedder. bge-family cosines for
related pairs sit well above ~0.5 with noise below ~0.4, so auto
resolves to 0.35 there. jina-v2 cosines run lower — the remote
benchmark showed a 0.35 floor KILLING relevant results outright
(MRR 0.90 → 0.77, recall@2 == recall@4) — and that model’s own
precision already keeps noise low (~1.2 vs bge’s ~4.0 capsules on
no-answer queries, floors off), so auto resolves to 0.0 (disabled)
for non-bge models. Set an explicit value to override auto in
either direction; 0.0 disables. #[serde(default = …)] keeps older
configs loading with auto.
min_lexical_coverage: f32v1.0.0: absolute lexical relevance floor for memory candidates,
expressed as the fraction of the query’s IDF-weighted discriminating
power a memory must lexically cover to survive. Unlike
min_semantic_score (which needs a query embedding and is therefore
inert on the FTS-only UserPromptSubmit hook path), this floor works
on lexical retrieval — closing the gap where a broad conceptual query
(“what’s the idea of the repo”) surfaces unrelated memories that only
share a corpus-ubiquitous token like the project name.
Mechanics: query tokens are stripped of stopwords; each remaining token is IDF-weighted over the memory corpus (so the project name, present in nearly every memory, contributes ~0). A memory is dropped when the IDF-weighted share of the query it covers is below this floor AND it has no semantic support. Repo-file/manifest capsules pass through untouched (their FTS match on file content is itself the relevance signal, and overview queries want the README).
Default 0.5 = “must cover the more-discriminating half of the query.”
0.0 disables the floor. #[serde(default = …)] keeps older configs
loading with the floor active.
fusion: Stringv2.6: how the broker merges candidate lists from different retrieval strategies (lexical FTS, semantic ANN, graph traversal).
"linear"(default) — union the lists, keeping each memory’s bestraw_relevance, itself a linear blend of BM25 and cosine at α = 0.5. Kimetsu’s behaviour through v2.5."rrf"— reciprocal rank fusion. Uses only each candidate’s rank in each list, so the fact that BM25 is unbounded and corpus-dependent while cosine is bounded and tightly clustered stops mattering, and a memory both lists rank highly beats one a single list loves.
Defaults to linear because the house rule is that every claim ships
with a measurement, and “RRF is the 2026 default” is not one for this
corpus. kimetsu brain tune sweeps both against your own query history.
Unknown values fall back to linear.
normalization: Stringv2.6: how a candidate’s raw relevance is normalized into the
relevance term of the composite score.
"per_kind"(default) — normalize within each capsule kind, so the best memory and the best repo_file each land atrelevance = 1.0however good either is. Kimetsu’s behaviour through v2.5."global"— one max across every candidate, so relevance means the same thing across kinds and the best of an irrelevant kind stays low.
Per-kind normalization is the reason the lexical and semantic floors
have to exist: they prune weak candidates before normalization can
flatter them to 1.0. Global is the more principled rule, and it is
still not the default, because a ranking change ships with a
measurement on a corpus and not with an argument. Unknown values fall
back to per_kind.
abstain_min_score: f32Abstention floor for the whole retrieval, on the ABSOLUTE evidence
scale (v2.7): the best raw query-cosine any memory candidate achieved.
When set above zero and no cosine-backed memory candidate clears it —
and the bundle would contain only memory capsules — the context bundle
comes back empty (skipped) so the reader abstains instead of answering
from weak matches. Lean builds and cross-model rows have no comparable
cosine verdict and are exempt rather than judged on a lexical scale.
History: v2.5 introduced this as a floor on the NORMALIZED composite,
which could never fire — normalization hands the top candidate
relevance 1.0, putting the composite’s floor at ~0.57 regardless of
match quality (the workflow benchmark measured false-injection 1.00 at
a 60-memory corpus). The evidence scale is corpus-size-independent.
For jina-v2/bge-family embedders, genuinely-relevant matches typically
sit at raw cosine 0.6+, unrelated dev text at 0.35-0.55. 0.0 disables;
-1.0 = per-model AUTO (0.55 for jina-v2 — swept on the workflow
benchmark — and bge provisionally; off for uncalibrated families, the
same rule as min_semantic_score). The band one width below the floor
is arbitrated by the cross-encoder where one is available.
KIMETSU_ABSTAIN_EVIDENCE overrides at retrieval time (sweeps).
#[serde(default = …)] keeps older project.toml files loading
unchanged (off).
rerank_min_score: f32Final cross-encoder admission floor. Scores are model-specific, not calibrated probabilities. Zero disables this floor (not cosine gating).
explicit_fact_guard: boolRequire visible value evidence for recognized explicit configuration questions. Experimental, opt-in English/Spanish rules; not a general entailment check. Unsupported wording retains normal retrieval.
budget_floor_tokens: u32F3: floor for the adaptive per-stage brain budget. Small tasks
receive at least this many tokens so the brain is never starved.
#[serde(default)] keeps pre-F3 project.toml files loading cleanly.
budget_run_cap_tokens: u32F3: per-run global ceiling on brain-injected tokens across ALL
stages combined. Later stages receive only the remaining capacity
once earlier stages have been charged via the RunRecallLedger.
#[serde(default)] keeps pre-F3 project.toml files loading cleanly.
ambient: boolW3.2: persistent ambient-context off-switch. When false, the
workspace fingerprint (branch, recent files, dirty status) is not
collected or appended to the retrieval query. Precedence:
KIMETSU_BRAIN_AMBIENT env override > this field > default (true).
#[serde(default = "default_true")] keeps pre-W3 project.toml
files loading unchanged.
compress_capsules: boolv1.5 (Story 2.1): render-time capsule compression. When true (default),
capsule summaries are compressed with [compress_for_render] before
being injected into hook stdout or MCP tool responses. Compression
strips [tags: ...] / (context: ...) annotations and caps at 3
sentences. Ranking is NEVER affected — compression runs only after
retrieval and reranking. Set false to inject full memory text (useful
for debugging or when summaries are already concise).
#[serde(default = "default_true")] keeps pre-v1.5 project.toml files
loading cleanly (they get compression ON).
session_dedupe: boolv1.5 (Story 2.3): session-scoped cross-turn capsule dedupe. When true
(default), the UserPromptSubmit context hook skips capsules whose
expansion_handle was already injected earlier in the same session
(tracked via the proactive-state sidecar). A soft policy: skipping only
happens when at least one NEW capsule remains — if dedupe would empty
the injection entirely, all capsules are injected anyway (a repeated
top memory may still be the right context). Set false to disable
session dedupe and always inject the full ranked set.
#[serde(default = "default_true")] keeps pre-v1.5 project.toml files
loading cleanly (they get session dedupe ON).
warm_start: boolFlagship 1 / Pass B: inject the repo digest + work-resume context at
SessionStart. When true (default), kimetsu brain session-start-hook
prints additionalContext JSON combining the ~400-token repo digest
(1.1) and the episodic resume (Pass A). Set false to suppress the
warm-start injection entirely — useful when the host already provides
repo context or the digest is not yet built.
#[serde(default = "default_true")] keeps pre-Flagship-1 project.toml
files loading cleanly (they get warm_start ON — the feature is additive
and defaults to enabled so fresh installs get it immediately).
answer_grade_min_score: f32Flagship 3 / Pass B (3.3): minimum composite broker score for a capsule to receive the “Verified answer from project memory:” prefix at render time. This prefix signals to the model that it can act in one turn rather than re-verifying the information.
STRICTLY ADDITIVE: only changes the rendered prefix of an already-top capsule. Ranking, floors, and capsule selection are NEVER affected.
The threshold is deliberately conservative (0.92 default) so the marker
is rare and only fires on genuinely unambiguous matches. Tune with
kimetsu brain bench data (Epic S2) before lowering. Set to 1.1 (above
the maximum achievable score) to disable entirely, or 0.0 to always
mark any top capsule (not recommended — wait for regret data first).
Regret guard: if the capsule’s memory was recently dropped by floors in another retrieval context (appears in the dropped sidecar), the prefix is suppressed regardless of this threshold, preventing overconfident labelling of inconsistently-scored memories.
#[serde(default = …)] keeps all pre-F3 project.toml files loading
unchanged (they get the conservative default).
proactive_prefetch: boolFlagship 3 / Pass B (3.5): opt-in proactive pre-fetch at PreToolUse.
When true, the PreToolUse hook does a LIGHTWEIGHT relevance warm based on the current tool’s file path (in addition to the command text), surfacing a relevant memory before the agent edits or reads a file. The existing floors (min_score, max_capsules, session dedupe, refractory throttle) all apply — this is additive only.
Default false (OFF): the PreToolUse hook behaviour is identical to before this flag existed.
v2.6: graduating to default-on has always been stated to depend on
evidence that file-path-augmented queries do not increase noise — and
nothing was recording which hook surface an injection came from, so
that evidence could not accumulate and the flag could not graduate on
any timescale. Injections now carry their surface
(inject_policy::Surface), and kimetsu brain policy reports
acceptance per surface, so the prefetch surface can be compared against
the ones that react to something observed rather than predicted. The
default stays off until that comparison is made on a real brain; the
point of this change is that it is now makeable. Enable per-project in
project.toml meanwhile.
#[serde(default)] keeps all pre-F3 project.toml files loading with
the feature OFF (zero behaviour change for existing users).
Trait Implementations§
Source§impl Clone for BrokerSection
impl Clone for BrokerSection
Source§fn clone(&self) -> BrokerSection
fn clone(&self) -> BrokerSection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more