Class: MnemeJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/mneme_job.rb

Overview

Runs the Mneme memory department — a phantom LLM loop that observes the main session and creates summaries of conversation context before it evicts from the viewport.

Triggered when the terminal event (Session#mneme_boundary_event_id) leaves the viewport, indicating that meaningful context is about to be lost.

After L1 snapshot creation, checks whether enough uncovered L1 snapshots have accumulated to trigger Level 2 compression.

Examples:

MnemeJob.perform_later(session.id)

Instance Method Summary collapse

Instance Method Details

#perform(session_id) ⇒ Object

Parameters:

  • session_id (Integer)

    the main Session to summarize



26
27
28
29
30
31
32
33
34
# File 'app/jobs/mneme_job.rb', line 26

def perform(session_id)
  session = Session.find(session_id)
  log.info("job started for session=#{session_id}")
  Mneme::Runner.new(session).call
  check_l2_compression(session)
rescue => error
  log.error("FAILED session=#{session_id}: #{error.class}: #{error.message}")
  raise
end