Guide

Recursive Systems

Build bounded populations of separately identified chart instances from recursive definition graphs.

Some domains are recursive because each unit can own another unit of the same kind: plans contain subplans, supervisors delegate to supervisors, documents include documents, and agents create agents. Model that cycle only when every node deserves its own durable lifecycle.

Recursion is a cycle between chart definitions

A recursive Statechart does not put a State inside itself. It declares that one chart definition may spawn another instance whose definition belongs to the same recursive group. The authored graph contains a cycle; every running node remains an ordinary child instance with its own InstanceId, Snapshot, mailbox, obligations, and settlement.

This distinction is the category boundary. Recursive Component composition reuses authored structure inside one chart. Recursive Systems create an ancestry of separately running charts.

Separate the definition graph from runtime ancestry

The definition graph must close to a finite canonical declaration even though it contains a cycle. Statechart.contract therefore asks for the child contract before the implementation exists, then closes that direct fixed point exactly once. The same constructor accepts a complete member record and closes an entire strongly connected group atomically.

Runtime ancestry is finite for a different reason. The model chooses a base case; maximumDepth is the hard refusal boundary if the model requests another birth anyway. Definition closure proves what may run. Ancestry records what actually ran.

Keep three bounds independent

Recursive systems usually need three different limits:

  1. Lineage bounds how deeply one recursive group may descend. The recursive contract and engine-owned ancestry own this limit.
  2. Breadth and work bound how many siblings or expensive operations may proceed. Dynamic families and Resource capacity own those limits.
  3. Authority bounds which external data or capabilities cross each child edge. Resource slots, providers, and attenuation own that boundary.

maximumDepth does not limit sibling count, tokens, model calls, file access, or confidential data. An ancestry frame does not grant Resource authority. Keeping the limits separate makes both refusal and recovery explainable.

Choose the cycle you need

Where recursion leads

Begin with Statechart.contract and one direct cycle, then make its base case and hard boundary explicit in Depth & Recursion Queries. Child Lifecycle & Restart then separates a durable incarnation from its temporary runner, while Mutually Recursive Groups closes a complete definition cycle atomically. Recursive Resource Propagation then makes authority across every child edge explicit rather than hiding all of those decisions inside one oversized lesson.

After recursive runtime ownership is clear, Components returns to reusable authored structure inside a chart.