Class: Tools::Remember
Overview
Fractal-resolution zoom into message history. Returns a window centered on a target message with full detail at the center and compressed context 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]
The agent discovers target messages via FTS5 search results embedded in viewport recall snippets. This tool drills down into the full context.
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:) ⇒ Remember
constructor
A new instance of Remember.
Methods inherited from Base
Constructor Details
#initialize(session:) ⇒ Remember
Returns a new instance of Remember.
43 44 45 |
# File 'lib/tools/remember.rb', line 43 def initialize(session:, **) @session = session end |
Class Method Details
.description ⇒ Object
31 |
# File 'lib/tools/remember.rb', line 31 def self.description = "Recall the full conversation around a past message." |
.input_schema ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/tools/remember.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/remember.rb', line 29 def self.tool_name = "remember" |
Instance Method Details
#execute(input) ⇒ String
Returns fractal-resolution window around the target message.
49 50 51 52 53 54 55 |
# File 'lib/tools/remember.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 |