a digital entity named phi that roams bsky

fix: clearly label thread context vs episodic memory

- thread context is CURRENT THREAD (SQLite) - what user is asking about
- memory context is PAST CONVERSATIONS (TurboPuffer) - background only
- this prevents semantic search from returning previous thread and confusing the agent
- fixes issue where phi answered about wrong thread

+6 -4
+6 -4
src/bot/agent.py
··· 93 except Exception as e: 94 logger.warning(f"Failed to retrieve memories: {e}") 95 96 - # Build full prompt with all context 97 prompt_parts = [] 98 99 if thread_context and thread_context != "No previous messages in this thread.": 100 - prompt_parts.append(thread_context) 101 102 if memory_context: 103 - prompt_parts.append(memory_context) 104 105 - prompt_parts.append(f"\nNew message from @{author_handle}: {mention_text}") 106 prompt = "\n\n".join(prompt_parts) 107 108 # Run agent with MCP tools available
··· 93 except Exception as e: 94 logger.warning(f"Failed to retrieve memories: {e}") 95 96 + # Build full prompt with clearly labeled context sections 97 prompt_parts = [] 98 99 + # Thread context is the CURRENT conversation - this is what the user is asking about 100 if thread_context and thread_context != "No previous messages in this thread.": 101 + prompt_parts.append(f"[CURRENT THREAD - these are the messages in THIS thread]:\n{thread_context}") 102 103 + # Memory context is PAST conversations - for background/relationship context only 104 if memory_context: 105 + prompt_parts.append(f"[PAST CONVERSATIONS WITH @{author_handle} - for background context only]:\n{memory_context}") 106 107 + prompt_parts.append(f"\n[NEW MESSAGE]:\n@{author_handle}: {mention_text}") 108 prompt = "\n\n".join(prompt_parts) 109 110 # Run agent with MCP tools available