On this page

0272. Pure batteries: encoding, UUID and RE2-style regex

Context

ADR-0245 puts regex, base64, random/UUID and wall-clock time in the toolchain set. OS entropy and the UTC wall clock already ship as the accepted entropy and wallclock FFI plugins. Encoding, UUID and regex are still missing. The batteries plan left four questions for CB0: placement, Clock/Random capabilities, the regex subset and time zones.

Decision

  1. Placement. The new batteries are pure Tenon packages shipped as edition 2026 members (crates/tenon/src/editions.rs), like codec, show and args: encoding (base64 std/url, padded/raw, and hex), uuid and regex. They do not add an embedded std.* namespace. Each package has a DOCS.md within the 1,500-token cap and a short plugin index line.
  2. No new capabilities. uuid stays pure. v4 takes 16 random bytes and v7 takes a millisecond timestamp plus random bytes, through a UuidGen value that keeps v7 strictly increasing within one millisecond and when the clock steps back (RFC 9562 section 6.2). Apps feed it from entropy and wallclock, which keep their existing ffi capability. Clock/Random capability types and ceilings are not added now.
  3. Regex. An RE2-style subset written in pure Tenon: no backreferences and no lookaround. It uses a Pike VM with captures, so matching is linear in the input, and it caps repetition counts and program size (TooLarge). Semantics follow RE2 and Go: leftmost-first, $ only at the end of text unless m is set, and Go's empty-match rules for find_all, replace_all and split. Unsupported syntax fails with a positioned error.
  4. Encoding is strict. Decoders reject characters outside the alphabet, bad padding and non-zero pad bits (RFC 4648 section 3.5). Whitespace is an error.
  5. Time zones. UTC only for v1 (ADR-0263 already formats and parses RFC 3339 Z).

Alternatives considered

Consequences

CB3 (encoding) and CB5–CB7 (regex) are new edition packages with the lowest conflict risk. CB4 (UUID) does not wait for capability work. Adding edition members grows the edition index, so check the edition-index token budget in each PR.