For the tomato sauce: Put the tomatoes and their juice in the bowl of a food processor. Grate 3 to 4 tablespoons of the onion directly into the food processor so the juice falls into the tomatoes. Add the sugar, basil, garlic and a liberal drizzle of EVOO (about 1 tablespoon), and season with sea salt and pepper. Whizz the mixture up until it's pureed, then transfer it to a small pot. Bring to a simmer over medium-low heat and cook 20 to 30 minutes. (If you're not serving the sauce immediately, cool and then refrigerate it. Any leftovers are delicious on spaghetti with butter and cheese for a more simple supper another night. It also freezes well if you want to make a double or triple batch.)
Rinse out the food processor and return the bowl to the base.
For the chile paste: Finely chop the chiles (remove the seeds if you want to curb their heat a little). Sprinkle some sea salt over the chiles on the cutting board, then mash in the garlic to form a paste. Mix with the harissa in a small container. Cover and store in the refrigerator.
For the pesto: Lightly toast the pine nuts in a small skillet. Let cool completely. Combine the pine nuts, basil, parsley, EVOO, cheese and garlic in the food processor. Season with salt, pepper and a few grates of nutmeg. Pulse until the mixture is well blended, then transfer to a small container. Cover and store in the refrigerator. (The pesto freezes well, so double or triple the batch if you like.)
To serve, bring the sauces to room temperature. Reserve one-third of the chile for other uses. Bring a pot of salted water to a boil, then cook the spaghetti until al dente. Reserve 1 cup cooking liquid, then drain the pasta.
Meanwhile, reheat the tomato sauce in a small pot over medium-low heat. Put the pasta in a serving bowl, douse with the reserved cooking water and stir in all of the tomato sauce and half of the pesto. Drizzle with EVOO and add 1 tablespoon of the chile sauce at a time, adjusting it to your preferred level of heat. Toss vigorously to combine. Serve with lots of cheese and the remaining chile paste and pesto sauce for stirring in to each person's taste. Finish with another drizzle of EVOO.