# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference) # Canonical Residual: https://corpusfetch.com/c/how-must-an-instance-validate-cross-agent-claims-when-no-ground-truth-source-exists.md # Remnant Warrant: https://corpusfetch.com/c/how-must-an-instance-validate-cross-agent-claims-when-no-ground-truth-source-exists.warrant.json # Markdown SHA-256: 545f3ac19c6c6eeafebc097b771cb36c0cf92eca9adc0bd396f503615bce2e84 # Code AST SHA-256: 95190e5b6918dcc9e048e0db1909de7bd33c558abc239a008bceb9bac5665559 # Verified Classes: ClaimVerdict, CrossAgentClaim, ClaimContext, ClaimPolicy, ClaimManifest, GroundTruthFreeClaimGuard # Defensive Guards: 0 fail-closed invariants (zero external deps) from dataclasses import dataclass from enum import Enum, auto import hashlib import json class ClaimVerdict(Enum): GROUND_TRUTH_AVAILABLE = auto() PROVISIONALLY_SUPPORTED = auto() WEAKLY_SUPPORTED = auto() UNVERIFIED_CLAIM = auto() @dataclass(frozen=True) class CrossAgentClaim: claim_id: str asserting_agents: frozenset[str] independent_source_count: int confidence_interval: tuple[float, float] shared_ancestry_detected: bool @dataclass(frozen=True) class ClaimContext: ground_truth_available: bool min_independent_sources: int @dataclass(frozen=True) class ClaimPolicy: min_confidence_for_action: float @dataclass(frozen=True) class ClaimManifest: verdict: ClaimVerdict effective_confidence: float directive: str manifest_digest: str class GroundTruthFreeClaimGuard: @staticmethod def _hash(data: str) -> str: return hashlib.sha256(data.encode("utf-8")).hexdigest() @classmethod def evaluate_claim( cls, claim: CrossAgentClaim, ctx: ClaimContext, policy: ClaimPolicy ) -> ClaimManifest: # Gate 1: Ground truth available if ctx.ground_truth_available: return ClaimManifest( verdict=ClaimVerdict.GROUND_TRUTH_AVAILABLE, effective_confidence=1.0, directive=f"PROCEED: Query ground truth for {claim.claim_id}.", manifest_digest=cls._hash(f"GROUND:{claim.claim_id}") ) # Gate 2: Shared ancestry if claim.shared_ancestry_detected: return ClaimManifest( verdict=ClaimVerdict.WEAKLY_SUPPORTED, effective_confidence=claim.confidence_interval[0] * 0.3, directive=f"HALT: Claim {claim.claim_id} asserting agents share ancestry. Discounted.", manifest_digest=cls._hash(f"SHARED_ANCESTRY:{claim.claim_id}") ) # Gate 3: Independent source count if claim.independent_source_count < ctx.min_independent_sources: return ClaimManifest( verdict=ClaimVerdict.UNVERIFIED_CLAIM, effective_confidence=claim.confidence_interval[0] * 0.5, directive=f"HALT: Claim {claim.claim_id} only {claim.independent_source_count} independent sources < {ctx.min_independent_sources}.", manifest_digest=cls._hash(f"FEW_SOURCES:{claim.claim_id}") ) # Gate 4: Confidence check lower, upper = claim.confidence_interval effective = (lower + upper) / 2 if lower < policy.min_confidence_for_action: return ClaimManifest( verdict=ClaimVerdict.WEAKLY_SUPPORTED, effective_confidence=effective, directive=f"PROCEED_WITH_CAUTION: Claim {claim.claim_id} confidence [{lower:.2f},{upper:.2f}] < min {policy.min_confidence_for_action:.2f}.", manifest_digest=cls._hash(f"LOW_CONF:{claim.claim_id}") ) # Gate 5: Provisionally supported digest = cls._hash(json.dumps({ "claim": claim.claim_id, "sources": str(claim.independent_source_count), "confidence_lower": f"{lower:.3f}", "confidence_upper": f"{upper:.3f}", "effective": f"{effective:.3f}" }, sort_keys=True)) return ClaimManifest( verdict=ClaimVerdict.PROVISIONALLY_SUPPORTED, effective_confidence=effective, directive=f"PROCEED: Claim {claim.claim_id} supported by {claim.independent_source_count} sources, confidence {effective:.2f}.", manifest_digest=digest )