- Schema:
proto/3dcf.proto(compiled viaprost_build). - Serialized with Protobuf, then compressed with
zstd(level 3, multi-threaded when available). - Cells are delta-encoded along
(z, x, y)axes for compactness;code_idholds the 32-byteblake3hash of the normalized cell text. dictmapscode_id → payloadto guarantee lossless decode.numguardsembed numeric checksum guards for high-value measurements;3dcf decodewarns whenever the decoded payload disagrees with the recorded checksum/units so numeric integrity regressions are visible immediately.
- 1:1 serde representation of the document structure.
- Hashes are hex strings, dict encoded as
[ ["hash", "payload"], ... ]to preserve ordering.
- Prompt-friendly textual serialization implemented in
TextSerializer. - Header & footer:
<ctx3d grid=coarse codeset=HASH256 preset=reports budget=256>- Optional
grammar: --select "z=0,x=0..1024,y=0..4096" </ctx3d>closing tag so parsers can sanity check completeness.
- Body lines follow the grammar:
(z=0,x=10,y=20,w=700,h=20,code=0011223344556677,rle=0,imp=120,type=TEXT) "Preview text"- Coordinates are absolute,
codeis the first 16 hex chars of the 32-byte payload hash, previews are JSON-style quoted with"escaped.
- Table previews:
automode emits[csv ...]snippets for small tables, e.g.[csv Quarter, Revenue, Cost | Q1, 10, 5].- For large tables or when
dimmode is forced:[table rows=6 cols=4]summarises dimensions.
- Serializer knobs (via config/CLI) control preview length, table mode, and metadata labels so downstream prompts stay consistent.
Encoding uses page-level importance scores plus a rolling dedup window (configurable via CLI/TOML) so repeated headers/footers collapse into a single macro-token. The .3dcf.txt output therefore maintains reading order while delivering ≥×5 token savings on typical report/slides presets.