Skip to content

Composable primitives for goal-directed coordination in Go. Synchronization, resource allocation, and collective intelligence that adapt through multiple strategies. Built with capacity for systems with 1000+ independent agents.

License

Notifications You must be signed in to change notification settings

carlisia/bio-adapt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Bio-adapt

Goal-directed coordination for concurrent and distributed systems, inspired by biological intelligence.

Drawing from Dr. Michael Levin's research on how biological systems reliably achieve goals through multiple pathways, bio-adapt brings these principles to software systemsโ€”from single-process concurrency to distributed architectures.

What: Goal-directedness, adaptive pathfinding, collective intelligence
How: Decentralized algorithms that pursue goals through multiple strategies

Why: Instead of programming HOW (procedures), you program WHAT (goals). Go goroutines figure out the HOW through:

  • Emerge: Finding when to coordinate (temporal synchronization)
  • Navigate: Finding what resources to use (resource allocation)
  • Glue: Finding how things work (collective understanding)

Installation

go get github.com/carlisia/bio-adapt

Quick Start - Use Emerge

import (
    "github.com/carlisia/bio-adapt/emerge"
    "github.com/carlisia/bio-adapt/emerge/goal"
    "github.com/carlisia/bio-adapt/emerge/swarm/scale"
    "github.com/carlisia/bio-adapt/emerge/swarm/trait"
)

// Create a swarm for API batching optimization
swarm, err := emerge.Swarm(emerge.Preset{
    Goal:  goal.MinimizeAPICalls,
    Scale: scale.Medium,
    Trait: trait.Speed,
})
if err != nil {
    log.Fatal(err)
}
err = swarm.Start(ctx)

// Check synchronization
if swarm.IsConverged() {
    // System is synchronized - safe to batch operations
}

๐Ÿ“– See the quick start guide | ๐ŸŽฎ Try the interactive demo

Features

๐ŸŽฏ Goal-directed - Systems maintain target states as invariants, finding alternative paths when defaults fail
๐Ÿ”„ Multiple pathways - Inspired by how biological systems reach goals despite perturbations
โšก Emergent coordination - Collective intelligence without central control
๐Ÿงฌ Bio-inspired principles - Computational primitives derived from Levin's research on adaptive biological systems

Coordination primitives

Bio-adapt provides three complementary primitives for system coordination:

๐Ÿงฒ Emerge - Goal-directed synchronization

Status: โœ… Production-ready

Systems (concurrent or distributed) that converge on target coordination states through multiple pathways, inspired by how biological systems reliably achieve morphological goals.

  • Temporal coordination (when agents act)
  • Self-organizing synchronization
  • Adaptive strategy switching
  • Optimized for 20-2000+ agents

โšก Navigate - Goal-directed resource allocation

Status: ๐Ÿšง Coming soon

Systems that navigate resource configuration spaces to reach target allocations via multiple paths, adapting when direct routes are blocked.

  • Dynamic resource allocation (what resources to use)
  • Alternative path discovery
  • Constraint-aware navigation

๐Ÿ”— Glue - Goal-directed collective intelligence

Status: ๐Ÿ“‹ Planned

Collective goal-seeking enables independent agents to converge on shared understanding through local interactions, achieving insights no individual could reach alone.

  • Schema discovery (how APIs work)
  • Distributed hypothesis testing
  • Emergent consensus

See primitives overview for detailed comparison.

Real-World Use Case Examples

Emerge

  • API batching - Reduce API costs by 80% through synchronized batching
  • Load distribution - Balance work across servers without central control
  • Distributed cron - Prevent thundering herd in scheduled tasks
  • Connection pooling - Optimize database connections adaptively
  • Rate limiting - Coordinate request rates across services

Coming Soon (Navigate & Glue)

  • Dynamic resource allocation - Navigate to optimal resource distributions
  • Failure recovery - Find alternative resource paths when failures occur
  • Schema discovery - Collectively understand API contracts
  • Distributed consensus - Achieve agreement without voting

Perfect for systems with 20-2000+ concurrent agents requiring coordination.

Documentation

๐Ÿ“š Full documentation index - Complete documentation guide

Quick Links

For Developers

Quick Start with Interactive Simulation

# Clone and run the interactive demo
git clone https://github.com/carlisia/bio-adapt
cd bio-adapt
go run ./simulations/emerge

# Try different scales
go run ./simulations/emerge -scale=large  # 1000 agents

# See all options
go run ./simulations/emerge -list

๐ŸŽฎ Learn more about the simulation - 8 optimization goals to explore interactively!

Contributing

We welcome contributions! See our development guide for:

  • Setting up your environment
  • Running tests and benchmarks
  • Submitting pull requests
  • Code style guidelines

Performance

The emerge primitive is production-optimized:

Scale Agents Convergence Time Memory/Agent
Tiny 20 ~800ms ~5KB
Small 50 ~1s ~4KB
Medium 200 ~2s ~3KB
Large 1000 ~5s ~3KB
Huge 2000 ~10s ~2KB

Key optimizations:

  • Automatic storage strategy selection based on swarm size
  • Grouped atomic fields for 62% faster access
  • Fixed-size arrays for 45% faster neighbor iteration

See optimization guide for benchmarks and details.

Research foundation

Inspired by Dr. Michael Levin's research on goal-directedness in biological systems, where cells and tissues achieve target morphologies through multiple pathways despite perturbations.

Key concepts adapted:

  • Goal-directedness - Systems that maintain target states as invariants
  • Multiple pathways - Alternative routes to achieve the same outcome
  • Collective intelligence - Problem-solving that emerges from local interactions
  • Adaptive navigation - Finding new solutions when defaults are blocked

Implementation foundations:

  • Kuramoto model for synchronization dynamics (emerge)
  • Pathfinding algorithms for resource navigation (navigate)
  • Distributed consensus protocols for collective intelligence (glue)

License

MIT - See LICENSE

About

Composable primitives for goal-directed coordination in Go. Synchronization, resource allocation, and collective intelligence that adapt through multiple strategies. Built with capacity for systems with 1000+ independent agents.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published