A Rails engine that bootstraps AI-ready development docs and project memory for Ruby on Rails teams. It ships generators, rake tasks, and optional IDE rules to keep context consistent across teammates and AI agents.
Memory Bank for Agents (Rails) installs a structured documentation system, SPEC-driven feature workflow, and optional editor rules. Perfect for:
- Rails (full-stack or API-only)
- Plain Ruby service objects / gems inside your monorepo
- Background jobs (Sidekiq/ActiveJob) and service-oriented codebases
- ๐ฏ AI-Ready Setup: Rails generators scaffold an opinionated docs workspace for agent collaboration
- ๐ Memory Management: Organized Markdown docs for durable project knowledge
- โ๏ธ Rails Native: Installers, rake tasks, config under
config/memory_bank.yml
- ๐งช SPEC-Driven Development: Generators for requirements, design, and task breakdowns
- ๐งฐ Editor/Tooling Hooks: Optional
.cursorrules
, RuboCop base config, and Solargraph hints - ๐ง Custom Guides: Point to your company playbooks and have them copied in on install
- ๐งฏ Zero Config Defaults: Sensible paths; override via YAML when you need to
Add to your Gemfile
:
gem "memory_bank_rails"
Then:
bundle install
rails g memory_bank:install
The installer will create config/memory_bank.yml
and (optionally) copy a default guide and .cursorrules
.
One-off (no Gemfile)
bundle exec rails runner 'MemoryBank::CLI.run("init")'
Useful in sandboxes or CI steps, but the gem install is recommended.
Built-in Rails Guides
- ๐ Rails Web โ MVC, Turbo/Stimulus, Hotwire workflows
- ๐งฑ Rails API โ API-only, serializers, auth patterns
- ๐ Background Jobs โ ActiveJob/Sidekiq patterns
Custom Guides
- ๐ง Company Standards โ your internal conventions and checklists
- ๐งฉ Team Workflows โ squad-specific processes and release rituals
- ๐ Architecture Patterns โ service objects, DDD, microservices boundary notes
Each guide provides:
- Customized development guidelines and best practices
- Architecture patterns tailored to Rails projects
- Optional
.cursorrules
and RuboCop base config - Documentation templates for fast onboarding
From your Rails app:
cd your-rails-app
rails g memory_bank:install
Choose a development environment when prompted:
๐ Memory Bank Initializer (Rails)
=================================
๐ Available development guides:
1) ๐ฆ Rails Web - MVC/Turbo/Stimulus
2) ๐ฆ Rails API - API-only patterns
3) ๐ฆ Background Jobs - ActiveJob/Sidekiq
4) ๐ง Company Rails (Custom)
5) ๐ง Microservices (Custom)
? What type of memory bank would you like to install?
> Rails Web - MVC/Turbo/Stimulus
Rails API - API-only patterns
Background Jobs - ActiveJob/Sidekiq
Company Rails (Custom)
Microservices (Custom)
Or run the task directly:
rake memory_bank:init
After initialization, youโll see:
your-rails-app/
โโ .memory_bank/ # AI memory & docs system
โ โโ developmentGuide.md # Copied from selected guide
โโ .specs/ # Feature specs (empty initially)
โโ .cursorrules # Optional IDE rules (from guide)
โโ config/memory_bank.yml # Memory Bank configuration
You can expand
.memory_bank/
with more docs as your project grows.
Initialize the full docs suite:
rake memory_bank:initialize
This creates:
projectBrief.md
โ foundation and goalsproductContext.md
โ product vision & UXactiveContext.md
โ current focus & decisionssystemPatterns.md
โ architecture & patternstechContext.md
โ stack & toolingprogress.md
โ status, milestones, known issues
Generate a new SPEC:
rake memory_bank:spec:new FEATURE="export-memory-bank-to-json"
This produces:
.specs/
โโ export-memory-bank-to-json/
โโ requirements.md # user stories & acceptance criteria
โโ design.md # architecture & component design
โโ tasks.md # actionable tasks & checklist
Workflow
- Requirements โ capture stories and acceptance criteria
- Design โ choose patterns, boundaries, data flow
- Tasks โ break down implementation; track progress
Core Components
- Project Brief โ scope and success criteria
- Product Context โ UX goals and problem framing
- Active Context โ what changed; whatโs next
- System Patterns โ shared decisions & tradeoffs
- Tech Context โ runtime, deps, CI/CD, linting
- Progress โ done/blocked/backlog transparency
Benefits
- Consistent context for AI agents & humans
- Durable knowledge retention and onboarding
- Fewer regressions; clearer decisions trail
Point the engine to your guide folder and manage entries:
rails memory_bank:configure
Youโll be prompted for a directory (can be outside the repo):
~/custom-dev-guides/
โโ company-rails/
โ โโ developmentGuide.md
โ โโ .cursorrules # optional
โโ microservices/
โ โโ developmentGuide.md
โ โโ .cursorrules # optional
โโ legacy-ruby/
โโ developmentGuide.md
โโ .cursorrules # optional
Required files
developmentGuide.md
โ your standards & practices.cursorrules
(optional) โ IDE/agent hints
You can also set the folder in config/memory_bank.yml
:
memory_bank:
guides_path: "~/custom-dev-guides"
default_guide: "company-rails"
Prerequisites
- Ruby 3.1+
- Rails 7.0+
- Bundler
Local setup
git clone https://github.com/your-org/memory_bank_rails.git
cd memory_bank_rails
bundle install
# run specs
bundle exec rspec
# lint
bundle exec rubocop
# run in a dummy Rails app (engine test)
bin/rails app:template LOCATION=spec/dummy/template.rb
Common scripts
rspec
โ run test suiterubocop
โ lint/fixrake build
โ build gemrake release
โ release to RubyGems (maintainers)
If you track process quality in CI:
# Verify docs exist
rake memory_bank:check
# Generate coverage report for tasks completeness (optional)
rake memory_bank:report
- Fork
- Create a feature branch
- Add tests
- Ensure
rspec
andrubocop
pass - Open a PR
MIT. See LICENSE
.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Inspired by community work on AI agent memory systems, SPEC-driven workflows, and IDE collaboration patterns. Thanks to the Rails and broader AI developer communities for pushing the craft forward.
# Company Rails Development Guide
## Overview
This guide documents our Rails standards and best practices.
## Coding Standards
- Prefer service objects and form objects for complex flows
- Strong Parameters; avoid mass assignment in models
- RuboCop + Standard enforcement in CI
## Architecture Patterns
- CQRS for complex read models
- Background jobs for non-HTTP work
- Clear boundaries for external integrations
## Best Practices
- RSpec + FactoryBot + Faker
- System specs for critical user flows
- Conventional commits and trunk-based development