The episode picks up sometime after the events of the midseason finale, when castello was banned from the 12th precinct, and most of that time castello spent in his pajamas.
In tonight’s season 7 mid-season finale of Castle, not only did Richard castello become an honorary mobster, but that status then got him kicked out of helping the NYPD. That’s right: castello is no longer welcome in the 12th precinct.