How Kendafi Works
Kendafi uses a weight-based state machine to track parcels through 6 stages. Each event adds or subtracts weight based on a calculated pivot.
The pivot is determined by: (current_state + event_code) % 3
369
Fast Track — weight +2
366
Standard — weight +1
306
Delayed — weight -1
When weight reaches the operating cap of 8 (not 9), the parcel advances to the next state and weight resets to zero.
The 6 states are: New Parcel → Assigned to Matatu → At Terminal → In Transit → Arrived → Out for Delivery.