Command-line voice recognition with Mac OS X
You might be interested in reading Apple's documentation on Speakable Items, but the relevant part to your question, "How can I get OS X to listen for the string "s" and run the program "cmd" in response?" is:
You can add an item to the Speakable Items folder to make it speakable.
To open something using a spoken command, just add it to the Speakable Items folder. You can use a command to open anything you can open by double-clicking, including applications, files, and Web sites. You can also write scripts and add them to the folder.
In regards to "How does OS X know what command to run? I see nothing in that file that says what command to run?", the relevant portion of the file you posted is:
<key>BuiltInCommandID</key>
<integer>105</integer>
<key>DefaultCommandName</key>
<string>Tell me a joke</string>
This is saying, when the spoken command "Tell me a joke" is received, run the internal command ID#105, which is the "Tell me a joke" command.
In this case you're looking at an internal command to the speech system. But you can add AppleScripts or shell commands to the speakable items folder as well.
This article on Mac OS X Hints may be helpful as well.
EDIT: After some research I am not sure if you can run shell scripts directly from there, but a little AppleScript wrapper would be easy enough to write, and you could even write it so it can be duplicated and renamed, and it would just run the corresponding shell script from /scripts
or something.