scripting: take PSI into consideration on command detection