Skip to main content

Crate aura_toon

Crate aura_toon 

Source
Expand description

§aura-toon

Lightweight encoder for TOON — Token-Oriented Object Notation.

TOON is a JSON-compatible serialization format designed to reduce token count when feeding structured data to LLMs. For typical payloads it produces 30–60% fewer tokens than equivalent JSON, with a tabular form for arrays of homogeneous objects.

Spec: https://github.com/toon-format/spec

§Example

use serde_json::json;

let value = json!({
    "snapshots": [
        {"file": "main.rs", "trigger": "watcher", "ts": 123},
        {"file": "lib.rs",  "trigger": "mcp",     "ts": 456}
    ]
});

let toon = aura_toon::encode(&value);
assert!(toon.contains("snapshots[2]{file,trigger,ts}:"));

§Caveman Mode

For natural-language strings, caveman() strips articles, filler words, hedging, and pleasantries — producing terse, fragment-style output that uses 20–40% fewer tokens while preserving all technical meaning.

let verbose = "I would be happy to help you with that. The function is currently \
               failing because the variable is not properly initialized.";
let terse = aura_toon::caveman(verbose);
assert!(terse.contains("function"));
assert!(!terse.contains("would be happy"));

Originally extracted from Aura, the semantic version control engine.

Functions§

caveman
Strip filler words, articles, hedging, and pleasantries from prose.
encode
Encode a serde_json::Value as a TOON string.