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.
Three concurrent polling loops run continuously:
IPC_DIR/{id}/results/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.
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.
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.
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.
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.
Three-tier model strategy that minimizes cost while preserving quality where it matters.
| Tier | Purpose | Models | Cost/Call | Volume |
|---|---|---|---|---|
| Tier 1: Triage | RSS classification, relevance scoring, urgency rating | Gemini Flash 3.0 / GPT-4.1 Mini | ~$0.01 | 200-500/day |
| Tier 2: Deep Dive | Multi-agent research, scenario analysis, source evaluation | Claude Opus 4.6 / GPT-5 | $5-15 | 2-4/month (triggered) |
| Tier 3: Allocation | Trade recommendation, portfolio overlay, conviction scoring | GPT-5.2 mid-effort | $1-3 | Same as Tier 2 |