Yes easier said than done and custom code… Depends on your appetite for that.
The indexer in my Friday’s Party project was designed to solve this very problem - from an LLM perspective. After Frenk delivered the set operations functions earlier this year I modified mine to use the builtin… The custom template basically works as you describe a. Epts two labels and an operator… Feel free to rip out the indexer and use it. For your automation. You’d hav to build it in yaml and call a custom template but you can make it work.
I put it here
And funny enough last night’s work was documentibg the darn thing.
Supports AND, OR, NOT, XOR, and limited CART (you’ll overrun CART fast only good for small sets, I had to choke it when you exceed template specs. ) returns a list of ents or a state dump.
(also for the record this - set ops on selectors) would be an incredible add to the picker. Its amazing with an LLM)