Skip to main content

Crate chump_belief_state

Crate chump_belief_state 

Source
Expand description

Belief state module: maintains per-tool confidence and task-level uncertainty, updated each turn via Bayesian beta-distribution updates.

Implements the proactive uncertainty awareness from Active Inference (Section 2.1 of CHUMP_TO_COMPLEX.md). The belief state drives Expected Free Energy scoring and epistemic escalation.

Part of the Synthetic Consciousness Framework, Section 2.

Structs§

EFEScore
Expected Free Energy components for a candidate tool call.
TaskBelief
Task-level belief state: overall confidence in the current task trajectory.
ToolBelief
Per-tool reliability belief, modeled as a Beta(alpha, beta) distribution. Alpha = successes + 1 prior, Beta = failures + 1 prior.

Functions§

belief_state_enabled
Returns false when CHUMP_BYPASS_BELIEF_STATE=1 (or true).
context_summary
Format belief state summary for context injection. Returns an empty string when CHUMP_BYPASS_BELIEF_STATE=1 (no injection).
decay_turn
Decay task freshness (call once per turn). No-op when CHUMP_BYPASS_BELIEF_STATE=1.
metrics_json
JSON metrics for the health endpoint.
nudge_trajectory
Adjust trajectory confidence by a delta (positive = increase, negative = decrease). Used by the perception layer to lower confidence when input is highly ambiguous. No-op when CHUMP_BYPASS_BELIEF_STATE=1.
restore_from_snapshot
Restore belief state from a snapshot (used by speculative execution rollback).
score_tools
Score a set of candidate tools by Expected Free Energy. Returns scores sorted by G ascending (lowest G = best choice).
score_tools_except
Score all known tools except excluded, sorted by EFE ascending (best first).
should_escalate_epistemic
Should the agent escalate to the human due to epistemic uncertainty? Returns false (no escalation) when CHUMP_BYPASS_BELIEF_STATE=1. Otherwise returns true when task uncertainty is very high (> threshold).
snapshot_inner
Snapshot the full inner state for speculative execution forking.
task_belief
Get the current task belief state.
tool_belief
Get belief for a specific tool.
tool_reliability
Reliability of a single tool from the Beta mean. Returns 0.5 (prior) if unknown.
update_tool_belief
Record a tool call outcome and update beliefs. No-op when CHUMP_BYPASS_BELIEF_STATE=1.