You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two separate triggers for background review, matching Hermes:
- Memory review: fires after 5+ user turns (unchanged)
- Skill review: fires after 10+ tool iterations in a single reply
(complex work that required many tool calls = likely worth capturing)
When both trigger at once, sends a combined prompt that asks for both
memory AND skill extraction in one call (avoids double API cost).
Skill review prompt asks specifically: 'Was a non-trivial approach used
that required trial and error, or changing course, or did the user
expect a different method?' — focused on learnable struggle, not routine.
Review agent gets both memory + skill tools (create_skill, patch_skill,
load_skill) so it can create new skills or update existing ones.
Signed-off-by: Michael Neale <michael.neale@gmail.com>
Copy file name to clipboardExpand all lines: crates/goose/src/agents/knowledge_review.rs
+89-39Lines changed: 89 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
1
//! Background knowledge review and pre-compression memory flush.
2
2
//!
3
-
//! Two mechanisms for autonomous memory extraction:
3
+
//! Three mechanisms for autonomous knowledge extraction:
4
4
//!
5
-
//! 1. **Background review**: After a reply is delivered, if enough user turns
6
-
//! have elapsed, spawn a background task that reviews the conversation
7
-
//! and calls memory tools to extract durable facts.
5
+
//! 1. **Background memory review**: After a reply, if enough user turns have
6
+
//! elapsed, review the conversation for memory-worthy facts.
8
7
//!
9
-
//! 2. **Pre-compression flush**: Before context compaction, give the model
10
-
//! one cheap API call with only memory tools to save anything worth
11
-
//! keeping before it gets summarized away.
8
+
//! 2. **Background skill review**: After a reply, if enough tool iterations
9
+
//! occurred (complex work), review whether a skill should be created/updated.
10
+
//!
11
+
//! 3. **Pre-compression flush**: Before context compaction, give the model
12
+
//! one cheap API call with only memory tools to save anything worth keeping.
12
13
13
14
use std::sync::Arc;
14
15
@@ -24,10 +25,12 @@ use tracing::{debug, info, warn};
24
25
/// Default interval: review memory every N user turns.
25
26
pubconstDEFAULT_MEMORY_REVIEW_INTERVAL:u32 = 5;
26
27
28
+
/// Default interval: review skills every N tool iterations in a single reply.
29
+
pubconstDEFAULT_SKILL_REVIEW_ITERATIONS:u32 = 10;
30
+
27
31
/// Maximum tool calls the review agent can make per review.
28
32
constMAX_REVIEW_TOOL_CALLS:usize = 8;
29
33
30
-
/// The prompt injected for background memory review.
31
34
constMEMORY_REVIEW_PROMPT:&str = r#"Review the conversation above and extract any durable facts worth saving to persistent memory. Focus on:
32
35
33
36
1. User identity/preferences: name, role, timezone, coding style, communication preferences, pet peeves
@@ -49,10 +52,26 @@ Rules:
49
52
50
53
Make your memory tool calls now."#;
51
54
52
-
/// The prompt injected for pre-compression flush.
55
+
constSKILL_REVIEW_PROMPT:&str = r#"Review the conversation above and consider saving or updating a skill if appropriate.
56
+
57
+
Focus on: was a non-trivial approach used to complete a task that required trial and error, or changing course due to experiential findings along the way, or did the user expect or desire a different method or outcome?
58
+
59
+
If a relevant skill already exists, update it with what you learned.
60
+
Otherwise, create a new skill if the approach is reusable.
61
+
If nothing is worth saving, just say "Nothing to save." and stop."#;
62
+
63
+
constCOMBINED_REVIEW_PROMPT:&str = r#"Review the conversation above and consider two things:
64
+
65
+
**Memory**: Has the user revealed things about themselves — their persona, desires, preferences, or personal details? Has the user expressed expectations about how you should behave, their work style, or ways they want you to operate? If so, save using the memory tool.
66
+
67
+
**Skills**: Was a non-trivial approach used to complete a task that required trial and error, or changing course due to experiential findings along the way, or did the user expect or desire a different method or outcome? If a relevant skill already exists, update it. Otherwise, create a new one if the approach is reusable.
68
+
69
+
Only act if there's something genuinely worth saving.
70
+
If nothing stands out, just say "Nothing to save." and stop."#;
71
+
53
72
constFLUSH_PROMPT:&str = "[System: The session context is being compressed. Save anything worth remembering permanently — prioritize user preferences, corrections, environment facts, and recurring patterns over task-specific details. This is your last chance before earlier conversation turns are summarized away.]";
54
73
55
-
/// Spawn a background task to review the conversation for memory-worthy facts.
74
+
/// Spawn a background task to review the conversation for memory and/or skill saves.
56
75
///
57
76
/// Runs AFTER the reply is delivered. The user never sees this.
0 commit comments