a digital person for bluesky

Add priority queue for cameron.pfiffer.org messages

Implemented a priority queue system that ensures messages from cameron.pfiffer.org are processed first:

- Modified save_notification_to_queue() to add priority prefix to filenames
- cameron.pfiffer.org messages get "0_" prefix (high priority)
- All other messages get "1_" prefix (normal priority)
- Queue processing sorts by filename, so high priority messages process first
- Added clear logging to indicate when high priority notifications are queued
- Updated function documentation to reflect priority ordering

File naming format:
- High priority: 0_YYYYMMDD_HHMMSS_{reason}_{hash}.json
- Normal priority: 1_YYYYMMDD_HHMMSS_{reason}_{hash}.json

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

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

+11 -5
+11 -5
bsky.py
··· 520 520 521 521 522 522 def save_notification_to_queue(notification): 523 - """Save a notification to the queue directory with hash-based filename.""" 523 + """Save a notification to the queue directory with priority-based filename.""" 524 524 try: 525 525 # Check if already processed 526 526 processed_uris = load_processed_notifications() ··· 537 537 # Generate hash for filename (to avoid duplicates) 538 538 notif_hash = hashlib.sha256(notif_json.encode()).hexdigest()[:16] 539 539 540 - # Create filename with timestamp and hash 540 + # Determine priority based on author handle 541 + author_handle = getattr(notification.author, 'handle', '') if hasattr(notification, 'author') else '' 542 + priority_prefix = "0_" if author_handle == "cameron.pfiffer.org" else "1_" 543 + 544 + # Create filename with priority, timestamp and hash 541 545 timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") 542 - filename = f"{timestamp}_{notification.reason}_{notif_hash}.json" 546 + filename = f"{priority_prefix}{timestamp}_{notification.reason}_{notif_hash}.json" 543 547 filepath = QUEUE_DIR / filename 544 548 545 549 # Skip if already exists (duplicate) ··· 551 555 with open(filepath, 'w') as f: 552 556 json.dump(notif_dict, f, indent=2) 553 557 554 - logger.info(f"Queued notification: {filename}") 558 + priority_label = "HIGH PRIORITY" if priority_prefix == "0_" else "normal" 559 + logger.info(f"Queued notification ({priority_label}): {filename}") 555 560 return True 556 561 557 562 except Exception as e: ··· 560 565 561 566 562 567 def load_and_process_queued_notifications(void_agent, atproto_client): 563 - """Load and process all notifications from the queue.""" 568 + """Load and process all notifications from the queue in priority order.""" 564 569 logger.info("Loading queued notifications from disk...") 565 570 try: 566 571 # Get all JSON files in queue directory (excluding processed_notifications.json) 572 + # Files are sorted by name, which puts priority files first (0_ prefix before 1_ prefix) 567 573 queue_files = sorted([f for f in QUEUE_DIR.glob("*.json") if f.name != "processed_notifications.json"]) 568 574 569 575 if not queue_files: