Save both the contact number and name to a list of lists and a TinyDB (if you want persistence)
Get your number from the contact picker, compare that number from the list of lists
Use the lookup in pairs key, pair, not found block
If it is there, grap the contact name, if it is not there ...sorry not in your list, put it in your list.
You can have your party with AI2, you just do not have a tool to do it in one step.