> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Auto-Triage Bugs via Linear

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Auto-Triage Bugs via Linear" description="Devin auto-investigates bugs the moment a label is applied in Linear." prompt="Read the bug report on this Linear ticket. Search the codebase for the relevant code paths and identify the root cause." category="Project Management" features="Integrations, Playbooks" devinUrl="https://app.devin.ai/settings/connections/linear" />

<div className="uc-detail-wrapper">
  <Tip>Don't want to set this up manually? Paste a link to this page into a Devin session and ask it to set everything up for you.</Tip>

  <Steps>
    <Step title="Write a triage playbook">
      The automation needs a playbook that tells Devin *how* your team triages bugs — not just "fix the bug," but the specific steps an engineer would follow.

      Start by duplicating the `!triage` [template playbook](https://app.devin.ai/settings/playbooks/14fed18b89d44713a26e673cf258f548?utm_source=docs\&utm_medium=use-case-gallery) and customizing it for your stack. Or go to [**Settings > Playbooks**](https://app.devin.ai/settings/playbooks?utm_source=docs\&utm_medium=use-case-gallery) and create a new playbook with the macro `!triage-bug`. Here's an example:

      <PromptBlock type="playbook">
        ```txt Triage playbook example theme={null}
        Read the bug report on this Linear ticket. Then:

        1. Search the codebase for the relevant code paths mentioned in the report
        2. Check git log for recent changes to those files
        3. Identify the root cause and summarize your findings: root cause,
           affected files, recent changes that may have caused it, and a
           suggested fix approach
        ```
      </PromptBlock>

      The more specific your playbook, the better Devin's triage. Reference your team's actual patterns — error logging conventions, test frameworks, branch naming rules. See the [playbook docs](/product-guides/creating-playbooks) for more on writing effective playbooks, or ask Devin to generate a playbook for you.

      <Tip>Connect the [Datadog MCP](/work-with-devin/mcp#datadog) (or other logging/monitoring services) and give Devin read-only database access so it can check logs, metrics, and query data as part of its investigation.</Tip>
    </Step>

    <Step title="Wire up the automation trigger">
      Now connect the playbook to Linear so it fires automatically when a bug is labeled.

      1. Go to [**Settings > Connections > Linear**](https://app.devin.ai/settings/connections/linear?utm_source=docs\&utm_medium=use-case-gallery) (connect the integration first if you haven't — [setup guide](/integrations/linear))
      2. Under **Synced playbook labels**, click **Add playbook** and select `!triage-bug` — this creates a matching label in Linear's **"Devin Playbooks"** label group
      3. Scroll to **Automation triggers** and click **Add trigger**:
         * **Teams**: Select the team where bugs are filed (e.g., "Engineering")
         * **Labels**: Select `Bug` (or whichever label your team uses for bug reports)
         * **Playbook**: Select `!triage-bug`
      4. Save the trigger

      Triggers use **edge detection** — they only fire when a ticket *transitions* to matching (e.g., when someone adds the `Bug` label), not for tickets that already have it. This means you won't accidentally trigger Devin on your entire existing backlog.

      <Note>For playbook labels to sync to Linear automatically, your Linear workspace must have **Manage workspace labels** set to **All members** (found under Linear's **Settings > Security**). If that's not enabled, you'll need to create the labels manually in Linear.</Note>
    </Step>

    <Step title="Label a bug and watch Devin investigate">
      When an engineer adds the `Bug` label to a Linear ticket like this:

      > **ENG-487**: Users see a 500 error when submitting the contact form on /contact. Started after last Friday's deploy. Stack trace points to `validateEmail()` in `src/lib/forms.ts`.

      Devin automatically starts a session and follows your triage playbook:

      * **Reads the ticket** — pulls the title, description, and any comments from Linear
      * **Searches the codebase** — finds `src/lib/forms.ts`, the route handler at `src/routes/contact.ts`, and the form validation tests
      * **Checks recent changes** — runs `git log --since="last Friday" -- src/lib/forms.ts` and spots a commit that refactored the email regex

      Devin's findings are automatically synced back to the Linear ticket via the integration. All of this happens without anyone assigning the ticket to Devin — the label alone triggers the entire workflow.

      <Tip>With the Linear integration installed, Devin natively has access to Linear's tools — so your playbook can instruct Devin to update ticket labels based on its findings. For example, your triage playbook could tell Devin to add a `Clear Fix`, `Needs Review`, or `Lacking Context` label depending on the outcome. Since labels can trigger other automations, you can chain workflows — e.g., a `Clear Fix` label could kick off a second Devin session that writes the fix.</Tip>
    </Step>

    <Step title="Sharpen the loop">
      After a few triages, refine the system based on what Devin gets right and where it needs more guidance.

      **Improve the playbook based on real sessions.** If Devin consistently misses something (e.g., not checking logs or missing a related service), add that step to your `!triage-bug` playbook. You can ask Devin to analyze past sessions and automatically improve your playbook or create [Knowledge](/product-guides/knowledge) entries for patterns Devin should follow across all sessions — like "always check the error tracking dashboard first" or "our auth service logs are in CloudWatch, not Datadog."

      **Add a fix playbook for when you're ready.** Once you trust Devin's triage, create a second playbook like `!fix-bug` that goes further — writing a fix, adding a regression test, and opening a PR. Map it to a separate label so your team can choose between "just tell me what's wrong" and "fix it for me":

      <PromptBlock type="playbook">
        ```txt Fix playbook example theme={null}
        Read the bug report on this Linear ticket. Then:

        1. Search the codebase for the relevant code paths mentioned in the report
        2. Check git log for recent changes to those files
        3. Identify the root cause
        4. Write a fix that addresses the root cause
        5. Add a regression test that would have caught this bug
        6. Run the existing test suite to make sure nothing else breaks
        7. Open a PR linked to the Linear ticket — include "Fixes ENG-XXX" in
           the PR description
        ```
      </PromptBlock>
    </Step>
  </Steps>
</div>
