01 - Preheat oven to 350°F. Line two baking sheets with parchment paper.
02 - In a heatproof bowl, melt 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 granulated sugar, brown sugar, eggs, and vanilla extract until pale and slightly thickened, about 2 minutes.
04 - Stir sourdough discard into the egg mixture until fully incorporated.
05 - Pour the melted chocolate-butter mixture into the egg mixture, whisking until smooth and glossy.
06 - Sift together 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 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 until 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.