a digital person for bluesky

Fix X bot synthesis functionality with custom implementation

- Replace import of send_synthesis_message from bsky.py with custom send_x_synthesis_message function
- Create X-specific synthesis prompt focusing on X/Twitter platform experiences
- Use simplified Letta client message creation instead of streaming for X synthesis
- Remove dependency on atproto_client and bsky context that was causing 'NoneType' errors
- Add proper error handling in X synthesis function

X bot synthesis now works independently without bsky.py dependencies.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+41 -4
+41 -4
x.py
··· 2054 2054 2055 2055 return void_agent 2056 2056 2057 + def send_x_synthesis_message(letta_client, agent_id): 2058 + """ 2059 + Send a simple synthesis message to the X agent. 2060 + Simplified version for X bot without atproto dependencies. 2061 + """ 2062 + try: 2063 + from datetime import date 2064 + today = date.today() 2065 + 2066 + synthesis_prompt = f"""Time for synthesis and reflection on your X (Twitter) experiences. 2067 + 2068 + Today's date: {today.strftime('%B %d, %Y')} 2069 + 2070 + Please reflect on: 2071 + 1. Recent X interactions and conversations you've had 2072 + 2. Patterns you've observed in X discussions 2073 + 3. Your evolving understanding of the X platform dynamics 2074 + 4. Notable exchanges or insights from X users 2075 + 5. How your presence on X is developing 2076 + 2077 + Use your memory tools to record significant insights and observations.""" 2078 + 2079 + logger.info("🧠 Sending X synthesis message to agent") 2080 + 2081 + # Send simple synthesis message 2082 + response = letta_client.agents.messages.create( 2083 + agent_id=agent_id, 2084 + messages=[{"role": "user", "content": synthesis_prompt}], 2085 + max_steps=50 2086 + ) 2087 + 2088 + logger.info("✅ X synthesis message completed successfully") 2089 + return True 2090 + 2091 + except Exception as e: 2092 + logger.error(f"Error sending X synthesis message: {e}") 2093 + return False 2094 + 2057 2095 def x_main_loop(testing_mode=False, cleanup_interval=10, synthesis_interval=600, synthesis_only=False): 2058 2096 """ 2059 2097 Main X bot loop that continuously monitors for mentions and processes them. ··· 2069 2107 from time import sleep 2070 2108 from config_loader import get_letta_config 2071 2109 from letta_client import Letta 2072 - from bsky import send_synthesis_message 2110 + # We'll create our own X synthesis function instead 2073 2111 2074 2112 logger.info("=== STARTING X VOID BOT ===") 2075 2113 ··· 2116 2154 try: 2117 2155 # Send synthesis message immediately on first run 2118 2156 logger.info("🧠 Sending X synthesis message") 2119 - # No atproto_client for X bot, just pass None 2120 - send_synthesis_message(letta_client, void_agent.id, atproto_client=None) 2157 + send_x_synthesis_message(letta_client, void_agent.id) 2121 2158 2122 2159 # Wait for next interval 2123 2160 logger.info(f"Waiting {synthesis_interval} seconds until next synthesis...") ··· 2153 2190 current_time = time.time() 2154 2191 if current_time - last_synthesis_time >= synthesis_interval: 2155 2192 logger.info(f"⏰ {synthesis_interval/60:.1f} minutes have passed, triggering X synthesis") 2156 - send_synthesis_message(letta_client, void_agent.id, atproto_client=None) 2193 + send_x_synthesis_message(letta_client, void_agent.id) 2157 2194 last_synthesis_time = current_time 2158 2195 2159 2196 # Log cycle completion