budget: identity = system prompt + personality, memory = loaded nodes
Personality is identity, not memory. Memory is nodes loaded during the session via tool calls — things I've actively looked at. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
79672cbe53
commit
c5efc6e650
1 changed files with 5 additions and 8 deletions
|
|
@ -193,8 +193,8 @@ impl Agent {
|
||||||
} else if text.starts_with("Your context was just rebuilt") {
|
} else if text.starts_with("Your context was just rebuilt") {
|
||||||
jnl_tokens += tokens;
|
jnl_tokens += tokens;
|
||||||
} else if jnl_tokens == 0 && conv_tokens == 0 {
|
} else if jnl_tokens == 0 && conv_tokens == 0 {
|
||||||
// First user message is personality/memory context
|
// Personality context — part of identity
|
||||||
// Count it as memory, not identity
|
id_tokens += tokens;
|
||||||
} else {
|
} else {
|
||||||
in_conversation = true;
|
in_conversation = true;
|
||||||
conv_tokens += tokens;
|
conv_tokens += tokens;
|
||||||
|
|
@ -207,13 +207,10 @@ impl Agent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory = personality context + loaded nodes from tool calls
|
// Memory = nodes loaded during the session via tool calls
|
||||||
let mut mem_tokens: usize = self.context.personality.iter()
|
let mem_tokens: usize = self.context.loaded_nodes.iter()
|
||||||
.map(|(_, content)| count(content))
|
.map(|node| count(&node.render()))
|
||||||
.sum();
|
.sum();
|
||||||
for node in &self.context.loaded_nodes {
|
|
||||||
mem_tokens += count(&node.render());
|
|
||||||
}
|
|
||||||
|
|
||||||
self.context_budget = ContextBudget {
|
self.context_budget = ContextBudget {
|
||||||
identity_tokens: id_tokens,
|
identity_tokens: id_tokens,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue