agenticoutputs
Open Source

Local-First GitHub Triage with Llama 3 and a Shell Script

mrmolsen · June 29, 2026 ·6 min read
Local-First GitHub Triage with Llama 3 and a Shell Script

Stop paying for GitHub Copilot just to summarize pull requests. You can get 90% of the value for free, on your own machine, with five lines of shell script and an open-source LLM. Your code never leaves your laptop.

The Morning Triage Problem

You open your laptop to 15 new issues and 4 pull requests. Each one requires you to stop, read, understand the context, and decide on a next action. At two to three minutes per item, you’ve burned nearly an hour of your most productive time before writing a single line of code. It’s a daily tax on your focus.

The standard advice is to use an AI tool. But pasting code diffs and issue descriptions into a third-party web UI is a massive risk. For many, it violates compliance policies like SOC 2 or HIPAA. For others, it’s an unacceptable risk of leaking unpatched security vulnerabilities or proprietary intellectual property. A local model keeps all that data where it belongs: on your machine.

The Stack: Ollama + Llama 3 8B + GitHub CLI

This workflow uses three tools. No more, no less. Open a terminal and run these commands.

First, install Ollama, the simplest way to run LLMs locally.

curl -fsSL https://ollama.com/install.sh | sh

Next, pull the model. We’re using Llama 3 8B. It’s small, fast, and more than capable of summarizing text.

ollama pull llama3:8b

Hardware Check: Llama 3 8B runs best with at least 16GB of RAM. It will run on 8GB, especially with Apple Silicon (M1/M2/M3), but expect it to be slower. A dedicated GPU will also speed things up considerably.

Finally, install the official GitHub CLI, gh, to fetch data directly from the API. If you’re on a Mac with Homebrew:

brew install gh

Once installed, authenticate with your GitHub account. This command will open a browser window to complete the login process. Grant it access to the repositories you want to triage.

gh auth login

The Triage Scripts: Copy, Paste, Run

With the tools installed, you just need two scripts. These use gh to get the data and pipe it into ollama with a specific prompt. The <<EOF syntax is important; it handles multi-line prompts cleanly.

Triage a Single Issue

This script fetches an issue’s body, then asks the LLM for a summary, a category, and suggested labels.

Create a file named triage-issue.sh:

#!/bin/bash

# Usage: ./triage-issue.sh <issue_number>

if [ -z "$1" ]; then
  echo "Usage: $0 <issue_number>"
  exit 1
fi

ISSUE_BODY=$(gh issue view "$1" --json body --jq .body)

ollama run llama3:8b --verbose=false <<EOF
You are a GitHub issue triage assistant.
Your task is to process the following issue body and provide a structured summary.

ISSUE BODY:
---
$ISSUE_BODY
---

Respond in the following format, and nothing else:

**Summary:** A single, concise sentence explaining the core problem.
**Category:** Choose one: Bug, Feature Request, Question, Documentation, Chore.
**Labels:** Suggest 1-3 relevant labels from this list: "ui", "api", "database", "performance", "auth", "bug", "enhancement", "needs-repro".
EOF

Make it executable with chmod +x triage-issue.sh. Now, run it on an issue.

./triage-issue.sh 341

A realistic output looks like this:

**Summary:** The user is reporting that the main login button is unresponsive on the Safari browser, preventing them from accessing their account.
**Category:** Bug
**Labels:** "ui", "bug", "needs-repro"

Summarize a Pull Request

This script fetches the diff of a PR and asks the LLM to explain the change at a high level. It’s for understanding intent, not for a line-by-line review.

Create a file named summarize-pr.sh:

#!/bin/bash

# Usage: ./summarize-pr.sh <pr_number>

if [ -z "$1" ]; then
  echo "Usage: $0 <pr_number>"
  exit 1
fi

PR_DIFF=$(gh pr diff "$1")

ollama run llama3:8b --verbose=false <<EOF
You are a GitHub pull request summarization assistant.
Analyze the following code diff and explain the change. Focus on the 'what' and 'why', not a line-by-line description.

DIFF:
---
$PR_DIFF
---

Respond in the following format, and nothing else:

**Summary:** A short paragraph explaining the purpose and approach of the changes.
**Purpose:** Choose one: Bug Fix, New Feature, Refactor, Chore, Documentation.
**Labels:** Suggest 1-2 relevant labels from this list: "fix", "feature", "refactor", "tests", "docs".
EOF

Make it executable (chmod +x summarize-pr.sh) and run it.

./summarize-pr.sh 345

The output gives you immediate context on the proposed change:

**Summary:** This pull request fixes the unresponsive login button bug on Safari by replacing a custom JavaScript click handler with a standard HTML form submission. It also adds a basic integration test to prevent regressions for this specific behavior.
**Purpose:** Bug Fix
**Labels:** "fix", "tests"

Batch Mode: The Daily Digest

Running these one by one is useful, but the real speed comes from batching your morning triage. A simple for loop can create a daily digest.

for number in $(gh issue list --limit 10 --state open --json number --jq '.[].number'); do
  echo "## Triaging Issue #$number"
  ./triage-issue.sh "$number"
  echo -e "\n---\n"
done

This fetches the 10 most recent open issues and runs the triage script on each one, printing a separator. You get a scannable list in your terminal in under a minute.

## Triaging Issue #341
**Summary:** The user is reporting that the main login button is unresponsive on the Safari browser, preventing them from accessing their account.
**Category:** Bug
**Labels:** "ui", "bug", "needs-repro"

---

## Triaging Issue #340
**Summary:** The developer proposes adding a dark mode option to the user settings page to improve accessibility and user experience.
**Category:** Feature Request
**Labels:** "ui", "enhancement"

---

You can extend this pattern for a first-pass code review. This script asks the model to act as a security and reliability reviewer, specifically ignoring stylistic concerns.

Create review-diff.sh:

#!/bin/bash
if [ -z "$1" ]; then echo "Usage: $0 <pr_number>"; exit 1; fi
PR_DIFF=$(gh pr diff "$1")
ollama run llama3:8b --verbose=false <<EOF
You are an automated code reviewer.
Analyze this diff for potential bugs. Focus ONLY on:
1. Null pointer exceptions
2. Off-by-one errors
3. Race conditions
4. Insecure practices (e.g., SQL injection, hardcoded secrets)

Do NOT comment on style, formatting, or naming. If no issues are found, respond with "No critical issues found."

DIFF:
---
$PR_DIFF
---
EOF

This is a filter, not a replacement for human review. It helps spot common mistakes before you invest your own time.

For even faster access, wire these scripts into an Alfred workflow or a Raycast script command. Or, take it a step further: run summarize-pr.sh as a GitHub Actions step that posts its summary as the first comment on any new PR.

What This Is (and Isn’t)

Let’s be clear. The LLM suggests; the developer decides. This workflow doesn’t automatically apply labels or merge pull requests. It’s a tool to accelerate your own judgment.

The model will occasionally misclassify an issue or suggest a nonsensical label. It might miss a subtle bug in a code review. Treat its output as a well-informed first draft from a junior developer. It saves you the initial context-gathering effort, but the final decision is always yours.

The real point here is the pattern. Once you have these scripts, swapping in a different model from Ollama is a one-line change. Extending the prompt to fit your team’s specific needs is trivial. This is a foundation, not a finished product. Build on it.

Share Post on X LinkedIn