Heat the oil in a frying pan, and add the diced onion, diced mushrooms, and minced garlic. Cook over a medium heat for a few minutes, until the onion is soft and translucent. Add the chopped spinach and cook for a further 5 minutes, stirring regularly, until all the vegetables are well cooked and any excess liquid has cooked off.
Remove from the heat, and add the diced tofu and the egg (if using). Season very generously with salt and pepper. Mix to combine.
Cut each sheet of filo pastry into wide strips - I found it worked best to cut each sheet into three strips, with each strip measuring approximately 10.5 x 3.5 inches (though the exact dimensions will depend on how big your pastry sheets are!).
Place a spoonful of the tofu mixture at one end of a pastry strip, and fold the corner of the pastry over it at 45 degrees. Continue folding up the length of the pastry strip to form a triangular samosa (see the step-by-step photos in the blog post for a better explanation!).
Place the folded samosas in the pan of the Actifry*, and spray with oil. Cook in the Actifry for 20 minutes, until golden brown and crispy. Serve immediately.
If you don't have an air fryer, these samosas can be baked in the oven instead.