Class: OllamaAgent::SelfImprovement::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama_agent/self_improvement/analyzer.rb

Overview

Runs a read-only agent pass to review the gem (no edits).

Constant Summary collapse

DEFAULT_PROMPT =
<<~PROMPT
  Perform a self-review of this gem: architecture, tests, clarity, and risks.
  Scan for TODO/FIXME/HACK and call out the highest-impact follow-ups.
  Use tools to inspect real files; finish with prioritized, actionable recommendations.
PROMPT
INTERACTIVE_PROMPT =

Mode 2 (interactive): full tool loop on the real tree; user confirms each patch like ‘ask`.

<<~PROMPT
  You are improving the ollama_agent gem in this working tree (not a sandbox).
  The user message may begin with "## Static analysis (ruby_mastery)" from tooling; confirm against the tree.
  Use list_files, search_code, and read_file, then apply small unified diffs with edit_file.
  Keep changes reviewable; prefer tests, docs, and clarity fixes; address TODO/FIXME/HACK when safe.
  When finished, summarize what you changed or suggested next.
PROMPT

Instance Method Summary collapse

Constructor Details

#initialize(agent) ⇒ Analyzer

Returns a new instance of Analyzer.



24
25
26
# File 'lib/ollama_agent/self_improvement/analyzer.rb', line 24

def initialize(agent)
  @agent = agent
end

Instance Method Details

#run(prompt = DEFAULT_PROMPT, preamble: nil) ⇒ Object



28
29
30
31
# File 'lib/ollama_agent/self_improvement/analyzer.rb', line 28

def run(prompt = DEFAULT_PROMPT, preamble: nil)
  body = [preamble, prompt].compact.map(&:to_s).reject(&:empty?).join("\n\n")
  @agent.run(body)
end