Restore trim_conversation: dedup memories, evict to budget, snap boundary
Ported the old trim_entries logic to the new AstNode types: - Phase 1: Dedup Memory nodes by key (keep last), drop DMN entries - Phase 2: While over budget, evict lowest-scored memory (if memories > 50% of conv tokens) or oldest conversation entry - Phase 3: Snap to User message boundary at start Called from compact() which runs on startup and on /compact. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
7237baba11
commit
bbffc2213e
2 changed files with 84 additions and 0 deletions
|
|
@ -555,6 +555,8 @@ impl Agent {
|
|||
|
||||
self.load_startup_journal().await;
|
||||
|
||||
self.context.lock().await.trim_conversation();
|
||||
|
||||
let mut st = self.state.lock().await;
|
||||
st.generation += 1;
|
||||
st.last_prompt_tokens = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue