Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::CompactionManager Class Reference

Manages automatic context compaction. More...

#include <entropic/core/compaction.h>

Collaboration diagram for entropic::CompactionManager:

Public Member Functions

 CompactionManager (const CompactionConfig &config, TokenCounter &counter)
 Construct a compaction manager.
 
CompactionResult check_and_compact (std::vector< Message > &messages, bool force=false, const std::string &conversation_id="")
 Check if compaction is needed and perform if so.
 
CompactionResult compact_messages (const std::vector< Message > &messages)
 Compact messages using the value-density strategy.
 
void set_storage (const struct StorageInterface *storage)
 Set storage interface for compaction snapshots.
 

Public Attributes

CompactionConfig config
 Compaction configuration.
 
TokenCountercounter
 Shared token counter.
 

Detailed Description

Manages automatic context compaction.

Monitors token usage and triggers deterministic summarization when approaching the context limit. No model inference — uses structured extraction only.

Version
1.8.4

Definition at line 113 of file compaction.h.

Constructor & Destructor Documentation

◆ CompactionManager()

entropic::CompactionManager::CompactionManager ( const CompactionConfig config,
TokenCounter counter 
)

Construct a compaction manager.

Parameters
configCompaction config (copied by value).
counterToken counter instance (shared reference).
Version
1.8.4
Parameters
configCompaction configuration.
counterToken counter (shared reference).

Definition at line 111 of file compaction.cpp.

Member Function Documentation

◆ check_and_compact()

CompactionResult entropic::CompactionManager::check_and_compact ( std::vector< Message > &  messages,
bool  force = false,
const std::string &  conversation_id = "" 
)

Check if compaction is needed and perform if so.

Check and perform compaction if over threshold.

Parameters
messagesCurrent message list (modified in place if compacted).
forceBypass threshold check and compact immediately.
conversation_idConversation ID for snapshot (empty = skip).
Returns
Compaction result.
Version
1.8.8
Parameters
messagesMessage list (modified in place if compacted).
forceBypass threshold.
Returns
CompactionResult with before/after stats.

Definition at line 124 of file compaction.cpp.

◆ compact_messages()

CompactionResult entropic::CompactionManager::compact_messages ( const std::vector< Message > &  messages)

Compact messages using the value-density strategy.

Compact messages using value-density strategy.

Public entry point for the default compaction algorithm. Used by CompactorRegistry to wrap the built-in strategy as a compactor. Does NOT check thresholds — callers are responsible for that.

Parameters
messagesMessages to compact.
Returns
CompactionResult with compacted messages and metadata.
Version
1.9.9

Public wrapper around the private compact() method. Returns a fully-populated CompactionResult including the compacted message list. Does not check thresholds.

Parameters
messagesMessages to compact.
Returns
CompactionResult with compacted messages and metadata.

Definition at line 428 of file compaction.cpp.

◆ set_storage()

void entropic::CompactionManager::set_storage ( const struct StorageInterface storage)

Set storage interface for compaction snapshots.

Parameters
storageStorage callbacks (nullable).
Version
1.8.8
Parameters
storageStorage callbacks (nullable).

Definition at line 458 of file compaction.cpp.

Member Data Documentation

◆ config

CompactionConfig entropic::CompactionManager::config

Compaction configuration.

Definition at line 157 of file compaction.h.

◆ counter

TokenCounter& entropic::CompactionManager::counter

Shared token counter.

Definition at line 158 of file compaction.h.


The documentation for this class was generated from the following files: