# loktrishal-05/codekiln architecture

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

- Interactive diagram: https://gitdiagram.com/loktrishal-05/codekiln
- Repository: https://github.com/loktrishal-05/codekiln

## Overview

CodeKiln generates validated, tamper-resistant feature-development tasks from a working repository, then evaluates coding systems against them. The intended workflow is repository ingestion and feature planning, synthesis of a specification and reference patch, blind-reader and execution/mutation gates, secure packaging, and evaluation/reporting. The sampled pipeline currently stops after planning and diversity checks, while the README documents the broader product capabilities; those later stages are included from documented contracts and indexed modules. Arrows use shown references or README statements; uncertain integration details are omitted.

Main entry points: [`src/codekiln/cli.py`](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/cli.py) (CLI), [`src/codekiln/pipeline.py`](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/pipeline.py) (Pipeline orchestration), [`src/codekiln/synthesis/runner.py`](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/runner.py) (Synthesis runner), [`src/codekiln/evaluation/eval_runner.py`](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/evaluation/eval_runner.py) (Blind evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and planning"]
  node_cli["CLI<br/>[cli.py]"]
  node_pipeline["Pipeline orchestration<br/>[pipeline.py]"]
  node_repo_loader["Repository loader<br/>[repo_loader.py]"]
  node_reverse_planner["Reverse feature extraction<br/>[reverse_extract.py]"]
  node_forward_planner["Forward planning<br/>[forward_synth.py]"]
  node_diversity["Difficulty and diversity<br/>[diversity_guard.py]"]
  node_plan_model["Candidate plan<br/>[models.py]"]
end

subgraph group_synthesis["Task synthesis"]
  node_synth_runner["Synthesis runner<br/>[runner.py]"]
  node_llm_router["LLM router<br/>[llm_router.py]"]
  node_feature_spec["Feature specification<br/>[models.py]"]
  node_rtm["Requirement-test audit<br/>[rtm.py]"]
end

subgraph group_validation["Trust and validation"]
  node_blind_reader["Blind-reader lint<br/>[blind_reader.py]"]
  node_gate["Execution gate<br/>[gate_runner.py]"]
  node_harbor_runner["Harbor task runner<br/>[harbor_runner.py]"]
  node_mutation_probe["Mutation probes<br/>[mutation_probe.py]"]
end

subgraph group_delivery["Packaging and evaluation"]
  node_packager["Harbor packaging<br/>[packager.py]"]
  node_scrubber["Security scrubber<br/>[scrubber.py]"]
  node_harbor["Harbor task format<br/>[harbor.py]"]
  node_eval_runner["Blind evaluation<br/>[eval_runner.py]"]
  node_report["Evaluation reports<br/>[report_builder.py]"]
  node_variation["Cross-task matrix"]
end

subgraph group_ledger["State and accounting"]
  node_db[("Factory database<br/>[db.py]")]
  node_states["Candidate state machine<br/>[states.py]"]
  node_billing[("Cost and budget ledger<br/>[ledger.py]")]
end

node_operator(("Factory operator"))
node_model_service{{"Chat model service"}}
node_harbor_service{{"Harbor runtime"}}
node_target_repo["Target repository"]

node_operator -->|"invokes"| node_cli
node_cli -->|"starts run"| node_pipeline
node_pipeline -->|"loads repository"| node_repo_loader
node_repo_loader -->|"checks out"| node_target_repo
node_pipeline -->|"plans features"| node_reverse_planner
node_pipeline -.->|"plans features"| node_forward_planner
node_pipeline -->|"balances candidates"| node_diversity
node_reverse_planner -->|"creates plans"| node_plan_model
node_forward_planner -->|"creates plans"| node_plan_model
node_pipeline -->|"records candidates"| node_db
node_pipeline -->|"marks diversity state"| node_states
node_cli -->|"starts synthesis"| node_synth_runner
node_synth_runner -->|"requests feature spec"| node_llm_router
node_llm_router -->|"requests completion"| node_model_service
node_llm_router -->|"parses and validates"| node_feature_spec
node_synth_runner -->|"audits traceability"| node_rtm
node_synth_runner -->|"checks instruction"| node_blind_reader
node_synth_runner -->|"writes task package"| node_packager
node_synth_runner -->|"meters generation"| node_billing
node_cli -->|"runs gates"| node_gate
node_gate -->|"executes phases"| node_harbor_runner
node_gate -->|"advances on pass"| node_states
node_cli -->|"runs probes"| node_mutation_probe
node_mutation_probe -->|"runs mutants"| node_harbor_runner
node_cli -->|"audits staged task"| node_scrubber
node_cli -->|"packages task"| node_packager
node_packager -->|"scrubs package"| node_scrubber
node_packager -->|"writes Harbor files"| node_harbor
node_harbor_runner -->|"runs task"| node_harbor_service
node_cli -->|"starts evaluation"| node_eval_runner
node_eval_runner -->|"runs evaluation task"| node_harbor_runner
node_eval_runner -->|"checks task visibility"| node_blind_reader
node_eval_runner -->|"records results"| node_db
node_cli -->|"builds report"| node_report
node_report -->|"renders state data"| node_states
node_operator -->|"compares tasks"| node_variation

click node_cli "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/cli.py"
click node_pipeline "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/pipeline.py"
click node_repo_loader "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/ingestion/repo_loader.py"
click node_reverse_planner "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/reverse_extract.py"
click node_forward_planner "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/forward_synth.py"
click node_diversity "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/diversity_guard.py"
click node_plan_model "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/models.py"
click node_synth_runner "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/runner.py"
click node_llm_router "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/llm_router.py"
click node_feature_spec "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/models.py"
click node_rtm "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/rtm.py"
click node_blind_reader "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/blind_reader.py"
click node_gate "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/gate_runner.py"
click node_harbor_runner "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/harbor_runner.py"
click node_mutation_probe "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/mutation_probe.py"
click node_packager "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/packaging/packager.py"
click node_scrubber "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/packaging/scrubber.py"
click node_harbor "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/packaging/harbor.py"
click node_eval_runner "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/evaluation/eval_runner.py"
click node_report "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/evaluation/report_builder.py"
click node_variation "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/evaluation/variation_matrix.py"
click node_db "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/db.py"
click node_states "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/states.py"
click node_billing "https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/billing/ledger.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_pipeline,node_repo_loader,node_reverse_planner,node_forward_planner,node_diversity,node_plan_model toneBlue
class node_synth_runner,node_llm_router,node_feature_spec,node_rtm toneAmber
class node_blind_reader,node_gate,node_harbor_runner,node_mutation_probe toneMint
class node_packager,node_scrubber,node_harbor,node_eval_runner,node_report,node_variation toneRose
class node_db,node_states,node_billing,node_operator,node_model_service,node_harbor_service,node_target_repo toneIndigo
```

## Components

### Intake and planning

- [CLI](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/cli.py): `src/codekiln/cli.py`
- [Pipeline orchestration](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/pipeline.py): `src/codekiln/pipeline.py`
- [Repository loader](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/ingestion/repo_loader.py): `src/codekiln/ingestion/repo_loader.py`
- [Reverse feature extraction](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/reverse_extract.py): `src/codekiln/planner/reverse_extract.py`
- [Forward planning](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/forward_synth.py): `src/codekiln/planner/forward_synth.py`
- [Difficulty and diversity](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/diversity_guard.py): `src/codekiln/planner/diversity_guard.py`
- [Candidate plan](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/planner/models.py): `src/codekiln/planner/models.py`

### Task synthesis

- [Synthesis runner](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/runner.py): `src/codekiln/synthesis/runner.py`
- [LLM router](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/llm_router.py): `src/codekiln/synthesis/llm_router.py`
- [Feature specification](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/models.py): `src/codekiln/synthesis/models.py`
- [Requirement-test audit](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/synthesis/rtm.py): `src/codekiln/synthesis/rtm.py`

### Trust and validation

- [Blind-reader lint](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/blind_reader.py): `src/codekiln/validation/blind_reader.py`
- [Execution gate](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/gate_runner.py): `src/codekiln/validation/gate_runner.py`
- [Harbor task runner](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/harbor_runner.py): `src/codekiln/validation/harbor_runner.py`
- [Mutation probes](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/validation/mutation_probe.py): `src/codekiln/validation/mutation_probe.py`

### Packaging and evaluation

- [Harbor packaging](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/packaging/packager.py): `src/codekiln/packaging/packager.py`
- [Security scrubber](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/packaging/scrubber.py): `src/codekiln/packaging/scrubber.py`
- [Harbor task format](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/packaging/harbor.py): `src/codekiln/packaging/harbor.py`
- [Blind evaluation](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/evaluation/eval_runner.py): `src/codekiln/evaluation/eval_runner.py`
- [Evaluation reports](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/evaluation/report_builder.py): `src/codekiln/evaluation/report_builder.py`
- [Cross-task matrix](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/evaluation/variation_matrix.py): `src/codekiln/evaluation/variation_matrix.py`

### State and accounting

- [Factory database](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/db.py): `src/codekiln/db.py`
- [Candidate state machine](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/states.py): `src/codekiln/states.py`
- [Cost and budget ledger](https://github.com/loktrishal-05/codekiln/blob/main/src/codekiln/billing/ledger.py): `src/codekiln/billing/ledger.py`

### Other components

- **Factory operator**
- **Chat model service**
- **Harbor runtime**
- **Target repository**

## Connections

- Factory operator → CLI: invokes (evidence: `README.md`)
- CLI → Pipeline orchestration: starts run (evidence: `src/codekiln/cli.py`)
- Pipeline orchestration → Repository loader: loads repository (evidence: `src/codekiln/pipeline.py`)
- Repository loader → Target repository: checks out (evidence: `src/codekiln/ingestion/repo_loader.py`)
- Pipeline orchestration → Reverse feature extraction: plans features (evidence: `src/codekiln/pipeline.py`)
- Pipeline orchestration → Forward planning: plans features
- Pipeline orchestration → Difficulty and diversity: balances candidates (evidence: `src/codekiln/pipeline.py`)
- Reverse feature extraction → Candidate plan: creates plans (evidence: `src/codekiln/planner/reverse_extract.py`)
- Forward planning → Candidate plan: creates plans (evidence: `src/codekiln/planner/forward_synth.py`)
- Pipeline orchestration → Factory database: records candidates (evidence: `src/codekiln/pipeline.py`)
- Pipeline orchestration → Candidate state machine: marks diversity state (evidence: `src/codekiln/pipeline.py`)
- CLI → Synthesis runner: starts synthesis (evidence: `src/codekiln/cli.py`)
- Synthesis runner → LLM router: requests feature spec (evidence: `src/codekiln/synthesis/runner.py`)
- LLM router → Chat model service: requests completion (evidence: `src/codekiln/synthesis/llm_router.py`)
- LLM router → Feature specification: parses and validates (evidence: `src/codekiln/synthesis/llm_router.py`)
- Synthesis runner → Requirement-test audit: audits traceability (evidence: `src/codekiln/synthesis/runner.py`)
- Synthesis runner → Blind-reader lint: checks instruction (evidence: `src/codekiln/synthesis/runner.py`)
- Synthesis runner → Harbor packaging: writes task package (evidence: `src/codekiln/synthesis/runner.py`)
- Synthesis runner → Cost and budget ledger: meters generation (evidence: `src/codekiln/synthesis/runner.py`)
- CLI → Execution gate: runs gates (evidence: `src/codekiln/cli.py`)
- Execution gate → Harbor task runner: executes phases (evidence: `src/codekiln/validation/gate_runner.py`)
- Execution gate → Candidate state machine: advances on pass
- CLI → Mutation probes: runs probes (evidence: `src/codekiln/cli.py`)
- Mutation probes → Harbor task runner: runs mutants (evidence: `src/codekiln/validation/mutation_probe.py`)
- CLI → Security scrubber: audits staged task (evidence: `src/codekiln/cli.py`)
- CLI → Harbor packaging: packages task (evidence: `src/codekiln/cli.py`)
- Harbor packaging → Security scrubber: scrubs package (evidence: `src/codekiln/packaging/packager.py`)
- Harbor packaging → Harbor task format: writes Harbor files (evidence: `src/codekiln/packaging/harbor.py`)
- Harbor task runner → Harbor runtime: runs task (evidence: `README.md`)
- CLI → Blind evaluation: starts evaluation (evidence: `src/codekiln/cli.py`)
- Blind evaluation → Harbor task runner: runs evaluation task (evidence: `src/codekiln/evaluation/eval_runner.py`)
- Blind evaluation → Blind-reader lint: checks task visibility (evidence: `src/codekiln/evaluation/eval_runner.py`)
- Blind evaluation → Factory database: records results (evidence: `src/codekiln/evaluation/eval_runner.py`)
- CLI → Evaluation reports: builds report (evidence: `src/codekiln/cli.py`)
- Evaluation reports → Candidate state machine: renders state data (evidence: `src/codekiln/evaluation/report_builder.py`)
- Factory operator → Cross-task matrix: compares tasks (evidence: `README.md`)
