viva_aion/memory

Memory - Records that persist across the Big Bounce

Philosophy

“All You Zombies” - We are shaped by our past lives. Memories are not just data, they are the essence that transcends death and rebirth.

Structure

Each memory has:

Big Bounce Survival

Not all memories survive the Big Bounce. The DRE score determines which memories are “burned” into the next universe’s consciousness.

Types

A memory record

pub type Memory {
  Memory(
    id: Int,
    content: Int,
    emotionality: Float,
    created_at: Int,
    access_count: Int,
    last_accessed: Int,
    importance: Float,
    life_number: Int,
  )
}

Constructors

  • Memory(
      id: Int,
      content: Int,
      emotionality: Float,
      created_at: Int,
      access_count: Int,
      last_accessed: Int,
      importance: Float,
      life_number: Int,
    )

    Arguments

    id

    Unique identifier

    content

    Content hash (what the memory is about)

    emotionality

    Emotional intensity at time of creation [0, 1]

    created_at

    Tick when memory was created

    access_count

    How many times this memory was accessed

    last_accessed

    Last tick when accessed

    importance

    Manual importance boost [0, 1]

    life_number

    Which life/universe this memory is from

A collection of memories

pub type MemoryBank {
  MemoryBank(
    memories: List(Memory),
    next_id: Int,
    current_tick: Int,
    current_life: Int,
  )
}

Constructors

  • MemoryBank(
      memories: List(Memory),
      next_id: Int,
      current_tick: Int,
      current_life: Int,
    )

Values

pub fn access(memory: Memory, current_tick: Int) -> Memory

Mark memory as accessed (reinforcement)

pub fn age(memory: Memory, current_tick: Int) -> Int

Get memory age in ticks

pub fn all(bank: MemoryBank) -> List(Memory)

Get all memories

pub fn boost(memory: Memory, amount: Float) -> Memory

Boost memory importance

pub fn bounce(
  bank: MemoryBank,
  protected_ids: List(Int),
) -> MemoryBank

Prepare bank for Big Bounce - only keep protected memories

pub fn count(bank: MemoryBank) -> Int

Get memory count

pub fn current_life_memories(bank: MemoryBank) -> List(Memory)

Filter memories from current life

pub fn get(bank: MemoryBank, id: Int) -> Result(Memory, Nil)

Get memory by ID

pub fn is_current_life(memory: Memory, current_life: Int) -> Bool

Check if memory is from current life

pub fn is_past_life(memory: Memory, current_life: Int) -> Bool

Check if memory is from a past life (transcended Big Bounce)

pub fn mark_as_transcended(
  memory: Memory,
  new_life: Int,
) -> Memory

Memory that survived Big Bounce (marked as protected) Note: life_number is preserved to track which life created the memory

pub fn new(
  id: Int,
  content: Int,
  emotionality: Float,
  current_tick: Int,
  life_number: Int,
) -> Memory

Create a new memory

pub fn new_bank(life_number: Int) -> MemoryBank

Create empty memory bank

pub fn new_important(
  id: Int,
  content: Int,
  emotionality: Float,
  current_tick: Int,
  life_number: Int,
  importance: Float,
) -> Memory

Create memory with importance boost

pub fn past_life_memories(bank: MemoryBank) -> List(Memory)

Filter memories from past lives

pub fn recall(
  bank: MemoryBank,
  id: Int,
) -> #(MemoryBank, Result(Memory, Nil))

Access memory by ID (marks as accessed)

pub fn store(
  bank: MemoryBank,
  content: Int,
  emotionality: Float,
) -> #(MemoryBank, Memory)

Add memory to bank

pub fn store_important(
  bank: MemoryBank,
  content: Int,
  emotionality: Float,
  importance: Float,
) -> #(MemoryBank, Memory)

Store important memory

pub fn tick(bank: MemoryBank) -> MemoryBank

Advance tick

pub fn time_since_access(
  memory: Memory,
  current_tick: Int,
) -> Int

Get time since last access

Search Document