ifp

Garden Patch Home · Patterns

Dual Representation for Human and Machine Readability

Context

Protocols that prioritize human readability (YAML, Markdown, plain text) resist deterministic serialization — whitespace variations, key ordering, and encoding differences make cryptographic signing unreliable. Protocols that prioritize machine processing (JSON, Protocol Buffers) are difficult for humans to read in a text editor.

Inter-Face Protocol requires both: every message must be auditable by a human in a text editor (IFP-1 Section 5.3), and every message must be signable with deterministic cryptographic operations (IFP-5).

Forces

Solution

Maintain two equivalent representations:

Representation Format Purpose Canonical For
IFP-3 YAML envelope + Markdown body Human reading, text editor review, email rendering Human audit
IFP-4 JSON (RFC 8785 JCS canonical) Signing, transport, machine parsing Cryptographic operations

Conversion between IFP-3 and IFP-4 is defined as lossless for the core message model (IFP-4 Section 4). An agent stores messages in IFP-3 for human audit and converts to IFP-4 for signing and sending.

Consequences

Sources

Relations