Multi-agent LLM systems -” several models exchanging messages within
one session -” pay for context, not intelligence. Every round trip in
natural language or verbose JSON burns tokens re-stating structured
context that a fixed, external schema could carry in a fraction of
the size.
I got tired of watching this happen in my own pipelines, so I built a
small serialization protocol to fix it. Sharing it here in case it's
useful to others hitting the same wall.
Move inter-agent messages from natural language / JSON to short,
positional ASCII identifiers (P1:A2:X0:V4
), resolved against an
external, versioned dictionary.json
. A deterministic Python layer
handles encode/decode -” no model involved in reconstructing meaning,
so there's no hallucination risk on the decode side.
def encode(payload: dict, schema: dict) -> str:
parts = []
for field_name, field_id in schema["fields"].items():
if field_name not in payload:
continue
value = str(payload[field_name])
value_id = schema["values"][field_name][value]
parts.append(f"{field_id}{value_id}")
return ":".join(parts)
Unknown fields or values raise an explicit error instead of guessing -”
the whole point of an external schema is that the model never has to
improvise meaning on decode.
Conceptually this is closer to Protocol Buffers than to prompt
engineering: a fixed contract, not a clever prompt.
Measured on cl100k_base
(industry-standard reference tokenizer):
| Format | Tokens |
|---|---|
| Natural language (RU) | 49 |
| Standard JSON | 38 |
| SCP ASCII ID-stack | 11 |
3.45x fewer tokens than JSON. Full reproducible benchmark script
is in the repo -” run it yourself against your own tokenizer before
trusting these numbers for a cost projection.
Tokenizer vocabularies are trained predominantly on English text, so
non-Latin scripts pay a real, measurable tax. Same sentence, same
meaning, measured multiplier vs. the SCP ID-stack:
| Language | Multiplier vs. SCP |
|---|---|
| English | 1.89x |
| Russian | 5.11x |
| Arabic | 5.56x |
| Japanese | 4.22x |
| Hindi | 9.89x |
Because the ID-stack costs the same regardless of source language (9
tokens either way -” it's just ASCII after encoding), SCP's savings
scale disproportionately for non-English multi-agent deployments.
That's not a marketing angle, it's just what the tokenizer does.
cl100k_base
as a common reference point. If you're deploying against a different model family, re-run the benchmark script against that tokenizer before relying on these numbers.Anthropic and OpenAI both offer ~90% discounts on cached input tokens.
Three conditions determine whether SCP's savings actually materialize
in a caching setup:
python mvp/encoder_decoder.py encode '{"system": "Quantumoan", "version": "4", "action": "paradigm_shift", "target": "cognitive_profiles_alignment"}'
python mvp/encoder_decoder.py decode "P1:V4:A2:X0"
Repo (AGPLv3): https://github.com/andrey-architect/scp-protocol
Would genuinely like to know where this breaks -” issues and PRs welcome.