Place the diced potatoes in a pot of salted water and bring to a boil. Cook for 12 to 15 minutes until fork-tender. Drain well and roughly mash them so they are broken up but still have some chunks. Set aside.
Heat the tablespoon of avocado oil in a skillet over medium heat. Add the onion and cook for 4 to 5 minutes until softened. Add the garlic, ginger, garam masala, cumin, turmeric, coriander, and cayenne pepper and cook for 1 minute until very fragrant.
Add the frozen peas and cook for 2 minutes. Stir in the mashed potatoes, cilantro, lemon juice, and salt to taste. Mix well and remove from heat to cool.
Make the pastry by whisking together the gluten free flour, xanthan gum, and salt. Add the avocado oil and mix until crumbly, then add the cold water and stir until a smooth dough forms. Let it rest for 10 minutes.
Preheat the oven to 400°F and line a baking sheet with parchment paper. Divide the dough into 8 equal pieces. Roll each piece into a circle about 6 inches across, then cut each circle in half to create 16 semicircles.
Take one semicircle and fold it into a cone shape, overlapping the straight edges and pressing to seal with a dab of water. Fill the cone with about 2 tablespoons of the potato filling, then pinch the open edge firmly closed. Repeat with all the remaining pieces.
Place the samosas on the prepared baking sheet, brush them with the beaten egg, and bake for 25 to 30 minutes, until golden brown and crispy. Let cool for 5 minutes before serving with your favorite chutney.