GitHub Issue Resolver
Autonomous agent for discovering, analyzing, and fixing open GitHub issues — with a 5-layer guardrail system.
⚠️ GUARDRAILS — Read First
Every action goes through guardrails. Before any operation:
- Load
guardrails.json config
- Validate scope (repo, branch, path)
- Check action gate (auto/notify/approve)
- Validate command against allowlist
- Log to audit trail
For guardrail details, see references/guardrails-guide.md.
Key Rules (Non-Negotiable)
- Never touch protected branches (main, master, production)
- Never modify .env, secrets, CI configs, credentials
- Never force push
- Never modify dependency files without explicit approval
- Never modify own skill/plugin files
- One issue at a time — finish or abandon before starting new
- All dangerous actions require user approval (write code, commit, push, PR)
- Everything is logged to
audit/ directory
Workflow
Phase 1 — Issue Discovery
Trigger: User provides a GitHub repository (owner/repo).
Steps:
Validate repo against guardrails:
python3 scripts/guardrails.py repo <owner> <repo>
If blocked, tell the user and stop.
Fetch, score, and present issues using the recommendation engine:
python3 scripts/recommend.py <owner> <repo>
This automatically fetches open issues, filters out PRs, scores them by severity/impact/effort/freshness, and presents a formatted recommendation.
Always use recommend.py — never manually format issue output. The script ensures consistent presentation every time.
For raw JSON (e.g., for further processing):
python3 scripts/recommend.py <owner> <repo> --json
⏹️ STOP. Wait for user to select an issue.
Phase 2 — Fixing
Trigger: User selects an issue.
Steps:
Lock the issue (one-at-a-time enforcement):
python3 scripts/guardrails.py issue_lock <owner> <repo> <issue_number>
Read full issue thread including comments.
Clone the repo (Gate: notify):
python3 scripts/sandbox.py run git clone https://github.com/<owner>/<repo>.git /tmp/openclaw-work/<repo>
Create a safe branch (Gate: auto):
python3 scripts/sandbox.py run git checkout -b fix-issue-<number>
Explore codebase — read relevant files. For each file:
python3 scripts/guardrails.py path <file_path>
Plan the fix — explain approach to user:
## Proposed Fix
- Problem: [root cause]
- Solution: [what changes]
- Files: [list of files and what changes in each]
- Estimated diff size: [lines]
⏹️ STOP. Wait for user to approve the plan before implementing.
- Implement the fix (Gate:
approve):
- Apply changes
- Check diff size:
python3 scripts/guardrails.py diff <line_count>
- Log:
python3 scripts/audit.py log_action write_code success
Phase 3 — Testing
After implementing:
Find and run tests (Gate: notify):
python3 scripts/sandbox.py run npm test # or pytest, cargo test, etc.
If tests fail AND autoRollbackOnTestFail is true:
- Revert all changes
- Notify user
- Suggest alternative approach
If no tests exist, write basic tests covering the fix.
Report results to user.
Phase 4 — Draft PR for Review (Approval REQUIRED)
⚠️ NEVER create PR automatically. Always ask first.
Do NOT dump full diffs in chat. For any non-trivial project, push the branch
and let the user review on GitHub where they get syntax highlighting, file-by-file
navigation, and inline comments.
Commit changes (Gate: approve):
python3 scripts/sandbox.py run git add .
python3 scripts/sandbox.py run git commit -m "Fix #<number>: <title>"
Show a change summary (NOT the raw diff) — keep it concise:
## Changes
- **src/models.py** — Added field validation (title length, enum checks)
- **app.py** — Added validation to POST endpoint, 400 error responses
- **tests/test_app.py** — 22 new tests covering validation rules
- 4 files changed, ~100 lines of source + ~150 lines of tests
- All tests passing ✅
Ask explicitly: "Ready to push and create a draft PR?"
Only after user says "yes" (Gate: approve):
python3 scripts/sandbox.py run git push -u origin fix-issue-<number>
python3 scripts/sandbox.py run gh pr create --draft --title "..." --body "..."
Note: PRs are always created as draft by default.
The PR body should include a detailed description of all changes, test results,
and link to the issue (Closes #N).
Share the PR link — user reviews on GitHub.
Unlock the issue:
python3 scripts/guardrails.py issue_unlock
Scripts Reference
| Script |
Purpose |
Run Without Reading |
scripts/recommend.py |
Primary entry point — fetch, score, and present issues |
✅ |
scripts/fetch_issues.py |
Raw issue fetcher (used internally by recommend.py) |
✅ |
scripts/analyze_issue.py |
Deep analysis of single issue |
✅ |
scripts/create_pr.py |
PR creation wrapper |
✅ |
scripts/guardrails.py |
Guardrail enforcement engine |
✅ |
scripts/sandbox.py |
Safe command execution wrapper |
✅ |
scripts/audit.py |
Action logger |
✅ |
References
- references/quick-reference.md — GitHub API reference, scoring rubric, test commands
- references/guardrails-guide.md — Full guardrails documentation and customization
1---2name: github-issue-resolver3description: Autonomous GitHub Issue Resolver Agent with guardrails. Use when the user wants to discover, analyze, and fix open issues in GitHub repositories. Triggers on requests like "fix GitHub issues", "resolve issues in repo", "work on GitHub bugs", or when the user provides a GitHub repository URL and asks for issue resolution. Supports the full workflow from issue discovery to PR submission with safety guardrails preventing scope creep, unauthorized access, and dangerous operations.4---56# GitHub Issue Resolver78Autonomous agent for discovering, analyzing, and fixing open GitHub issues — with a 5-layer guardrail system.910## ⚠️ GUARDRAILS — Read First1112**Every action goes through guardrails.** Before any operation:13141. Load `guardrails.json` config152. Validate scope (repo, branch, path)163. Check action gate (auto/notify/approve)174. Validate command against allowlist185. Log to audit trail1920For guardrail details, see [references/guardrails-guide.md](references/guardrails-guide.md).2122### Key Rules (Non-Negotiable)23- **Never touch protected branches** (main, master, production)24- **Never modify** .env, secrets, CI configs, credentials25- **Never force push**26- **Never modify dependency files** without explicit approval27- **Never modify own skill/plugin files**28- **One issue at a time** — finish or abandon before starting new29- **All dangerous actions require user approval** (write code, commit, push, PR)30- **Everything is logged** to `audit/` directory3132---3334## Workflow3536### Phase 1 — Issue Discovery3738**Trigger:** User provides a GitHub repository (`owner/repo`).3940**Steps:**41421. **Validate repo** against guardrails:43 ```bash44 python3 scripts/guardrails.py repo <owner> <repo>45 ```46 If blocked, tell the user and stop.47482. **Fetch, score, and present issues** using the recommendation engine:49 ```bash50 python3 scripts/recommend.py <owner> <repo>51 ```52 This automatically fetches open issues, filters out PRs, scores them by severity/impact/effort/freshness, and presents a formatted recommendation.5354 **Always use `recommend.py`** — never manually format issue output. The script ensures consistent presentation every time.5556 For raw JSON (e.g., for further processing):57 ```bash58 python3 scripts/recommend.py <owner> <repo> --json59 ```6061**⏹️ STOP. Wait for user to select an issue.**6263---6465### Phase 2 — Fixing6667**Trigger:** User selects an issue.6869**Steps:**70711. **Lock the issue** (one-at-a-time enforcement):72 ```bash73 python3 scripts/guardrails.py issue_lock <owner> <repo> <issue_number>74 ```75762. **Read full issue thread** including comments.77783. **Clone the repo** (Gate: `notify`):79 ```bash80 python3 scripts/sandbox.py run git clone https://github.com/<owner>/<repo>.git /tmp/openclaw-work/<repo>81 ```82834. **Create a safe branch** (Gate: `auto`):84 ```bash85 python3 scripts/sandbox.py run git checkout -b fix-issue-<number>86 ```87885. **Explore codebase** — read relevant files. For each file:89 ```bash90 python3 scripts/guardrails.py path <file_path>91 ```92936. **Plan the fix** — explain approach to user:94 ```95 ## Proposed Fix96 - Problem: [root cause]97 - Solution: [what changes]98 - Files: [list of files and what changes in each]99 - Estimated diff size: [lines]100 ```101102**⏹️ STOP. Wait for user to approve the plan before implementing.**1031047. **Implement the fix** (Gate: `approve`):105 - Apply changes106 - Check diff size: `python3 scripts/guardrails.py diff <line_count>`107 - Log: `python3 scripts/audit.py log_action write_code success`108109---110111### Phase 3 — Testing112113**After implementing:**1141151. **Find and run tests** (Gate: `notify`):116 ```bash117 python3 scripts/sandbox.py run npm test # or pytest, cargo test, etc.118 ```1191202. **If tests fail AND `autoRollbackOnTestFail` is true:**121 - Revert all changes122 - Notify user123 - Suggest alternative approach1241253. **If no tests exist**, write basic tests covering the fix.1261274. **Report results** to user.128129---130131### Phase 4 — Draft PR for Review (Approval REQUIRED)132133**⚠️ NEVER create PR automatically. Always ask first.**134135**Do NOT dump full diffs in chat.** For any non-trivial project, push the branch136and let the user review on GitHub where they get syntax highlighting, file-by-file137navigation, and inline comments.1381391. **Commit changes** (Gate: `approve`):140 ```bash141 python3 scripts/sandbox.py run git add .142 python3 scripts/sandbox.py run git commit -m "Fix #<number>: <title>"143 ```1441452. **Show a change summary** (NOT the raw diff) — keep it concise:146 ```147 ## Changes148 - **src/models.py** — Added field validation (title length, enum checks)149 - **app.py** — Added validation to POST endpoint, 400 error responses150 - **tests/test_app.py** — 22 new tests covering validation rules151 - 4 files changed, ~100 lines of source + ~150 lines of tests152 - All tests passing ✅153 ```1541553. **Ask explicitly:** "Ready to push and create a draft PR?"1561574. **Only after user says "yes"** (Gate: `approve`):158 ```bash159 python3 scripts/sandbox.py run git push -u origin fix-issue-<number>160 python3 scripts/sandbox.py run gh pr create --draft --title "..." --body "..."161 ```162 Note: PRs are always created as **draft** by default.163 The PR body should include a detailed description of all changes, test results,164 and link to the issue (Closes #N).1651665. **Share the PR link** — user reviews on GitHub.1671686. **Unlock the issue:**169 ```bash170 python3 scripts/guardrails.py issue_unlock171 ```172173---174175## Scripts Reference176177| Script | Purpose | Run Without Reading |178|--------|---------|---------------------|179| `scripts/recommend.py` | **Primary entry point** — fetch, score, and present issues | ✅ |180| `scripts/fetch_issues.py` | Raw issue fetcher (used internally by recommend.py) | ✅ |181| `scripts/analyze_issue.py` | Deep analysis of single issue | ✅ |182| `scripts/create_pr.py` | PR creation wrapper | ✅ |183| `scripts/guardrails.py` | Guardrail enforcement engine | ✅ |184| `scripts/sandbox.py` | Safe command execution wrapper | ✅ |185| `scripts/audit.py` | Action logger | ✅ |186187## References188189- [references/quick-reference.md](references/quick-reference.md) — GitHub API reference, scoring rubric, test commands190- [references/guardrails-guide.md](references/guardrails-guide.md) — Full guardrails documentation and customization