Class: Mneme::PassiveRecall
- Inherits:
-
Object
- Object
- Mneme::PassiveRecall
- Defined in:
- lib/mneme/passive_recall.rb
Overview
Passive recall — automatic memory surfacing triggered by Goal updates. When goals are created or updated, searches event history for related context and caches the results on the session for viewport injection.
The agent never calls a tool; relevant memories appear automatically in the viewport between snapshots and the sliding window. This mirrors recognition memory in humans — context surfaces without conscious effort.
Instance Method Summary collapse
-
#call ⇒ Array<Mneme::Search::Result>
Searches event history using active goal descriptions as queries.
-
#initialize(session) ⇒ PassiveRecall
constructor
A new instance of PassiveRecall.
Constructor Details
#initialize(session) ⇒ PassiveRecall
Returns a new instance of PassiveRecall.
16 17 18 |
# File 'lib/mneme/passive_recall.rb', line 16 def initialize(session) @session = session end |
Instance Method Details
#call ⇒ Array<Mneme::Search::Result>
Searches event history using active goal descriptions as queries. Returns recall results suitable for viewport injection.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mneme/passive_recall.rb', line 24 def call goals = @session.goals.active.root.includes(:sub_goals) return [] if goals.empty? search_terms = build_search_terms(goals) return [] if search_terms.blank? results = Mneme::Search.query(search_terms, limit: Anima::Settings.recall_max_results) # Exclude events from the current session's viewport — no point recalling # what the agent already sees. = @session..to_set results.reject { |result| .include?(result.event_id) } end |