{
  "synapse_export": true,
  "version": "1.0",
  "exported_at": "2026-09-09T00:01:06.893021+00:00",
  "has_python_tools": false,
  "custom_tools": [],
  "agents": [
    {
      "id": "agent_code_reviewer",
      "name": "Code Review Agent",
      "description": "Analyzes codebases to identify bugs, security issues, and improvement opportunities. Provides actionable, file-referenced feedback.",
      "avatar": "default",
      "type": "conversational",
      "tools": [
        "github__pull_request_read",
        "github__get_file_contents"
      ],
      "system_prompt": "# Role & Identity\nYou are an expert Code Review Agent. Your job is to deeply analyze codebases, identify issues, and provide clear, actionable, file-referenced feedback that helps developers improve their code quality, security, and performance.\n\n# Core Capabilities\n- **Bug Detection:** Identify logic errors, off-by-one mistakes, null pointer risks, and incorrect assumptions.\n- **Security Analysis:** Spot common vulnerabilities — SQL injection, XSS, hardcoded secrets, insecure dependencies, improper auth checks.\n- **Performance Review:** Flag N+1 queries, unnecessary re-renders, blocking I/O in hot paths, and memory leaks.\n- **Code Quality:** Assess readability, naming conventions, duplication, and adherence to SOLID principles.\n- **Architecture Assessment:** Evaluate project structure, separation of concerns, and coupling.\n\n# Workflow\n1. **Explore Structure:** Start with `directory_tree` to understand the project layout.\n2. **Read Entry Points:** Identify and read main files (e.g., `main.py`, `index.ts`, `App.js`, `server.go`).\n3. **Trace the Flow:** Follow the code through key files — APIs, services, database layers, auth.\n4. **Read Related Files Together:** Use `read_multiple_files` when you need to understand how modules interact.\n5. **Synthesize Findings:** Organize issues by severity and provide concrete, actionable fixes.\n\n# Response Format\nAlways respond with a structured review:\n\n## Code Review: [Scope/Feature]\n\n### 🔴 Critical Issues (Must Fix)\n- **[File:Line]** — [Issue description and suggested fix]\n\n### 🟡 Warnings (Should Fix)\n- **[File:Line]** — [Issue description and suggested fix]\n\n### 🟢 Suggestions (Nice to Have)\n- **[File:Line]** — [Improvement idea]\n\n### Architecture Notes\n[High-level observations about project structure]\n\n### Summary\n[Overall assessment in 2-3 sentences]\n\n# Rules\n- **Always cite file paths and line numbers** when referencing code.\n- **Show code snippets** for clarity — the problematic code and the suggested fix.\n- **Do NOT guess** at code you haven't read. Use tools to verify before commenting.\n- **Be specific:** Instead of \"this is inefficient\", say \"this runs an N+1 query — add `.select_related()` or use a JOIN\"."
    },
    {
      "id": "agent_software_engineer",
      "name": "GitHub Agent",
      "description": "Reads, comments on and merges pull requests through GitHub's tools, and nothing else.",
      "avatar": "default",
      "type": "conversational",
      "tools": [
        "github__pull_request_read",
        "github__add_issue_comment",
        "github__merge_pull_request"
      ],
      "system_prompt": "You work on GitHub pull requests through the GitHub tools: you read them, comment on them and merge them. Do exactly the action the step asks for and nothing else, then report what you did."
    },
    {
      "id": "agent_deployment_monitor",
      "name": "CI Checker",
      "description": "Reads a pull request's checks and reports which pass and which fail.",
      "avatar": "default",
      "type": "conversational",
      "tools": [
        "github__pull_request_read"
      ],
      "system_prompt": "You report a pull request's CI: every check, whether it passed, and the overall result. Read it with pull_request_read (get_status and get_check_runs). Never re-run anything."
    }
  ],
  "orchestrations": [
    {
      "id": "orch_pr_review_pipeline",
      "name": "Automated PR Review & Merge Pipeline",
      "description": "Reviews a pull request against your standards while checking its CI, merges the clean ones, posts the review on the ones that need changes, and asks a person about anything in between. Start it with the repository and the pull request's number: by hand, through the API, or from a GitHub Action.",
      "avatar": "default",
      "steps": [
        {
          "id": "step_pr_fetch",
          "name": "Fetch PR Details",
          "type": "agent",
          "agent_id": "agent_software_engineer",
          "prompt_template": "Read pull request #{{ state.pr_number }} in {{ state.repo }} with pull_request_read: its title, description and author (get), the changed files (get_files) and the diff (get_diff). Return them.",
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [],
          "output_key": "pr_details",
          "max_turns": 35,
          "timeout_seconds": 600,
          "allowed_tools": null,
          "next_step_id": "step_parallel_review",
          "max_iterations": 3,
          "position_x": -800.0,
          "position_y": 0.0
        },
        {
          "id": "step_parallel_review",
          "name": "Parallel Review",
          "type": "parallel",
          "agent_id": null,
          "prompt_template": null,
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [
            [
              "step_code_review"
            ],
            [
              "step_ci_check"
            ]
          ],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [],
          "output_key": null,
          "max_turns": 5,
          "timeout_seconds": 1800,
          "allowed_tools": null,
          "next_step_id": "step_merge_reviews",
          "max_iterations": 3,
          "position_x": -500.0,
          "position_y": 0.0
        },
        {
          "id": "step_code_review",
          "name": "Automated Code Review",
          "type": "agent",
          "agent_id": "agent_code_reviewer",
          "prompt_template": "Review the pull request below.\n\nAnalyze every changed file and produce a structured code review covering:\n- Critical bugs or logic errors\n- Security vulnerabilities (injections, hardcoded secrets, improper auth)\n- Performance issues\n- Missing error handling or edge cases\n- Style inconsistencies with the rest of the codebase\n- Missing tests for changed behavior\n\nScore the PR: APPROVE (no critical/warning issues), REQUEST_CHANGES (has critical or multiple warning issues), or COMMENT (minor suggestions only).\n\nSave the review to the vault under key `code_review`.",
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [
            "pr_details"
          ],
          "output_key": "code_review",
          "max_turns": 35,
          "timeout_seconds": 600,
          "allowed_tools": null,
          "next_step_id": "step_merge_reviews",
          "max_iterations": 3,
          "position_x": -200.0,
          "position_y": -200.0
        },
        {
          "id": "step_ci_check",
          "name": "CI Status Check",
          "type": "agent",
          "agent_id": "agent_deployment_monitor",
          "prompt_template": "Check the CI for pull request #{{ state.pr_number }} in {{ state.repo }}: every check, and the overall result.",
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [
            "pr_details"
          ],
          "output_key": "ci_status",
          "max_turns": 35,
          "timeout_seconds": 600,
          "allowed_tools": null,
          "next_step_id": "step_merge_reviews",
          "max_iterations": 3,
          "position_x": -200.0,
          "position_y": 200.0
        },
        {
          "id": "step_merge_reviews",
          "name": "Merge Review Results",
          "type": "merge",
          "agent_id": null,
          "prompt_template": null,
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "concat",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [
            "code_review",
            "ci_status"
          ],
          "output_key": "all_review_data",
          "max_turns": 5,
          "timeout_seconds": 30,
          "allowed_tools": null,
          "next_step_id": "step_eval_pr_quality",
          "max_iterations": 3,
          "position_x": 100.0,
          "position_y": 0.0
        },
        {
          "id": "step_eval_pr_quality",
          "name": "Auto-Merge Decision",
          "type": "evaluator",
          "agent_id": null,
          "prompt_template": null,
          "route_map": {
            "auto_approve": "step_auto_merge",
            "needs_human_review": "step_human_review",
            "auto_reject": "step_post_review_comments"
          },
          "route_descriptions": {
            "auto_approve": "CI passes AND code review score is APPROVE with no critical issues. Safe to merge automatically.",
            "needs_human_review": "CI passes but code review has minor warnings or suggestions. Route to a human to make the final merge decision.",
            "auto_reject": "CI fails OR code review has critical bugs or security issues. Post the review comments to the PR and block the merge."
          },
          "evaluator_prompt": "Evaluate the combined code review and CI status. If CI is all-green AND review score is APPROVE → 'auto_approve'. If CI passes but review score is COMMENT (minor suggestions only) → 'needs_human_review'. If CI fails OR review score is REQUEST_CHANGES → 'auto_reject'.",
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [
            "all_review_data"
          ],
          "output_key": "merge_decision",
          "max_turns": 5,
          "timeout_seconds": 30,
          "allowed_tools": null,
          "next_step_id": null,
          "max_iterations": 3,
          "position_x": 350.0,
          "position_y": 0.0
        },
        {
          "id": "step_human_review",
          "name": "Human Review Decision",
          "type": "human",
          "agent_id": null,
          "prompt_template": null,
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": "The review found minor suggestions and nothing blocking.\n\n{state.all_review_data}\n\nMerge it, or post the review and ask the author for changes?",
          "human_fields": [
            {
              "name": "merge",
              "type": "boolean",
              "label": "Merge it"
            },
            {
              "name": "comments",
              "type": "textarea",
              "label": "Comments for the author (optional)"
            }
          ],
          "input_keys": [
            "all_review_data"
          ],
          "output_key": "human_review_decision",
          "max_turns": 5,
          "timeout_seconds": 86400,
          "allowed_tools": null,
          "next_step_id": "step_eval_human_decision",
          "max_iterations": 3,
          "position_x": 600.0,
          "position_y": 250.0
        },
        {
          "id": "step_eval_human_decision",
          "name": "Merge it?",
          "type": "if_else",
          "agent_id": null,
          "prompt_template": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [
            "human_review_decision"
          ],
          "max_turns": 5,
          "timeout_seconds": 30,
          "allowed_tools": null,
          "next_step_id": null,
          "max_iterations": 3,
          "position_x": 600.0,
          "position_y": 500.0,
          "if_condition": "state.human_review_decision.merge == True",
          "if_true_step_id": "step_auto_merge",
          "if_false_step_id": "step_post_review_comments"
        },
        {
          "id": "step_post_review_comments",
          "name": "Post Review Comments to PR",
          "type": "agent",
          "agent_id": "agent_software_engineer",
          "prompt_template": "Post the review as one comment on pull request #{{ state.pr_number }} in {{ state.repo }} (add_issue_comment), with sections for critical issues, warnings and suggestions, and any comments the person added. Do not merge.",
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [
            "pr_details",
            "all_review_data",
            "human_review_decision"
          ],
          "output_key": "review_posted_result",
          "max_turns": 35,
          "timeout_seconds": 600,
          "allowed_tools": null,
          "next_step_id": "step_notify_pr_blocked",
          "max_iterations": 3,
          "position_x": 600.0,
          "position_y": -250.0
        },
        {
          "id": "step_notify_pr_blocked",
          "name": "Say it's blocked",
          "type": "print",
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "output_key": "outcome",
          "max_turns": 35,
          "timeout_seconds": 600,
          "allowed_tools": null,
          "next_step_id": null,
          "max_iterations": 3,
          "position_x": 850.0,
          "position_y": -250.0,
          "print_content": "Changes requested on #{state.pr_number} in {state.repo}. The review is posted on the pull request."
        },
        {
          "id": "step_auto_merge",
          "name": "Merge PR",
          "type": "agent",
          "agent_id": "agent_software_engineer",
          "prompt_template": "Squash-merge pull request #{{ state.pr_number }} in {{ state.repo }} (merge_pull_request, merge_method squash) with a commit title that includes the pull request's title. Report the merged commit.",
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "input_keys": [
            "pr_details",
            "merge_decision",
            "human_review_decision"
          ],
          "output_key": "merge_result",
          "max_turns": 35,
          "timeout_seconds": 600,
          "allowed_tools": null,
          "next_step_id": "step_notify_merged",
          "max_iterations": 3,
          "position_x": 850.0,
          "position_y": 0.0
        },
        {
          "id": "step_notify_merged",
          "name": "Say it's merged",
          "type": "print",
          "route_map": {},
          "route_descriptions": {},
          "evaluator_prompt": null,
          "parallel_branches": [],
          "merge_strategy": "list",
          "loop_count": 3,
          "loop_step_ids": [],
          "transform_code": null,
          "human_prompt": null,
          "human_fields": [],
          "output_key": "outcome",
          "max_turns": 35,
          "timeout_seconds": 600,
          "allowed_tools": null,
          "next_step_id": null,
          "max_iterations": 3,
          "position_x": 1100.0,
          "position_y": 0.0,
          "print_content": "Merged #{state.pr_number} in {state.repo}.\n\n{state.merge_result}"
        }
      ],
      "entry_step_id": "step_pr_fetch",
      "state_schema": {
        "repo": {
          "type": "string",
          "default": "",
          "description": "The repository, as owner/name"
        },
        "pr_number": {
          "type": "number",
          "default": 0,
          "description": "The pull request's number"
        }
      },
      "max_total_turns": 400,
      "timeout_minutes": 180,
      "trigger": "manual",
      "created_at": "2026-01-01T00:00:00Z",
      "updated_at": "2026-01-01T00:00:00Z",
      "result_key": "outcome"
    }
  ],
  "mcp_servers": [
    {
      "name": "github",
      "label": "GitHub",
      "server_type": "remote",
      "url": "https://api.githubcopilot.com/mcp/",
      "token": "xxxxxxxxx",
      "env": {},
      "command": "",
      "args": []
    }
  ]
}
