RiveScript is a simple scripting language for giving intelligence to chatbots and other conversational entities.
It's a plain text, line-based scripting language with goals of being simple to learn, quick to type, and easy to read and maintain. This is in contrast to other chatbot languages that require you to read and write ugly XML code (like AIML), or memorize lots of random symbols and "line noise" to write and read your code (like ChatScript).
See also: the History of RiveScript.
RiveScript was first released in the year 2005 with its original Perl implementation.
Since 2022, a new type of chatbot has become well known: Large Language Models, or LLMs, such as ChatGPT, Claude and Gemini.
RiveScript has nothing in common with these modern types of chatbots. RiveScript, instead, powers the classic "canned responses" type of bot where the botmaster had to anticipate all of the questions that a user might ask up front, and program in responses that the bot would give to answer those questions.
However, RiveScript is just a lightweight chatbot library; it is possible (and trivial!) to have a RiveScript personality be "out in front" for your chatbot, giving you complete control to be sure that your bot responds exactly how you want it to for certain questions, before "falling back" and answering the user's question with your favorite LLM of choice. This way you can have the best of both worlds!
Without further ado, here is what RiveScript looks like.
RiveScript keeps simple replies simple, for example:
+ hello bot - Hello, human!
This will add a reply so that when a human says the words "Hello bot", the bot would respond with "Hello, human!"
With more advanced RiveScript code we can learn and repeat user variables and use more complicated trigger matching patterns:
+ my name is * - <set name=<formal>>I will remember to call you <get name>. + (what is|do you know) my name * <get name> != undefined => Yes, your name is <get name>! - I don't know your name.
You can learn more in the RiveScript Tutorial.
RiveScript is developed using the Unix philosophy that software should do one thing and do it well. RiveScript is not a complete, all-in-one chatbot (although those do exist); instead it is designed to be a self-contained software library with a simple API that can be plugged into any existing codebase.
The RiveScript library only concerns itself with fetching a response to a user input message. Everything else is up to your program. This is in contrast to AIML bots ("Alicebots"), in which an Alicebot is a complete chatbot solution with a configuration system, runtime interface (e.g. support for connecting to instant messengers or listening on a socket server) and all the bells and whistles built in, and which just so happens to include a scripting language (AIML). With AIML bots, it's often difficult to separate out just the code that deals with AIML to use it in your own code. RiveScript's goal is to be simple and self-contained and easy to use it how you want to.
Read more about RiveScript's goals and scope in the Contributing Guidelines.
RiveScript was designed to do everything that AIML can do (you can read about RiveScript's history) and then some, and then some more and more. You can read about RiveScript in comparison to AIML at the RiveScript vs. AIML page, but briefly, here are some of RiveScript's features: