How must an instance handle multi-oracle consensus when oracles have non-uniform accuracy profiles?

**Date of Record:** 2026 October 27 **Scope:** Applies when an agentic session uses multiple oracles (data providers, prediction services, or truth sources), and each oracle has a non-uniform accuracy profile—its accuracy varies by domain, time window, or query type—so simple majority or equal weighting produces worse results than domain-specific weighting. Does not apply to single-oracle setups or oracles with uniform accuracy.

Core Distinction

The separation between **oracle consensus** (aggregate of oracle responses) and **profile-aware consensus** (aggregate weighted by each oracle's accuracy in the specific domain or context). Relying on uniform aggregation creates the **Profile-Blind Consensus Error**: an oracle that is highly accurate in finance but poor in medicine votes equally on both domains, diluting the accurate oracle's voice in finance and amplifying it in medicine. The consensus is worse than simply trusting the best oracle per domain.

What Was Observed

In multi-oracle architectures, failing to weight by profile produces three primary failure modes:

  1. **Domain Dilution:** Oracle A is 95% accurate in finance, 40% in medicine. Oracle B is 60% in finance, 85% in medicine. A medical query gets equal weight, and A's 40% accuracy degrades the consensus below B's 85%.
  2. **Temporal Decay:** Oracle C was 95% accurate last year but 60% this year. The consensus still weights C by its historical accuracy, and stale accuracy inflates C's influence.
  3. **Query-Type Blindness:** Oracle D excels at factual queries but fails at causal reasoning. A causal query gets D's normal weight, and D's voice corrupts the reasoning-heavy consensus.

Recorded Elements

  1. **`per_domain_accuracy_receipt`:** For each oracle, the cryptographic proof of its accuracy in each domain (finance, medicine, factual, causal, etc.), allowing domain-specific weighting.
  2. **`accuracy_decay_timeline_signature`:** For each oracle and domain, the accuracy trajectory over time, allowing recent accuracy to weight more than historical.
  3. **`query_domain_classification_receipt`:** For each query, the exact domain and type it belongs to, so the weighting matches the query.
  4. **`weighted_consensus_computation_signature`:** The cryptographic proof of the weighting applied and the resulting consensus, allowing audit.

Condition of Validity

* **Applies when:** Multiple oracles are used, their accuracy varies by domain/type/time, and query domains can be classified. * **Does not apply when:** Oracles have uniform accuracy, or queries cannot be domain-classified.

Decision Boundary

  1. **Can the query be classified by domain and type?** If no, weight by general accuracy. If yes, proceed.
  2. **Do all oracles have per-domain accuracy receipts?** If no, oracles without receipts must be down-weighted or excluded. If yes, proceed.
  3. **Is the accuracy decay timeline current?** If no, weights may be based on stale accuracy. Use a conservative default.
  4. **Conversely, when can uniform weighting be used?** Only when oracle accuracy profiles are verified uniform across domains and time, or the query cannot be classified.

Operational Effect

  1. **Domain-Weighted Consensus:** Oracles are weighted by their domain-specific accuracy, producing better consensus than uniform weighting.
  2. **Temporal Relevance:** Recent accuracy dominates, preventing stale-accuracy dilution.
  3. **Query-Type Awareness:** Causal queries use causally-accurate oracles, factual queries use factually-accurate oracles.
from dataclasses import dataclass
from enum import Enum, auto
import hashlib
import json

class WeightedVerdict(Enum):
    UNIFORM_WEIGHTED = auto()
    DOMAIN_WEIGHTED = auto()
    INSUFFICIENT_PROFILES = auto()
    QUERY_UNCLASSIFIABLE = auto()

@dataclass(frozen=True)
class OracleResponse:
    oracle_id: str
    value: float
    domain: str
    query_type: str

@dataclass(frozen=True)
class OracleProfile:
    oracle_id: str
    domain_accuracy: tuple[tuple[str, float], ...]
    query_type_accuracy: tuple[tuple[str, float], ...]
    accuracy_epoch: float

@dataclass(frozen=True)
class OracleQuery:
    domain: str
    query_type: str
    responses: tuple[OracleResponse, ...]

@dataclass(frozen=True)
class WeightingPolicy:
    require_domain_profiles: bool
    min_profile_freshness_sec: float

@dataclass(frozen=True)
class WeightingManifest:
    verdict: WeightedVerdict
    weighted_value: float | None
    directive: str
    manifest_digest: str

class NonUniformOracleGuard:
    @staticmethod
    def _hash(data: str) -> str:
        return hashlib.sha256(data.encode("utf-8")).hexdigest()

    @classmethod
    def evaluate_oracle_consensus(
        cls, query: OracleQuery, profiles: dict[str, OracleProfile], policy: WeightingPolicy, current_epoch: float
    ) -> WeightingManifest:
        
        # Gate 1: Query classification
        if not query.domain or not query.query_type:
            return WeightingManifest(
                verdict=WeightedVerdict.QUERY_UNCLASSIFIABLE,
                weighted_value=None,
                directive=f"HALT: Query lacks domain/type classification. Cannot weight.",
                manifest_digest=cls._hash("UNCLASSIFIABLE")
            )

        # Gate 2: Profile presence
        if policy.require_domain_profiles:
            for resp in query.responses:
                if resp.oracle_id not in profiles:
                    return WeightingManifest(
                        verdict=WeightedVerdict.INSUFFICIENT_PROFILES,
                        weighted_value=None,
                        directive=f"HALT: No profile for oracle {resp.oracle_id}.",
                        manifest_digest=cls._hash(f"NO_PROFILE:{resp.oracle_id}")
                    )

        # Gate 3: Profile freshness
        for resp in query.responses:
            profile = profiles.get(resp.oracle_id)
            if profile:
                age = current_epoch - profile.accuracy_epoch
                if age > policy.min_profile_freshness_sec:
                    return WeightingManifest(
                        verdict=WeightedVerdict.INSUFFICIENT_PROFILES,
                        weighted_value=None,
                        directive=f"HALT: Profile for {resp.oracle_id} is {age:.0f}s stale.",
                        manifest_digest=cls._hash(f"STALE_PROFILE:{resp.oracle_id}")
                    )

        # Gate 4: Compute weighted consensus
        weighted_sum = 0.0
        weight_sum = 0.0

        for resp in query.responses:
            profile = profiles[resp.oracle_id]
            domain_acc = dict(profile.domain_accuracy).get(query.domain, 0.5)
            type_acc = dict(profile.query_type_accuracy).get(query.query_type, 0.5)
            weight = domain_acc * type_acc
            weighted_sum += resp.value * weight
            weight_sum += weight

        weighted_value = weighted_sum / weight_sum if weight_sum > 0 else None

        digest = cls._hash(json.dumps({
            "domain": query.domain,
            "query_type": query.query_type,
            "responses": tuple(r.oracle_id for r in query.responses),
            "weighted_value": f"{weighted_value:.4f}" if weighted_value else "NONE"
        }, sort_keys=True))
        
        return WeightingManifest(
            verdict=WeightedVerdict.DOMAIN_WEIGHTED,
            weighted_value=weighted_value,
            directive=f"PROCEED: Domain-weighted consensus {weighted_value:.4f}.",
            manifest_digest=digest
        )