Heat the oven: Heat the oven to 375°F and lightly grease a 24-cup mini muffin tin.
Cut the pastry: Roll the thawed puff pastry sheet out lightly on a floured surface, just enough to smooth the fold lines, then cut it into 24 squares, about 2 inches each — about 10 minutes of prep.
Press into the tin: Press one square into each muffin cup, pushing the center down so the pastry sits against the bottom, with the corners pointing up.
Add the brie: Set one cube of brie into each pastry cup.
Add the sauce: Top each with a rounded teaspoon of cranberry sauce — no more, or the filling bubbles over and glues itself to the pan.
Top and wash: Scatter the pecans over the top and brush the exposed pastry with the beaten egg, if using.
Bake: Bake for 15 to 18 minutes, until the pastry is deep golden and puffed and the cheese is soft and glossy.
Cool and serve: Cool in the tin for 5 minutes, then lift the bites out, garnish with rosemary, and serve warm.