so i was talking to Novalia Spirit a couple weeks ago:
$2BAF: Command selection for ally 1
$2BB0: First subcommand selection in queue
$2BB7: Command selection for ally 2
$2BBF: Command selection for ally 3
$2BC7: Command selection for ally 4
like his $2BB0 description suggests, the allies don't seem to be fixed numbers, but based on the order in which you're choosing their commands.
to know the latest ally (i.e. whoever's menus you're currently using), i think $3A6A is the pointer.
there's also the limitation that if you back out of a command menu into the main menu, the variable still holds the command's ID. so you'd have to combine use of these variables with $2F41 to verify that you're indeed in a submenu at the time.
anyway, the commands to check for would be Item (01) and Throw (08). Tools (09) shouldn't need a check, because its list is generated just at battle start, and you can't move stuff around with it anyway.