symfonic.core.utils.compression¶
compression ¶
Deterministic local text compression for memory context.
Reduces verbose memory strings to high-density tokens without any API calls. Uses a fixed abbreviation dictionary + whitespace collapsing.
compress_memory ¶
Compress memory text by abbreviating common words and collapsing whitespace.
Deterministic and local -- zero API cost. Safe for pre-LLM context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Input text to compress. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Compressed text with abbreviated common terms and collapsed whitespace. |
Source code in src/symfonic/core/utils/compression.py
decompress_memory ¶
Reverse compression for logging and debugging. Not used in hot path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Previously compressed text. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Text with abbreviations expanded back to full words. |