Ainsley suddenly felt bad that she suspected someone so kind like this guy. If Cain had a malicious intent, he wouldn't give her the brooch to protect herself.
Clearly, Cain also knew how vulnerable Ainsley was, so he chose to protect her from whoever eyed her in the dark.
The brooch could indeed help Ainsley to a certain degree, even though if Ainsley contracted Code-B, she would be way safer than now.
After all, if Ainsley used her luck ability in a wide range and for too long, a random otherworldly summoner might feel the strange aura from her luck ability and deduce that she's from another world.
However, Code-B could also mask Ainsley's luck aura, making it seem ordinary and not a special skill belonging to someone from another world.
Thus, Ainsley still had to find Code-B when the gate to the prairie opened three months in the future.