Ragex.Agent.Report (Ragex v0.12.0)

View Source

Report generation utilities for agent analysis.

Handles:

  • System prompts for AI report generation
  • Formatting raw issues for LLM consumption
  • Fallback basic report generation when no AI provider is available

Tool access during report generation

The executor is intentionally called with tools: [] (no tool access) during report generation. All required analysis data is serialised into the user message so the AI writes the report in a single blocking call.

Providing tools during report generation caused a regression with DeepSeek R1 and similar reasoning models: they place the entire report in their hidden thinking block and then emit tool calls as the visible response, causing the ReAct loop to iterate until the dedup guard fires and force_text_response/1 produces a "data not provided" stub instead of the real report.

The ToolSchema.rag_query_tools/1 set is used when the AI has an interactive conversation session (ragex.chat follow-up queries), not during report generation.

Summary

Functions

Format issues map for LLM consumption.

Generate a basic report without AI assistance.

System prompt for report generation.

Functions

format_issues_for_llm(issues)

@spec format_issues_for_llm(map()) :: String.t()

Format issues map for LLM consumption.

generate_basic_report(issues)

@spec generate_basic_report(map()) :: String.t()

Generate a basic report without AI assistance.

Used as fallback when AI generation fails.

system_prompt(project_path \\ nil)

@spec system_prompt(String.t() | nil) :: String.t()

System prompt for report generation.

Instructs the AI to act as a senior software architect writing a professional code audit report based solely on the pre-computed analysis data passed in the user message. No tools are available during report generation — see the module doc for the reasoning.

Parameters

  • project_path - Absolute path to the project being analyzed (optional)