zeph_agent_context/summarization/mod.rs
1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Context summarization pipeline for `zeph-agent-context`.
5//!
6//! This module organises the three summarization tiers:
7//!
8//! - **Deferred** (`deferred`) — stores tool-pair summaries on message metadata and
9//! applies them lazily when context pressure rises, preserving provider cache hits.
10//! - **Pruning** (`pruning`) — evicts tool output bodies using one of the five
11//! configured strategies (Reactive, `TaskAware`, MIG, Subgoal, `SubgoalMig`).
12//! - **Scheduling** (`scheduling`) — dispatches the Soft/Hard/Proactive compaction tiers
13//! and drives non-blocking background goal/subgoal extraction.
14//! - **Compaction** (`compaction`) — LLM-based summarization that drains the oldest
15//! messages and reinserts a compact summary.
16//!
17//! All entry points accept a [`crate::state::ContextSummarizationView`] so the logic
18//! contains no `Agent<C>` references and the crate does not depend on `zeph-core`.
19
20pub(crate) mod compaction;
21pub(crate) mod deferred;
22pub(crate) mod pruning;
23pub mod scheduling;
24
25// Re-export the read-only helpers so `zeph-core` integration tests can call
26// them via `zeph_agent_context::summarization::*` without duplicating the logic.
27pub use deferred::{
28 count_deferred_summaries, count_unsummarized_pairs, find_oldest_unsummarized_pair,
29};