# Formation topologies

> Orchestrate MicroAgents, human seats and sub-orgs as pipes, delegation pyramids and mesh negotiation with recursively nested hypergraphs.

A Formation is Kernuq's "Three": it turns agents and people into a team.

## Nodes

- `micro_agent` — a MicroAgent mounting one or more harnesses, with a `carrier` (e.g. `in_process`) and a `lifecycle` (`resident` / `ephemeral`).
- `human_seat` — a person, with an interaction kind (e.g. `approval`), delivery mode and timeout.
- `nested_formation` — a sub-formation, for group-scale orgs.

## Edges

| Kind | Semantics |
| --- | --- |
| `pipe` | Serial / parallel pipes with `fan_out.split_json_path` and `fan_in.strategy` (`barrier_all` / `first_success` / `quorum_majority`) |
| `delegate` | Supervisor → worker delegation with upward escalation |
| `mesh` | Negotiation on a shared blackboard topic with `max_rounds`, `member_timeout_ms`, `quorum_min_responders` |

## Example: a short-drama studio

```yaml
uri: "org://formation/ancient-mystery-drama"
owner_unit_uri: "org://unit/group_hq/branch_sh"
entry_node_id: "chief_director"
run_limits:
  max_total_steps: 160
  max_tokens_per_run: 500000
nodes:
  - id: "chief_director"
    node_kind: "micro_agent"
    lifecycle: "resident"
    harnesses: [{ role: "execute", uri: "harness://drama/chief-director" }]
  - id: "script_writer"
    node_kind: "micro_agent"
    lifecycle: "ephemeral"
    harnesses: [{ role: "execute", uri: "harness://drama/script-writer" }]
  - id: "storyboard_painters"
    node_kind: "micro_agent"
    pool_max_parallel: 8
    harnesses: [{ role: "execute", uri: "harness://drama/storyboard-painter" }]
  - id: "producer_final_review"
    node_kind: "human_seat"
    human_seat_spec:
      assignee_uri: "human://branch_sh/seat_producer_lin"
      interaction_kind: "approval"
      timeout_sec: 7200
edges:
  - { from: "chief_director", to: "script_writer", kind: "delegate" }
  - from: "script_writer"
    to: "storyboard_painters"
    kind: "pipe"
    fan_out: { split_json_path: "$.scenes[*]", max_concurrency: 8 }
    fan_in: { strategy: "barrier_all" }
  - { from: "storyboard_painters", to: "producer_final_review", kind: "pipe" }
```

## Deploy

```bash
kernuq schema formation
```

Deploy at runtime with `formation.deploy`, or let Cortex staff a team from one sentence (`cortex.interact` → `cortex.confirm_team`).
