Standard library
The CX standard library ships bundled with the binary as the cx-stdlib/* sub-packages. Load one with [?lib 'cx-stdlib/ and call its functions as [$. Every contract, prose block, and runnable example is co-located with the function definitions in the bundle source — so these pages are generated straight from the shipped code and cannot drift from it.
- authz — The XAP authority model as data plus a single decision function.
- bus — In-process publish/subscribe that delivers each published message to its matching subscribers synchronously and in a defined order.
- bytes — Byte-level operations on the CX bytes scalar kind.
- crypto — Operations involving a key, a secret, or authentication.
- csv — Parse and emit CSV/TSV following RFC 4180 with Excel-pragmatic extensions.
- did — Decentralized identifiers (DIDs): the decentralized identity source that identifies a principal, counterpart to crypto's centralized JWT/JWKS.
- email — Parse and build RFC 5322 + MIME multipart email messages. The surface covers parsing inbound messages, inspecting headers and bodies, extracting attachments, decoding encoded-words and address lists, and building outgoing messages with text + HTML alternatives and attachments.
- env — Expose process-level metadata to CX code: environment variables, command-line arguments, and process identity. Read, list, and typed-default environment variables; parse argv into declarative flags and positionals; query process metadata such as PID, executable path, cwd, hostname, and OS/arch; reach the standard stream handles; and terminate the process.
- fabric — Platform-level eventing over the shipped primitives: one subscribe/emit surface with an explicit durability axis.
- format — Emit CX values back to CX text in four forms: canonical, pretty, compact, and diff-friendly. Canonical is the byte-stable hash preimage used for hashing, diffing, and content addressing; pretty is human-readable with indentation and wrapping; compact minimizes whitespace for transport; diff-friendly is a version-stable, one-element-per-line form for snapshots and version control.
- fp — Functional composition over the four value channels.
- ft — In-program fulltext search with structured ranking and snippet generation.
- geo — Coordinate primitives without a new scalar kind — geometries are ordinary CXDM elements.
- hash — Content-addressable hashing — fixed-length digests of arbitrary byte payloads.
- html — HTML as a first-class document format: parse, sanitize, serialize, and extract text.
- http — HTTP/1.1 request/response semantics: a programmatic client and server built on the `cx-stdlib/net` transport.
- i18n — The message and translation layer of CX's internationalization surface.
- io — File and stream I/O — whole-file reads and writes, streaming handles, line iteration, filesystem queries, directory operations, globbing, tempfiles, and advisory file locking.
- journal — An append-only, hash-chained, tenant-partitioned event log and the deterministic projection of that log into state.
- json — Parse JSON (RFC 8259) into CXDM values and emit CXDM values back to JSON.
- jsonrpc — Bundled cx-stdlib module.
- jsonschema — Bundled cx-stdlib module.
- locale — The primitives layer of CX's internationalization surface.
- log — Structured logging: leveled emit with arbitrary structured fields.
- math — Numeric utilities over CX int and float scalar kinds.
- mime — MIME data-shape handling: a built-in extension-to-type registry, Content-Type and Content-Disposition parsing, multipart boundary generation, type classification, and Accept-header content negotiation.
- net — Transport-level (L4) networking: opening and accepting stream connections (TCP, Unix-stream, TLS), exchanging datagrams (UDP, Unix-datagram, DTLS), name resolution, and TLS upgrade or termination.
- path — Filesystem path manipulation — splitting, joining, normalizing, and comparing OS paths.
- process — Run child processes: spawn them, capture their output, stream their stdio, connect them into pipelines, deliver signals, manage process groups, and drive pseudo-terminals.
- prof — In-program profiling, callable directly from CX code.
- random — Two distinct randomness facilities, kept cleanly separated so PRNG output can never accidentally stand in for crypto.
- re — Regular expressions backed by the RE2 engine, guaranteeing linear-time matching against any input with no catastrophic backtracking.
- sched — Scheduled events and timers on the event loop.
- session — The server-held (principal, tenant) session for a web app.
- similar — Graded comparison as a generalization of exact equality: where = returns a boolean, the core ~ operator returns a score in [0,1] plus evidence, and a decision policy maps the score to :match / :review / :no-match bands.
- store — A content-addressed object store with URL-dispatched backends.
- strings — String inspection, search, and transformation for general text work.
- test — Authoring primitives for unit-test-style programs written in CX: assertions, fixtures, lifecycle hooks, and structured reporting.
- time — Dates, datetimes, durations, and instants, with wall-clock and monotonic time sources.
- url — RFC 3986 and WHATWG-URL-aligned URL parsing, building, and component encoding.
- uuid — Generate, parse, format, and validate Universally Unique Identifiers. Four variants are supported: v4 (fully random), v7 (timestamp-ordered with an intra-millisecond monotonic counter), and the name-based deterministic v5 (SHA-1) and v3 (MD5).
- validate — Validate a CX data record against a record-schema at runtime, in the JSON-Schema / pydantic style.
- vc — Verifiable credentials: portable, signed, attenuating delegations that carry authority between DIDs and verify offline (the §22.2 delegation transport, counterpart to `did` for identity).
- xap — The XAP orchestrator — the experience layer at the top of the CX web stack.
- xsp — The XAP Stream Protocol frame codec — a self-describing, self-delimiting frame [version · type · stream-id · principal-DID · flags · len · payload] that carries XAP over any transport.