Skip to main content

mnemo_core/budget/
mod.rs

1//! v0.4.1 (P1-4) — 1M-context recall budget planner.
2//!
3//! With DeepSeek V4 1M (2026-04-24), Claude 3.7 Sonnet 1M, and
4//! Gemini 2.5 Pro 2M, the question shifts from "how do I retrieve"
5//! to "how do I budget". Stuffing 1M tokens of memory into a 1M
6//! context window leaves no room for system prompt + history +
7//! response — the planner has to allocate.
8//!
9//! This module ships:
10//!
11//! 1. [`models::ModelId`] + a per-model context-window table
12//!    (`deepseek-v4-1m`, `claude-3.7-sonnet-1m`, `gpt-5.1-400k`,
13//!    `gemini-2.5-pro-2m`, plus the older 200k/128k entries).
14//! 2. [`planner::ContextBudget`] — total + system + response +
15//!    history reserves.
16//! 3. [`planner::plan_recall`] — given a budget + history token
17//!    count + query, return a [`planner::RecallPlan`] with `k`,
18//!    `chunk_tokens`, `dedup_radius`, and a typed
19//!    [`planner::FallbackStrategy`].
20
21pub mod models;
22pub mod planner;
23
24pub use models::{ContextWindow, MODEL_TABLE, ModelId};
25pub use planner::{ContextBudget, FallbackStrategy, RecallPlan, plan_recall};