{
  "version": "0.2",
  "identity_profiles": [
    {
      "id": "git-readonly",
      "provider": "none",
      "subject": {
        "kind": "service",
        "principal": "agent://ops/git-readonly",
        "display_name": "Git Read-Only Agent"
      },
      "trust": {
        "level": "restricted",
        "constraints": {
          "max_autonomy": "restricted",
          "escalation": "fail"
        }
      }
    },
    {
      "id": "git-write",
      "provider": "env-bearer",
      "subject": {
        "kind": "service",
        "principal": "agent://ops/git-write",
        "display_name": "Git Write Agent",
        "delegation_mode": "none"
      },
      "auth": {
        "mode": "service",
        "required": false,
        "provider_config": {
          "token_env": "GIT_TOKEN"
        }
      },
      "trust": {
        "level": "supervised",
        "constraints": {
          "max_autonomy": "supervised",
          "escalation": "human-approval"
        }
      },
      "presentation": {
        "bindings": [
          {
            "source": "credentials.access_token.value",
            "target": { "kind": "env", "name": "GIT_TOKEN" },
            "required": false,
            "redact": true
          }
        ],
        "handoff": "none",
        "cleanup": "always"
      }
    }
  ],
  "evidence_profiles": [
    {
      "id": "git-evidence",
      "provider": "ssh",
      "payload": {
        "bind": ["execution_id", "declared_identity", "command", "result"],
        "format": "canonical-json"
      },
      "verify": { "required": false }
    }
  ],
  "workflows": [
    {
      "id": "git-ops",
      "name": "Git Operations",
      "contract": {
        "sandbox": "permissive",
        "network": "unrestricted",
        "audit": "always"
      },
      "tasks": [
        {
          "id": "status",
          "name": "Check Working Tree Status",
          "shell": {
            "program": "git",
            "args": ["status", "--porcelain"]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "git-readonly" },
          "output": { "format": "text", "preview_bytes": 4000 },
          "schedule": { "cron": "*/10 * * * *" }
        },
        {
          "id": "log",
          "name": "Recent Commit History",
          "shell": {
            "program": "git",
            "args": ["log", "--oneline", "-20"]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "git-readonly" },
          "output": { "format": "text", "preview_bytes": 4000 },
          "schedule": { "cron": "*/15 * * * *" }
        },
        {
          "id": "diff",
          "name": "Show Changes Summary",
          "shell": {
            "program": "git",
            "args": ["diff", "--stat"]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "git-readonly" },
          "output": { "format": "text", "preview_bytes": 8000 },
          "schedule": { "cron": "*/10 * * * *" }
        },
        {
          "id": "commit",
          "name": "Commit All Changes",
          "shell": {
            "program": "sh",
            "args": ["-c", "git add -A && git commit -m 'automated: agent commit'"]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "git-write" },
          "output": { "format": "text", "preview_bytes": 2000 },
          "schedule": { "cron": "0 */4 * * *" },
          "on_failure": {
            "id": "triage-commit-failure",
            "name": "Triage Commit Failure",
            "prompt": "The git commit operation failed. Determine whether this is a merge conflict, dirty index issue, empty changeset, or hook rejection, and recommend the safest resolution.",
            "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": "push",
          "name": "Push to Remote",
          "shell": {
            "program": "git",
            "args": ["push", "origin", "HEAD"]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "git-write" },
          "evidence": { "ref": "git-evidence" },
          "output": { "format": "text", "preview_bytes": 2000 },
          "contract": {
            "required_trust_level": "supervised",
            "trust_enforcement": "strict"
          },
          "trigger": {
            "parent": "commit",
            "on": "success"
          }
        }
      ]
    }
  ]
}
