feat(kei-pet): Day 1 — persona manifest parse + validate + overlay + Ed25519 identity
First crate of the Pet UI v1 line (feat/pet-ui-v1 branch). Ships:
## Schema (src/schema.rs — 213 LOC)
Strongly-typed `PetManifest` covering:
- identity (pet_name, user_name, addressing, languages)
- voice (tone primary/secondary, humor style + frequency)
- edge (profanity, directness, initiative)
- appearance (base_shape, size, colours, eyes, expression, accessories)
- room (theme, lighting, decor, time_sync)
- privacy (public_profile, publish_allowed, share_dreams, share_garden)
- interests[] (topic, depth, freshness, vault_path, last_refresh)
- routines[] (kind, schedule, template, enabled)
- forbidden (topics, tone_patterns)
- meta (schema version, timestamps, tune_count)
All enums serde-renamed to kebab-case for TOML-native feel.
## Validation (src/validate.rs — 180 LOC)
19-rule validator (R1–R19 per earlier spec). Errors **accumulate** — single
validate() call surfaces every issue, not just the first. Covers:
- schema version (R1)
- name bounds (R2, R2)
- languages ISO-639-1 (R4)
- tone_secondary cardinality + no-primary-dup (R6)
- profanity/language consistency (R10)
- interest topic slug-safety (R12)
- interest/forbidden contradiction (R14)
- schedule grammar: HH:MM, dow-HH:MM, every-Nh, no-commit-for-Nh,
N-errors-in-N-calls (R16)
- empty-string guards (R18)
- ISO-8601 timestamps (R19)
- hex-colour sanity on appearance
## Overlay rendering (src/overlay.rs — 128 LOC)
Pure function `system_prompt(&PetManifest) -> String`. Deterministic — same
manifest → same bytes. Used as prompt-prefix by the runtime at spawn time.
## Identity (src/identity.rs — 117 LOC incl. 5 unit tests)
Standard Ed25519 (RFC 8032) via ed25519-dalek. `user_id` = first 16 hex
chars of blake3(public_key) — deterministic, 64-bit, URL-safe. Hex-string
API for cross-boundary verify. No proprietary crypto, no matrix math.
## CLI (src/bin/kei-pet.rs — 110 LOC)
- `kei-pet validate <path>` — parse + run R1–R19
- `kei-pet show <path>` — print rendered overlay
- `kei-pet identity new` — generate + store ~/.keisei/identity.key (0600)
- `kei-pet identity show` — print public key + user_id
- `kei-pet tune` stub (Day 2 — /pet-tune skill lands full implementation)
## Tests
- 23/23 integration (tests/validation_tests.rs) — one rejector per rule +
accept cases for examples/minimal.toml and examples/full.toml + overlay
smoke + multi-error accumulation guard
- 5/5 unit (identity module) — keypair roundtrip, user_id determinism,
sign/verify, hex API boundary
- cargo test -p kei-pet --release: all green
## Examples
- examples/minimal.toml — smallest valid manifest
- examples/full.toml — every optional section populated
## Scope boundary (enforced by in-file doc comment in lib.rs)
NO imports, references, or conceptual mentions of sibling research-grade
IP. Identity is standard Ed25519. Cache/projection is standard CQRS. This
crate ships as a clean MIT-licensable unit of the KeiSeiKit public surface.
Day 2: /pet-setup 7-phase wizard skill that drives this crate via the CLI.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>