{
  "name": "Pyragogy AI-driven handbook generator with multi-agent orchestration",
  "nodes": [
    {
      "id": "907e30c8-87e4-46f8-8863-9e3abf429415",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "position": [
        -1600,
        300
      ]
    },
    {
      "id": "ae6910fd-9244-4bab-a0f7-c91a4ad84f28",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1400,
        300
      ]
    },
    {
      "id": "a782c52f-b296-4477-8cf4-454a7df0c8a5",
      "name": "Check DB Connection",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -1200,
        300
      ]
    },
    {
      "id": "3df503dd-db5e-4bd1-8925-e715b8bbe03c",
      "name": "Meta-Orchestrator",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -1000,
        300
      ]
    },
    {
      "id": "a4c7eb13-bd36-4c9d-8927-2e6fe54c32a3",
      "name": "Parse Orchestration Plan",
      "type": "n8n-nodes-base.function",
      "position": [
        -800,
        300
      ]
    },
    {
      "id": "915e18ea-1540-4059-883f-739f77f41cc2",
      "name": "More Agents to Run?",
      "type": "n8n-nodes-base.if",
      "position": [
        -600,
        300
      ]
    },
    {
      "id": "6f478d71-791e-4f6b-b5e3-5b7b842181b0",
      "name": "Prepare Agent Input",
      "type": "n8n-nodes-base.function",
      "position": [
        -400,
        200
      ]
    },
    {
      "id": "d575e9c9-2d58-4061-944b-61b32d15eefb",
      "name": "Route Agents with Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -200,
        200
      ]
    },
    {
      "id": "3711824c-5a58-4e3d-95dd-3ca16cc551ca",
      "name": "Summarizer Agent",
      "type": "n8n-nodes-base.openAi",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "67b23742-e3bd-4437-99eb-957e6bc0912e",
      "name": "Synthesizer Agent",
      "type": "n8n-nodes-base.openAi",
      "position": [
        0,
        100
      ]
    },
    {
      "id": "8bfe179e-ed05-43df-b9c6-862f86c1189c",
      "name": "Peer Reviewer Agent",
      "type": "n8n-nodes-base.openAi",
      "position": [
        0,
        200
      ]
    },
    {
      "id": "2dc73ca6-f17f-4214-acbb-3ea3ed470f13",
      "name": "Sensemaking Agent",
      "type": "n8n-nodes-base.openAi",
      "position": [
        0,
        300
      ]
    },
    {
      "id": "ec3b9cc0-a039-4cac-90ca-7de54f41f5d4",
      "name": "Prompt Engineer Agent",
      "type": "n8n-nodes-base.openAi",
      "position": [
        0,
        400
      ]
    },
    {
      "id": "bc382e04-9c5d-4ab9-b874-2da213499614",
      "name": "Onboarding/Explainer Agent",
      "type": "n8n-nodes-base.openAi",
      "position": [
        0,
        500
      ]
    },
    {
      "id": "03017738-b11e-4016-8c05-65204ef7e8c3",
      "name": "Add Handbook Metadata",
      "type": "n8n-nodes-base.function",
      "position": [
        0,
        600
      ]
    },
    {
      "id": "d183d513-00a3-4a38-9ef8-37a646d2ad15",
      "name": "Generate Content for Review",
      "type": "n8n-nodes-base.function",
      "position": [
        200,
        600
      ]
    },
    {
      "id": "41919337-0762-47d0-9c7c-d51fa966caae",
      "name": "Generate Review ID",
      "type": "n8n-nodes-base.function",
      "position": [
        400,
        600
      ]
    },
    {
      "id": "6fb5b6d5-4ea8-49c9-9ebc-3c37eb2897b8",
      "name": "Send Review Request Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        600,
        600
      ]
    },
    {
      "id": "e69480df-aab3-4b05-8c2b-5ec369966084",
      "name": "Wait for Human Approval",
      "type": "n8n-nodes-base.wait",
      "position": [
        800,
        600
      ]
    },
    {
      "id": "80fca66e-fdc6-49b1-9873-b10c03409926",
      "name": "Human Decision Split",
      "type": "n8n-nodes-base.if",
      "position": [
        1000,
        600
      ]
    },
    {
      "id": "ed575c60-32e2-411e-9619-ac40ac647e3b",
      "name": "Save to handbook_entries",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1200,
        500
      ]
    },
    {
      "id": "a43a61ae-0062-4705-8ef2-a65d8bd65fb7",
      "name": "Prepare Approved Contribution Data",
      "type": "n8n-nodes-base.function",
      "position": [
        1400,
        500
      ]
    },
    {
      "id": "4a03b029-e65f-4844-a605-f668c39f05f7",
      "name": "Save Agent Contribution (Approved)",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1600,
        500
      ]
    },
    {
      "id": "9a3b2bdc-b894-4b5d-a783-003c1d0cbac5",
      "name": "Generate GitHub File Path",
      "type": "n8n-nodes-base.function",
      "position": [
        1800,
        500
      ]
    },
    {
      "id": "42831df9-f694-43fa-8612-b9aee95bef6c",
      "name": "GitHub Enabled?",
      "type": "n8n-nodes-base.if",
      "position": [
        2000,
        500
      ]
    },
    {
      "id": "2049ac7d-bf01-4d9b-a222-ca988892d1e6",
      "name": "Commit to GitHub (Approved)",
      "type": "n8n-nodes-base.github",
      "position": [
        2200,
        500
      ]
    },
    {
      "id": "352599e9-8b68-412c-bd28-f92844e9c712",
      "name": "Log Human Rejection",
      "type": "n8n-nodes-base.function",
      "position": [
        1200,
        700
      ]
    },
    {
      "id": "6f0ea479-d689-40fc-a72f-d1ad161f8743",
      "name": "Merge Archivist Paths",
      "type": "n8n-nodes-base.merge",
      "position": [
        2400,
        600
      ]
    },
    {
      "id": "ffd0ab23-cb9d-4ac1-ad3d-6fe856ca1fad",
      "name": "Evaluate Board Consensus",
      "type": "n8n-nodes-base.function",
      "position": [
        200,
        300
      ]
    },
    {
      "id": "f2ec87e5-0a06-4d8f-896b-a3d203fcea41",
      "name": "Check Redraft Needed",
      "type": "n8n-nodes-base.if",
      "position": [
        400,
        300
      ]
    },
    {
      "id": "413074bb-38ad-42d6-8d63-402e33528a5b",
      "name": "Handle Redraft",
      "type": "n8n-nodes-base.function",
      "position": [
        600,
        200
      ]
    },
    {
      "id": "6508f0f9-09c2-4fe6-8cae-eb90ea58d875",
      "name": "Process Agent Output",
      "type": "n8n-nodes-base.function",
      "position": [
        400,
        200
      ]
    },
    {
      "id": "2fd3c340-a2d0-489c-a098-42530fdb4c61",
      "name": "Slack Enabled?",
      "type": "n8n-nodes-base.if",
      "position": [
        -400,
        500
      ]
    },
    {
      "id": "314c7a11-493a-4550-9cd0-f1fc5e5b2994",
      "name": "Notify Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -200,
        500
      ]
    },
    {
      "id": "564a52df-8f4f-4be6-a219-b8c965eccd3b",
      "name": "Final Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -400,
        400
      ]
    },
    {
      "id": "generated-ce444b1c-b361-43c8-a0b6-29a1324993c5",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        -140
      ],
      "parameters": {
        "width": 1100,
        "height": 400,
        "content": "## Pyragogy AI Village Workflow\n\nThis workflow orchestrates an AI Village process for generating, reviewing, and publishing content to a handbook.\n\n**Key Stages:**\n1.  **Trigger & DB Check:** Initiate"
      }
    }
  ],
  "connections": {
    "Notify Slack": {
      "main": [
        [
          {
            "node": "Final Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handle Redraft": {
      "main": [
        [
          {
            "node": "More Agents to Run?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Enabled?": {
      "main": [
        [
          {
            "node": "Notify Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Final Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub Enabled?": {
      "main": [
        [
          {
            "node": "Commit to GitHub (Approved)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge Archivist Paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Check DB Connection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarizer Agent": {
      "main": [
        [
          {
            "node": "Process Agent Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Meta-Orchestrator": {
      "main": [
        [
          {
            "node": "Parse Orchestration Plan",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sensemaking Agent": {
      "main": [
        [
          {
            "node": "Prompt Engineer Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Synthesizer Agent": {
      "main": [
        [
          {
            "node": "Process Agent Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Review ID": {
      "main": [
        [
          {
            "node": "Send Review Request Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check DB Connection": {
      "main": [
        [
          {
            "node": "Meta-Orchestrator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Human Rejection": {
      "main": [
        [
          {
            "node": "Merge Archivist Paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "More Agents to Run?": {
      "main": [
        [
          {
            "node": "Prepare Agent Input",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack Enabled?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Peer Reviewer Agent": {
      "main": [
        [
          {
            "node": "Sensemaking Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Agent Input": {
      "main": [
        [
          {
            "node": "Route Agents with Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Redraft Needed": {
      "main": [
        [
          {
            "node": "Handle Redraft",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process Agent Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Human Decision Split": {
      "main": [
        [
          {
            "node": "Save to handbook_entries",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Human Rejection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Agent Output": {
      "main": [
        [
          {
            "node": "More Agents to Run?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Handbook Metadata": {
      "main": [
        [
          {
            "node": "Generate Content for Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Archivist Paths": {
      "main": [
        [
          {
            "node": "Process Agent Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prompt Engineer Agent": {
      "main": [
        [
          {
            "node": "Evaluate Board Consensus",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Human Approval": {
      "main": [
        [
          {
            "node": "Human Decision Split",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate Board Consensus": {
      "main": [
        [
          {
            "node": "Check Redraft Needed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Orchestration Plan": {
      "main": [
        [
          {
            "node": "More Agents to Run?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Agents with Switch": {
      "main": [
        [
          {
            "node": "Summarizer Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to handbook_entries": {
      "main": [
        [
          {
            "node": "Prepare Approved Contribution Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate GitHub File Path": {
      "main": [
        [
          {
            "node": "GitHub Enabled?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Review Request Email": {
      "main": [
        [
          {
            "node": "Wait for Human Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Onboarding/Explainer Agent": {
      "main": [
        [
          {
            "node": "Process Agent Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Commit to GitHub (Approved)": {
      "main": [
        [
          {
            "node": "Merge Archivist Paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Content for Review": {
      "main": [
        [
          {
            "node": "Generate Review ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Approved Contribution Data": {
      "main": [
        [
          {
            "node": "Save Agent Contribution (Approved)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Agent Contribution (Approved)": {
      "main": [
        [
          {
            "node": "Generate GitHub File Path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}