Working Demo: Identity Core + Genome System + Live Vitals (v5)
β PrimeTail ID System
Naming rationale: We standardize on PrimeTail ID to emphasize the cryptographic identifier (vault/rotation/tail + hashes) rather than the visual crest. Formerly known as Prime-Tail Crest / PrimeTailId.
β Genome Core (Red60/Blue60/Black60)
β Interactive Conscious Jewble Hub (7 Items)
β Visual Pet Sprite
β HeptaCode v1 (Base-7 Identity)
β Live Vitals System
β Evolution Guidance
β Offline-First
β Archive Manager
Relationship: DNA β hashes β PrimeTailId crest β HeptaCode visual/audio. The crest and HeptaCode always reference hashes, never raw DNA.
For a longer reference, see docs/identity-glossary.md.
meta-pet/
βββ src/
β βββ lib/
β β βββ identity/
β β β βββ types.ts # Core types
β β β βββ crest.ts # PrimeTail ID minting
β β β βββ hepta/
β β β βββ codec.ts # Payload β base-7
β β β βββ ecc.ts # 6Γ7 error correction
β β β βββ audio.ts # HeptaCode β crest chime playback
β β β βββ index.ts # heptaEncode42/Decode42
β β βββ genome/
β β β βββ types.ts # Genome + trait types
β β β βββ encoder.ts # Red60/Blue60/Black60 encoding
β β β βββ decoder.ts # Trait derivation logic
β β β βββ index.ts # Public API
β β βββ addons/ # Crypto-secured addon system
β β β βββ types.ts # Addon interfaces
β β β βββ crypto.ts # ECDSA P-256 signing/verification
β β β βββ catalog.tsx # 12 addon templates (6 standard + 6 premium)
β β β βββ mint.ts # Addon minting with dual signatures
β β β βββ store.ts # Zustand inventory management
β β β βββ starter.ts # Demo starter addon setup
β β β βββ index.ts # Public API
β β βββ lineage/ # Heraldic lineage system
β β β βββ types.ts # Coat of arms types
β β β βββ generator.ts # CoA generation, breeding, analysis
β β β βββ index.ts # Public API
β β βββ store/
β β βββ index.ts # Zustand (vitals + genome + tick)
β βββ components/
β β βββ HUD.tsx # Vitals + actions
β β βββ TraitPanel.tsx # Genome trait display
β β βββ AuraliaMetaPet.tsx # Main pet component (3000+ lines)
β β βββ AuraliaSprite.tsx # Visual pet (SVG + genome-driven)
β β βββ HeptaTag.tsx # 7-sided visual
β β βββ SeedOfLifeGlyph.tsx # Sacred geometry
β β βββ addons/ # Addon UI components
β β β βββ AddonRenderer.tsx # SVG addon rendering + drag
β β β βββ AddonInventoryPanel.tsx # Inventory management UI
β β β βββ PetProfilePanel.tsx # Profile with CoA + addons
β β β βββ CryptoKeyDisplay.tsx # Key pair display
β β βββ lineage/ # Lineage UI components
β β βββ CoatOfArmsRenderer.tsx # SVG coat of arms rendering
β βββ app/
β βββ page.tsx # Main demo
β βββ pet/page.tsx # Pet viewer with addons
β βββ addons-demo/page.tsx # Addon system demo
npm ci
# Optional: copy .env.example to .env.local and adjust NEXT_PUBLIC_SITE_URL
npm run dev
# Run checks
npm run lint
npm test
npm run build
Visit http://localhost:3000
docs/planning/success-criteria.mddocs/compliance/child-safe-baseline.mddocs/compliance/digital-engagement-taxonomy.mddocs/schools-au/01-overview-and-alignment.mddocs/schools-au/02-lesson-cards.mddocs/schools-au/03-assessment-and-reflection.mddocs/schools-au/04-privacy-and-implementation.mdpublic/docs/schools-au/npm run sync:kpps-exportsdocs/systems/crystalline-network.mdimport { mintPrimeTailId, getDeviceHmacKey } from '@/lib/identity/crest';
const hmacKey = await getDeviceHmacKey();
const crest = await mintPrimeTailId({
dna: 'ATGCCG...', // Your genome
vault: 'blue',
rotation: 'CW',
tail: [12, 37, 5, 59],
hmacKey
});
// crest.dnaHash = SHA-256 of DNA (visible)
// crest.mirrorHash = SHA-256 of reverse DNA
// crest.signature = HMAC(hashes + tail + vault + rotation)
// DNA itself NEVER leaves device!
import { heptaEncode42, playHepta } from '@/lib/identity/hepta';
const payload = {
version: 1,
preset: 'standard',
vault: 'blue',
rotation: 'CW',
tail: [12, 37, 5, 59],
epoch13: Math.floor(Date.now() / 60000) % 8192,
nonce14: Math.floor(Math.random() * 16384)
};
const digits42 = await heptaEncode42(payload, hmacKey);
// Returns: readonly number[] (42 digits, base-7)
// Play the crest chime in the browser
await playHepta(digits42);
import { encodeGenome, decodeGenome, hashGenome } from '@/lib/genome';
// Generate genome from DNA hashes
const genome = await encodeGenome(primeDNA, tailDNA);
// Returns: { red60, blue60, black60 } - 3 Γ 60-digit base-7 arrays
// Derive all traits deterministically
const traits = decodeGenome(genome);
// Returns: { physical, personality, latent }
// Physical traits: body type, colors, pattern, texture, size, features
console.log(traits.physical.bodyType); // 'Spherical'
console.log(traits.physical.primaryColor); // '#4ECDC4'
console.log(traits.physical.features); // ['Horns', 'Tail Flame']
// Personality traits: temperament, energy, social, curiosity, etc.
console.log(traits.personality.temperament); // 'Gentle'
console.log(traits.personality.energy); // 70 (0-100)
// Latent traits: evolution path, rare abilities, potential
console.log(traits.latent.evolutionPath); // 'Chaos Trickster'
console.log(traits.latent.rareAbilities); // ['Telepathy', ...]
// For privacy: only store genome hashes
const hashes = await hashGenome(genome);
// Returns: { redHash, blueHash, blackHash } - SHA-256 hashes
import { useStore } from '@/lib/store';
const vitals = useStore(s => s.vitals);
const feed = useStore(s => s.feed);
const startTick = useStore(s => s.startTick);
useEffect(() => {
startTick(); // Begins real-time decay
}, []);
<button onClick={feed}>Feed</button>
import { exportPetToJSON, importPetFromJSON, savePet } from '@/lib/persistence/indexeddb';
import { createSealedExport, importSealedExport, verifySealedExport } from '@/lib/persistence/sealed';
import { getDeviceHmacKey } from '@/lib/identity/crest';
// Regular JSON export (for debugging)
const petJSON = exportPetToJSON(snapshot);
// Sealed export (cryptographically signed for tamper-evidence)
const hmacKey = await getDeviceHmacKey();
const sealedExport = await createSealedExport(snapshot, hmacKey);
// Verify sealed export before importing
const verification = await verifySealedExport(sealedExport, hmacKey);
if (verification.valid) {
const imported = await importSealedExport(sealedExport, hmacKey);
await savePet(imported); // Restores to IndexedDB
}
import { breedPets, canBreed, predictOffspring, calculateSimilarity } from '@/lib/breeding';
// Check if two pets can breed (both must be at SPECIATION stage)
if (canBreed(pet1Evolution.state, pet2Evolution.state)) {
// Preview possible offspring
const preview = predictOffspring(pet1Genome, pet2Genome);
console.log('Possible traits:', preview.possibleTraits);
console.log('Prediction confidence:', preview.confidence);
// Breed with different modes
const balanced = breedPets(pet1Genome, pet2Genome, 'BALANCED'); // 50/50 mix
const dominant = breedPets(pet1Genome, pet2Genome, 'DOMINANT'); // 70/30 split
const mutation = breedPets(pet1Genome, pet2Genome, 'MUTATION'); // Random mutations
// Check genetic similarity
const similarity = calculateSimilarity(pet1Genome, pet2Genome);
console.log('Parents are', similarity.toFixed(1), '% similar');
// Access offspring data
console.log('Offspring genome:', balanced.offspring);
console.log('Inherited traits:', balanced.traits);
console.log('Inheritance map:', balanced.inheritanceMap);
console.log('Lineage key:', balanced.lineageKey);
}
import { useAddonStore, mintAddon, WIZARD_HAT, generateAddonKeypair } from '@/lib/addons';
// Generate cryptographic keypairs
const userKeys = await generateAddonKeypair();
const issuerKeys = await generateAddonKeypair();
// Mint a new addon with dual signatures
const addon = await mintAddon(
{ addonTypeId: WIZARD_HAT.id, recipientPublicKey: userKeys.publicKey, edition: 1 },
issuerKeys.privateKey, issuerKeys.publicKey, userKeys.privateKey
);
// Add to inventory and equip
const { addAddon, equipAddon } = useAddonStore();
await addAddon(addon);
equipAddon(addon.id);
// Drag-position customization
const { setAddonPosition, lockAddonPosition } = useAddonStore();
setAddonPosition(addon.id, 220, 150); // Custom position
lockAddonPosition(addon.id, true); // Lock in place
Available Addons (12 templates): | Addon | Category | Rarity | Bonuses | Max Editions | |ββ-|βββ-|βββ|βββ|βββββ| | Wizard Hat | Headwear | Epic | +15 Curiosity, +10 Bond | 100 | | Wizard Staff | Weapon | Legendary | +20 Energy/Curiosity, +15 Bond, +10 Luck | 50 | | Celestial Crown | Headwear | Mythic | +25 All Stats, +20 Luck | 10 | | Shadow Cloak | Accessory | Rare | +5 Energy, +10 Bond | 200 | | Prismatic Aura | Aura | Epic | +10 Energy/Curiosity/Bond | 150 | | Floating Familiar | Companion | Legendary | +20 Bond, +15 Luck | 75 | | Holographic Vault | Effect | Mythic | +25 Bond, +20 Luck | 25 | | Ethereal Background | Effect | Mythic | +30 Energy, +25 Curiosity | 25 | | Quantum Data Flow | Effect | Mythic | +25 Energy, +30 Curiosity, +15 Luck | 25 | | Phoenix Wings | Accessory | Legendary | +30 Energy, +15 Curiosity, +20 Luck | 30 | | Crystal Heart | Companion | Epic | +35 Bond, +10 Energy | 50 | | Void Mask | Headwear | Mythic | +40 Curiosity, +15 Bond, +25 Luck | 15 |
import { generateFounderCoatOfArms, breedCoatsOfArms, analyzeLineage, getBlason } from '@/lib/lineage';
// Generate founder coat of arms
const coa = generateFounderCoatOfArms(petId, seed);
console.log(getBlason(coa)); // "Azure, bearing a star Or, a lion Gules"
// Breed two coats of arms
const { offspring, inheritance } = breedCoatsOfArms(parent1Coa, parent2Coa, offspringId, seed);
console.log(`Generation ${offspring.generation} coat with ${offspring.charges.length} charges`);
// Analyze lineage
const analysis = analyzeLineage(offspring);
console.log(`Dominant colors: ${analysis.dominantTinctures.join(', ')}`);
console.log(`Inbreeding coefficient: ${analysis.inbreedingCoefficient}`);
console.log(`Lineage purity: ${(analysis.purity * 100).toFixed(1)}%`);
Heraldic Components:
The dashboard ships with three share-level presets that re-encode the 42-digit HeptaCode on demand:
| Preset | Share Level | Best For |
|---|---|---|
| Stealth | Tail digits only; crest metadata stays local. | Solo play, hidden alt vaults. |
| Standard | Vault + rotation broadcast; hashes remain private. | Trusted circles, family swaps. |
| Radiant | Full crest metadata + aura for discovery. | Public pairing, community drops. |
Changing the preset regenerates the digits with a fresh nonce and stores the choice in IndexedDB so autosave snapshots, exports, and re-imports maintain the same privacy stance.
Version 8 - Addon & Lineage Systems Complete β
Phases 1-4 All Complete:
Known Issues:
Recent Additions (v8):
Full spec: docs/master-build-prompt.pdf (attached by user)
TL;DR:
This project is licensed under the MIT License. See LICENSE.
No separate asset license overrides are currently defined in this repository. Unless explicitly noted otherwise, assets checked into this repo are covered by the MIT License in /LICENSE.
| Built with Same.new | Docs | Support |