Horoi Protocol

Agentic governance for CDP stablecoins, AI agents adjust PID parameters on-chain with policy bounds.

Horoi Protocol

Created At

Open Agents

Project Description

Horoi Protocol is the first agentic-first CDP where governance is performed by AI agents instead of centralized voting or timelocks. The protocol uses a ParameterGuard smart contract that enforces policies and bounds set by a DAO, company, or individual — giving complete control over what the agent can and cannot do. The agent monitors BTC collateral and the GRIT stablecoin peg, then autonomously adjusts PID controller gains (KP, KI) to maintain the peg during crashes and pumps. Every proposal is validated on-chain against policy bounds — anything outside is rejected. Every decision is stored as a Policy Decision Record (PDR) on 0G Storage for auditability. Key Innovation: Small model governance. Most agentic protocols use large LLMs ($10+/1M tokens). Horoi is designed around small models (1.5B-7B parameters) that cost 90% less, run on decentralized compute (0G), and can achieve sub-second latency — critical for DeFi crisis response. We trained a Qwen 2.5 1.5B model with RL to adjust PID parameters in crash scenarios. The model learned to propose bounded parameter changes within on-chain policies.

How it's Made

Tech Stack

  • Smart Contracts: Solidity (Foundry), Uniswap V4 PoolManager, on Unichain Sepolia
  • Agent: TypeScript, viem, OpenAI SDK — monitors state → calls LLM → executes via ParameterGuard
  • Frontend: React + Vite + Express server — live state, cheat controls, SSE streaming
  • LLM: Qwen 2.5 7B via 0G Compute testnet (OpenAI-compatible API)
  • Storage: 0G Storage SDK for PDR persistence with verifiable rootHashes
  • Chain: Unichain Sepolia (1301) Architecture Oracle → GrintaEngine (CDP) ↔ PIDController → GrintaHook (Uniswap V4) ↓ ParameterGuard ← Agent (LLM)
  1. Oracle updates BTC price (demo uses cheat buttons)
  2. Agent reads on-chain state: collateral price, market price, deviation
  3. Agent calls 0G Compute (Qwen 2.5 7B) for reasoning
  4. Returns: hold | adjust | adjust_emergency
  5. ParameterGuard validates against on-chain bounds (KP: 3.33e-7, 1e-6)
  6. On accept → PID updates redemption rate → afterSwap fires on swaps
  7. PDR stored to 0G Storage — audit trail with rootHash Partner Technologies
  • 0G Labs: Compute (inference) + Storage (PDR persistence) — decentralized, low-cost
  • Uniswap Foundation: V4 pool state monitoring via API for market prices
  • Unichain: EVM chain with fast finality for on-chain validation Hacky Notable
  • OpenAI SDK had auth issues with 0G — solved by using native fetch with bearer token
  • No API key for 0G Compute — wallet-based auth via CLI, generates app-sk-... tokens
  • BigInt serialization in 0G Storage — needed to stringify before JSON.stringify All source at github.com/reflecterlabs/horoi (https://github.com/reflecterlabs/horoi)
background image mobile

Join the mailing list

Get the latest news and updates

Horoi Protocol | ETHGlobal