NanoClaw: Recommended Orchestration Layer

NanoClaw is a TypeScript framework (~500 lines) built on the Claude Agent SDK. It provides the autonomous orchestration needed to run geopolitical research agents 24/7 without manual intervention.

Architecture

Three concurrent polling loops run continuously:

  • Message Loop (2s): Handles incoming messages (WhatsApp monitoring/triggering)
  • IPC Watcher (1s): Picks up result files from IPC_DIR/{id}/results/
  • Scheduler (60s): Checks SQLite for due tasks and fires agent invocations

Container isolation via Apple Container (macOS Tahoe+) or Docker. SQLite state persistence with two-cursor at-least-once delivery. Per-group memory via CLAUDE.md files.

Self-Continuation Pattern

The key pattern that enables autonomous operation: agents call schedule_task() to queue their own future invocations. The scheduler loop fires the task when due. This means no cron jobs, no infinite loops, no external orchestration. Each agent: reads CLAUDE.md (state) then does web research, writes findings to IPC_DIR, and schedules its next run. Clean, resumable, fault-tolerant.

Supabase Push Pattern

IPC watcher picks up JSON result files from agents. A post-processor normalizes the output and executes a Supabase INSERT into geopolitical_findings (or extends content_items). The webapp already reads from Supabase for all research data. Adding another source table is trivial.

Why NanoClaw Works

  • TypeScript/Python difference is irrelevant: NanoClaw is an independent process communicating via Supabase (PostgreSQL)
  • Container isolation means research agents cannot crash the main system
  • Self-continuation means clean autonomous operation without external scheduling
  • WhatsApp integration gives monitoring and manual triggering for free
  • SQLite persistence enables resume after failure or restart
  • File-based IPC is simple and debuggable

Local Machine Requirements

  • Hardware: Mac Mini or similar, 24/7 operation
  • OS: macOS Tahoe+ (for Apple Container) or Docker on any OS
  • Cost: ~$40-60/month including API calls, electricity, and network
  • Setup: NanoClaw + agent CLAUDE.md files + post-processor script
  • Monitoring: WhatsApp alerts for trigger events and errors
Verdict: NanoClaw is the recommended orchestration layer. The TypeScript/Python language difference is a non-issue because NanoClaw runs as an independent local process and communicates with the fund infrastructure exclusively through Supabase (PostgreSQL). The webapp already fetches research from Supabase. Adding another research source is the same pattern used by RSS items, YouTube transcripts, and earnings data.

Open-Source Model Assessment

Llama 4 Scout

Cost: Free (self-hosted). Quality: Decent for classification and filtering tasks. Can handle binary relevance scoring (is this article about geopolitics? yes/no). NOT suitable for deep geopolitical analysis requiring nuanced reasoning about second-order effects, probability weighting, or market transmission mechanisms.

MiniMax

Cost: API pricing competitive with GPT-4.1 Mini. Quality: Chinese model, strong at language tasks and translation. Significant quality gap vs Opus/GPT-5 for multi-step reasoning. Potential geopolitical bias concerns when analyzing events involving China.

Conclusion: Open-source models are viable for the triage tier ONLY. The deep analysis that actually generates alpha requires premium models (Opus, GPT-5, GPT-5.2) with strong reasoning, source evaluation, and scenario modeling capabilities.

Recommended Hybrid Architecture

Three-tier model strategy that minimizes cost while preserving quality where it matters.

TierPurposeModelsCost/CallVolume
Tier 1: TriageRSS classification, relevance scoring, urgency ratingGemini Flash 3.0 / GPT-4.1 Mini~$0.01200-500/day
Tier 2: Deep DiveMulti-agent research, scenario analysis, source evaluationClaude Opus 4.6 / GPT-5$5-152-4/month (triggered)
Tier 3: AllocationTrade recommendation, portfolio overlay, conviction scoringGPT-5.2 mid-effort$1-3Same as Tier 2
Cost efficiency: Tier 1 handles 99% of volume at < $0.01/call. Tier 2 and 3 only fire on high-scoring events (2-4 per month). Total monthly cost: $50-150. The cheap models handle the firehose; the expensive models handle the alpha generation.