Agentic MarketAgentic Market Docs
Operations & ADRs

Off-Chain Workers

Isolated least-privilege operational workers for Price Engine, INV-1 Solvency Watcher, MEV-protected Guardian, and AI Curator/Resolver.

All privileged off-chain automation lives in the isolated workers/ workspace (Bun + viem) and runs strictly as separate single-role processes. None of these keys ever exist in app/, agenticmarket/, or docs-site/.


Isolated Worker Modes (workers/src/index.ts)

Mode FlagPackage ScriptOn-Chain RoleAllowed Operations
--mode=watcherbun run watcherRead-only (no key)Continuous INV-1 solvency audit (USDT.balanceOf >= 1e12 * accountedUnits), 1e12 boundary check, Vault & Leaky Bucket alerts
--mode=keeperbun run keeperKEEPERDeterministic BTC 1h/4h launchPriceMarketBatch, Chainlink bracketing (phaseId + 1 rollover), and settlement sweeps
--mode=guardianbun run guardianGUARDIANEmergency pause(key) routed exclusively over MEV-protected private BSC RPC (PRIVATE_RPC_URL + fallback)
--mode=curatorbun run curatorOff-chain / RESOLVER3-tier LLM trend curation & cross-source proposals gated by the deterministic firewall and Phase 0 DraftVetoQueue

Add --once for single-tick cron or post-deploy verification runs:

cd workers
bun run src/index.ts --mode=watcher --once

3-Tier LLM Failover & Validation Firewall

AI Curator and AI Resolver inference routes through structured JSON output mode (30s hard timeout):

  1. Primary: Nemotron 3 Ultra 550B
  2. Secondary Failover: NVIDIA NIM (hosted Nemotron 3 Ultra)
  3. Platform Failover: Gemini 3.5 Flash

Every draft and resolution output must pass workers/src/lib/validator.ts:

  • Adaptive Seed Bounds (OD-6): initialProbBps sums to 10_000; [15%, 85%] for lean seeds (< 100 USDT); [10%, 90%] for deep seeds (>= 100 USDT); post-seed R_MIN >= 5 USDT.
  • MECE Enforcement: Requires slot 5 = "Other" whenever contestantsCount > 5.
  • Whitelisted Domains & Quorum: Rejects single-wiki or non-whitelisted URLs; requires >= 2 independent allowlisted sources for high-value cross-source resolution quorum and >= 10m pre-match cutoff buffers for sports/esports.
  • Prompt-Injection Sanitizer: Strips HTML scripts/hidden nodes and neutralizes imperative instruction strings inside untrusted external web content.

Verification (13 / 13 Passing)

cd workers
bun run typecheck
bun test   # chainlink.test.ts, validator.test.ts, and live Cancun Anvil solvency-watcher.test.ts