# thrisha2812/logicflow architecture

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

- Interactive diagram: https://gitdiagram.com/thrisha2812/logicflow
- Repository: https://github.com/thrisha2812/logicflow

## Overview

LogicFlow has two code paths: a Python test-driven repair loop that proposes and validates fixes, and a separate C build-error extractor that emits function context as JSON. The main loop owns test execution, file changes, and calls to inference; inference owns the Ollama request. The extractor runner owns parsing compiler logs and reading/writing its inputs and output. The extractor is not shown wired into the repair loop. Edges reflect the sampled source and README; unsampled behavior is not inferred.

Main entry points: [`extractor_runner.py`](https://github.com/thrisha2812/logicflow/blob/main/extractor_runner.py) (Extractor CLI), [`main.py`](https://github.com/thrisha2812/logicflow/blob/main/main.py) (Repair loop), [`inference/run_inference.py`](https://github.com/thrisha2812/logicflow/blob/main/inference/run_inference.py) (Fix generation), [`inference/tree_sitter_extractor.py`](https://github.com/thrisha2812/logicflow/blob/main/inference/tree_sitter_extractor.py) (Syntax extractor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_repair["Automated repair"]
  node_repair_loop["Repair loop<br/>[main.py]"]
  node_test_runner["Pytest runner<br/>[main.py]"]
  node_sample_tests["Sample tests<br/>[test_calculator.py]"]
  node_target_code["Target code<br/>[calculator.py]"]
end

subgraph group_inference["AI inference"]
  node_inference_engine["Fix generation<br/>[run_inference.py]"]
  node_ollama["Ollama model"]
end

subgraph group_extract["Error extraction"]
  node_extractor_runner["Extractor CLI"]
  node_tree_extractor["Syntax extractor"]
  node_tree_sitter["Tree-sitter"]
  node_build_log["Build log"]
  node_c_source["C source<br/>[test.c]"]
  node_json_output["JSON output"]
end

node_user(("Developer"))

node_user -->|"starts"| node_repair_loop
node_repair_loop -->|"runs tests"| node_test_runner
node_test_runner -->|"tests"| node_sample_tests
node_repair_loop -->|"reads and writes"| node_target_code
node_repair_loop -->|"requests fixes"| node_inference_engine
node_inference_engine -->|"requests completion"| node_ollama
node_user -->|"runs CLI"| node_extractor_runner
node_extractor_runner -->|"reads"| node_build_log
node_extractor_runner -->|"reads"| node_c_source
node_extractor_runner -->|"extracts context"| node_tree_extractor
node_tree_extractor -->|"parses syntax"| node_tree_sitter
node_extractor_runner -->|"writes"| node_json_output

click node_repair_loop "https://github.com/thrisha2812/logicflow/blob/main/main.py"
click node_test_runner "https://github.com/thrisha2812/logicflow/blob/main/main.py"
click node_sample_tests "https://github.com/thrisha2812/logicflow/blob/main/data/samples/test_calculator.py"
click node_target_code "https://github.com/thrisha2812/logicflow/blob/main/data/samples/calculator.py"
click node_inference_engine "https://github.com/thrisha2812/logicflow/blob/main/inference/run_inference.py"
click node_extractor_runner "https://github.com/thrisha2812/logicflow/blob/main/extractor_runner.py"
click node_tree_extractor "https://github.com/thrisha2812/logicflow/blob/main/inference/tree_sitter_extractor.py"
click node_c_source "https://github.com/thrisha2812/logicflow/blob/main/data/samples/test.c"

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_repair_loop,node_test_runner,node_sample_tests,node_target_code toneBlue
class node_inference_engine,node_ollama toneAmber
class node_extractor_runner,node_tree_extractor,node_tree_sitter,node_build_log,node_c_source,node_json_output toneMint
class node_user toneIndigo
```

## Components

### Automated repair

- [Repair loop](https://github.com/thrisha2812/logicflow/blob/main/main.py): `main.py`
- [Pytest runner](https://github.com/thrisha2812/logicflow/blob/main/main.py): `main.py`
- [Sample tests](https://github.com/thrisha2812/logicflow/blob/main/data/samples/test_calculator.py): `data/samples/test_calculator.py`
- [Target code](https://github.com/thrisha2812/logicflow/blob/main/data/samples/calculator.py): `data/samples/calculator.py`

### AI inference

- [Fix generation](https://github.com/thrisha2812/logicflow/blob/main/inference/run_inference.py): `inference/run_inference.py`
- **Ollama model**

### Error extraction

- [Extractor CLI](https://github.com/thrisha2812/logicflow/blob/main/extractor_runner.py): `extractor_runner.py`
- [Syntax extractor](https://github.com/thrisha2812/logicflow/blob/main/inference/tree_sitter_extractor.py): `inference/tree_sitter_extractor.py`
- **Tree-sitter**
- **Build log**
- [C source](https://github.com/thrisha2812/logicflow/blob/main/data/samples/test.c): `data/samples/test.c`
- **JSON output**

### Other components

- **Developer**

## Connections

- Developer → Repair loop: starts (evidence: `README.md`)
- Repair loop → Pytest runner: runs tests (evidence: `main.py`)
- Pytest runner → Sample tests: tests (evidence: `main.py`)
- Repair loop → Target code: reads and writes (evidence: `main.py`)
- Repair loop → Fix generation: requests fixes (evidence: `main.py`)
- Fix generation → Ollama model: requests completion (evidence: `inference/run_inference.py`)
- Developer → Extractor CLI: runs CLI (evidence: `extractor_runner.py`)
- Extractor CLI → Build log: reads (evidence: `extractor_runner.py`)
- Extractor CLI → C source: reads (evidence: `extractor_runner.py`)
- Extractor CLI → Syntax extractor: extracts context (evidence: `extractor_runner.py`)
- Syntax extractor → Tree-sitter: parses syntax (evidence: `inference/tree_sitter_extractor.py`)
- Extractor CLI → JSON output: writes (evidence: `extractor_runner.py`)
