Fix: compact() was clearing tool definitions from system section
compact() cleared and rebuilt the system section but only pushed the system prompt — tool definitions were lost. Since new() sets up the system section correctly (prompt + tools), compact() now only reloads identity and journal, leaving system untouched. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
d4d661df5b
commit
fc75b181cf
2 changed files with 9 additions and 3 deletions
|
|
@ -540,10 +540,9 @@ impl Agent {
|
|||
|
||||
pub async fn compact(&self) {
|
||||
match crate::config::reload_for_model(&self.app_config, &self.prompt_file) {
|
||||
Ok((system_prompt, personality)) => {
|
||||
Ok((_system_prompt, personality)) => {
|
||||
let mut ctx = self.context.lock().await;
|
||||
ctx.clear(Section::System);
|
||||
ctx.push(Section::System, AstNode::system_msg(&system_prompt));
|
||||
// System section (prompt + tools) set by new(), don't touch it
|
||||
ctx.clear(Section::Identity);
|
||||
for (name, content) in &personality {
|
||||
ctx.push(Section::Identity, AstNode::memory(name, content));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue