{
  "version": "0.2",
  "identity_profiles": [
    {
      "id": "gh-readonly",
      "provider": "env-bearer",
      "subject": {
        "kind": "service",
        "principal": "agent://ops/gh-readonly",
        "display_name": "GitHub Read-Only Agent",
        "delegation_mode": "none"
      },
      "auth": {
        "mode": "service",
        "required": false,
        "provider_config": {
          "token_env": "GH_TOKEN"
        }
      },
      "trust": {
        "level": "restricted",
        "constraints": {
          "max_autonomy": "restricted",
          "escalation": "fail"
        }
      },
      "presentation": {
        "bindings": [
          {
            "source": "credentials.access_token.value",
            "target": {
              "kind": "env",
              "name": "GH_TOKEN"
            },
            "required": false,
            "redact": true
          }
        ],
        "handoff": "none",
        "cleanup": "always"
      }
    },
    {
      "id": "gh-write",
      "provider": "env-bearer",
      "subject": {
        "kind": "service",
        "principal": "agent://ops/gh-write",
        "display_name": "GitHub Write Agent",
        "delegation_mode": "none"
      },
      "auth": {
        "mode": "service",
        "required": true,
        "provider_config": {
          "token_env": "GH_TOKEN"
        }
      },
      "trust": {
        "level": "supervised",
        "constraints": {
          "max_autonomy": "supervised",
          "escalation": "human-approval"
        }
      },
      "presentation": {
        "bindings": [
          {
            "source": "credentials.access_token.value",
            "target": {
              "kind": "env",
              "name": "GH_TOKEN"
            },
            "required": true,
            "redact": true
          }
        ],
        "handoff": "none",
        "cleanup": "always"
      }
    }
  ],
  "evidence_profiles": [
    {
      "id": "gh-evidence",
      "provider": "ssh",
      "payload": {
        "bind": ["execution_id", "declared_identity", "command", "result"],
        "format": "canonical-json"
      },
      "verify": {
        "required": false
      }
    }
  ],
  "workflows": [
    {
      "id": "gh-ops",
      "name": "GitHub CLI Operations",
      "contract": {
        "sandbox": "permissive",
        "network": "unrestricted",
        "audit": "always"
      },
      "tasks": [
        {
          "id": "list-prs",
          "name": "List Pull Requests",
          "shell": {
            "program": "gh",
            "args": ["pr", "list", "--json", "number,title,state,author", "--limit", "10"]
          },
          "target": {
            "session_target": "shell"
          },
          "identity": {
            "ref": "gh-readonly"
          },
          "evidence": {
            "ref": "gh-evidence"
          },
          "output": {
            "format": "json",
            "preview_bytes": 4000,
            "offload": "auto"
          },
          "schedule": {
            "cron": "0 */4 * * *"
          }
        },
        {
          "id": "check-ci",
          "name": "Check CI Run Status",
          "shell": {
            "program": "gh",
            "args": ["run", "list", "--json", "status,conclusion,name", "--limit", "5"]
          },
          "target": {
            "session_target": "shell"
          },
          "identity": {
            "ref": "gh-readonly"
          },
          "evidence": {
            "ref": "gh-evidence"
          },
          "output": {
            "format": "json",
            "preview_bytes": 4000
          },
          "schedule": {
            "cron": "*/15 * * * *"
          },
          "on_failure": {
            "id": "triage-ci-check",
            "name": "Triage CI Check Failure",
            "prompt": "The GitHub CI status check failed. Determine whether this is an authentication issue, a gh CLI problem, or an API error, and recommend the next step without making changes.",
            "target": {
              "session_target": "isolated",
              "agent_id": "main"
            },
            "intent": {
              "mode": "plan",
              "read_only": true
            },
            "context": {
              "retrieval": "recent",
              "limit": 3
            },
            "delivery": {
              "mode": "announce",
              "to": "@owner_dm"
            }
          }
        },
        {
          "id": "list-issues",
          "name": "List Open Issues",
          "shell": {
            "program": "gh",
            "args": ["issue", "list", "--json", "number,title,labels,assignees", "--limit", "10"]
          },
          "target": {
            "session_target": "shell"
          },
          "identity": {
            "ref": "gh-readonly"
          },
          "evidence": {
            "ref": "gh-evidence"
          },
          "output": {
            "format": "json",
            "preview_bytes": 4000,
            "offload": "auto"
          },
          "schedule": {
            "cron": "0 8 * * *"
          }
        },
        {
          "id": "create-release",
          "name": "Create Draft Release",
          "shell": {
            "program": "gh",
            "args": ["release", "create", "--generate-notes", "--draft"]
          },
          "target": {
            "session_target": "shell"
          },
          "identity": {
            "ref": "gh-write"
          },
          "evidence": {
            "ref": "gh-evidence"
          },
          "output": {
            "format": "text"
          },
          "contract": {
            "required_trust_level": "supervised",
            "trust_enforcement": "strict"
          },
          "approval": {
            "required": true,
            "policy": "manual",
            "risk_level": "high"
          },
          "schedule": {
            "cron": "0 12 * * 5"
          }
        }
      ]
    }
  ]
}
