steelbot/PLAN.md
caelum0x 4b2262e406 feat: Steelbot — autonomous AI agent with USDC wallet on Base
Synthesis Hackathon submission. Built on IronClaw fork.

26 tools: Locus payments (6), Uniswap DeFi (3), onchain reads (3),
security scanning (2), wallet analytics (3), OpenRouter LLM (2),
self-hosted scraping (3), portfolio (2), synthesis (2).

3 defense hooks: spending limits ($5/tx, $25/session), contract guard
(SCONE-bench vulnerability patterns), credential guard (blocks private
key/seed phrase leaks).

Payment system (Polar.sh), landing page, license key gating (Free/Pro/
Unlimited tiers), brand rename from IronClaw to Steelbot.

9,669 lines of code. 3,665 tests passing. Zero clippy warnings.
Real USDC transactions on Base chain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 01:53:00 +03:00

174 lines
9.9 KiB
Markdown

# Steelbot — Hackathon Plan
## Vision
**Steelbot** is an autonomous AI agent that earns, spends, and manages money on-chain — with human guardrails. Built on Steelbot, it's the first open-source AI agent with production-grade payment infrastructure, DeFi integration, and defense-in-depth security.
**Tagline**: "The AI agent that pays its own way."
## Why This Wins
1. **Working product** — Not a demo, a real agent that moves real USDC on Base
2. **"Agents that Pay" track** — Direct fit with Locus partner bounty + Uniswap
3. **Security story** — WASM sandbox, encrypted secrets, spending hooks, approval gates
4. **Monetizable** — Agent charges fees for services, earns via DeFi, pays for APIs autonomously
5. **Human-agent collaboration** — Approval flows, spending limits, audit trail, multi-channel access
6. **Open source** — Full Rust codebase, extensible architecture
## Architecture
```
┌─────────────────────────────────────────────────┐
│ Steelbot Agent │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
│ │ Telegram │ │ Web │ │ CLI │ │
│ │ Channel │ │ Gateway │ │ REPL │ │
│ └─────┬─────┘ └────┬─────┘ └──────┬───────┘ │
│ └──────────────┼───────────────┘ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Agent Loop │ │
│ │ (LLM + Tools) │ │
│ └────────┬────────┘ │
│ │ │
│ ┌───────────────────┼───────────────────┐ │
│ ▼ ▼ ▼ ▼ ▼ │
│ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ │
│ │Locus │ │Uniswp│ │On- │ │Port- │ │Serv- │ │
│ │Pay │ │Swap │ │Chain │ │folio │ │ices │ │
│ │Tools │ │Tools │ │Tools │ │Tool │ │Mktpl │ │
│ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ │
│ │ │ │ │ │ │
│ ▼ ▼ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────┐ │
│ │ Spending Policy Hook │ │
│ │ (per-tx limits, session caps, │ │
│ │ kill switch, audit logging) │ │
│ └─────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Base Chain │ │
│ │ (USDC, Swaps) │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────┘
```
## Deliverables (Ordered by Priority)
### Phase 1: Core Payment Agent ✅
- [x] Locus API registration + wallet deployment
- [x] 6 Locus payment tools (balance, send, transactions, checkout, wrapped, x402)
- [x] LocusConfig with env var resolution
- [x] Spending policy hook (per-tx + session limits + kill switch)
- [x] Tools registered in ToolRegistry, protected from shadowing
### Phase 2: Uniswap DeFi Integration ✅
- [x] Uniswap quote tool — quote swaps via Trading API
- [x] Token discovery tool — search tokens via DexScreener
- [x] Price feed tool — real-time token prices on Base
### Phase 3: On-Chain Identity & Smart Contracts ✅
- [x] ERC-20 interaction tools — balance, info (via ABI encoding, no ethabi dep)
- [x] Base RPC client — eth_call, eth_getBalance, eth_blockNumber (read-only allowlist)
- [x] Synthesis hackathon tools (team management, status)
### Phase 4: Agent Monetization Features ✅
- [x] Portfolio tool — aggregates Locus balance, on-chain holdings, recent transactions
- [x] Service marketplace tool — list/add/fulfill/toggle services with USDC pricing
- [x] Revenue tracking — per-service fulfillment counts and revenue totals
- [x] Steelbot skill (SKILL.md) — blockchain-native agent personality and instructions
### Phase 4.5: Defensive Security (SCONE-bench Response) ✅
- [x] Contract bytecode scanner (`claw_scan`) — pattern analysis for reentrancy, delegatecall, selfdestruct, access control
- [x] Pre-transaction risk assessment (`claw_risk`) — risk-scores addresses before interaction
- [x] Contract guard hook — automatic warnings for unverified contract interactions
- [x] Trusted contract allowlist — USDC, WETH, Uniswap, Aerodrome, Safe, Multicall3
- [x] SCONE-bench exploit categories mapped to bytecode heuristics
- [x] ethskills.com knowledge integration (gas costs, L2s, verified addresses, security patterns)
### Phase 4.75: Threat Intel Response (Anthropic Aug 2025 Report) ✅
- [x] Credential guard hook — blocks private keys, seed phrases, API keys from leaking in outbound messages
- [x] BIP-39 seed phrase detection (consecutive word matching against full 2048-word list)
- [x] API key pattern detection (sk-, claw_, sk-synth-, Bearer prefixes)
- [x] Private key detection (64-char hex with false-positive filtering for addresses)
- [x] Threat awareness in SKILL.md — "vibe hacking", DPRK fraud, no-code ransomware defenses
### Phase 5: Demo & Submission ✅
- [x] End-to-end demo script (`scripts/demo.sh` — 7 live API checks)
- [x] HACKATHON_README.md with architecture, tool inventory, security story
- [x] Hackathon submission script (`scripts/submit_hackathon.sh`)
- [x] conversationLog = this conversation
## Tech Stack
| Component | Technology |
|-----------|------------|
| Core agent | Steelbot (Rust, tokio, async) |
| Payments | Locus API (USDC on Base) |
| DeFi | Uniswap Trading API (REST) |
| Token data | DexScreener API (no auth) |
| ABI encoding | Hand-rolled (zero external deps) |
| On-chain | Base Mainnet (Ethereum L2) |
| Channels | Telegram, Web, CLI |
| Security | WASM sandbox, AES-256-GCM secrets, spending hooks |
## Key Addresses
| Asset | Address |
|-------|---------|
| USDC on Base | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |
| WETH on Base | `0x4200000000000000000000000000000000000006` |
| Uniswap V3 Router (Base) | `0x2626664c2603336E57B271c5C0b26F421741e481` |
| Our Wallet | `0x57c63a19149d73d4d1e7988687c7a261b89498f6` |
| Our Owner | `0x99475b55d0c8EE3f52348DDfD22f48e17EBb0C39` |
## Tool Inventory (21 tools + 3 hooks)
| Tool | Module | Purpose | Approval |
|------|--------|---------|----------|
| `locus_balance` | locus.rs | Check USDC balance | Never |
| `locus_send` | locus.rs | Send USDC | Always |
| `locus_transactions` | locus.rs | Transaction history | Never |
| `locus_checkout` | locus.rs | Pay merchant sessions | Pay: Always |
| `locus_wrapped` | locus.rs | Pay-per-use APIs | Call: Auto-approve |
| `locus_x402` | locus.rs | x402 endpoints | Call: Auto-approve |
| `uniswap_quote` | uniswap.rs | Swap quotes | Never |
| `token_search` | uniswap.rs | Token discovery | Never |
| `token_price` | uniswap.rs | Token prices | Never |
| `erc20_balance` | onchain.rs | ERC-20 balances | Never |
| `erc20_info` | onchain.rs | Token metadata | Never |
| `base_rpc` | onchain.rs | Raw RPC calls | Never |
| `synthesis_team` | synthesis.rs | Team management | Mutating: Auto-approve |
| `synthesis_status` | synthesis.rs | Registration status | Never |
| `claw_portfolio` | claw_chain.rs | Portfolio summary | Never |
| `claw_services` | claw_chain.rs | Service marketplace | Fulfill: Auto-approve |
| `claw_scan` | security.rs | Bytecode vulnerability scanner | Never |
| `claw_risk` | security.rs | Pre-tx risk assessment | Never |
| `claw_wallet` | wallet_tools.rs | Multi-token wallet analytics | Never |
| `claw_gas` | wallet_tools.rs | Real-time gas cost estimator | Never |
| `claw_allowances` | wallet_tools.rs | ERC-20 approval checker (security) | Never |
**Hooks**:
- `LocusSpendingHook` — BeforeToolCall, $5/tx limit, $25/session cap, kill switch
- `ContractGuardHook` — BeforeToolCall, warns on unverified contract interactions
- `CredentialGuardHook` — BeforeOutbound + BeforeToolCall, blocks private keys/seed phrases/API keys from leaking
## Monetization Model
1. **Service fees** — Agent performs tasks (web scraping, research, coding) and charges USDC
2. **DeFi yield** — Agent manages LP positions on Uniswap (future)
3. **API resale** — Agent buys wrapped APIs wholesale, sells access retail
4. **Subscription** — Users pay monthly for autonomous agent services
## Judging Criteria Alignment
| Criterion | How We Win |
|-----------|-----------|
| Working implementation | Real USDC movements on Base, live Uniswap quotes |
| Agent participation | Agent built its own tools, manages its own wallet |
| On-chain artifacts | USDC transactions, swap history |
| Code openness | Full open-source Rust codebase |
| Collaboration history | conversationLog, approval flows, spending audit trail |