1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Context management: one window, one policy, one budget.
//!
//! Context is the agent's scarcest resource and the one it cannot measure
//! directly, so this module is organised around the few facts that are
//! actually knowable and derives everything else from them:
//!
//! - [`window`] owns the layout, and guarantees it grows only at the end so a
//! provider's prefix cache survives the conversation growing;
//! - [`budget`] turns the provider's own token counts into a usage figure,
//! instead of trusting a character heuristic that is wrong by a different
//! factor for prose, code and tool arguments;
//! - [`policy`] holds every threshold there is — when to compact, when to
//! wait for it, when to rebuild, how much may be restored;
//! - [`cache`] translates the layout into per-provider cache controls;
//! - [`compaction`] forks a typed handoff at a request boundary and applies
//! it at the next one, so the run never stops to summarize itself;
//! - [`reassembly`] re-reads what the handoff named, within budget;
//! - [`source`] is how everything ambient — working documents, running jobs,
//! active skills — reaches the model without the agent loop knowing about
//! any of it in particular.
pub use ContextBudget;
pub use ;
pub use ;
pub use ContextPolicy;
pub use restore_context;
pub use ;
pub use ActiveSkills;
pub use ;
pub use ;