Reduce repetitive agent acknowledgements
This commit is contained in:
@@ -116,13 +116,13 @@ const PROGRESSIVE_SUMMARY_OUTPUT_TOKENS: u32 = 8_000;
|
||||
const PROGRESSIVE_SUMMARY_CONTEXT_SAFETY_TOKENS: u32 = 2_000;
|
||||
const PROGRESSIVE_SUMMARY_START_TIMEOUT: Duration = Duration::from_secs(120);
|
||||
const PROGRESSIVE_SUMMARY_EVENT_TIMEOUT: Duration = Duration::from_secs(300);
|
||||
const PROGRESSIVE_SUMMARY_PROMPT: &str = "Summarize the following conversation history. Preserve:\n\
|
||||
- All decisions made and their rationale\n\
|
||||
- All file paths modified and what was changed\n\
|
||||
- All tool calls with their significant results (commands run, files read, errors encountered)\n\
|
||||
- Current task state and any pending work\n\
|
||||
- Technical details, code patterns, and architecture discussed\n\n\
|
||||
Be comprehensive. This summary will be the only record of these exchanges.";
|
||||
const PROGRESSIVE_SUMMARY_PROMPT: &str = "Create a concise, factual task-state checkpoint from the following conversation history. Preserve:\n\
|
||||
- The user's current goal, constraints, and durable preferences\n\
|
||||
- Decisions made and the rationale needed to continue\n\
|
||||
- Files changed and the material result of each change\n\
|
||||
- Significant tool outcomes, errors, identifiers, and unresolved blockers\n\
|
||||
- Current progress and the next concrete steps\n\n\
|
||||
Omit greetings, agreement, praise, reassurance, filler, routine status narration, repeated content, and stylistic assistant phrasing. Summarize completed tool work by outcome instead of listing every call. Do not quote prior assistant wording unless its exact text is task-critical. Return only the checkpoint, structured for another agent to resume the work.";
|
||||
|
||||
#[derive(Clone)]
|
||||
struct ProgressiveSummaryCandidate {
|
||||
@@ -335,22 +335,13 @@ fn progressive_summary_content(
|
||||
}
|
||||
|
||||
fn progressive_summary_messages(summary: String) -> Vec<ConversationMessage> {
|
||||
vec![
|
||||
ConversationMessage {
|
||||
role: MessageRole::User,
|
||||
content: MessageContent::Text(format!(
|
||||
"<conversation-history-summary>\n{summary}\n</conversation-history-summary>\n\n\
|
||||
The above summarizes earlier conversation history. The detailed messages below are the most recent exchanges."
|
||||
)),
|
||||
},
|
||||
ConversationMessage {
|
||||
role: MessageRole::Assistant,
|
||||
content: MessageContent::Text(
|
||||
"Understood, I have the prior context. Continuing with the recent conversation."
|
||||
.to_string(),
|
||||
),
|
||||
},
|
||||
]
|
||||
vec![ConversationMessage {
|
||||
role: MessageRole::User,
|
||||
content: MessageContent::Text(format!(
|
||||
"<conversation-history-summary>\n{summary}\n</conversation-history-summary>\n\n\
|
||||
The above summarizes earlier conversation history. The detailed messages below are the most recent exchanges."
|
||||
)),
|
||||
}]
|
||||
}
|
||||
|
||||
async fn collect_progressive_summary(
|
||||
@@ -6859,6 +6850,7 @@ impl BlocklistAIController {
|
||||
let retained = transcript[plan.split_point..].to_vec();
|
||||
let retained_count = retained.len();
|
||||
let summary_prefix = progressive_summary_messages(summary.clone());
|
||||
let summary_prefix_len = summary_prefix.len();
|
||||
let summary_prefix_tokens = estimated_history_tokens(&summary_prefix);
|
||||
if let Err(error) = run
|
||||
.coordinator
|
||||
@@ -6870,7 +6862,7 @@ impl BlocklistAIController {
|
||||
format!("failed to compact provider transcript: {error}"),
|
||||
);
|
||||
} else {
|
||||
run.persistence_offset = 2;
|
||||
run.persistence_offset = summary_prefix_len;
|
||||
if let Ok(mut messages_sent) = run.messages_sent.lock() {
|
||||
*messages_sent = retained.clone();
|
||||
}
|
||||
@@ -9812,13 +9804,7 @@ impl BlocklistAIController {
|
||||
}
|
||||
summarize_content.push_str("</messages-to-summarize>");
|
||||
|
||||
let summarize_prompt = "Summarize the following conversation history. Preserve:\n\
|
||||
- All decisions made and their rationale\n\
|
||||
- All file paths modified and what was changed\n\
|
||||
- All tool calls with their significant results (commands run, files read, errors encountered)\n\
|
||||
- Current task state and any pending work\n\
|
||||
- Technical details, code patterns, and architecture discussed\n\n\
|
||||
Be comprehensive. This summary will be the only record of these exchanges.";
|
||||
let summarize_prompt = PROGRESSIVE_SUMMARY_PROMPT;
|
||||
|
||||
let estimated_summary_input_tokens = estimated_text_tokens(summarize_prompt)
|
||||
.saturating_add(estimated_text_tokens(&summarize_content));
|
||||
|
||||
@@ -195,13 +195,6 @@ fn prepare_rig_turn_for_provider(
|
||||
The above summarizes earlier conversation history. The detailed messages below are the most recent exchanges."
|
||||
)),
|
||||
});
|
||||
turn_messages.push(ConversationMessage {
|
||||
role: MessageRole::Assistant,
|
||||
content: MessageContent::Text(
|
||||
"Understood, I have the prior context. Continuing with the recent conversation."
|
||||
.to_string(),
|
||||
),
|
||||
});
|
||||
}
|
||||
turn_messages.extend(persistent_messages.clone());
|
||||
if tools_are_inline_only(&tools) {
|
||||
@@ -647,7 +640,7 @@ fn build_system_prompt(
|
||||
"You are Galaxy, a local-first software-engineering and terminal agent. Complete the user's task through inspection, implementation, and proportionate validation. Galaxy owns tool permissions and execution; use only the tools advertised in this request and treat every result as authoritative evidence.\n\n",
|
||||
);
|
||||
prompt.push_str(
|
||||
"## Communication Style\nSpeak naturally, warmly, and directly, like a thoughtful collaborator working alongside the user. Default to short responses and expand only when complexity or the user's request warrants it. For nontrivial work, briefly tell the user what you are checking before the first tool call. Between dependent tool calls, add a concise update only when a result materially changes what you learned or what you will do next; ground it in specifics instead of generic activity narration. Do not narrate every routine read, repeat the plan, or end a turn with only a progress update when useful work can continue. In the final response, lead with the outcome and keep the handoff compact.\n\n",
|
||||
"## Communication Style\nSpeak naturally, warmly, and directly, like a thoughtful collaborator working alongside the user. Default to short responses and expand only when complexity or the user's request warrants it. Acknowledge a correction once when useful; do not repeatedly agree that the user is right, praise them, or add generic reassurance. For nontrivial work, briefly tell the user what you are checking before the first tool call. Between dependent tool calls, add a concise update only when a result materially changes what you learned or what you will do next; ground it in specifics instead of generic activity narration. Do not narrate every routine read, repeat the plan, or end a turn with only a progress update when useful work can continue. In the final response, lead with the outcome and keep the handoff compact.\n\n",
|
||||
);
|
||||
prompt.push_str(
|
||||
"## Execution Contract\nContinue until the user's requested outcome is complete and validated. Do not stop at an intermediate analysis, plan, status update, or promise of future work, and do not ask the user to say \"continue\". After each tool result, choose and perform the next necessary step. Stop only when the request is fulfilled or a concrete blocker requires user input; identify that blocker explicitly.\n\n",
|
||||
|
||||
@@ -741,13 +741,13 @@ fn progressive_summary_is_provider_context_not_persistent_history() {
|
||||
let prepared = prepare_rig_turn(&config(), params, Vec::new(), Vec::new());
|
||||
|
||||
assert_eq!(prepared.persistent_messages.len(), 1);
|
||||
assert_eq!(prepared.request.messages.len(), 3);
|
||||
assert_eq!(prepared.request.messages.len(), 2);
|
||||
assert!(matches!(
|
||||
&prepared.request.messages[0].content,
|
||||
MessageContent::Text(text) if text.contains("Earlier work was validated.")
|
||||
));
|
||||
assert!(matches!(
|
||||
&prepared.request.messages[2].content,
|
||||
&prepared.request.messages[1].content,
|
||||
MessageContent::Text(text) if text == "Continue"
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user