Koder Document eXchange (KDX)

  • Area: Foundation (Engines / Lang)
  • Path: engines/lang/kdx
  • Kind: Open universal document format + render-core
  • Spec: meta/docs/stack/specs/kdx/format.kmd v0.1 (ratified by kdx-RFC-001, 2026-06-09)
  • Status: v0.1 pre-normative — phase F1 (Core/reflow) in progress
  • Landing: engines/lang/kdx/landing/index.html (live at https://kdx.koder.dev, prd)

Role in the stack

KDX (.kdx) is the Koder Stack's universal document format — portable and self-contained like PDF, structured like the web. Its founding principle: meaning is the source; layout is a projection. The document stores the semantic tree (KMD-AST) as the single source of truth; fixed page layout is a derived, cacheable projection. Accessibility, search, selection, reflow and pagination all derive from the same source by construction.

KDX is not a monolithic format — it composes existing Stack layers:

Layer Owner Role
Meaning KMD (engines/lang/kmd) prose, structure, tables, refs, data, forms
Marks KVG (engines/lang/kvg) every visual mark + fixed-page projection
Page/theme KMD extension (kmd-RFC-001) page sizemarginsmasters/cover + theme
Container ZIP + kpkg-class manifest [F3] embedded fontsimagesICC/data
Render render-core (engines/lang/kdx) reflow · paged · export

Boundary rule (normative): text flows as text (embedded fonts, selectablesearchableaccessible), never as KVG outlines.

Render backends (all from the same parseKdx AST)

Backend Projection Output
pdf_writer.dart paged native PDF (subset fonts, ToUnicode, links, outline)
kdx_wasm.dart + <koder-kdx> paged box-tree JSON → <canvas> (web/Dok), byte-faithful to PDF
html_writer.dart reflow semantic/accessible HTML with Verge stylesheet

Profiles

Core (floor) · Interactive [F4] · Motion [F4] · Solid [F4] · Print [F2] · Archive [F4] — progressive conformance, each degrades gracefully to Core.

Primary couplings

Consumer Relationship
products/dev/dok Reference editor (documents)
products/horizontal/kad Reference editor for embedded KVG figures
engines/lang/kmd Meaning layer + page/theme contract
engines/lang/kvg Marks layer + print profile (kvg-RFC-003)

References

  • Spec: meta/docs/stack/specs/kdx/format.kmd
  • RFCs: kdx-RFC-001, kmd-RFC-001, kvg-RFC-003
  • Landing: engines/lang/kdx/landing/ (deployed at kdx.koder.dev, since 2026-06-10)
  • Backlog: engines/lang/kdx/backlog/{pending,in-progress,done}/ (prefix KDX)
  • Initiative: meta/docs/stack/backlog/pending/133-kdx-universal-document-format-initiative.md