Forge Integration
Forge is the optional backend infrastructure that powers Genie’s persistent state, real-time neuron streaming, and advanced session management. When integrated, Forge provides:- Persistent state - Postgres-backed session storage
- Worktree isolation - Separate git worktrees per session
- Real-time neurons - WebSocket-based orchestrator streaming
- Faster sessions - Database state vs file-based state
- Dashboard UI - Web interface for session monitoring
What is Forge?
Forge is a Rust-based backend service that provides:Core Features
- Session Management - Create, resume, stop, list agent sessions
- Task Orchestration - Background execution, queuing, prioritization
- State Persistence - SQLite/Postgres storage for sessions and tasks
- Neuron Streaming - Real-time WebSocket connections for orchestrators
- API Client - 80+ type-safe endpoints for Genie integration
Architecture
Integration Benefits
With Forge
✅ Persistent State - Sessions survive CLI restarts ✅ Faster Startup - Database state vs file parsing ✅ Worktree Isolation - Each session in separate worktree ✅ Real-Time Streaming - Live neuron thoughts via WebSocket ✅ Dashboard UI - Visual session monitoring ✅ Better Performance - 10-100x faster than file-based stateWithout Forge
⚠️ File-Based State - Sessions in.genie/state/ files
⚠️ Slower Startup - Parse JSON state files
⚠️ No Worktrees - Sessions share workspace
⚠️ No Streaming - Polling-based updates
⚠️ CLI Only - No web dashboard
⚠️ Limited Scale - Performance degrades with many sessions
Installation
Prerequisites
Install Forge
Option 1: Quick Start (Recommended)Verify Installation
Configuration
Environment Variables
Configure Forge connection in Genie:Genie Configuration
Update.genie/config.yaml for Forge integration:
Forge Configuration
Configure Forge backend in itsconfig.toml:
Session Management
Creating Sessions via Forge
When Forge is running, Genie automatically uses Forge for session management:Session State Storage
With Forge:Worktree Isolation
Forge automatically creates separate git worktrees for each session:- Parallel sessions don’t conflict
- Each session on separate branch
- Automatic cleanup after session ends
- Prevents workspace pollution
Neuron Streaming
What are Neurons?
Neurons are persistent orchestrator agents that stream their thoughts in real-time via WebSocket:- WISH - Feature wish creation
- FORGE - Implementation breakdown
- REVIEW - QA validation
- MASTER - Master orchestration
Neuron Configuration
Neurons are defined in.genie/neurons/<name>.md:
Streaming Connection
Neuron Thought Stream
Example WebSocket messages:Accessing Neuron Streams
MCP Resource URIs:Session Persistence
Session Reference File
When using Forge, Genie stores session metadata in.genie/.session:
Resume from Anywhere
Dashboard UI
Accessing Dashboard
Dashboard Features
Session List:- View all active/paused/completed sessions
- Filter by agent, status, date
- Quick access to transcripts
- Live transcript updates
- File tree view
- Token usage tracking
- Session metadata
- Active sessions count
- Forge uptime
- Database status
- Worktree usage
- Agent utilization
- Average session duration
- Token consumption trends
- Error rates
Troubleshooting
Forge Not Running
Symptom:genie status shows “Forge Backend: 🔴 Down”
Solution:
Connection Refused
Symptom:Error: connect ECONNREFUSED 127.0.0.1:8887
Solution:
Worktree Conflicts
Symptom:Error: worktree already exists
Solution:
Database Connection Failed
Symptom:Error: database connection failed
Solution:
Session Not Found
Symptom:Error: session not found
Solution:
Performance Tuning
Database Optimization
Worktree Management
WebSocket Tuning
Security Considerations
Network Security
Authentication
Worktree Isolation
Migration Guide
From File-Based to Forge
Step 1: Backup StateAPI Reference
Forge Client
Genie includes a TypeScript Forge client with 80+ type-safe endpoints:Key Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/health | GET | Health check |
/tasks | POST | Create task/session |
/sessions/{id} | GET | Get session details |
/sessions/{id}/transcript | GET | Get transcript |
/sessions | GET | List sessions |
/worktrees | GET | List worktrees |
/ws/neurons/{name} | WS | Neuron stream |

