Backup: Complete agent asset verification before implementation
- 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
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Operator Brief — Complex Decision Surfaces with Uncertainty Thresholds
|
||||
|
||||
Handles multi-factor decisions with explicit uncertainty quantification.
|
||||
Delegates complex decisions when confidence < threshold.
|
||||
"""
|
||||
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class OperatorBrief:
|
||||
def __init__(self, confidence_threshold=0.7):
|
||||
self.threshold = confidence_threshold
|
||||
self.decisions = []
|
||||
self.uncertainty_log = []
|
||||
|
||||
def evaluate(self, decision, factors, uncertainty=0.0):
|
||||
"""
|
||||
Evaluate decision with explicit uncertainty.
|
||||
|
||||
Args:
|
||||
decision: Decision string
|
||||
factors: Dict of contributing factors with weights
|
||||
uncertainty: Explicit uncertainty score (0.0-1.0)
|
||||
"""
|
||||
confidence = 1.0 - uncertainty
|
||||
|
||||
if confidence >= self.threshold:
|
||||
# Direct decision
|
||||
result = {
|
||||
'decision': decision,
|
||||
'confidence': confidence,
|
||||
'factors': factors,
|
||||
'uncertainty': uncertainty,
|
||||
'timestamp': datetime.utcnow().isoformat(),
|
||||
'action': 'EXECUTE'
|
||||
}
|
||||
else:
|
||||
# Defer to higher-level analysis
|
||||
result = {
|
||||
'decision': decision,
|
||||
'confidence': confidence,
|
||||
'factors': factors,
|
||||
'uncertainty': uncertainty,
|
||||
'timestamp': datetime.utcnow().isoformat(),
|
||||
'action': 'DEFER',
|
||||
'reason': f'Confidence {confidence:.2f} < threshold {self.threshold:.2f}'
|
||||
}
|
||||
|
||||
self.decisions.append(result)
|
||||
self.uncertainty_log.append(uncertainty)
|
||||
return result
|
||||
|
||||
def aggregate_uncertainty(self):
|
||||
"""Return average uncertainty across all decisions."""
|
||||
if not self.uncertainty_log:
|
||||
return 0.0
|
||||
return sum(self.uncertainty_log) / len(self.uncertainty_log)
|
||||
|
||||
def to_json(self):
|
||||
"""Export current state for logging."""
|
||||
return json.dumps({
|
||||
'decisions_count': len(self.decisions),
|
||||
'avg_uncertainty': self.aggregate_uncertainty(),
|
||||
'recent_decisions': self.decisions[-10:]
|
||||
}, indent=2)
|
||||
|
||||
|
||||
# Singleton instance
|
||||
operator_brief = OperatorBrief(confidence_threshold=0.7)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Test usage
|
||||
result = operator_brief.evaluate(
|
||||
"Deploy MTP monitoring to production",
|
||||
{
|
||||
'monitoring_active': True,
|
||||
'data_collection': True,
|
||||
'resource_impact': 'moderate'
|
||||
},
|
||||
uncertainty=0.2
|
||||
)
|
||||
print(f"Decision: {result['action']}")
|
||||
print(f"Confidence: {result['confidence']:.2f}")
|
||||
Reference in New Issue
Block a user