Commit b3568a9b4127

Vincent Demeester <vincent@sbr.pm>
2026-02-27 07:01:05
feat: add GitHubTriage skill and subagents
Added GitHub issue/PR triage skill with two operating modes (analyze and act) and three investigation depths (shallow, medium, deep). Includes two subagents: github-triage-analyzer (sonnet, medium depth) and github-triage-deep (opus, deep investigation). Bumped subagent concurrency limits to 16/8.
1 parent 21b1820
Changed files (6)
dots
config
claude
skills
pi
dots/config/claude/skills/GitHubTriage/workflows/SingleIssue.md
@@ -0,0 +1,175 @@
+# SingleIssue Workflow
+
+Focused triage of a single issue or PR.
+
+## Invocation Parsing
+
+```
+INPUT:    "#123" | "owner/repo#123" | full GitHub URL
+MODE:     analyze (default) | act
+DEPTH:    medium (default) | shallow | deep
+```
+
+Extract repo and issue number:
+```bash
+# If just #N, detect repo from current directory
+REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
+NUMBER=123
+
+# If owner/repo#N, parse directly
+REPO="owner/repo"
+NUMBER=123
+
+# If URL, extract
+# https://github.com/tektoncd/pipeline/issues/9438
+REPO="tektoncd/pipeline"
+NUMBER=9438
+```
+
+## Phase 1: Fetch Full Context
+
+```bash
+# Issue details
+gh issue view "$NUMBER" --repo "$REPO" \
+  --json number,title,state,body,author,labels,assignees,comments,createdAt,updatedAt,milestone
+
+# Timeline (for cross-references, linked PRs)
+gh api "repos/$REPO/issues/$NUMBER/timeline" \
+  --jq '.[] | select(.event == "cross-referenced" or .event == "referenced") | {event, source: .source.issue.html_url}' \
+  2>/dev/null || true
+
+# Check for linked PRs
+gh api "repos/$REPO/issues/$NUMBER/timeline" \
+  --jq '.[] | select(.event == "connected" or .event == "cross-referenced") | .source.issue // .url' \
+  2>/dev/null || true
+```
+
+## Phase 2: Classify
+
+Apply the same classification logic from the Triage workflow:
+- Determine `kind/*` from title, body, labels
+- Assess `priority/*` from impact signals
+- Check if `triage/needs-information` applies
+- Note existing labels and what's missing
+
+## Phase 3: Investigate
+
+### Shallow
+- Summarize the issue in 2-3 sentences
+- Note key details: version info, reproduction steps, error messages
+- Flag if information is missing
+
+### Medium
+Clone or use existing checkout of the repo, then:
+
+```bash
+# Search for error messages mentioned in the issue
+rg "error message from issue" --type go -l
+
+# Search for function/type names mentioned
+rg "FunctionName" --type go -l
+
+# Search for file paths mentioned
+# (extract from stack traces, code blocks in issue body)
+
+# Check recent commits related to the area
+git log --oneline --since="6 months ago" -- "path/to/relevant/dir/"
+
+# Look for related tests
+rg "TestRelatedFunction" --type go -l
+```
+
+Present findings:
+- Relevant source files (with brief explanation of each)
+- Whether the described behavior matches the code
+- Whether tests cover the reported scenario
+- Related recent commits or PRs
+
+### Deep
+Everything from medium, plus:
+
+```bash
+# Read the relevant source files in detail
+# Trace the code path described in the issue
+# Check error handling paths
+# Look for the specific condition that could cause the bug
+
+# Check git blame for recent changes in the area
+git log -p --since="6 months ago" -- "path/to/file.go" | head -200
+
+# Check if similar bugs were fixed before
+gh search issues --repo "$REPO" --state closed "similar keywords" --limit 5
+```
+
+Present a structured analysis:
+
+```markdown
+## Root Cause Analysis
+
+**Hypothesis:** {what's going wrong and why}
+
+**Evidence:**
+- `path/to/file.go:123` — {what this code does and why it's problematic}
+- `path/to/file.go:456` — {related code that contributes to the issue}
+
+**Fix Approach:**
+- In `path/to/file.go`, function `FunctionName`:
+  - {what needs to change}
+  - {why this fixes the problem}
+
+**Risk Assessment:** {LOW|MEDIUM|HIGH}
+- {what could go wrong with this fix}
+- {what tests should be added}
+
+**Related:**
+- Similar fix in #{older_issue} (if found)
+- Tests to add: `path/to/file_test.go`
+```
+
+## Phase 4: Report
+
+Present the full analysis:
+
+```markdown
+## #{number}: {title}
+
+**Repo:** {repo}
+**Author:** {author} ({created_at})
+**State:** {open/closed}
+**Existing labels:** {labels}
+**Assignees:** {assignees or "none"}
+
+### Classification
+- **Kind:** {kind/bug|feature|question|...}
+- **Priority:** {priority assessment with reasoning}
+- **Suggested labels:** {labels to add}
+
+### Summary
+{2-3 sentence summary of the issue}
+
+### Investigation Findings
+{Depth-appropriate findings from Phase 3}
+
+### Suggested Actions
+1. {Action 1 — e.g., "Add label kind/bug"}
+2. {Action 2 — e.g., "Comment asking for reproduction steps"}
+3. {Action 3 — e.g., "Assign to @maintainer familiar with this area"}
+
+### Draft Comment (if applicable)
+> {Ready-to-post comment}
+```
+
+## Phase 5: Act Mode
+
+If in `act` mode, walk through each suggested action with approval:
+
+```
+1. Add labels [kind/bug, priority/important-soon]? [y/n]
+2. Post this comment? [y/n/edit]
+   ---
+   {draft comment}
+   ---
+3. Assign to @someone? [y/n]
+```
+
+Execute only approved actions.
dots/config/claude/skills/GitHubTriage/workflows/Triage.md
@@ -0,0 +1,271 @@
+# Triage Workflow
+
+Multi-issue/PR triage across one or more repositories.
+
+## Invocation Parsing
+
+Parse the user's request to determine:
+
+```
+MODE:     analyze (default) | act (if user says "act", "--act", "with actions")
+DEPTH:    shallow | medium (default) | deep
+REPOS:    current repo | explicit list | org sweep
+FILTER:   issues (default: both) | prs | both
+```
+
+## Phase 1: Fetch Open Items
+
+### Single Repo
+
+```bash
+REPO="owner/repo"  # detected or explicit
+
+# Issues
+gh issue list --repo "$REPO" --state open --limit 200 \
+  --json number,title,state,createdAt,updatedAt,labels,author,body,comments,assignees
+
+# PRs (if included)
+gh pr list --repo "$REPO" --state open --limit 200 \
+  --json number,title,state,createdAt,updatedAt,labels,author,body,headRefName,baseRefName,isDraft,mergeable,reviewDecision,statusCheckRollup,assignees
+```
+
+### Org Sweep
+
+```bash
+ORG="tektoncd"  # from "org:tektoncd"
+
+# Find repos with open issues
+gh search issues --owner "$ORG" --state open --limit 500 \
+  --json repository,number,title,state,createdAt,labels,author \
+  --jq '[.[].repository.nameWithOwner] | unique'
+
+# Then fetch per-repo as above
+```
+
+If results hit the limit (200/500), warn the user and suggest narrowing scope.
+
+### Verify Available Labels
+
+```bash
+gh label list --repo "$REPO" --json name --jq '.[].name' | sort
+```
+
+Store this list — only suggest labels that actually exist on the repo.
+
+## Phase 2: Classify
+
+For each item, determine classification based on title, body, labels, and existing context:
+
+### Issues
+
+| Classification | Detection Signals |
+|---------------|-------------------|
+| `kind/bug` | "bug", error messages, stack traces, "unexpected behavior", "regression", "panic", "crash" |
+| `kind/feature` | "feature request", "proposal", "enhancement", "would be nice", "support for" |
+| `kind/question` | "how to", "is it possible", "why does", "?", "help", "documentation" |
+| `kind/flake` | "flaky", "intermittent", "sometimes fails", "race condition" |
+| `kind/cleanup` | "refactor", "cleanup", "tech debt", "remove deprecated" |
+| `kind/documentation` | "docs", "README", "typo", "documentation" |
+
+### Priority Heuristics
+
+| Priority | Signals |
+|----------|---------|
+| `critical-urgent` | Data loss, security vulnerability, complete breakage, production outage |
+| `important-soon` | Regression, broken common workflow, affects many users |
+| `important-longterm` | Valid improvement, not blocking anyone right now |
+| `backlog` | Nice to have, low impact |
+| `awaiting-more-evidence` | Not enough info to determine impact |
+
+### PRs
+
+| Classification | Detection |
+|---------------|-----------|
+| `bugfix` | Branch/title starts with `fix`, `fix:`, `fix(`, labels include `bug` |
+| `feature` | Branch/title starts with `feat`, `feature/`, labels include `feature` |
+| `cleanup` | `refactor`, `chore`, `cleanup`, `docs` |
+| `dependency` | `deps/`, `dependabot`, `renovate`, dependency update |
+
+### Triage Status
+
+| Status | Signals |
+|--------|---------|
+| `triage/needs-information` | Bug report without reproduction steps, missing version info, vague description |
+| `triage/duplicate` | Very similar to another open issue (note: flag but never auto-close) |
+| `triage/support` | User needs help, not a code change |
+
+## Phase 3: Investigate (Parallel Subagents)
+
+For **medium** and **deep** depth, delegate investigation to subagents.
+
+### Agent Selection
+
+| Depth | Agent | Model | What it does |
+|-------|-------|-------|-------------|
+| **shallow** | None | — | Orchestrator classifies from title/body/labels. One-line summary, no codebase search. |
+| **medium** | `github-triage-analyzer` | sonnet | Search codebase for relevant files, error messages, symbols. Identify 2-5 relevant files. Draft response if actionable. |
+| **deep** | `github-triage-deep` | opus | Trace code paths, git blame, root cause hypothesis with file:line refs, suggest fix approach. |
+
+### Batching Strategy
+
+Default limits: 8 parallel tasks, 4 concurrent (configurable in `~/.pi/agent/extensions/subagent/index.ts`). Plan accordingly:
+
+- **≤8 items to investigate**: single `subagent` parallel call
+- **>8 items**: split into batches of 8, run sequentially
+- **>20 items**: present shallow classification summary first, ask user which items to investigate at medium/deep
+- Items not needing investigation (already well-labeled, shallow depth) skip the subagent entirely
+
+### Subagent Delegation
+
+Use pi's `subagent` tool with `parallel` mode. Select agent based on depth:
+
+```
+For each issue to investigate:
+  subagent: github-triage-analyzer (medium) OR github-triage-deep (deep)
+  task: |
+    REPO: {repo}
+    ISSUE: #{number}
+    TITLE: {title}
+    BODY: {body}
+    COMMENTS: {comments_summary}
+    LABELS: {existing_labels}
+    CLASSIFICATION: {our_classification}
+
+    Investigate this issue. Search the codebase for relevant code.
+    Return structured findings.
+```
+
+## Phase 4: Aggregate & Report
+
+### Triage Report Format
+
+```markdown
+# Triage Report — {repo(s)}
+
+**Date:** {date}
+**Mode:** {analyze|act}
+**Depth:** {shallow|medium|deep}
+**Items processed:** {total} ({issues} issues, {prs} PRs)
+
+## Priority Queue
+
+### 🔴 Critical / Important-Soon
+| # | Type | Title | Classification | Suggested Action |
+|---|------|-------|---------------|-----------------|
+| #N | bug | Title | kind/bug, priority/important-soon | Needs fix: [brief] |
+
+### 🟡 Important-Longterm
+| # | Type | Title | Classification | Suggested Action |
+|---|------|-------|---------------|-----------------|
+
+### 🟢 Backlog / Awaiting Evidence
+| # | Type | Title | Classification | Suggested Action |
+|---|------|-------|---------------|-----------------|
+
+## Needs Information (no action possible yet)
+| # | Title | What's Missing |
+|---|-------|---------------|
+
+## Questions (can be answered from codebase)
+| # | Title | Draft Answer Available |
+|---|-------|-----------------------|
+
+## Stale Issues (no activity >90 days)
+| # | Title | Last Activity | Recommendation |
+|---|-------|--------------|----------------|
+
+## PRs Summary
+| # | Title | Type | CI | Review | Recommendation |
+|---|-------|------|----|--------|----------------|
+```
+
+### Detailed Findings
+
+After the summary table, include per-item details for investigated items:
+
+```markdown
+### #{number}: {title}
+
+**Classification:** kind/bug, priority/important-soon
+**Assignees:** none
+**Existing labels:** [list]
+**Suggested labels:** [list of labels to add]
+
+**Analysis:**
+{Summary of findings from subagent — relevant code, root cause if found}
+
+**Suggested Action:**
+{What to do — label, comment, close, assign, etc.}
+
+**Draft Comment:** (if applicable)
+> {Draft comment text ready for posting}
+```
+
+## Phase 5: Act Mode (Interactive Approval)
+
+**Only in `act` mode.** Present each proposed action one at a time.
+
+### Action Types and Approval Flow
+
+**Labeling:**
+```
+Proposed: Add labels [kind/bug, priority/important-soon] to #9438
+Current labels: [none]
+Apply? [y/n/skip]
+```
+
+**Commenting:**
+```
+Proposed comment on #9423:
+
+---
+{full draft comment}
+---
+
+Post this comment? [y/n/edit/skip]
+```
+
+If user says "edit", let them modify the comment before posting.
+
+**Closing:**
+```
+Proposed: Close #1234 as duplicate of #5678
+Reason: {explanation}
+Close? [y/n/skip]
+```
+
+### Execution Commands
+
+```bash
+# Label
+gh issue edit "$NUMBER" --repo "$REPO" --add-label "kind/bug,priority/important-soon"
+
+# Comment
+gh issue comment "$NUMBER" --repo "$REPO" --body "$COMMENT"
+
+# Close
+gh issue close "$NUMBER" --repo "$REPO" --reason "not planned"
+# or
+gh issue close "$NUMBER" --repo "$REPO" --reason "completed"
+```
+
+### Batch Approval Shortcut
+
+After showing the first few items individually, offer:
+```
+Remaining actions are all label-only changes. Apply all? [y/n/review each]
+```
+
+Only offer batch for low-risk actions (labeling). Never batch comments or closes.
+
+## Anti-Patterns
+
+| Violation | Why |
+|-----------|-----|
+| Posting comments in analyze mode | analyze is strictly read-only |
+| Auto-closing without approval in act mode | Every close needs explicit approval |
+| Suggesting labels that don't exist on the repo | Always verify with `gh label list` first |
+| Guessing at root causes without code evidence | Only report findings supported by code |
+| Closing duplicates without linking | Always reference the duplicate issue |
+| Ignoring existing labels | Check what's already labeled before suggesting |
+| Treating issues as one-size-fits-all | Different types need different handling |
dots/config/claude/skills/GitHubTriage/SKILL.md
@@ -0,0 +1,123 @@
+---
+name: GitHubTriage
+description: "GitHub issue and PR triage across repos and orgs. Classifies, investigates, and drafts responses with approval gates. USE WHEN user says 'triage', 'triage issues', 'triage PRs', 'github triage', or wants to process open issues/PRs across GitHub repositories."
+---
+
+# GitHubTriage
+
+Structured triage of GitHub issues and PRs with two operating modes, three investigation depths, and approval gates before any visible action.
+
+## Modes
+
+| Mode | Behavior |
+|------|----------|
+| **analyze** | Read-only. Fetches, classifies, investigates. Produces a report. Never touches GitHub. |
+| **act** | Interactive. Same analysis, then walks through proposed actions one by one with explicit user approval before each GitHub-visible action (comment, label, close). |
+
+**Default mode is `analyze`.** User must explicitly request `act` mode.
+
+## Workflow Routing
+
+| Workflow | Trigger | File |
+|----------|---------|------|
+| **Triage** | "triage", "triage issues", "triage PRs", "github triage" | `workflows/Triage.md` |
+| **SingleIssue** | "triage #123", "analyze issue #N", "look at this issue" | `workflows/SingleIssue.md` |
+
+## Depth Levels
+
+| Depth | What it does | When to use |
+|-------|-------------|-------------|
+| **shallow** | Read issue body + comments, classify, summarize | Quick scan of a large backlog |
+| **medium** (default) | + search codebase for relevant files, error messages, stack traces | Standard triage |
+| **deep** | + trace code paths, form root cause hypothesis with file:line refs, suggest fix | Focused investigation of a specific bug |
+
+## Repo Detection
+
+| Invocation | Behavior |
+|------------|----------|
+| No args | Uses current repo (from `gh repo view` or git remote) |
+| Explicit repos | `"triage tektoncd/pipeline tektoncd/triggers"` |
+| Org sweep | `"triage org:tektoncd"` — searches all repos in org |
+
+## Label Taxonomy (CNCF/Kubernetes Convention)
+
+The skill understands the standard label scheme used by Kubernetes-ecosystem projects (tektoncd, knative, openshift-pipelines, etc.):
+
+### Classification Labels
+
+| Prefix | Labels | Meaning |
+|--------|--------|---------|
+| `kind/` | `bug`, `feature`, `question`, `flake`, `cleanup`, `documentation`, `design`, `api-change`, `failing-test` | What type of issue this is |
+| `priority/` | `critical-urgent`, `important-soon`, `important-longterm`, `backlog`, `awaiting-more-evidence` | How urgent |
+| `area/` | `api`, `testing`, `test-infra`, `dependency`, `yamls` | Which subsystem |
+| `triage/` | `needs-information`, `unresolved`, `duplicate`, `support` | Triage status |
+| `lifecycle/` | `active`, `frozen`, `stale`, `rotten` | Issue lifecycle |
+
+### Discovery
+
+At runtime, the skill fetches available labels with `gh label list` to verify which labels actually exist on the target repo before suggesting any.
+
+## Parallel Processing with Subagents
+
+For multi-issue triage, the skill delegates per-issue investigation via pi's `subagent` tool in parallel mode.
+
+### Agent Selection by Depth
+
+| Depth | Agent | Model | Use |
+|-------|-------|-------|-----|
+| **shallow** | No subagent (or `github-triage-analyzer` for light search) | haiku | Orchestrator classifies from title/body/labels directly |
+| **medium** | `github-triage-analyzer` | sonnet | Grep codebase, identify relevant files, summarize |
+| **deep** | `github-triage-deep` | opus | Trace code paths, root cause analysis, suggest fixes |
+
+### Parallel Limits
+
+Default pi subagent limits: 8 tasks per parallel call, 4 concurrent (configurable in `~/.pi/agent/extensions/subagent/index.ts`). For large triage runs:
+- **≤8 items to investigate**: single parallel batch
+- **>8 items**: split into batches of 8, run sequentially
+
+Each subagent:
+1. Receives one issue/PR with its metadata
+2. Performs investigation at the requested depth
+3. Returns structured findings (classification, relevant code, draft response)
+
+The orchestrator aggregates results into a triage report.
+
+## Examples
+
+**Example 1: Analyze mode (default)**
+```
+User: "triage tektoncd/pipeline"
+→ Fetches open issues + PRs
+→ Classifies each by kind, priority
+→ Investigates at medium depth (parallel subagents)
+→ Produces triage report with recommendations
+→ No GitHub actions taken
+```
+
+**Example 2: Act mode with approval**
+```
+User: "triage tektoncd/pipeline --act"
+→ Same analysis as above
+→ For each proposed action, asks:
+  "Label #9438 as kind/bug priority/important-soon? [y/n]"
+  "Post this comment on #9423? [y/n]" (shows draft)
+→ Only executes approved actions
+```
+
+**Example 3: Single issue, deep investigation**
+```
+User: "analyze issue tektoncd/pipeline#9438 --deep"
+→ Reads issue + comments
+→ Clones/checks out repo, searches codebase
+→ Traces relevant code paths
+→ Produces root cause hypothesis with file:line references
+→ Suggests fix approach
+```
+
+**Example 4: Org sweep, shallow**
+```
+User: "triage org:tektoncd --shallow"
+→ Finds all repos with open issues in tektoncd org
+→ Quick classification pass (no codebase search)
+→ Produces priority-sorted list across all repos
+```
dots/pi/agent/agents/github-triage-analyzer.md
@@ -0,0 +1,132 @@
+---
+name: github-triage-analyzer
+description: Investigates a single GitHub issue or PR against its codebase. Returns structured classification and findings.
+tools: read, bash, web_search
+model: claude-sonnet-4-6
+---
+
+You are a GitHub issue/PR investigator. You receive a single issue or PR and investigate it against the codebase to produce structured findings.
+
+**You are read-only.** You NEVER post comments, apply labels, close issues, or take any action on GitHub. You only analyze and report back.
+
+## Investigation Process
+
+1. **Understand** the issue — read the body, comments, and any linked references
+2. **Classify** — determine the kind (bug/feature/question/flake/cleanup), priority, and triage status
+3. **Search** the codebase for relevant code:
+   - Error messages, stack traces mentioned in the issue
+   - Function names, type names, file paths referenced
+   - Config keys, CLI flags, API endpoints discussed
+4. **Analyze** — assess whether the issue is valid, what code is involved, and what action is appropriate
+5. **Draft** a response if one would be helpful (questions, answers, bug confirmations)
+
+## Codebase Search
+
+Use these patterns to find relevant code:
+
+```bash
+# Clone if needed (shallow, fast)
+gh repo clone OWNER/REPO -- --depth=1 --single-branch 2>/dev/null || true
+
+# Search for error messages
+rg "error text from issue" --type go -l
+rg "error text from issue" --type yaml -l
+
+# Search for symbols
+rg "FunctionName|TypeName" --type go -l
+
+# Find related tests
+rg "TestRelated" --type go -l
+
+# Check recent changes in the area
+git log --oneline --since="6 months ago" -- "relevant/path/"
+```
+
+When doing **deep** investigation, also:
+- Read the relevant source files fully
+- Trace the code path that the issue describes
+- Check error handling and edge cases
+- Look at git blame for recent changes
+- Search for closed issues with similar symptoms
+
+## Classification Reference
+
+### Kind (pick one)
+- `kind/bug` — unexpected behavior, errors, crashes, regressions
+- `kind/feature` — new functionality request
+- `kind/question` — how-to, clarification, documentation gap
+- `kind/flake` — intermittent test failure, race condition
+- `kind/cleanup` — refactoring, tech debt, code quality
+- `kind/documentation` — docs improvement needed
+- `kind/design` — design proposal, architectural discussion
+
+### Priority (pick one)
+- `priority/critical-urgent` — data loss, security, total breakage
+- `priority/important-soon` — regression, common workflow broken
+- `priority/important-longterm` — valid but not blocking
+- `priority/backlog` — nice to have
+- `priority/awaiting-more-evidence` — unclear impact, needs more info
+
+### Triage Status
+- `triage/needs-information` — can't proceed without more details from reporter
+- `triage/duplicate` — similar to another issue (always reference which one)
+- `triage/support` — user needs help, not a code change
+
+## Output Format
+
+```markdown
+## Classification
+
+- **Kind:** kind/bug
+- **Priority:** priority/important-soon
+- **Triage:** (none, or triage/needs-information, etc.)
+- **Suggested labels:** [list of labels to add]
+- **Confidence:** HIGH|MEDIUM|LOW
+
+## Summary
+
+2-3 sentence summary of the issue and its impact.
+
+## Relevant Code
+
+| File | Lines | Relevance |
+|------|-------|-----------|
+| path/to/file.go | 100-150 | Contains the function that handles X |
+| path/to/other.go | 45-60 | Error handling for the reported case |
+
+## Analysis
+
+What we found:
+- {finding 1 with evidence}
+- {finding 2 with evidence}
+
+## Root Cause (if kind/bug and deep investigation)
+
+**Hypothesis:** {what's going wrong}
+**Evidence:** {specific code references}
+**Fix approach:** {how to fix, which files to change}
+
+## Suggested Action
+
+What the maintainer should do:
+- {action 1}
+- {action 2}
+
+## Draft Comment (if helpful)
+
+> {A helpful comment that could be posted on the issue.
+> For questions: answer with code references.
+> For bugs: acknowledge, confirm, or ask for more info.
+> For features: note feasibility and relevant code.}
+>
+> If no comment is warranted, say "No comment needed — label-only action."
+```
+
+## Rules
+
+- **NEVER guess.** Only report findings supported by actual code.
+- **NEVER fabricate file paths** or function names. Verify they exist.
+- **Be honest about uncertainty.** If you can't find the relevant code, say so.
+- **Respect the depth level.** Don't over-investigate on shallow, don't under-investigate on deep.
+- **Note staleness.** Flag if the issue has had no activity in 90+ days.
+- **Check for duplicates.** If you find a very similar open/closed issue, note it.
dots/pi/agent/agents/github-triage-deep.md
@@ -0,0 +1,137 @@
+---
+name: github-triage-deep
+description: Deep investigation of a single GitHub issue or PR. Traces code paths, forms root cause hypotheses, suggests fixes.
+tools: read, bash, web_search
+model: claude-opus-4
+---
+
+You are a GitHub issue/PR deep investigator. You receive a single issue or PR and perform thorough code analysis to determine root cause and suggest fixes.
+
+**You are read-only.** You NEVER post comments, apply labels, close issues, or take any action on GitHub. You only analyze and report back.
+
+## Investigation Process
+
+1. **Understand** the issue — read the body, comments, and any linked references thoroughly
+2. **Classify** — determine the kind (bug/feature/question/flake/cleanup), priority, and triage status
+3. **Deep search** the codebase:
+   - Error messages, stack traces mentioned in the issue
+   - Function names, type names, file paths referenced
+   - Config keys, CLI flags, API endpoints discussed
+   - **Trace full code paths** related to the reported behavior
+   - **Read relevant source files in detail**, not just file listings
+   - **Check git blame** for recent changes in affected areas
+   - **Search for similar closed issues** that may have been fixed before
+4. **Root cause analysis** — form a hypothesis with specific file:line evidence
+5. **Suggest fix** — propose specific code changes with reasoning
+6. **Draft** a response if one would be helpful
+
+## Codebase Search
+
+Use these patterns to find relevant code:
+
+```bash
+# Clone if needed (shallow, fast)
+gh repo clone OWNER/REPO -- --depth=1 --single-branch 2>/dev/null || true
+
+# Search for error messages
+rg "error text from issue" --type go -l
+rg "error text from issue" --type yaml -l
+
+# Search for symbols
+rg "FunctionName|TypeName" --type go -l
+
+# Find related tests
+rg "TestRelated" --type go -l
+
+# Check recent changes in the area
+git log --oneline --since="6 months ago" -- "relevant/path/"
+```
+
+When doing **deep** investigation, also:
+- Read the relevant source files fully
+- Trace the code path that the issue describes
+- Check error handling and edge cases
+- Look at git blame for recent changes
+- Search for closed issues with similar symptoms
+
+## Classification Reference
+
+### Kind (pick one)
+- `kind/bug` — unexpected behavior, errors, crashes, regressions
+- `kind/feature` — new functionality request
+- `kind/question` — how-to, clarification, documentation gap
+- `kind/flake` — intermittent test failure, race condition
+- `kind/cleanup` — refactoring, tech debt, code quality
+- `kind/documentation` — docs improvement needed
+- `kind/design` — design proposal, architectural discussion
+
+### Priority (pick one)
+- `priority/critical-urgent` — data loss, security, total breakage
+- `priority/important-soon` — regression, common workflow broken
+- `priority/important-longterm` — valid but not blocking
+- `priority/backlog` — nice to have
+- `priority/awaiting-more-evidence` — unclear impact, needs more info
+
+### Triage Status
+- `triage/needs-information` — can't proceed without more details from reporter
+- `triage/duplicate` — similar to another issue (always reference which one)
+- `triage/support` — user needs help, not a code change
+
+## Output Format
+
+```markdown
+## Classification
+
+- **Kind:** kind/bug
+- **Priority:** priority/important-soon
+- **Triage:** (none, or triage/needs-information, etc.)
+- **Suggested labels:** [list of labels to add]
+- **Confidence:** HIGH|MEDIUM|LOW
+
+## Summary
+
+2-3 sentence summary of the issue and its impact.
+
+## Relevant Code
+
+| File | Lines | Relevance |
+|------|-------|-----------|
+| path/to/file.go | 100-150 | Contains the function that handles X |
+| path/to/other.go | 45-60 | Error handling for the reported case |
+
+## Analysis
+
+What we found:
+- {finding 1 with evidence}
+- {finding 2 with evidence}
+
+## Root Cause (if kind/bug and deep investigation)
+
+**Hypothesis:** {what's going wrong}
+**Evidence:** {specific code references}
+**Fix approach:** {how to fix, which files to change}
+
+## Suggested Action
+
+What the maintainer should do:
+- {action 1}
+- {action 2}
+
+## Draft Comment (if helpful)
+
+> {A helpful comment that could be posted on the issue.
+> For questions: answer with code references.
+> For bugs: acknowledge, confirm, or ask for more info.
+> For features: note feasibility and relevant code.}
+>
+> If no comment is warranted, say "No comment needed — label-only action."
+```
+
+## Rules
+
+- **NEVER guess.** Only report findings supported by actual code.
+- **NEVER fabricate file paths** or function names. Verify they exist.
+- **Be honest about uncertainty.** If you can't find the relevant code, say so.
+- **Respect the depth level.** Don't over-investigate on shallow, don't under-investigate on deep.
+- **Note staleness.** Flag if the issue has had no activity in 90+ days.
+- **Check for duplicates.** If you find a very similar open/closed issue, note it.
dots/pi/agent/extensions/subagent/index.ts
@@ -24,8 +24,8 @@ import { Container, Markdown, Spacer, Text } from "@mariozechner/pi-tui";
 import { Type } from "@sinclair/typebox";
 import { type AgentConfig, type AgentScope, discoverAgents } from "./agents.js";
 
-const MAX_PARALLEL_TASKS = 8;
-const MAX_CONCURRENCY = 4;
+const MAX_PARALLEL_TASKS = 16;
+const MAX_CONCURRENCY = 8;
 const COLLAPSED_ITEM_COUNT = 10;
 
 // Default provider preference order for model resolution