Skip to main content

Crate behest_memory

Crate behest_memory 

Source
Expand description

Conversation memory with demotion, compaction, and active window management.

This crate provides:

  • ConversationMemory: trait for loading/appending/clearing conversation messages
  • DemotionHook: trait for demoting old messages to long-term storage
  • Compactor: trait for summarizing old messages into a compact form
  • ActiveWindow: manages the short-term context window with policy-based trimming
  • MemoryPolicy: configures window size, token budget, and retention rules

§Lifecycle

New message → ActiveWindow::push()
  → if over token limit → trim()
    → DemotionHook::demote()  (save to long-term storage)
    → Compactor::compact()    (summarize and inject back)

Structs§

ActiveWindow
Manages the short-term active window of conversation messages.
InMemoryConversationMemory
Simple in-memory implementation of ConversationMemory.
MemoryPolicy
Policy controlling active window management.

Enums§

MemoryEvent
Events produced by memory operations for audit and observability.

Traits§

Compactor
Compacts old messages into a summary.
ConversationMemory
Manages conversation messages for a session.
DemotionHook
Hook for demoting old messages to long-term storage.