Analyze a GitHub issue, reproduce the bug, and write a structured analysis to .ai/issue-analysis.md.
Analyze the given GitHub issue, attempt to reproduce it, and write a structured artifact.
Read the issue (title, body, labels, comments). Determine if it's a Bug, Feature Request, Question, or Enhancement.
Once found, verify it contains the Deployment and Feature Inventory sections. If either is missing, stop and tell the developer exactly which sections are needed.
Fetch the GitHub issue using the gh CLI. The developer will provide either a full URL (e.g., https://github.com/org/repo/issues/123) or a repo and issue number.
# If given a full URL
gh issue view <URL>
# If given a repo and number
gh issue view <number> --repo <owner/repo>
# To also read comments
gh issue view <number> --repo <owner/repo> --comments
Read the issue title, body, labels, and comments from the output.
Handling attachments: The gh output will contain attachment URLs as markdown links. Issues may include images, log files, config files, JSON payloads, etc. Download and inspect any attachments that are relevant to understanding the bug:
# Download an attachment to a temp file
curl -sL "<attachment-url>" -o /tmp/<filename>
Then inspect the downloaded file based on its type:
.png, .jpg, .gif): Read the file to display it visually..log, .txt, .json, .yaml, .xml, .csv, etc.): Read the file to view content directly..zip, .tar.gz, .gz): Extract first, then inspect the contents:
unzip /tmp/<filename>.zip -d /tmp/issue-attachments/
# or: tar -xzf /tmp/<filename>.tar.gz -C /tmp/issue-attachments/
List the extracted files and read the relevant ones.Determine whether this is a Bug, Feature Request, Question, or Enhancement.
Some bugs are obvious from code inspection alone (e.g., typo in config key, null-pointer from missing null-check). If the root cause is clear without running the product, skip to Step 6.
Otherwise, proceed to Step 3.
Using agents.md > Deployment:
If setup fails, report the failure and stop — do not proceed with a broken environment.
Using agents.md > Feature Inventory, locate the feature referenced in the issue.
Search for existing unit and integration tests covering the affected code path. Note:
Create the directory .ai/ at the repo root if it doesn't exist. Write the analysis to .ai/issue-analysis.md using this exact format:
Create .ai/ at repo root if absent. Write .ai/issue-analysis.md:
# Issue Analysis — [#ID]: [Title]
## Classification
- **Type:** Bug | Not a Bug — [brief reason]
- **Severity:** Critical | High | Medium | Low
- **Affected Component(s):**
- **Affected Feature(s):**
## Reproducibility
- **Reproducible:** Yes | No | Not Attempted — [reason]
- **Environment:** [branch, runtime, OS, config]
- **Steps Executed:**
1.
- **Expected:** [what should happen]
- **Actual:** [what happened]
- **Evidence:** [logs or inline output]
## Root Cause Hypothesis
[Code-informed analysis of the likely cause]
## Test Coverage
- **Existing tests on this path:** [list + pass/fail]
- **Gaps:** [untested paths]
- **Proposed tests:** unit / integration / edge cases
Stop any started servers. Revert temp config or data changes. Leave the working tree clean.