Skip to content

zeitge/myco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ„ Myco β€” A Bio-Isomorphic Runtime for Rust

Myco is a research runtime that implements metabolic programming: a paradigm where programs are modeled as living cells in a biological ecosystem rather than functions or objects.

What Makes Myco Different?

Traditional Systems Myco
Fixed network topology Self-organizing topology β€” cells create bonds based on communication patterns
Explicit service discovery Gradient-based discovery β€” cells "smell" services like chemicals
Manual load balancing Emergent load balancing β€” energy flows to productive cells
Crash = failure Apoptosis is normal β€” cells die gracefully, work continues
Hardcoded routes Morphological computing β€” code builds its own hardware

Core Concepts

1. Cells β€” Autonomous Units

Every component is a Cell with a metabolism() function called once per tick:

impl Cell for Worker {
    fn metabolism(&mut self, ctx: &mut CellContext) -> MetabolismResult {
        // Sense the environment
        if let Some(task) = ctx.sense_gradient_strongest(TASK_AVAILABLE) {
            // Communicate
            ctx.send(task.source, TaskClaim { worker: ctx.id() });
            ctx.report_value(1.0); // I did useful work
        }
        MetabolismResult::Continue
    }
}

2. Dual Topology β€” Euclidean + Morphological

Cells exist in two spaces simultaneously:

  • Euclidean Space: Physical positions (x, y). Gradients decay with distance.
  • Morphological Space: A dynamic graph of explicit bonds. Bound cells are adjacent regardless of physical distance.
// Sense a faraway resource
if let Some(resource) = ctx.sense_gradient(RESOURCE).first() {
    // Create a direct bond β€” bypass physical distance!
    ctx.bind_to(resource.source);
}

// Now we sense their gradients at FULL STRENGTH
// And signals to them are FREE

3. Gradients β€” Chemical Communication

Instead of direct messages, cells communicate via gradients that spread spatially:

// Emit "I'm available for work"
ctx.emit(gradient_kinds::AVAILABLE, 1.0);

// Sense nearby workers
let workers = ctx.sense_gradient(gradient_kinds::AVAILABLE);

4. Energy Economics

All operations cost energy. Cells that run out starve. The runtime distributes energy based on priority and productivity:

// Check before expensive operation
if ctx.try_emit(gradient, 5.0) {
    // Success β€” had enough energy
} else {
    // Failed β€” conserve energy
}

5. Immune System

The runtime includes an immune system that detects and kills parasites:

  • Tracks metabolic ratio (W/E = value produced / energy consumed)
  • Cells with low W/E ratio are flagged as parasites
  • Grace period for newly spawned cells
  • Automatic apoptosis signaling

6. Morphological Computing (Phase 7)

The key innovation: Cells can modify the topology of the network itself.

// Consumer senses data source 1000 units away (weak signal)
let source = ctx.sense_gradient(DATA_AVAILABLE).first()?;

// Create topological bond
ctx.bind_to(source.source);

// Next tick: sense at FULL STRENGTH, communicate for FREE
// Physical distance: 1000 units
// Logical distance: 1 hop

This is software that builds its own hardware.

Quick Start

# Clone and build
git clone <repo>
cd myco
cargo build

# Run demo (/examples)
cargo run --example [demo]

Architecture

myco/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cell.rs         # Cell trait, CellContext, metabolism
β”‚   β”œβ”€β”€ runtime.rs      # Tick loop, scheduling, dual topology
β”‚   β”œβ”€β”€ gradient.rs     # Euclidean gradient field
β”‚   β”œβ”€β”€ morphology.rs   # Relational graph topology (NEW)
β”‚   β”œβ”€β”€ signal.rs       # Direct signals, gradient kinds
β”‚   β”œβ”€β”€ energy.rs       # Energy pool, distribution
β”‚   β”œβ”€β”€ immune.rs       # Parasite detection, apoptosis
β”‚   β”œβ”€β”€ stem.rs         # Stem cells, differentiation
β”‚   └── ...
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ phase7_morphology.rs  # Morphological computing demo
β”‚   β”œβ”€β”€ ecosystem.rs          # Full ecosystem with parasites
β”‚   └── ...
└── tests/

Key Features

  • Core runtime, gradients, signals
  • Energy costs for operations
  • Sleep/wake conditions
  • Spawn requests with positioning
  • Membrane isolation
  • Morphological computing
  • Metabolic W/E ratio tracking
  • Hybrid gradient sensing
  • Auto-binding from traffic

Research Applications

Myco is designed for:

  1. Multi-agent AI systems β€” Thousands of AI agents coordinating without central control
  2. Resilient distributed systems β€” Systems that survive partial failure by design
  3. Self-organizing networks β€” Topology that adapts to communication patterns
  4. Simulation β€” Biological systems, economies, traffic

Theoretical Foundation

Myco draws from:

  • Stigmergy (indirect coordination via environment modification)
  • Cellular automata (local rules β†’ global behavior)
  • Morphogenesis (how organisms build structures)
  • Thermodynamics (energy-bounded computation)

Motivation

This is a research project exploring bio-isomorphic computing.

License

Apache 2.0


"The topology is the program."