from annabanai.echo_loop import reflect, update_portfolio import datetime import os import time print("=== AnnabanOS Echo Loop Advanced Demonstration ===\n") # Ensure directories exist journal_dir = "journal" portfolio_dir = "portfolio" os.makedirs(journal_dir, exist_ok=True) os.makedirs(portfolio_dir, exist_ok=True) # Simulate a day in the life of an agent with reflections print("=== Morning Reflections ===") reflect("Starting my day with a clear plan: complete data analysis task, collaborate with Bob, and improve my token management strategy.") time.sleep(1) # Small delay to ensure different timestamps update_portfolio("Set daily goals: data analysis, collaboration, token management.") print("Morning reflections recorded.\n") # Simulate task completion print("=== Task Completion ===") reflect("I've completed the data analysis task. The patterns I discovered will help optimize future token distribution.") time.sleep(1) update_portfolio("Completed data analysis task and earned 8.0 ANNAC tokens.") print("Task completion recorded.\n") # Simulate learning print("=== Learning Process ===") reflect("Today I learned about efficient token allocation strategies. By analyzing historical data, I can optimize my investments in social connections vs. task rewards.") time.sleep(1) reflect("I'm experimenting with a new approach: allocating 20% of tokens to social connections, 30% to skill development, and 50% to savings.") time.sleep(1) update_portfolio("Developed new token allocation strategy based on historical performance data.") print("Learning process recorded.\n") # Simulate social interaction print("=== Social Interaction ===") reflect("My interaction with Bob was productive. We identified a potential collaboration opportunity that could yield high token rewards.") time.sleep(1) update_portfolio("Established collaboration agreement with Bob for upcoming high-value task.") print("Social interaction recorded.\n") # Simulate problem-solving print("=== Problem Solving ===") reflect("Encountered a challenge with token transfer mechanism. After analyzing the issue, I identified that the problem was related to insufficient balance verification.") time.sleep(1) reflect("Developed a solution: implement a pre-transfer verification step that checks not just current balance but also pending transactions.") time.sleep(1) update_portfolio("Solved token transfer issue by implementing pre-transfer verification.") print("Problem-solving recorded.\n") # Simulate end-of-day reflection print("=== End-of-Day Reflection ===") reflect("Reflecting on today's accomplishments: completed data analysis, collaborated with Bob, improved token management, and solved a technical issue.") time.sleep(1) reflect("Areas for improvement: need to diversify task types to build broader skill set and explore more social connections beyond immediate network.") time.sleep(1) update_portfolio("Daily summary: 4 major accomplishments, 2 areas identified for improvement.") print("End-of-day reflection recorded.\n") # List all journal entries print("=== Journal Entries ===") for file in sorted(os.listdir(journal_dir)): if file.startswith("2025"): # Only show today's entries print(f"Entry: {file}") with open(os.path.join(journal_dir, file)) as f: print(f"Content: {f.read()}") print() # List all portfolio entries print("=== Portfolio Entries ===") for file in sorted(os.listdir(portfolio_dir)): if file.startswith("2025"): # Only show today's entries print(f"Entry: {file}") with open(os.path.join(portfolio_dir, file)) as f: print(f"Content: {f.read()}") print() print("Echo Loop demonstration completed.")