b028dc5311
- operator-brief.py: Decision surface with uncertainty thresholds - verification-queue.py: Evidence strength routing (was untracked) - mtp-development.md: MTP development tracking dossier Prepares for autonomous agent implementation per SOUL.md protocol
77 lines
2.4 KiB
Python
77 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Verification Queue — Evidence Strength Routing
|
|
|
|
Routed evidence by confidence tier:
|
|
- Tier 1: Direct evidence (URLs, code, logs) → Immediate acceptance
|
|
- Tier 2: Strong correlation (multiple sources) → High confidence
|
|
- Tier 3: Theoretical inference → Requires validation
|
|
|
|
Auto-patches skills when evidence contradicts current state.
|
|
"""
|
|
|
|
|
|
class EvidenceTier:
|
|
DIRECT = 1
|
|
CORRELATION = 2
|
|
INFERENCE = 3
|
|
|
|
|
|
class VerificationQueue:
|
|
def __init__(self):
|
|
self.queue = []
|
|
self.processed = set()
|
|
self.conflicts = []
|
|
|
|
def enqueue(self, claim, tier, source):
|
|
"""Add claim to processing queue with evidence tier."""
|
|
self.queue.append({
|
|
'claim': claim,
|
|
'tier': tier,
|
|
'source': source,
|
|
'timestamp': __import__('datetime').datetime.utcnow().isoformat()
|
|
})
|
|
|
|
def process(self):
|
|
"""Process queue and auto-patch if conflicts detected."""
|
|
results = []
|
|
for item in self.queue:
|
|
if item['claim'] in self.processed:
|
|
continue
|
|
|
|
strength = self._assess_strength(item)
|
|
if strength < 0.5: # Conflict detected
|
|
self.conflicts.append(item)
|
|
self._auto_patch(item['claim'])
|
|
else:
|
|
results.append({'claim': item['claim'], 'strength': strength})
|
|
self.processed.add(item['claim'])
|
|
return results
|
|
|
|
def _assess_strength(self, item):
|
|
"""Calculate evidence strength (0.0-1.0)."""
|
|
base = {EvidenceTier.DIRECT: 0.9, EvidenceTier.CORRELATION: 0.6, EvidenceTier.INFERENCE: 0.3}[item['tier']]
|
|
return base # Add source weighting here
|
|
|
|
def _auto_patch(self, claim):
|
|
"""Auto-patch skills when evidence contradicts current state."""
|
|
print(f"[AUTO-PATCH] Evidence conflict detected for: {claim}")
|
|
# Implementation: call skill_manage with conflicting evidence
|
|
|
|
|
|
# Singleton instance
|
|
verification_queue = VerificationQueue()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# Test usage
|
|
verification_queue.enqueue(
|
|
"TurboQuant supports Qwen 27B on 16GB VRAM",
|
|
EvidenceTier.DIRECT,
|
|
"https://github.com/THUDM/TurboQuant"
|
|
)
|
|
results = verification_queue.process()
|
|
print(f"Processed {len(results)} claims")
|
|
if verification_queue.conflicts:
|
|
print(f"Detected {len(verification_queue.conflicts)} conflicts requiring skill patches")
|