This commit adds the pretty-complicated decision function to check whether a command should run on the daemon. @maybebtc @mappum double check the logic?