Build guide
How to Build a Bug Triage Agent With Linear and GitHub
A bug triage agent should read the report, search related issues, inspect recent code, suggest severity and draft a scoped engineering task. It should reduce intake work without pretending it has reproduced the bug unless it actually ran the steps.
On this page
How do you build bug triage agent?
Building bug triage agent starts with a clear trigger and ends with a handoff a person can check. The steps below define that path, and the code shape under them shows how one run holds together.
- 1Define the trigger: issue, PR, failed CI job, docs change or support ticket.
- 2Limit tool access to the files and systems the agent needs.
- 3Add a plan step before writes.
- 4Run checks and produce a short reviewer handoff.
- 5Log the prompt, changed files, commands and result.
type AgentJob = { task: string; context: string[]; allowedTools: string[]; checks: string[]; handoff: "diff" | "comment" | "pull_request"; };
Start with allowedTools. I'd say it's the field people end up regretting, though I'll admit that's a guess from a small sample. The pull is to grant broad access while you're building, because narrowing it is fiddly and everything works either way when you're sitting there watching. An agent running unattended with repo-wide write and a shell is a genuinely different risk than one that can edit three paths and run a single command, and you find out which one you built on the run where something goes wrong.
handoff is what decides whether anyone trusts the thing. Returning a diff keeps a person in front of it before anything lands, which is the right default while you're still learning how the agent behaves on your codebase. Opening a pull request is that same gate with better ergonomics, once you've earned the confidence. A comment is the lightest option and suits agents that only diagnose. What none of them should do is merge — not until the commands in checks are ones you'd have run yourself anyway.
Interactive widget. Tab through its controls; the result updates in the panel below as you change them.
A useful build keeps trigger, context, tools, patch and handoff visible.
This is covered hands-on in Agent Mode Foundations — 6 short modules, free to read.
What can go wrong?
Most failures here are not exotic. They come from giving the agent too much room, or trusting a "done" that no test ever proved.
The agent touches files outside the task.
The handoff says done without test or review proof.
The agent gets broad access when narrow access would work.
Scope bites earliest. Give an agent a vague task and it will go and find related work to do, which reads as initiative right up until you're staring at a diff across twenty files with no idea which changes were the point. A better model doesn't fix this. A narrower task does: name the files, name the behaviour that should change, say what's out of bounds.
Weak checks bite latest, and hardest. An agent reports success from its own reading of its own work, and it isn't lying when it does that — it just has nothing external telling it otherwise. Maybe the better way to put it is that if the only thing between the agent and your main branch is its own summary, you don't have a review step at all, you have a formality with a nice interface. Give it a command whose exit code you trust, and let the run fail when that command fails.
Your ticket is the agent's brief
A detailed Linear or GitHub ticket is no longer just a record for a human - it is the agent's brief. The quality of the agent's output is set by the ticket, so write the ticket as the what, not the how: user story, requirements, data model, expected UI. Leave the implementation steps out and let the agent reason about how.
Pull the ticket into the agent via MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. (Linear or Atlassian). Point the agent at the issue and it recognizes the source, fetches the full details, plans, and builds - you don't paste the body in by hand.
The board-column trigger
Add a dedicated column - e.g. an In Progress Cursor column split from In Progress Human so agent work is visible. Wire it via webhook so dragging a ticket into the column triggers a cloud agent that extracts the ticket, implements it, and returns a PR plus artifacts.
- 1
- Move the ticket to In Progress.
- 2
- Copy the issue content.
- 3
- Paste it into the agent.
- 4
- Wait for the run.
- 5
- Manually test.
- 6
- Open a PR.
- 7
- Get review, then merge.
With a board-column trigger, steps 1-6 become a single drag - and dragging several tickets at once fans out parallel agents, each opening its own PR.
How does the agent reach Linear and prune a backlog?
Through the Linear MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition.. An MCP lets a Cursor agent talk to an external system; the Linear one lets it read tickets, comment on them, and create tickets and projects. PMs use Cursor as a Linear front-end and let it do bulk triage a human would never finish by hand.
Point the agent at a project: "go to this project, look at all the tickets, mark all the ones that are solved as done."
For each ticket it pulls the context, jumps to the code, checks git history for relevant commits, decides whether the problem still exists, updates the comments, and surfaces open questions back to you.
Cursor's own team runs an unreleased auto-run feature internally: it automatically fires a background agent on incoming bug reports that meet a confidence bar. The agent works autonomously, then a human reviews and merges a high-confidence fix or iterates if not. It is oriented around Linear's schema today, with Jira and more connectors expanding externally in the coming months.
The bottleneck wasn't the agent. It was the data the agent was handed - so fix the intake before blaming the model.
The biggest learnings... aren't that the background agent is actually really effective with the data it's given but we found that we need to iterate on our bug reporting process a little bit to make the right data available.
Can I investigate a bug just by pasting a Slack thread?
Yes, and you don't need to know the codebase. A finance teammate flagged a self-serve team with 10 stacked unpaid invoices the product should have blocked after the first. The presenter opened a new agent, pasted the raw Slack thread, and hit go. Nothing else.
With the agent connected to the GitHub repo, Databricks via MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition., and Slack and Notion, Cursor reasoned across every system. It built its own to-do list, located the exact function causing the bug, validated against that specific customer, summarized all impacted teams (open invoice counts, total exposure, top 10 customers by open value), and proposed both a fix and a Linear bug report. The agent discovers the files live - you don't point it at them.
An investigation that normally means a day of work plus engineering triage collapses into a single chat, because the agent walks the systems for you.
Typically, this sort of investigation might take you a day... And so, we've been able to do all of that in the space of, 5 to 10 minutes.
Frequently asked questions
Who is this guide for?
AI engineers, support engineering teams and DevEx teams.
What should I do next?
Start with one real repo task, capture the prompt and review the result before scaling the workflow.
Can one drag start several agents at once?
Yes. Drag several tickets into the trigger column together and each spins up its own cloud agent in parallel, each opening its own PR. The strongest use case is fanning out one-shottable low-hanging fruit asynchronously.
Sources & last verified
- Cursor agent best practices
- Cursor Learn: working with agents
- Cursor Learn: context
- Cursor docs: prompting agents
Cursor ships frequently. Facts verified against primary sources on July 9, 2026.
Keep reading
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.