# Wave Analyzer and Confidence Scorer in AIOX Workflow Intelligence: Complete Technical Guide

> Learn about the Wave Analyzer and Confidence Scorer, key components of AIOX workflow intelligence. Optimize execution with parallel wave detection and context-aware scoring for better next-step suggestions.

- Repository: [SynkraAI/aiox-core](https://github.com/synkraai/aiox-core)
- Tags: technical-guide
- Published: 2026-03-15

---

**The Wave Analyzer and Confidence Scorer are two core components in SynkraAI/aiox-core that optimize workflow execution through parallel wave detection and rank next-step suggestions using a weighted, context-aware scoring algorithm.**

AIOX workflow intelligence transforms static workflow definitions into dynamic, optimized execution plans. In the **SynkraAI/aiox-core** repository, the **wave analyzer and confidence scorer in AIOX workflow intelligence** work together to determine both *how* workflows should execute and *which* next steps are most likely correct based on current session context.

## What Is the Wave Analyzer?

The **Wave Analyzer** identifies opportunities for parallel execution by decomposing workflows into discrete waves—groups of tasks that can run simultaneously without dependency conflicts. Located in [`.aiox-core/workflow-intelligence/engine/wave-analyzer.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/workflow-intelligence/engine/wave-analyzer.js), this engine converts sequential workflow definitions into optimized execution plans.

### Dependency Graph Construction and Cycle Detection

The analyzer first constructs a directed acyclic graph (DAG) of task dependencies using `buildDependencyGraph()`. Before proceeding with optimization, it validates the graph structure by checking for circular dependencies via `findCycle()`. This ensures that only valid, non-cyclic workflows proceed to the wave analysis stage.

### Kahn's Algorithm and Wave Grouping

The core parallelization logic resides in `_kahnWaveAnalysis()`, which implements **Kahn's topological sort algorithm** with wave-based grouping. This method produces an ordered array of waves, where each wave contains:

- Tasks eligible for simultaneous execution
- Parallel execution flags
- Estimated durations
- Dependency references

The analyzer calculates **optimization gain** by comparing sequential versus parallel execution times and identifying the critical path through the workflow.

```javascript
const {
  WaveAnalyzer,
  createWaveAnalyzer,
} = require('.aiox-core/workflow-intelligence');

// Use the factory (allows lazy loading of the workflow registry)
const analyzer = createWaveAnalyzer();   // ← optional custom taskDurations, registry, etc.

const workflowId = 'story_development';
const result = analyzer.analyzeWaves(workflowId, {
  // optional: supply ad‑hoc task definitions
  // customTasks: [...]
});

console.log('Detected waves:', result.waves);
console.log('Optimization gain:', result.optimizationGain);

```

## What Is the Confidence Scorer?

While the Wave Analyzer optimizes execution structure, the **Confidence Scorer** determines which workflow suggestions to prioritize. Implemented in [`.aiox-core/workflow-intelligence/engine/confidence-scorer.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/workflow-intelligence/engine/confidence-scorer.js), this component assigns a normalized confidence score (0-1) to each potential next action based on current session context.

### The Four Partial Scoring Dimensions

The scorer evaluates suggestions against session context through four weighted dimensions:

1. **Command match** – Measures exact or partial alignment between the suggestion's trigger command and the user's last command
2. **Agent match** – Calculates progress through the expected agent sequence (e.g., `@dev` → `@qa` → `@pm`)
3. **History depth** – Analyzes overlap between recent command history and the suggestion's key commands, applying a recency bonus
4. **Project-state match** – Provides a neutral fallback score when project state data is ambiguous or unknown

### Weighted Normalization

Each dimension contributes to the final score according to configurable `SCORING_WEIGHTS` constants. The weighted sum is normalized to a 0-1 range, allowing the CLI to rank suggestions deterministically.

```javascript
const {
  ConfidenceScorer,
} = require('.aiox-core/workflow-intelligence');

const scorer = new ConfidenceScorer({
  // optionally override default weights
  // weights: { COMMAND_MATCH: 0.5, AGENT_MATCH: 0.2, HISTORY_DEPTH: 0.2, PROJECT_STATE: 0.1 }
});

// Example suggestion generated by the suggestion engine
const suggestion = {
  trigger: 'run-tests',
  agentSequence: ['@dev', '@qa', '@pm'],
  keyCommands: ['run-tests', 'review-qa'],
};

// Current CLI session context
const context = {
  lastCommand: 'run-tests',
  lastCommands: ['write-tests', 'run-tests'],
  agentId: '@qa',
  projectState: { /* … */ },
};

const confidence = scorer.score(suggestion, context);
console.log(`Confidence for suggestion: ${(confidence * 100).toFixed(1)}%`);

```

## Integration with AIOX Execution Layer

These components integrate directly with AIOX's execution and suggestion infrastructure. The `WaveAnalyzer` feeds into [`.aiox-core/core/execution/wave-executor.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/core/execution/wave-executor.js) to drive parallel task execution, while the `ConfidenceScorer` is consumed by [`.aiox-core/workflow-intelligence/engine/suggestion-engine.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/workflow-intelligence/engine/suggestion-engine.js) to rank recommendations before CLI presentation.

Both classes are exported from [`.aiox-core/workflow-intelligence/index.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/workflow-intelligence/index.js) (lines 53-55), making them available via `require('.aiox-core/workflow-intelligence')`.

## Summary

- The **Wave Analyzer** uses graph theory and Kahn's algorithm to detect parallel execution opportunities in [`.aiox-core/workflow-intelligence/engine/wave-analyzer.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/workflow-intelligence/engine/wave-analyzer.js)
- **Confidence Scorer** applies four weighted dimensions (command match, agent match, history depth, project state) to rank suggestions in [`.aiox-core/workflow-intelligence/engine/confidence-scorer.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/workflow-intelligence/engine/confidence-scorer.js)
- Together, they enable the AIOX CLI to present optimized, context-aware workflow guidance
- Both components are accessible through the main workflow-intelligence module exports

## Frequently Asked Questions

### How does the Wave Analyzer detect circular dependencies in AIOX workflows?

The analyzer runs `findCycle()` on the dependency graph constructed by `buildDependencyGraph()` before executing wave analysis. This validation ensures only valid directed acyclic graphs (DAGs) proceed to the `_kahnWaveAnalysis()` stage, preventing infinite loops during execution.

### Can I customize the confidence scoring weights in AIOX?

Yes. The `ConfidenceScorer` constructor accepts an optional `weights` object that overrides the default `SCORING_WEIGHTS` constants. This allows you to adjust the relative importance of command matching, agent sequence alignment, history depth analysis, and project state matching to fit your specific workflow requirements.

### What algorithm does the AIOX Wave Analyzer use for parallelization?

The analyzer implements **Kahn's topological sort algorithm** with wave grouping via the internal `_kahnWaveAnalysis()` method. This algorithm determines which tasks can execute simultaneously without dependency conflicts while maintaining the correct execution order across waves.

### Where are the Wave Analyzer and Confidence Scorer exported in the codebase?

Both are exposed through [`.aiox-core/workflow-intelligence/index.js`](https://github.com/SynkraAI/aiox-core/blob/main/.aiox-core/workflow-intelligence/index.js) at lines 53-55, allowing imports via `require('.aiox-core/workflow-intelligence')` as `WaveAnalyzer`, `createWaveAnalyzer`, and `ConfidenceScorer`.