Compact Spatial Package
CSP Simulator
Interactive simulator for CSP (Compact Spatial Package) — a binary micro-packet format that encodes precise spatial position, context, and confidence in 9–17 bytes.
v0.1 DRAFTWhat is CSP?
CSP stands for Compact Spatial Package — a structured binary format designed to answer the question "where is it, what is it, and how sure are you?" in the fewest bytes possible.
A single CSP package encodes three layers of information into a flat byte sequence:
Why CSP?
Most spatial data formats are verbose — GeoJSON, KML, and NMEA sentences measure in hundreds of bytes to kilobytes. CSP compresses the same information into a deterministic binary layout that fits in a single radio burst, a BLE advertisement, or a UDP datagram with room to spare.
Coordinates All the Way Down
Every layer of CSP is the same operation: bytes encode a coordinate, a reference space (atlas) gives that coordinate meaning. The structure is fractal — the same pattern repeats at every level.
| Layer | Bytes | Coordinate | Atlas | Resolution |
|---|---|---|---|---|
| Position | MGRS + offset | Grid cell + 3D delta | Structure overlay | "Building 7, Floor 4, SW window 4" |
| Semantics | 4 uint8 fields | Point in concept space | Semantic atlas | "HOSTILE WEAPON_SYSTEM" or novel blend |
| Confidence | 1 uint8 | Point on [0, 1] | Threshold map | Gating decisions per consumer |
| Consumer | Profile ID | Point in task space | Projection functions | Speech / waypoint / marker / fire mission |
From enums to coordinates
The semantic layer's four enum fields (eventType, entityClass, priority, sourceType) are already a 4D vector. Named enum values are just labeled points in this space. The space between them is valid — a coordinate at (0.7 × HOSTILE, 0.3 × HAZARD) represents a concept that doesn't need a name to be useful. This turns ~1,440 enum combinations into a continuous manifold.
The ML bridge
Any model that produces a latent vector can quantize it into semantic coordinates. An unknown entity detected by a sensor becomes a point in semantic space. Consumers interpret it by proximity to known regions — no enum extension, no schema migration, no retraining. The same 5 bytes that currently say "HOSTILE" could say "73% hostile, 22% hazard, 5% unknown" as a coordinate.
Packet Layout
+--------+----------+---------+----------+------+------------+
| HEADER | ANCHOR? | MGRS | OFFSET | CONF | SEMANTIC? |
| 1 byte | 0-1 B | 3-5 B | variable | 1 B | 0-5 bytes |
+--------+----------+---------+----------+------+------------+
HEADER byte [VV][OO][PP][S][A]
VV = version (2 bits) OO = offset type (2 bits)
PP = precision tier (2 bits) S = semantic present (1 bit)
A = anchor override (1 bit)
OFFSET TYPE SIZE FIELDS
00 Raw 6 B dx(i16) dy(i16) dz(i16)
01 Structural 5 B struct_id(u16) floor(u8) facade|depth(u8) unit(u8)
02 Topological 5 B net_id(u8) seg_id(u16) param(u8) lat|vert(u8)
03 Extended 2+N B type(u8) length(u8) payload(N)
PRECISION TIER MGRS SCALE CEP
00 Coarse 3 B 1.0 m/u ~10m
01 Operational 4 B 0.1 m/u ~1m
02 Precision 5 B 0.01 m/u ~0.1m
03 Exact 5 B 0.001 m/u ~0.01mArchitecture
+-------------------+
| CSP ENCODER |
| CspPackage -> u8[]|
+---------+---------+
|
v
+--------+--------+--------+--------+
| | | | |
v v v v v
+-------+ +------+ +-----+ +------+ +--------+
|HEADER | |ANCHOR| |MGRS | |OFFSET| |SEMANTIC|
|1 byte | |0-1 B | |3-5B | |var. | |0-5 B |
+-------+ +------+ +-----+ +------+ +--------+
|
v
+-------------------+
| CSP DECODER |
| u8[] -> CspPackage|
+---------+---------+
|
+-------+-------+-------+--------+
v v v v v
+------+ +------+ +-----+ +------+
|AUDIO | | NAV | | TAC | |FIRES |
| TTS | |COORD | | MAP | | FDC |
+------+ +------+ +-----+ +------+
Consumer Profile Projections