orka.memory.file_operations module

File operations for memory loggers.

class orka.memory.file_operations.FileOperationsMixin[source]

Bases: object

Mixin class providing file operations for memory loggers.

save_to_file(file_path: str) None[source]

Save the logged events to a JSON file with blob deduplication.

This method implements deduplication by: 1. Replacing repeated JSON response blobs with SHA256 references 2. Storing unique blobs once in a separate blob store 3. Reducing file size by ~80% for typical workflows 4. Meeting data minimization requirements

Parameters:

file_path – Path to the output JSON file.

static load_from_file(file_path: str, resolve_blobs: bool = True) Dict[str, Any][source]

Load and optionally resolve blob references from a deduplicated log file.

Parameters:
  • file_path – Path to the log file

  • resolve_blobs – If True, resolve blob references to original content

Returns:

Dictionary containing metadata, events, and optionally resolved content