agent: compact() preserves Identity section
compact() was calling reload_context() to re-fetch personality_nodes from the store and pushing fresh AstNode::memory leaves into the Identity section. Fresh leaves start with score: None, so every compact — which fires after every turn (mind/mod.rs:884) — was wiping any memory scores that had just been computed. Scoring then often ran immediately after compact on the same path (line 886), starting from a zero-score Identity section. Drop the rebuild. Identity content is loaded at startup via new() + restore_from_log(); compact doesn't need to redo that. Mid-session edits to personality-node content are a non-goal — a restart picks them up. Scores survive. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
e59f6a59e2
commit
b8485ed6c1
1 changed files with 3 additions and 14 deletions
|
|
@ -583,20 +583,9 @@ impl Agent {
|
|||
}
|
||||
|
||||
pub async fn compact(&self) {
|
||||
match crate::config::reload_context().await {
|
||||
Ok(personality) => {
|
||||
let mut ctx = self.context.lock().await;
|
||||
// System section (prompt + tools) set by new(), don't touch it
|
||||
ctx.clear(Section::Identity);
|
||||
for (name, content) in &personality {
|
||||
ctx.push_no_log(Section::Identity, AstNode::memory(name, content));
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
dbglog!("warning: failed to reload identity: {:#}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Identity section is left in place — mid-session rebuilds discard
|
||||
// memory scores. Content edits to personality nodes get picked up at
|
||||
// the next restart via new() + restore_from_log().
|
||||
self.load_startup_journal().await;
|
||||
|
||||
self.context.lock().await.trim_conversation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue