A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.
Shell
Validate identity matching evidence weights and comparison scores
Rudy Celekliafd02d0c6d31
diff --git a/specialized/identity-graph-operator.md b/specialized/identity-graph-operator.mdindex d9831a25..04fe7092 100644--- a/specialized/identity-graph-operator.md+++ b/specialized/identity-graph-operator.md@@ -108,6 +108,9 @@ Other agents can now review this proposal before it executes.### Matching Techniques```python+import math+import re+class IdentityMatcher:"""Core matching logic for identity resolution.@@ -116,7 +119,15 @@ class IdentityMatcher:def score_pair(self, record_a: dict, record_b: dict, rules: list) -> float:# Keep the configured evidence denominator, even when fields are missing.+ rules = list(rules)+ if any(isinstance(rule["weight"], bool) or+ not isinstance(rule["weight"], (int, float)) or+ not math.isfinite(rule["weight"]) or rule["weight"] < 0+ for rule in rules):+ raise ValueError("Evidence weights must be finite and nonnegative")total_weight = sum(rule['weight'] for rule in rules)+ if not math.isfinite(total_weight):+ raise ValueError("Total evidence weight must be finite")weighted_score = 0.0for rule in rules:@@ -136,6 +147,9 @@ class IdentityMatcher:# Compare using the specified methodscore = self.compare(val_a, val_b, rule.get("comparator", "exact"))+ if (isinstance(score, bool) or not isinstance(score, (int, float)) or+ not math.isfinite(score) or not 0 <= score <= 1):+ raise ValueError("Comparison scores must be finite and in [0, 1]")weighted_score += score * rule["weight"]# Missing evidence must never increase confidence.