Skip to main content

assemble

Function assemble 

Source
pub fn assemble(
    records: Vec<MemoryRecord>,
    budget: &ContextBudget,
) -> Result<MemoryAssembly>
Expand description

Rank and pack records under budget, deterministically.

The rank is a total order — explicit priority descending, then confidence descending, then recency (created_at) descending, then the content address ascending as the final tie-break — so equal store state and equal budget produce byte-equal assemblies. Packing walks the ranked list and stops at the first record that does not fit the remaining budget (BudgetOverflow::Truncate) or fails the read (BudgetOverflow::Fail).