Class: ObservationCompressor
Defined in: packages/agentos/src/memory/observation/ObservationCompressor.ts:122
LLM-based compressor that takes a batch of ObservationNote objects and produces denser CompressedObservation summaries.
Achieves 3-10x compression while preserving key facts, entities, and temporal context. Each compressed observation carries three-date temporal metadata: when the compression happened, the earliest referenced event, and a human-friendly relative time label.
Constructors
Constructor
new ObservationCompressor(
llmInvoker,traits?):ObservationCompressor
Defined in: packages/agentos/src/memory/observation/ObservationCompressor.ts:127
Parameters
llmInvoker
(system, user) => Promise<string>
Function that calls an LLM with (system, user) prompts.
traits?
Optional HEXACO personality traits for bias-aware compression.
Returns
ObservationCompressor
Methods
compress()
compress(
notes):Promise<CompressedObservation[]>
Defined in: packages/agentos/src/memory/observation/ObservationCompressor.ts:144
Compress a batch of observation notes into denser summaries.
The method:
- Formats the notes as a numbered list for the LLM.
- Sends the batch to the LLM with a compression prompt.
- Parses the JSON array response into CompressedObservation objects.
- Attaches three-date temporal metadata (observedAt, referencedAt, relativeLabel).
Parameters
notes
Batch of observation notes to compress.
Returns
Promise<CompressedObservation[]>
Array of compressed observations. Returns empty array on LLM failure.