Skip to main content

Confidence gating (PASS / FLAG / FILTER)

memledger applies a three-tier policy to every search result, gating on effective confidence — not declared confidence.

FlagEffective confidenceEffect
🟢 PASSflag_thresholdReturned normally
🟡 FLAGbetween min_threshold and flag_thresholdReturned with confidence_flag="FLAG" attribute
🔴 FILTER< min_thresholdExcluded from results

Configure thresholds per call:

result = await ml.search(
query="connection pool fix",
confidence_policy={"min_threshold": 0.4, "flag_threshold": 0.6},
)

Inspect the gate decision via the response metadata:

print(result.metadata["confidence_gating"])
# {'passed': 4, 'flagged': 1, 'filtered': 2,
# 'policy': {'min': 0.4, 'flag': 0.6}, ...}

For the conceptual framing — including how effective confidence is computed via the chain — see Confidence flags and Effective confidence.

The full configuration reference — global defaults via memledger.yaml, per-namespace overrides — ships in a future release.