{
  "artifactDir": ".pi/pi-materia",
  "activeLoadout": "Graph Semantics Example",
  "loadouts": {
    "Graph Semantics Example": {
      "entry": "Socket-1",
      "sockets": {
        "Socket-1": {
          "materia": "ensureArtifactsIgnored",
          "edges": [
            {
              "when": "always",
              "to": "Socket-2"
            }
          ]
        },
        "Socket-2": {
          "materia": "detectVcs",
          "edges": [
            {
              "when": "always",
              "to": "Socket-3"
            }
          ]
        },
        "Socket-3": {
          "materia": "Auto-Plan",
          "parse": "json",
          "assign": {
            "workItems": "$.workItems"
          },
          "edges": [
            {
              "when": "always",
              "to": "Socket-4"
            }
          ]
        },
        "Socket-4": {
          "materia": "Build",
          "parse": "text",
          "edges": [
            {
              "when": "always",
              "to": "Socket-5"
            }
          ]
        },
        "Socket-5": {
          "materia": "Auto-Eval",
          "parse": "json",
          "assign": {
            "lastCheck": "$",
            "lastContext": "$.context"
          },
          "edges": [
            {
              "when": "satisfied",
              "to": "Socket-6"
            },
            {
              "when": "not_satisfied",
              "to": "Socket-4",
              "maxTraversals": 3
            }
          ]
        },
        "Socket-6": {
          "materia": "Maintain",
          "parse": "json",
          "assign": {
            "lastMaintain": "$"
          },
          "advance": {
            "cursor": "workItemIndex",
            "items": "state.workItems",
            "done": "end",
            "when": "satisfied"
          },
          "edges": [
            {
              "when": "not_satisfied",
              "to": "Socket-6",
              "maxTraversals": 3
            },
            {
              "when": "always",
              "to": "Socket-4"
            }
          ]
        }
      },
      "loops": {
        "workItemIteration": {
          "sockets": [
            "Socket-4",
            "Socket-5",
            "Socket-6"
          ],
          "consumes": {
            "from": "Socket-3",
            "output": "workItems"
          },
          "exit": {
            "from": "Socket-6",
            "when": "satisfied",
            "to": "end"
          }
        }
      }
    }
  },
  "materia": {
    "ensureArtifactsIgnored": {
      "type": "utility",
      "label": "Ensure artifacts ignored",
      "description": "Ensures .pi/pi-materia/ is ignored by the project.",
      "group": "Utility",
      "command": [
        "node",
        "../config/utilities/ensure-ignored.mjs"
      ],
      "parse": "json",
      "params": {
        "patterns": [
          ".pi/pi-materia/"
        ]
      },
      "assign": {
        "artifactIgnore": "$.state.artifactIgnore"
      }
    },
    "detectVcs": {
      "type": "utility",
      "label": "Detect VCS",
      "description": "Detects jj/git availability and repository root.",
      "group": "Utility",
      "command": [
        "node",
        "../config/utilities/detect-vcs.mjs"
      ],
      "parse": "json",
      "assign": {
        "vcs": "$.state.vcs"
      }
    },
    "Auto-Plan": {
      "tools": "readOnly",
      "prompt": "Return compact JSON with ordered workItems and optional context. Use workItems, not tasks; each item has only title and context strings.",
      "generator": true
    },
    "Build": {
      "tools": "coding",
      "prompt": "Implement the current workItem supplied by the socket adapter, using adapter-provided context. Return a concise text implementation summary."
    },
    "Auto-Eval": {
      "tools": "readOnly",
      "prompt": "Evaluate the current workItem and return compact JSON with satisfied and context."
    },
    "Maintain": {
      "tools": "coding",
      "prompt": "Checkpoint accepted work and return compact JSON with satisfied plus explanatory context. Put deterministic maintenance details in utility state, not agent handoff JSON."
    }
  }
}
