Taming My GitHub Backlog with a Local LLM: A Triage Game Changer

2026-11-03来源 dev.toEnglish

My sprint started like usual: staring down a mountain of GitHub issues. Some of them, bless their hearts, had comment threads longer than a novella. You know the ones – the original bug report, 10 comments debating a workaround, 5 more about a related edge case, and then buried somewhere, the actual resolution or next step. Triage felt less like managing work and more like an archaeological dig.

In the past, I'd just skim, open every link, try to piece together the narrative. It was agonizing, easily eating an hour or more just to get a handle on a handful of complex issues. This sprint, I was determined to do better. My first thought was a full-blown AI integration, but I'm an indie dev, not a bank. Paid LLM APIs felt like overkill for internal messy comments, plus I'm a bit wary of sending all my internal discussions to a third party. I needed something private, cheap, and effective.

That's when I remembered Ollama. I've been dabbling with local models, mostly for fun. Could I really throw a chunky GitHub thread at llama3 and get something useful back? Turns out, yes, but not without some nudging.

What Actually Fixed It

1. Getting the Data (Without Over-Engineering)

For my initial test, I just copy-pasted the entire comment history for a particularly gnarly issue into a text file. For real use, I quickly whipped up a little helper function using the gh CLI. It's simple, but it works:

python
import subprocess
import json

def get_issue_comments(repo, issue_number):
try:
# Requires gh CLI to be installed and authenticated
cmd = f"gh api repos/{repo}/issues/{issue_number}/comments"
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=True)
comments_data = json.loads(result.stdout)
# Concatenate all comment bodies, separated for clarity
return "\n---\n".join([c['body'] for c in comments_data])
except subprocess.CalledProcessError as e:
print(f"Error fetching comments for issue {issue_number}: {e}")
print(e.stderr)
return None

This gives me a single string of all comments, nicely delimited, ready for the LLM.

2. Ollama & llama3:8b (My Local Workhorse)

I already had Ollama installed and llama3:8b downloaded. It's a fantastic local model that strikes a great balance between performance and size. Running it is as simple as ollama run llama3:8b in your terminal, then feeding it input.

3. The Magic: Prompt Engineering (Focus on Actionability)

My initial prompt was too generic, something like, "Summarize this GitHub issue comment thread." It gave me bland, academic recaps that weren't actionable. I needed intelligence that helped me triage, not just understand. After a few iterations, this is the prompt that clicked:

You are an expert software engineer and project manager. I am providing you with the entire comment history for a GitHub issue. Your task is to summarize the core problem, the proposed solutions, any blocking issues, and the clear next steps for triaging this issue. Be concise and focus on actionable insights for an engineering team.

{TEXT_TO_SUMMARIZE_HERE}

Summary:

That last Summary: at the end is crucial. It primes the model to immediately start its output with the summary itself, making parsing easier.

4. Tying It Together: A Python Script

I combined the comment fetching with a function to send the data to Ollama:

python
def summarize_with_ollama(text_to_summarize):
prompt = f"""You are an expert software engineer and project manager. I am providing you with the entire comment history for a GitHub issue. Your task is to summarize the core problem, the proposed solutions, any blocking issues, and the clear next steps for triaging this issue. Be concise and focus on actionable insights for an engineering team.

{text_to_summarize}

Summary:
"""
try:
# Using Popen for better control over stdin/stdout
cmd = ["ollama", "run", "llama3:8b"]
process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
output, _ = process.communicate(prompt) # Send prompt, get output

 # Ollama often echoes the prompt; find where the actual response starts response_start_marker = "Summary:" response_start_index = output.find(response_start_marker) if response_start_index != -1: return output[response_start_index + len(response_start_marker):].strip() return output.strip() # Fallback if marker isn't found perfectly except Exception as e: print(f"Error calling Ollama: {e}") return "Failed to get summary." 

Example usage (put this in a main block or another script)

if name == "main":
REPO = "your-github-org/your-repo"
ISSUE_NUMBERS = [123, 456, 789] # Your backlog issues

for issue_num in ISSUE_NUMBERS: print(f"\n--- Summarizing Issue #{issue_num} ---") all_comments = get_issue_comments(REPO, issue_num) if all_comments: summary = summarize_with_ollama(all_comments) print(f"Issue #{issue_num} Summary:\n{summary}") else: print(f"Could not retrieve comments for Issue #{issue_num}.") 

The Result: My Triage Superpower

The difference was night and day. A complex issue that would have taken me 15-20 minutes to fully grasp, I could now triage in under 5 minutes thanks to a solid, actionable summary. I probably saved myself at least an hour this week alone, and my team will definitely feel the benefit of more accurately triaged issues, since I'm not making snap judgments based on partial understanding.

It’s funny how often the simplest solutions, built on existing tools, turn out to be the most effective. No fancy SaaS, no API keys, just my local machine, Ollama, and a little bit of Python. If you're drowning in GitHub comments, I highly recommend giving a local LLM a shot. It's a game-changer for reclaiming your sprint.

原文:https://www.a8q9.cn/en/article/taming-my-github-backlog-with-a-local-llm-a-triage-game-changer-3f01f2.html

相关文章