We open sourced (GPL3) Mitro (https://www.mitro.co). You can find the code here: https://github.com/mitro-co/mitro.
We have a similar model for reprompting, but you can alter the code as you see fit. Someone was working on a command line client too, but I'm not sure what became of it.