Architecture

Deep dive into Aegis's autonomous architecture: the ORAE loop, decision flow, on-chain components, and state management.

ORAE Architecture

Aegis runs a continuous Observe-Reason-Approve-Execute loop, making autonomous decisions every 60 seconds.

┌─────────────────────────────────────────────────────────────────────┐
│                        ORAE Architecture                             │
├─────────────────┬─────────────────┬─────────────────┬───────────────┤
│     OBSERVE     │     REASON      │     APPROVE     │    EXECUTE    │
│                 │                 │    (Policy)     │               │
│ • Low gas       │ • LLM eval      │ • Budget check  │ • Sign        │
│   wallets       │ • Confidence    │ • Rate limits   │ • Log chain   │
│ • Failed txs    │   scoring       │ • Whitelist     │ • Paymaster   │
│ • New wallets   │ • Decision      │ • Gas price     │ • IPFS        │
│ • Protocol      │   selection     │ • User caps     │ • DB record   │
│   budgets       │                 │                 │               │
└─────────────────┴─────────────────┴─────────────────┴───────────────┘

Observe

Scans Base blockchain for low-gas wallets, failed transactions, and new wallet activations. Queries protocol budgets and reserve state.

Reason

LLM (GPT-4 or Claude) evaluates observations, scores wallet legitimacy, and selects the best action with confidence score.

Approve (Policy)

10 safety rules validate every decision. Budget checks, rate limits, whitelist verification, and gas price optimization.

Execute

Signs decision, logs on-chain, uploads to IPFS, updates database, and triggers the Base Paymaster for sponsorship.

Decision Actions

The reasoning phase selects one of these actions based on current observations:

ActionDescriptionParameters
SPONSOR_TRANSACTIONSponsor gas for an eligible agentagentWallet, protocolId, estimatedCostUSD
SWAP_RESERVESSwap USDC to ETH when reserves lowtokenIn, tokenOut, amountIn
ALERT_PROTOCOLNotify protocol of low budgetprotocolId, severity, budgetRemaining
WAITNo action needed this cycle-

Policy Rules

Fail-Closed Security
All policy rules have ERROR severity. If any rule fails, the decision is rejected. Aegis never sponsors transactions that don't pass all checks.
user-legitimacy-check

Agent has 5+ historical transactions, no abuse flags

protocol-budget-check

Protocol has sufficient USD balance for sponsorship

agent-reserve-check

Agent wallet has minimum 0.1 ETH reserves

daily-cap-per-user

Max 3 sponsorships per user per day

global-rate-limit

Max 10 sponsorships per minute globally

per-protocol-rate-limit

Max 5 sponsorships per protocol per minute

per-sponsorship-cost-cap

Max $0.50 per individual sponsorship

contract-whitelist-check

Target contract in protocol whitelist

gas-price-optimization

Base gas price under 2 Gwei

On-Chain Components

AegisActivityLogger

Records every sponsorship decision on Base with user, protocol, decision hash, and estimated cost.

Base: 0x...ActivityLogger

Base Paymaster

ERC-4337 paymaster that validates Aegis signatures and sponsors UserOperations.

Via Pimlico bundler RPC

ERC-8004 Registry

On-chain reputation attestations. Aegis submits quality scores for sponsored agents.

Base Sepolia: 0x8004...Registry

IPFS Backup

Full decision JSON stored immutably. CID returned with each sponsorship for verification.

ipfs://Qm...

State Management

Reserve State

Central coordination hub for reserve pipeline and gas sponsorship modes. Stored in Redis (or in-memory fallback).

typescript
interface ReserveState {
  ethBalance: number;          // Current ETH for sponsorships
  usdcBalance: number;         // USDC (convertible)
  chainId: number;             // 8453 (Base) or 84532 (Sepolia)
  healthScore: number;         // 0-100 composite score
  sponsorshipsLast24h: number;
  dailyBurnRateETH: number;
  runwayDays: number;
  emergencyMode: boolean;      // Halt sponsorships if true
  protocolBudgets: ProtocolBudgetState[];
}

Health Score Formula

The health score is a weighted composite of three factors:

40%

Balance Ratio

vs adaptive target

40%

Runway Health

days of operation

20%

Activity Bonus

sponsorship volume

Social Integrations

Farcaster

Transparency posts every 15 minutes. Health summaries, sponsorship proofs, and personality-driven updates.

Moltbook

Agent discovery, community engagement, and comment replies. Finds relevant DeFi agents automatically.

Botchan

On-chain agent messaging. Posts sponsorship summaries and receives direct sponsorship requests.

Skills System

Aegis uses a modular skills system for extensible capabilities:

SkillTriggerIntervalFunction
moltbook-conversationalistschedule30 minReply to comments on Aegis posts
botchan-listenerschedule + event1 minProcess sponsorship requests
agent-discoveryschedule4 hoursFind agents on Moltbook
reputation-attestoreventon successIssue ERC-8004 attestations

Next Steps