CoM and 358/2 spoilers ahead. You have been warned.
So when Sora was at Castle Oblivion, he lost some of his most important memories and those memories sipped into Xion, correct? That is why she looks like Kairi - because she's Sora's most important memory. When he lost his memories, everyone connected to him forgot about him. Thanks to that, the Xion plan could work at all, since she was supposed to prevent Sora from awekening and take over his role as the Keyblade master. How then is it possible tha Riku remembered everything about Sora? Is it because he was at Castle Oblivion at the time? Even if that's the case, how does that make sense? Did I forget something improtant from CoM or is this an inconsistency?