huskies: merge 1033

This commit is contained in:
dave
2026-05-14 13:08:43 +00:00
parent 72d79deec9
commit c353c0a6be
3 changed files with 62 additions and 1 deletions
@@ -30,6 +30,30 @@ pub(in crate::chat::transport::matrix::bot) async fn handle_message(
guard.get(&room_id).and_then(|conv| conv.session_id.clone())
};
// Drain any pipeline transition events buffered since the last LLM turn and
// prepend them as a passive <system-reminder> block so Timmy sees pipeline
// activity without requiring a separate message. Capped at 20 lines to
// keep context size bounded.
const MAX_PIPELINE_EVENTS: usize = 20;
let system_reminder_prefix = {
let mut guard = ctx.pending_pipeline_events.lock().await;
if guard.is_empty() {
String::new()
} else {
let total = guard.len();
let lines: Vec<String> = guard.drain(..).collect();
drop(guard);
let shown_count = total.min(MAX_PIPELINE_EVENTS);
let shown = lines[..shown_count].join("\n");
let tail = if total > MAX_PIPELINE_EVENTS {
format!("\n...and {} more", total - MAX_PIPELINE_EVENTS)
} else {
String::new()
};
format!("<system-reminder>\n{shown}{tail}\n</system-reminder>\n")
}
};
// The prompt is just the current message with sender attribution.
// Prior conversation context is carried by the Claude Code session.
let bot_name = &ctx.services.bot_name;
@@ -40,7 +64,7 @@ pub(in crate::chat::transport::matrix::bot) async fn handle_message(
String::new()
};
let prompt = format!(
"[Your name is {bot_name}. Refer to yourself as {bot_name}, not Claude.]\n{active_project_ctx}\n{}",
"{system_reminder_prefix}[Your name is {bot_name}. Refer to yourself as {bot_name}, not Claude.]\n{active_project_ctx}\n{}",
format_user_prompt(&sender, &user_message)
);