ExAgent.Compaction.Memo (ExAgent v2.3.0)

View Source

A bounded, host-supervised store that lets ExAgent.Compaction.Summary reuse its last summary instead of summarizing on every request.

children = [{ExAgent.Compaction.Memo, name: MyApp.CompactionMemo, max_entries: 2_000}]

%ExAgent.Compaction.Capability{
  compactor: ExAgent.Compaction.Summary,
  opts: [summarize: &my_summarize/1, memo: MyApp.CompactionMemo]
}

Each entry holds one summary text and a SHA-256 digest of the messages it replaced, keyed by a digest of the conversation's first message. The digest check makes reuse safe across forks and unrelated conversations; conversations that start with the same message share one entry, which costs extra summaries, never a wrong one. When :max_entries (default 1024) is exceeded, the oldest conversation is evicted. Entries live in memory only: after a restart the next compaction summarizes once and stores a new entry. Summaries can contain conversation content; size the store, and its process ownership, like any other in-memory cache of it.

Summary

Functions

Returns a specification to start this module under a supervisor.

Number of stored conversations.

Start the store. Options: :name, :max_entries (positive integer).

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

size(memo)

Number of stored conversations.

start_link(opts \\ [])

Start the store. Options: :name, :max_entries (positive integer).