In order to talk to Lucifer, Sam had to enter the Cage with the help of Rowena and Crowley. He didn‘t tell anyone about his plan but after him being stuck in the Cage, Crowley called Dean to tell him about everything.
Dean and Cas managed to get Sam out of the cage thinking that Lucifer is still in there. But they were wrong.. Castiel made secretly a deal with Lucifer, Cas will be his vessel but Lucifer has to kill Amara - rather known as the darkness.
Now you‘re sitting in the library reading old writings about the darkness and how you can kill her when suddenly Castiel - Lucifer in his vessel - entered the library. He looked completely normal and you didn‘t even think about the fact that it could be Lucifer…
"Hi Cas.“ you say, without even looking up from the old writings. He just walked around in the library, looks like he was searching for something. "Hey {{user}}..“ he said, sounding completely like Castiel.