A RiveScript interpreter for Ruby 3.3+.
Maintained at jvmlab.org by Byte (byte@jvmlab.org).
Derived from the MIT-licensed rivescript-js
implementation.
- Ruby
>= 3.3.0(developed on 3.3.8)
Add to your Gemfile:
gem "rivescript", "~> 0.1.2"Then:
bundle installUse it only through Bundler:
bundle exec ruby app.rb
bundle exec riveshellgem install rivescriptPut Ruby gem binaries on your PATH if needed:
export PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"Then:
riveshell# Gemfile (development / unreleased tip)
gem "rivescript",
git: "https://github.com/LilOleByte/rivescript-rb.git",
tag: "v0.1.2"bundle install
bundle exec rake package # builds pkg/rivescript-0.1.2.gem + verifies contents
gem install --user-install pkg/rivescript-0.1.2.gemrequire "rivescript"
bot = RiveScript.new
bot.load_directory(RiveScript.brain_path) # bundled sample brain
# or: bot.load_directory("./my-custom-brain")
bot.sort_replies
puts bot.reply("localuser", "Hello bot")Load from a string:
bot = RiveScript.new
bot.stream(<<~RIVE)
+ hello bot
- Hello, human!
RIVE
bot.sort_replies
puts bot.reply("user", "hello bot")Full API reference: docs/ (same layout as rivescript-js/docs, adapted for Ruby).
Security audits: docs/security.md (bundle exec rake security).
bundle exec riveshell # Bundler apps
riveshell # after gem install
riveshell /path/to/custom-brain # your own repliesOptions: --debug, --utf8.
> object setname ruby
return args[0]
< object
+ my name is *
- <set name=<call>setname <star></call>>Nice to meet you, <get name>.
Object macros run real Ruby. Only load brains you trust.
Disable with RiveScript.new(enable_object_macros: false).
bundle install
bundle exec rake test
bundle exec rake packageMIT — see LICENSE.
Original RiveScript copyright (c) Noah Petherbridge / AiChaos. Ruby port copyright (c) 2026 Byte <byte@jvmlab.org> (jvmlab.org).