EXCLUSIVE

Taylor Swift had a real life version of Goldilocks play out in one of her homes, as an intruder got way too comfortable after breaking into the place.

Law enforcement sources tell TMZ ... Roger Alvarado allegedly climbed up a ladder, smashed a window with his hand and got into the NYC brownstone early Friday. Once he got in, he took a shower and fell asleep in a bed.

This would be the part where Taylor walks in on him, if this really were Goldilocks ... luckily, she wasn't there. However, a witness spotted Alvarado breaking in and called cops. He was arrested inside the home and charged with stalking, burglary and criminal mischief.

Taylor just owns the property -- she bought it a few months ago, but we're told she's never lived there.