Installation¶
Requirements¶
- Ruby: 2.7 or higher
- SQLite3: For persistent blackboard memory (optional)
- Redis: For high-performance persistence (optional)
Installing the Gem¶
From RubyGems¶
Using Bundler¶
Add to your Gemfile
:
Then run:
From Source¶
Optional Dependencies¶
SQLite3 (Default Blackboard Backend)¶
Or in your Gemfile
:
Redis (High-Performance Backend)¶
Install Redis server:
# macOS
brew install redis
brew services start redis
# Ubuntu/Debian
sudo apt-get install redis-server
sudo systemctl start redis
# Docker
docker run -d -p 6379:6379 redis:latest
Install Ruby Redis gem:
Or in your Gemfile
:
Verification¶
Verify the installation:
require 'kbs'
puts "KBS version: #{KBS::VERSION}"
# => KBS version: 0.1.0
# Test basic functionality
engine = KBS::Engine.new
engine.add_fact(:test, value: 42)
puts "✓ KBS is working!"
Development Setup¶
For contributing or running tests:
git clone https://github.com/madbomber/kbs.git
cd kbs
bundle install
# Run tests
bundle exec rake test
# Run examples
bundle exec ruby examples/working_demo.rb
Troubleshooting¶
SQLite3 Installation Issues¶
On macOS with M1/M2:
gem install sqlite3 -- --with-sqlite3-include=/opt/homebrew/opt/sqlite/include \
--with-sqlite3-lib=/opt/homebrew/opt/sqlite/lib
On Ubuntu/Debian:
Redis Connection Issues¶
Check Redis is running:
Test connection from Ruby:
Next Steps¶
- Quick Start Guide - Build your first rule-based system
- RETE Algorithm - Understand the engine
- Writing Rules - Master the DSL
- Examples - See real-world applications