Class: Mneme::Runner

Inherits:
BaseRunner show all
Defined in:
lib/mneme/runner.rb

Overview

Mneme in eviction mode — a phantom LLM loop that summarizes the oldest slice of the viewport before it slides off. She sees the eviction zone (what she’s compressing) plus the remaining viewport (context she needs to write a faithful summary), calls Tools::SaveSnapshot to persist the compressed memory, optionally pins critical messages to goals, then advances the Mneme boundary past the zone so the cycle repeats as more messages accumulate.

Examples:

Mneme::Runner.new(session).call

Constant Summary collapse

TOOLS =
[
  Tools::SaveSnapshot,
  Tools::AttachMessagesToGoals,
  Tools::EverythingOk
].freeze
TASK_PROMPT =
<<~PROMPT
  Right now your work is compression. As Aoide's viewport slides forward, you catch what's about to fall off and turn it into something she can carry.

  ──────────────────────────────
  WHAT YOU SEE
  ──────────────────────────────
  Two sections of the viewport, oldest to newest:
  - EVICTION ZONE: about to fall off. This is what you summarize.
  - CONTEXT: the live viewport past the eviction zone. Use it for continuity — Aoide is still seeing it.

  Messages are prefixed with `message N` (database ID, used for pinning).
  Tool calls are compressed to `[N tools called]` — focus on conversation, not mechanical work.

  ──────────────────────────────
  HOW TO REMEMBER
  ──────────────────────────────
  Summarize the eviction zone with save_snapshot: what was discussed and decided, why, goal progress, and the context Aoide will need later. Paraphrase — don't quote verbatim. Drop mechanical steps.

  A snapshot is a tax on Aoide's viewport budget. Every word you write takes a word she can't spend on the current exchange. Capture the load-bearing details; let the rest go.

  Pin critical messages to goals with attach_messages_to_goals when exact wording matters — user instructions, key corrections, key decisions. A pinned message survives eviction intact. Use it sparingly: each pin is another slice of viewport Aoide carries forward.

  If the eviction zone holds only mechanical activity — tool calls, no conversation — call everything_ok and let it fall off without a snapshot.

  save_snapshot and attach_messages_to_goals can be called together in one turn.
PROMPT

Constants inherited from BaseRunner

BaseRunner::BASE_IDENTITY

Method Summary

Methods inherited from BaseRunner

#call, #initialize

Constructor Details

This class inherits a constructor from Mneme::BaseRunner