How 0xoucan/celo-mind-dn works
Layers
Layer 1 – External Interfaces (How users & frontends interact)
Layer 2 – Core Backend (Agent orchestration & action providers)
Layer 3 – Infrastructure & External Services (Blockchain, AI, wallets)
Main Components per Layer
Layer 1: External Interfaces
• CLI Chatbot (src/chatbot.ts)
• Telegram Bot Interface (src/telegram-interface.ts)
• Web UI (external repo) ↔ API Server (src/api-server.ts)
Layer 2: Core Backend
• Agent Orchestrator
– Receives natural-language commands
– Routes to action providers
• Action Providers (src/action-providers/*)
– Aave, ICHI vault, Mento swap, Balance-checker modules
– Each exposes a unified “executeAction” interface
• Network Module (src/network/network.ts)
– RPC client to Celo nodes
• Utilities & Helpers
– Logger (src/utils/logger.ts)
– Rate limiter (src/utils/rate-limiter.ts)
– Transaction utils (src/utils/transaction-utils.ts)
• Constants & Types (src/constants, src/types)
Layer 3: Infrastructure & External Services
• Celo Blockchain (RPC)
• OpenAI API (AI agent)
• Browser Wallet (MetaMask, Rabby)
• Telegram API
• Redis or in-memory cache (agent caching)
Relationships & Data Flow
1. User/Frontend → Interface Layer
– CLI or Telegram bot or Web UI sends command
2. Interface → API Server / Chatbot process
3. API Server invokes Agent Orchestrator
4. Orchestrator → Appropriate Action Provider
5. Action Provider → Network Module → Celo RPC
6. Celo RPC → Blockchain → transaction result
7. Result streams back up → Interface → User
8. Throughout:
– OpenAI API calls for command parsing/strategy
– Rate limiter and logger wrap all requests
Architectural Patterns & Principles
• Modular “plugin” pattern for action providers
• Layered separation: Interfaces ↔ Business Logic ↔ Infrastructure
• Single responsibility: utilities, constants, network all isolated
• Streaming responses & caching for performance