Class: Silas::Tools::Remember

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

Overview

Built-in, advertised when memory is enabled and the table exists. Writes are APPROVAL-GATED by default (config.memory_approval = :always) — a memory card parks in the inbox before anything persists, eve's user-approved-memory pattern done Rails-style. transactional! — the memory row and the ledger row commit together, exactly once.

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:, content:, attribute: nil, shared: nil) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/silas/tools/remember.rb', line 22

def call(subject:, content:, attribute: nil, shared: nil)
  memory = Memory.remember!(
    agent_name: session.agent_name, subject:, content:, attribute:,
    scope: shared ? "app" : "agent",
    turn: session.turns.order(:index).last
  )
  { "remembered" => memory.to_line, "scope" => memory.scope }
end