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.



29
30
31
# File 'lib/debug_agent/system_prompt_builder.rb', line 29

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

Instance Method Details

#buildObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/debug_agent/system_prompt_builder.rb', line 33

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