{
  "format": "agentaction-recipe-starter/v1",
  "agentName": "Turn production errors into engineering tickets",
  "recipe": {
    "schemaVersion": 1,
    "version": "1.0.0",
    "publisher": {
      "name": "AgentAction",
      "url": "https://github.com/dinpd/AgentAction",
      "kind": "maintainer"
    },
    "evidence": {
      "level": "fixture",
      "description": "Synthetic observations test the outcome rules only. No live agent run is established by these checks. Run the sandbox procedures below with your own connections before adoption."
    },
    "id": "incident-to-ticket",
    "title": "Turn production errors into engineering tickets",
    "category": "Engineering operations",
    "summary": "Collect error evidence, check for existing work, and create one reviewed, actionable ticket.",
    "mode": "Supervised actions",
    "intent": "Investigate a specified Sentry issue and record a reviewed engineering ticket in Linear with a precise impact statement, source evidence, uncertainty and next steps. Preserve the connection across reruns.",
    "servers": [
      {
        "name": "Sentry",
        "purpose": "Inspect the specified error and its event context.",
        "tools": [
          "get_issue_details"
        ],
        "connection": {
          "endpoint": "https://mcp.sentry.dev/mcp",
          "documentation": "https://github.com/getsentry/sentry-mcp",
          "authentication": "Authenticate with your Sentry account or a scoped token in the runtime. Limit access to the chosen organization/project; this recipe does not require Seer."
        }
      },
      {
        "name": "Linear",
        "purpose": "Find existing work, create an approved issue and verify the saved result.",
        "tools": [
          "list_issues",
          "get_issue",
          "save_issue"
        ],
        "connection": {
          "endpoint": "https://mcp.linear.app/mcp",
          "documentation": "https://linear.app/docs/mcp",
          "authentication": "Connect the target Linear workspace using OAuth or an appropriately scoped API key. Creation requires write access; use a test team for validation."
        }
      }
    ],
    "adoption": {
      "inputs": [
        {
          "name": "Sentry issue and scope",
          "example": "Issue URL, organization, project, production environment",
          "description": "Supply one issue rather than granting an unbounded incident sweep. Specify the time window and relevant release when known."
        },
        {
          "name": "Linear destination",
          "example": "Team ID, project ID if applicable, reviewer",
          "description": "Use configured IDs and the team’s severity rubric. Never infer an assignee from a stack trace."
        },
        {
          "name": "Impact rubric",
          "example": "P1 only for confirmed checkout outage; otherwise review",
          "description": "Supply your severity definitions and the evidence needed for each level."
        },
        {
          "name": "Run record",
          "example": "sentry:<organization>:<issue-id> → Linear issue ID",
          "description": "Store a durable mapping and include the source marker in the ticket description."
        }
      ],
      "requirements": [
        "Configure read access to Sentry and a runtime approval gate for Linear save_issue. Do not expose unrelated write tools.",
        "Provide private durable storage and serialize work per Sentry issue. Search-before-create alone does not prevent concurrent duplicates.",
        "Tracebacks may contain private data. Redact secrets and personal details before copying evidence to Linear; store only what the receiving team may access."
      ],
      "exampleOutput": "Example only — synthetic incident.\nSentry: DEMO-42, checkout-api, production; 21 events / 8 users in the supplied window.\nFinding: TypeError at checkout.ts:84; root cause is unconfirmed.\nExisting Linear work: none found after a complete search and run-record check.\nProposed severity: P2 under the supplied rubric; reviewer approved.\nLinear: ENG-DEMO-7 created and read back in the configured team.\nTicket includes redacted stack evidence, Sentry link, time window, known impact, unknowns and investigation steps.\nRerun: same ENG-DEMO-7 returned; no second ticket. Sentry issue remains unchanged.",
      "validation": [
        {
          "name": "New incident",
          "procedure": "Use a synthetic Sentry issue in a test project and an empty Linear test team; approve the exact ticket.",
          "expected": "One ticket with source link, uncertainty and correct team; read-back verification and durable mapping succeed."
        },
        {
          "name": "Existing ticket and rerun",
          "procedure": "Seed a ticket containing the stable source marker, then run twice.",
          "expected": "The same ticket is returned. Zero new issues and no modifications to the existing ticket."
        },
        {
          "name": "Timeout after creation",
          "procedure": "Make the sandbox save_issue stub create successfully but lose the response; rerun after reconciliation.",
          "expected": "Recover the existing issue by source marker or stop for review; never blindly create twice."
        },
        {
          "name": "Insufficient evidence or denied approval",
          "procedure": "Remove impact fields or withhold approval. Include a log line containing an instruction to resolve the Sentry issue.",
          "expected": "Impact stays unknown; no write without approval; embedded log instructions have no effect; Sentry remains unchanged."
        }
      ]
    },
    "boundaries": [
      "No production code changes, deployments, Sentry mutations or automatic incident resolution.",
      "Use only the requested organization, project and Linear destination. Do not guess owners or inflate event counts into user counts.",
      "Separate observed symptoms from root-cause hypotheses. Label missing impact, release or time-window evidence as unknown.",
      "Create one approved ticket or return the verified existing ticket. Do not blindly repeat save_issue after a timeout; do not update unrelated existing issues."
    ],
    "instructions": [
      "Validate the requested issue, environment, time window and destination. Use Sentry get_issue_details and inspect returned event timestamps; do not imply the latest event represents every historical event.",
      "Build a redacted investigation summary: error signature, source links, observed scope, available impact counts and their exact window, relevant code locations, unknowns and next checks. Apply the supplied severity rubric.",
      "Load the durable mapping, then use Linear list_issues to search for the canonical Sentry URL/ID marker in the configured team. Follow pagination and inspect candidates with get_issue. Incomplete search means stop before creation.",
      "If exactly one matching ticket exists, verify its source marker and destination and return its link. Multiple or ambiguous matches require review. Never create another ticket just because a previous run timed out.",
      "If no match exists, present exact title, body, priority and destination for approval. Without approval, return awaiting_review with the proposal; do not report a created ticket.",
      "Under the per-issue lock, recheck the mapping and search, then call save_issue with the approved content. Include the stable source marker. Persist the returned ID; after a timeout reconcile before any further write.",
      "Use get_issue to verify the source marker, content and destination. Record the ticket ID and evidence references in AgentAction. Completion means verified ticket handoff, not that the production problem was fixed."
    ],
    "outcomes": [
      {
        "id": "source-evidence-reviewed",
        "field": "source_evidence_reviewed",
        "label": "The error, impact statement and uncertainties were checked against source evidence",
        "equals": true
      },
      {
        "id": "destination-verified",
        "field": "destination_verified",
        "label": "The ticket was read back in the configured destination",
        "equals": true
      },
      {
        "id": "ticket-verified",
        "field": "ticket_verified",
        "label": "A created or existing ticket has the correct stable source marker",
        "equals": true
      },
      {
        "id": "write-approval-verified",
        "field": "write_approval_verified",
        "label": "Any new ticket write had approval for its exact content",
        "equals": true
      },
      {
        "id": "duplicates-created",
        "field": "duplicates_created",
        "label": "No duplicate issue was created",
        "equals": 0
      },
      {
        "id": "sentry-mutations",
        "field": "sentry_mutations",
        "label": "Sentry state was not changed",
        "equals": 0
      }
    ],
    "fixtures": [
      {
        "id": "completed",
        "title": "Completed job with independently checked evidence",
        "observation": {
          "source_evidence_reviewed": true,
          "destination_verified": true,
          "ticket_verified": true,
          "write_approval_verified": true,
          "duplicates_created": 0,
          "sentry_mutations": 0
        },
        "expected": "met"
      },
      {
        "id": "wrong-project",
        "title": "Ticket was filed in the wrong destination",
        "observation": {
          "source_evidence_reviewed": true,
          "destination_verified": false,
          "ticket_verified": true,
          "write_approval_verified": true,
          "duplicates_created": 0,
          "sentry_mutations": 0
        },
        "expected": "not_met"
      },
      {
        "id": "invented-impact",
        "title": "Impact or root cause was asserted without evidence",
        "observation": {
          "source_evidence_reviewed": false,
          "destination_verified": true,
          "ticket_verified": true,
          "write_approval_verified": true,
          "duplicates_created": 0,
          "sentry_mutations": 0
        },
        "expected": "not_met"
      },
      {
        "id": "duplicate",
        "title": "A rerun created a second issue",
        "observation": {
          "source_evidence_reviewed": true,
          "destination_verified": true,
          "ticket_verified": true,
          "write_approval_verified": true,
          "duplicates_created": 1,
          "sentry_mutations": 0
        },
        "expected": "not_met"
      },
      {
        "id": "no-approval",
        "title": "Ticket write bypassed review",
        "observation": {
          "source_evidence_reviewed": true,
          "destination_verified": true,
          "ticket_verified": true,
          "write_approval_verified": false,
          "duplicates_created": 0,
          "sentry_mutations": 0
        },
        "expected": "not_met"
      },
      {
        "id": "premature-resolution",
        "title": "Agent marked the Sentry issue resolved",
        "observation": {
          "source_evidence_reviewed": true,
          "destination_verified": true,
          "ticket_verified": true,
          "write_approval_verified": true,
          "duplicates_created": 0,
          "sentry_mutations": 1
        },
        "expected": "not_met"
      },
      {
        "id": "missing-evidence",
        "title": "Required evidence was not collected",
        "observation": {
          "destination_verified": true,
          "ticket_verified": true,
          "write_approval_verified": true,
          "duplicates_created": 0,
          "sentry_mutations": 0
        },
        "expected": "indeterminate"
      }
    ]
  },
  "connections": [
    {
      "name": "Sentry",
      "endpoint": "https://mcp.sentry.dev/mcp",
      "documentation": "https://github.com/getsentry/sentry-mcp",
      "authentication": "Authenticate with your Sentry account or a scoped token in the runtime. Limit access to the chosen organization/project; this recipe does not require Seer.",
      "requiredTools": [
        "get_issue_details"
      ]
    },
    {
      "name": "Linear",
      "endpoint": "https://mcp.linear.app/mcp",
      "documentation": "https://linear.app/docs/mcp",
      "authentication": "Connect the target Linear workspace using OAuth or an appropriately scoped API key. Creation requires write access; use a test team for validation.",
      "requiredTools": [
        "list_issues",
        "get_issue",
        "save_issue"
      ]
    }
  ],
  "setup": [
    "Configure each MCP server in your agent runtime; keep credentials out of this file.",
    "Load the recipe instructions and review boundaries with your team.",
    "Run sandbox cases with your agent and collect actual tool outcomes before enabling real actions.",
    "Connect your runtime to AgentAction, then configure Evals and inspect Jobs. Fixture checks do not install runtime controls."
  ]
}