Agentation Ruby Gem
A Rails engine that provides a floating toolbar for annotating web pages and collecting structured feedback for AI coding agents.
This gem is a Ruby/Rails port of Agentation - the original React-based annotation toolkit created by Benji Taylor.
Installation
Add to your Gemfile:
gem 'agentation'Run:
bundle install
rails generate agentation:installThat's it! The generator automatically:
- Adds the stylesheet to your application.css
- Adds the JavaScript import to application.js
- Adds the toolbar helper to your layout
Manual Installation
If you prefer manual setup or the generator doesn't work for your setup:
1. Add stylesheet to app/assets/stylesheets/application.css:
*= require agentation2. Import JavaScript in app/javascript/application.js:
import "agentation"3. Add toolbar to your layout (before </body>):
<%= agentation_toolbar %>Usage
The toolbar appears in the bottom-right corner. Click the sparkle icon to activate.
Options
<%= agentation_toolbar(
output_detail: "standard", # compact, standard, detailed, forensic
annotation_color: "#3c82f7", # hex color for markers
auto_clear_after_copy: false, # clear annotations after copying
dark_mode: true # dark or light theme
) %>Features
- Click any element to add an annotation
- Drag to multi-select elements
- Click marker to edit, Shift+click to delete
- Copy feedback as structured Markdown
- Persistent storage (localStorage)
- Light and dark mode support
- Draggable toolbar position
Output Formats
Compact
1. **button "Submit"**: Make this green
Standard
### 1. button "Submit"
**Location:** form > .actions > button
**Feedback:** Make this green
Detailed
### 1. button "Submit"
**Location:** form > .actions > button
**Classes:** btn, btn-primary
**Position:** 100px, 200px (120x40px)
**Feedback:** Make this green
Forensic
Full debugging information including computed styles, accessibility info, and nearby elements.
Requirements
- Rails 6.1+
- Ruby 3.0+
Credits
This Ruby gem is based on Agentation, an open-source annotation toolkit for AI coding agents.
- Original Project: github.com/benjitaylor/agentation
- Website: agentation.dev
License
MIT