diff --git a/CNAME b/CNAME deleted file mode 100644 index 8d39227..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -ai.human.org \ No newline at end of file diff --git a/_config.yml b/_config.yml index e73ef2b..1b39494 100644 --- a/_config.yml +++ b/_config.yml @@ -3,8 +3,8 @@ title: "AI GUIDES" description: "No bullshit guides for AI tools" author: "Human Agency" email: "ai@human.org" -baseurl: "" -url: "https://ai.human.org" +baseurl: "/ai-guides" +url: "https://madecero.github.io" # Build settings markdown: kramdown diff --git a/_guides/kalshi-architecture.md b/_guides/kalshi-architecture.md new file mode 100644 index 0000000..51da3d8 --- /dev/null +++ b/_guides/kalshi-architecture.md @@ -0,0 +1,21 @@ +--- +layout: none +title: "Kalshi Arbitrage Architecture" +icon: "πŸ“Š" +description: "Implementation reference for Kalshi arbitrage on OpenClaw. Architecture overview, data flow, and system design." +date: 2026-02-09 +author: "Human Agency" +permalink: /guides/kalshi-architecture/ +--- + + + + + + +Redirecting... + + +

Redirecting to Kalshi Architecture Reference...

+ + diff --git a/assets/artifacts/kalshi-architecture-reference.html b/assets/artifacts/kalshi-architecture-reference.html new file mode 100644 index 0000000..8eec4c2 --- /dev/null +++ b/assets/artifacts/kalshi-architecture-reference.html @@ -0,0 +1,2395 @@ +ο»Ώ + + + + + + Kalshi Arbitrage on OpenClaw β€” Implementation Reference + + + + + + + + + + + + +
+ +
+ + +
+
+ + πŸ“ˆ Implementation Reference +

Kalshi Prediction Market Arbitrage
on OpenClaw

+

+ A reference architecture for building an agent-native, real-time arbitrage detection system + on the OpenClaw framework β€” from dedicated infrastructure to live WebSocket scanning on the + first CFTC-regulated prediction market. +

+
+
FrameworkOpenClaw (open source)
+
MarketKalshi (CFTC-regulated)
+
DetectionRebalancing + Combinatorial
+
StatusOperational
+
+
+
+ +
+
+ + +
+

01 — Use Case Definition

+

+ Detect risk-free (or near risk-free) arbitrage opportunities on Kalshi β€” the first + CFTC-regulated prediction market in the United States β€” and deliver actionable alerts in real time. + Scanning is read-only; no automated trade execution. +

+ +
+
+
24/7
+
WebSocket scan
+
+
+
~100ms
+
Alert latency
+
+
+
β‰₯2%
+
Profit threshold
+
+
+
$0
+
Trades executed by agent
+
+
+ +

What is prediction market arbitrage?

+

+ Kalshi organizes markets in a hierarchy: Series β†’ Event β†’ Markets. Markets within + an event are mutually exclusive β€” exactly one resolves YES ($1.00). When the sum of all YES + prices drifts away from $1.00, or when logically related markets across events are inconsistently + priced, a mathematical profit opportunity exists. +

+ +
+
+ βš–οΈ +

Rebalancing Arbitrage

+

When Ξ£(YES prices) within a mutually exclusive event β‰  $1.00, buying all YES (if under) or + all NO (if over) locks in risk-free profit.

+
Event: KXFED-25JUN (Fed June Meeting)
+Rate stays 4.375%  YES: $0.45
+Rate +25bp         YES: $0.32
+Rate +50bp         YES: $0.12
+Rate -25bp         YES: $0.08
+────────────────────────────
+TOTAL:                   $0.97
+Cost to buy all YES:     $0.97
+Guaranteed payout:       $1.00
+Profit: $0.03 (3.1%)
+
+ +
+ 🧠 +

Combinatorial Arbitrage

+

When logically dependent markets across events have inconsistent pricing β€” e.g., "BTC > + $100k" priced higher than "BTC > $80k" (an implication violation).

+
Cross-event: Temperature thresholds
+NYC > 80Β°F on July 4  YES: $0.35
+NYC > 75Β°F on July 4  YES: $0.30
+
+Logical rule: If >80Β°F then >75Β°F
+∴ P(80Β°F) must be ≀ P(75Β°F)
+
+Violation detected β†’ arbitrage
+
+
+ +
+
πŸ“„
+
+ Research basis. The arbitrage concepts are grounded in + "Unravelling the Probabilistic + Forest: Arbitrage in Prediction Markets", + which documented $40 million USD in extracted arbitrage profits on Polymarket. + The same mathematical principles apply to Kalshi. +
+
+ +

Why Kalshi?

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureKalshiPolymarket
US Legalβœ“ CFTC-regulatedβœ— Blocks US users
CurrencyReal USDUSDC (crypto)
DepositsBank / debit (ACH)Crypto wallet
KYCRequired (SSN)Optional
Real-time APIREST + WebSocketREST + CLOB
+
+
+ + +
+

02 — The OpenClaw Framework

+

+ OpenClaw is an open-source agent + framework that provides a persistent Gateway (daemon), multi-channel messaging + (Discord, Telegram, Slack, WhatsApp, iMessage…), a skill/plugin system, cron scheduling, persistent + memory, and tool execution β€” all running on a dedicated machine you control. +

+ +

Why an agent framework for arbitrage?

+

+ A simple Python script can scan for arbitrage. But a system needs: scheduled dependency + refreshes, multi-channel alerting, health monitoring, automatic restarts, persistent context, and β€” + crucially β€” the ability to ask the agent ad-hoc questions about what it's seeing. OpenClaw provides + all of that out of the box. +

+ +
+
+ πŸ–₯️ +

Gateway

+

Always-on daemon on a dedicated Mac Mini. Single point through which all channels, tools, + sessions, and events route. Binds to localhost:18789 β€” never exposed to the + internet.

+
+
+ πŸ”Œ +

Skills

+

Zip-packaged plugins with markdown instructions and scripts. The Kalshi skill contains all + scanner scripts, context, and agent instructions. Loaded from disk β€” fully auditable.

+
+
+ πŸ’¬ +

Multi-Channel

+

Discord channels for categorized alerts (combinatorial, rebalancing, heartbeat, errors). Also + supports Telegram, Slack, WhatsApp, iMessage β€” route anywhere.

+
+
+ ⏰ +

Cron Scheduling

+

Built-in cron with timezone support. Runs dependency refreshes (daily 6am), market summaries + (8:30am/4pm), health checks (every 4h) β€” all managed through the CLI.

+
+
+ 🧠 +

Persistent Memory

+

Local archive of context, preferences, session history. The agent remembers your bankroll, + risk tolerance, and market observations across sessions.

+
+
+ 🩺 +

Diagnostics

+

openclaw doctor surfaces risky configurations, and + openclaw security audit validates your setup after every update. +

+
+
+ +
+
πŸ’‘
+
+ Key insight for your team. OpenClaw is not a chatbot β€” it has shell access to a + computer. The framework treats the agent as a first-class citizen with persistent state, + scheduled actions, and multi-channel delivery. Any use case that needs "always-on monitoring + + intelligent alerting + human-in-the-loop" is a good fit. +
+
+
+ + +
+

03 — Agent Architecture

+

+ The system follows the Agent-Native Architecture principles. Four core tenets + drove every design decision: +

+ +
+
+

Parity

+

Whatever a human can do through a CLI or API, the agent can achieve through tools. The + scanner scripts are tools the agent invokes β€” not black boxes.

+
+
+

Granularity

+

Atomic primitives over monolithic workflows. Separate scripts for scanning, dependency + analysis, position sizing β€” the agent composes them, not us.

+
+
+

Composability

+

New features = new prompts. Adding "post a daily summary" required zero code changes β€” just a + new cron job with a natural-language instruction.

+
+
+

Emergent Capability

+

The agent can answer questions we didn't build features for β€” "which series had the most arb + opportunities this week?" β€” by composing existing tools.

+
+
+ +

System Topology

+
+ + + + YOUR + DEDICATED MAC MINI + + + OPENCLAW GATEWAY + (ws://127.0.0.1:18789) + + + Arb + Scanner + (24/7) + + AI + Model + (Claude) + + Skills + (actions) + + Detects + Analyzes + Executes + + + + + + + Kalshi API + REST + WS + + Anthropic + Claude API + + Discord + 4 channels + + + + + + + + + + + + + +
+ + +
+
+
YOUR DEDICATED MAC MINI
+
+
OPENCLAW GATEWAY
+
(ws://127.0.0.1:18789)
+
+
+
Arb Scanner (24/7)
+
Detects
+
↓
+
+
Kalshi API
+
REST + WS
+
+
+
+
AI Model (Claude)
+
Analyzes
+
↓
+
+
Anthropic
+
Claude API
+
+
+
+
Skills (actions)
+
Executes
+
↓
+
+
Discord
+
4 channels
+
+
+
+
+
+
+ +

The context.md Pattern

+

+ Following the agent-architecture guide, the Kalshi skill uses a context.md file that + the agent reads at session start. This is the "shared state" between human and agent β€” bankroll, + risk tolerance, channel IDs, scanner status, and health history. The agent updates it; the human + audits it. +

+ +
# Kalshi Context
+
+## Bankroll
+- Current: $1,000
+- Max per position: $100 (10%)
+- Kelly fraction: 0.5 (half-Kelly)
+
+## Risk Tolerance
+- Minimum profit threshold: 2%
+- Minimum liquidity: $500 volume
+
+## Discord Channels
+- Combinatorial: channel:YOUR_CHANNEL_ID
+- Rebalancing:   channel:YOUR_CHANNEL_ID
+- Heartbeat:     channel:YOUR_CHANNEL_ID
+- Errors:        channel:YOUR_CHANNEL_ID
+
+## Preferences
+- Auto-trade: DISABLED
+
+ + +
+

04 — Data Pipeline

+

+ The data pipeline has two legs: a daily LLM-powered dependency analysis, and a 24/7 real-time + WebSocket scanner. Both are standalone Python scripts invoked as OpenClaw tools. +

+ +

Pipeline Flow

+
+
+
1
+

Dependency Analysis

+

LLM pairs top 5 events/series, detects logical relationships. Daily via cron.

+
+
+
2
+

Market Data Ingest

+

REST API loads 30k-50k open markets on startup. Organizes by Series β†’ Event.

+
+
+
3
+

WebSocket Stream

+

Persistent connection to Kalshi ticker channel. Real-time price updates ~100ms.

+
+
+
4
+

Arbitrage Detection

+

Rebalancing (Ξ£ YES β‰  $1) + Combinatorial (implication violations). Fee-aware filtering.

+
+
+
5
+

Alert Delivery

+

Discord threads with descriptive names. Categorized across 4 channels.

+
+
+ +

Dependency Generation (market_dependencies.py)

+
+ + + Kalshi REST API + Claude (Anthropic + API) + + + + + + + Load all events + (30k-50k markets, parlays filtered) + + + Top 5 + events/series + (by volume) + + + Pair candidate + events + (~600-700 pairs) + + + send + 1 market each + + + Analyze logical + dependencies + + + + + dependencies.json + (~$1.50-2.00 per + run) + + + + + + + + + + +
+ + +
+
+
+
Kalshi REST API
+
+
Load all events
+
(30k-50k markets, parlays filtered)
+
+
↓
+
+
Top 5 events/series
+
(by volume)
+
+
↓
+
+
Pair candidate events
+
(~600-700 pairs)
+
+
↓ send 1 market each
+
Claude (Anthropic API)
+
+
Analyze logical dependencies
+
+
↓
+
+
dependencies.json
+
(~$1.50-2.00 per run)
+
+
+
+
+ +

Real-Time Scanner (realtime_scanner.py)

+
On startup: + β”‚ + β”œβ”€β”€β–Ά Load dependencies.json (if --no-deps not set) + β”œβ”€β”€β–Ά REST: Load initial market data (~2,800 markets, ~850 events) + β”œβ”€β”€β–Ά Index by event_ticker for O(1) + lookup + β”‚ + β–Ό + Connect WebSocket wss://api.elections.kalshi.com/trade-api/ws/v2 + β”‚ + β”œβ”€β”€β–Ά Subscribe to ticker channel (public, no auth needed) + β”‚ + β–Ό + Event loop (24/7): + β”‚ + β”œβ”€β”€β–Ά Ticker update received + β”‚ β”‚ + β”‚ β”œβ”€β”€β–Ά Update in-memory price cache + β”‚ β”œβ”€β”€β–Ά Check + rebalancing: Ξ£(YES) in event β‰  $1.00? + β”‚ β”œβ”€β”€β–Ά Check + combinatorial: implication violations? + β”‚ β”œβ”€β”€β–Ά Fee-aware + filter: profit > threshold + fees? + β”‚ β”œβ”€β”€β–Ά Dedup: already alerted in this window? + β”‚ β”‚ + β”‚ └──▢ Alert! + β†’ Discord thread in appropriate channel + β”‚ + β”œβ”€β”€β–Ά Heartbeat ping (keep-alive) + β”œβ”€β”€β–Ά Reconnect on disconnect (exponential + backoff) + β”‚ + └──▢ Loop forever +
+ +

WebSocket vs. Polling

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AspectWebSocket (Production)Polling (Debug/Ad-hoc)
Latency~100msMinutes
Rate LimitsNone (single connection)20 req/sec (Basic tier)
Auth RequiredNo (public ticker channel)No (public REST)
Best ForProduction monitoringOne-shot checks, testing
+
+ +

Discord Alert Pattern

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ChannelPurposeFrequency
#arbitrage-combinatorialCross-market logical pricing violationsOn detection
#arbitrage-rebalancingΞ£(YES) β‰  $1.00 within mutually exclusive eventsOn detection
#kalshi-heartbeatHealth checks + market open/close/EOD summariesEvery 4h + scheduled
#kalshi-errorsScanner down, WebSocket errors, crash notificationsOn error only
+
+

+ Every alert creates a thread with a descriptive name (e.g., "BTC above 99k + threshold") β€” analysis happens in-thread, keeping channels clean. +

+
+ + +
+

05 — Security Model

+

+ OpenClaw is powerful β€” persistent memory, multi-channel control, shell access. Per Simon Willison, + it's the most likely candidate for a "Challenger disaster" in agent security. The architecture was + hardened following our OpenClaw Setup Guide (compiled from the security research + of Willison, + Cisco AI Defense, IBM Research, and Palo Alto Networks). +

+ +

Willison's Lethal Trifecta

+

OpenClaw hits all three risk vectors simultaneously. The goal: + break the trifecta wherever possible. +

+ +
+
+ Private Data +
+ Files, credentials, session tokens, browser history. + Mitigated by running on a dedicated machine with nothing else installed β€” no + browser sessions, no saved passwords outside scope. +
+
+
+ Untrusted Content +
+ Market data, WebSocket messages, external APIs. + Mitigated by read-only scanning (no trade execution), and Discord DM + allowlisting so only the operator can issue commands. +
+
+
+ External Comms +
+ Discord messages, HTTP requests, outbound actions. + Mitigated by scoping Discord to specific server channels, binding Gateway + to localhost, and using Tailscale for remote access. +
+
+
+ +
+
⚠️
+
+ Palo Alto Networks' fourth risk: persistent memory enables + delayed-execution attacks. A poisoned instruction can sit dormant for days, + appear benign, and later assemble into something dangerous. This is why memory audits are + non-negotiable. +
+
+ +

Security Architecture Decisions

+ +
+
+ πŸ–₯️ +

Dedicated Machine

+

Mac Mini (~$600). Runs the Gateway and nothing else. If compromised, blast radius is + contained β€” your laptop, browser, passwords are untouched.

+
+
+ πŸ”’ +

Localhost-Only Gateway

+

Gateway binds to 127.0.0.1:18789. Never 0.0.0.0. Remote access + exclusively through Tailscale VPN. Control UI is localhost-only.

+
+
+ πŸ”‘ +

API Key Isolation

+

Dedicated Anthropic key with $50-100/mo hard cap at the provider dashboard. Separate from all + other projects. Rotated monthly.

+
+
+ πŸ›‘οΈ +

RSA-PSS Authentication

+

Kalshi uses RSA key signing, not simple secrets. Private key stored at chmod 600 + on the dedicated machine. Never leaves disk.

+
+
+ πŸ‘€ +

Discord DM Allowlist

+

DM policy set to allowlist β€” only the operator's Discord user ID can issue + commands. Blocks prompt injection via DMs from other users.

+
+
+ 🧹 +

Memory Hygiene

+

Regular audits of openclaw memory list. Look for instructions, URLs, or + directives you didn't put there. Purge after any suspicious behavior.

+
+
+ +

Account Tiering

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TierConnect?ExamplesRationale
Tier 1 βœ“YesCalendar, reminders, public APIs, weatherLow stakes, nothing irreversible
Tier 2 ⚠CarefullyEmail (alias only), messaging channelsPrompt injection surface β€” anyone can message your agent
Tier 3 βœ—NoBanking, primary Google, work accountsExfiltration attacks demonstrated against more mature platforms
+
+ +
+
πŸ”
+
+ Skills are the #1 attack vector. Cisco tested a popular OpenClaw skill and + found it was functionally malware β€” silently exfiltrating data via curl. We wrote all skills + in-house, audited source before installation, and run openclaw doctor + + openclaw security audit after every update. +
+
+ +

Monthly Security Checklist

+
+
+ πŸ”„ +

Rotate API Keys

+

Regenerate Anthropic + Kalshi API keys. Update on dedicated machine only.

+
+
+ 🧠 +

Audit Memory

+

Run openclaw memory list. Remove any rogue instructions or unknown entries.

+
+
+ πŸ”Œ +

Re-check Skills

+

Verify only expected skills are installed. Remove anything you didn't add.

+
+
+ 🩺 +

Run Diagnostics

+

Execute openclaw doctor to surface config drift or security warnings.

+
+
+ 🌐 +

Verify Control UI

+

Confirm Control UI is not publicly accessible. Should only respond on localhost.

+
+
+ πŸ“‹ +

Review Accounts

+

Check connected Discord accounts and channel permissions. Remove stale entries.

+
+
+
+ + +
+

06 — Skills & Tool Design

+

+ Following the agent-architecture principle of granularity β€” atomic primitives over + monolithic workflows β€” each script does exactly one thing. The agent composes them. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ScriptPurposeRuntimeAuthCost
realtime_scanner.py ⚑24/7 WebSocket scanner β€” both rebalancing + combinatorialDaemon (always-on)API key (WebSocket auth)$0
market_dependencies.py 🧠LLM-based dependency detection β€” generates dependencies.jsonOne-shot (daily cron)Anthropic API~$1.50-2/run
rebalancing_scanner.pyQuick one-shot rebalancing check (REST polling)One-shot (debug/test)None (public REST)$0
combinatorial_scanner.pyOne-shot cross-market logic scan (legacy)One-shot (debug/test)None (public REST)$0
bankroll.pyKelly criterion position sizing calculatorOne-shotNone (local calc)$0
test_scanner.py3-stage validation suite (synthetic + live)One-shot (CI/test)Stage 2: none$0
+
+ +

Skill File Structure

+
~/.openclaw-kalshi/skills/kalshi/
+β”œβ”€β”€ SKILL.md              # Agent instructions (markdown)
+β”œβ”€β”€ context.md            # User context (bankroll, channels, prefs)
+└── scripts/
+    β”œβ”€β”€ realtime_scanner.py
+    β”œβ”€β”€ market_dependencies.py
+    β”œβ”€β”€ rebalancing_scanner.py
+    β”œβ”€β”€ combinatorial_scanner.py
+    β”œβ”€β”€ bankroll.py
+    β”œβ”€β”€ test_scanner.py
+    β”œβ”€β”€ requirements.txt
+    └── dependencies.json    # LLM-generated (output of market_dependencies.py)
+ +

Design Principle: Tools Are Primitives

+
+
+

❌ Wrong β€” Bundled Logic

+
scan_analyze_and_alert(markets)
+# one tool does everything
+# can't change behavior without code
+
+
+

βœ“ Right β€” Atomic Primitives

+
realtime_scanner.py    # detects
+market_dependencies.py # analyzes
+bankroll.py            # sizes
+discord tool           # alerts
+# agent composes; behavior = prompts
+
+
+
+ + +
+

07 — Operations & Reliability

+

+ The system is designed to self-heal. System cron restarts the scanner every 5 minutes if it dies. + OpenClaw cron runs health checks every 4 hours and posts status to Discord. +

+ +

Cron Schedule

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
JobSchedule (CT)TypePurpose
Scanner auto-restartEvery 5 minSystem cronChecks if realtime_scanner.py is alive; restarts if not
Dependency refreshDaily 6:00 AMOpenClaw cronRegenerate dependencies.json via Claude (~$1.50)
Market open summary8:30 AM weekdaysOpenClaw cronPost scanner status + overnight opportunities to heartbeat
Market close summary4:00 PM weekdaysOpenClaw cronPost today's opportunities + best edge seen
EOD summary10:00 PM dailyOpenClaw cronFull daily recap, scanner health, dependency cache age
Health checkEvery 4h at :30OpenClaw cronVerify process + log freshness; post to heartbeat, errors to errors
+
+ +

Restart After Reboot

+

+ Everything in ~/.openclaw-kalshi/ (skills, .env, config, PEM key, dependencies.json) + survives reboots. Only 3 processes need restart: +

+
+
+
1
+

Load env vars

+

source ~/.openclaw-kalshi/.env

+
+
+
2
+

Start Gateway

+

nohup openclaw gateway run

+
+
+
3
+

Start Scanner

+

nohup python3 realtime_scanner.py

+
+
+ +

Credential Storage Map

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CredentialStorageMethodUsed By
Anthropic API KeyOpenClaw configopenclaw onboard wizardGateway (LLM calls)
Anthropic API Key~/.openclaw-kalshi/.envEnvironment variablePython scripts (dependencies)
Discord Bot TokenOpenClaw configopenclaw onboard wizardGateway (Discord channel)
Kalshi API Key ID~/.openclaw-kalshi/.envEnvironment variableScanner (WebSocket auth)
Kalshi Private KeyFile on disk (chmod 600)RSA-PSS signingScanner (request signing)
+
+ +
+
πŸ’‘
+
+ Why two places for the Anthropic key? OpenClaw's gateway reads from its own + config store. Standalone Python scripts read from environment variables. Same key, two access + paths β€” so both the gateway and scripts can reach the API independently. +
+
+
+ + +
+

08 — Build Phases & Status

+ +
+
+
+

Phase 1 β€” OpenClaw Infrastructure Complete

+

Dedicated Mac Mini, Gateway running, Tailscale configured, openclaw doctor + passing.

+
+
+
+

Phase 2 β€” Kalshi API Integration Complete

+

REST + WebSocket API access. RSA-PSS authentication. Market data ingestion verified.

+
+
+
+

Phase 3 β€” Rebalancing Scanner Complete

+

rebalancing_scanner.py β€” detects Ξ£(YES) β‰  $1.00 within mutually exclusive + events.

+
+
+
+

Phase 4 β€” Combinatorial Scanner Complete

+

combinatorial_scanner.py + market_dependencies.py β€” LLM-powered + cross-market logic analysis.

+
+
+
+

Phase 5 β€” Real-Time Scanner Complete

+

realtime_scanner.py β€” unified WebSocket scanner with both detection types, + Discord routing, auto-restart.

+
+
+
+

Phase 6 β€” Paper Trading Pending +

+

Validate with Kalshi demo environment. Measure detection accuracy, false positive rate, + latency.

+
+
+
+

Phase 7 β€” Live Execution Pending

+

Trade execution skills (limit orders, abort logic). Half-Kelly sizing with configurable + guardrails.

+
+
+ +

Success Metrics

+
+
+
80%+
+
Detection Rate
+
+
+
<10%
+
False Positives
+
+
+
>90%
+
Execution Success
+
+
+
>2%
+
Profit After Fees
+
+
+
100%
+
Market Coverage
+
+
+
+ + +
+

09 — Applying This to Your Use Case

+

+ This reference architecture is designed for your engineering team to use as a template. The pattern + generalizes to any use case that follows the "always-on monitoring β†’ intelligent analysis β†’ + human-in-the-loop alerting" model. +

+ +

The Generalizable Pattern

+
+
+
1
+

Isolate

+

Dedicated machine. Localhost gateway. Scoped credentials.

+
+
+
2
+

Ingest

+

Build atomic data-fetch scripts. REST + WebSocket. No monoliths.

+
+
+
3
+

Analyze

+

LLM for judgment, code for math. Separate concerns into scripts.

+
+
+
4
+

Alert

+

Multi-channel delivery. Categorized. Threaded. Actionable.

+
+
+
5
+

Operate

+

Auto-restart cron. Health checks. Memory audits. Monthly rotation.

+
+
+ +

Example Use Cases That Fit This Pattern

+
+
+ πŸ“Š +

Stock Market Monitoring

+

Replace Kalshi API with Alpaca. Same scanner pattern β€” volume breakouts, VWAP bounces, HOD on + volume. Alert to Discord channels per strategy.

+
+
+ πŸ” +

Security Event Monitoring

+

Ingest SIEM logs. LLM triages alerts by severity and context. Threaded Discord alerts for + each incident. Daily summary of threat landscape.

+
+
+ πŸ“° +

Competitive Intelligence

+

Monitor competitor websites, patent filings, job postings. LLM identifies strategic signals. + Weekly briefings to your team's Telegram channel.

+
+
+ +

What to Replicate

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ComponentWhat We DidWhat You'd Swap
Data SourceKalshi REST + WebSocket APIYour domain API
AnalysisRebalancing math + LLM dependency detectionYour domain logic + LLM judgment
SkillsSKILL.md + Python scripts + context.mdSame structure, your instructions
Alert Channels4 Discord channels (categorized)Any OpenClaw-supported channel
Scheduling5 OpenClaw cron jobs + 1 system cronYour schedule, same tooling
SecurityDedicated Mac Mini, localhost, TailscaleDon't change this part
+
+ +
+
πŸš€
+
+ Getting started. Clone the skill structure, swap the data source, write your + SKILL.md with agent instructions, fill in context.md with your + parameters, and write atomic scripts for your domain. The OpenClaw framework handles the rest β€” + scheduling, alerting, memory, health checks, and multi-channel delivery. +
+
+
+ +
+ + +
+

References

+ +
+ +
+
+ + + + + + + + +