mixle.substrate.belief module

Calibrated belief store: harvest claims from model output and assimilate them as CREDENCES.

A model’s output is a paragraph of assertions – some grounded, some not. This module turns each assertion into a tracked belief with a probability (not a binary “fact” flag) that moves with the STRENGTH of its evidence: a verifiable source (a document, an executable check, a held-out truth, a real measurement) moves it strongly; the model’s own say-so moves it weakly and is capped low. Every belief carries its full evidence_history so the current credence is always reproducible by replaying it, and evidence can be revised or retract()-ed, cascading to whatever depended on it.

Anti-laundering is the load-bearing property: evidence that resolves back to the claim itself, or to another belief that has no independent (non-model-assertion) support of its own, contributes ZERO – a claim cannot bootstrap high credence by citing itself or an equally ungrounded peer.

This is the write side of the knowledge substrate: harvest, credence assimilation, and traceable history. The retrieval side is mixle.substrate.retrieve.

class Claim(text, produced_by=<factory>, quantity=None)[source]

Bases: object

One atomic proposition (or typed quantity) pulled from a model’s output.

Parameters:
class EvidenceEntry(source_id, tier, direction='+', weight=1.0, time=<factory>)[source]

Bases: object

One piece of evidence that moved a belief’s credence, in the order it was applied.

Parameters:
class BeliefItem(id, claim, credence, evidence_history=<factory>, scope='local')[source]

Bases: object

A claim’s current credence plus the full evidence trail that produced it.

Parameters:
  • id (str)

  • claim (Claim)

  • credence (float)

  • evidence_history (list[EvidenceEntry])

  • scope (str)

harvest_knowledge(model_output, *, source, extract=None)[source]

Split model_output into atomic claims, each stamped with source (which model produced it, its confidence, etc). Default extraction is sentence-level (mixle.reason.llm.sentence_claims()); pass extract for a different atomic-proposition splitter.

Parameters:
Return type:

list[Claim]

credence_from_history(evidence_history)[source]

The credence implied by an evidence history alone – a pure function, so replaying a belief’s stored evidence_history through this always reproduces its current credence exactly.

Parameters:

evidence_history (Sequence[EvidenceEntry])

Return type:

float

assimilate(sub, claim, evidence, *, scope='local')[source]

Bayesian-ish update of the belief in claim from evidence – never a binary write.

Finds or creates the belief item (keyed on normalized claim text) and appends each evidence entry ({"source_id", "tier", "direction": "+"/"-", "weight"}); tier must be one of _TIER_STRENGTH ("model_assertion" plus mixle.doe.oracle.VERIFIABILITY_TIERS).

Anti-laundering: an entry whose source_id resolves back to THIS belief (a cycle) or to another belief item with no independent (non-model-assertion) support of its own is stored with an effective weight of zero – it cannot move the credence, though it stays in the trail for audit.

Parameters:
Return type:

BeliefItem

retract(sub, source_id, *, scope=None)[source]

Remove every evidence entry citing source_id, recomputing credence, and CASCADE: if that removal causes a belief to lose its only independent support, also strip citations of THAT belief from whatever cited it, recursively. Returns every belief item touched by the cascade.

Parameters:
  • sub (Substrate)

  • source_id (str)

  • scope (str | None)

Return type:

list[BeliefItem]

retrieve_beliefs(sub, query, *, k=8, min_credence=None, scope=None)[source]

Beliefs relevant to query, optionally thresholded on min_credence and re-ranked by relevance * credence – so a caller can weight by, or hard-filter on, how much the store actually believes each item (never a “fact” vs “non-fact” partition, only credence).

Parameters:
  • sub (Substrate)

  • query (str)

  • k (int)

  • min_credence (float | None)

  • scope (str | None)

Return type:

list[BeliefItem]