Heavy Duty Zig - a commercial truck diagnostics library for Zig

Heavy Duty Zig


Heavy Duty Zig is a Zig library for observing and decoding diagnostic traffic from heavy-duty commercial vehicles.

GitHub: https://github.com/f-drakeland/heavy-duty-zig

The part I found most interesting while building it was that simply decoding messages wasn’t enough for what I wanted to do. I wanted to preserve how a diagnostic observation was derived, including which captured frames contributed bytes to a reconstructed message, while being careful not to turn correlations into claims the data doesn’t actually prove.

For example, the included demo carries the same synthetic component-identification payload through two different paths: J1939 RTS/CTS and a multi-frame UDS response over ISO-TP. HDZ reconstructs both, preserves the contributing frame occurrences, and records that the payloads are identical. It deliberately does not conclude from that alone that both observations came from the same physical ECU.

That distinction has influenced quite a bit of the design. Transport reassembly owns transport state, capture orchestration owns occurrence lineage, and higher-level correlation operates on preserved evidence rather than creating stronger identity claims underneath it.

The library also uses bounded, caller-controlled state rather than hidden allocation, and the package has no external dependencies. There is a public synthetic capture and expected output in the repository, so the evidence model can be exercised directly with:

zig build demo

and the complete repository verification is:

zig build check

I’d particularly appreciate feedback on the Zig API design, bounded-state approach, and the separation between protocol decoding, evidence lineage, and higher-level correlation.

Supported Zig versions

Zig 0.17.0

AI / LLM usage disclosure

AI was used during development as a programming and research assistant. I used it to discuss architecture, review code and protocol behavior, identify edge cases, draft tests and documentation, and help investigate implementation problems.

The project was not generated from a single prompt or accepted without review. I made the architecture and scope decisions, worked through the implementation iteratively, ran and inspected the tests and diagnostic captures, challenged suggested designs when they did not fit the evidence model, and validated the resulting behavior before incorporating changes.

4 Likes