Cellular automata & metacognition

Two frontier patterns: Cellular Automata creates emergent behavior from simple local rules, where agents on a grid follow basic movement and interaction rules that produce complex global behavior. Reflexive Metacognition gives agents self-awareness, letting them model their own capabilities and decide when to act, use tools, or escalate to humans.

Cellular automata: local rules → emergent behavior

Agents with simple rules like "move toward resources" and "cooperate with neighbors" can produce complex global patterns: clustering, resource optimization, and even division of labor, without any central coordinator telling them what to do.

patterns/45_cellular_automata.py + 46_reflexive_metacognitive.py
python
# Cellular Automata (Pattern 45)
class CellularAutomata:
    def update(self):
        for agent in self.agents.values():
            if agent.state != "active":
                continue
            dx, dy = self._movement_rule(agent)       # Local decision
            self._resource_collection_rule(agent)       # Local interaction
            self._agent_interaction_rule(agent)          # Neighbor cooperation

# Reflexive Metacognition (Pattern 46)
class MetacognitiveReasoner:
    def __init__(self, llm):
        self.self_model = SelfModel()  # Capabilities & limitations
        self.llm = llm

    def make_decision(self, task):
        capability = self.assess_capability(task)
        if capability["confidence"] >= 0.8:
            return DecisionType.DIRECT_ANSWER
        elif capability["confidence"] >= 0.5:
            return DecisionType.USE_TOOL
        else:
            return DecisionType.ESCALATE_HUMAN

class ReflexiveMetacognitiveAgent:
    def process_request(self, request):
        decision = self.metacognitive_reasoner.make_decision(request)
        if decision == DecisionType.DIRECT_ANSWER:
            return self._provide_direct_answer(request)
        elif decision == DecisionType.USE_TOOL:
            return self._use_tool(request)
        else:
            return self._escalate_to_human(request)

Local rules for cellular automata and self-model for metacognition.

Quiz: Quiz

Loading practice…

Metacognition pattern

Matching exercise: Match frontier pattern concepts

Loading practice…

Flashcards: Flashcards

Loading practice…

Cellular automata shows that complex intelligence can emerge from simple local rules, with no central coordinator needed. Metacognition adds self-awareness, letting agents know when to act and when to ask for help. With all six frontier patterns under your belt, it is time to bring everything together in the capstone project.