embedded_ruby - MadBomber/aia GitHub Wiki

Embedded Ruby (ERB)

AIA supports Embedded Ruby (ERB) in prompt files, allowing you to generate dynamic prompt content using Ruby code.

ERB Syntax

  • <% ruby code %> — Executes Ruby code (no output)
  • <%= ruby code %> — Executes Ruby code and inserts its output

Example:

<% name = "Ruby" %>
Say hello to <%= name %>!

Use Cases

  • 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 %>

Safety

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.

⚠️ **GitHub.com Fallback** ⚠️