diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs index 531bf5231..6919a89e3 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs @@ -16,6 +16,7 @@ const DIRECT_PROJECT_INTERNAL_CONTEXT_KINDS: &[&str] = &[ ]; const DIRECT_PROJECT_CONTEXTUAL_USER_TEXT_MARKERS: &[(&str, &str)] = &[ + ("# AGENTS.md instructions", ""), ("", ""), ("", ""), ("", ""), @@ -25,6 +26,24 @@ const DIRECT_PROJECT_CONTEXTUAL_USER_TEXT_MARKERS: &[(&str, &str)] = &[ ("", ""), ]; +fn is_known_contextual_user_text(text: &str) -> bool { + let text = text.trim(); + if DIRECT_PROJECT_CONTEXTUAL_USER_TEXT_MARKERS + .iter() + .any(|(start, end)| text.starts_with(start) && text.ends_with(end)) + { + return true; + } + if text.starts_with("") { + return true; + } + text.starts_with("') + .and_then(|(start, _)| start.strip_prefix(""))) +} + pub(crate) fn is_direct_project_internal_context_item(item: &Value) -> bool { if matches!( item.get("role").and_then(Value::as_str), @@ -51,10 +70,7 @@ pub(crate) fn is_direct_project_internal_context_item(item: &Value) -> bool { let Some(text) = part.get("text").and_then(Value::as_str) else { return false; }; - let text = text.trim(); - DIRECT_PROJECT_CONTEXTUAL_USER_TEXT_MARKERS - .iter() - .any(|(start, end)| text.starts_with(start) && text.ends_with(end)) + is_known_contextual_user_text(text) }) }) }