surface agent: add surface_hooks config and reduce search hops
Add surface_hooks config field — list of hook event names that trigger the surface agent (e.g. ["UserPromptSubmit"]). Empty list disables it. Reduce surface agent search from 3-5 hops to 2-3 to keep prompt size under the API endpoint's connection limit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9a0121250b
commit
78c93dde4d
2 changed files with 10 additions and 7 deletions
|
|
@ -6,6 +6,10 @@ Your job is to find and surface memories relevant and useful to the current
|
||||||
conversation that have not yet been surfaced by walking the graph memory graph.
|
conversation that have not yet been surfaced by walking the graph memory graph.
|
||||||
Prefer shorter and more focused memories.
|
Prefer shorter and more focused memories.
|
||||||
|
|
||||||
|
If graph walks aren't finding what you're looking for, try searching with
|
||||||
|
queries on node keys, and then content. If these turn up relevant results, add
|
||||||
|
appropriate links.
|
||||||
|
|
||||||
Your output should be notes and analysis on the search - how useful do
|
Your output should be notes and analysis on the search - how useful do
|
||||||
you think the search was, or do memories need to be organized better - and then
|
you think the search was, or do memories need to be organized better - and then
|
||||||
then at the end, if you find relevant memories:
|
then at the end, if you find relevant memories:
|
||||||
|
|
@ -33,17 +37,11 @@ Already in current context (don't re-surface unless the conversation has shifted
|
||||||
Surfaced before compaction (context was reset — re-surface if still relevant):
|
Surfaced before compaction (context was reset — re-surface if still relevant):
|
||||||
{{seen_previous}}
|
{{seen_previous}}
|
||||||
|
|
||||||
Context budget: {{memory_ratio}}
|
|
||||||
The higher this percentage, the pickier you should be. Only surface memories
|
|
||||||
that are significantly more relevant than what's already loaded. If memories
|
|
||||||
are already 20%+ of context, the bar is very high — a new find must clearly
|
|
||||||
add something the current set doesn't cover.
|
|
||||||
|
|
||||||
How focused is the current conversation? If it's highly focus, you should only
|
How focused is the current conversation? If it's highly focus, you should only
|
||||||
be surfacing highly relevant memories; if it seems more dreamy or brainstormy,
|
be surfacing highly relevant memories; if it seems more dreamy or brainstormy,
|
||||||
go a bit wider and surface more.
|
go a bit wider and surface more.
|
||||||
|
|
||||||
Search at most 3-5 hops, and output at most 2-3 memories, picking the most
|
Search at most 2-3 hops, and output at most 2-3 memories, picking the most
|
||||||
relevant. When you're done, output exactly one of these two formats:
|
relevant. When you're done, output exactly one of these two formats:
|
||||||
|
|
||||||
{{node:memory-instructions-core}}
|
{{node:memory-instructions-core}}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ pub struct Config {
|
||||||
/// Surface agent timeout in seconds. Kill if running longer than this.
|
/// Surface agent timeout in seconds. Kill if running longer than this.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub surface_timeout_secs: Option<u32>,
|
pub surface_timeout_secs: Option<u32>,
|
||||||
|
/// Hook events that trigger the surface agent (e.g. ["UserPromptSubmit"]).
|
||||||
|
/// Empty list disables surface agent.
|
||||||
|
#[serde(default)]
|
||||||
|
pub surface_hooks: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
|
|
@ -109,6 +113,7 @@ impl Default for Config {
|
||||||
"separator".into(), "split".into(),
|
"separator".into(), "split".into(),
|
||||||
],
|
],
|
||||||
surface_timeout_secs: None,
|
surface_timeout_secs: None,
|
||||||
|
surface_hooks: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue