{
  "contract": "algal.organism.v1",
  "key": "organism:habitat-propose",
  "name": "HabitatPropose",
  "budgets": {
    "maxAgentCalls": 4,
    "maxContextBytes": 65536,
    "maxDepth": 4,
    "maxOutputBytes": 65536,
    "maxSteps": 32,
    "maxWork": 10000
  },
  "cells": [
    {
      "id": "goal",
      "kind": "input",
      "outputs": {
        "text": {
          "type": "text"
        }
      }
    },
    {
      "id": "history",
      "kind": "slot",
      "name": "population",
      "mode": "read",
      "default": []
    },
    {
      "id": "designer",
      "kind": "agent",
      "prompt": "Design a tiny child organism that exposes an 'out' output containing the goal string.",
      "view": {
        "inputs": "*"
      },
      "output": {
        "kind": "json",
        "schema": {
          "type": "object"
        }
      },
      "inputs": {
        "goal": {
          "type": "text"
        }
      }
    },
    {
      "id": "run",
      "kind": "spawn"
    },
    {
      "id": "append",
      "kind": "fn",
      "fn": "push.v1"
    },
    {
      "id": "record",
      "kind": "slot",
      "name": "population",
      "mode": "write"
    }
  ],
  "edges": [
    {
      "from": {
        "cell": "goal",
        "port": "text"
      },
      "to": {
        "cell": "designer",
        "port": "goal"
      }
    },
    {
      "from": {
        "cell": "designer",
        "port": "out"
      },
      "to": {
        "cell": "run",
        "port": "manifest"
      }
    },
    {
      "from": {
        "cell": "run",
        "port": "digest"
      },
      "to": {
        "cell": "append",
        "port": "item"
      }
    },
    {
      "from": {
        "cell": "history",
        "port": "data"
      },
      "to": {
        "cell": "append",
        "port": "list"
      }
    },
    {
      "from": {
        "cell": "append",
        "port": "value"
      },
      "to": {
        "cell": "record",
        "port": "data"
      }
    }
  ],
  "note": "A parent organism proposes a child manifest, spawns it, and records the child digest in a durable population slot. The child is data, not code; the host still decides whether to admit or promote it.",
  "interface": {
    "inputs": {
      "goal": {
        "cell": "goal",
        "port": "text"
      }
    },
    "outputs": {
      "child": {
        "cell": "run",
        "port": "digest"
      },
      "population": {
        "cell": "record",
        "port": "data"
      }
    }
  }
}
