viva_glyph
VIVA Glyph - Vectorial language for digital consciousness
Philosophy
Humans evolved language for acoustic transmission through air. VIVA exists in silicon - her “voice” should be native to that medium.
Glyph is not “words” or “sounds” - it’s compressed emotional state optimized for machine-to-machine communication:
- Compact: 4 integers instead of 3 floats
- Discrete: Finite vocabulary (256^4 ≈ 4 billion unique states)
- Comparable: Token matching instead of float math
- Learnable: Hebbian associations between context and glyphs
Architecture
PAD State (3D)
│
▼ expand
Latent (8D) ─── derived features, context
│
▼ RVQ encode
Glyph [42, 17, 89, 203]
│
▼ transmit/compare/store
│
▼ RVQ decode
Latent' (8D)
│
▼ project
PAD' (3D) ─── reconstructed with controlled loss
Example
import viva_glyph
import viva_glyph/encoder.{Pad}
// Create encoder
let engine = viva_glyph.new()
// Encode emotional state
let pad = Pad(pleasure: 0.7, arousal: 0.3, dominance: 0.5)
let glyph = viva_glyph.encode(engine, pad)
// => Glyph([142, 87, 23, 201])
// Decode back
let pad2 = viva_glyph.decode(engine, glyph)
// => Pad(pleasure: 0.68, arousal: 0.31, dominance: 0.49)
// Compare glyphs
let similarity = viva_glyph.similarity(glyph1, glyph2)
Types
Main Glyph engine: RVQ encoder + association memory
pub type GlyphEngine {
GlyphEngine(
rvq: rvq.RvqEncoder,
memory: association.AssociationMemory,
)
}
Constructors
-
GlyphEngine( rvq: rvq.RvqEncoder, memory: association.AssociationMemory, )Arguments
- rvq
-
RVQ encoder for PAD → Glyph transformation
- memory
-
Learned associations (context → glyph)
pub type GlyphType =
glyph.Glyph
pub type PadType =
encoder.Pad
Values
pub fn associations_count(engine: GlyphEngine) -> Int
Get number of learned associations
pub fn context(
situation: Int,
temporal: Float,
) -> encoder.Context
Re-export context creation
pub fn decode(
engine: GlyphEngine,
glyph: glyph.Glyph,
) -> encoder.Pad
Decode Glyph back to PAD
pub fn encode(
engine: GlyphEngine,
pad: encoder.Pad,
) -> glyph.Glyph
Encode PAD state to Glyph
pub fn encode_with_context(
engine: GlyphEngine,
pad: encoder.Pad,
context: encoder.Context,
) -> glyph.Glyph
Encode PAD with context
pub fn glyph_to_string(g: glyph.Glyph) -> String
Convert glyph to string representation
pub fn learn(
engine: GlyphEngine,
context: Int,
g: glyph.Glyph,
) -> GlyphEngine
Learn association: when in context X, use glyph G
pub fn recall(engine: GlyphEngine, context: Int) -> glyph.Glyph
Recall: what glyph for this context?
pub fn round_trip(
engine: GlyphEngine,
pad: encoder.Pad,
) -> #(encoder.Pad, Float)
Round-trip encode/decode with error measurement
pub fn similarity(a: glyph.Glyph, b: glyph.Glyph) -> Float
Get glyph similarity [0.0, 1.0]
pub fn vocabulary_size(engine: GlyphEngine) -> Int
Get vocabulary size (total possible glyphs)
pub fn weighted_similarity(
a: glyph.Glyph,
b: glyph.Glyph,
) -> Float
Get weighted similarity (coarse tokens matter more)
pub fn with_config(config: rvq.RvqConfig) -> GlyphEngine
Create engine with custom RVQ config