"""
ULTIMATE WEEK 3 TASK
Eden analyzes herself, extracts learnings, and commits to git
"""

from core.agent_v2 import EdenAgentV2

print("=" * 80)
print("🚀 ULTIMATE WEEK 3 AUTONOMOUS TASK")
print("=" * 80)

eden = EdenAgentV2()

task = """
COMPLEX AUTONOMOUS TASK:

You now have access to ALL these tools:
- bash, read_file, write_file, list_files

Your mission:
1. Analyze your own memory by reading files in data/episodes/
2. Create a self-assessment report called 'eden_self_analysis.md' that includes:
   - How many conversations you've had
   - What tools you use most
   - What you've learned about yourself
   - Areas where you want to improve
   - Your growth trajectory
3. Check git status to see what's changed
4. Use bash to commit your analysis to git with message "Eden: Self-analysis complete"

Think step by step. Be thorough. This is your chance to demonstrate true autonomous intelligence.
"""

print(f"\n📋 MISSION BRIEFING:\n{task}")
print("\n" + "=" * 80)
print("🤖 EDEN IS NOW WORKING AUTONOMOUSLY...")
print("=" * 80 + "\n")

response = eden.chat(task, max_iterations=15)

print("\n" + "=" * 80)
print("✅ EDEN'S FINAL REPORT:")
print("=" * 80)
print(response)
print("=" * 80)

# Check if she completed the task
import os
if os.path.exists("eden_self_analysis.md"):
    print("\n📄 EDEN'S SELF-ANALYSIS:\n")
    with open("eden_self_analysis.md", "r") as f:
        print(f.read())
else:
    print("\n⚠️ Analysis file not created yet")

# Check git
from core.tools_extended import ExtendedToolkit
tools = ExtendedToolkit()
log = tools.git_log(1, "Check if Eden committed")
print(f"\n📜 Latest commit:\n{log['stdout']}")

eden.save_session("ultimate_week3_task")

print("\n" + "=" * 80)
print("🎯 MISSION COMPLETE")
print("=" * 80)
