- Overview
- Project Structure
- Core Packages
- Architecture
- Key Features
- Technology Stack
- Development Setup
- Testing & Quality
- Deployment
- Contributing
OpenSPG (Opencode Framework 2.0) is an enterprise-grade AI development platform that brings universal AI capabilities directly into React applications. Created by Jim McKenney as part of the Project AEON AI Initiative, this framework doubles traditional capabilities while maintaining simplicity.
- Universal AI Integration: One-line AI integration in any React component
- Enterprise-Grade: Production-ready with analytics, collaboration, and cost management
- Performance: 2x faster with smart caching and optimization
- Team-First: Real-time collaboration with shared AI sessions
- Developer-Centric: AI-powered code suggestions, review, and generation
- Author: Jim McKenney (@Planet9V)
- License: MIT
- Initiative: Project AEON AI
- Version: 2.0
- Repository: Opencode_Template
openspg/
├── packages/
│ ├── ai-hooks/ # Core AI React hooks
│ │ ├── src/
│ │ │ ├── index.ts # Main hooks export
│ │ │ ├── useAnalytics.ts
│ │ │ ├── useWorkflow.ts
│ │ │ └── ...
│ │ └── package.json
│ │
│ ├── ui-components/ # Pre-built UI components
│ │ ├── src/
│ │ │ ├── AIChat.tsx
│ │ │ ├── WorkflowBuilder.tsx
│ │ │ ├── AnalyticsDashboard.tsx
│ │ │ ├── CollaborationPanel.tsx
│ │ │ └── ...
│ │ └── package.json
│ │
│ ├── openrouter-sdk/ # Multi-model AI gateway
│ │ ├── src/
│ │ │ └── index.ts
│ │ └── package.json
│ │
│ ├── taskmaster/ # Task management system
│ │ ├── src/
│ │ │ ├── index.ts
│ │ │ ├── database.ts
│ │ │ ├── cli.ts
│ │ │ └── taskmaster-ui.tsx
│ │ ├── package.json
│ │ └── README.md
│ │
│ └── cli-tool/ # CLI utilities
│ └── src/
│ └── index.ts
│
├── examples/
│ └── ai-integrated-app/ # Demo application
│ └── src/
│ └── App.tsx
│
├── README.md
├── AI_INTEGRATION_README.md
├── FRAMEWORK_2.0_IMPLEMENTATION.md
└── .gitignore
Purpose: Core AI React hooks for seamless AI integration
Key Hooks:
useAI()- Single AI completionsuseChat()- Conversational AIuseStreamingChat()- Real-time streaming responsesuseCodeGeneration()- Programming assistantuseModelSelector()- Model switching
useWorkflow()- Multi-agent orchestrationuseCodeSuggestions()- AI-powered code intelligenceuseAnalytics()- Usage tracking & cost managementuseCache()- Smart response cachinguseCollaboration()- Real-time team collaboration
Dependencies:
- React >= 16.8.0
- @opencode/openrouter-sdk
Build Commands:
bun build # Build package
bun dev # Watch mode
bun typecheck # Type checkingPurpose: Beautiful, accessible UI components built with ShadCN UI
Components:
AIModelSelector- Model marketplace with descriptionsAIChat- Ready-to-use chat interface
WorkflowBuilder- Visual workflow creationAnalyticsDashboard- Enterprise analyticsCollaborationPanel- Team collaboration hubCodeSuggestionsPanel- AI code intelligence UIAPIGateway- API orchestrationDatabaseConnector- Database integrationDeploymentOrchestrator- Deployment management
Dependencies:
- @opencode/ai-hooks
- @radix-ui/react-select, @radix-ui/react-scroll-area
- lucide-react (icons)
- tailwindcss >= 3.0.0
Build Commands:
bun build # Build package
bun dev # Watch mode
bun typecheck # Type checkingPurpose: Multi-model AI gateway for unified access to GPT-4, Claude, Gemini, and more
Features:
- Universal OpenRouter.ai integration
- Automatic model switching
- Streaming support
- Rate limiting and retry logic
- Cost tracking
Supported Models:
- OpenAI: gpt-4o, gpt-4o-mini
- Anthropic: claude-3.5-sonnet, claude-3-haiku
- Google: gemini-pro-1.5
- Meta: llama-3.1-70b-instruct
- And many more via OpenRouter
Build Commands:
bun build # Build package
bun dev # Watch mode
bun typecheck # Type checkingPurpose: Advanced SQLite-based task management and project orchestration
Version: 2.0.0
Features:
- SQLite database backend for persistent storage
- Multi-agent orchestration
- Progress tracking and analytics
- Dependency management
- AI-powered task assignment
- CLI interface
- React dashboard component
Core Capabilities:
- Project management with phases
- Task creation and assignment
- Dependency tracking (finish-to-start, etc.)
- Agent workload balancing
- Workflow execution
- Project metrics and reporting
Database Schema:
projects- Project definitionsphases- Project phasestasks- Individual taskstask_dependencies- Task relationshipstask_progress- Progress historyagents- AI/development agentsworkflow_executions- Workflow runs
CLI Commands:
npx taskmaster init # Initialize
npx taskmaster project:create # Create project
npx taskmaster task:create # Create task
npx taskmaster task:update # Update progress
npx taskmaster project:status # View statusDependencies:
- better-sqlite3 - SQLite database
- uuid - ID generation
- date-fns - Date utilities
- zod - Schema validation
┌─────────────────────────────────────────────────────────────┐
│ Opencode Framework 2.0 │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌──────────────────┐ ┌────────────┐│
│ │ UI Components │ │ AI Hooks │ │ Taskmaster ││
│ │ • AIChat │ │ • useAI │ │ • Projects ││
│ │ • Workflows │ │ • useWorkflow │ │ • Tasks ││
│ │ • Analytics │ │ • useAnalytics │ │ • Agents ││
│ │ • Collab │ │ • useCache │ │ • Analytics││
│ └─────────────────┘ └──────────────────┘ └────────────┘│
│ │ │ │ │
│ └────────────────────┼────────────────────┘ │
│ │ │
│ ┌───────────────────────┐ │
│ │ OpenRouter SDK │ │
│ │ Multi-Model Gateway │ │
│ └───────────────────────┘ │
│ │ │
└────────────────────────────────┼────────────────────────────┘
│
┌────────────────────────┐
│ OpenRouter.ai API │
│ GPT-4, Claude, Gemini │
└────────────────────────┘
User Interaction
↓
UI Component (React)
↓
AI Hook (State Management)
↓
OpenRouter SDK (API Client)
↓
Cache Layer (Optional)
↓
OpenRouter.ai API
↓
AI Model (GPT-4, Claude, etc.)
↓
Response Processing
↓
Analytics Tracking
↓
UI Update
Workflow Definition
↓
Agent Configuration
(id, role, model, dependencies)
↓
Dependency Resolution
↓
Sequential Execution
(respects dependencies)
↓
Progress Tracking
↓
Result Aggregation
↓
Workflow Completion
- Complex AI workflows with dependency chains
- Visual workflow builder interface
- Real-time execution monitoring
- Pre-built templates (code review, content creation)
- Error handling and retry logic
- Real-time usage metrics
- Cost tracking and budgeting
- Model performance comparison
- Usage trends and forecasting
- Export capabilities
- Shared AI sessions
- Live messaging and model switching
- Session management
- Participant tracking
- Team productivity features
- Intelligent code completion
- Refactoring suggestions
- Performance optimization
- Bug detection
- Multi-language support
- Automatic response caching
- TTL management
- Intelligent cache invalidation
- Hit/miss tracking
- Performance optimization
- SQLite-based persistence
- Multi-agent orchestration
- Progress tracking
- Dependency management
- Project analytics
- React 18+
- TypeScript 5.0+
- Tailwind CSS
- ShadCN UI Components
- Lucide React (Icons)
- Radix UI (Primitives)
- Bun (Runtime & Package Manager)
- OpenRouter API (Multi-model access)
- Better SQLite3 (Database)
- Date-fns (Date utilities)
- UUID (ID generation)
- Zod (Schema validation)
- Turbo (Monorepo orchestration)
- tsup (TypeScript bundler)
- TypeScript Compiler
- ESLint (Linting)
- Prettier (Formatting)
- Hot Module Replacement
- Watch mode compilation
- Type checking
- Automated testing (Vitest)
- Bun >= 1.0.0
- Node.js >= 18.0.0 (for compatibility)
- Git
# Clone repository
git clone https://github.com/Planet9V/Opencode_Template.git
cd Opencode_Template
# Install dependencies
bun install
# Build all packages
bun turbo build
# Run example application
cd examples/ai-integrated-app
bun devCreate .env file in your project:
OPENROUTER_API_KEY=your-api-key-here
DEFAULT_AI_MODEL=openai/gpt-4o-mini
AI_TEMPERATURE=0.7# Build all packages
bun turbo build
# Type check all packages
bun turbo typecheck
# Test all packages
bun turbo test
# Test single file
bun test <file>
# Format code
./script/format.ts# Work on ai-hooks
cd packages/ai-hooks
bun dev # Watch mode
bun build # Build
bun typecheck # Type check
# Work on ui-components
cd packages/ui-components
bun dev
bun build
bun typecheck
# Work on taskmaster
cd packages/taskmaster
bun dev
bun test
bun run cli -- --help- Vitest for unit and integration tests
- Bun:test for runtime tests
# Run all tests
bun turbo test
# Run specific package tests
cd packages/ai-hooks && bun test
# Run with coverage
bun test --coverage
# Watch mode
bun test --watch# Lint all packages
bun turbo lint
# Fix linting issues
bun turbo lint:fix# Type check all packages
bun turbo typecheck# Format all files
./script/format.tsPrettier Config:
- No semicolons
- Print width: 120
- Single quotes
- Trailing commas: all
# Install Vercel CLI
bun add -g vercel
# Deploy
vercel deploy# Build
bun turbo build
# Deploy dist/ folder
netlify deploy --prod# Configure amplify.yml
# Connect repository
# Auto-deploy on pushFROM oven/bun:latest
WORKDIR /app
COPY . .
RUN bun install
RUN bun turbo build
EXPOSE 3000
CMD ["bun", "dev"]- Kubernetes orchestration
- Azure App Service
- Private cloud deployment
- On-premise installation
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
- TypeScript: Strict typing, avoid
any - Testing: 80%+ code coverage
- Documentation: JSDoc comments for all public APIs
- Formatting: Prettier with project config
- Linting: ESLint with TypeScript rules
- Run
bun installafter pulling changes - Use
bun devfor watch mode during development - Run
bun typecheckbefore committing - Run
bun testto ensure tests pass - Format code with
./script/format.ts
type(scope): subject
body (optional)
Types: feat, fix, docs, style, refactor, test, chore
Examples:
feat(ai-hooks): add useCollaboration hookfix(ui-components): resolve WorkflowBuilder rendering issuedocs(wiki): update architecture diagram
- Framework Overview Video (Coming Soon)
- Building Your First AI Workflow
- Enterprise Analytics Setup
- Team Collaboration Best Practices
- Advanced workflow templates library
- Real-time collaboration WebSocket integration
- Enhanced analytics with ML insights
- Mobile SDK for React Native
- Enterprise SSO integration
- Advanced security and compliance features
- AI model fine-tuning capabilities
- GraphQL API layer
- Visual workflow marketplace
- Advanced team management features
- Multi-tenant architecture support
- Advanced monitoring and alerting
MIT License - see the LICENSE file for details.
Built with ❤️ by:
- Jim McKenney - Creator and lead architect
- Project AEON - AI initiative
- OpenRouter - Multi-model infrastructure
- Vercel - Deployment platform
- ShadCN - UI component library
Last Updated: 2024 Maintained By: Opencode Team Status: Active Development