AI Orchestration Configuration Reference
Last Updated: 2025-01-XX
Version: 2.0
Overview
This document provides a comprehensive reference for the two core configuration systems that control AI analysis generation and report processing in the Strategic Intelligence platform.
Architecture Overview
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ UI Selection │ → │ Translation │ → │ AI Orchestration│
│ (tierLevel) │ │ Layer │ │ (analysisDepth) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ mapTierLevelToAnalysisDepth() │
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ User Interface │ │ Entry Point │ │ AI Generation │
│ - quick │ │ AdminOrchestrator│ │ DEPTH_CONFIGS │
│ - standard │ │ Service.js:186 │ │ + │
│ - comprehensive │ │ │ │ Post-Processing │
│ - enterprise │ │ │ │ TIER_CONTENT_ │
└─────────────────┘ └─────────────────┘ └─────────────────┘DEPTH_CONFIGURATIONS
Purpose: Controls AI prompt generation and workflow orchestration
File: src/config/DepthConfigurations.js
Usage: AI content generation phase
Configuration Structure
Each analysis depth contains:
{
// Page Targeting
targetPages: '8-12', // Target page range for entire report
totalPageTarget: 10, // Specific page target for calculations
// AI Generation Controls
maxTokensPerSection: 1024, // Token limit per AI section
sections: ['executiveSummary', 'keyFindings', 'topRecommendations'],
// Per-Section Page Allocation
pageAllocationPerSection: {
executiveSummary: '3-4 pages',
keyFindings: '2-3 pages',
topRecommendations: '3-4 pages'
},
// Content Generation Instructions
contentVolumeInstructions: 'Generate comprehensive executive-level content...',
wordTargetPerPage: 350,
contentDensity: 'executive-focused',
detailLevel: 'detailed', // Used in AI prompts as DEPTH: ${detailLevel}
// Content Guidelines
requiredElements: ['quantified impact statements', 'specific recommendations'],
expandContentAreas: ['strategic implications', 'competitive positioning'],
// Workflow Settings
includeCharts: true,
includePresentation: false,
pauseDuration: 500,
timeEstimate: '15 minutes'
}Analysis Depth Levels
| Depth | Pages | Sections | Max Tokens | Detail Level | Use Case |
|---|---|---|---|---|---|
| quick | 8-12 | 3 | 1,024 | detailed | Executive Brief |
| standard | 20-25 | 4 | 1,536 | detailed | Management Analysis |
| comprehensive | 35-50 | 6 | 2,560 | comprehensive | Strategic Study |
| enterprise | 60-80 | 8 | 3,072 | enterprise | Board Assessment |
How It Works
Entry Point:
javascriptconst depthConfig = this.getDepthConfiguration(analysisDepth); // Returns: DEPTH_CONFIGURATIONS[analysisDepth] || DEPTH_CONFIGURATIONS.standardPrompt Generation:
javascriptbuildFinancialAnalysisPrompt(industry, depthConfig, clientContext) { const pageTarget = depthConfig.pageAllocationPerSection?.financialAnalysis || '4-5 pages'; return ` 🎯 PAGE TARGET: ${pageTarget} 📊 CONTENT DENSITY: ${depthConfig.contentDensity} DEPTH: ${depthConfig.detailLevel} MAX TOKENS: ${depthConfig.maxTokensPerSection} Your response must be substantial enough to fill ${pageTarget} when formatted in professional PDF layout. `; }Dynamic Scaling:
- Quick analysis: 3-4 pages per section, 350 words/page
- Enterprise analysis: 10-12 pages per section, 500 words/page
TIER_CONTENT_LIMITS
Purpose: Controls post-AI content filtering and limiting
File: src/config/TierContentLimits.js
Usage: Report processing and structure enforcement
Configuration Structure
{
// Content Item Limits
recommendations: 8, // Total recommendations in final report
quickWins: 3, // Quick win recommendations (0-90 days)
strategicInitiatives: 3, // Strategic initiatives (3-12 months)
longTermGoals: 2, // Long-term goals (12+ months)
keyPoints: 4, // Key points per section
insights: 2, // Key insights extracted
phases: 2, // Implementation phases
objectives: 3 // Objectives per implementation phase
}Content Limits by Analysis Depth
| Content Type | Quick | Standard | Comprehensive | Enterprise |
|---|---|---|---|---|
| Total Recommendations | 8 | 15 | 25 | 40 |
| Quick Wins | 3 | 5 | 8 | 12 |
| Strategic Initiatives | 3 | 6 | 12 | 18 |
| Long Term Goals | 2 | 4 | 5 | 10 |
| Key Points (per section) | 4 | 6 | 10 | 15 |
| Insights | 2 | 3 | 5 | 8 |
| Implementation Phases | 2 | 3 | 4 | 6 |
| Objectives (per phase) | 3 | 4 | 6 | 8 |
How It Works
Function Interface:
javascriptgetTierLimit(contentType, analysisDepth, fallbackDepth = 'standard') // Examples: getTierLimit('quickWins', 'comprehensive') // Returns: 8 getTierLimit('recommendations', 'enterprise') // Returns: 40 getTierLimit('keyPoints', 'quick') // Returns: 4Usage in Report Processing:
javascript// After AI generates content, apply limits const recommendations = this.extractRecommendationsFromContent(rawOutput, analysisDepth); const quickWins = recommendations .filter(r => r.priority === 'high' || r.timeline.includes('immediate')) .slice(0, getTierLimit('quickWins', analysisDepth)); // Limit to 3-12 items const keyPoints = this.extractKeyPoints(content, analysisDepth); return keyPoints.slice(0, getTierLimit('keyPoints', analysisDepth)); // Limit to 4-15 itemsSlicing Behavior:
javascript// Safe slicing - no data loss when AI underperforms ['item1', 'item2'].slice(0, 8) // Returns: ['item1', 'item2'] ✅ ['item1'...'item15'].slice(0, 8) // Returns: ['item1'...'item8'] ✅
Configuration Alignment
Page Target Consistency
Both configurations reference identical page targets:
| Analysis Depth | DEPTH_CONFIGURATIONS | TIER_CONTENT_LIMITS |
|---|---|---|
| quick | targetPages: '8-12' | // Quick Tier: 8-12 pages |
| standard | targetPages: '20-25' | // Standard Tier: 20-25 pages |
| comprehensive | targetPages: '35-50' | // Comprehensive Tier: 35-50 pages |
| enterprise | targetPages: '60-80' | // Enterprise Tier: 60-80 pages |
Mathematical Validation
Standard Analysis (20-25 pages):
- Per-section allocation: 3-4 + 5-6 + 5-6 + 6-7 = 19-23 pages ✅
- Content limits: 15 recommendations, 6 key points per section = Appropriate density ✅
Enterprise Analysis (60-80 pages):
- Per-section allocation: 5-6 + 10-12 + 10-12 + 12-14 + 8-10 + 8-10 + 6-8 + 6-8 = 65-80 pages ✅
- Content limits: 40 recommendations, 15 key points per section = Rich content density ✅
Workflow Integration
Complete Flow
graph TD
A[UI Selection: tierLevel] --> B[mapTierLevelToAnalysisDepth]
B --> C[getDepthConfiguration]
C --> D[DEPTH_CONFIGURATIONS]
D --> E[AI Prompt Generation]
E --> F[AI Content Generation]
F --> G[Report Processing]
G --> H[getTierLimit]
H --> I[TIER_CONTENT_LIMITS]
I --> J[Content Slicing & Filtering]
J --> K[Final Report]Phase Breakdown
Configuration Phase:
javascript// AdminOrchestratorService.js:186 const analysisDepth = this.mapTierLevelToAnalysisDepth(profileResult.tier_level || 'standard'); const depthConfig = this.getDepthConfiguration(analysisDepth);AI Generation Phase:
javascript// AnalysisService.js - Uses DEPTH_CONFIGURATIONS prompt: this.buildFinancialAnalysisPrompt(industry, depthConfig, clientContext) // Tells AI: "Fill 7-8 pages with comprehensive financial analysis"Post-Processing Phase:
javascript// ReportProcessor.ts - Uses TIER_CONTENT_LIMITS quickWins.slice(0, getTierLimit('quickWins', analysisDepth)) // Ensures: Only 8 quick wins for comprehensive (not 50)
Common Patterns
Adding New Content Types
Add to TIER_CONTENT_LIMITS:
javascript// In each depth level newContentType: 5, // Standard limitUse in processing:
javascriptreturn items.slice(0, getTierLimit('newContentType', analysisDepth));
Adding New Analysis Depths
Add to DEPTH_CONFIGURATIONS:
javascriptpremium: { targetPages: '100-120', totalPageTarget: 110, maxTokensPerSection: 4096, // ... complete configuration }Add to TIER_CONTENT_LIMITS:
javascriptpremium: { recommendations: 60, quickWins: 20, // ... complete limits }
Debugging Configuration Issues
Check alignment:
javascript// Verify page targets match console.log('DEPTH target:', DEPTH_CONFIGURATIONS.comprehensive.targetPages); // Should match comment in TIER_CONTENT_LIMITSValidate limits:
javascript// Test slicing behavior const testArray = ['item1', 'item2']; console.log('Slice result:', testArray.slice(0, getTierLimit('quickWins', 'quick')));
Best Practices
Configuration Management
- Keep configurations synchronized - Page targets must match between both files
- Update comments - TIER_CONTENT_LIMITS comments should reflect DEPTH_CONFIGURATIONS values
- Test edge cases - Verify behavior when AI underperforms prompt expectations
- Document changes - Update this reference when modifying configurations
Content Scaling
- Linear scaling - Higher depths should have proportionally more content
- Balanced distribution - Don't put all limits in one content type
- Page density - Ensure total items can reasonably fit in target pages
- User expectations - Enterprise users expect significantly more content than quick users
Performance Considerations
- Token limits - Higher maxTokensPerSection = longer AI generation times
- Section counts - More sections = more AI calls = longer processing
- Content extraction - More complex parsing for higher content limits
Troubleshooting
Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Reports too thin | TIER_CONTENT_LIMITS too restrictive | Increase content limits for affected depth |
| AI timeouts | maxTokensPerSection too high | Reduce token limits or add retry logic |
| Page targets missed | Per-section allocations don't sum correctly | Recalculate pageAllocationPerSection |
| Content imbalance | Uneven TIER_CONTENT_LIMITS distribution | Rebalance limits across content types |
Validation Queries
// Check configuration consistency
const validateConfig = (depth) => {
const depthConfig = DEPTH_CONFIGURATIONS[depth];
const tierLimits = TIER_CONTENT_LIMITS[depth];
console.log(`${depth} analysis:`);
console.log(`- Target pages: ${depthConfig.targetPages}`);
console.log(`- Total recommendations limit: ${tierLimits.recommendations}`);
console.log(`- Sections: ${depthConfig.sections.length}`);
};References
- Source Files:
src/config/DepthConfigurations.js- AI generation controlssrc/config/TierContentLimits.js- Post-processing limits
- Key Integration Points:
src/services/AnalysisService.js:129- getDepthConfiguration()src/handlers/admin/services/AdminOrchestratorService.js:186- tier mappingsrc/reportProcessing/ReportProcessor.ts- content limiting usagesrc/reportProcessing/OrchestratorTransformer.ts- content limiting usage
This document serves as the definitive reference for understanding and maintaining the AI orchestration configuration system. Keep it updated as configurations evolve.