If you use single letter commands, you won't have to save them.
The state machine example in Nick Gammon's serial input tutorial covers letter-number combinations.
I have sketches to make a keyword list with up to 255 variable-length words stored in flash. It reads text and finds where in the list it can be with help from links, if a char does not match and there is a link to another word that that starts the same but is different for that letter, there is a link to it and if that doesn't match there is either a link to another or the code flags a no-match.
If that seems tricky, it is. I wrote one sketch just to take a new word list and generate Arduino source code for all the tables be put in flash/PROGMEM. There is one function that you feed input chars to one at a time (as they arrive in serial) and it returns status of the match process each time. The rest is whatever sketch uses it.
What it gives is a serial keyword match routine that tells you what word was matched on the arrival of the last char of the word. Methods that buffer then compare start on arrival of the final char, just fine for one at a time command entry. The difference is that mine finds matches as they happen without needing to stop between. I fed it long lines of keywords at 250000 baud and it kept up. The example prints trace data to show what was read and where it points in the data while doing that.
BTW, I've done this kind of thing before in the 80's and 90's. I think it's still regarded as work.
I am working on a smaller version that stores list and links in EEPROM. There would be 255 bytes of list space including delimiters. 50-60 commands would be in the park, it could go farther if the keys combine but that's if I get it done.