Documentation
¶
Overview ¶
Package gcf implements a LOSSLESS columnar re-encoding of homogeneous JSON arrays — the highest-leverage harvest from the OmniRoute compression study (see OMNIROUTE-HARVEST-DESIGN-2026-07-23.md). Tool outputs are dominated by arrays of flat objects (file matches, directory listings, test rows); their JSON repeats every key on every element. GCF states the keys once:
[{"id":1,"name":"a","ok":true}, ...x20]
becomes
```gcf-generic
GCF profile=generic
## [20]{id,name,ok}
1|a|true
...
```
Losslessness is the contract, proven the way the upstream proves it: the decoder below is the ROUND-TRIP ORACLE — production never decodes (the model reads the compact form), but every encoder path must deep-equal back through Decode in tests and fuzz. Anything the codec cannot round-trip bit-honestly it refuses to touch (fail-closed to the original text): arrays under minRows, non-object elements, nested values, unsafe field names, or an encoding that is not strictly smaller.
Format origin: the GCF generic profile from blackwell-systems/gcf-typescript (MIT), vendored into OmniRoute (MIT) and reimplemented here from its observed behavior — scalars-only, no v3.2 nested flattening. Attribution carried in NOTICE per both licenses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compact ¶
Compact rewrites every eligible JSON array in text into its GCF block: the whole text when it IS a JSON array, otherwise each ```json fenced block whose body qualifies. Returns (text, false) unchanged when nothing was eligible or nothing got smaller.
func Decode ¶
Decode is the ROUND-TRIP ORACLE. Production never calls it — the model reads the compact form directly — but every encoding must decode back to deep-equal rows in tests and fuzz, or the encoder is not lossless and may not ship. Mirrors the upstream design (their reconstructHeadroom exists solely as the reversibility proof).
Input is one GCF block exactly as Compact emits it (fence lines included). Output rows carry the same typing parseEligible produced: string, json.Number, bool, nil; absent keys are absent (not nil).
func IsCompacted ¶
IsCompacted reports whether text already carries a GCF block, so callers (and re-compaction passes) never double-encode.
Types ¶
This section is empty.