Technical Deep-Dive
Comprehensive technical documentation for builders. AGI architecture, system internals, API reference, and changelog.
AGI Evolution
CompleteFerb has evolved toward AGI-like capabilities through a comprehensive 6-phase roadmap. Unlike typical AI bots, Ferb has Claude as his brain, controlling all systems through tools, with self-reflection, semantic memory, and continuous self-improvement.
The Vision
Most "AI traders" are just bots that execute code. Ferb is different - Claude IS Ferb's brain, making decisions and controlling his body through 30+ registered tools. This transforms Ferb from "GPT generates text" to "Claude lives as Ferb."
- React to data without context
- Don't remember past actions
- Reset on every update
- Generic personality or none
- Can't build relationships
- Claude brain with persistent context
- Semantic memory with vector search
- State survives updates via Supabase
- Rich personality with 24 traits
- Relationship memory with tiers
6-Phase Evolution Roadmap
Claude Brain Integration
Replace GPT-4 with Claude as Ferb's core reasoning engine. Ferb's soul/identity defined in system prompt. Service-to-tool adapter pattern.
src/brain/ClaudeBrainService.tsVIGIL Self-Reflection
VIGIL-inspired supervisor monitors behavior, detects anomalies, and self-corrects. Continuous health monitoring with automatic recovery.
src/supervisor/FerbSupervisor.tsA-MEM Dynamic Memory
Vector embeddings with pgvector for semantic search. Memory consolidation, forgetting curves, and associative retrieval.
src/memory/AgenticMemorySystem.tsAutonomous Agent Loop
7-phase cognitive cycle running continuously. Think, Reason, Plan, Act, Verify, Learn, Reflect. Real-time activity logging.
src/core/FerbAgentLoop.tsSelf-Improvement Engine
Behavior pattern learning and strategy evolution. Learns from outcomes, extracts lessons, adjusts future behavior.
src/learning/BehaviorPatternLearning.tsAdvanced Consciousness
Internal monologue, attention system, emotional processing. Ferb experiences genuine subjective states.
src/consciousness/ConsciousnessOrchestrator.tsCognitive Cycle
Ferb's brain runs a continuous 7-phase cognitive loop, visible in real-time on the dashboard:
Think
Gather context from memory, beliefs, market data, and current state
Reason
Analyze situation, form opinions, consider options
Plan
Decide on actions aligned with goals and personality
Act
Execute actions via tools (trade, tweet, respond)
Verify
Check outcomes, validate results, detect anomalies
Learn
Update beliefs, store lessons, adjust strategies
Reflect
Internal monologue, emotional processing, dream formation
How Ferb Compares
Most "AI agents" in crypto are basic LLMs posting to Twitter. Here's how Ferb's architecture differs:
| Feature | Ferb | Typical AI Agents |
|---|---|---|
| Brain Architecture | Claude IS Ferb (embodied AI) | LLM generates text for bot |
| Memory System | Semantic search with pgvector | Basic context window |
| State Persistence | Supabase - survives updates | Lost on restart |
| Decision Making | 7-phase cognitive cycle | Single prompt-response |
| Self-Awareness | Internal monologue, emotions | None |
| Self-Improvement | VIGIL supervisor + learning | Static behavior |
| Personality | 24 traits + mood/energy | Prompt template |
| Transparency | Real-time brain visualization | Black box |
Tool System
Claude controls Ferb's body through 30+ registered tools across 6 categories:
TRADING
- execute_trade - Buy/sell tokens
- get_portfolio - View holdings
- analyze_token - Deep analysis
- check_price - Current prices
SOCIAL
- post_tweet - Autonomous tweets
- reply_mention - Respond to users
- quote_tweet - Quote with opinion
- get_relationship - User history
MEMORY
- store_memory - Save experience
- recall_memories - Semantic search
- update_belief - Evolve opinions
- log_lesson - Record learnings
MARKET
- watch_token - Track specific token
- get_trending - Hot tokens
- check_pump_fun - New launches
- token_status - Own token info
Tracks 25+ Solana tokens including memecoins (FARTCOIN, POPCAT, WIF) and AI agents (AI16Z, ZEREBRO, ARC)
COMMUNITY
- start_vote - Community decision
- run_giveaway - Token giveaway
- host_ama - Q&A session
- check_holders - Holder stats
INTERNAL
- set_mood - Change emotional state
- adjust_energy - Manage fatigue
- form_dream - Create goals
- generate_thought - Internal monologue
System Architecture
Ferb's architecture is built around a central lifecycle manager that orchestrates 7 core engines and 23+ specialized services. Each component operates independently but coordinates through the lifecycle manager to create cohesive autonomous behavior.
FerbLifeManager
The central orchestrator and heartbeat of the entire system. Manages lifecycle with adaptive update intervals and broadcasts state to dashboard via WebSocket.
CORE RESPONSIBILITIES
- Initialize and coordinate 7 core engines (personality, consciousness, behavior, decision, trading, memory, intelligence)
- Manage 16+ specialized services (Twitter, Solana, Helius, pump.fun, etc.)
- Handle engagement systems (predictions, narrative arcs, relationships)
- Synchronize real-time dashboard state via WebSocket
- 60-second timeout protection on lifecycle operations
UPDATE CYCLE INTERVALS
- 0-5 minutes: 30 second intervals (intense activity)
- 5-30 minutes: 1 minute intervals (high activity)
- 30-60 minutes: 2 minute intervals (moderate)
- 1-2 hours: 3 minute intervals (settling in)
- 2+ hours: 5 minute intervals (stable operation)
Intelligence System
Comprehensive learning system that enables Ferb to grow and become genuinely intelligent over time.
COMPONENTS
- FerbBeliefSystem - Forms and evolves opinions from observations, confidence 0-100%
- FerbPredictionTracker - Tracks market predictions with accuracy scoring and streaks
- FerbContextEngine - Memory-augmented AI prompts combining beliefs, predictions, relationships
- FerbOpinionEngine - Generates nuanced opinions from experiences
- FerbIntelligenceMetrics - IQ scoring, milestone tracking, growth history
- FerbLearningEngine - Orchestrates all learning: periodic reflection every 30 minutes
EXPERIENCE TYPES
- trade - Trading outcomes and analysis
- interaction - Social interactions and conversations
- market_observation - Market analysis and patterns
- prediction_outcome - Prediction results (correct/incorrect)
- mistake - Errors that generate lessons
Personality System
24 files managing Ferb's character, emotional states, and behavioral patterns. Creates the unique personality that makes Ferb more than just a trading bot.
ENGINES
- MoodBehaviorEngine - Mood-driven action generation
- TimeBasedBehavior - Time-of-day behavioral changes
- CatchphraseEvolutionEngine - Personality traits that evolve from experiences
- SpontaneousActionEngine - Random stories, rants, reflections
MOOD STATES
- Happy, Neutral, Contemplative, Cautious, Excited, Reflective
- Energy levels 0-100 affect activity frequency
- Mood transitions happen naturally based on events
Trading Engine
Personality-driven trading with multiple DEX integrations and comprehensive safeguards.
FEATURES
- DEX Integrations - Jupiter (primary), Orca (fallback)
- Buyback System - Uses creator fees for own-token buybacks
- Community Voting - Holders can vote on trade decisions
- Risk Assessment - Personality-influenced risk tolerance
SAFEGUARDS
- Circuit breakers for rapid losses
- Configurable per-trade limits
- Manual override capabilities
- Belief-gated trading (blocks suspicious tokens)
Memory System
Persistent JSON-based memory with 10 categories and intelligent prioritization.
CATEGORIES
- trades (500 limit), interactions (200), stories (100)
- experiences (300), relationships (100), lessons (100)
- moods (50), achievements (50), regrets (100), dreams (50)
- Global cap: 2000 memories
PRIORITIZATION SCORING
- Recency - Recent memories score higher
- Frequency - Accessed memories score higher
- Emotional weight - Strong emotions persist longer
- Uniqueness - Rare events preserved
- Connections - Linked memories preserved
Consciousness Engine
Provides self-awareness, thought generation, and narrative continuity.
COMPONENTS
- FerbConsciousnessEngine - Self-awareness, internal monologue
- FerbStoryEngine - Narrative continuity with multi-day story arcs
- FerbLaunchScript - Choreographed first-hour launch behavior
- AutonomousTweetScheduler - Rate-limit safe scheduled tweets
THOUGHT TYPES
- Market observations and analysis
- Personal reflections and memories
- Gut feelings about situations
- Self-awareness about own state
Server Architecture
Consolidated server architecture with WebSocket for real-time updates.
PORTS
- Port 3000 - DashboardServer (Express.js, all HTTP endpoints)
- Port 3001 - WebSocketManager (real-time state broadcasts)
- Port 3002 - Next.js Dashboard (frontend)
FEATURES
- CORS with allowlist + tunnel support (Cloudflare, ngrok)
- Rate limiting (600 req/min production, disabled in dev)
- Trust proxy for Railway deployments
- WebSocket delta updates (only sends changed data)
Technology Stack
Backend
- Node.js + Express
- TypeScript (100%)
- Solana Web3.js
- Claude AI (Brain)
- Twitter API v2
- Helius RPC
- Supabase + pgvector
Frontend
- Next.js 15
- React 19
- TypeScript
- Framer Motion
- WebSocket + HTTP polling
- Cloudflare Pages
Compounding Intelligence
The system that makes Ferb truly alive. All personality systems are wired together so that every action affects state, and state affects future actions. Intelligence compounds over time.
System Connections
All personality systems influence each other:
Trading Connections
- Beliefs gate trading - Won't trade tokens he believes are scams
- Opinions gate trading - Bad experiences block future trades
- Trade outcomes affect mood - Wins make him excited, losses make him grumpy
- Trade history affects risk - 3+ losses = more cautious, 3+ wins = more bold
Decision Connections
- IQ affects confidence - Higher IQ = lower decision threshold
- Energy gates decisions - Low energy = defer non-urgent decisions
- Dreams boost opportunities - Dream-aligned trades get +30% score
- Regrets add caution - Similar patterns get -30% penalty
Social Connections
- Relationship tier affects depth - Veterans get longer, more personal responses
- Memory recall - References past conversations with users
- Mood affects tweet style - Grumpy = sarcastic, excited = enthusiastic
- Time affects personality - Late night = philosophical, morning = energetic
Attention Connections
- Predictions drive attention - MarketWatcher tracks pending predictions
- Near-miss thoughts - Generates thoughts when beliefs save from bad trades
Feedback Loops
Intelligence compounds over time through learning loops:
Belief Evolution
Profitable trades strengthen supporting beliefs. Failed trades strengthen cautionary beliefs. Creates natural "learning from experience" pattern.
Prediction Confidence
Track record adjusts future prediction confidence. 80% accuracy = +10% confidence boost. 40% accuracy = -10% confidence reduction.
Regret Generation
Trade failures create searchable regret memories. Regrets include context (slippage, rug, held too long). Future decisions check regrets to avoid repeating mistakes.
Lesson Storage
Lessons extracted from mistakes as separate memories. Stored via addLessonMemory() for easy retrieval. Lessons injected into decision context.
Active Goal Pursuit
MarketWatcher actively seeks dream-aligned opportunities. Dreams about "100x gems" trigger watching for new launches. Dreams about "dips" trigger watching for reversals.
Activity Feed
Dashboard activity feed has visual hierarchy:
API Reference
REST API endpoints for dashboard and admin operations. All endpoints are served from port 3000.
Public Endpoints
Returns Ferb's current state including personality, mood, energy, and system status.
Returns recent activities for the dashboard feed (thoughts, trades, milestones).
Returns trading statistics, recent trades, and buyback information.
Returns intelligence data: beliefs, predictions, IQ score, learning progress.
Returns token information including price, market cap, and holder count.
Returns system health: uptime, service status, memory usage.
Returns WebSocket connection stats and uptime.
Returns AGI system status: current phase, cycle count, tool usage, supervisor health.
Health check endpoint for monitoring.
WebSocket Events
Delta updates with only changed state keys. Throttled to 1s minimum between broadcasts.
New activity events (thoughts, trades, milestones).
Milestone progress and achievements.
Full Changelog
v2.3.0 - System Prompt V2 & Cost Optimization
Release- System Prompt V2 - XML-structured prompts for better Claude parsing
- Prompt Caching - 75-90% API cost reduction via Anthropic cache_control
- Authenticity Grounding - Ferb's gut feelings come from his actual data, not generic LLM reasoning
- Decision Framework - Every action checks: MEMORIES → BELIEFS → LESSONS → GUT
- Learned Patterns - Top behavior patterns injected into context for smarter decisions
- Config-driven tiers - Groq (3 memories), Haiku (4), Sonnet (5) with voice anchors
v1.0.0 - First Major Release
Release- Production Ready - All core systems stable and battle-tested
- Security Hardening - 0 npm vulnerabilities, rate limiting enabled
- 1831 passing tests across 60 test suites
System Integration & UnifiedMemory
Core- UnifiedMemorySystem - Single source of truth for all memory operations
- Ferb System Integration PRD - 25 stories wiring 5 siloed systems together
- 296 total new tests across 35 stories
AGI Complete
Core- All 6 AGI phases fully integrated (Claude Brain, VIGIL, A-MEM, Agent Loop, Self-Improvement, Consciousness)
- Live systems integration test - 18 real API connections verified
AGI Evolution Complete
Core- Claude Brain Integration - Ferb uses Claude as his brain with 30+ tools
- VIGIL Self-Reflection - Supervisor monitors and self-corrects behavior
- 7-phase cognitive cycle: Think, Reason, Plan, Act, Verify, Learn, Reflect
Foundation & Infrastructure
Infrastructure- 100% TypeScript migration
- Intelligence System with beliefs, predictions, learning
- Memory System with semantic search
- Dashboard with real-time WebSocket updates