{
  "handle": "Step",
  "mechanism": "A unit of action that declares its own boundaries. It specifies: 1. Preconditions (what must be true before), 2. Action (what to do), 3. Postconditions (what will be true after), 4. Rollback (how to undo if needed). It acts as a node in a causal graph.",
  "gloss": "Atomic action with pre/post conditions",
  "failure_modes": [
    "Precondition violation: executed when preconditions were not met.",
    "Postcondition failure: completes without achieving its postconditions.",
    "Rollback failure: the declared undo does not restore the prior state, so the step is neither done nor undone."
  ],
  "invariants": [
    "Declares whether it can be rolled back, and how. A step that cannot be undone says so.",
    "Causal closure: preconditions are satisfiable by prior steps or the initial state."
  ],
  "_meta": {
    "tier": 1,
    "ring": 0,
    "related": [
      "Plan"
    ],
    "path": [
      "Infrastructure",
      "Data Structures"
    ],
    "supersedes": [
      "sema:Step#mh:SHA-256:aa73ad96f51e2c5fe3a5a42d251855eea9c8a75c93a50539f4d6c6635c8dd7d7"
    ]
  },
  "sema_id": "sema:Step#mh:SHA-256:fa207e6f70e14a67e3baa7e4ad4df9ece59ba4d07083fbbcc992332959e1520a",
  "sema_ref": "Step#fa20",
  "sema_stub": "fa20",
  "data_schema": {
    "type": "object",
    "required": [
      "step_id",
      "action_type",
      "params",
      "preconditions",
      "postconditions",
      "rollback"
    ],
    "properties": {
      "step_id": {
        "type": "string"
      },
      "action_type": {
        "type": "string",
        "description": "The verb or tool to invoke"
      },
      "params": {
        "type": "object",
        "description": "Arguments for the action"
      },
      "dependencies": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "IDs of steps that must complete first"
      },
      "retry_policy": {
        "type": "object",
        "properties": {
          "max_attempts": {
            "type": "integer"
          },
          "backoff_strategy": {
            "type": "string"
          }
        }
      },
      "preconditions": {
        "type": "array",
        "description": "What must be true before the action runs."
      },
      "postconditions": {
        "type": "array",
        "description": "What will be true after it succeeds."
      },
      "rollback": {
        "type": "object",
        "description": "How to undo the action, or an explicit statement that it cannot be undone."
      }
    }
  },
  "sema_layer": "Infrastructure",
  "sema_category": "Data Structures",
  "used_by": {
    "references": {
      "Plan": "sema:Plan#mh:SHA-256:246db278c5db286fcd78d824d85054fafb3348565ef584599b63900000c43b32",
      "Realizable": "sema:Realizable#mh:SHA-256:2ed7d7f05fe50ff38d46631e5334f2229c4c1f1118e0576d88388b23a586d622",
      "Workflow": "sema:Workflow#mh:SHA-256:808de72d3285e4ac086b85bfe4ba028ad2904b4088f7a22b60259ff8d8ffe057"
    }
  }
}
