01 - Preheat the oven to 350°F. Line two baking sheets with parchment paper.
02 - In a heatproof bowl, melt the dark chocolate and butter together over a pot of simmering water, stirring until smooth. Remove from heat and let cool slightly.
03 - In a large mixing bowl, whisk together the granulated sugar, brown sugar, eggs, and vanilla extract until pale and slightly thickened, about 2 minutes.
04 - Stir in the sourdough discard until fully incorporated.
05 - Pour the melted chocolate-butter mixture into the egg mixture, whisking until smooth and glossy.
06 - Sift together the flour, cocoa powder, baking powder, and sea salt. Fold the dry ingredients into the wet mixture with a spatula until just combined.
07 - Gently fold in the chocolate chips and nuts, if using.
08 - Using a cookie scoop or tablespoon, drop dollops of dough (about 2 tablespoons each) onto the prepared baking sheets, spacing them 2 inches apart.
09 - Bake for 10–12 minutes, or until the cookies are puffed with crackly tops and just set around the edges. Centers will look soft.
10 - Allow cookies to cool on the baking sheet for 5 minutes, then transfer to a wire rack to cool completely.