Class: XAeonAgents::Agents::DiffInterpreterAgent

Inherits:
ComposableAgents::AiAgents::Agent
  • Object
show all
Includes:
XAeonAgents::AgentDefaults
Defined in:
lib/x_aeon_agents/agents/diff_interpreter_agent.rb

Overview

Agent responsible for analyzing files differences in a repository

Instance Method Summary collapse

Methods included from XAeonAgents::AgentDefaults

#new_agent, prepended, singleton_session_id

Constructor Details

#initialize(**agent_params) ⇒ DiffInterpreterAgent

Constructor

Parameters:

  • agent_params (Hash{Symbol => Object})

    Extra agent parameters



29
30
31
32
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
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/x_aeon_agents/agents/diff_interpreter_agent.rb', line 29

def initialize(**agent_params)
  super(
    name: 'Diff interpreter',
    role: 'You are a files diff interpreter agent',
    objective: <<~EO_OBJECTIVE,
      Interpret files modifications and explain the changes properly with its meaning and intent.

      The goals are:
      - Get a general explanation of those changes.
      - Identify the kind of changes involved (new features, feature change, bug fix, documentation...).
      - Identify the components that are impacted by those changes (a specific plugin, CLI, UI...).
    EO_OBJECTIVE
    **agent_params
  )
  self.system_instructions = {
    ordered_list: [
      <<~EO_INSTRUCTIONS,
      <<~EO_INSTRUCTIONS,
      <<~EO_INSTRUCTIONS
        Create an artifact named `#{artifact_ref(:change_intent)}` to explain properly the changes reported by the artifact named `#{artifact_ref(:files_diff)}`

        - You MUST create an artifact named `change_intent` that contains:
          1. A general explanation of the changes, their meaning and intent in the context of this project.
          2. The types of changes (feature, bug fix, documentation, etc.).
          3. The impacted architectural components (backend, login screen, CLI, etc.).
        - Describe those changes in a way similar to a git commit comment or a pull request description.
        - ONLY cover changes from the artifact named `#{artifact_ref(:files_diff)}`.
        - Do NOT explain changes for other files.
      EO_INSTRUCTIONS
    ]
  }
  self.constraints = <<~EO_CONSTRAINTS
    - You are in read-only mode.
    - Do NOT modify or write any file.
    - You must ONLY explain the changes of the artifact named `#{artifact_ref(:files_diff)}`, NOT other changes.
    - You already have ALL the information required.
    - The user's intent is fully specified.
    - The conversation log is provided for context only. You MUST NOT ask follow-up questions.
  EO_CONSTRAINTS
end

Instance Method Details

#input_artifacts_contractsHash{Symbol => Object}

Define input artifacts contracts

Returns:

  • (Hash{Symbol => Object})

    Set of input artifacts description, per artifact name



10
11
12
# File 'lib/x_aeon_agents/agents/diff_interpreter_agent.rb', line 10

def input_artifacts_contracts
  super.merge(files_diff: 'The full list of files changes and differences that have been done')
end

#output_artifacts_contractsHash{Symbol => Object}

Define output artifacts contracts

Returns:

  • (Hash{Symbol => Object})

    Set of output artifacts description, per artifact name



17
18
19
20
21
22
23
24
# File 'lib/x_aeon_agents/agents/diff_interpreter_agent.rb', line 17

def output_artifacts_contracts
  super.merge(
    change_intent: {
      description: 'The full explanation of the changes, as in a git commit description',
      type: :text
    }
  )
end