1 cup chicken stock, fish stock or bottled clam juice
2 medium onions, finely chopped
Salt and freshly ground pepper
1 teaspoon chopped thyme
1/4 teaspoon cayenne pepper
6 tablespoons unsalted butter, softened
1 dozen cherrystone clams—shucked and coarsely chopped, clam liquid
1/2 pound sea scallops, cut into 1-inch pieces
Preheat the oven to 400°. Butter a medium glass or ceramic baking dish. Coarsely grate the potatoes and transfer to a coarse stainless-steel sieve. Using a spatula, press on the potatoes to extract as much liquid as possible.
In a skillet, cook the potatoes in the stock over moderate heat until thick, about 3 minutes. Remove from the heat and stir in half of the onions, a large pinch of salt, 1 teaspoon of pepper, 1/2 teaspoon of thyme and the cayenne.
Melt 2 tablespoons of the butter in a medium skillet. Add the remaining onions and 1/2 teaspoon of thyme and cook over low heat until the onions soften, about 8 minutes. Add the reserved clam liquid and boil over high heat until reduced by half, about 3 minutes. Remove from the heat and let cool, then stir in the clams and scallops and season with salt and pepper.
Spread half of the potatoes in a layer in the prepared baking dish. Spread the onions, clams and scallops on top, then cover with the remaining potatoes. Dot the top of the pie with the remaining 4 tablespoons of butter and bake for 45 minutes, until bubbling hot. Preheat the broiler. Broil for 3 minutes, or until browned and crisp on top. Let stand for 10 minutes before serving.