Preheat the oven to 200C/180C fan/gas 6. Lay the squash halves, cut-side down, on a board. Carefully slice widthways at 1cm intervals, all along the length, being careful not to cut all the way through. (One way to do this is to lie each squash half cut-side down and place a wooden spoon either side of it: the knife will hit the spoons, preventing you from cutting all the way down.)
Drizzle 2 tablespoons of olive oil into a large roasting tin and place the squash halves in it, cut-side down (don’t worry if any sections come apart, just place them back together). Dot the onions around the tin, drizzle with another 2 tablespoons of oil, season and roast for 45 minutes.
Meanwhile, put the chestnuts and pecans in a bowl. Add 1 teaspoons of oil and a pinch of salt; mix well.
Scatter the nut mixture over the squash; return to the oven for 10 minutes or until crisp.
For the sauce, in a small bowl, mix the finely chopped curly parsley and mint with the lemon zest and juice, oil and capers. Season with sea salt and black pepper.
Put the squash on a platter with the onions (and lemon wedges and a scattering of flat-leaf parsley and mint, if using). Finish with a grind of black pepper and the sauce spooned over. Store leftovers chilled in an airtight container for 4-5 days.
