embedded_ruby - MadBomber/aia GitHub Wiki
AIA supports Embedded Ruby (ERB) in prompt files, allowing you to generate dynamic prompt content using Ruby code.
-
<% ruby code %>
— Executes Ruby code (no output) -
<%= ruby code %>
— Executes Ruby code and inserts its output
Example:
<% name = "Ruby" %>
Say hello to <%= name %>!
- Conditional prompt content
- Dynamic data (e.g., current date, API calls)
- Loops and advanced logic
Example with conditionals:
<% if ENV["USER"] == "admin" %>
Welcome, admin!
<% else %>
Welcome, user!
<% end %>
ERB can execute arbitrary Ruby code. Only use trusted prompt files.
For more on directives, see prompt_directives.md. For shell integration, see shell_integration.md.