huskies: merge 1125 story LLM session entity + assemble_prompt_context helper, wired into Matrix bot

This commit is contained in:
dave
2026-05-17 20:04:42 +00:00
parent ecd3f600d9
commit badd522d60
11 changed files with 454 additions and 14 deletions
@@ -54,6 +54,11 @@ pub(in crate::chat::transport::matrix::bot) async fn handle_message(
prefix
};
// Pull new pipeline-transition events from the CRDT event log for this
// session and atomically advance the high-water marks so the same events
// are not re-injected on the next turn.
let event_log_ctx = crate::llm_session::assemble_prompt_context(&room_id_str);
// 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;
@@ -64,7 +69,7 @@ pub(in crate::chat::transport::matrix::bot) async fn handle_message(
String::new()
};
let prompt = format!(
"{system_reminder_prefix}[Your name is {bot_name}. Refer to yourself as {bot_name}, not Claude.]\n{active_project_ctx}\n{}",
"{system_reminder_prefix}{event_log_ctx}[Your name is {bot_name}. Refer to yourself as {bot_name}, not Claude.]\n{active_project_ctx}\n{}",
format_user_prompt(&sender, &user_message)
);