Class: RobotLab::RecordKnowledge

Inherits:
Tool
  • Object
show all
Defined in:
lib/robot_lab/record_knowledge.rb

Instance Method Summary collapse

Instance Method Details

#execute(content:, reasoning:, category:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/robot_lab/record_knowledge.rb', line 15

def execute(content:, reasoning:, category:)
  adapter = RobotLab::Durable::Hook.current_adapter
  return 'No durable session active on this robot.' unless adapter

  adapter.record(content: content, reasoning: reasoning, category: category)

  # Update session memory so subsequent LLM calls in this run see the fact.
  # HTM deduplicates by content hash, so the on_learn callback that follows is safe.
  robot.learn(content)

  "Recorded: #{content}"
end