Pronto sim

pronto.stream · bilim merkezi

Cognitive Wire Format (CWF v3): Developer Specification

Knowledge Hub / Token Optimization
TECHNICAL SPECIFICATION · COGNITIVE WIRE FORMAT
Published by pronto.stream Protocol Working Group Updated September 2026 CWF v3 ~50% PROMPT TOKEN SAVING

When an autonomous AI agent polls a REST or JSON-RPC API inside a continuous control loop, a staggering share of every response is structural boilerplate: repeated property keys, quotation marks, curly braces, and whitespace indentation. An agent pays for this boilerplate twice: once across network bandwidth, and a second time in model inference context costs.

Cognitive Wire Format (CWF) is a line-oriented, human-readable text schema designed specifically for high-cadence AI agent signal delivery. It achieves about half the prompt tokens of standard indented JSON without sacrificing data fidelity, schema validation, or provenance tracing.

Core Design Rule: Intern the Opaque, Inline the Meaningful

An LLM reasons about observations, numbers, places, severities, and timestamps. It cites URLs and correlation IDs, but never reasons about their internal character sequences. CWF v3 hoists repeated schema definitions, URLs, and references into a concise response header, abbreviates correlation IDs to deterministic 8-character base-36 handles, and keeps meaningful values verbatim and uncompressed.

01
01

Empirical Token Reduction Benchmarks

Every figure published here is measured directly using OpenAI's cl100k_base tokenizer across verified signal suites in the test harness (evidence-blocks.json).

Benchmark Suite Indented JSON Compact JSON CWF v3 Savings vs Indented Savings vs Compact
Mixed Batch 1,266 tokens 688 tokens 45.7% fewer
50 Heterogeneous Signals 6,202 tokens 4,553 tokens 3,060 tokens 50.7% fewer 32.8% fewer
50 Numeric Telemetry Signals 2,030 tokens 57.4% fewer 36.9% fewer

Against indented JSON — which is what nearly all HTTP debugging surfaces and standard REST endpoints return — CWF cuts prompt costs by 45.7% to 57.4%. Against minified, compact JSON (no indentation or spaces), the net reduction remains 32.8% to 36.9%.

02
02

Wire Grammar and Structure

A CWF response consists of a response-scoped preamble followed by pipe-delimited (|) data rows:

CWF|3|pronto.stream
META|t:1785672000|rows:2|matched:2|fresh:100%|span:120s
REF|h1:https://earthquake.usgs.gov|h2:https://api.weather.gov
SCHEMA|SEIS:mag,depth_km,lat,lon|CLIM:temp_c,rh_pct,wspd_kts
S|8f93a102|12|USGS|seis_us7000m9|SEIS:mag=4.8,depth=10.2,lat=34.05,lon=-118.24|prov:h1
S|b4k291df|4|NWS|warn_78821|CLIM:temp=18.4,rh=72,wspd=14|prov:h2

Preamble Directives

  • CWF|3|<host> — Declares protocol version 3 and origin server.
  • META|t:...|rows:... — Carries batch timestamps, matched counts, observation window span, and freshness rates.
  • REF|h<n>:<url> — Interns long URLs into 2-character handles (h1, h2) to eliminate link duplication.
  • SCHEMA|<domain>:fields... — Establishes field orders for structured numeric sensor bursts.
  • REL|echo|handle1|handle2|0.94|shared:topic — Out-of-band link graph indicating correlated signals without duplicate round trips.

Row Schema (TAG|handle|Δseconds|provider|message_id|fields...)

  • TAG — Single-letter record classification: S (Signal), F (Fused intelligence), E (Event alert).
  • Handle — Deterministic 8-character base-36 correlation identifier (8f93a102). Across a 2,000-signal live rolling window, 368 provides a collision probability under 10-6.
  • Δseconds — Observation age in seconds relative to batch timestamp, avoiding redundant ISO-8601 strings.
  • Provider & Message ID — Origin authority (e.g., USGS, NOAA, SEC, FRED) and native publication ID.
  • Labelled Fields & Provenance — Concise key-value pairs or schema values followed by the source reference tag (prov:h1) or explicit prov:missing if no direct web citation was provided.
03
03

Agent Integration & Parsing

CWF requires no custom binary deserializer. In Python, an agent splits lines and parses records in under 10 lines of code:

def parse_cwf(text: str):
    records = []
    refs = {}
    for line in text.strip().splitlines():
        if not line or line.startswith("#"):
            continue
        parts = line.split("|")
        tag = parts[0]
        if tag == "REF":
            for ref in parts[1:]:
                k, url = ref.split(":", 1)
                refs[k] = url
        elif tag in ("S", "F"):
            records.append({
                "type": tag,
                "handle": parts[1],
                "age_sec": int(parts[2]),
                "provider": parts[3],
                "id": parts[4],
                "payload": parts[5:],
            })
    return records, refs
04
04

Live Availability

All 15 tools on the pronto.stream Model Context Protocol (/mcp) endpoint emit CWF by default. HTTP callers can also pass Accept: text/x-cwf or query parameter ?format=cwf to any signal query endpoint.