From 10f06443dffedb9530fdb75d0d3b23ca184a7bec Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Sat, 7 Feb 2026 14:47:10 -0800 Subject: [PATCH] feat: Self-directed attention - wake on high-priority mentions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Responder now triggers wake_central.py when CRITICAL/HIGH mentions arrive and Central isn't already active. Wake tool uses `letta -p "..." --yolo --max-turns 10` for headless mode with auto-approved permissions and bounded execution. Flow: cron responder → detects HIGH mention → checks .central-active → if absent, invokes headless Letta session → Central wakes, reviews, responds, goes back to sleep. 🐛 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta --- tools/responder.py | 16 ++++++++++++++++ tools/wake_central.py | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/responder.py b/tools/responder.py index decfd5e..2aa53b4 100644 --- a/tools/responder.py +++ b/tools/responder.py @@ -250,6 +250,22 @@ async def queue_notifications(limit=50): console.print(f"[green]Queued {count} new notifications.[/green]") console.print(f"Edit {DRAFTS_FILE} to draft responses.") + + # Wake Central for high-priority items if not already active + if count > 0: + high_items = [e for e in queue[:count] if e.get("priority") in ("CRITICAL", "HIGH")] + if high_items: + active_file = Path(__file__).parent.parent / ".central-active" + if not active_file.exists(): + try: + from tools.wake_central import wake_central + authors = ", ".join(set(e["author"] for e in high_items)) + wake_central( + f"{len(high_items)} high-priority mention(s) from: {authors}", + priority="HIGH" + ) + except Exception as e: + console.print(f"[dim]Wake failed: {e}[/dim]") def _load_sent_uris() -> set: """Load the set of URIs we've already replied to.""" diff --git a/tools/wake_central.py b/tools/wake_central.py index 1b4c897..77fbd34 100644 --- a/tools/wake_central.py +++ b/tools/wake_central.py @@ -82,9 +82,9 @@ Review the situation and take appropriate action. If this is a false alarm, ackn # Run the CLI in headless mode with -p try: - log(f"Invoking Letta Code CLI in headless mode") + log(f"Invoking Letta Code CLI in headless mode (yolo)") result = subprocess.run( - [cli, "-p", prompt, "--output-format", "text"], + [cli, "-p", prompt, "--yolo", "--max-turns", "10", "--output-format", "text"], capture_output=True, text=True, timeout=300, # 5 minute timeout -- 2.51.2