Preheat oven (electric cooker: 200 °C/circulating air: 175 °C/gas: see manufacturer). Grease an ovenproof casserole dish (approx. 2.5 l) and roast the almonds in a pan without fat. Take out, let cool and chop coarsely.
Wash the herbs, dab dry, pluck off flags or leaves and chop finely, except for one half of the basil. Peel garlic and chop finely. Grate the Parmesan finely. Mix almonds, dill, parsley, half basil, garlic, approx. 3⁄4 Parmesan, mascarpone, eggs and chili flakes.
Season with salt and pepper.
Season tomatoes with salt, pepper and 1⁄2 teaspoon sugar. Spread evenly in the casserole dish. Fill the herb-cheese mixture into the pasta with a tablespoon. Place the noodles on the tomato sauce. Cover with aluminium foil.
Bake in a hot oven for about 30 minutes. Remove the foil and bake for another 15 minutes until the pasta is al dente and the cheese is golden brown. Coarsely chop the rest of the basil. Serve the pasta casserole sprinkled with basil and the rest parmesan.