Knolo KIP-0003: Canonical CBOR and Domain-Separated Digests
Knolo KIP-0003 fixes one encoding per value: a strict CBOR subset, sorted keys, re-encode checks, and sha256 digests prefixed by purpose so no hash proves the wrong thing.
Knolo is the open-source, local-first Knowledge Image runtime and format from Hive AI, released under Apache-2.0 with the reference runtime on npm as @knolo/core. Every Knolo verification claim, from a state root to a query receipt, rests on one small rule: the same data must always become the same bytes, and the same bytes must always hash the same way for the same purpose. That rule is KIP-0003, canonical encoding and digest domains, listed with the other proposals on the Knolo KIPs page. Its status is "implemented foundation contract".
Knolo V5 uses a strict CBOR subset
Knolo V5 Knowledge Images use definite-length CBOR only. The supported foundation subset is small on purpose:
- null and booleans
- unsigned and negative integers
- byte strings and UTF-8 text
- arrays, and maps with text keys
Anything outside that set is rejected: indefinite-length values, floats, tags and duplicate map keys. Each of those either has more than one valid encoding or leaves room for two readers to disagree about what a value is. Leaving them out removes the ambiguity before it can reach a digest.
Knolo canonical form: one value, one encoding
Within the subset, KIP-0003 fixes the remaining choices:
- Maps are sorted by the encoded UTF-8 bytes of their text keys.
- Integers use the shortest valid CBOR representation.
- A decoded payload must re-encode to identical bytes before it is accepted.
The last rule is the important one. A Knolo reader does not just parse; it checks that what it parsed round-trips to exactly what it received. Non-canonical input is refused rather than normalized, so two independent Knolo implementations can compare bytes instead of comparing interpretations. That is what makes Knolo conformance and compatibility claims testable.
Knolo digest domains
Digests are rendered as sha256- followed by lowercase hexadecimal. The hash input is not the payload alone:
UTF8("knolo:<domain>:v1\0") || payload
The foundation domains are object, object-root, event, event-root, transaction, transaction-root, segment, commit, state, schema, policy, runtime, view, receipt and superblock.
Domain separation means a digest carries its purpose. The same bytes hashed as an object and as a receipt produce different digests, so a value computed for one role cannot be presented as proof of another. The v1 in the prefix leaves room for a future version without reinterpreting old digests.
Knolo V4 to V5 migration stays verifiable
KIP-0003 also keeps the older format intact. The V4 reader and retrieval contract are unchanged. Migration to V5 verifies the source artifact first, then creates a deterministic genesis image and a receipt that records the source digest, the destination state root, and the mappings from legacy blocks to objects. Anyone holding the V4 file can check the migration rather than trust it.
Why this matters for the open Knolo ecosystem
An open format is only as open as its byte rules. Because KIP-0003 is short and public, a second Knolo runtime in another language can implement it, run the shared fixtures, and show it agrees on every digest. Later KIPs, such as bounded EQL query roots and append-only keyrings, all build on this foundation.
- Read the full text of Knolo KIP-0003 on GitHub.
- See how the Knolo specifications and KIP process work on knolo.org.
- Build with the reference runtime from the Knolo developer docs on knolo.dev.
knolo · kip · canonical-encoding · specifications · open-technology
