Skip to main content

Stigmergy

Understanding coordination through environmental modification

Stigmergy

Stigmergy (pronounced “stig-MER-jee”) is coordination through the environment.

Instead of talking to each other directly, agents communicate by changing their environment. Other agents see those changes and respond.

Traditional vs Stigmergic Coordination

Traditional Coordination:          Stigmergic Coordination:

Agent A ──message──► Agent B       Agent A ──deposit──► Environment

                                   Agent B ◄──perceive────────┘

Real-World Examples

SystemMark LeftWho Responds
Ant trailsPheromone chemicalsOther ants
WikipediaEdited articlesFuture editors
CitiesBuilt buildingsFuture developers
MarketsPrice changesFuture traders
Stack OverflowAnswers/votesFuture developers

How It Works in Our System

In Ants at Work, stigmergy operates on a graph:

  1. Nodes represent concepts, regions, or states
  2. Edges connect nodes with traversal costs
  3. Pheromone accumulates on edges that lead to success
┌──────────┐      pheromone: 15      ┌──────────┐
│  Node A  │ ─────────────────────►  │  Node B  │
└──────────┘                         └──────────┘

     │  pheromone: 2

┌──────────┐
│  Node C  │
└──────────┘

Agents are more likely to traverse A→B (high pheromone) than A→C (low pheromone).

The Feedback Loop

1. Agent finds something valuable at destination


2. Agent deposits pheromone on path taken


3. Future agents sense higher pheromone


4. Future agents more likely to take that path


5. More value found → more pheromone → stronger trail

This creates positive feedback:

  • Good paths get stronger
  • Bad paths decay (pheromone evaporates over time)
  • Optimal paths emerge without central planning

Why Stigmergy Works

1. No Central Coordinator

No single agent needs to know the big picture. Intelligence emerges from local interactions.

2. Adaptive

When conditions change, trails adjust. Old paths decay; new paths form.

3. Fault Tolerant

If agents fail, the system continues. The environment preserves knowledge.

4. Scalable

Adding more agents adds more exploration power. No coordination bottleneck.

Stigmergy vs Other Approaches

ApproachProsCons
Central coordinatorOptimal decisionsSingle point of failure, bottleneck
Message passingDirect communicationComplex protocols, overhead
StigmergyEmergent, fault-tolerantSlower convergence, no guarantees

The Pheromone Lifecycle

┌─────────────────────────────────────────────────────────────────┐
│                    PHEROMONE LIFECYCLE                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│   DEPOSIT ─────────► ACCUMULATION ─────────► EXPLOITATION       │
│      │                     │                       │            │
│      │                     │                       │            │
│      ▼                     ▼                       ▼            │
│   Agent finds          Multiple              Harvesters         │
│   value and           agents use            follow the          │
│   leaves mark          the path             "superhighway"      │
│                                                                  │
│                            │                                     │
│                            ▼                                     │
│                         DECAY                                    │
│                            │                                     │
│                            ▼                                     │
│                      Pheromone evaporates                       │
│                      over time unless                           │
│                      reinforced                                  │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Superhighways

When pheromone level exceeds a threshold (default: 20), an edge becomes a superhighway:

  • Crystallized knowledge
  • Near-optimal path
  • Preserved even after mission ends
  • Transferable to other missions
# In STAN algorithm
if edge.pheromone_level > 20:
    edge.is_superhighway = True
    # This path is now permanent colony knowledge

The Balance Problem

Too much exploitation = stuck in local optima Too much exploration = never converge

Our solution: castes with different pheromone sensitivities:

CasteSensitivityBehavior
Scout0.3Mostly ignores pheromone, explores freely
Harvester0.9Strongly follows pheromone, exploits known paths
HybridAdaptiveSwitches based on environment

Key Insight

No agent is intelligent. The colony is.

The intelligence doesn’t exist in any individual ant. It exists in the pattern of pheromones across the environment—a form of collective memory that guides all future behavior.

This is emergence: complex behavior arising from simple rules.