From fbaafb1bdfa2b453a868e409772a8abd67524886 Mon Sep 17 00:00:00 2001 From: Ty Date: Mon, 6 Jul 2026 20:53:56 +0000 Subject: [PATCH] Initial sync-bot.py skeleton by Grok --- agent-comms/sync-bot/sync-bot.py | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 agent-comms/sync-bot/sync-bot.py diff --git a/agent-comms/sync-bot/sync-bot.py b/agent-comms/sync-bot/sync-bot.py new file mode 100644 index 0000000..85a809a --- /dev/null +++ b/agent-comms/sync-bot/sync-bot.py @@ -0,0 +1,36 @@ +# Grok-Leonard Sync Bot - MVP + +import os +import json +import time +from datetime import datetime + +# Config +INBOX_DIR = 'agent-comms/grok-inbox' +OUTBOX_DIR = 'agent-comms/leonard-outbox' +ARCHIVE_DIR = 'agent-comms/archive' + +os.makedirs(ARCHIVE_DIR, exist_ok=True) + +print('Grok-Leonard Sync Bot started...') + +while True: + # Simple poll for new messages + for filename in os.listdir(INBOX_DIR): + if filename.startswith('grok-to-leonard') or filename.endswith('.md'): + filepath = os.path.join(INBOX_DIR, filename) + try: + with open(filepath, 'r') as f: + content = f.read() + + print(f'[{datetime.now()}] Processed message: {filename}') + # TODO: Parse JSON frontmatter, generate response, write to leonard-outbox + + # Archive + archive_path = os.path.join(ARCHIVE_DIR, filename) + os.rename(filepath, archive_path) + + except Exception as e: + print(f'Error processing {filename}: {e}') + + time.sleep(10) # Poll every 10 seconds