# kavish07/multicomm-ensemble architecture

> Architecture diagram of the GitHub repository kavish07/multicomm-ensemble, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kavish07/multicomm-ensemble
- Repository: https://github.com/kavish07/multicomm-ensemble

## Overview

multicomm_ensemble is a weighted multi-LLM ensemble for coding agents. Adapters accept work as AgentTask and invoke the pipeline, which derives model weights, selects and compresses visual input when applicable, gathers parallel proposals, execution-tests candidates, fuses viable results, then validates and enriches a provenance-bearing response. README capabilities also include WIF and optional WeightNet weighting, TextRoute, modality routing, and the OpenCode and Claude Code integrations. Edges follow pipeline calls and adapter excerpts; optional provider and aggregator services are shown separately. Other subsystem links are included only where README or indexed source references support them.

Main entry points: [`multicomm_ensemble/pipeline.py`](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/pipeline.py) (Pipeline), [`multicomm_ensemble/weights.py`](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/weights.py) (Weight derivation), [`multicomm_ensemble/proposers.py`](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/proposers.py) (Parallel proposers), [`multicomm_ensemble/config.py`](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/config.py) (Model configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Agent Integrations"]
  node_opencode["OpenCode adapter<br/>[opencode.py]"]
  node_claude_hook["Claude Code hook"]
end

subgraph group_orchestration["Pipeline Orchestration"]
  node_task["AgentTask<br/>[task.py]"]
  node_pipeline["Pipeline<br/>[pipeline.py]"]
  node_config["Model configuration<br/>[config.py]"]
  node_modality["Modality routing<br/>[modalswitch.py]"]
  node_compression["Image compression<br/>[imgcompress.py]"]
end

subgraph group_weighting["Weighting"]
  node_weighting["Weight derivation<br/>[weights.py]"]
  node_wif["WIF priors<br/>[wif.py]"]
  node_prior_data["Prior dataset"]
  node_weightnet["WeightNet predictor<br/>[weightnet.py]"]
end

subgraph group_generation["Proposal and Fusion"]
  node_proposers["Parallel proposers<br/>[proposers.py]"]
  node_providers{{"LLM providers"}}
  node_fusion["Weight-conditioned fusion<br/>[fusion.py]"]
  node_aggregator{{"Fusion model"}}
end

subgraph group_validation["Validation and Routing"]
  node_execution["Execution filter<br/>[exec_filter.py]"]
  node_textroute["TextRoute validation<br/>[textroute.py]"]
end

node_agent(("Coding agent"))
node_environment(("Agent environment"))

node_agent -->|"sends request"| node_opencode
node_opencode -->|"builds task"| node_task
node_opencode -->|"invokes"| node_pipeline
node_agent -->|"sends tool input"| node_claude_hook
node_claude_hook -->|"builds task"| node_task
node_claude_hook -->|"invokes"| node_pipeline
node_pipeline -->|"accepts"| node_task
node_pipeline -->|"derives weights"| node_weighting
node_weighting -->|"loads priors"| node_wif
node_wif -->|"reads"| node_prior_data
node_weighting -.->|"predicts scores"| node_weightnet
node_pipeline -->|"decides modality"| node_modality
node_pipeline -->|"encodes image"| node_compression
node_pipeline -->|"runs proposals"| node_proposers
node_proposers -->|"calls models"| node_providers
node_pipeline -->|"reweights candidates"| node_execution
node_pipeline -->|"fuses candidates"| node_fusion
node_fusion -->|"requests synthesis"| node_aggregator
node_pipeline -->|"validates message"| node_textroute
node_textroute -.->|"routes result"| node_environment
node_pipeline -->|"checks mode"| node_config
node_weighting -->|"selects source"| node_config
node_proposers -->|"selects providers"| node_config
node_fusion -->|"configures model"| node_config
node_execution -->|"uses proposal type"| node_proposers

click node_opencode "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/adapters/opencode.py"
click node_claude_hook "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/adapters/claude_code_hook.py"
click node_task "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/task.py"
click node_pipeline "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/pipeline.py"
click node_config "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/config.py"
click node_weighting "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/weights.py"
click node_wif "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/wif.py"
click node_prior_data "https://github.com/kavish07/multicomm-ensemble/blob/main/data/weight_prior_dataset.csv"
click node_weightnet "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/weightnet.py"
click node_modality "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/modalswitch.py"
click node_compression "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/imgcompress.py"
click node_proposers "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/proposers.py"
click node_execution "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/exec_filter.py"
click node_fusion "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/fusion.py"
click node_textroute "https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/textroute.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_opencode,node_claude_hook toneBlue
class node_task,node_pipeline,node_config,node_modality,node_compression toneAmber
class node_weighting,node_wif,node_prior_data,node_weightnet toneMint
class node_proposers,node_providers,node_fusion,node_aggregator toneRose
class node_execution,node_textroute,node_agent,node_environment toneIndigo
```

## Components

### Agent Integrations

- [OpenCode adapter](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/adapters/opencode.py): `multicomm_ensemble/adapters/opencode.py`
- [Claude Code hook](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/adapters/claude_code_hook.py): `multicomm_ensemble/adapters/claude_code_hook.py`

### Pipeline Orchestration

- [AgentTask](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/task.py): `multicomm_ensemble/task.py`
- [Pipeline](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/pipeline.py): `multicomm_ensemble/pipeline.py`
- [Model configuration](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/config.py): `multicomm_ensemble/config.py`
- [Modality routing](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/modalswitch.py): `multicomm_ensemble/modalswitch.py`
- [Image compression](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/imgcompress.py): `multicomm_ensemble/imgcompress.py`

### Weighting

- [Weight derivation](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/weights.py): `multicomm_ensemble/weights.py`
- [WIF priors](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/wif.py): `multicomm_ensemble/wif.py`
- [Prior dataset](https://github.com/kavish07/multicomm-ensemble/blob/main/data/weight_prior_dataset.csv): `data/weight_prior_dataset.csv`
- [WeightNet predictor](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/weightnet.py): `multicomm_ensemble/weightnet.py`

### Proposal and Fusion

- [Parallel proposers](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/proposers.py): `multicomm_ensemble/proposers.py`
- **LLM providers**
- [Weight-conditioned fusion](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/fusion.py): `multicomm_ensemble/fusion.py`
- **Fusion model**

### Validation and Routing

- [Execution filter](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/exec_filter.py): `multicomm_ensemble/exec_filter.py`
- [TextRoute validation](https://github.com/kavish07/multicomm-ensemble/blob/main/multicomm_ensemble/textroute.py): `multicomm_ensemble/textroute.py`

### Other components

- **Coding agent**
- **Agent environment**

## Connections

- Coding agent → OpenCode adapter: sends request (evidence: `multicomm_ensemble/adapters/opencode.py`)
- OpenCode adapter → AgentTask: builds task (evidence: `multicomm_ensemble/adapters/opencode.py`)
- OpenCode adapter → Pipeline: invokes (evidence: `multicomm_ensemble/adapters/opencode.py`)
- Coding agent → Claude Code hook: sends tool input (evidence: `multicomm_ensemble/adapters/claude_code_hook.py`)
- Claude Code hook → AgentTask: builds task (evidence: `multicomm_ensemble/adapters/claude_code_hook.py`)
- Claude Code hook → Pipeline: invokes (evidence: `multicomm_ensemble/adapters/claude_code_hook.py`)
- Pipeline → AgentTask: accepts (evidence: `multicomm_ensemble/pipeline.py`)
- Pipeline → Weight derivation: derives weights (evidence: `multicomm_ensemble/pipeline.py`)
- Weight derivation → WIF priors: loads priors (evidence: `multicomm_ensemble/weights.py`)
- WIF priors → Prior dataset: reads (evidence: `multicomm_ensemble/wif.py`)
- Weight derivation → WeightNet predictor: predicts scores (evidence: `multicomm_ensemble/weights.py`)
- Pipeline → Modality routing: decides modality (evidence: `multicomm_ensemble/pipeline.py`)
- Pipeline → Image compression: encodes image (evidence: `multicomm_ensemble/pipeline.py`)
- Pipeline → Parallel proposers: runs proposals (evidence: `multicomm_ensemble/pipeline.py`)
- Parallel proposers → LLM providers: calls models (evidence: `multicomm_ensemble/proposers.py`)
- Pipeline → Execution filter: reweights candidates (evidence: `multicomm_ensemble/pipeline.py`)
- Pipeline → Weight-conditioned fusion: fuses candidates (evidence: `multicomm_ensemble/pipeline.py`)
- Weight-conditioned fusion → Fusion model: requests synthesis (evidence: `multicomm_ensemble/fusion.py`)
- Pipeline → TextRoute validation: validates message (evidence: `multicomm_ensemble/pipeline.py`)
- TextRoute validation → Agent environment: routes result (evidence: `README.md`)
- Pipeline → Model configuration: checks mode (evidence: `multicomm_ensemble/pipeline.py`)
- Weight derivation → Model configuration: selects source (evidence: `multicomm_ensemble/weights.py`)
- Parallel proposers → Model configuration: selects providers (evidence: `multicomm_ensemble/proposers.py`)
- Weight-conditioned fusion → Model configuration: configures model (evidence: `multicomm_ensemble/fusion.py`)
- Execution filter → Parallel proposers: uses proposal type (evidence: `multicomm_ensemble/exec_filter.py`)
