Class: Silas::Tools::Recall

Inherits:
Silas::Tool show all
Defined in:
lib/silas/tools/recall.rb

Overview

Read-side of memory: on-demand subject lookup (the injected snapshot carries only the most recent few — this digs deeper).

Instance Attribute Summary

Attributes inherited from Silas::Tool

#session

Instance Method Summary collapse

Methods inherited from Silas::Tool

approval, #approval_policy, at_most_once!, description, effect_mode, #effect_mode, idempotent!, param, schema, tool_name, transactional!, validate_signature!

Instance Method Details

#call(subject:) ⇒ Object



11
12
13
14
15
# File 'lib/silas/tools/recall.rb', line 11

def call(subject:)
  memories = Memory.recall(agent_name: session.agent_name, subjects: [ subject ], limit: 20)
                   .select { |m| m.subject == subject.to_s.strip.downcase }
  { "subject" => subject, "memories" => memories.map(&:to_line) }
end