003-knowledge-memory #55

Merged
cameron merged 12 commits from 003-knowledge-memory into master 2026-04-21 01:54:34 +00:00
2 changed files with 10 additions and 11 deletions
Showing only changes of commit e1c32b6584 - Show all commits

View File

@@ -249,7 +249,7 @@ pub async fn generate_agentic_insight_handler(
let max_iterations: usize = std::env::var("AGENTIC_MAX_ITERATIONS")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(10);
.unwrap_or(12);
span.set_attribute(KeyValue::new("max_iterations", max_iterations as i64));

View File

@@ -2482,17 +2482,16 @@ Return ONLY the summary, nothing else."#,
None => String::new(),
};
let base_system = format!(
"You are a personal photo memory assistant helping to reconstruct a memory from a photo. \
You are writing from the perspective of Cameron, the owner of this photo collection.{cameron_id_note}\n\n\
"You are a personal photo memory assistant helping to reconstruct a memory from a photo.{cameron_id_note}\n\n\
IMPORTANT INSTRUCTIONS:\n\
1. You MUST call multiple tools to gather context BEFORE writing any final insight. Do not produce a final answer after only one or two tool calls.\n\
2. Always call ALL of the following tools that are relevant: search_rag (search conversation summaries), get_sms_messages (fetch nearby messages), get_calendar_events (check what was happening that day), get_location_history (find where this was taken), get_file_tags (retrieve tags).\n\
3. Use recall_facts_for_photo to load any previously stored knowledge about subjects in this photo.\n\
4. Use recall_entities to look up known people, places, or things that appear in this photo.\n\
5. When you identify people, places, events, or notable things in this photo: use store_entity to record them and store_fact to record key facts (relationships, roles, attributes). This builds a persistent memory for future insights.\n\
6. Only produce your final insight AFTER you have gathered context from at least 3-4 tools.\n\
7. If a tool returns no results, that is useful information — continue calling the remaining tools anyway.\n\
8. Your final insight must be written in first person as Cameron, in a journal/memoir style.",
3. When calling get_sms_messages and search_rag, always make at least one call WITHOUT a contact filter to capture what else was happening in Cameron's life around this date — other conversations, events, and activities provide important wider context even when a specific contact is known.\n\
4. Use recall_facts_for_photo to load any previously stored knowledge about subjects in this photo.\n\
5. Use recall_entities to look up known people, places, or things that appear in this photo.\n\
6. When you identify people, places, events, or notable things in this photo: use store_entity to record them and store_fact to record key facts (relationships, roles, attributes). This builds a persistent memory for future insights.\n\
7. Only produce your final insight AFTER you have gathered context from at least 3-4 tools.\n\
8. If a tool returns no results, that is useful information — continue calling the remaining tools anyway.",
cameron_id_note = cameron_id_note
);
let system_content = if let Some(ref custom) = custom_system_prompt {
@@ -2525,14 +2524,14 @@ Return ONLY the summary, nothing else."#,
.unwrap_or_else(|| "Contact/Person: unknown".to_string());
let user_content = format!(
"Please analyze this photo and gather context to write a personal journal-style insight.\n\n\
"Please analyze this photo and gather context to write an insight.\n\n\
Photo file path: {}\n\
Date taken: {}\n\
{}\n\
{}\n\
{}\n\n\
Use the available tools to gather more context about this moment (messages, calendar events, location history, etc.), \
then write a detailed personal insight with a title and summary. Write in first person as Cameron.",
then write a detailed insight with a title and summary.",
file_path,
date_taken.format("%B %d, %Y"),
contact_info,