RoboPersona .botpack

The .botpack Package Format — Specification#

Version: 0.1.0 (DRAFT — tracks the Rust reference implementation in crates/) Status: Implemented. Every normative statement below is enforced by and tested against the reference implementation.

The key words MUST, MUST NOT, SHALL, and MAY are to be interpreted as described in RFC 2119.


1. Overview#

A .botpack file is a behavior package for embodied AI personas. It bundles:

The container is a zstd-compressed tar archive. All JSON in this spec is UTF-8, pretty or compact — readers MUST accept both.

2. Container layout#

Entry order is normative:

Order Entry Content
1 (MUST be first) manifest.json Manifest object (§3)
middle payload entries Arbitrary files, paths per §5
last (MUST be last) checksums.json Checksum index (§4)

Readers MUST reject archives where the first entry is not manifest.json or the last entry is not checksums.json. Writers MUST emit them in this order.

3. Manifest schema (manifest.json)#

{
  "format_version": "0.1.0",
  "name": "atlas-caretaker",
  "version": "0.1.0",
  "persona": {
    "display_name": "Atlas Caretaker",
    "description": "Warehouse patrol persona.",
    "system_prompt": "You are a careful warehouse robot.",
    "languages": ["en"]
  }
}

3.1 Fields#

3.2 Package name rules#

A valid name:

  1. is 2–63 bytes long,
  2. contains only a–z, 0–9, -,
  3. starts with a lowercase letter,
  4. does not end with -,
  5. contains no consecutive -.

3.3 Forward compatibility#

Readers MUST ignore unknown fields (top-level and nested). Writers MUST NOT fail on round-tripping manifests that carry unknown fields.

3.4 Byte preservation on ingest#

When a manifest.json is ingested from a file or stream (e.g. by a pack tool), writers MUST embed the ingested bytes verbatim as the manifest.json entry — after parsing and validating them against §3 — instead of re-serializing the parsed structure. Re-serialization MAY drop unknown fields (§3.3) and is therefore not round-trip stable; the embedded bytes are the source of truth. Readers MUST expose the stored bytes as read.

This rule applies only to manifest.json. checksums.json is always writer-generated (§4) and has no ingest path.

Reference note (non-normative): the reference CLI's show command prints the stored bytes exactly, with no added trailing newline, so botpack show f.botpack > manifest.json is a valid pack input.

4. Integrity (checksums.json)#

{
  "files": {
    "prompts/greeting.txt": "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"
  }
}

5. Path safety#

Payload entry paths MUST:

  1. be relative (no leading /),
  2. contain no .. components,
  3. be valid UTF-8,
  4. not collide with the reserved names manifest.json / checksums.json.

Readers MUST reject violations. (Duplicate structural entries inside the payload region are likewise rejected.)

6. Affect engine (normative mathematics)#

The affect state is a PAD vector (v, a, d) — valence, arousal, dominance — each axis clamped to [-1, 1]. Non-finite axis inputs are mapped: NaN → 0, ±∞ → ±1.

6.1 Configuration#

Field Constraint
baseline PAD vector (resting state)
decay_rate λ finite, > 0
mood_tau τ finite, > 0 (reserved for baseline adaptation)
max_step finite, in (0, 2]

Invalid configurations MUST be rejected at construction; a constructed engine can never hold an invalid state.

6.2 Stimulus application#

A stimulus moves each axis toward the stimulus point by at most max_step:

s' = s + clamp(|target − s|, 0, max_step) · sign(target − s)

6.3 Decay#

Time advancement by dt ≥ 0 (negative or non-finite dt MUST be rejected):

s' = baseline + (s − baseline) · exp(−λ·dt)

dt = 0 MUST be an exact identity.

7. Determinism contract#

  1. Cross-runtime bit-identity: For identical operation sequences (same config, same stimuli, same tick durations), conforming implementations MUST produce bit-identical IEEE-754 doubles on all platforms. This is achieved by a fixed-budget exp(−x) implementation (range reduction + 13 Taylor terms + exponent-field scaling) and pure-Rust sqrt/round/floor (libm), never platform libm. Verified: Rust (ARM64 macOS) ≡ Python (pyo3 extension) ≡ JavaScript (wasm-bindgen, Node) — byte-equal float64s. The reference scenario's normative bit patterns live in conformance/affect-reference.json (*_bits fields are f64::to_bits() as 16 lowercase hex digits; decimal renderings in that file are non-normative and MUST NOT be parsed back into floats).
  2. Replay: Identical event sequences replayed with identical advance chunking are bit-identical.
  3. Chunking tolerance: Different advance chunkings of the same event schedule agree to 1e-12 absolute tolerance (exponential factorization is not bitwise associative). Implementations MUST document this bound rather than claim unconditional bit-identity.

8. Runtime loop#

A conforming runtime loop:

  1. fires each scheduled stimulus at its exact timestamp (decay up to at, apply stimulus, decay onward) — the fire point MUST NOT depend on how the caller chunks time advancement;
  2. integrates decay in fixed sub-ticks on an absolute grid (k·tick_len measured from loop start);
  3. enforces a monotone clock: events scheduled in the past (earlier than current loop time) MUST be rejected;
  4. applies simultaneous events (equal timestamps) in stable insertion order.

9. Versioning policy#


Reference implementations#

Target Crate / Artifact Conformance
Rust (ARM64/embedded) botpack-core, botpack-archive, botpack-affect 34 tests
WebAssembly botpack-wasm → botpack_wasm.wasm Node functional test
Python botpack-python → botpack module conformance/check_python.py