Preheat the oven to 350°F and position a rack in the center of the oven. Place the walnuts on a baking sheet and toast for 8 to 10 minutes, until they start to smell fragrant and are lightly golden brown when you break one in half. Remove them from the oven and let cool. Roughly chop them and set aside.
Chop 5 ounces of the bittersweet chocolate and 4 ounces of the unsweetened chocolate into large chunks and place them with the butter in a metal or heatproof glass bowl. Set the bowl over a pot of simmering water and heat, stirring occasionally, until completely smooth. Remove from the heat, whisk in the vanilla, and let cool for about 20 minutes so it’s not piping hot.
In a stand mixer fitted with a whisk attachment, whisk together the sugar and eggs for about 5 minutes on medium-high speed, until light and thick and pale yellow. With the mixer on low, slowly add the chocolate-butter mixture and whisk for about 15 seconds. It will not be completely mixed at this point but that’s okay, because you will finish combining all the ingredients by hand.
Chop the remaining 4 ounces bittersweet chocolate into 1-inch chunks and shave the remaining 2 ounces unsweetened chocolate into fine shavings. In a medium bowl, stir together the rye flour, the chopped bittersweet chocolate, shaved unsweetened chocolate, baking powder, salt, and toasted walnuts. Remove the bowl from the mixer, add the rye flour mixture, and fold it in by hand until the dough is completely homogeneous.
For best results, scrape the dough into an airtight container and let it rest in the refrigerator for at least 3 to 4 hours or up to overnight before baking. (The unbaked dough can be stored in the refrigerator for up to 1 week.)
Preheat the oven to 350°F and position a rack in the center of the oven. Line a baking sheet with parchment paper.
Drop the dough in ¼-cup scoops onto the prepared baking sheet, spacing them about 2 inches apart. Bake for 10 to 12 minutes, rotating the baking sheet midway through the baking time, until the cookies are just starting to crack on the edges and the centers are soft but not liquidy when you press them.
Remove the cookies from the oven and let them cool on the baking sheet on a wire rack for 5 to 10 minutes, then transfer them to the rack and let cool completely.
The cookies can be stored in an airtight container at room temperature for up to 3 days.