You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Token-Oriented Object Notation (TOON, https://github.com/toon-format/toon) is a schema-aware JSON replacement designed for LLM prompts. It cuts ~40% of tokens on arrays of uniform objects by emitting the schema once in a header (users[3]{id,name,role}:) and then rows.
Many gh/kubectl/aws/gcloud/az outputs are exactly this shape (--json, -o json, --output json, --format json). Squeez currently runs them through CloudHandler which only strips noise — never reformats. Free 40% on a large class of common dev commands.
Goal
Add an opt-in TOON re-encoding step to the CloudHandler (and any other JSON-emitting handlers later). When the captured output is a JSON array of flat, uniformly-shaped objects, emit TOON in place; otherwise pass through unchanged.
Returns Some(toon) only when input is a top-level JSON array of flat objects with identical key sets in identical order, and all values are primitives (string / number / bool / null).
Returns None for any deviation — never produces lossy output.
CloudHandler calls it before its existing pipeline; if Some, returns the TOON lines.
Unit tests cover: gh PR list shape, kubectl pods, aws ec2 describe, heterogeneous keys (must reject), nested values (must reject), single object (must reject), empty array.
Zero new runtime deps.
Out of scope
Streaming JSON (NDJSON from docker ps --format '{{json .}}') — handled in a follow-up.
cargo metadata — nested structures, not worth TOON.
Activity
jhonatanjunio commentedon May 18, 2026
Moved to upstream claudioemmanuel/squeez. Superseded.
feat(intensity): compress harder when output will be re-read many times