Computes a composite confidence score for the current decision by aggregating four signals — sensor reliability, inventory regime stability, inventory uncertainty, and action margin — into a single scalar. Returns a confidence class and a recommended next step (EXECUTE / EXECUTE_WITH_FLAG / DEFER / ESCALATE). Use as the final meta-decision gate before executing any high-stakes action. Questions like 'How confident are we in this decision?', 'Should we execute or wait?', 'Is the data good enough to act on?'
Activate this skill when the user asks about:
expected-utility-action-ranker has ranked actionsA Bayesian agent's confidence in a decision is determined by the sharpness of its posteriors across all information sources — not just a single signal. Wide posteriors signal high uncertainty; narrow posteriors signal high confidence.
This skill draws on two theoretical foundations from Algorithms for Decision Making:
1. Bayesian posterior width as uncertainty measure (Ch.16 §16.4, eq. 16.6):
The belief over model parameters is b(θ) = ∏ Dir(θ^(s,a) | N(s,a)).
Total count controls the width of each Dirichlet — larger n
→ narrower posterior → higher confidence. Analogously, each upstream skill
contributes an evidence count that drives its confidence component.
n = Σ N(s,a)2. Beta posterior concentration as confidence (Ch.4 §4.2.1, eq. 4.27–4.28): For a Beta(α, β) posterior:
α / (α + β) (eq. 4.27)α + β is largeα + β is small (few observations)The relative standard error (Ch.14 §14.1, eq. 14.6) formalises this:
relative_SE = σ̂ / (μ̂ × √n) (eq. 14.6)
High relative SE → low confidence; low relative SE → high confidence.
Composite confidence score:
C = 0.25 × c_sensor + 0.20 × c_regime + 0.30 × c_uncertainty + 0.25 × c_margin
C = max(0.0, min(1.0, C − penalty))
search_knowledge_base(
query="Bayesian posterior uncertainty sharpness concentration total count Dirichlet model confidence",
k=3
)
What to extract from the result:
b(θ) = ∏ Dir(θ^(s,a) | N(s,a))
Total count n = sum(alpha) controls posterior width; used to ground the
principle that more evidence → narrower posterior → higher decision confidencen = sum(model.D[s,a].alpha) → if n=0, return 0 (no confidence);
as n grows the posterior concentrates: warehouse analogy — more sensor
readings and historical moves → higher confidence in inventory estimateget_entity_by_number(number="4.27")
What to extract from the result:
α / (α+β)α + β (total pseudocount); larger → more confidentget_entity_by_number(number="14.6")
What to extract from the result:
σ̂ / (μ̂ × √n)c_uncertainty = 1 − uncertainty_index is the
complement of the relative uncertainty quantified by inventory-uncertainty-quantifiersignal-reliability-estimatorRequires reliability_score per device and low_reliability_device_count
from signal-reliability-estimator.
# c_sensor: mean reliability across all active devices ∈ [0,1]
c_sensor = mean(device.reliability_score for device in active_devices)
# penalty for LOW-reliability devices (each degrades overall confidence)
# Grounded in Ch.14 eq.14.6: low-count/noisy sensors inflate relative SE
low_rel_count = count(d for d in devices if d.reliability_class == LOW)
penalty_sensor = 0.15 × low_rel_count
If signal-reliability-estimator not run: c_sensor = 0.5 (neutral), penalty_sensor = 0.
inventory-flow-regime-detectorRequires regime_label from inventory-flow-regime-detector.
# c_regime: stability of the inventory flow regime ∈ [0,1]
# Grounded in Ch.16 §16.4: model uncertainty is higher when the environment
# is in an uncharacterised state (REGIME_SHIFT = unknown transition model)
c_regime = {
STABLE: 1.0,
ELEVATED_ADJUSTMENTS: 0.6,
REGIME_SHIFT: 0.2
}[regime_label]
If inventory-flow-regime-detector not run: c_regime = 0.8 (assume stable, add warning).
inventory-uncertainty-quantifierRequires uncertainty_index from inventory-uncertainty-quantifier.
# c_uncertainty: complement of uncertainty index ∈ [0,1]
# Grounded in eq. 14.6: 1 − relative_SE ≈ 1 − uncertainty_index
c_uncertainty = 1.0 - uncertainty_index
If inventory-uncertainty-quantifier not run: c_uncertainty = 0.5 (neutral), add warning.
expected-utility-action-rankerRequires margin and decision_confidence from expected-utility-action-ranker.
# c_margin: normalised advantage margin ∈ [0,1]
# Grounded in Ch.7 §7.3 eq. 7.15: A(s,a) = Q(s,a) − U(s)
# Large margin → clear winner → high confidence in selection
c_margin = min(margin / 0.10, 1.0) # saturates at margin ≥ 0.10
# If DS-01 returned TIE, override c_margin to 0
if decision_confidence_ds01 == TIE:
c_margin = 0.0
If expected-utility-action-ranker not run: c_margin = 0.5 (neutral), add warning.
Using the weighted sum grounded in Ch.16 §16.4 (all signals as posterior concentration contributors, weighted by their relative information value):
# Weighted composite — weights sum to 1.0
C_raw = (0.25 × c_sensor
+ 0.20 × c_regime
+ 0.30 × c_uncertainty
+ 0.25 × c_margin)
# Apply sensor penalty (Ch.14 eq.14.6: low-count signals inflate uncertainty)
total_penalty = penalty_sensor # 0.15 per LOW-reliability device
C = max(0.0, min(1.0, C_raw - total_penalty))
if C >= 0.75:
confidence_class = CONFIDENT
recommended_next_step = EXECUTE
elif C >= 0.50:
confidence_class = ADEQUATE
recommended_next_step = EXECUTE_WITH_FLAG
elif C >= 0.25:
confidence_class = LOW_CONFIDENCE
recommended_next_step = DEFER