# smlfg/variance-workflow architecture

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

- Interactive diagram: https://gitdiagram.com/smlfg/variance-workflow
- Repository: https://github.com/smlfg/variance-workflow

## Overview

variance-workflow is a command-line harness for building multiple model-generated implementations of one feature in parallel, validating them, comparing their behavior, and integrating passing alternatives side by side. Its principal flow is plan → spawn → run → collect → compare → integrate; `vw all` orchestrates those stages. Configuration, rendered prompts, run state, adapter scripts, and target-repository commands support that workflow. The README documents the major stage relationships; the sampled `bin/vw.py` excerpt is partial, so internal call relationships beyond those documented are not asserted.

Main entry points: [`bin/vw.py`](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py) (Run variants), [`variance.example.toml`](https://github.com/smlfg/variance-workflow/blob/main/variance.example.toml) (Run configuration), [`prompts`](https://github.com/smlfg/variance-workflow/tree/main/prompts) (Prompt rendering), [`adapters`](https://github.com/smlfg/variance-workflow/tree/main/adapters) (Harness adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Variant workflow"]
  node_cli["vw CLI<br/>[vw.py]"]
  node_configuration["Run configuration"]
  node_planner["Plan variants<br/>[vw.py]"]
  node_worktrees["Variant worktrees<br/>[vw.py]"]
  node_prompting["Prompt rendering"]
end

subgraph group_execution["Model execution"]
  node_runner["Run variants<br/>[vw.py]"]
  node_adapters["Harness adapters"]
  node_models["Model agents"]
  node_run_state["Run state and logs<br/>[vw.py]"]
end

subgraph group_evaluation["Evaluation and reporting"]
  node_acceptance["Acceptance checks"]
  node_probes["Behavior probes"]
  node_metrics["Diff and code metrics<br/>[vw.py]"]
  node_comparison["Variant comparison<br/>[vw.py]"]
  node_report["Comparison report<br/>[vw.py]"]
end

subgraph group_integration["Integration and learning"]
  node_integration["Passing-variant integration<br/>[vw.py]"]
  node_learning["Learning notes<br/>[vw.py]"]
end

node_engineer(("Workflow operator"))
node_target["Target repository"]

node_engineer -->|"invokes"| node_cli
node_cli -->|"loads"| node_configuration
node_cli -->|"runs stages"| node_planner
node_planner -->|"freezes base and assigns variants"| node_worktrees
node_worktrees -->|"renders prompts for"| node_prompting
node_prompting -->|"provides variant prompts"| node_runner
node_runner -->|"dispatches through"| node_adapters
node_adapters -->|"starts agent runs"| node_models
node_runner -->|"records run status"| node_run_state
node_runner -->|"runs per-variant checks"| node_acceptance
node_runner -.->|"runs optional probes"| node_probes
node_acceptance -->|"supplies evaluation results"| node_metrics
node_probes -.->|"supplies behavior results"| node_comparison
node_metrics -->|"supplies variant measurements"| node_comparison
node_comparison -->|"writes"| node_report
node_comparison -->|"selects passing variants"| node_integration
node_integration -->|"copies owned paths into branch"| node_target
node_integration -->|"checks combined tree"| node_acceptance
node_comparison -->|"writes draft"| node_learning
node_learning -.->|"feeds reviewed learnings"| node_planner
node_configuration -->|"sets harness and limits"| node_runner

click node_cli "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_configuration "https://github.com/smlfg/variance-workflow/blob/main/variance.example.toml"
click node_planner "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_worktrees "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_prompting "https://github.com/smlfg/variance-workflow/tree/main/prompts"
click node_runner "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_adapters "https://github.com/smlfg/variance-workflow/tree/main/adapters"
click node_run_state "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_metrics "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_comparison "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_report "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_integration "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py"
click node_learning "https://github.com/smlfg/variance-workflow/blob/main/bin/vw.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_cli,node_configuration,node_planner,node_worktrees,node_prompting toneBlue
class node_runner,node_adapters,node_models,node_run_state toneAmber
class node_acceptance,node_probes,node_metrics,node_comparison,node_report toneMint
class node_integration,node_learning toneRose
class node_engineer,node_target toneIndigo
```

## Components

### Variant workflow

- [vw CLI](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`
- [Run configuration](https://github.com/smlfg/variance-workflow/blob/main/variance.example.toml): `variance.example.toml`
- [Plan variants](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`
- [Variant worktrees](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`
- [Prompt rendering](https://github.com/smlfg/variance-workflow/tree/main/prompts): `prompts`

### Model execution

- [Run variants](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`
- [Harness adapters](https://github.com/smlfg/variance-workflow/tree/main/adapters): `adapters`
- **Model agents**
- [Run state and logs](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`

### Evaluation and reporting

- **Acceptance checks**
- **Behavior probes**
- [Diff and code metrics](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`
- [Variant comparison](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`
- [Comparison report](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`

### Integration and learning

- [Passing-variant integration](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`
- [Learning notes](https://github.com/smlfg/variance-workflow/blob/main/bin/vw.py): `bin/vw.py`

### Other components

- **Workflow operator**
- **Target repository**

## Connections

- Workflow operator → vw CLI: invokes (evidence: `README.md`)
- vw CLI → Run configuration: loads (evidence: `README.md`)
- vw CLI → Plan variants: runs stages (evidence: `README.md`)
- Plan variants → Variant worktrees: freezes base and assigns variants (evidence: `README.md`)
- Variant worktrees → Prompt rendering: renders prompts for (evidence: `README.md`)
- Prompt rendering → Run variants: provides variant prompts (evidence: `README.md`)
- Run variants → Harness adapters: dispatches through (evidence: `README.md`)
- Harness adapters → Model agents: starts agent runs (evidence: `README.md`)
- Run variants → Run state and logs: records run status (evidence: `README.md`)
- Run variants → Acceptance checks: runs per-variant checks (evidence: `README.md`)
- Run variants → Behavior probes: runs optional probes (evidence: `README.md`)
- Acceptance checks → Diff and code metrics: supplies evaluation results (evidence: `README.md`)
- Behavior probes → Variant comparison: supplies behavior results (evidence: `README.md`)
- Diff and code metrics → Variant comparison: supplies variant measurements (evidence: `README.md`)
- Variant comparison → Comparison report: writes (evidence: `README.md`)
- Variant comparison → Passing-variant integration: selects passing variants (evidence: `README.md`)
- Passing-variant integration → Target repository: copies owned paths into branch (evidence: `README.md`)
- Passing-variant integration → Acceptance checks: checks combined tree (evidence: `README.md`)
- Variant comparison → Learning notes: writes draft (evidence: `README.md`)
- Learning notes → Plan variants: feeds reviewed learnings (evidence: `README.md`)
- Run configuration → Run variants: sets harness and limits (evidence: `README.md`)
