# kalicocrew/kalico architecture

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

- Interactive diagram: https://gitdiagram.com/kalicocrew/kalico
- Repository: https://github.com/kalicocrew/kalico

## Overview

Kalico is a community-maintained Klipper firmware fork for controlling 3D printers. A user configures the printer and submits G-code; the host parses commands, plans motion and coordinates heaters and peripherals, then communicates timed commands to MCU firmware that drives hardware. The repository also provides calibration, probing, sensor and plugin capabilities. The graph reflects documented product stages and the available source-index references; many host-to-host and host-to-MCU calls are not shown in excerpts, so those links are marked unverified rather than asserted as inspected.

Main entry points: [`klippy/gcode.py`](https://github.com/kalicocrew/kalico/blob/main/klippy/gcode.py) (G-code parser), [`klippy/extras`](https://github.com/kalicocrew/kalico/tree/main/klippy/extras) (Printer extensions), [`klippy/toolhead.py`](https://github.com/kalicocrew/kalico/blob/main/klippy/toolhead.py) (Motion planner), [`klippy/mcu.py`](https://github.com/kalicocrew/kalico/blob/main/klippy/mcu.py) (MCU interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host runtime"]
  node_config["Configuration<br/>[configfile.py]"]
  node_runtime["Printer runtime<br/>[klippy.py]"]
  node_gcode["G-code parser<br/>[gcode.py]"]
  node_reactor["Event reactor<br/>[reactor.py]"]
  node_webhooks["Webhook API<br/>[webhooks.py]"]
end

subgraph group_motion["Motion control"]
  node_toolhead["Motion planner<br/>[toolhead.py]"]
  node_kinematics["Kinematics<br/>[cartesian.py]"]
  node_stepper["Stepper control<br/>[stepper.py]"]
end

subgraph group_hardware["Hardware control"]
  node_heaters["Heater control<br/>[heaters.py]"]
  node_fan["Fan control<br/>[fan.py]"]
  node_mcu["MCU interface<br/>[mcu.py]"]
  node_serial["Serial transport<br/>[serialhdl.py]"]
  node_clocksync["Clock synchronization<br/>[clocksync.py]"]
end

subgraph group_firmware["MCU firmware"]
  node_firmware["MCU scheduler<br/>[sched.h]"]
  node_commands["Firmware commands<br/>[command.h]"]
end

subgraph group_features["Printer features"]
  node_extras["Printer extensions"]
  node_probing["Probe and leveling<br/>[probe.py]"]
  node_calibration["Motion calibration"]
  node_plugins["User plugins"]
end

node_user(("Printer operator"))
node_printer["3D printer hardware"]

node_user -.->|"configures"| node_config
node_user -.->|"submits G-code"| node_gcode
node_config -.->|"configures"| node_runtime
node_runtime -.->|"dispatches"| node_gcode
node_gcode -->|"uses events"| node_reactor
node_webhooks -->|"routes commands"| node_gcode
node_gcode -.->|"requests motion"| node_toolhead
node_toolhead -.->|"calculates motion"| node_kinematics
node_kinematics -.->|"sets steppers"| node_stepper
node_toolhead -.->|"queues commands"| node_mcu
node_mcu -.->|"transmits"| node_serial
node_mcu -.->|"synchronizes clocks"| node_clocksync
node_serial -.->|"sends commands"| node_commands
node_commands -->|"dispatches"| node_firmware
node_firmware -.->|"drives hardware"| node_printer
node_extras -.->|"provides control"| node_heaters
node_extras -.->|"provides control"| node_fan
node_extras -->|"includes probes"| node_probing
node_extras -->|"includes calibration"| node_calibration
node_plugins -.->|"extends runtime"| node_runtime
node_probing -.->|"measures bed"| node_printer
node_heaters -.->|"controls temperature"| node_printer
node_fan -.->|"controls cooling"| node_printer

click node_config "https://github.com/kalicocrew/kalico/blob/main/klippy/configfile.py"
click node_runtime "https://github.com/kalicocrew/kalico/blob/main/klippy/klippy.py"
click node_gcode "https://github.com/kalicocrew/kalico/blob/main/klippy/gcode.py"
click node_reactor "https://github.com/kalicocrew/kalico/blob/main/klippy/reactor.py"
click node_webhooks "https://github.com/kalicocrew/kalico/blob/main/klippy/webhooks.py"
click node_toolhead "https://github.com/kalicocrew/kalico/blob/main/klippy/toolhead.py"
click node_kinematics "https://github.com/kalicocrew/kalico/blob/main/klippy/kinematics/cartesian.py"
click node_stepper "https://github.com/kalicocrew/kalico/blob/main/klippy/stepper.py"
click node_heaters "https://github.com/kalicocrew/kalico/blob/main/klippy/extras/heaters.py"
click node_fan "https://github.com/kalicocrew/kalico/blob/main/klippy/extras/fan.py"
click node_mcu "https://github.com/kalicocrew/kalico/blob/main/klippy/mcu.py"
click node_serial "https://github.com/kalicocrew/kalico/blob/main/klippy/serialhdl.py"
click node_clocksync "https://github.com/kalicocrew/kalico/blob/main/klippy/clocksync.py"
click node_firmware "https://github.com/kalicocrew/kalico/blob/main/src/sched.h"
click node_commands "https://github.com/kalicocrew/kalico/blob/main/src/command.h"
click node_extras "https://github.com/kalicocrew/kalico/tree/main/klippy/extras"
click node_probing "https://github.com/kalicocrew/kalico/blob/main/klippy/extras/probe.py"
click node_calibration "https://github.com/kalicocrew/kalico/blob/main/klippy/extras/resonance_tester.py"
click node_plugins "https://github.com/kalicocrew/kalico/tree/main/klippy/plugins"

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_config,node_runtime,node_gcode,node_reactor,node_webhooks toneBlue
class node_toolhead,node_kinematics,node_stepper toneAmber
class node_heaters,node_fan,node_mcu,node_serial,node_clocksync toneMint
class node_firmware,node_commands toneRose
class node_extras,node_probing,node_calibration,node_plugins,node_user,node_printer toneIndigo
```

## Components

### Host runtime

- [Configuration](https://github.com/kalicocrew/kalico/blob/main/klippy/configfile.py): `klippy/configfile.py`
- [Printer runtime](https://github.com/kalicocrew/kalico/blob/main/klippy/klippy.py): `klippy/klippy.py`
- [G-code parser](https://github.com/kalicocrew/kalico/blob/main/klippy/gcode.py): `klippy/gcode.py`
- [Event reactor](https://github.com/kalicocrew/kalico/blob/main/klippy/reactor.py): `klippy/reactor.py`
- [Webhook API](https://github.com/kalicocrew/kalico/blob/main/klippy/webhooks.py): `klippy/webhooks.py`

### Motion control

- [Motion planner](https://github.com/kalicocrew/kalico/blob/main/klippy/toolhead.py): `klippy/toolhead.py`
- [Kinematics](https://github.com/kalicocrew/kalico/blob/main/klippy/kinematics/cartesian.py): `klippy/kinematics/cartesian.py`
- [Stepper control](https://github.com/kalicocrew/kalico/blob/main/klippy/stepper.py): `klippy/stepper.py`

### Hardware control

- [Heater control](https://github.com/kalicocrew/kalico/blob/main/klippy/extras/heaters.py): `klippy/extras/heaters.py`
- [Fan control](https://github.com/kalicocrew/kalico/blob/main/klippy/extras/fan.py): `klippy/extras/fan.py`
- [MCU interface](https://github.com/kalicocrew/kalico/blob/main/klippy/mcu.py): `klippy/mcu.py`
- [Serial transport](https://github.com/kalicocrew/kalico/blob/main/klippy/serialhdl.py): `klippy/serialhdl.py`
- [Clock synchronization](https://github.com/kalicocrew/kalico/blob/main/klippy/clocksync.py): `klippy/clocksync.py`

### MCU firmware

- [MCU scheduler](https://github.com/kalicocrew/kalico/blob/main/src/sched.h): `src/sched.h`
- [Firmware commands](https://github.com/kalicocrew/kalico/blob/main/src/command.h): `src/command.h`

### Printer features

- [Printer extensions](https://github.com/kalicocrew/kalico/tree/main/klippy/extras): `klippy/extras`
- [Probe and leveling](https://github.com/kalicocrew/kalico/blob/main/klippy/extras/probe.py): `klippy/extras/probe.py`
- [Motion calibration](https://github.com/kalicocrew/kalico/blob/main/klippy/extras/resonance_tester.py): `klippy/extras/resonance_tester.py`
- [User plugins](https://github.com/kalicocrew/kalico/tree/main/klippy/plugins): `klippy/plugins`

### Other components

- **Printer operator**
- **3D printer hardware**

## Connections

- Printer operator → Configuration: configures
- Printer operator → G-code parser: submits G-code
- Configuration → Printer runtime: configures
- Printer runtime → G-code parser: dispatches
- G-code parser → Event reactor: uses events (evidence: `klippy/gcode.py`)
- Webhook API → G-code parser: routes commands (evidence: `klippy/webhooks.py`)
- G-code parser → Motion planner: requests motion
- Motion planner → Kinematics: calculates motion
- Kinematics → Stepper control: sets steppers
- Motion planner → MCU interface: queues commands
- MCU interface → Serial transport: transmits
- MCU interface → Clock synchronization: synchronizes clocks
- Serial transport → Firmware commands: sends commands
- Firmware commands → MCU scheduler: dispatches (evidence: `src/command.h`)
- MCU scheduler → 3D printer hardware: drives hardware
- Printer extensions → Heater control: provides control
- Printer extensions → Fan control: provides control (evidence: `klippy/extras/controller_fan.py`)
- Printer extensions → Probe and leveling: includes probes
- Printer extensions → Motion calibration: includes calibration
- User plugins → Printer runtime: extends runtime
- Probe and leveling → 3D printer hardware: measures bed
- Heater control → 3D printer hardware: controls temperature
- Fan control → 3D printer hardware: controls cooling
