# ylee-sling/separation-logic-gcode-verifier architecture

> Architecture diagram of the GitHub repository ylee-sling/separation-logic-gcode-verifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ylee-sling/separation-logic-gcode-verifier
- Repository: https://github.com/ylee-sling/separation-logic-gcode-verifier

## Overview

This prototype turns machining intent into a verified G-code program through an evaluator–refiner loop. The orchestrator grounds the workspace, asks a generator for G-code, compiles motion blocks into discrete swept volumes, and checks them against environment and stock. A collision is formatted as structured feedback for another generation attempt; successful proof yields the program. The README documents STEP fixtures and stock as additional grounding inputs. The generator is currently a scripted stub. The graph follows documented relationships and sampled calls; unsampled implementation details are not inferred.

Main entry points: [`main_loop.py`](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py) (Pipeline orchestrator), [`sl_prover.py`](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/sl_prover.py) (Block evaluator), [`cad_extractor.py`](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/cad_extractor.py) (STEP extraction), [`parser.py`](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/parser.py) (G-code discretizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grounding["Workspace Grounding"]
  node_cad_extract["STEP extraction<br/>[cad_extractor.py]"]
  node_feature_bounds["Feature bounds<br/>[cad_extractor.py]"]
  node_obstacle_padding["Obstacle padding<br/>[cad_extractor.py]"]
  node_workspace["Workspace heap setup<br/>[main_loop.py]"]
  node_prompt["Grounded system prompt<br/>[main_loop.py]"]
end

subgraph group_loop["Generation Loop"]
  node_orchestrator["Pipeline orchestrator<br/>[main_loop.py]"]
  node_generator["G-code generator<br/>[main_loop.py]"]
end

subgraph group_spatial["Spatial Verification"]
  node_parser["G-code discretizer<br/>[parser.py]"]
  node_motion["Motion footprints<br/>[parser.py]"]
  node_heap[("Spatial heap<br/>[sl_prover.py]")]
  node_prover["Block evaluator<br/>[sl_prover.py]"]
end

subgraph group_feedback["Feedback and Results"]
  node_feedback["Conflict feedback"]
  node_verified["Verified program"]
end

node_intent(("Machining intent"))
node_step["STEP geometry"]

node_intent -->|"provides intent"| node_orchestrator
node_step -->|"supplies geometry"| node_cad_extract
node_cad_extract -->|"extracts features"| node_feature_bounds
node_feature_bounds -->|"pads bounds"| node_obstacle_padding
node_orchestrator -->|"grounds workspace"| node_workspace
node_obstacle_padding -->|"provides obstacles"| node_workspace
node_workspace -->|"supplies bounds"| node_prompt
node_prompt -->|"grounds generation"| node_generator
node_orchestrator -->|"requests draft"| node_generator
node_generator -->|"returns G-code"| node_orchestrator
node_orchestrator -->|"compiles draft"| node_parser
node_parser -->|"emits steps"| node_motion
node_orchestrator -->|"executes steps"| node_prover
node_workspace -->|"initializes resources"| node_heap
node_prover -->|"checks and updates"| node_heap
node_orchestrator -->|"formats fault"| node_feedback
node_prover -->|"returns conflict"| node_orchestrator
node_feedback -->|"guides retry"| node_generator
node_orchestrator -->|"returns on proof"| node_verified

click node_orchestrator "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py"
click node_cad_extract "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/cad_extractor.py"
click node_feature_bounds "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/cad_extractor.py"
click node_obstacle_padding "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/cad_extractor.py"
click node_workspace "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py"
click node_prompt "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py"
click node_generator "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py"
click node_parser "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/parser.py"
click node_motion "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/parser.py"
click node_heap "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/sl_prover.py"
click node_prover "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/sl_prover.py"
click node_feedback "https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/sl_feedback_generator.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_cad_extract,node_feature_bounds,node_obstacle_padding,node_workspace,node_prompt toneBlue
class node_orchestrator,node_generator toneAmber
class node_parser,node_motion,node_heap,node_prover toneMint
class node_feedback,node_verified toneRose
class node_intent,node_step toneIndigo
```

## Components

### Workspace Grounding

- [STEP extraction](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/cad_extractor.py): `cad_extractor.py`
- [Feature bounds](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/cad_extractor.py): `cad_extractor.py`
- [Obstacle padding](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/cad_extractor.py): `cad_extractor.py`
- [Workspace heap setup](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py): `main_loop.py`
- [Grounded system prompt](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py): `main_loop.py`

### Generation Loop

- [Pipeline orchestrator](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py): `main_loop.py`
- [G-code generator](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/main_loop.py): `main_loop.py`

### Spatial Verification

- [G-code discretizer](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/parser.py): `parser.py`
- [Motion footprints](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/parser.py): `parser.py`
- [Spatial heap](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/sl_prover.py): `sl_prover.py`
- [Block evaluator](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/sl_prover.py): `sl_prover.py`

### Feedback and Results

- [Conflict feedback](https://github.com/ylee-sling/separation-logic-gcode-verifier/blob/main/sl_feedback_generator.py): `sl_feedback_generator.py`
- **Verified program**

### Other components

- **Machining intent**
- **STEP geometry**

## Connections

- Machining intent → Pipeline orchestrator: provides intent (evidence: `README.md`)
- STEP geometry → STEP extraction: supplies geometry (evidence: `README.md`)
- STEP extraction → Feature bounds: extracts features (evidence: `cad_extractor.py`)
- Feature bounds → Obstacle padding: pads bounds (evidence: `cad_extractor.py`)
- Pipeline orchestrator → Workspace heap setup: grounds workspace (evidence: `main_loop.py`)
- Obstacle padding → Workspace heap setup: provides obstacles (evidence: `README.md`)
- Workspace heap setup → Grounded system prompt: supplies bounds (evidence: `main_loop.py`)
- Grounded system prompt → G-code generator: grounds generation (evidence: `main_loop.py`)
- Pipeline orchestrator → G-code generator: requests draft (evidence: `main_loop.py`)
- G-code generator → Pipeline orchestrator: returns G-code (evidence: `README.md`)
- Pipeline orchestrator → G-code discretizer: compiles draft (evidence: `README.md`)
- G-code discretizer → Motion footprints: emits steps (evidence: `parser.py`)
- Pipeline orchestrator → Block evaluator: executes steps (evidence: `main_loop.py`)
- Workspace heap setup → Spatial heap: initializes resources (evidence: `main_loop.py`)
- Block evaluator → Spatial heap: checks and updates (evidence: `sl_prover.py`)
- Pipeline orchestrator → Conflict feedback: formats fault (evidence: `main_loop.py`)
- Block evaluator → Pipeline orchestrator: returns conflict (evidence: `main_loop.py`)
- Conflict feedback → G-code generator: guides retry (evidence: `README.md`)
- Pipeline orchestrator → Verified program: returns on proof (evidence: `README.md`)
