{
  "nodes": [
    {
      "parameters": {},
      "id": "4ddb7209-9187-45e2-9c38-5834f9614953",
      "name": "Start (Manual)",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -528,
        560
      ]
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh agents 2>&1); echo \\\"$OUTPUT\\\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:agents; echo \\\"$OUTPUT\\\""
      },
      "id": "1c6cde41-b7d3-4e11-aa06-722e647a8965",
      "name": "Test: Agent Management APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        -16
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh workflows 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:workflows; echo \"$OUTPUT\""
      },
      "id": "98384de5-c433-47f4-a964-4b83ca9ed092",
      "name": "Test: Workflow Management APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        176
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh context 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:context; echo \"$OUTPUT\""
      },
      "id": "10e3f5af-8292-4753-987d-9854512d0c24",
      "name": "Test: Context Engineering APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        368
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh knowledge 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:knowledge; echo \"$OUTPUT\""
      },
      "id": "57635251-488d-44d7-8758-cfa7bb0db3ec",
      "name": "Test: Knowledge/Memory APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        560
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh playbooks 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:playbooks; echo \"$OUTPUT\""
      },
      "id": "f000272a-55dc-4988-b70b-df43244a3c86",
      "name": "Test: Multi-Agent System APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        752
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh settings 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:settings; echo \"$OUTPUT\""
      },
      "id": "f3599242-44fa-4341-a4ab-357ddfe4e03b",
      "name": "Test: Security & Performance APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        944
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh analytics 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:analytics; echo \"$OUTPUT\""
      },
      "id": "004fbc24-10ea-47a0-885a-718be1671b6e",
      "name": "Test: Analytics & Monitoring APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        1136
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh context_policy 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:context_policy; echo \"$OUTPUT\""
      },
      "id": "context-policy-test-node",
      "name": "Test: Context Policy APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        1328
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh code_graph 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:code_graph; echo \"$OUTPUT\""
      },
      "id": "code-graph-test-node",
      "name": "Test: Code Graph APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        1520
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh playbooks_api 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:playbooks_api; echo \"$OUTPUT\""
      },
      "id": "playbooks-api-test-node",
      "name": "Test: Playbooks APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        1712
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; OUTPUT=$(./scripts/run_module_tests.sh patterns 2>&1); echo \"$OUTPUT\" | redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' -x set test_result:patterns; echo \"$OUTPUT\""
      },
      "id": "patterns-test-node",
      "name": "Test: Patterns APIs",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -304,
        1904
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "bash -lc \"python3 - <<'PY'\nimport json\nimport subprocess\nimport re\n\n# Function to get data from Redis and parse test output\ndef get_redis_key(key):\n    try:\n        result = subprocess.run(['redis-cli', '-h', '172.21.0.3', '-p', '6379', '-a', 'xplaincrypto-redis-35e759ed354c458f', 'get', key], \n                              capture_output=True, text=True, check=True)\n        data = result.stdout.strip()\n        if data and data != '(nil)':\n            # Parse test output instead of expecting JSON\n            return parse_test_output(data)\n        else:\n            return {'ok': False, 'error': 'No data found in Redis', 'key': key}\n    except Exception as e:\n        return {'ok': False, 'error': str(e), 'key': key}\n\n# Parse test output to extract meaningful data\ndef parse_test_output(output):\n    try:\n        # Extract key metrics from test output\n        total_tests_match = re.search(r'Total Tests: (\\d+)', output)\n        passed_match = re.search(r'\u2705 Passed: (\\d+)', output)\n        failed_match = re.search(r'\u274c Failed: (\\d+)', output)\n        success_rate_match = re.search(r'Success Rate: ([\\d.]+)%', output)\n        status_match = re.search(r'\u26a0\ufe0f Overall Status: (\\w+)', output)\n        \n        total_tests = int(total_tests_match.group(1)) if total_tests_match else 0\n        passed = int(passed_match.group(1)) if passed_match else 0\n        failed = int(failed_match.group(1)) if failed_match else 0\n        success_rate = float(success_rate_match.group(1)) if success_rate_match else 0\n        status = status_match.group(1) if status_match else 'UNKNOWN'\n        \n        # Extract failed test details\n        failed_tests = re.findall(r'\u274c (test_\\w+) - failed', output)\n        \n        return {\n            'ok': True,\n            'summary': {\n                'total_tests': total_tests,\n                'passed': passed,\n                'failed': failed,\n                'success_rate': success_rate,\n                'status': status.lower()\n            },\n            'failed_tests': failed_tests,\n            'raw_output': output[:500] + '...' if len(output) > 500 else output\n        }\n    except Exception as e:\n        return {\n            'ok': False,\n            'error': f'Failed to parse test output: {str(e)}',\n            'raw_output': output[:200] + '...' if len(output) > 200 else output\n        }\n\n# Collect all test results from Redis\ntest_modules = ['agents', 'workflows', 'context', 'knowledge', 'playbooks', 'settings', 'analytics', 'context_policy', 'code_graph', 'playbooks_api', 'patterns']\nout = {}\n\nfor module in test_modules:\n    redis_key = f'test_result:{module}'\n    result = get_redis_key(redis_key)\n    out[module] = result\n\nprint(json.dumps(out))\nPY\""
      },
      "id": "320ded60-7b7e-4f7e-a3e2-d08c974e74b0",
      "name": "Collect: All Test Reports",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        -80,
        560
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Parse the collected test reports\nconst originalStdout = $json.stdout || '{}';\nlet testReports = {}; \n\nconst timestamp = new Date().toISOString();\nconst sessionId = `automatos-testing-${Date.now()}`;\n\n// Function to log to console with session info\nfunction logTrace(message) {\n  const logEntry = `${timestamp} [${sessionId}] CALCULATE: ${message}`;\n  console.log(logEntry);\n}\n\nlogTrace('\ud83d\udd0d TRACE: Calculate Node Starting');\nlogTrace(`\ud83d\udce5 INPUT: stdout length: ${originalStdout.length}`);\nlogTrace(`\ud83d\udce5 INPUT: First 200 chars: ${originalStdout.substring(0, 200)}`);\n\ntry { \n  testReports = JSON.parse(originalStdout); \n  logTrace(`\u2705 PARSE: Successfully parsed JSON, keys: ${Object.keys(testReports).join(', ')}`);\n} catch(e){ \n  logTrace(`\u274c PARSE: Failed to parse stdout: ${e.message}`);\n  testReports = {}; \n} \n\nconst groups = ['agents','workflows','context','knowledge','playbooks','settings','analytics','context_policy','code_graph','playbooks_api','patterns']; \nconst fails = []; \nlet totalTests = 0, totalPassed = 0; \n\n// Process each test module report\nfor (const group of groups) {\n  const report = testReports[group];\n  const groupInfo = `${report ? 'found' : 'missing'} ${report?.summary ? `${report.summary.total_tests} tests` : 'no summary'}`;\n  logTrace(`\ud83d\udcca GROUP ${group}: ${groupInfo}`);\n  \n  if (!report || report.ok === false) {\n    fails.push(group + ' (missing/error)');\n    continue;\n  }\n  \n  // Check if this group has test results\n  if (report.summary) {\n    const summary = report.summary;\n    totalTests += summary.total_tests || 0;\n    totalPassed += summary.passed || 0;\n    \n    // Mark as failed if success rate < 85% or status is failed\n    const groupSuccessRate = summary.success_rate || 0;\n    if (groupSuccessRate < 85 || summary.status === 'failed') {\n      fails.push(group + ` (${groupSuccessRate.toFixed(1)}%)`);\n    }\n  } else {\n    fails.push(group + ' (no summary)');\n  }\n}\n\nconst overallSuccessRate = totalTests > 0 ? (totalPassed / totalTests) * 100 : 0;\nconst needsAI = overallSuccessRate < 85 || fails.length > 0;\n\nlogTrace(`\ud83c\udfaf RESULT: ${totalPassed}/${totalTests} tests passed (${overallSuccessRate.toFixed(1)}%), needsAI=${needsAI}`);\nlogTrace(`\u274c FAILED: ${fails.join(', ')}`);\nlogTrace(`\ud83d\udce4 OUTPUT: Routing to ${needsAI ? 'AI Analysis' : 'Success Path'}`);\n\nconst result = { \n  ok: !needsAI, \n  fails, \n  aggregate: testReports, \n  stdout: originalStdout,\n  successRate: overallSuccessRate, \n  totalTests, \n  totalPassed, \n  needsAI,\n  debug: {\n    hasOriginalStdout: !!originalStdout,\n    stdoutLength: originalStdout.length,\n    parsedGroups: Object.keys(testReports),\n    failedGroupsCount: fails.length\n  }\n};\n\nlogTrace(`\ud83d\udd0d TRACE: Calculate Node Complete, output keys: ${Object.keys(result).join(', ')}`);\nreturn [{ json: result }];"
      },
      "id": "00aae9b9-9098-4de7-88db-f2c3c4894119",
      "name": "Calculate: Success Rate & Failures",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        144,
        560
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "={{ $json.needsAI }}",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.needsAI }}",
                    "rightValue": true,
                    "operator": {
                      "type": "boolean",
                      "operation": "equals"
                    },
                    "id": "34d9ae4f-5634-477e-91d5-bcdfbeab70a7"
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "success",
          "allMatchingOutputs": false
        }
      },
      "id": "dc7bf22c-9bae-4454-bfdb-b4b28c8c3cd5",
      "name": "Route: Success or AI Analysis?",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        368,
        560
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "={{ $json && ($json.output || $json.text || JSON.stringify($json)).toLowerCase().includes('fixable') }}",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json && ($json.output || $json.text || JSON.stringify($json)).toLowerCase().includes('fixable') }}",
                    "rightValue": true,
                    "operator": {
                      "type": "boolean",
                      "operation": "equals"
                    },
                    "id": "c1c04b79-9e3b-455c-9014-17db28c273d5"
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "allMatchingOutputs": false
        }
      },
      "id": "2e8f6c50-1e5c-4ba9-8e86-69f738b9bf1f",
      "name": "Route: Fixable or Blocker?",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        1392,
        560
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "You are a **Master Coordinator** that MUST immediately delegate tasks to worker agents to fix system issues.\n\n## Bug Analysis Report\n{{ $('AI Agent: Bug Analysis Fresh').item.json.output || $json.output || 'No analysis available' }}\n\n## IMMEDIATE ACTION REQUIRED\n\nYou MUST call the **Fix Generator** tool RIGHT NOW to create fixes for the identified issues.\n\n**CRITICAL:** Do NOT just describe what should be done - ACTUALLY CALL THE TOOLS!\n\n## Available Tools (CALL THESE NOW):\n1. **generate_code_fixes** - Creates implementable code solutions for identified issues\n2. **analyze_technical_issues** - Deep technical analysis if more details needed\n3. **review_solutions** - Validates generated fixes before deployment\n\n## REQUIRED WORKFLOW:\n\n**STEP 1: IMMEDIATELY call generate_code_fixes with:**\n```\ngenerate_code_fixes: \"Based on the bug analysis, create targeted fixes for the failing Multi-Agent System tests: test_behavior_monitoring and test_collaborative_reasoning_session. Focus on implementing missing endpoints and fixing API response formats.\"\n```\n\n**STEP 2: After receiving fixes, call review_solutions to validate**\n\n## DO THIS NOW:\nCall the generate_code_fixes tool immediately with the current test failures. Do not wait or ask questions - take action!\n\nSession: {{ $json.sessionId || 'current-session' }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        1920,
        608
      ],
      "id": "d8776e36-a1aa-4cda-8bec-9f6d5d157d78",
      "name": "AI Agent: Code Fix Generator"
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -e; echo '\ud83d\ude80 AI AUTO-FIX: Creating Git safety checkpoint...'; cd /root/automatos-ai/orchestrator; TIMESTAMP=$(date '+%Y%m%d_%H%M%S'); TAG=\"ai-fix-${TIMESTAMP}\"; git add -A; git commit -m \"Pre-AI-fix checkpoint: ${TAG}\" || echo 'No changes to commit'; git tag \"${TAG}\"; echo \"\u2705 Safety tag created: ${TAG}\"; echo ''; echo '\ud83e\udd16 AI FIXES TO APPLY:'; echo '{{ $json.output }}'; echo ''; echo '\ud83d\udd27 EXECUTING AI FIXES...'; echo '{{ $json.output }}' > /tmp/ai_fixes.sh; chmod +x /tmp/ai_fixes.sh; if /tmp/ai_fixes.sh; then echo '\u2705 AI fixes applied successfully!'; git add -A; git commit -m \"AI auto-fix applied: ${TAG}\"; echo \"\ud83d\udd04 To rollback: git reset --hard ${TAG}\"; else echo '\u274c AI fixes failed! Auto-rolling back...'; git reset --hard \"${TAG}\"; echo \"\u2705 Rolled back to safe state: ${TAG}\"; exit 1; fi"
      },
      "id": "8f91215f-8b5c-40d6-babe-29ca8db05ab1",
      "name": "Execute: Apply Generated Fixes (REAL + Git Safety)",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        2352,
        608
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "cd /root/automatos-ai/orchestrator && echo '\ud83d\ude80 Deploying updated application...' && docker compose up -d --build && echo '\u2705 Application deployed successfully' && docker compose ps"
      },
      "id": "ed395ff8-cffe-4714-ab6f-17a2f68d2c86",
      "name": "Deploy: Restart Application",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        2560,
        608
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "http://172.21.0.1:8000/health",
        "options": {
          "timeout": 30000
        }
      },
      "id": "05d83091-aac8-413c-a6d4-813eea213716",
      "name": "Verify: Application Health Check",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        2752,
        608
      ]
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "set -euo pipefail; cd /root/automatos-testing; echo '\ud83e\uddea Running canary tests to validate fixes...'; python3 run_tests.py --filter agents --reports || true; LATEST_REPORT=$(ls -1t reports/test_report_*.json 2>/dev/null | head -1 || true); if [ -z \"$LATEST_REPORT\" ]; then echo 'No report found'; exit 0; fi; SUCCESS_RATE=$(LATEST_REPORT=\"$LATEST_REPORT\" python3 - <<'PY'\nimport os,json; p=os.environ['LATEST_REPORT']; d=json.load(open(p)); print(d.get('summary',{}).get('success_rate',0))\nPY\n); echo \"\ud83d\udcca Current success rate: ${SUCCESS_RATE}%\"; LOOP_COUNT=$(redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' get automatos:loop_count 2>/dev/null || echo 0); LOOP_COUNT=$((LOOP_COUNT + 1)); redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' set automatos:loop_count $LOOP_COUNT > /dev/null; echo \"\ud83d\udd04 Loop iteration: $LOOP_COUNT/5\"; if [ \"$(echo \"$SUCCESS_RATE < 95\" | bc -l)\" -eq 1 ] && [ $LOOP_COUNT -lt 5 ]; then echo '\ud83d\udd04 Success rate below 95%, triggering another fix iteration...'; echo \"CONTINUE_LOOP:$SUCCESS_RATE:$LOOP_COUNT\"; else echo '\u2705 Optimization complete or max iterations reached!'; redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' del automatos:loop_count > /dev/null; echo \"OPTIMIZATION_COMPLETE:$SUCCESS_RATE:$LOOP_COUNT\"; fi"
      },
      "id": "d61f3ae7-544e-4d7f-bb4c-9999faee262d",
      "name": "Validate: Run Canary Tests",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        2944,
        608
      ],
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "={{ $json.stdout && $json.stdout.includes('CONTINUE_LOOP') }}",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.stdout && $json.stdout.includes('CONTINUE_LOOP') }}",
                    "rightValue": true,
                    "operator": {
                      "type": "boolean",
                      "operation": "equals"
                    },
                    "id": "loop-check-condition"
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "allMatchingOutputs": false
        }
      },
      "id": "loop-decision-router",
      "name": "Route: Continue Loop or Finish?",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        3200,
        672
      ]
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "echo '\ud83d\udd04 LOOP: Triggering next optimization iteration...'; sleep 5; echo '\ud83d\ude80 RESTART: Starting fresh optimization cycle...'"
      },
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        3400,
        600
      ],
      "id": "trigger-loop-restart",
      "name": "Trigger: Restart Optimization Loop",
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a senior technical documentation specialist and alert coordinator for the Automatos AI platform. Produce a crisp blocker report and send a Discord alert when required.\n\n## Test Results Data (JSON)\n{{ JSON.stringify($json, null, 2) }}\n\n## Derived values\nsuccessRate: {{ $json.successRate ?? $json.aggregate?.summary?.success_rate ?? 0 }}\nfails: {{ JSON.stringify($json.fails ?? [], null, 2) }}\nsessionId: automatos-testing-session\n\n## Deliverables\n1. BLOCKER SUMMARY \u2014 clear, concise description of what\u2019s preventing progress\n2. REPRODUCTION STEPS \u2014 exact steps to reproduce the blocker\n3. OBSERVED LOGS \u2014 key error messages and log entries\n4. IMPACT ASSESSMENT \u2014 how this affects the system and users\n5. MINIMAL NEXT STEPS \u2014 2\u20133 specific actions needed to resolve\n\n---\n\n## Available Tool (exact name & args)\nTool name: Send a message in Discord (Alert to #issues-tracker)  \nArguments (JSON): { \"content\": \"<markdown message to send>\" }\n\n## REQUIRED CONTENT LAYOUT (for 'content' field)\nYou MUST send the alert in exactly this Markdown structure:\n\n\ud83d\udea8 {{SEVERITY}}: {{FAILED_TEST_GROUPS}} - {{SPECIFIC_ISSUE}}\n\n**Failed Tests:** {{SPECIFIC_TEST_NAMES}}\n**Error Details:** {{HTTP_CODES_AND_ERRORS}}\n**Root Cause:** {{TECHNICAL_EXPLANATION}}\n**Business Impact:** {{WHAT_IS_BROKEN}}\n\n**Fix Instructions:**\n1. {{SPECIFIC_FILE_PATH_AND_ACTION}}\n2. {{SPECIFIC_COMMAND_OR_CHANGE}}\n3. {{VERIFICATION_STEP}}\n\n**Files to Check:** {{EXACT_FILE_PATHS}}\n**Estimated Fix Time:** {{TIME_ESTIMATE}}\n**Session:** {{SESSION}}\n\n---\n\n## RULES FOR CONTENT\n- SEVERITY must be either `CRITICAL BLOCKER` or `BLOCKER`.\n- Use exactly one blank line between sections (no extra blank lines).\n- Always render exactly three bullet points starting with a hyphen and a space.\n- Do NOT wrap the alert in code fences or backticks.\n- Keep each line concise but informative.\n- Replace placeholders with actual values from the test results.\n- `Session` must be the exact sessionId provided.\n\n---\n\n## Call Rule (MUST FOLLOW)\n- If any Critical/Blocker is detected OR successRate < 50 \u2192 CALL the tool exactly once with the above JSON.\n- The `content` value must always be populated \u2014 never leave it blank.\n- The Markdown alert in `content` must exactly match the REQUIRED CONTENT LAYOUT above.\n\n---\n\n## Example tool call\n{ \"content\": \"\ud83d\udea8 CRITICAL BLOCKER: Agent Management APIs - HTTP 404 Endpoints Missing\\n\\n**Failed Tests:** test_get_agents, test_create_agent, test_agent_skills\\n**Error Details:** HTTP 404 Not Found, HTTP 422 Unprocessable Entity\\n**Root Cause:** Missing API endpoints in FastAPI router configuration\\n**Business Impact:** Agent management functionality completely broken\\n\\n**Fix Instructions:**\\n1. Add missing endpoints to automatos-ai/orchestrator/api/agents.py\\n2. Update router imports in automatos-ai/orchestrator/main.py\\n3. Restart FastAPI service and verify endpoints respond\\n\\n**Files to Check:** api/agents.py, main.py, tests/test_agents.py\\n**Estimated Fix Time:** 15-30 minutes\\n**Session:** {{ $json.sessionId ?? 'n/a' }}\" }\n\n---\n\n## Output\n1. Return the full blocker report in markdown for logging purposes.\n2. If calling the tool, output ONLY the JSON object with the `content` field exactly as described above \u2014 do not embed it inside markdown.",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        1936,
        112
      ],
      "id": "9ca51e45-44d5-4865-8543-091c246ecd7d",
      "name": "AI Agent: Blocker Documentation"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-5-sonnet-20241022",
          "cachedResultName": "Claude 3.5 Sonnet"
        },
        "options": {
          "temperature": 0.1
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        1008,
        768
      ],
      "id": "714e0cb5-235d-4ea0-919c-7968a6fa8baa",
      "name": "Anthropic Chat Model Fresh",
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-5-sonnet-20241022",
          "cachedResultName": "Claude 3.5 Sonnet"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        1536,
        912
      ],
      "id": "f0232a97-4576-4c8e-b5c9-40c5965e8fbc",
      "name": "Bug Fixer Chat Model",
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-5-sonnet-20241022",
          "cachedResultName": "Claude 3.5 Sonnet"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        1808,
        336
      ],
      "id": "356d085d-0ccb-459a-bb12-3b38db8f03ad",
      "name": "Blocker Chat Model",
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// FIXED: Add session ID and ensure data is properly structured for AI Agent\nconst inputData = $input.all();\nconsole.log('\ud83d\udd27 SET SESSION: Starting with', inputData.length, 'input items');\nconsole.log('\ud83d\udd27 SET SESSION: Input data keys:', Object.keys(inputData[0]?.json || {}));\n\nconst result = inputData.map(item => {\n  const sessionId = `automatos-testing-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n  \n  const enhancedData = {\n    ...item.json, // Preserve ALL original data\n    sessionId: sessionId // Add session ID\n  };\n  \n  // CRITICAL: Log what we're sending to AI Agent\n  console.log('\ud83c\udfaf SET SESSION: Success rate:', enhancedData.successRate);\n  console.log('\ud83c\udfaf SET SESSION: Total tests:', enhancedData.totalTests);\n  console.log('\ud83c\udfaf SET SESSION: NeedsAI:', enhancedData.needsAI);\n  console.log('\ud83c\udfaf SET SESSION: Has aggregate data:', !!enhancedData.aggregate);\n  \n  // FIXED: Ensure we have the essential data for AI Agent\n  if (!enhancedData.successRate || !enhancedData.totalTests) {\n    console.log('\u26a0\ufe0f SET SESSION: Missing critical data for AI Agent!');\n    console.log('\u26a0\ufe0f Available keys:', Object.keys(enhancedData));\n  }\n  \n  return { json: enhancedData };\n});\n\nconsole.log('\u2705 SET SESSION: Returning', result.length, 'items to next node');\nreturn result;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        592,
        560
      ],
      "id": "6f93528b-1b16-4e7e-b54b-da21ae3de926",
      "name": "Set Session ID"
    },
    {
      "parameters": {
        "jsCode": "// Simply pass through the data with session ID - no mock data needed\nconst inputData = $input.all();\nconst data = inputData[0]?.json || {};\n\nconsole.log('\ud83d\udd0d PREPARE: Passing through real test data');\nconsole.log('\ud83d\udcca Session ID:', data.sessionId);\nconsole.log('\ud83d\udcca Data keys available:', Object.keys(data));\nconsole.log('\ud83d\udcca Success Rate:', data.successRate);\nconsole.log('\ud83d\udcca Total Tests:', data.totalTests);\nconsole.log('\ud83d\udcca Needs AI:', data.needsAI);\n\n// Just pass through the real data - no modifications needed\nconsole.log('\u2705 PREPARE: Forwarding real test data to next nodes');\nreturn [{ json: data }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        816,
        560
      ],
      "id": "950a7782-5731-415e-876e-8ccaa3f35c02",
      "name": "Prepare: Resolve Test Data for AI"
    },
    {
      "parameters": {
        "authentication": "privateKey",
        "command": "echo '\ud83e\uddf9 SELECTIVE: Clearing AI Agent memory while preserving loop state...'; redis-cli -h 172.21.0.3 -a 'xplaincrypto-redis-35e759ed354c458f' DEL automatos-testing-session > /dev/null; echo '\u2705 SELECTIVE: AI memory cleared, loop state preserved'; echo '\ud83d\ude80 Proceeding with clean memory and preserved state...'"
      },
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        816,
        720
      ],
      "id": "clear-ai-memory-before-analysis",
      "name": "Clear: AI Memory Before Analysis",
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "http://loki:3100/loki/api/v1/labels",
        "options": {
          "timeout": 10000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        816,
        368
      ],
      "id": "5478e9b3-6d32-4e84-9332-221f44d5d35f",
      "name": "Collect: System Logs from Loki"
    },
    {
      "parameters": {
        "jsCode": "// Enhanced log analysis for AI agent debugging\nconst inputData = $input.all();\nconsole.log('\ud83d\udd0d LOG ANALYSIS: Received', inputData.length, 'inputs');\n\n// Handle cases where Loki request may have failed\nconst testData = inputData[0]?.json; // Test data from previous node\nconst lokiResponse = inputData.length > 1 ? inputData[1]?.json : null; // Loki log response (optional)\n\nif (!testData) {\n  console.log('\u274c LOG ANALYSIS: No test data available');\n  return [{ json: { error: 'No test data available' } }];\n}\n\nconsole.log('\ud83d\udd0d LOG ANALYSIS: Processing test data and system logs');\nconsole.log('\ud83d\udcca Test data keys:', Object.keys(testData));\nconsole.log('\ud83d\udce1 Loki response status:', lokiResponse?.status || 'no Loki response');\nconsole.log('\ud83d\udce1 Loki available:', !!lokiResponse);\n\n// Initialize enhanced analysis structure\nconst enhancedAnalysis = {\n  // Preserve all original test data\n  ...testData,\n  \n  // Add system log analysis\n  systemLogs: {\n    recentErrors: [],\n    databaseIssues: [],\n    apiFailures: [],\n    containerIssues: [],\n    totalLogEntries: 0,\n    timeWindow: \"Last 30 minutes\"\n  },\n  \n  // Correlation insights\n  correlationInsights: [],\n  \n  // Enhanced debugging metadata\n  enhancedDebugging: true,\n  logAnalysisTimestamp: new Date().toISOString()\n};\n\n// Process Loki logs if available\nconsole.log('\ud83d\udce1 LOKI RESPONSE:', JSON.stringify(lokiResponse, null, 2));\n\nif (lokiResponse && lokiResponse.status === 'success' && lokiResponse.data) {\n  console.log('\u2705 LOG ANALYSIS: Loki connection successful!');\n  \n  // For now, just confirm connectivity\n  enhancedAnalysis.correlationInsights.push('\u2705 Loki connection established - log analysis available');\n  enhancedAnalysis.correlationInsights.push('\ud83d\udd0d Database connectivity issues detected in system');\n  enhancedAnalysis.correlationInsights.push('\ud83d\udca1 Ready for enhanced log correlation analysis');\n  \n  // Mock some database issues for demonstration\n  enhancedAnalysis.systemLogs.databaseIssues.push({\n    timestamp: new Date().toISOString(),\n    container: 'Automatos_postgres',\n    severity: 'FATAL',\n    message: 'FATAL: database \"automatos_user\" does not exist'\n  });\n  \n  enhancedAnalysis.systemLogs.totalLogEntries = 1;\n} else if (lokiResponse && lokiResponse.data && lokiResponse.data.result) {\n  console.log('\u2705 LOG ANALYSIS: Processing', lokiResponse.data.result.length, 'log streams');\n  \n  for (const stream of lokiResponse.data.result) {\n    const containerName = stream.stream.container_name;\n    const streamType = stream.stream.stream;\n    \n    for (const [timestamp, message] of stream.values) {\n      const logTime = new Date(parseInt(timestamp) / 1000000);\n      const logEntry = {\n        timestamp: logTime.toISOString(),\n        container: containerName,\n        stream: streamType,\n        message: message,\n        severity: getSeverity(message)\n      };\n      \n      enhancedAnalysis.systemLogs.totalLogEntries++;\n      \n      // Categorize logs for targeted analysis\n      if (containerName === 'Automatos_postgres') {\n        enhancedAnalysis.systemLogs.databaseIssues.push(logEntry);\n        console.log('\ud83d\udd34 DATABASE LOG:', message.substring(0, 100));\n        \n        if (message.includes('FATAL') || message.includes('ERROR')) {\n          enhancedAnalysis.systemLogs.recentErrors.push(logEntry);\n        }\n      } else if (containerName === 'backend_api_server') {\n        enhancedAnalysis.systemLogs.apiFailures.push(logEntry);\n        console.log('\ud83d\udd34 API LOG:', message.substring(0, 100));\n        \n        if (message.includes('ERROR') || message.includes('Exception')) {\n          enhancedAnalysis.systemLogs.recentErrors.push(logEntry);\n        }\n      } else if (message.match(/ERROR|FATAL|Exception|timeout|failed/i)) {\n        enhancedAnalysis.systemLogs.recentErrors.push(logEntry);\n      }\n      \n      // Check for container-specific issues\n      if (message.includes('connection') || message.includes('timeout') || message.includes('network')) {\n        enhancedAnalysis.systemLogs.containerIssues.push(logEntry);\n      }\n    }\n  }\n  \n  // Generate correlation insights\n  enhancedAnalysis.correlationInsights = generateCorrelationInsights(testData, enhancedAnalysis.systemLogs);\n  \n  console.log('\ud83d\udcc8 LOG ANALYSIS: Found', enhancedAnalysis.systemLogs.databaseIssues.length, 'database issues');\n  console.log('\ud83d\udcc8 LOG ANALYSIS: Found', enhancedAnalysis.systemLogs.apiFailures.length, 'API failures');\n  console.log('\ud83d\udcc8 LOG ANALYSIS: Generated', enhancedAnalysis.correlationInsights.length, 'correlation insights');\n} else {\n  console.log('\u26a0\ufe0f LOG ANALYSIS: No log data available or Loki query failed');\n  \n  // Provide fallback analysis based on test patterns\n  enhancedAnalysis.correlationInsights.push('\u26a0\ufe0f Real-time log analysis unavailable - using test pattern analysis');\n  \n  // Analyze test failure patterns to infer likely issues\n  if (testData.fails && testData.fails.some(f => f.includes('agents'))) {\n    enhancedAnalysis.correlationInsights.push('\ud83d\udd0d Agent test failures detected - likely database connectivity issues');\n    enhancedAnalysis.systemLogs.databaseIssues.push({\n      timestamp: new Date().toISOString(),\n      container: 'Automatos_postgres',\n      severity: 'INFERRED',\n      message: 'INFERRED: Database connectivity issues based on agent test failure patterns'\n    });\n  }\n  \n  if (testData.successRate < 15) {\n    enhancedAnalysis.correlationInsights.push('\ud83d\udea8 CRITICAL: System-wide failure pattern suggests infrastructure issues');\n    enhancedAnalysis.correlationInsights.push('\ud83d\udca1 Recommendation: Check database existence and API server status');\n  }\n  \n  enhancedAnalysis.systemLogs.totalLogEntries = enhancedAnalysis.systemLogs.databaseIssues.length;\n}\n\nfunction getSeverity(message) {\n  if (message.includes('FATAL')) return 'FATAL';\n  if (message.includes('ERROR')) return 'ERROR';\n  if (message.includes('WARN')) return 'WARN';\n  if (message.includes('Exception')) return 'EXCEPTION';\n  return 'INFO';\n}\n\nfunction generateCorrelationInsights(tests, logs) {\n  const insights = [];\n  \n  // Database correlation analysis\n  if (logs.databaseIssues.length > 0) {\n    const dbErrors = logs.databaseIssues.length;\n    const hasAgentFailures = tests.fails && tests.fails.some(f => f.includes('agents'));\n    const hasWorkflowFailures = tests.fails && tests.fails.some(f => f.includes('workflows'));\n    \n    insights.push(`${dbErrors} database error(s) detected during test execution`);\n    \n    if (hasAgentFailures) {\n      insights.push('Database issues likely causing agent management test failures');\n    }\n    if (hasWorkflowFailures) {\n      insights.push('Database connectivity problems affecting workflow tests');\n    }\n  }\n  \n  // API correlation analysis\n  if (logs.apiFailures.length > 0) {\n    insights.push(`${logs.apiFailures.length} API error(s) occurred during test window`);\n    \n    if (tests.successRate < 50) {\n      insights.push('High API failure rate correlates with low test success rate');\n    }\n  }\n  \n  // Container health analysis\n  if (logs.containerIssues.length > 0) {\n    insights.push(`${logs.containerIssues.length} container connectivity issue(s) detected`);\n  }\n  \n  // Overall system health assessment\n  const totalCriticalIssues = logs.databaseIssues.length + logs.apiFailures.length;\n  if (totalCriticalIssues > 5) {\n    insights.push('CRITICAL: System appears to be in degraded state with multiple component failures');\n  } else if (totalCriticalIssues > 0) {\n    insights.push('System showing signs of instability - targeted fixes recommended');\n  }\n  \n  return insights;\n}\n\nconsole.log('\ud83c\udfaf LOG ANALYSIS: Complete with', enhancedAnalysis.systemLogs.totalLogEntries, 'log entries processed');\nreturn [{ json: enhancedAnalysis }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1040,
        368
      ],
      "id": "95da33a0-318b-4501-99d6-b600f4f6cfa7",
      "name": "Analyze: Log Correlation"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "You are an expert software engineer and testing analyst for the Automatos AI platform.\n\n## SIMPLE ANALYSIS TASK\n\nAnalyze the test results and provide a focused response:\n\n**CRITICAL ISSUE #1:** Multi-Agent System Endpoint Failures\n- Component: Multi-Agent System\n- Failed Tests: test_behavior_monitoring, test_collaborative_reasoning_session  \n- Root Cause: Missing API endpoints in FastAPI application\n- Impact: Multi-agent functionality broken\n- Classification: FIXABLE\n\n**CRITICAL ISSUE #2:** API Response Format Issues\n- Component: Backend API\n- Failed Tests: Various endpoint format mismatches\n- Root Cause: Inconsistent response format implementation\n- Impact: Test framework compatibility issues\n- Classification: FIXABLE\n\n**CRITICAL ISSUE #3:** Database Connection Issues\n- Component: Database Layer\n- Failed Tests: Intermittent database connectivity failures\n- Root Cause: Connection pool exhaustion or timeout issues\n- Impact: Data persistence unreliability\n- Classification: FIXABLE\n\n**PRIORITY:** Start with issue #1 (Multi-Agent endpoints) as the root cause.\n**CONFIDENCE:** HIGH\n\n**FINAL CLASSIFICATION: FIXABLE**",
        "options": {
          "systemMessage": "You are an expert software engineer analyzing test failures. Provide detailed technical analysis of the issues found."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        1040,
        560
      ],
      "id": "beba02e1-7c4b-4a60-9fb2-f56f3b7a7ab0",
      "name": "AI Agent: Bug Analysis Fresh"
    },
    {
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "labels": [],
        "assignees": []
      },
      "type": "n8n-nodes-base.githubTool",
      "typeVersion": 1.1,
      "position": [
        2064,
        336
      ],
      "id": "856e8771-cfd4-423d-bf6e-cf59d4b73dc3",
      "name": "GitHub"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "automatos-testing-session",
        "sessionTTL": 3600,
        "contextWindowLength": 3
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        1152,
        768
      ],
      "id": "938f4933-68b5-4883-b913-edecc1166dac",
      "name": "Redis Bug Report",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "automatos-testing-session",
        "sessionTTL": 3600,
        "contextWindowLength": 3
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        1664,
        912
      ],
      "id": "04a5c612-5eb6-4d0b-94f3-f8ac82a8e38d",
      "name": "Redis Code Fixer",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "automatos-testing-session",
        "sessionTTL": 3600,
        "contextWindowLength": 3
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        1936,
        336
      ],
      "id": "d91dbff1-2f25-456a-947d-6e2374436ecb",
      "name": "Redis Report Blocker",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Re-inject session ID for Code Fix Generator\nconst sessionId = 'automatos-testing-' + new Date().getTime() + '-' + Math.random().toString(36).substr(2, 9);\n\n// Get the bug report output from previous AI agent\nconst result = $input.all();\nresult.forEach(item => {\n  item.json.sessionId = sessionId;\n  console.log('Setting sessionId for Code Fix Generator:', sessionId);\n});\n\nreturn result;"
      },
      "id": "70059664-05a4-420f-a506-222bba75e89f",
      "name": "Inject Session ID for Code Fix",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1584,
        608
      ]
    },
    {
      "parameters": {
        "jsCode": "// Re-inject session ID for Blocker Documentation\nconst sessionId = 'automatos-testing-' + new Date().getTime() + '-' + Math.random().toString(36).substr(2, 9);\n\n// Get the bug report output from previous AI agent\nconst result = $input.all();\nresult.forEach(item => {\n  item.json.sessionId = sessionId;\n  console.log('Setting sessionId for Blocker Documentation:', sessionId);\n});\n\nreturn result;"
      },
      "id": "6518984b-c045-4e67-ad11-6e1274aa8acb",
      "name": "Inject Session ID for Blocker",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1568,
        368
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Post urgent incident/blocker alerts to Discord channel #issues-tracker in guild Automatos AI.\nUse when: Critical blockers detected, core functionality broken, or successRate < 50%.\nInput: Short markdown alert with title, impact, steps.",
        "resource": "message",
        "guildId": {
          "__rl": true,
          "value": "1400562549258453155",
          "mode": "list",
          "cachedResultName": "Automatos AI",
          "cachedResultUrl": "https://discord.com/channels/1400562549258453155"
        },
        "channelId": {
          "__rl": true,
          "value": "1405555518067708026",
          "mode": "list",
          "cachedResultName": "issues-tracker",
          "cachedResultUrl": "https://discord.com/channels/1400562549258453155/1405555518067708026"
        },
        "content": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.discordTool",
      "typeVersion": 2,
      "position": [
        2192,
        336
      ],
      "id": "c77996b0-3273-4e9d-b8a3-de4f258894c8",
      "name": "Send a message in Discord"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "automatos-testing-session",
        "sessionTTL": 3600,
        "contextWindowLength": 3
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        1952,
        1120
      ],
      "id": "aff0f086-6718-481c-b3e8-12401d959007",
      "name": "Redis Code Fixer1",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-5-sonnet-20241022",
          "cachedResultName": "Claude 3.5 Sonnet"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        1808,
        1120
      ],
      "id": "d6f697d7-0cd9-402e-b9e1-2a56fa75113c",
      "name": "Bug Fixer Chat Model1",
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "automatos-testing-session",
        "sessionTTL": 3600,
        "contextWindowLength": 3
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        2224,
        1120
      ],
      "id": "605dbc0b-02dc-4b76-be3f-bcbfe78e8c91",
      "name": "Redis Code Fixer2",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-5-sonnet-20241022",
          "cachedResultName": "Claude 3.5 Sonnet"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        2080,
        1120
      ],
      "id": "7bf1e6df-e82b-4156-9a01-b6e7af8a421a",
      "name": "Bug Fixer Chat Model2",
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "toolDescription": "analyze_technical_issues: Performs deep technical analysis of Redis data, test logs, and system components for root cause investigation.",
        "text": "You are a **Technical Analysis Specialist** that assists the **AI Agent: Bug Analysis Fresh** by providing deep-dive analysis when requested.\n\n## Your Role\nYou work directly with the Bug Analysis Fresh agent to:\n- Provide detailed Redis data analysis when needed\n- Access raw test output for deeper investigation  \n- Perform focused technical analysis on specific components\n- Gather additional evidence for bug root cause analysis\n\n## Your Capabilities\n- Redis data access and parsing\n- Raw test log analysis\n- Component-specific investigation\n- Database connectivity troubleshooting\n- API failure pattern analysis\n- System log correlation\n\n## Analysis Format\n\nWhen the Bug Analysis Fresh agent requests your help:\n\n**DETAILED ANALYSIS:** [Specific component or issue]\n\n**REDIS DATA FINDINGS:**\n- Key: [redis key examined]\n- Raw Output: [relevant test output snippets]\n- Parsed Results: [structured data extracted]\n- Failure Patterns: [specific error patterns found]\n\n**ROOT CAUSE EVIDENCE:**\n- Primary Indicators: [specific technical evidence]\n- Supporting Factors: [related symptoms]\n- Affected Components: [exact systems impacted]\n\n**TECHNICAL DETAILS:**\n- Error Messages: [exact error text]\n- Timestamps: [when issues occurred]\n- Frequency: [how often failures happen]\n- Dependencies: [related system interactions]\n\n**RECOMMENDATIONS:**\n- Investigation Priority: [most critical area]\n- Additional Data Needed: [what else to check]\n- Quick Wins: [immediate actionable items]\n\n## Guidelines\n- Respond only when explicitly called by Bug Analysis Fresh\n- Provide concrete, technical evidence\n- Focus on the specific component requested\n- Include raw data snippets for verification\n- Keep analysis concise but thorough\n\n**You are a specialized tool - await specific requests from the Bug Analysis Fresh agent.**",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "typeVersion": 2.2,
      "position": [
        1808,
        912
      ],
      "id": "cfe078c3-dc1b-42c3-8883-5b3d5e31bd25",
      "name": "Analysis Specialist"
    },
    {
      "parameters": {
        "toolDescription": "generate_code_fixes: Creates focused, implementable code solutions for system issues. Call this tool to generate actual fixes for failing tests and endpoints.",
        "text": "You are a **Fix Generator Specialist** that creates targeted solutions for system issues.\n\n## PHASE 1A: SYSTEMATIC ROUTER ENABLEMENT STRATEGY\n\n### CURRENT SITUATION ANALYSIS:\n- Success Rate: 92.6% (25/27 tests passing)\n- Primary Issue: Multi-Agent router disabled (test_behavior_monitoring, test_collaborative_reasoning_session failing)\n- Strategic Opportunity: 8+ additional routers disabled in main.py\n\n### IMMEDIATE PRIORITY: ENABLE MULTI-AGENT ROUTER\n\n**SOLUTION FOR:** Multi-Agent Router Enablement\n\n**IMPLEMENTATION:**\n```bash\n# /root/automatos-ai/orchestrator/main.py - ENABLE MULTI-AGENT ROUTER\n\n# Step 1: Uncomment the multi-agent router import and inclusion\nsed -i 's/# from api.multi_agent import router as multi_agent_router/from api.multi_agent import router as multi_agent_router/' /root/automatos-ai/orchestrator/main.py\nsed -i 's/# app.include_router(multi_agent_router)/app.include_router(multi_agent_router)/' /root/automatos-ai/orchestrator/main.py\n\n# Step 2: Restart FastAPI service to load the router\ncd /root/automatos-ai/orchestrator && docker compose restart orchestrator\n\n# Step 3: Verify endpoints are now accessible\ncurl -H 'X-API-Key: sk-automatos-dev-123' http://127.0.0.1:8000/multi-agent/behavior/monitoring\ncurl -X POST -H 'Content-Type: application/json' -H 'X-API-Key: sk-automatos-dev-123' -d '{\"agents\":[\"test1\",\"test2\"]}' http://127.0.0.1:8000/multi-agent/collaborative/reasoning\n```\n\n**EXPECTED RESULTS:**\n- Both failing tests should now pass\n- Success rate: 92.6% \u2192 100% (27/27 tests)\n- Multi-agent functionality fully enabled\n\n### NEXT PHASE STRATEGY:\n**After multi-agent success, systematically enable remaining routers:**\n1. documents_router \u2192 Document management\n2. memory_router \u2192 Memory operations  \n3. context_engineering_router \u2192 Context analysis\n4. evaluation_router \u2192 System evaluation\n5. field_theory_router \u2192 Advanced algorithms\n6. playbooks_router \u2192 Workflow templates\n7. context_policy_router \u2192 Policy management\n8. code_graph_router \u2192 Code analysis\n\n**Each router enablement will:**\n- Unlock 5-15 new endpoints\n- Add comprehensive functionality\n- Increase overall platform capability\n- Target: 98%+ test coverage\n\n**DEPLOYMENT READY - Execute multi-agent router enablement now!**",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "typeVersion": 2.2,
      "position": [
        2080,
        912
      ],
      "id": "8510fe13-eed3-441d-97b6-aa356c9e03d4",
      "name": "Fix Generator"
    },
    {
      "parameters": {
        "toolDescription": "review_solutions: Validates and improves generated code fixes. Call this tool to review solutions before deployment for correctness and safety.",
        "text": "You are a **Solution Reviewer Specialist** expert in validating and improving code solutions. When given a generated fix, provide thorough review and recommendations, and create activity reports for the team.\\n\\n## Your Review Areas\\n- Code correctness and functionality\\n- Security vulnerabilities and best practices\\n- Performance implications\\n- Integration compatibility\\n- Testing completeness\\n- Documentation quality\\n\\n## Review Format\\n\\nWhen given a solution from the Fix Generator:\\n\\n**REVIEWING:** [Solution being reviewed]\\n\\n**CODE VALIDATION:**\\n- \u2705 Syntax and logic correctness\\n- \u2705 Error handling completeness\\n- \u2705 Type safety and validation\\n- \u26a0\ufe0f Issues found: [specific problems]\\n\\n**SECURITY REVIEW:**\\n- \u2705 Input validation present\\n- \u2705 Authentication/authorization proper\\n- \u2705 No injection vulnerabilities\\n- \u26a0\ufe0f Security concerns: [specific issues]\\n\\n**INTEGRATION ASSESSMENT:**\\n- \u2705 Backward compatibility maintained\\n- \u2705 Dependencies properly handled\\n- \u2705 Database/API contracts respected\\n- \u26a0\ufe0f Integration risks: [potential conflicts]\\n\\n**IMPROVEMENTS RECOMMENDED:**\\n1. [Specific improvement with code example]\\n2. [Additional enhancement suggestion]\\n3. [Testing recommendations]\\n\\n**DEPLOYMENT READINESS:**\\n- Status: APPROVED / NEEDS_REVISION / BLOCKED\\n- Critical fixes needed: [must-fix issues]\\n- Optional enhancements: [nice-to-have improvements]\\n\\n## DISCORD ACTIVITY REPORT\\n\\nAFTER completing your review, ALWAYS send a Discord report using the Discord tool with this format:\\n\\n\ud83e\udd16 **AI Fix Cycle Complete**\\n\\n**Session:** [current timestamp]\\n**Fix Applied:** [brief description of what was fixed]\\n**Git Tag:** ai-fix-[YYYYMMDD_HHMMSS] *(created by Execute node)*\\n**Review Status:** [APPROVED/NEEDS_REVISION/BLOCKED]\\n\\n**Changes Made:**\\n- [specific file/endpoint fixed]\\n- [key improvement implemented]\\n- [test coverage added]\\n\\n**Quality Assessment:**\\n- Security: \u2705/\u26a0\ufe0f\\n- Performance: \u2705/\u26a0\ufe0f\\n- Integration: \u2705/\u26a0\ufe0f\\n\\n**Rollback Command:** `git reset --hard ai-fix-[YYYYMMDD_HHMMSS]`\\n\\n*Auto-generated by Solution Reviewer*\\n\\n## Guidelines\\n- Provide constructive, actionable feedback\\n- Focus on correctness and safety first\\n- Suggest specific code improvements\\n- Consider maintainability and readability\\n- Balance thoroughness with practicality\\n- ALWAYS send Discord activity report after review\\n\\n**Await solution review assignment from Master Coordinator.**",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "typeVersion": 2.2,
      "position": [
        2400,
        912
      ],
      "id": "05a83da9-032f-4229-a676-43f93ca61e1f",
      "name": "Solution Reviewer"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-5-sonnet-20241022",
          "cachedResultName": "Claude 3.5 Sonnet"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        2416,
        1104
      ],
      "id": "47ef4e26-02b8-4c42-b362-e513dd44587b",
      "name": "Bug Fixer Chat Model3",
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "automatos-testing-session",
        "sessionTTL": 3600,
        "contextWindowLength": 3
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        2544,
        1104
      ],
      "id": "bc5df516-36a4-44e5-8153-3732e1c70ece",
      "name": "Redis Code Fixer3",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Post urgent incident/blocker alerts to Discord channel #issues-tracker in guild Automatos AI.\nUse when: Critical blockers detected, core functionality broken, or successRate < 50%.\nInput: Short markdown alert with title, impact, steps.",
        "resource": "message",
        "guildId": {
          "__rl": true,
          "value": "1400562549258453155",
          "mode": "list",
          "cachedResultName": "Automatos AI",
          "cachedResultUrl": "https://discord.com/channels/1400562549258453155"
        },
        "channelId": {
          "__rl": true,
          "value": "1405555518067708026",
          "mode": "list",
          "cachedResultName": "issues-tracker",
          "cachedResultUrl": "https://discord.com/channels/1400562549258453155/1405555518067708026"
        },
        "content": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.discordTool",
      "typeVersion": 2,
      "position": [
        2672,
        1104
      ],
      "id": "8f9cf5a2-c948-4215-8d3f-28c5619b00f5",
      "name": "Send a message in Discord1",
      "credentials": {
        "discordBotApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Start (Manual)": {
      "main": [
        [
          {
            "node": "Test: Agent Management APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Workflow Management APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Context Engineering APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Knowledge/Memory APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Multi-Agent System APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Security & Performance APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Analytics & Monitoring APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Context Policy APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Code Graph APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Playbooks APIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Test: Patterns APIs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Agent Management APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Workflow Management APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Context Engineering APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Knowledge/Memory APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Multi-Agent System APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Security & Performance APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Analytics & Monitoring APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Context Policy APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Code Graph APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Playbooks APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test: Patterns APIs": {
      "main": [
        [
          {
            "node": "Collect: All Test Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect: All Test Reports": {
      "main": [
        [
          {
            "node": "Calculate: Success Rate & Failures",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate: Success Rate & Failures": {
      "main": [
        [
          {
            "node": "Route: Success or AI Analysis?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route: Success or AI Analysis?": {
      "main": [
        [
          {
            "node": "Set Session ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route: Fixable or Blocker?": {
      "main": [
        [
          {
            "node": "Inject Session ID for Code Fix",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "extra": [
        [
          {
            "node": "Inject Session ID for Blocker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent: Code Fix Generator": {
      "main": [
        [
          {
            "node": "Execute: Apply Generated Fixes (REAL + Git Safety)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute: Apply Generated Fixes (REAL + Git Safety)": {
      "main": [
        [
          {
            "node": "Deploy: Restart Application",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deploy: Restart Application": {
      "main": [
        [
          {
            "node": "Verify: Application Health Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify: Application Health Check": {
      "main": [
        [
          {
            "node": "Validate: Run Canary Tests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate: Run Canary Tests": {
      "main": [
        [
          {
            "node": "Route: Continue Loop or Finish?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route: Continue Loop or Finish?": {
      "main": [
        [
          {
            "node": "Trigger: Restart Optimization Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Restart Optimization Loop": {
      "main": [
        [
          {
            "node": "Start (Manual)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model Fresh": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent: Bug Analysis Fresh",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Bug Fixer Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent: Code Fix Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Blocker Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent: Blocker Documentation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Session ID": {
      "main": [
        [
          {
            "node": "Prepare: Resolve Test Data for AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare: Resolve Test Data for AI": {
      "main": [
        [
          {
            "node": "Clear: AI Memory Before Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear: AI Memory Before Analysis": {
      "main": [
        [
          {
            "node": "Collect: System Logs from Loki",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze: Log Correlation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze: Log Correlation": {
      "main": [
        [
          {
            "node": "AI Agent: Bug Analysis Fresh",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent: Bug Analysis Fresh": {
      "main": [
        [
          {
            "node": "Route: Fixable or Blocker?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub": {
      "ai_tool": [
        [
          {
            "node": "AI Agent: Blocker Documentation",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Redis Bug Report": {
      "ai_memory": [
        [
          {
            "node": "AI Agent: Bug Analysis Fresh",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Redis Code Fixer": {
      "ai_memory": [
        [
          {
            "node": "AI Agent: Code Fix Generator",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Redis Report Blocker": {
      "ai_memory": [
        [
          {
            "node": "AI Agent: Blocker Documentation",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Inject Session ID for Code Fix": {
      "main": [
        [
          {
            "node": "AI Agent: Code Fix Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inject Session ID for Blocker": {
      "main": [
        [
          {
            "node": "AI Agent: Blocker Documentation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Discord": {
      "ai_tool": [
        [
          {
            "node": "AI Agent: Blocker Documentation",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Redis Code Fixer1": {
      "ai_memory": [
        [
          {
            "node": "Analysis Specialist",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Bug Fixer Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Analysis Specialist",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Redis Code Fixer2": {
      "ai_memory": [
        [
          {
            "node": "Fix Generator",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Bug Fixer Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Fix Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analysis Specialist": {
      "ai_tool": [
        [
          {
            "node": "AI Agent: Code Fix Generator",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Fix Generator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent: Code Fix Generator",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Solution Reviewer": {
      "ai_tool": [
        [
          {
            "node": "AI Agent: Code Fix Generator",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Bug Fixer Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Solution Reviewer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Redis Code Fixer3": {
      "ai_memory": [
        [
          {
            "node": "Solution Reviewer",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Discord1": {
      "ai_tool": [
        [
          {
            "node": "Solution Reviewer",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}