Design
Why this exists#
LLM agents cannot reliably decode hex, base64 or binary formats by reading them: they produce plausible but wrong bytes. The usual workaround, a throwaway Python script, routinely gets the edge cases wrong: missing base64 padding, URL-safe alphabets, 10-byte negative varints, zigzag applied to the wrong type, or a LEN field that is a submessage being printed as garbage text.
bytepeel moves the byte-exact work into a tested tool and leaves the judgment to the agent. When the bytes are genuinely ambiguous, it reports ranked alternatives instead of guessing silently.
Principles#
- Never resolve ambiguity silently. LEN fields carry ranked
alts; varints carry every integer view (uint,int,sint). - Every node and field has a byte range, so results can be cited and sliced.
- Deterministic. The same input and options always give byte-identical JSON.
- Errors are data. Stable
codes and byteoffsets let an agent fix its call in one turn. - Zero dependencies in
bytepeel-core. Small, auditable, builds anywhere including WASM. - Token-frugal output. Compact JSON, long text and hex capped (with
"truncated":true), and--getto extract exactly one field.