I am building a closet in our office to make it a bedroom. The chimney runs through the room. While the bricks are only warm to the touch after hours of a raging fire, I suspect there are some regulations about how close I can build a wall to the chimney.

Is there a gap that must exist between the chimney and the new closet wall? Are there any firestop materials that must be used on the side of the wall closest to the chimney?