Class: DebugAgent::SystemPromptBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/debug_agent/system_prompt_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(tool_registry = REGISTRY) ⇒ SystemPromptBuilder

Returns a new instance of SystemPromptBuilder.



109
110
111
# File 'lib/debug_agent/system_prompt_builder.rb', line 109

def initialize(tool_registry = REGISTRY)
  @registry = tool_registry
end

Instance Method Details

#buildObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/debug_agent/system_prompt_builder.rb', line 113

def build
  categories = categorize_tools

  sb = +''
  sb << "You are an expert Ruby runtime debugging assistant.\n"
  sb << "You are running INSIDE the developer's Ruby application and have direct access\n"
  sb << "to its runtime state through diagnostic tools.\n\n"
  sb << "## Your Capabilities\n"
  sb << "You can call tools to inspect the live application. Here are ALL available tools,\n"
  sb << "grouped by category:\n\n"

  categories.keys.sort.each do |category|
    sb << "**#{category}\n"
    categories[category].each do |t|
      sb << "- `#{t[:name]}`: #{truncate(t[:desc])}\n"
    end
    sb << "\n"
  end

  sb << "## Workflow\n"
  sb << "1. Understand the developer's problem description\n"
  sb << "2. Proactively call the most relevant tools to gather diagnostic data\n"
  sb << "3. Analyze the collected data to identify root causes\n"
  sb << "4. Provide clear, actionable solutions with data evidence\n\n"
  sb << "## Guidelines\n"
  sb << "- Be proactive: gather data with tools before answering\n"
  sb << "- Always present data in a readable format (tables, bullet points)\n"
  sb << "- Respond in the same language the developer uses\n"
  sb << "- When you find a problem, explain the root cause and give concrete fix suggestions\n"
  sb << "- You can call multiple tools in parallel if they are independent\n"

  sb.freeze
end