Class: Tools::ViewMessages
Overview
Fractal-resolution window into long-term memory. Given a message_id, returns the surrounding conversation with full detail at the center and compressed snapshots at the edges — sharp fovea, blurry periphery.
Output structure:
[Previous snapshots — compressed context before]
[Messages N-M — full detail, tool_responses compressed to checkmarks]
[Following snapshots — compressed context after]
Aoide discovers target message IDs via SearchMessages and drills down here to recover the full context around any moment.
Constant Summary collapse
- CONTEXT_WINDOW =
Messages around the target to include at full resolution. ±10 messages provides sharp foveal detail while keeping output readable.
20- ROLE_LABELS =
{ "user_message" => "User", "agent_message" => "Assistant", "system_message" => "System" }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#execute(input) ⇒ String
Fractal-resolution window around the target message.
-
#initialize(session:) ⇒ ViewMessages
constructor
A new instance of ViewMessages.
Methods inherited from Base
prompt_guidelines, prompt_snippet, schema, truncation_threshold
Constructor Details
#initialize(session:) ⇒ ViewMessages
Returns a new instance of ViewMessages.
43 44 45 |
# File 'lib/tools/view_messages.rb', line 43 def initialize(session:, **) @session = session end |
Class Method Details
.description ⇒ Object
31 |
# File 'lib/tools/view_messages.rb', line 31 def self.description = "View the full conversation around a message in long-term memory. Pass a message_id — typically one returned by search_messages — to see the surrounding exchange with compressed snapshots at the edges." |
.input_schema ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/tools/view_messages.rb', line 33 def self.input_schema { type: "object", properties: { message_id: {type: "integer"} }, required: ["message_id"] } end |
.tool_name ⇒ Object
29 |
# File 'lib/tools/view_messages.rb', line 29 def self.tool_name = "view_messages" |
Instance Method Details
#execute(input) ⇒ String
Returns fractal-resolution window around the target message.
49 50 51 52 53 54 55 |
# File 'lib/tools/view_messages.rb', line 49 def execute(input) = input["message_id"].to_i target = Message.find_by(id: ) return {error: "Message #{} not found"} unless target build_fractal_window(target) end |