{
  "schemaVersion": "0.1",
  "id": "f_01KWC5ZHNRJ8K47M1DM6ZZ7D35",
  "name": "ci-multi-agent-review",
  "createdAt": "2026-06-30T11:52:37.8160068+00:00",
  "modifiedAt": "2026-07-03T07:37:50.3008118+00:00",
  "nodes": [
    {
      "id": "aggregate",
      "typeId": "text.format",
      "parameters": {
        "inputCount": "8",
        "optionalInputs": "true",
        "placeholder": "",
        "template": "=== RESULT: codex ===\n{in1}\n\n=== RESULT: claude ===\n{in2}\n\n=== RESULT: gemini ===\n{in3}\n\n=== RESULT: grok ===\n{in4}\n\n=== ERROR: codex ===\n{in5}\n\n=== ERROR: claude ===\n{in6}\n\n=== ERROR: gemini ===\n{in7}\n\n=== ERROR: grok ===\n{in8}"
      },
      "ui": {
        "x": 835,
        "y": 224
      }
    },
    {
      "id": "aggregateFile",
      "typeId": "file.write",
      "parameters": {
        "append": "false",
        "createDirectories": "true",
        "encoding": "utf-8",
        "path": "(wired via aggregatePath)"
      },
      "ui": {
        "x": 1070,
        "y": 332
      }
    },
    {
      "id": "aggregatePath",
      "typeId": "text.format",
      "parameters": {
        "inputCount": "1",
        "optionalInputs": "false",
        "placeholder": "",
        "template": "{in1}/.mar-out/agents-aggregate.txt"
      },
      "ui": {
        "x": 260,
        "y": 249
      }
    },
    {
      "id": "availability",
      "typeId": "text.format",
      "parameters": {
        "inputCount": "4",
        "optionalInputs": "true",
        "placeholder": "",
        "template": "{in1}{in2}{in3}{in4}"
      },
      "ui": {
        "x": 840,
        "y": 705
      }
    },
    {
      "id": "claude",
      "typeId": "agent.cli",
      "parameters": {
        "customCommand": "",
        "customPromptMode": "arg",
        "env": null,
        "errorMarker": "__UNAVAILABLE__ ",
        "errorOutput": "true",
        "errorOutputMode": "port",
        "errorTailChars": "2000",
        "executablePath": null,
        "extraArgs": "--permission-mode\nplan\n--disallowedTools\nEdit\nWrite\nBash\nWebFetch\nWebSearch\nTask",
        "failOnError": "false",
        "failOnNonZeroExit": "false",
        "model": "",
        "secretEnv": "ANTHROPIC_API_KEY=claude",
        "task": null,
        "timeoutSeconds": "900",
        "tool": "claude",
        "workingDirectory": null
      },
      "ui": {
        "x": 495,
        "y": 106
      }
    },
    {
      "id": "codex",
      "typeId": "agent.cli",
      "parameters": {
        "customCommand": "",
        "customPromptMode": "arg",
        "env": null,
        "errorMarker": "__UNAVAILABLE__ ",
        "errorOutput": "true",
        "errorOutputMode": "port",
        "errorTailChars": "2000",
        "executablePath": null,
        "extraArgs": "--sandbox\nread-only",
        "failOnError": "false",
        "failOnNonZeroExit": "false",
        "model": "",
        "secretEnv": "CODEX_API_KEY=openai",
        "task": null,
        "timeoutSeconds": "900",
        "tool": "codex",
        "workingDirectory": null
      },
      "ui": {
        "x": 495,
        "y": 272
      }
    },
    {
      "id": "commentsVal",
      "typeId": "input.value",
      "parameters": {
        "label": "comments (--var comments)",
        "value": "{{var.comments}}"
      },
      "ui": {
        "x": 80,
        "y": 391
      }
    },
    {
      "id": "consensus",
      "typeId": "agent.cli",
      "parameters": {
        "customCommand": "",
        "customPromptMode": "arg",
        "env": null,
        "errorMarker": "__AGENT_ERROR__",
        "errorOutput": "false",
        "errorOutputMode": "port",
        "errorTailChars": "2000",
        "executablePath": null,
        "extraArgs": "--permission-mode\nplan\n--disallowedTools\nEdit\nWrite\nBash\nWebFetch\nWebSearch\nTask",
        "failOnError": "false",
        "failOnNonZeroExit": "false",
        "model": "opus",
        "secretEnv": "ANTHROPIC_API_KEY=claude",
        "task": null,
        "timeoutSeconds": "600",
        "tool": "claude",
        "workingDirectory": null
      },
      "ui": {
        "x": 1575,
        "y": 355
      }
    },
    {
      "id": "consensusTask",
      "typeId": "text.format",
      "parameters": {
        "inputCount": "1",
        "optionalInputs": "false",
        "placeholder": "",
        "template": "You are aggregating code-review findings from up to four independent expert AI reviewers (codex, claude, gemini, grok). Their raw outputs are below, one section per reviewer: a \u0060=== RESULT: \u003Cname\u003E ===\u0060 section holds that reviewer\u0027s findings as a JSON array (it may be wrapped in prose or a \u0060\u0060\u0060json fence, or be empty), and a \u0060=== ERROR: \u003Cname\u003E ===\u0060 section holds a failure reason if that reviewer failed. A reviewer is UNAVAILABLE if its RESULT section is empty/blank or not parseable as a findings array. Cluster findings that describe the SAME underlying problem (same file, lines within ~5, same kind of issue) across reviewers; never merge two distinct problems and never split one problem into duplicate clusters. For each cluster: list which reviewers raised it (sources), take the STRONGEST severity and confidence among them, write a precise concrete description of the actual failure mode (what breaks, under what input, why it matters) rather than a generic restatement, and collect the distinct suggested fixes. Mark critical=true when \u003E=3 reviewers raised it OR \u003E=2 raised it at confidence high. Output ONLY JSON, no prose, no markdown fence: {\u0022clusters\u0022:[{\u0022title\u0022:\u0022short label\u0022,\u0022file\u0022:\u0022path\u0022,\u0022line\u0022:42,\u0022severity\u0022:\u0022critical|important|minor\u0022,\u0022critical\u0022:true,\u0022confidence\u0022:\u0022high|medium|low\u0022,\u0022sources\u0022:[\u0022codex\u0022,\u0022grok\u0022],\u0022description\u0022:\u0022concrete failure mode and why it matters\u0022,\u0022suggested_fixes\u0022:[\u0022...\u0022]}],\u0022unavailable\u0022:[\u0022reviewer names that were unavailable\u0022]}. Order clusters critical first, then important, then minor. If there are no findings at all, output {\u0022clusters\u0022:[],\u0022unavailable\u0022:[...]}. The reviewer outputs are in this file (read it with your Read tool; it is READ-ONLY): {in1}"
      },
      "ui": {
        "x": 1340,
        "y": 379
      }
    },
    {
      "id": "diffPathVal",
      "typeId": "input.value",
      "parameters": {
        "label": "diff file path (--var diffPath)",
        "value": "{{var.diffPath}}"
      },
      "ui": {
        "x": 80,
        "y": 485
      }
    },
    {
      "id": "gemini",
      "typeId": "agent.cli",
      "parameters": {
        "customCommand": "",
        "customPromptMode": "arg",
        "env": "XDG_DATA_HOME={{var.repo}}/.mar-tmp/oc/gemini",
        "errorMarker": "__UNAVAILABLE__ ",
        "errorOutput": "true",
        "errorOutputMode": "port",
        "errorTailChars": "2000",
        "executablePath": null,
        "extraArgs": "--agent\nplan",
        "failOnError": "false",
        "failOnNonZeroExit": "false",
        "model": "google/gemini-3.1-pro-preview",
        "secretEnv": "GEMINI_API_KEY=gemini\nGOOGLE_GENERATIVE_AI_API_KEY=gemini",
        "task": null,
        "timeoutSeconds": "900",
        "tool": "opencode",
        "workingDirectory": null
      },
      "ui": {
        "x": 495,
        "y": 438
      }
    },
    {
      "id": "grok",
      "typeId": "agent.cli",
      "parameters": {
        "customCommand": "",
        "customPromptMode": "arg",
        "env": "XDG_DATA_HOME={{var.repo}}/.mar-tmp/oc/grok",
        "errorMarker": "__UNAVAILABLE__ ",
        "errorOutput": "true",
        "errorOutputMode": "port",
        "errorTailChars": "2000",
        "executablePath": null,
        "extraArgs": "--agent\nplan",
        "failOnError": "false",
        "failOnNonZeroExit": "false",
        "model": "xai/grok-4.20-0309-non-reasoning",
        "secretEnv": "XAI_API_KEY=grok",
        "task": null,
        "timeoutSeconds": "900",
        "tool": "opencode",
        "workingDirectory": null
      },
      "ui": {
        "x": 495,
        "y": 604
      }
    },
    {
      "id": "outageGuard",
      "typeId": "logic.assert",
      "parameters": {
        "compareTo": "",
        "message": "multi-agent-review: ALL reviewers failed to produce output \u2014 failing the run (deterministic total-outage guard)",
        "operator": "isEmpty",
        "sense": "failWhen"
      },
      "ui": {
        "x": 1080,
        "y": 705
      }
    },
    {
      "id": "rawdump",
      "typeId": "text.format",
      "parameters": {
        "inputCount": "20",
        "optionalInputs": "true",
        "placeholder": "(none)",
        "template": "######## codex ########\n[exitCode] {in1}\n[stdout]\n{in2}\n[stderr]\n{in3}\n[error] {in4}\n\n######## claude ########\n[exitCode] {in5}\n[stdout]\n{in6}\n[stderr]\n{in7}\n[error] {in8}\n\n######## gemini ########\n[exitCode] {in9}\n[stdout]\n{in10}\n[stderr]\n{in11}\n[error] {in12}\n\n######## grok ########\n[exitCode] {in13}\n[stdout]\n{in14}\n[stderr]\n{in15}\n[error] {in16}\n\n######## consensus ########\n[exitCode] {in17}\n[stdout]\n{in18}\n[stderr]\n{in19}\n[error] {in20}"
      },
      "ui": {
        "x": 1915,
        "y": 80
      }
    },
    {
      "id": "rawfile",
      "typeId": "file.write",
      "parameters": {
        "append": "false",
        "createDirectories": "true",
        "encoding": "utf-8",
        "path": "(wired via rawpath)"
      },
      "ui": {
        "x": 2255,
        "y": 379
      }
    },
    {
      "id": "rawpath",
      "typeId": "text.format",
      "parameters": {
        "inputCount": "1",
        "optionalInputs": "false",
        "placeholder": "",
        "template": "{in1}/.mar-out/agents-raw.log"
      },
      "ui": {
        "x": 260,
        "y": 367
      }
    },
    {
      "id": "render",
      "typeId": "script.run",
      "parameters": {
        "code": "import sys, os, runpy\nsys.argv = [\u0022render\u0022, os.getcwd()]\nrunpy.run_path(os.path.abspath(r\u0022{{var.rendererPath}}\u0022), run_name=\u0022__main__\u0022)\n",
        "env": null,
        "failOnNonZeroExit": "true",
        "language": "python",
        "secretEnv": null,
        "timeoutSeconds": "60",
        "workingDirectory": null
      },
      "ui": {
        "x": 1915,
        "y": 630
      }
    },
    {
      "id": "repoVal",
      "typeId": "input.value",
      "parameters": {
        "label": "repo (--var repo)",
        "value": "{{var.repo}}"
      },
      "ui": {
        "x": 80,
        "y": 297
      }
    },
    {
      "id": "task",
      "typeId": "text.format",
      "parameters": {
        "inputCount": "3",
        "optionalInputs": "false",
        "placeholder": "",
        "template": "You are an expert code reviewer in READ-ONLY mode. Review the unified diff in this file: {in1} . Additional reviewer comments: {in2} . Repository working directory (read-only), for context only: {in3} . FOCUS on what THIS diff changes and the bugs/risks it introduces or exposes; do NOT audit unrelated pre-existing code. Review for: (1) correctness and robustness: bugs, swallowed/unhandled errors, edge cases, null/concurrency/races, resource leaks; (2) security; (3) readability: intent-revealing names, one responsibility per unit, shallow nesting, comments that explain WHY not what; (4) maintainability: genuine (not superficial) duplication, magic values, dead code, missing tests for changed behavior, over-engineering (YAGNI). Rules: respect the codebase\u0027s EXISTING conventions (flag inconsistency, not your personal preference); do NOT invent requirements (if needed context is missing, say so instead of assuming); be proportional (no architectural essays for a small change). Output ONLY a JSON array, no prose: [{\u0022file\u0022:\u0022path\u0022,\u0022line\u0022:42,\u0022severity\u0022:\u0022critical|important|minor\u0022,\u0022confidence\u0022:\u0022high|medium|low\u0022,\u0022description\u0022:\u0022the concrete failure mode or cost: what breaks and why it matters\u0022,\u0022suggested_fix\u0022:\u0022corrected code or approach, or null\u0022}] . Severity: critical=bug/security/crash/data-loss/race; important=wrong logic/missing validation/null risk/unhandled error; minor=readability/naming/style/docs (advisory). If nothing is wrong, return []."
      },
      "ui": {
        "x": 260,
        "y": 485
      }
    }
  ],
  "connections": [
    {
      "id": "c_01KWK82HMPMJ54MMN7GPGQP87D",
      "fromNode": "aggregate",
      "fromPort": "result",
      "toNode": "aggregateFile",
      "toPort": "content"
    },
    {
      "id": "c_aggfilepath_to_consensustask",
      "fromNode": "aggregateFile",
      "fromPort": "path",
      "toNode": "consensusTask",
      "toPort": "in1"
    },
    {
      "id": "c_aggpath_to_aggfile",
      "fromNode": "aggregatePath",
      "fromPort": "result",
      "toNode": "aggregateFile",
      "toPort": "path"
    },
    {
      "id": "c_01KWKCPX7Q20MM2EEGQ7R3EN7Q",
      "fromNode": "availability",
      "fromPort": "result",
      "toNode": "outageGuard",
      "toPort": "in"
    },
    {
      "id": "c_01KWD2BBFV05EQ5R5HXPGF7HFF",
      "fromNode": "claude",
      "fromPort": "error",
      "toNode": "aggregate",
      "toPort": "in6"
    },
    {
      "id": "c_01KWJDA8V1R6WSKNW7T5DRRHAR",
      "fromNode": "claude",
      "fromPort": "error",
      "toNode": "rawdump",
      "toPort": "in8"
    },
    {
      "id": "c_01KWJD9E6NN453ZCB3GZ16ANM6",
      "fromNode": "claude",
      "fromPort": "exitCode",
      "toNode": "rawdump",
      "toPort": "in5"
    },
    {
      "id": "c_01KWJDA0MCBTWXHNGNQYB2NMR4",
      "fromNode": "claude",
      "fromPort": "stderr",
      "toNode": "rawdump",
      "toPort": "in7"
    },
    {
      "id": "c_01KWCZSP40C6HGVKY2DYMFEP9J",
      "fromNode": "claude",
      "fromPort": "stdout",
      "toNode": "aggregate",
      "toPort": "in2"
    },
    {
      "id": "c_01KWKCPGR2XR0PTW1Y9MXSBJCN",
      "fromNode": "claude",
      "fromPort": "stdout",
      "toNode": "availability",
      "toPort": "in2"
    },
    {
      "id": "c_01KWJD9QWQ65J7BS9DMVXEST07",
      "fromNode": "claude",
      "fromPort": "stdout",
      "toNode": "rawdump",
      "toPort": "in6"
    },
    {
      "id": "c_01KWD2B7GXBR55VBMT4C2ZGE2J",
      "fromNode": "codex",
      "fromPort": "error",
      "toNode": "aggregate",
      "toPort": "in5"
    },
    {
      "id": "c_01KWJD977YPQY8XC795KRZPN9K",
      "fromNode": "codex",
      "fromPort": "error",
      "toNode": "rawdump",
      "toPort": "in4"
    },
    {
      "id": "c_01KWJD8GMBBSSETNJWQ30R7WFZ",
      "fromNode": "codex",
      "fromPort": "exitCode",
      "toNode": "rawdump",
      "toPort": "in1"
    },
    {
      "id": "c_01KWJD8Y79TMYPGM94DJE6HEXT",
      "fromNode": "codex",
      "fromPort": "stderr",
      "toNode": "rawdump",
      "toPort": "in3"
    },
    {
      "id": "c_01KWCZSGREW0J154XAHF6D5R6M",
      "fromNode": "codex",
      "fromPort": "stdout",
      "toNode": "aggregate",
      "toPort": "in1"
    },
    {
      "id": "c_01KWKCPDFW9ZD0PJSDXZ3KAK7Y",
      "fromNode": "codex",
      "fromPort": "stdout",
      "toNode": "availability",
      "toPort": "in1"
    },
    {
      "id": "c_01KWJD8QBBBRCAAHG2AM4Q9SHB",
      "fromNode": "codex",
      "fromPort": "stdout",
      "toNode": "rawdump",
      "toPort": "in2"
    },
    {
      "id": "c_9cc569ba8e31",
      "fromNode": "commentsVal",
      "fromPort": "value",
      "toNode": "task",
      "toPort": "in2"
    },
    {
      "id": "c_01KWJDDBS4YP4WE515D4X2PYR7",
      "fromNode": "consensus",
      "fromPort": "error",
      "toNode": "rawdump",
      "toPort": "in20"
    },
    {
      "id": "c_01KWJDCJEBE8JGEY21GV01K193",
      "fromNode": "consensus",
      "fromPort": "exitCode",
      "toNode": "rawdump",
      "toPort": "in17"
    },
    {
      "id": "c_01KWJDD41VBFJDNQ5VAMMV8GM6",
      "fromNode": "consensus",
      "fromPort": "stderr",
      "toNode": "rawdump",
      "toPort": "in19"
    },
    {
      "id": "c_01KWJDCWJ2DNP5ZQP9538NYJJK",
      "fromNode": "consensus",
      "fromPort": "stdout",
      "toNode": "rawdump",
      "toPort": "in18"
    },
    {
      "id": "c_153ccd9c8e20",
      "fromNode": "consensus",
      "fromPort": "stdout",
      "toNode": "render",
      "toPort": "stdin"
    },
    {
      "id": "c_eff567615bbf",
      "fromNode": "consensusTask",
      "fromPort": "result",
      "toNode": "consensus",
      "toPort": "task"
    },
    {
      "id": "c_57a926e5ce5c",
      "fromNode": "diffPathVal",
      "fromPort": "value",
      "toNode": "task",
      "toPort": "in1"
    },
    {
      "id": "c_01KWD2BEX6W01JXFJ5B3ZG4R0A",
      "fromNode": "gemini",
      "fromPort": "error",
      "toNode": "aggregate",
      "toPort": "in7"
    },
    {
      "id": "c_01KWJDBAVKC96M4PQGNHN5N9MV",
      "fromNode": "gemini",
      "fromPort": "error",
      "toNode": "rawdump",
      "toPort": "in12"
    },
    {
      "id": "c_01KWJDAHQJ1SH3VA36EGFA9QG6",
      "fromNode": "gemini",
      "fromPort": "exitCode",
      "toNode": "rawdump",
      "toPort": "in9"
    },
    {
      "id": "c_01KWJDB3WJ3HS9MFYNHGWS02FC",
      "fromNode": "gemini",
      "fromPort": "stderr",
      "toNode": "rawdump",
      "toPort": "in11"
    },
    {
      "id": "c_01KWCZSVKQHFPANHGCTBHWJPX7",
      "fromNode": "gemini",
      "fromPort": "stdout",
      "toNode": "aggregate",
      "toPort": "in3"
    },
    {
      "id": "c_01KWKCPM8M3PNY7E9Z6DCYK8TV",
      "fromNode": "gemini",
      "fromPort": "stdout",
      "toNode": "availability",
      "toPort": "in3"
    },
    {
      "id": "c_01KWJDAT2J1B2YXNDBBS1HEH1W",
      "fromNode": "gemini",
      "fromPort": "stdout",
      "toNode": "rawdump",
      "toPort": "in10"
    },
    {
      "id": "c_01KWD2BJZWJSPSRKCM4D0FB0S4",
      "fromNode": "grok",
      "fromPort": "error",
      "toNode": "aggregate",
      "toPort": "in8"
    },
    {
      "id": "c_01KWJDC9TW8Q2A8TA0750BFMGT",
      "fromNode": "grok",
      "fromPort": "error",
      "toNode": "rawdump",
      "toPort": "in16"
    },
    {
      "id": "c_01KWJDBK0BBA5STHK82GAFB3KV",
      "fromNode": "grok",
      "fromPort": "exitCode",
      "toNode": "rawdump",
      "toPort": "in13"
    },
    {
      "id": "c_01KWJDC1QPF62NE5TZ2N2ATZXQ",
      "fromNode": "grok",
      "fromPort": "stderr",
      "toNode": "rawdump",
      "toPort": "in15"
    },
    {
      "id": "c_01KWCZSZGRC6MC23SJHG8EV3FS",
      "fromNode": "grok",
      "fromPort": "stdout",
      "toNode": "aggregate",
      "toPort": "in4"
    },
    {
      "id": "c_01KWKCPRQ7DNHXWSMH6QQ7KEND",
      "fromNode": "grok",
      "fromPort": "stdout",
      "toNode": "availability",
      "toPort": "in4"
    },
    {
      "id": "c_01KWJDBSXPAP7GB83A38EY3Q68",
      "fromNode": "grok",
      "fromPort": "stdout",
      "toNode": "rawdump",
      "toPort": "in14"
    },
    {
      "id": "c_01KWJDE45XDFH3MZZG8821BZWP",
      "fromNode": "rawdump",
      "fromPort": "result",
      "toNode": "rawfile",
      "toPort": "content"
    },
    {
      "id": "c_01KWJDDW26Z75GD8HM454NTD5K",
      "fromNode": "rawpath",
      "fromPort": "result",
      "toNode": "rawfile",
      "toPort": "path"
    },
    {
      "id": "c_repoval_to_aggpath",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "aggregatePath",
      "toPort": "in1"
    },
    {
      "id": "c_ac8bf91d2be4",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "claude",
      "toPort": "workingDirectory"
    },
    {
      "id": "c_f58c44cce466",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "codex",
      "toPort": "workingDirectory"
    },
    {
      "id": "c_0aef01e6cde6",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "consensus",
      "toPort": "workingDirectory"
    },
    {
      "id": "c_9d3afdbfb600",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "gemini",
      "toPort": "workingDirectory"
    },
    {
      "id": "c_fa9b13eb508d",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "grok",
      "toPort": "workingDirectory"
    },
    {
      "id": "c_01KWJDDK7PHWPCKTRJB2B5YN22",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "rawpath",
      "toPort": "in1"
    },
    {
      "id": "c_96aa71071d75",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "render",
      "toPort": "workingDirectory"
    },
    {
      "id": "c_41afabf5e448",
      "fromNode": "repoVal",
      "fromPort": "value",
      "toNode": "task",
      "toPort": "in3"
    },
    {
      "id": "c_3ef8bcaac17a",
      "fromNode": "task",
      "fromPort": "result",
      "toNode": "claude",
      "toPort": "task"
    },
    {
      "id": "c_fc9a5319f6c6",
      "fromNode": "task",
      "fromPort": "result",
      "toNode": "codex",
      "toPort": "task"
    },
    {
      "id": "c_d4df64973c37",
      "fromNode": "task",
      "fromPort": "result",
      "toNode": "gemini",
      "toPort": "task"
    },
    {
      "id": "c_4acae2f927c0",
      "fromNode": "task",
      "fromPort": "result",
      "toNode": "grok",
      "toPort": "task"
    }
  ]
}
