symfonic.memory.working.stm_summary¶
stm_summary ¶
Short-Term Memory (STM) summary generation for evicted working turns.
v7.0 T09. WorkingLayer.summarize used to return "" as a stub;
this module provides two real implementations:
- extractive (default when
stm_summary_mode == "extractive") — latency-free. For each dropped entry take the first and last sentence, dedup, bullet it. No LLM call. - llm (
stm_summary_mode == "llm") — one micro-call per summary through the caller-supplied model provider. Falls back to the extractive path on any upstream failure so hydration never stalls on an outage.
stm_summary_mode == "off" preserves v6.1.8 behaviour: the engine
skips this module entirely and WorkingLayer.summarize still
returns the empty stub.
STMSummary
dataclass
¶
Result of an STM summary pass.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
Rendered summary (may be empty when no source entries). |
mode_used |
SummaryMode
|
Actual mode applied. When the requested mode was
|
entry_count |
int
|
Number of source entries that fed the summary. |
truncated |
bool
|
True when the deterministic path truncated to the configured token budget. |
summarize_entries ¶
summarize_entries(
entries: list[MemoryEntry],
*,
mode: SummaryMode,
max_chars: int = 1000,
model_provider: _ModelProviderLike | None = None,
model_config: Any | None = None,
observability_hook: Any | None = None,
run_id: str = "",
) -> STMSummary
Summarise entries according to mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
list[MemoryEntry]
|
Dropped working-memory entries (FIFO evictees). |
required |
mode
|
SummaryMode
|
|
required |
max_chars
|
int
|
Upper bound on the summary body. |
1000
|
model_provider
|
_ModelProviderLike | None
|
Required when |
None
|
model_config
|
Any | None
|
Passed verbatim to |
None
|
observability_hook
|
Any | None
|
v8.3.2 (G3) -- when supplied AND
|
None
|
run_id
|
str
|
Engine run identifier stamped on the hook events. |
''
|
Returns:
| Type | Description |
|---|---|
STMSummary
|
STMSummary. Never raises. |