Context EngineeringPersistent state and memoryPrincipal
How should an agent resolve same-named people before merging their memories?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
Two customers named Arun Sharma contact one support team. One discusses billing and the other changes an address. Correct transcripts are consolidated into one shared profile, and the address is used in the billing case. Design subject resolution and scoped identity keys, handle shared contact details and third-party mentions, and recover from a false merge.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Entity resolution decides which real subject a mention refers to. A display name can help search for candidates, but it is not a durable identity key. The writer or retrieval layer treated two mentions with the same string as one subject. Conversational entity-linking research, such as CREL, treats linking mentions to entities as a separate problem. A provenance-aware memory design also keeps origin and evidence for each item, as in this agent memory work. Neither paper guarantees a particular production identity policy for this example.
I would trace the exact identity joins. Which authenticated customer ID belonged to each conversation? Was the address fact extracted from an agent note or from the customer's own statement? Did a batch consolidation job group facts by display name, email fragment or embedding similarity? Did retrieval filter by account ID before semantic matching? Once a fact is linked to the wrong profile, later summaries can repeat it with apparently high confidence. More retrieval or a bigger context window makes the contaminated fact easier to encounter, not safer.
The durable memory key should be the canonical subject ID in its tenant and account scope, with provenance back to the original utterance and any verified system-of-record change. A mention such as “Arun” can remain unresolved until the active session or a trusted lookup disambiguates it. If the source is about a third party, do not attach it to the speaker by default. When multiple identities remain possible, ask or abstain from using the fact for a consequential action. Retrieval authorization and entity correctness both matter. A fact can be from the right tenant and still be about the wrong person.
Keep mention resolution and profile merging as different operations. A search result can propose two possible Arun records without changing either record. A trusted session or customer lookup may resolve which one is active. A durable merge, however, changes where all dependent facts attach and needs a governed identity decision with reversible lineage.
For a hypothetical fixture, assign the two customers stable IDs C17 and C29 within the same tenant. Their shared display name should not make a fact from C29 eligible in C17’s context. Then add “my colleague Arun” to C17’s conversation. The speaker’s authenticated ID identifies the speaker, not necessarily the subject of that sentence. Preserve an unresolved mention until evidence supports the separate subject link.
If a false merge already happened, split the identity mapping, trace every derived claim and rebuild affected summaries or indexes. Do not merely rename the merged profile while leaving its mixed facts in place. Prior external effects need their own reconciliation because fixing identity metadata cannot recall an invoice already sent.
If the interviewer asks whether to merge two customer records that share a phone number, I would still require a defined identity-resolution process. Shared contact details can be family, employer or stale data. Keep candidate links separate, record why a merge happened, support reversal and rebuild dependent summaries when a merge is undone. Test same-name users within one tenant, renamed accounts, shared contacts and a false merge corrected later. A user switches accounts. Why does the agent remember the previous customer's preference? covers memory following a user across account switches. Here the user has not switched accounts. The system joined two distinct subjects because their names looked alike.
Related questions
Keep practising context engineering
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux