# water-vapor/synth-rearc architecture

> Architecture diagram of the GitHub repository water-vapor/synth-rearc, 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/water-vapor/synth-rearc
- Repository: https://github.com/water-vapor/synth-rearc

## Overview

RE-ARC generates synthetic ARC input/output examples with task-specific programs, then retains examples that satisfy each task’s verifier. The legacy `main.py` workflow discovers generators and verifiers, samples unique nontrivial examples, computes difficulty statistics, and writes a dataset. The newer `synth_rearc` package adds task discovery, validated artifact building, previews, and verification utilities. Task implementations are extensive; unsampled tasks are represented by their enclosing directory, and their internal behavior is not inferred.

Main entry points: [`main.py`](https://github.com/water-vapor/synth-rearc/blob/main/main.py) (Legacy dataset entry), [`synth_rearc/shared/discovery.py`](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/discovery.py) (Task discovery), [`synth_rearc/shared/build.py`](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/build.py) (Artifact builder), [`synth_rearc/core.py`](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/core.py) (Authoring core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Dataset workflow"]
  node_legacy_entry["Legacy dataset entry<br/>[main.py]"]
  node_generated_data["Generated examples"]
end

subgraph group_task_logic["Task programs"]
  node_task_generators["Task generators<br/>[generators.py]"]
  node_task_verifiers["Task verifiers<br/>[verifiers.py]"]
  node_task_packages["Task packages"]
end

subgraph group_shared["Shared runtime"]
  node_dsl_ops["ARC DSL<br/>[dsl.py]"]
  node_generation_utils["Grid utilities<br/>[utils.py]"]
  node_shared_core["Authoring core<br/>[core.py]"]
end

subgraph group_artifacts["Artifact operations"]
  node_discovery["Task discovery<br/>[discovery.py]"]
  node_path_config["Path configuration<br/>[paths.py]"]
  node_artifact_builder["Artifact builder<br/>[build.py]"]
  node_rendering["Preview rendering<br/>[render.py]"]
  node_verification["Artifact verification<br/>[verify.py]"]
  node_generated_checks["Generated-data checks"]
  node_inventory_checks["Task inventory checks"]
end

node_user(("Dataset user"))

node_user -->|"requests generation"| node_legacy_entry
node_legacy_entry -->|"selects generators"| node_task_generators
node_legacy_entry -->|"selects verifiers"| node_task_verifiers
node_legacy_entry -->|"uses utilities"| node_generation_utils
node_legacy_entry -->|"writes dataset"| node_generated_data
node_task_generators -.->|"uses DSL"| node_dsl_ops
node_task_verifiers -->|"uses DSL"| node_dsl_ops
node_task_generators -->|"imports authoring core"| node_shared_core
node_task_verifiers -->|"imports authoring core"| node_shared_core
node_shared_core -->|"re-exports DSL"| node_dsl_ops
node_shared_core -->|"re-exports utilities"| node_generation_utils
node_discovery -->|"loads task modules"| node_task_packages
node_discovery -->|"resolves paths"| node_path_config
node_artifact_builder -->|"loads task specs"| node_discovery
node_artifact_builder -->|"calls task programs"| node_task_packages
node_artifact_builder -->|"uses artifact paths"| node_path_config
node_artifact_builder -->|"renders previews"| node_rendering
node_verification -->|"loads task specs"| node_discovery
node_verification -->|"loads examples"| node_rendering
node_generated_checks -->|"loads task specs"| node_discovery
node_generated_checks -->|"loads examples"| node_rendering
node_generated_checks -->|"invokes verification"| node_verification
node_inventory_checks -->|"uses task paths"| node_path_config

click node_legacy_entry "https://github.com/water-vapor/synth-rearc/blob/main/main.py"
click node_task_generators "https://github.com/water-vapor/synth-rearc/blob/main/generators.py"
click node_task_verifiers "https://github.com/water-vapor/synth-rearc/blob/main/verifiers.py"
click node_task_packages "https://github.com/water-vapor/synth-rearc/tree/main/synth_rearc/tasks"
click node_dsl_ops "https://github.com/water-vapor/synth-rearc/blob/main/dsl.py"
click node_generation_utils "https://github.com/water-vapor/synth-rearc/blob/main/utils.py"
click node_shared_core "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/core.py"
click node_discovery "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/discovery.py"
click node_path_config "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/paths.py"
click node_artifact_builder "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/build.py"
click node_rendering "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/render.py"
click node_verification "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/verify.py"
click node_generated_checks "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/verify_generated.py"
click node_inventory_checks "https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/verify_inventory.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_legacy_entry,node_generated_data,node_user toneBlue
class node_task_generators,node_task_verifiers,node_task_packages toneAmber
class node_dsl_ops,node_generation_utils,node_shared_core toneMint
class node_discovery,node_path_config,node_artifact_builder,node_rendering,node_verification,node_generated_checks,node_inventory_checks toneRose
```

## Components

### Dataset workflow

- [Legacy dataset entry](https://github.com/water-vapor/synth-rearc/blob/main/main.py): `main.py`
- **Generated examples**

### Task programs

- [Task generators](https://github.com/water-vapor/synth-rearc/blob/main/generators.py): `generators.py`
- [Task verifiers](https://github.com/water-vapor/synth-rearc/blob/main/verifiers.py): `verifiers.py`
- [Task packages](https://github.com/water-vapor/synth-rearc/tree/main/synth_rearc/tasks): `synth_rearc/tasks`

### Shared runtime

- [ARC DSL](https://github.com/water-vapor/synth-rearc/blob/main/dsl.py): `dsl.py`
- [Grid utilities](https://github.com/water-vapor/synth-rearc/blob/main/utils.py): `utils.py`
- [Authoring core](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/core.py): `synth_rearc/core.py`

### Artifact operations

- [Task discovery](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/discovery.py): `synth_rearc/shared/discovery.py`
- [Path configuration](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/paths.py): `synth_rearc/shared/paths.py`
- [Artifact builder](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/build.py): `synth_rearc/shared/build.py`
- [Preview rendering](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/render.py): `synth_rearc/shared/render.py`
- [Artifact verification](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/verify.py): `synth_rearc/shared/verify.py`
- [Generated-data checks](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/verify_generated.py): `synth_rearc/shared/verify_generated.py`
- [Task inventory checks](https://github.com/water-vapor/synth-rearc/blob/main/synth_rearc/shared/verify_inventory.py): `synth_rearc/shared/verify_inventory.py`

### Other components

- **Dataset user**

## Connections

- Dataset user → Legacy dataset entry: requests generation
- Legacy dataset entry → Task generators: selects generators (evidence: `main.py`)
- Legacy dataset entry → Task verifiers: selects verifiers (evidence: `main.py`)
- Legacy dataset entry → Grid utilities: uses utilities (evidence: `main.py`)
- Legacy dataset entry → Generated examples: writes dataset
- Task generators → ARC DSL: uses DSL
- Task verifiers → ARC DSL: uses DSL (evidence: `verifiers.py`)
- Task generators → Authoring core: imports authoring core
- Task verifiers → Authoring core: imports authoring core
- Authoring core → ARC DSL: re-exports DSL (evidence: `synth_rearc/core.py`)
- Authoring core → Grid utilities: re-exports utilities (evidence: `synth_rearc/core.py`)
- Task discovery → Task packages: loads task modules (evidence: `synth_rearc/shared/discovery.py`)
- Task discovery → Path configuration: resolves paths (evidence: `synth_rearc/shared/discovery.py`)
- Artifact builder → Task discovery: loads task specs (evidence: `synth_rearc/shared/build.py`)
- Artifact builder → Task packages: calls task programs (evidence: `synth_rearc/shared/build.py`)
- Artifact builder → Path configuration: uses artifact paths (evidence: `synth_rearc/shared/build.py`)
- Artifact builder → Preview rendering: renders previews (evidence: `synth_rearc/shared/build.py`)
- Artifact verification → Task discovery: loads task specs (evidence: `synth_rearc/shared/verify.py`)
- Artifact verification → Preview rendering: loads examples (evidence: `synth_rearc/shared/verify.py`)
- Generated-data checks → Task discovery: loads task specs (evidence: `synth_rearc/shared/verify_generated.py`)
- Generated-data checks → Preview rendering: loads examples (evidence: `synth_rearc/shared/verify_generated.py`)
- Generated-data checks → Artifact verification: invokes verification (evidence: `synth_rearc/shared/verify_generated.py`)
- Task inventory checks → Path configuration: uses task paths (evidence: `synth_rearc/shared/verify_inventory.py`)
