Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions src/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,12 @@
//!
//! # Architecture
//!
//! The design separates **when to compact** from **how to compact**:
//! The design separates when to compact from how to compact:
//!
//! - [`ContextManager`] — a concrete struct that monitors token usage,
//! checks thresholds, and decides when to trigger compaction.
//! - [`ContextCompactor`] — a trait that defines the compaction strategy.
//! Plug in truncation, summarization, Q&A extraction, or any custom
//! approach.
//!
//! ```text
//! ┌────────────────────────────┐
//! │ ContextManager │
//! │ │
//! │ estimate_tokens() │
//! │ should_compact() │
//! │ ensure_context_fits() │
//! │ │ │
//! │ ▼ │
//! │ ┌──────────────────────┐ │
//! │ │ dyn ContextCompactor│ │
//! │ │ .compact() │ │
//! │ └──────────────────────┘ │
//! └────────────────────────────┘
//! ```
//! 1. [`ContextManager`] monitors token usage, checks thresholds, and
//! decides when to trigger compaction.
//! 2. [`ContextCompactor`] is the trait that defines the compaction
//! strategy. Plug in truncation, summarization, or any custom approach.
//!
//! # Provided Compactors
//!
Expand Down
Loading