Fix up intent handling, and add some utility functions.

This intergrates knowledge intents more deeply into the CI state
machine -- current_states will take intents into account in
determining  what is and is not an active state in the state machine.

This also adds a few useful utility functions for dealing with
intents from the CLI.