Unified orchestration layer for precision-aware AI processing
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β COGNITIVE PRECISION BRIDGE (CPB) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β QUERY ANALYSIS β β
β β β β
β β Input βββ [Complexity Signals] βββ [Path Scoring] βββ Decision β β
β β β β β β
β β βββββββββββββ΄ββββββββββββ ββββββββ΄βββββββ β β
β β β β’ Token count β β Score paths β β β
β β β β’ Code indicators β β Consider β β β
β β β β’ Reasoning patterns β β alternativesβ β β
β β β β’ Consensus signals β β Explain β β β
β β β β’ Domain complexity β β reasoning β β β
β β βββββββββββββββββββββββββ βββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β EXECUTION PATHS β β
β β β β
β β ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ β β
β β β DIRECT β RLM β ACE β HYBRID β CASCADE β β β
β β β <0.2 β 0.2-0.5 β 0.5-0.7 β >0.7+ β >0.7 β β β
β β ββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββΌβββββββββββ€ β β
β β β Simple β Context β Consensusβ Combined β Full β β β
β β β queries β compress β building β RLM+ACE β pipeline β β β
β β ββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββΌβββββββββββ€ β β
β β β ~1s β ~5s β ~5s β ~10s β ~15s β β β
β β ββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββΌβββββββββββ€ β β
β β β Sonnet β Sonnet β Opus β Opus β Opus β β β
β β ββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β ACE 5-AGENT ENSEMBLE β β
β β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β β
β β β π¬ β β π€ β β π β β π οΈ β β π β β β
β β β Analyst β β Skeptic β βSynthesizrβ βPragmatistβ β Visionaryβ β β
β β β β β β β β β β β β β β
β β β Evidence β β Risks β β Patterns β β Feasible β β Strategy β β β
β β β Logic β β Failures β β Connect β β Practicalβ β Long-termβ β β
β β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ β β
β β β β β β β β β
β β ββββββββββββββ΄βββββββββββββΌβββββββββββββ΄βββββββββββββ β β
β β βΌ β β
β β [CONSENSUS ENGINE] β β
β β Agreement scoring + synthesis β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β DQ SCORING β β
β β β β
β β βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ β β
β β β VALIDITY β β SPECIFICITY β β CORRECTNESS β β β
β β β 40% β β 30% β β 30% β β β
β β β β β β β β β β
β β β Addresses β β Detailed β β Factually β β β
β β β the query? β β actionable? β β grounded? β β β
β β βββββββββ¬ββββββββ βββββββββ¬ββββββββ βββββββββ¬ββββββββ β β
β β β β β β β
β β βββββββββββββββββββΌββββββββββββββββββ β β
β β βΌ β β
β β [OVERALL DQ SCORE] β β
β β 0.75 threshold (ELITE) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- 5 Execution Paths: Direct, RLM, ACE, Hybrid, Cascade
- 5-Agent ACE Ensemble: Analyst, Skeptic, Synthesizer, Pragmatist, Visionary
- Smart Routing: Auto-selects optimal path based on query complexity
- Provider Agnostic: Works with any LLM (OpenAI, Anthropic, Gemini, etc.)
- DQ Scoring: Validity + Specificity + Correctness quality measurement
- Multimodal Support: Text and image inputs
- Real-time Status: Progress callbacks for UI integration
- ELITE TIER: Maximum quality configuration by default
npm install @metaventionsai/cpb-core
# or
yarn add @metaventionsai/cpb-core
# or
pnpm add @metaventionsai/cpb-coreimport { createCPB, type CPBProvider } from '@metaventionsai/cpb-core';
// 1. Define your LLM provider
const claudeProvider: CPBProvider = {
name: 'claude',
isConfigured: () => !!process.env.ANTHROPIC_API_KEY,
generate: async (prompt, options) => {
const response = await anthropic.messages.create({
model: options?.model || 'claude-sonnet-4-20250514',
messages: [{ role: 'user', content: prompt }],
max_tokens: options?.maxTokens || 4096
});
return response.content[0].text;
}
};
// 2. Create CPB instance (ELITE TIER by default)
const cpb = createCPB({
fast: claudeProvider, // Sonnet for simple queries
balanced: claudeProvider, // Opus for RLM/ACE paths
deep: claudeProvider // Opus for cascade path
});
// 3. Execute with auto-routing
const result = await cpb.execute({
query: 'Compare microservices vs monolith architecture',
context: systemDesignDoc
});
console.log(result.output);
console.log(`Path: ${result.path}`); // 'ace'
console.log(`DQ Score: ${result.dqScore.overall}%`); // 78
console.log(`Confidence: ${result.confidence}`); // 85Default configuration optimized for maximum quality:
| Setting | ELITE Value | Standard Value | Description |
|---|---|---|---|
| Default Path | cascade |
direct |
Full pipeline by default |
| Context Threshold | 100,000 | 50,000 | Chars for RLM activation |
| Complexity Threshold | 0.35 | 0.5 | Lower = more consensus |
| DQ Threshold | 0.75 | 0.6 | Minimum acceptable quality |
| Fast Path Time | 8s | 5s | More time for quality |
| Standard Path Time | 45s | 30s | Extended reasoning |
| Hybrid Path Time | 90s | 60s | Full pipeline allowance |
| RLM Iterations | 25 | 10 | Deeper decomposition |
| ACE Rounds | 18 | 8 | More consensus rounds |
| ACE Agent Count | 5 | 3 | Full ensemble |
import { createCPB, STANDARD_CPB_CONFIG } from '@metaventionsai/cpb-core';
const cpb = createCPB(providers, STANDARD_CPB_CONFIG);The Adaptive Consensus Engine uses 5 specialized agents:
| Agent | Emoji | Role | Prompt Focus |
|---|---|---|---|
| Analyst | π¬ | Evidence evaluator | Data, evidence, logical consistency |
| Skeptic | π€ | Challenge assumptions | Failure modes, risks, edge cases |
| Synthesizer | π | Pattern finder | Connections, frameworks, integration |
| Pragmatist | π οΈ | Feasibility checker | Actionability, resources, constraints |
| Visionary | π | Strategic thinker | Long-term, second-order effects |
Agreement is calculated via keyword overlap between agent responses:
// High agreement (>0.7): Strong consensus
// Moderate (0.4-0.7): Some divergence
// Low (<0.4): Significant disagreement - may need human review| Path | Complexity | Use Case | Speed | Quality | Model |
|---|---|---|---|---|---|
| Direct | <0.2 | Simple queries, navigation | ~1s | Good | Sonnet |
| RLM | 0.2-0.5 | Long context, document analysis | ~5s | Better | Sonnet |
| ACE | 0.5-0.7 | Decisions, trade-offs, consensus | ~5s | High | Opus |
| Hybrid | >0.7 | Complex + long context | ~10s | Higher | Opus |
| Cascade | >0.7 | Critical decisions, research | ~15s | Highest | Opus |
// Automatic routing based on:
interface PathSignals {
contextLength: number; // Characters in context
queryComplexity: number; // 0-1 complexity score
requiresConsensus: boolean; // Multi-perspective needed?
requiresReasoning: boolean; // Deep analysis needed?
timeBudgetMs: number; // Time constraint
qualityTarget: number; // DQ threshold
}interface DQScore {
overall: number; // 0-100 weighted average
validity: number; // 40% - Does it address the query?
specificity: number; // 30% - Is it detailed/actionable?
correctness: number; // 30% - Is it factually grounded?
}| Tier | Score | Status |
|---|---|---|
| Excellent | β₯0.85 | π |
| Good | β₯0.75 | β |
| Acceptable | β₯0.60 | |
| Below Threshold | <0.60 | β |
const result = await cpb.execute(request, (status) => {
console.log(`Phase: ${status.phase}`);
console.log(`Progress: ${status.progress}%`);
console.log(`Path: ${status.path}`);
console.log(`Engine: ${status.currentEngine}`);
console.log(`Message: ${status.message}`);
});analyzing- Determining optimal pathcompressing- RLM context compressionexploring- Parallel explorationconverging- ACE consensus buildingverifying- DQ verificationreconstructing- Final synthesiscomplete- Done
import { createCPB } from '@metaventionsai/cpb-core';
const cpb = createCPB({
fast: geminiFlashProvider, // Fast queries β Gemini Flash
balanced: claudeSonnet, // Analysis β Claude Sonnet
deep: claudeOpus // Deep reasoning β Claude Opus
});import {
extractPathSignals,
selectPath,
canUseDirectPath,
needsRLMPath,
wouldBenefitFromConsensus
} from '@metaventionsai/cpb-core';
// Analyze without executing
const signals = extractPathSignals(query, context);
const decision = selectPath(signals);
console.log(`Recommended: ${decision.path}`);
console.log(`Confidence: ${decision.confidence}`);
console.log(`Reasoning: ${decision.reasoning}`);
console.log(`Alternatives:`, decision.alternatives);
// Quick checks
if (canUseDirectPath(query)) {
// Skip CPB, use direct LLM call
}
if (needsRLMPath(query, longContext)) {
// Context compression required
}
if (wouldBenefitFromConsensus(query)) {
// Multi-agent consensus recommended
}const result = await cpb.execute({
query: 'Design a new API',
forcePath: 'ace' // Force consensus path
});CPB is built on research from:
| Paper | Topic | Application |
|---|---|---|
| arXiv:2512.24601 | Recursive Language Model | Context externalization, compression |
| arXiv:2511.15755 | DQ Scoring | Quality measurement framework |
| arXiv:2508.17536 | Voting vs Debate | Consensus strategies |
- @metaventionsai/voice-nexus - Voice AI architecture
- ResearchGravity - Python CPB implementation
MIT Β© Dicoangelo