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> |
||
|---|---|---|
| .. | ||
| _rust | ||
| templates | ||
| design-scrape.sh | ||
| figma-tokens.sh | ||
| frontend-inspect.sh | ||
| harden-base.sh | ||
| kei-ci-lint.sh | ||
| kei-docs-scaffold.sh | ||
| kei-sleep-queue.sh | ||
| kei-sleep-setup.sh | ||
| kei-sleep-sync.sh | ||
| live-preview.sh | ||
| log-ship.sh | ||
| MANIFEST.toml | ||
| metrics-scrape.sh | ||
| provision-hetzner.sh | ||
| provision-vultr.sh | ||
| README.md | ||
| screenshot-decode.sh | ||
| tomd.sh | ||
_primitives — first-class building blocks
_primitives/ holds standalone utilities that agents, hooks, and skills
(including /compose-solution) depend on. Unlike _blocks/ (behavioral
markdown) or _manifests/ (agent TOML), primitives are executable shell
programs installed at $HOME/.claude/agents/_primitives/ by install.sh.
Current primitives
| Primitive | Purpose | Invocation |
|---|---|---|
tomd.sh |
Universal non-native-format → markdown converter (PDF, DOCX, XLSX, PPTX, CSV, images, code). | ~/.claude/agents/_primitives/tomd.sh <file> |
tomd.sh is a first-class primitive. Universal non-native-format →
markdown converter with configurable cache directory
(KEISEI_TOMD_CACHE) and KeiSeiKit-style error tags ([tomd]).
Hook integration
hooks/tomd-preread.sh is a PreToolUse(Read) hook that auto-redirects
Claude to the converted markdown when a Read targets .docx / .doc / .xlsx / .pptx / .csv. Cached under $KEISEI_TOMD_CACHE (default
/tmp/keisei-tomd-cache).
/compose-solution discovery
Phase 3 prior-art sweep greps _primitives/ alongside _blocks/,
_manifests/, skills/, _bridges/, hooks/. If a user task involves
file-format parsing, the meta-composer surfaces tomd automatically —
reuse over rewrite (RULE "No Patching").