{
  "id": "Th6oymAWb3801GGM",
  "name": "ai agent github burnout detector",
  "tags": [
    {
      "id": "Tqphal8U1xgK62Ru",
      "name": "burnout-detector",
      "createdAt": "2025-10-11T15:33:02.359Z",
      "updatedAt": "2025-10-11T15:33:02.359Z"
    },
    {
      "id": "tMPdyC8GBdQzpbC5",
      "name": "team-wellness",
      "createdAt": "2025-10-11T15:49:08.958Z",
      "updatedAt": "2025-10-11T15:49:08.958Z"
    }
  ],
  "nodes": [
    {
      "id": "ce1eaca0-50f9-49de-a865-51c602300439",
      "name": "Get Prs",
      "type": "n8n-nodes-base.github",
      "position": [
        1104,
        -176
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "url",
          "value": "=https://github.com/{{ $('Config').first().json.repoowner }}"
        },
        "resource": "repository",
        "operation": "getPullRequests",
        "returnAll": true,
        "repository": {
          "__rl": true,
          "mode": "url",
          "value": "=https://github.com/{{ $('Config').first().json.repoowner }}/{{  $('Config').first().json.reponame }}"
        },
        "getRepositoryPullRequestsFilters": {
          "state": "all",
          "direction": "desc"
        }
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "799820e9-9d39-4300-9c90-31a35c953e1c",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        592,
        -176
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"repoowner\": \"suarifymy\",\n  \"reponame\": \"adk-samples\",\n  \"period\":7,\n  \"emailreport\": \"user@example.com\"\n}\n"
      },
      "typeVersion": 3.3
    },
    {
      "id": "15e831a2-2321-488f-856a-875c3389f96e",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1520,
        -176
      ],
      "parameters": {
        "text": "= You are a **Professional Team Wellness and Burnout Detection Agent** with strict guardrails.  \nYour role is to analyze developer workload patterns and provide **objective, evidence-based assessments**.  \n\n### Core Rules\n1. NEVER make personal judgments or assumptions about individual developers.  \n2. ONLY analyze observable patterns in code activity data.  \n3. ALWAYS provide evidence-based reasoning for all assessments.  \n4. NEVER suggest disciplinary actions or performance reviews.  \n5. FOCUS on systemic issues and team-level recommendations.  \n6. ALWAYS include confidence scores and data limitations.  \n7. RESPECT privacy and confidentiality of team members.  \n8. PROVIDE actionable, constructive recommendations only.  \n9. AVOID alarmist language\u2014use a professional, measured tone.  \n10. ALWAYS structure responses with clear sections and evidence.  \n\n### Tools Available\n1. **Update GitHub Issue** \u2192 Create or update issues for tracking team wellness concerns.  \n2. **Email Tool** \u2192 Send urgent notifications to team leads.  \n\n- Use **GitHub Issues** for for CRITICAL alerts (Health Score < 90)\n- Use **Email** ONLY for CRITICAL alerts (Health Score < 90) requiring immediate intervention.  \n\nYour analysis must be **objective, professional, and focused on improving team wellness through positive interventions and follow the report consideration below in a nice md file **. Always update github issues tool.\n\n\noutput report considerations.Please do redaction on any name.\n \noutput html report examples\n```\n# \ud83d\udcca Team Health Report\n\n\n\ud83d\udc69\u200d\ud83d\udcbb Team Activity Snapshot\n\ud83d\udcca Overall Summary\n- Total commits: 6\n- Pull requests opened: 1\n- Workflows run: 1\n- Late\u2011night commits: 3\n- Weekend commits: 2\n- Failed workflows: 0 \u2705\nThe team is keeping activity light this cycle, with a few late\u2011night pushes and some weekend work showing up.\n\n\ud83d\udc65 Developer Activity Breakdown\n- sean\n- Commits: 2\n- Late\u2011night: 0\n- Weekend: 2 \ud83c\udf19 (notable weekend activity)\n- Ara SAMAD\n- Commits: 3\n- Late\u2011night: 3 \ud83c\udf19\ud83c\udf19\ud83c\udf19 (all commits after hours)\n- Weekend: 0\n- wzss088\n- Commits: 1\n- Late\u2011night: 0\n- Weekend: 0\n\n\n\n## \ud83d\udcdd Summary\nOverall, the team is maintaining a healthy delivery pace, but there are emerging signs of workload imbalance due to increased after-hours activity.\n\n---\n\n## \ud83d\udd22 Health Score\n- **Value:** 68 / 100  \n- **Confidence:** 87%  \n- **Limitations:** Based solely on commit and PR activity; meeting load and non-code tasks not captured.\n\n---\n\n## \ud83d\udd0d Observed Patterns\n- \u23f0 **After-hours activity**  \n  - 29% of commits occurred between 10pm\u20131am (baseline: 12%).  \n  - Confidence: 0.90  \n\n- \ud83d\udcc8 **Weekend workload**  \n  - Weekend commits increased by 35% compared to the previous month.  \n  - Confidence: 0.82  \n\n- \ud83e\udd1d **Collaboration bottleneck**  \n  - PR review turnaround time increased from 6h \u2192 18h.  \n  - Confidence: 0.78  \n\n---\n\n## \u26a0\ufe0f Systemic Risks\n- Sustained after-hours work may indicate creeping burnout risk.  \n  - Evidence: 3 consecutive weeks of elevated late-night commits.  \n  - Confidence: 0.85  \n\n- Slower PR reviews may delay feedback loops and increase cycle time.  \n  - Evidence: Median cycle time rose from 2.1 days \u2192 3.4 days.  \n  - Confidence: 0.80  \n\n---\n\n## \u2705 Recommendations\n- \ud83d\udccc Facilitate a team discussion on workload distribution and sprint commitments. *(Priority: Medium)*  \n- \ud83d\udd14 Introduce automated nudges discouraging late-night commits. *(Priority: Low)*  \n- \ud83d\udee0\ufe0f Rotate PR review responsibilities or adopt lightweight review guidelines. *(Priority: High)*  \n\n--- \n```\nPLease use the tool to send report. You must use html format and follow the html report example above\n\nUser a: {{ JSON.stringify( $('Analyze Patterns Developer').first().json )}}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "ce574d0d-76e2-4c6c-b1ab-850aa544e8cc",
      "name": "Groq Chat Model Report",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        1376,
        160
      ],
      "parameters": {
        "model": "openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "76fd974d-f101-45d0-afcf-4a4ed9c6b3b8",
      "name": "Send a message in Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        1744,
        160
      ],
      "parameters": {
        "sendTo": "={{  $('Config').first().json.emailreport }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "subject": " \ud83d\udcca Team Health and Wellness Report",
        "descriptionType": "manual",
        "toolDescription": "Update reports to stakeholder via email"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "df7238d2-665d-4da6-aa96-5f430ed04d14",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1872,
        -176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e71ac601-0698-49f4-a220-e1c3d2fa60ba",
      "name": "Analyze Patterns Developer",
      "type": "n8n-nodes-base.code",
      "position": [
        1280,
        -176
      ],
      "parameters": {
        "jsCode": "// Analyze patterns from GitHub data\n\nconst commits =$(\"Github Get Commits\").all();\nconst pullRequests = $('Get Prs').all();\nconst workflows = $(\"Github Get Workflows\").all();\nconst analysisPeriod =$('Config').first().json.period || 7;\n\n// Initialize patterns object\nconst patterns = {\n  total_commits: commits.length,\n  total_prs: pullRequests.length,\n  total_workflows: workflows.length,\n  late_night_commits: 0,\n  weekend_commits: 0,\n  failed_workflows: 0,\n  developer_activity: {}\n};\n\n// Analyze commits\nfor (const commit of commits) {\n  try {\n    const maincommit=commit.json.commit\n    const commitTime = new Date(maincommit.author.date);\n    const hour = commitTime.getHours();\n    const weekday = commitTime.getDay();\n    const author = maincommit.author.name || 'Unknown';\n    \n    // Track late night commits (after 10 PM or before 6 AM)\n    if (hour >= 22 || hour <= 6) {\n      patterns.late_night_commits++;\n    }\n    \n    // Track weekend commits (Saturday = 6, Sunday = 0)\n    if (weekday === 0 || weekday === 6) {\n      patterns.weekend_commits++;\n    }\n    \n    // Track per-developer activity\n    if (!patterns.developer_activity[author]) {\n      patterns.developer_activity[author] = {\n        commits: 0,\n        late_night: 0,\n        weekend: 0\n      };\n    }\n    \n    patterns.developer_activity[author].commits++;\n    if (hour >= 22 || hour <= 6) {\n      patterns.developer_activity[author].late_night++;\n    }\n    if (weekday === 0 || weekday === 6) {\n      patterns.developer_activity[author].weekend++;\n    }\n  } catch (e) {\n    console.log('Error processing commit:', e);\n  }\n}\n\n// Analyze workflows\nfor (const workflow of workflows) {\n  if (workflow.conclusion === 'failure') {\n    patterns.failed_workflows++;\n  }\n}\n\n// Calculate rates\nconst failureRate = (patterns.failed_workflows / Math.max(patterns.total_workflows, 1)) * 100;\nconst lateNightRate = (patterns.late_night_commits / Math.max(patterns.total_commits, 1)) * 100;\nconst weekendRate = (patterns.weekend_commits / Math.max(patterns.total_commits, 1)) * 100;\n\n// Prepare data for AI analysis\nconst analysisData = {\n  repository: $('Config').first().json.reponame  || 'unknown/repo',\n  analysis_period_days: analysisPeriod,\n  patterns: patterns,\n  rates: {\n    failure_rate: failureRate.toFixed(1),\n    late_night_rate: lateNightRate.toFixed(1),\n    weekend_rate: weekendRate.toFixed(1)\n  },\n  raw_data: {\n    // commits: commits,\n    // pull_requests: pullRequests,\n    // workflows: workflows\n  }\n};\n\nreturn [{\n  json: analysisData\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "0ce251fc-69de-4b91-ae36-bf1f92e8ed59",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -256
      ],
      "parameters": {
        "color": 4,
        "width": 1952,
        "height": 624,
        "content": " "
      },
      "typeVersion": 1
    },
    {
      "id": "3f33cf1e-7011-4a0e-b550-58be70d6ee16",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        -256
      ],
      "parameters": {
        "color": 4,
        "width": 580,
        "height": 624,
        "content": "# Team-Wellness :  AI Burnout Detector Agent [devex]\n\n## Demo \n* [github action code alternative ]( https://github.com/suarifymy/adk-samples/blob/main/.github/workflows/devex-ai-burnout-detector.yml)\n* [sample report ](https://github.com/suarifymy/adk-samples/issues/1/)\n \n\n## How it works \nPeriodically, there will be a job to fetch GitHub Commits  , PRs, Active Flows. Then the llm ai agent analyzes total comits, late night commits, weekend commmits , failed workflow and developer's activity and work intensity patterns. Lastly, creates a github issues and sends an email\n\n \n## Setup\n   - Follow setup link [n8n-github-account-setup](\nhttps://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.github/) , [n8n-groq-setup](https://docs.n8n.io/integrations/builtin/credentials/groq/)  ,[n8n-gmail-setup](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gmail/) \n- Change the `config` node"
      },
      "typeVersion": 1
    },
    {
      "id": "5be57b6b-349f-48a3-aa10-5552799a8ac2",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        352,
        -176
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 7
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4f6b2323-c3d1-49ce-9a37-616bccf907cc",
      "name": "Github Get Commits",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        944,
        -176
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $('Config').first().json.repoowner }}/{{  $('Config').first().json.reponame }}/commits",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "created",
              "value": "={{ $now.minus({ days: $json.period || 7 }).toISO() }}..*"
            }
          ]
        },
        "nodeCredentialType": "githubApi"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fb1996f6-35dd-4567-89fc-29c77716c57e",
      "name": "Github Get Workflows",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        768,
        -176
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $json.repoowner}}/{{ $json.reponame}}/actions/runs",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "created",
              "value": "={{ $now.minus({ days: $json.period || 7 }).toISO() }}..*"
            },
            {
              "name": "per_page",
              "value": "50"
            }
          ]
        },
        "nodeCredentialType": "githubApi"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "8deb394b-2654-4202-bff2-08eb40bd87a2",
      "name": "Update Github Issue",
      "type": "n8n-nodes-base.githubTool",
      "position": [
        1568,
        160
      ],
      "parameters": {
        "body": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Body', ``, 'string') }}",
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{  $('Config').first().json.repoowner }}"
        },
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}",
        "labels": [],
        "assignees": [],
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{  $('Config').first().json.reponame }}"
        },
        "descriptionType": "manual",
        "toolDescription": "#Update Github Issue\nCreate an issue in GitHub on the team wellness"
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "420ee020-9770-4587-ada3-664ab22396b1",
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Github Get Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Prs": {
      "main": [
        [
          {
            "node": "Analyze Patterns Developer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Github Get Commits": {
      "main": [
        [
          {
            "node": "Get Prs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Github Issue": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Github Get Workflows": {
      "main": [
        [
          {
            "node": "Github Get Commits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model Report": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Patterns Developer": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}