CX · Reference guideCX Guide
PlaygroundDownloadsAboutv0.18.0-pre.1
Sheet 01 · Why reach for CX
CXCX

One syntax.
Data to platform.
Agentic ready.

CX starts from a single axiom: computing is data transformation, nothing more. Languages, frameworks and processes are ceremony around that fact. CX is the principle made a language: transform.

Reach for CX whenever the data is the point. One bracketed syntax is the document, the query, the program and the compiler's own tree, so the file you read is the file you transform, validate, hash, store and serve — with no second language in between.

We hold ourselves to a standard we can state in one line — readable on day one, batteries included, exact by default, and effects you grant rather than inherit — and we prove each term of it with a conformance case this page replayed when it was built:

  • a query is a pattern over the document, not code over an object model — program-for-003-name-email-pair
  • a fraction literal is an exact decimal, and mixing one with a binary float is refused out loud rather than rounded in silence — ap-decimal-float-mix-right
  • an error is a value that propagates out of whatever is built from it — no exception unwinds past you — program-construction-err-004-captured-err-propagates
  • a program reads nothing it was not granted, and the denial is a value naming the flag that would allow it — io-001-read-file-cap-denied
  • a regular expression cannot backtrack, so no input can make it run for as long as it likes — re-003-compile-backreference-unsupported
  • state that outlives the program is two calls to a content-addressed store — store-rt-001-round-trip-get
  • an agent-protocol message is an ordinary value projected to its wire form — mcp-001-call-tool-request-shape

Every claim on this page stands beside a conformance fixture this cx replayed when the page was built.

R0Datadocuments · schemas · values — nothing executes
R1Codeevaluation · deny-by-default capabilities
GPlatformthe store · transports · live surfaces
GEcosystembindings · tooling · the registry

What you can do with it

Five things we promise, each with the conformance case that proves it; the why page states the case in eight before/after panels.

Query a document by its shape

A query is a pattern over the document — every user whose active is true, and its email. There is no object model to build first and no parser to call.

input.cx

    [users
  [user active=true [name Alice] [email a@x.com]]
  [user active=false [name Bob] [email b@x.com]]
  [user active=true [name Carol] [email c@x.com]]]
  

prog.cx

    [?for [user @active=true [email $e]] [yield $e]]
  
    $ cx --data=input.cx prog.cx
'a@x.com'
'c@x.com'
  

Fixture program-for-002-active-emails in deps/cx-core-code/conformance/code.cxd — replayed against this cx when the page was built.

Keep exact numbers exact

A fraction literal is an exact decimal and arithmetic keeps it one; mixing it with a binary float is refused out loud rather than rounded in silence, so money stays money.

prog.cx

    [?let [= $subtotal 19.99] [= $shipping 5.01] [total [+ $subtotal $shipping]]]
  
    $ cx prog.cx
[total 25.00]
  

Fixture ap-decimal-float-mix-right in conformance/llm/antipatterns.cxd — replayed against this cx when the page was built.

Grant effects instead of inheriting them

A program reads nothing it was not granted, and the refusal is an ordinary value that names the flag which would allow it.

prog.cx

    [?lib 'cx-stdlib/io']
[$io:read-file "/var/log/app.log"]
  
    $ cx prog.cx
[err code=cx-err:CXER0271 message='E_CAP_DENIED: read capability required for io-read-file; none granted (grant via --allow-read)' at='2:1']
  

Fixture io-001-read-file-cap-denied in deps/cx-core-code/conformance/stdlib/io.cxd — replayed against this cx when the page was built.

Update without mutation

[?modify] answers a new document; the one it started from is unchanged, so no reader ever sees a half-updated tree.

input.cx

    [users [user name=Alice]]
  

prog.cx

    [?let [= $orig $doc] [= $new [?modify $doc //user/@name [set "Bob"]]] [pair orig=$orig/user@name new=$new/user@name]]
  
    $ cx --data=input.cx prog.cx
[pair orig=Alice new=Bob]
  

Fixture program-modify-003-original-unchanged in deps/cx-core-code/conformance/code.cxd — replayed against this cx when the page was built.

Speak an agent protocol as plain values

An MCP request is an ordinary CX value projected to its wire form — no bespoke serializer anywhere in the path.

prog.cx

    [?lib 'cx-platform/mcp' as=mcp]
[?lib 'cx-stdlib/json' as=json]
[$json:emit [$mcp:call-tool-request 1 "get_weather" {location: "NYC"}]]
  
    $ cx prog.cx
'{"id":1,"jsonrpc":"2.0","method":"tools/call","params":{"arguments":{"location":"NYC"},"name":"get_weather"}}'
  

Fixture mcp-001-call-tool-request-shape in deps/cx-platform-agent/conformance/x/mcp.cxd — replayed against this cx when the page was built.

92 shipped modules · 82 directives · 25 repositories — counted from registry/modules.cxd, the specification's directive registry and registry/repos.cxd when this page was built.

Table of contents

Start here

Guide

Reference

Repositories

LLM

Source: docs-src/canonical/sections/*.cxd + the co-located docs in stdlib/*.cx and x/*.cx. Built by make guide.