_diffctx/config/budget.rs
1use once_cell::sync::Lazy;
2
3pub struct BudgetConfig {
4 pub unlimited: u32,
5 pub auto_multiplier: f64,
6 pub auto_min: u32,
7 pub auto_max: u32,
8 /// Per-core-fragment ceiling when sizing the auto budget. A core fragment
9 /// that is a whole-file `Chunk` (e.g. a 2000-line unparsed template touched
10 /// by one hunk) would otherwise inflate the budget by its entire byte
11 /// weight, dragging in the whole repo as "context". Capping each core
12 /// fragment's budget contribution decouples "how big are the files I edited"
13 /// from "how much of the repo do I pull in". Does not affect whether the
14 /// changed file is included (it always is) — only the context budget it earns.
15 pub core_token_cap_per_fragment: u32,
16}
17
18impl Default for BudgetConfig {
19 fn default() -> Self {
20 Self {
21 unlimited: 10_000_000,
22 auto_multiplier: 3.0,
23 auto_min: 8_000,
24 auto_max: 48_000,
25 core_token_cap_per_fragment: 1_500,
26 }
27 }
28}
29
30pub static BUDGET: Lazy<BudgetConfig> = Lazy::new(BudgetConfig::default);