This guide helps you migrate from OmniForge Council v1.0 (legacy) to v2.0 (enterprise edition).
- Overview
- Breaking Changes
- Step-by-Step Migration
- Code Updates
- Configuration Changes
- Testing Migration
- Rollback Plan
Version 2.0 is a complete architectural overhaul that:
- Adds multi-platform support (iOS, Android, Windows Desktop)
- Introduces enterprise-grade features (auth, database, caching)
- Restructures the codebase for better maintainability
- Preserves the legacy runtime as an optional fallback
- Preparation: 1-2 hours (review this guide)
- Implementation: 2-4 hours (update code and config)
- Testing: 1-2 hours (verify functionality)
- Total: 4-8 hours for typical installation
v1.0:
src/
├── server/
│ ├── index.ts
│ └── orchestrator.ts
├── client/
│ └── ...
└── shared/
└── types.ts
v2.0:
src/
├── api/ # New API layer
│ ├── index.ts
│ └── ApiServer.ts
├── core/ # New core engine
│ └── CouncilEngine.ts
├── client/ # Same as v1
│ └── ...
└── shared/ # Same as v1
└── types.ts
platforms/
├── legacy/ # Your old v1 code
├── web/ # PWA
├── mobile/ # iOS/Android
└── desktop/ # Windows
v1.0:
import { CouncilOrchestrator } from './server/orchestrator';v2.0:
import { CouncilEngine } from './core/CouncilEngine';
import { ApiServer } from './api/ApiServer';v1.0:
POST /api/council/query
GET /api/council/state
POST /api/council/config
v2.0:
POST /api/v1/council/query # Versioned
GET /api/v1/council/state
POST /api/v1/council/config
# Legacy endpoints redirect to v1
POST /api/council/query → /api/v1/council/query
v1.0 .env:
PORT=3001
NODE_ENV=developmentv2.0 .env:
# Server
PORT=3001
NODE_ENV=development
# New: Database
DATABASE_URL=postgresql://user:password@localhost:5432/omniforge
# New: Redis
REDIS_URL=redis://localhost:6379
# New: Security
JWT_SECRET=your-secret-key-here
CORS_ORIGIN=http://localhost:3000
# New: Rate Limiting
RATE_LIMIT_MAX=100
RATE_LIMIT_WINDOW=15This is the safest approach for production systems.
# Backup your current v1.0 installation
cp -r /path/to/agi_council /path/to/agi_council_v1_backup
# Export any important data
# (if you have custom configurations or data files)# Clone v2.0 to a new directory
git clone https://github.com/MASSIVEMAGNETICS/agi_council.git agi_council_v2
cd agi_council_v2
# Install dependencies
npm install
# Copy your v1.0 environment settings
cp ../agi_council_v1_backup/.env .env
# Add new required environment variables
cat >> .env << EOF
# Database (new in v2.0)
DATABASE_URL=postgresql://localhost:5432/omniforge
# Redis (new in v2.0)
REDIS_URL=redis://localhost:6379
# Security (new in v2.0)
JWT_SECRET=$(openssl rand -base64 32)
CORS_ORIGIN=http://localhost:3000
EOF# Option 1: Using Docker (recommended)
docker-compose up -d postgres redis
# Option 2: Install locally
# Install PostgreSQL and Redis on your system# Build the application
npm run build
# Run tests
npm test
# Start in development mode
npm run dev# Test API health
curl http://localhost:3001/health
# Expected response:
# {"status":"healthy","timestamp":"...","uptime":...}
# Test council query
curl -X POST http://localhost:3001/api/v1/council/query \
-H "Content-Type: application/json" \
-d '{"content":"Test query","modes":["Debate"],"userId":"test"}'# Build for production
npm run build
# Start production server
npm start
# Or use Docker
docker-compose up -dThis upgrades your existing installation.
# Create backup
tar -czf agi_council_backup_$(date +%Y%m%d).tar.gz /path/to/agi_councilcd /path/to/agi_council
# Stash any local changes
git stash
# Pull v2.0
git fetch origin
git checkout v2.0.0
# Restore your local changes (if any)
git stash pop# Remove old node_modules
rm -rf node_modules package-lock.json
# Install new dependencies
npm install# Update .env with new required variables
# See "Configuration Changes" section belownpm run build
npm startIf you have custom server code, update imports:
Before (v1.0):
import { CouncilOrchestrator } from './server/orchestrator';
import { CouncilState } from './shared/types';
const orchestrator = new CouncilOrchestrator(6, 'Prime Architect');
const state = orchestrator.getState();After (v2.0):
import { CouncilEngine } from './core/CouncilEngine';
import { ApiServer } from './api/ApiServer';
import { CouncilState } from './shared/types';
// Option 1: Use the full API server
const server = new ApiServer({ port: 3001 });
await server.start();
// Option 2: Use just the council engine
const engine = new CouncilEngine({
councilSize: 6,
primeArchitect: 'Prime Architect',
enableMetrics: true
});
const state = engine.getState();Client code remains largely compatible, but API calls need updating:
Before (v1.0):
const response = await fetch('http://localhost:3001/api/council/query', {
method: 'POST',
body: JSON.stringify(query)
});After (v2.0):
// Use versioned endpoint
const response = await fetch('http://localhost:3001/api/v1/council/query', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(query)
});
// Or legacy endpoint (redirects to v1)
const response = await fetch('http://localhost:3001/api/council/query', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(query)
});WebSocket connections remain the same:
// Works in both v1.0 and v2.0
const ws = new WebSocket('ws://localhost:3001/ws');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
// Handle message
};Create or update .env file:
# ============================================
# SERVER CONFIGURATION
# ============================================
PORT=3001
NODE_ENV=production # or 'development'
# ============================================
# DATABASE (New in v2.0)
# ============================================
DATABASE_URL=postgresql://user:password@localhost:5432/omniforge
# For Docker:
# DATABASE_URL=postgresql://omniforge:omniforge@postgres:5432/omniforge
# ============================================
# REDIS CACHE (New in v2.0)
# ============================================
REDIS_URL=redis://localhost:6379
# For Docker:
# REDIS_URL=redis://redis:6379
# ============================================
# SECURITY (New in v2.0)
# ============================================
# Generate with: openssl rand -base64 32
JWT_SECRET=your-secret-key-here
# Allowed origins for CORS
CORS_ORIGIN=http://localhost:3000,https://yourdomain.com
# ============================================
# RATE LIMITING (New in v2.0)
# ============================================
RATE_LIMIT_MAX=100
RATE_LIMIT_WINDOW=15 # minutes
# ============================================
# OPTIONAL FEATURES
# ============================================
# Enable/disable features
ENABLE_COMPRESSION=true
ENABLE_HELMET=true
ENABLE_RATE_LIMITING=true
ENABLE_LOGGING=true
ENABLE_METRICS=true
# Max request body size
MAX_REQUEST_SIZE=10mbIf using Docker, create docker-compose.override.yml:
version: '3.8'
services:
api:
environment:
- JWT_SECRET=${JWT_SECRET}
- DATABASE_URL=postgresql://omniforge:changeme@postgres:5432/omniforge
- REDIS_URL=redis://redis:6379
postgres:
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme}
# Add custom services here# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Watch mode during development
npm run test:watch# Test API endpoints
curl http://localhost:3001/health
curl http://localhost:3001/api/v1/council/state
# Test query processing
curl -X POST http://localhost:3001/api/v1/council/query \
-H "Content-Type: application/json" \
-d '{
"content": "Test migration",
"modes": ["Debate", "Build"],
"userId": "migration-test"
}'# Install wscat for testing
npm install -g wscat
# Test WebSocket connection
wscat -c ws://localhost:3001/ws
# Send test message
> {"type":"query","payload":{"content":"Test","modes":["Debate"],"userId":"test"}}# Install apache bench
# Ubuntu: sudo apt-get install apache2-utils
# Mac: brew install ab
# Test API performance
ab -n 1000 -c 10 http://localhost:3001/health
ab -n 100 -c 5 -p query.json -T application/json http://localhost:3001/api/v1/council/queryIf you encounter issues, you can rollback to v1.0:
# Stop v2.0
npm stop # or docker-compose down
# Restore backup
rm -rf /path/to/agi_council
tar -xzf agi_council_backup_YYYYMMDD.tar.gz -C /path/to
# Start v1.0
cd /path/to/agi_council
npm startv2.0 includes the legacy runtime:
# Stop v2.0 API
npm stop
# Start legacy runtime
npm run start:legacy# Revert to v1.0
git checkout v1.0.0
# Reinstall dependencies
rm -rf node_modules
npm install
# Start
npm startSolution:
# Clear caches
rm -rf node_modules dist
npm cache clean --force
npm install
npm run buildSolution:
# Check PostgreSQL is running
docker ps # or: sudo service postgresql status
# Test connection
psql -h localhost -U omniforge -d omniforge
# Check DATABASE_URL in .env
echo $DATABASE_URLSolution:
# Find process using port
lsof -i :3001 # or: netstat -ano | findstr :3001 (Windows)
# Kill process
kill -9 <PID>
# Or change port in .env
PORT=3002Solution:
# Check firewall
sudo ufw allow 3001 # Linux
# Or configure Windows Firewall
# Check CORS settings in .env
CORS_ORIGIN=* # Allow all (development only)If you encounter issues during migration:
- Check Logs:
docker-compose logs -fornpm run dev - Review Documentation: ARCHITECTURE.md, DEPLOYMENT.md
- Search Issues: GitHub Issues
- Ask Community: Discord
- Contact Support: support@massivemagnetics.com
- All tests passing
- API endpoints responding correctly
- WebSocket connections working
- Database connected and migrated
- Redis cache operational
- Frontend loading properly
- Authentication working (if enabled)
- Performance metrics acceptable
- Error tracking configured
- Monitoring dashboards set up
- Backup strategy implemented
- Documentation updated
- Team trained on new features
Last Updated: November 2024
Version: 2.0.0