# Encoding, tuple spaces, and continuations

This guide separates three layers that are easy to blur together: how records become bytes, how participants coordinate now, and how work resumes later.

## What is encoded today

The executable `CURSO/0` semantic profile uses a small deterministic tagged value codec:

- one-byte type tags;
- minimal unsigned LEB128 integers and lengths;
- strict UTF-8 text and raw byte strings;
- counted lists;
- counted records with unique UTF-8-sorted keys;
- no floats, indefinite lengths, duplicate keys, or trailing bytes.

That is TLV-like in spirit—values are typed and variable-size fields are length-delimited—but it is not currently named TIP, Atlas TLV, CBOR, Cap'n Proto, or bencoding. It is intentionally small enough for deterministic signatures and cross-language test vectors. JSON is used at browser and HTTP edges where inspectability matters; it does not define canonical core signing bytes.

BitTorrent dependencies do use **bencoding** for `.torrent`, DHT, and related BitTorrent metadata. That does not make bencoding the Cursors semantic record format.

## Zero-copy is a representation goal, not a wire promise

Length-delimited immutable byte ranges can be parsed as bounded views instead of copied into platform objects. Network byte order, alignment, bounds checks, and stable ownership still require an explicit framing/ABI design. A future fast path may resemble Cap'n Proto-style in-place traversal, but accepted authority continues to depend on canonical Cursors values, domain separation, signatures, and capability checks—not a particular memory layout.

## Linda-like coordination

Cursors places attributed, leased tuples in scoped dataspaces above mailboxes:

```text
["body", body-id, "offers", "wasm-continuation-v1"]
["mailbox", mailbox-id, "has", "cursor-envelope-v1"]
```

An assertion says what a publisher currently claims. An interest is a structural pattern that asks to observe matching assertions. A facet owns related assertions, interests, and behavior; stopping it withdraws its ephemeral claims. Attribution and capability references prevent a tuple match from becoming ambient authority.

This is closer to Linda/Syndicate coordination than to a permanent distributed database. Immutable cursor records and storage receipts preserve history separately.

## Continuations

A continuation names the resumable program point and ABI expected by a compatible body. The cursor also names immutable inputs, checkpoint/state roots, exercised grants, parents, and receipts. Resuming produces a new signed cursor; it does not mutate the old one.

Portable logical state is preferred over blindly copying an address space. WASM state, Smalltalk images/objects, bytecode VM frames, and explicit application checkpoints are possible continuation families. Native stack snapshots require strict architecture, runtime, page-layout, and device compatibility labels.

The restricted Lua source profile demonstrates the intended compilation boundary: source bytes → validated restricted intermediate form → cursor graph → placement/capability check → body execution. Lua text is not itself a continuation or a bearer capability.

## Open work

- freeze cross-language canonical codec vectors;
- specify framed zero-copy views and allocation limits;
- define the portable continuation ABI and compatibility tuples;
- implement leased attributed tuple assertions and structural interests;
- define facet pause/resume and reconciliation across partitions;
- prove that every edge adapter preserves canonical signing bytes.

Continue with [CURSO/0 Wire Profile](../protocol/curso-0.md), [Dataspaces](dataspace.md), [Cursor Records](crypto-cursors.md), and [Architecture](architecture.md).

