#!/usr/bin/env python3 """ Inbox processor - shows pending items and helps sort them. """ import os from pathlib import Path from datetime import datetime WORKSPACE = Path("/home/wdjones/.openclaw/workspace") INBOX = WORKSPACE / "inbox" def list_inbox(): """List all items in inbox.""" items = [] for fpath in INBOX.iterdir(): if fpath.is_file() and not fpath.name.startswith('.'): stat = fpath.stat() items.append({ 'name': fpath.name, 'path': fpath, 'size': stat.st_size, 'modified': datetime.fromtimestamp(stat.st_mtime) }) return sorted(items, key=lambda x: x['modified'], reverse=True) def show_inbox(): """Display inbox contents.""" items = list_inbox() if not items: print("📭 Inbox is empty") return print(f"📬 Inbox ({len(items)} items)\n") for item in items: age = datetime.now() - item['modified'] if age.days > 0: age_str = f"{age.days}d ago" elif age.seconds > 3600: age_str = f"{age.seconds // 3600}h ago" else: age_str = f"{age.seconds // 60}m ago" print(f" [{age_str}] {item['name']} ({item['size']} bytes)") # Show quick-notes if exists quick_notes = INBOX / "quick-notes.md" if quick_notes.exists(): print("\n--- Quick Notes ---") with open(quick_notes) as f: content = f.read().strip() if content: print(content) else: print("(empty)") if __name__ == "__main__": show_inbox()