What is TOON?
TOON (Token-Oriented Object Notation) is a compact data serialization format designed specifically for LLM prompts. It encodes structured data using 40-50% fewer tokens than JSON while remaining human-readable and LLM-parseable. ArgentOS uses TOON throughout the system wherever structured data needs to be injected into agent prompts.Why Not Just Use JSON?
Every token in an LLM prompt costs money and takes up context window space. When you inject a 50-item task list or a 20-step workflow history into an agent’s prompt, JSON’s verbosity adds up fast:| Format | Tokens (typical) | Savings |
|---|---|---|
| JSON (pretty) | 1,000 | baseline |
| JSON (compact) | 750 | 25% |
| TOON | 450-550 | 40-50% |
Where ArgentOS Uses TOON
TOON is integrated into 9 core systems viasrc/utils/toon-encoding.ts:
Workflow Pipeline Context
When an agent step runs inside a workflow, it receives the full pipeline history encoded as TOON:Agent Handoffs
When one agent passes work to another in a multi-agent workflow:Memory Recall Results
When the agent recalls memories, results are TOON-encoded before injection:SpecForge Task Breakdowns
When SpecForge creates atomic tasks for a project:Other Integration Points
- Knowledge Library results — RAG search results encoded for prompt injection
- Team status — multi-agent family status updates
- Tool results — uniform tool output arrays (search results, file listings)
- SIS active lessons — self-improving system lesson injection
- Cron definitions — scheduled task summaries
How It Works in Code
The encoding layer atsrc/utils/toon-encoding.ts provides typed functions:
Decoding
TOON content can be decoded back to structured data:JSON.parse if TOON decoding fails.
