Skip to content
cd /languages
  • Convention-heavy
  • Programming
  • AST and symbol support

Ruby Support in Maguyva: Code Graphs for Rails and Ruby Apps

Maguyva parses Ruby with AST, symbol, and graph support, so AI agents can follow classes, modules, singleton methods, and constructors in Rails and Ruby codebases.

Why Ruby repos are hard for shallow AI tools

Ruby leans on convention and metaprogramming. Methods are generated by attr_accessor, classes reopen in other files, and namespaces nest several modules deep. The readable surface hides which method a call actually reaches, and blunt text search returns every call and perform in the app.

Maguyva gives an agent classes, modules, methods, and their callers as structure, so it can follow a change through the app instead of guessing.

What Maguyva extracts in Ruby

Maguyva covers .rb, .rbw, .rake, and .gemspec files, plus Gemfile and Rakefile. Instance methods and singleton methods (def self.call) are extracted, with singleton methods marked as static. attr_reader, attr_writer, and attr_accessor declarations count as accessor methods, and symbols are qualified by their module and class namespace.

ClassName.new and Namespace::ClassName.new count as instantiation, and receiver typing follows local assignments and @instance_variables, so a call on an assigned object can resolve to its class. The graph also records inheritance, module inclusion, overrides, raise and rescue edges, and reads and writes.

Metaprogramming calls (define_method, send, method_missing, class_eval, and similar), Sorbet T:: type helpers, and common enumerable calls (each, collect, reject, and similar) are filtered from relationships so application code stands out.

Example agent prompts

  • “Who calls Billing::ChargeCustomer.call, and from which jobs and controllers?” (find_symbol, then dependency_search incoming)
  • “Which models inherit from ApplicationRecord and include Auditable?” (dependency_search)
  • “Trace what happens after an order is marked paid.” (get_task_context)

Known limits

  • require and load are ordinary method calls in Ruby, so the imports preset in structural_search selects nothing. Use text_pattern_search to list them.
  • Methods created at run time with define_method or handled by method_missing are not extracted as symbols, and those calls are filtered as metaprogramming noise.
  • Ruby has no decorator syntax, so decorator relationships are marked not applicable.

Next steps

Connect a repository with the quickstart, then check the support matrix on the compatibility page. For other dynamic-language repos, compare the Python guide.

Best fit

  • > Rails monoliths where models, service objects, jobs, and concerns call each other across many directories.
  • > Gems and Ruby services with deep module namespaces and shared base classes.
  • > Teams using AI agents to scope a change before touching a model or service that half the app depends on.

Agent workflows

  • > Find every caller of a service object or model method before changing its behaviour.
  • > Trace where a class is instantiated with `.new` and which methods run next.
  • > Map which classes inherit from a base class or mix in a module before a refactor.

Engine details

  • > Ruby support covers `.rb`, `.rbw`, `.rake`, `.gemspec`, `Gemfile`, and `Rakefile`. Singleton methods are marked static, and `attr_*` declarations count as accessor methods.
  • > `ClassName.new` counts as instantiation, and receiver typing follows local assignments and instance variables.
  • > Metaprogramming calls such as `define_method` and `send`, Sorbet `T::` helpers, and common enumerable calls are filtered from relationships.

Useful MCP entry points

  • find_symbol

    Use it for a namespaced class, module, or method such as `Billing::ChargeCustomer.call`.

  • dependency_search

    Use incoming traversal on a model or service object to see callers and subclasses before a change.

  • text_pattern_search

    Use it for `require` paths, route strings, and dynamically defined methods that the graph cannot see.