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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! 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;
//! - [`system`] orders the system prompt as the host lays it out and keeps
//! external content inside boundaries it cannot close;
//! - [`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;
//! - [`prefix`] hashes each request's prefix block by block, so a host can
//! tell where the prefix changed when the cache misses;
//! - [`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;
//! - [`live`] is how prefix content that changes mid-session — `AGENTS.md`,
//! the command table — reaches the model as one diff while the prefix is
//! cached and as its clean version after the next reassembly.
pub
pub use ContextBudget;
pub use ;
pub use ;
pub use ;
pub use ContextPolicy;
pub use ;
pub use restore_context;
pub use ;
pub use ActiveSkills;
pub use ;
pub use ;
pub use ;