Entity Resolution Strategy Selector
Overview
Entity resolution determines when two data records refer to the same
real-world entity — the cornerstone that lets an agent maintain a coherent
worldview across fragmented systems. If the agent cannot decide when two
references are the same entity, its whole reasoning framework collapses: the
graph either conflates distinct entities or fragments a single one.
The chapter draws one decisive distinction, and this skill turns it into a
selection:
- Evidence-based resolution examines specific features, applies
domain-specific matching rules, and builds a case from concrete evidence. It
is deterministic (same input, same output), explainable (every match
cites which features drove it and their scores), culturally robust
(explicit rules handle Arabic / Chinese / Russian naming), and calibrated
(confidence reflects actual match accuracy).
- Generalization-based AI (an LLM) infers from statistical similarity
learned in training. It is nondeterministic, its explanations are
post-hoc rationalizations, it breaks on non-Western names, and its
confidence is not tied to accuracy.
Evidence-based wins for identity, compliance, high-stakes, and adversarial
work. The sharp case is channel separation: a money launderer appears as
Bob Jones, then Bob R. Smith II at the same address with different phone
formatting, then Robert Smith Jr. elsewhere with overlapping contact details —
each variation engineered to pass fuzzy filters while looking distinct. Simple
string matching fails catastrophically; what wins is consolidating fragmented
identities on evidence from multiple overlapping features.
The selector scores a requirement profile across the six factors the chapter
names (high_stakes, adversarial channel-separation, explainability,
determinism, cultural_variation, training_examples) and returns
evidence-based, generalization-AI, or a hybrid (LLM for cheap candidate
generation, evidence-based for the auditable final decision). The matcher
makes the trade-off concrete: it scores name/address/phone similarity,
aggregates to an explainable confidence with per-feature evidence metadata
(the chapter's "89% because NAME 87%, ADDRESS 100%, PHONE 95%"), classifies
the graph edge (RESOLVED / POSSIBLY_RELATED / DISCLOSED), and flags the three
edge cases that require domain and cultural knowledge.
When to Use
- Standing up entity resolution for an agent knowledge graph and deciding the
resolution strategy
- Justifying evidence-based vs LLM matching in a design doc for identity,
compliance, or fraud work
- Auditing a proposed merge: what confidence, on what evidence, and is it an
edge case?
Phrases: "entity resolution", "record linkage", "deduplication", "are these
the same entity", "evidence-based vs LLM matching", "channel separation",
"RESOLVED edge", "match confidence explainability".
When NOT to Use
- The extraction stage. Producing the records (LLM triple extraction,
iText2KG / RAKG / ATOM construction) is upstream; this skill decides identity
once records exist.
- Picking a specific ER product. This chooses the strategy and gives a
reference matcher, not Senzing-vs-build. Vendor choice is downstream.
- Arity-2 relationship modeling. Whether a fact needs a hyperedge is the
graph-model-selector skill; this one is about identity, not structure.
- A domain with no identity stakes. Genuinely low-stakes fuzzy dedup with
abundant labeled examples and no compliance need can use generalization-AI —
the selector will say so.
Process
| Step |
Input |
Action |
Output |
Verification |
| 1 |
Requirement profile (6 weights 0..3) |
lib.score_strategies(profile) |
[(strategy, score), ...] sorted desc |
weights * factor-affinities, descending order |
| 2 |
Same |
lib.recommend_strategy(profile) |
{recommended, scores, rationale, hybrid_recommended} |
evidence-based wins high-stakes/adversarial; generalization-AI wins example-rich low-stakes; hybrid when mixed |
| 3 |
Two records {name, address, phone} |
lib.resolve_match(a, b, weights) |
{confidence, edge_type, features_used, evidence[]} |
confidence == sum of per-feature contributions; evidence names which features drove it |
| 4 |
A match confidence (or declared=True) |
lib.classify_edge(conf, declared) |
{edge_type, confidence, reason} |
>=0.85 RESOLVED, >=0.5 POSSIBLY_RELATED, else NO_MATCH; declared -> DISCLOSED |
| 5 |
Two records |
lib.flag_edge_cases(a, b) |
list of {case, warning, action} |
catches honorific-same-entity, near-identical-different-entity, address-same-location |
Rationalizations
| Agent rationalization |
Documented rebuttal |
| "Just ask an LLM if these two records are the same person." |
For identity, compliance, and fraud the LLM's answer is nondeterministic, its explanation is a post-hoc rationalization, and its confidence does not reflect accuracy. When a wrong merge denies a mortgage or voids a ballot, the org ends up in court. Evidence-based scoring is deterministic and cites the evidence. |
| "Fuzzy string matching on each field is good enough." |
It fails catastrophically under channel separation — variations are engineered to defeat per-attribute fuzzy filters. The win is channel consolidation from evidence across multiple overlapping features, not any single field. |
| "These names are almost identical, so merge them." |
flag_edge_cases catches near-identical-different-entity: John R Smith vs John E Smith differ by one letter that may mean father-and-son. High string similarity is a reason for caution, not a merge; the action is do-not-merge-without-evidence. |
| "These names look totally different, so they're different people." |
Wrong the other way: al-Hajj Abdullah Qardash and Abu Abdullah Qardash bin Amir look different as strings but are the same person once honorifics and Arabic naming conventions are handled. Cultural robustness is exactly where generalization-AI breaks. |
| "The selector said hybrid — pick one and move on." |
Hybrid is a real pattern: generalization-AI cheaply proposes candidate pairs (blocking), evidence-based makes the final auditable decision. Record it as a conscious trade-off, not a non-decision. |
| "Confidence is confidence; I don't need the per-feature breakdown." |
Evidence metadata (which features matched and their scores) is what makes the match explainable and auditable. "89% because NAME 87%, ADDRESS 100%, PHONE 95%" is defensible; a bare 89% is not. |
Red Flags
- All six profile weights set to 3. You have not prioritized. If every
concern is critical the selector degenerates to raw affinity sums — re-interview
the use case.
- Generalization-AI recommended while adversarial or high-stakes is weighted.
Mismatch: re-check the weights. Generalization-AI scores 0 on those axes by
construction.
- RESOLVED edge created on a single feature. Channel-separation resistance
comes from overlapping features. A match driven by name alone is fragile —
demand corroborating evidence.
- Merging on a near-identical pair without checking edge cases. Run
flag_edge_cases first; a one-character difference can be a distinct entity.
- Trusting an LLM confidence score as calibrated. It reflects statistical
regularity, not match accuracy — do not threshold merges on it.
Non-Negotiable Verification
- Run the benchmark battery.
python cli.py benchmark must report 10/10:
- adversarial high-stakes picks evidence-based; example-rich low-stakes picks
generalization-AI; mixed flags a hybrid
- identical records resolve at 1.0 and classify RESOLVED
resolve_match emits per-feature evidence and the confidence equals the
summed contributions
- edge thresholds hold and
declared=True overrides to DISCLOSED
- all three edge cases (honorifics / near-identical / address) fire on the
chapter's examples
- Run the scenario.
python cli.py scenario fraud-channel-separation
recommends evidence-based and consolidates the engineered aliases with
per-feature evidence.
- Verify CLI help.
python cli.py --help exits 0 and prints this
SKILL.md description (so any harness can discover the skill from --help).
Security Posture
- Prompt injection. The records under comparison are untrusted by
construction - channel separation IS adversarial input, fields engineered to
force or dodge a merge. The matcher only computes similarity scores over
field values; it never executes or interpolates them, so an attack can at
most bias one match - which is why RESOLVED demands overlapping evidence,
never a single feature.
- Data exfiltration. Records carry PII (names, addresses, phones). No
network calls, no file writes; PII surfaces only in the evidence output on
stdout, and the caller owns where that report flows.
- Privilege escalation. No shell invocation, no eval, no dynamic import. A
RESOLVED edge is a data assertion, not an identity credential - downstream
systems must not grant access on a merge without independent verification.
Source Attribution
Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien) Ch3 — Knowledge
Representation, section "Entity Resolution: The Foundation of Agent Knowledge"
and its subsections: "Why traditional approaches fail" (channel-separation
fraud), "Evidence-based resolution vs generalization-based AI" (the deterministic
/ explainable / culturally-robust / calibrated distinction and the "89% because
NAME 87%, ADDRESS 100%, PHONE 95%" example), "Entity resolution as graph
building blocks" (RESOLVED / POSSIBLY_RELATED / DISCLOSED edge types and
evidence metadata), and "Edge cases" (honorific same-entity, near-identical
different-entity, address same-location). The feature-scoring, edge
classification, and edge-case detection here are a self-contained stdlib
reference implementation of those ideas, not production ER tooling.
1---2name: entity-resolution-strategy-selector3description: Choose HOW to decide when two records are the same real-world entity — EVIDENCE-BASED resolution (deterministic feature-by-feature scoring with explainable evidence and culturally-robust rules) vs GENERALIZATION-BASED AI (LLM statistical similarity, nondeterministic, post-hoc rationalization) — per Ch3 "Entity Resolution: The Foundation of Agent Knowledge". Scores a six-factor requirement profile and picks evidence-based, generalization-AI, or a hybrid; ships a deterministic matcher that scores name/address/phone similarity into an explainable confidence, classifies the resulting graph edge, and flags the edge cases naive matching misses. Use when standing up entity resolution for an agent knowledge graph, justifying an evidence-vs-LLM choice for identity/compliance/fraud work, or auditing a proposed merge. NOT for the extraction stage that produces the records (that is upstream KG construction), NOT for picking a specific ER product, NOT for arity-2 relationship modeling (use graph-model-selector).4---56# Entity Resolution Strategy Selector78## Overview910Entity resolution determines when two data records refer to the same11real-world entity — the cornerstone that lets an agent maintain a coherent12worldview across fragmented systems. If the agent cannot decide when two13references are the same entity, its whole reasoning framework collapses: the14graph either conflates distinct entities or fragments a single one.1516The chapter draws one decisive distinction, and this skill turns it into a17selection:1819- **Evidence-based resolution** examines specific features, applies20 domain-specific matching rules, and builds a case from concrete evidence. It21 is **deterministic** (same input, same output), **explainable** (every match22 cites which features drove it and their scores), **culturally robust**23 (explicit rules handle Arabic / Chinese / Russian naming), and **calibrated**24 (confidence reflects actual match accuracy).25- **Generalization-based AI** (an LLM) infers from statistical similarity26 learned in training. It is **nondeterministic**, its explanations are27 **post-hoc rationalizations**, it **breaks on non-Western names**, and its28 confidence is **not tied to accuracy**.2930Evidence-based wins for identity, compliance, high-stakes, and adversarial31work. The sharp case is **channel separation**: a money launderer appears as32Bob Jones, then Bob R. Smith II at the same address with different phone33formatting, then Robert Smith Jr. elsewhere with overlapping contact details —34each variation engineered to pass fuzzy filters while looking distinct. Simple35string matching fails catastrophically; what wins is consolidating fragmented36identities on evidence from multiple overlapping features.3738The selector scores a requirement profile across the six factors the chapter39names (high_stakes, adversarial channel-separation, explainability,40determinism, cultural_variation, training_examples) and returns41evidence-based, generalization-AI, or a hybrid (LLM for cheap candidate42generation, evidence-based for the auditable final decision). The matcher43makes the trade-off concrete: it scores name/address/phone similarity,44aggregates to an explainable confidence with per-feature evidence metadata45(the chapter's "89% because NAME 87%, ADDRESS 100%, PHONE 95%"), classifies46the graph edge (RESOLVED / POSSIBLY_RELATED / DISCLOSED), and flags the three47edge cases that require domain and cultural knowledge.4849## When to Use5051- Standing up entity resolution for an agent knowledge graph and deciding the52 resolution strategy53- Justifying evidence-based vs LLM matching in a design doc for identity,54 compliance, or fraud work55- Auditing a proposed merge: what confidence, on what evidence, and is it an56 edge case?5758Phrases: "entity resolution", "record linkage", "deduplication", "are these59the same entity", "evidence-based vs LLM matching", "channel separation",60"RESOLVED edge", "match confidence explainability".6162## When NOT to Use6364- **The extraction stage.** Producing the records (LLM triple extraction,65 iText2KG / RAKG / ATOM construction) is upstream; this skill decides identity66 once records exist.67- **Picking a specific ER product.** This chooses the *strategy* and gives a68 reference matcher, not Senzing-vs-build. Vendor choice is downstream.69- **Arity-2 relationship modeling.** Whether a fact needs a hyperedge is the70 `graph-model-selector` skill; this one is about identity, not structure.71- **A domain with no identity stakes.** Genuinely low-stakes fuzzy dedup with72 abundant labeled examples and no compliance need can use generalization-AI —73 the selector will say so.7475## Process7677| Step | Input | Action | Output | Verification |78|------|-------|--------|--------|--------------|79| 1 | Requirement profile (6 weights 0..3) | `lib.score_strategies(profile)` | `[(strategy, score), ...]` sorted desc | weights * factor-affinities, descending order |80| 2 | Same | `lib.recommend_strategy(profile)` | `{recommended, scores, rationale, hybrid_recommended}` | evidence-based wins high-stakes/adversarial; generalization-AI wins example-rich low-stakes; hybrid when mixed |81| 3 | Two records `{name, address, phone}` | `lib.resolve_match(a, b, weights)` | `{confidence, edge_type, features_used, evidence[]}` | confidence == sum of per-feature contributions; evidence names which features drove it |82| 4 | A match confidence (or `declared=True`) | `lib.classify_edge(conf, declared)` | `{edge_type, confidence, reason}` | >=0.85 RESOLVED, >=0.5 POSSIBLY_RELATED, else NO_MATCH; declared -> DISCLOSED |83| 5 | Two records | `lib.flag_edge_cases(a, b)` | list of `{case, warning, action}` | catches honorific-same-entity, near-identical-different-entity, address-same-location |8485## Rationalizations8687| Agent rationalization | Documented rebuttal |88|------------------------|--------------------|89| "Just ask an LLM if these two records are the same person." | For identity, compliance, and fraud the LLM's answer is nondeterministic, its explanation is a post-hoc rationalization, and its confidence does not reflect accuracy. When a wrong merge denies a mortgage or voids a ballot, the org ends up in court. Evidence-based scoring is deterministic and cites the evidence. |90| "Fuzzy string matching on each field is good enough." | It fails catastrophically under channel separation — variations are *engineered* to defeat per-attribute fuzzy filters. The win is channel consolidation from evidence across multiple overlapping features, not any single field. |91| "These names are almost identical, so merge them." | `flag_edge_cases` catches near-identical-different-entity: John R Smith vs John E Smith differ by one letter that may mean father-and-son. High string similarity is a reason for caution, not a merge; the action is do-not-merge-without-evidence. |92| "These names look totally different, so they're different people." | Wrong the other way: al-Hajj Abdullah Qardash and Abu Abdullah Qardash bin Amir look different as strings but are the same person once honorifics and Arabic naming conventions are handled. Cultural robustness is exactly where generalization-AI breaks. |93| "The selector said hybrid — pick one and move on." | Hybrid is a real pattern: generalization-AI cheaply proposes candidate pairs (blocking), evidence-based makes the final auditable decision. Record it as a conscious trade-off, not a non-decision. |94| "Confidence is confidence; I don't need the per-feature breakdown." | Evidence metadata (which features matched and their scores) is what makes the match explainable and auditable. "89% because NAME 87%, ADDRESS 100%, PHONE 95%" is defensible; a bare 89% is not. |9596## Red Flags9798- **All six profile weights set to 3.** You have not prioritized. If every99 concern is critical the selector degenerates to raw affinity sums — re-interview100 the use case.101- **Generalization-AI recommended while adversarial or high-stakes is weighted.**102 Mismatch: re-check the weights. Generalization-AI scores 0 on those axes by103 construction.104- **RESOLVED edge created on a single feature.** Channel-separation resistance105 comes from *overlapping* features. A match driven by name alone is fragile —106 demand corroborating evidence.107- **Merging on a near-identical pair without checking edge cases.** Run108 `flag_edge_cases` first; a one-character difference can be a distinct entity.109- **Trusting an LLM confidence score as calibrated.** It reflects statistical110 regularity, not match accuracy — do not threshold merges on it.111112## Non-Negotiable Verification1131141. **Run the benchmark battery.** `python cli.py benchmark` must report 10/10:115 - adversarial high-stakes picks evidence-based; example-rich low-stakes picks116 generalization-AI; mixed flags a hybrid117 - identical records resolve at 1.0 and classify RESOLVED118 - `resolve_match` emits per-feature evidence and the confidence equals the119 summed contributions120 - edge thresholds hold and `declared=True` overrides to DISCLOSED121 - all three edge cases (honorifics / near-identical / address) fire on the122 chapter's examples1232. **Run the scenario.** `python cli.py scenario fraud-channel-separation`124 recommends evidence-based and consolidates the engineered aliases with125 per-feature evidence.1263. **Verify CLI help.** `python cli.py --help` exits 0 and prints this127 SKILL.md description (so any harness can discover the skill from --help).128129## Security Posture130131- **Prompt injection.** The records under comparison are untrusted by132 construction - channel separation IS adversarial input, fields engineered to133 force or dodge a merge. The matcher only computes similarity scores over134 field values; it never executes or interpolates them, so an attack can at135 most bias one match - which is why RESOLVED demands overlapping evidence,136 never a single feature.137- **Data exfiltration.** Records carry PII (names, addresses, phones). No138 network calls, no file writes; PII surfaces only in the evidence output on139 stdout, and the caller owns where that report flows.140- **Privilege escalation.** No shell invocation, no eval, no dynamic import. A141 RESOLVED edge is a data assertion, not an identity credential - downstream142 systems must not grant access on a merge without independent verification.143144## Source Attribution145146Distilled from *Agentic GraphRAG* (O'Reilly, by Anthony Alcaraz and Sam Julien) Ch3 — Knowledge147Representation, section "Entity Resolution: The Foundation of Agent Knowledge"148and its subsections: "Why traditional approaches fail" (channel-separation149fraud), "Evidence-based resolution vs generalization-based AI" (the deterministic150/ explainable / culturally-robust / calibrated distinction and the "89% because151NAME 87%, ADDRESS 100%, PHONE 95%" example), "Entity resolution as graph152building blocks" (RESOLVED / POSSIBLY_RELATED / DISCLOSED edge types and153evidence metadata), and "Edge cases" (honorific same-entity, near-identical154different-entity, address same-location). The feature-scoring, edge155classification, and edge-case detection here are a self-contained stdlib156reference implementation of those ideas, not production ER tooling.