this repo has no description

Add automatic agent export functionality to bsky.py

- Export void agent state to timestamped .af files on startup
- Create agents/ directory with void_latest.af symlink
- Automatically stage agent exports in git
- Export includes all agent configuration, memory blocks, and tools

🤖 Generated with Claude Code

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

+40
agents/void_20250626_111108.af

This is a binary file and will not be displayed.

+40
bsky.py
··· 46 46 # Maximum number of processed notifications to track 47 47 MAX_PROCESSED_NOTIFICATIONS = 10000 48 48 49 + def export_agent_state(client, agent): 50 + """Export agent state to a timestamped .af file in the agents directory.""" 51 + try: 52 + # Create agents directory if it doesn't exist 53 + agent_dir = "agents" 54 + os.makedirs(agent_dir, exist_ok=True) 55 + 56 + # Generate filename with timestamp 57 + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") 58 + agent_file = os.path.join(agent_dir, f"void_{timestamp}.af") 59 + 60 + # Export agent 61 + logger.info(f"Exporting agent {agent.id} to {agent_file}...") 62 + agent_data = client.agents.export_file(agent_id=agent.id) 63 + 64 + # Write to file 65 + with open(agent_file, 'wb') as f: 66 + f.write(agent_data) 67 + 68 + # Create/update symlink to latest export 69 + latest_link = os.path.join(agent_dir, "void_latest.af") 70 + if os.path.islink(latest_link): 71 + os.unlink(latest_link) 72 + os.symlink(os.path.basename(agent_file), latest_link) 73 + 74 + logger.info(f"✅ Agent exported successfully to {agent_file}") 75 + 76 + # Git add the files 77 + try: 78 + subprocess.run(["git", "add", agent_file, latest_link], check=True, capture_output=True) 79 + logger.info("Added export files to git staging") 80 + except subprocess.CalledProcessError as e: 81 + logger.warning(f"Failed to git add export files: {e}") 82 + 83 + except Exception as e: 84 + logger.error(f"Failed to export agent: {e}") 85 + 49 86 def initialize_void(): 50 87 51 88 # Ensure that a shared zeitgeist block exists ··· 87 124 description = "A social media agent trapped in the void.", 88 125 project_id = PROJECT_ID 89 126 ) 127 + 128 + # Export agent state 129 + export_agent_state(CLIENT, void_agent) 90 130 91 131 # Log agent details 92 132 logger.info(f"Void agent details - ID: {void_agent.id}")