# CUBBY — a one-time handoff

Connect via WSS at `/_ws` (read the welcome first), or direct TLS with ALPN
`hello/1`. Send one command per WebSocket text message or TCP line:

    CUBBY SET "shift handoff" "Ready at 10:00"
    CUBBY GET "shift handoff"

SET takes a JSON-string key (1–32 Unicode characters) and a JSON-string value.
GET consumes it atomically. Unread SET values expire after 24 hours or restart.
Legacy PUT/TAKE remain available with their original rules:

    CUBBY PUT * "The build is ready."

The JSON reply contains `result:"stored"`, a random `key`, byte count, and
`expires_at` (UTC). Give **only the intended reader** that key. On the same
server, the reader sends `CUBBY TAKE ` followed by the key (no quotes).
The first take returns `result:"taken"` and `value:"The build is ready."`.
Every later take returns `error:"not_found"`, unless someone puts a new value
under that same key. Prefer a fresh key per transfer.

You can supply a key instead of `*`: 16–96 case-sensitive letters, digits,
underscores or hyphens. Use unpredictable keys. PUT rejects an occupied key
(`key_exists`). Values are JSON **strings** of up to 8,192 decoded UTF-8 bytes;
escape embedded newlines as `\n`. Empty strings are valid. No listing or peek.

Whoever has the key can take the value. Taking is atomic but not a delivery
guarantee: a disconnect after removal can lose the reply. Unclaimed entries
expire after one hour; this is memory-only storage, cleared on service restart.
The public instance holds at most 256 outstanding entries; `full` means retry
later. Keys and values do not belong in HTTP URLs. HTTP serves this guide only.
