Whisk dry ingredients. In a bowl, whisk 2 cups all-purpose flour, 1 tablespoon cornstarch, 1 teaspoon baking powder, 1/2 teaspoon baking soda, and 1/2 teaspoon fine sea salt. Stir in 1 to 2 teaspoons espresso powder, depending on how bold you want the coffee flavor.
Cream the butter and sugars. In a large bowl, beat 1/2 cup softened unsalted butter with 1/2 cup granulated sugar and 1/2 cup light brown sugar until light and fluffy, about 2 minutes.
Add egg yolk and vanilla. Mix in 1 egg yolk and 2 teaspoons vanilla extract until smooth.
Fold in sourdough discard. Add 1/2 cup sourdough starter discard and mix until just combined.
The batter may look slightly curdled—that’s fine.
Combine wet and dry. Add the dry mix to the bowl and stir until no dry spots remain. If using, fold in 3/4 cup chopped dark chocolate.
Chill the dough. Cover and refrigerate for 30 to 45 minutes. This step helps avoid overspreading and intensifies flavor.
Preheat and prep pans. Heat the oven to 350°F (175°C).
Line two baking sheets with parchment.
Scoop. Use a 2-tablespoon scoop to portion dough onto the sheets, spacing about 2 inches apart.
Bake. Bake 10 to 12 minutes, until the edges are set and lightly golden but the centers still look soft. Don’t overbake; they’ll firm up as they cool.
Cool. Let cookies rest on the sheet for 5 minutes, then transfer to a rack to cool completely.
Make the mascarpone glaze. In a small bowl, whisk 4 ounces mascarpone, 1 cup powdered sugar, and 1 to 2 tablespoons cooled brewed espresso until smooth and spreadable. Add a pinch of salt to sharpen the flavor.
Finish. Spoon or drizzle glaze over the cooled cookies.
Dust lightly with unsweetened cocoa powder. For neat edges, let the glaze set 20 to 30 minutes.