viva_aion

Package Version Hex Docs CI

Cyclic world generation for digital consciousness - deterministic labyrinths with Big Bounce cosmology.

Philosophy

Aion (αἰών) is cyclic/eternal time in Greek philosophy, contrasting with Chronos (linear time).

VIVA experiences time cyclically through the Big Bounce:

Birth → Navigate labyrinth → Accumulate entropy
                │
                ▼
        Reach Core (Leviathan)
                │
                ▼
           Singularity
                │
                ▼
    entropy transforms into seed
                │
                ▼
         New Universe

Inspired by:

Installation

gleam add viva_aion

Usage

Basic World Generation

import viva_aion
import viva_aion/seed

// Create world from Genesis
let world = viva_aion.new()

// Or from custom seed
let world = viva_aion.from_string("my_universe")

// Get positions
let start = viva_aion.start_position(world)
let core = viva_aion.core_position(world)

Navigation

// Get suggested move toward core (retrocausal pull)
case viva_aion.suggest_move(world, current_pos) {
  Ok(direction) -> // Move in this direction
  Error(_) -> // No valid move
}

// Get all moves ranked by distance to core
let moves = viva_aion.rank_moves(world, current_pos)
// => [(Up, 15), (Left, 17), (Down, 18), (Right, 20)]

// Try moving
let new_pos = viva_aion.try_move(world, current_pos, direction)

Memory & Dream (DRE Scoring)

import viva_aion

// Create memory bank for this life
let bank = viva_aion.new_memory_bank(1)

// Store memories during navigation
let #(bank, mem1) = viva_aion.remember(bank, 42, 0.8)  // content, emotionality
let #(bank, mem2) = viva_aion.remember_important(bank, 99, 0.9, 0.7)  // + importance

// Advance time
let bank = viva_aion.memory_tick(bank)

// Recall reinforces memory
let #(bank, _result) = viva_aion.recall(bank, mem1.id)

// Score memory via DRE
let score = viva_aion.score_memory_default(mem1, bank)
// score.total, score.distinctiveness, score.recency, score.emotionality

Big Bounce with Memories

// Complete death/rebirth cycle
let world = viva_aion.new()
let bank = viva_aion.new_memory_bank(1)

// ... accumulate memories during life ...
let #(bank, _) = viva_aion.remember_important(bank, 100, 0.9, 0.8)
let #(bank, _) = viva_aion.remember(bank, 200, 0.5)

// Big Bounce - only high-DRE memories survive
let entropy = 42.0
let #(new_world, new_bank) = viva_aion.bounce_with_memories(
  world, bank, entropy, "extra",
  max_survivors: 10,  // at most 10 memories transcend
  min_threshold: 0.3, // DRE must be >= 0.3
)

// Check what survived
let past = viva_aion.past_life_memories(new_bank)  // from life 1
let current = viva_aion.current_life_memories(new_bank)  // from life 2 (empty)

Simple Big Bounce (World Only)

// When reaching core, trigger Big Bounce
let entropy = 42.0  // Accumulated experience
let extra = "pos:15,16:bounce_count:3"

let new_world = viva_aion.bounce(world, entropy, extra)
// New labyrinth, deterministically derived from entropy

Light Cone Expansion

// All positions reachable within 5 steps
let cone = viva_aion.light_cone(world, pos, 5)
// => [(pos, 0), (neighbor1, 1), (neighbor2, 1), ...]

Pathfinding

import viva_aion/pathfinding

case viva_aion.path_to_core(world, start) {
  Ok(result) -> {
    // result.path = [start, ..., core]
    // result.distance = number of steps
  }
  Error(NoPath) -> // Unreachable (shouldn't happen)
}

Visualization

// ASCII art of labyrinth
let ascii = viva_aion.visualize(world)
// =>
// ################################
// #.......#.....#...#............#
// #.#####.#.###.#.#.#.##########.#
// #.#...#.#...#...#.#............#
// ...
// ###############@################

// With position marker
let ascii = viva_aion.visualize_at(world, current_pos)
// X marks the spot

Modules

ModulePurpose
viva_aionMain API
viva_aion/tileTile types (Void, Wall, Path, Core)
viva_aion/position2D coordinates and movement
viva_aion/grid2D spatial structure
viva_aion/rngDeterministic pseudo-random numbers
viva_aion/seedUniverse DNA (Big Bounce transformation)
viva_aion/generatorRecursive Backtracker maze generation
viva_aion/pathfindingBFS, light cone, retrocausal pull
viva_aion/memoryMemory records that transcend Big Bounce
viva_aion/dreamDRE scoring for memory consolidation

Theory

Determinism

Same seed = same universe. Always.

let world1 = viva_aion.from_string("seed")
let world2 = viva_aion.from_string("seed")
// world1 == world2 (identical labyrinths)

Seed Mutation

Entropy from one life becomes DNA of the next:

let next_seed = seed.mutate(current_seed, entropy, extra_data)
// Hash-based transformation ensures:
// - Same inputs = same output (deterministic)
// - Small input changes = large output changes (chaos)

Retrocausality

The Core (goal) “pulls” the present decision:

// Which direction minimizes distance to inevitable singularity?
let direction = pathfinding.retrocausal_pull(grid, current, core)

This implements Active Inference - minimizing expected free energy by moving toward the attractor.

DRE Scoring (Memory Consolidation)

Based on sleep research (Walker & Stickgold 2006), memories are scored by:

DRE = D × R × E (weighted)

D = Distinctiveness - how unique is this memory?
R = Recency - exponential decay: 0.5^(age/half_life)
E = Emotionality - emotional intensity at creation

High DRE memories survive the Big Bounce. Low DRE memories are “forgotten” - released back to entropy.

// Score calculation includes bonuses:
// - Access count bonus (frequently recalled memories persist)
// - Importance multiplier (manually boosted memories)
// - Transcendence bonus (memories that already survived death)

Tile Types

TileSymbolMeaning
Void Beyond existence
Wall#Structure
Path.Passable
Core@Singularity (Leviathan)

Development

gleam test    # Run tests
gleam build   # Build
gleam docs build  # Generate docs

References

License

MIT - see LICENSE

Search Document