Analyze all open GitHub issues, prioritize them, and begin systematically fixing or implementing them starting with the highest priority.
Automates GitHub issue resolution by prioritizing, triaging, and fixing bugs and enhancements in a continuous loop.
/plugin marketplace add laird/agents/plugin install autofix@plugin-marketplaceAnalyze all open GitHub issues, prioritize them, and begin systematically fixing or implementing them starting with the highest priority.
# Automatic priority-based selection (processes all issues in priority order)
/fix-github
# Target a specific issue directly (skips priority selection)
/fix-github 223
With issue number: Skips the priority selection process and immediately starts working on the specified issue, regardless of its priority label.
Without issue number: Fetches all open issues with priority labels (P0-P3) and processes them in priority order.
Never stop, just keep looking for issues to address. Priority: Triage Unprioritized > Bugs > Existing Enhancements > Proposing New Enhancements.
Note: This command automatically reviews and prioritizes any open issues that lack priority labels (P0-P3) before processing the issue queue.
When unprioritized issues are detected, review each one and assign an appropriate priority label before continuing with the fix workflow.
For each unprioritized issue:
# Assign priority to an issue
gh issue edit <ISSUE_NUMBER> --add-label "P2" # Use appropriate priority
gh issue comment <ISSUE_NUMBER> --body "š·ļø **Triage Complete**
**Priority Assigned**: P2 (Medium)
**Rationale**: [Brief explanation of why this priority was chosen]
š¤ Triaged by autonomous fix workflow"
| Indicator | P0 | P1 | P2 | P3 |
|---|---|---|---|---|
| Production impact | Critical/Down | Major degradation | Partial impact | Minimal |
| User scope | All users | Many users | Some users | Few users |
| Workaround | None | Difficult | Available | Easy |
| Data risk | Loss/corruption | Possible | Unlikely | None |
| Security | Active exploit | Vulnerability | Potential | None |
| Keywords | "crash", "down", "urgent", "security" | "broken", "fails", "blocking" | "issue", "bug", "incorrect" | "minor", "cosmetic", "enhancement" |
When UNPRIORITIZED_ISSUES_FOUND=true is detected:
UNPRIORITIZED_DATA to get issue numbers, titles, and descriptionsModel Selection for Triage: Use Haiku for straightforward triage decisions, escalate to Sonnet if the issue description is ambiguous or requires deeper analysis.
Simple Issues (direct fix):
Complex Issues (use superpowers):
When spawning agents or using the Task tool during issue resolution, select the model based on task complexity:
| Issue Type | Model | Rationale |
|---|---|---|
| Simple (P2/P3, clear fix) | Sonnet | Known patterns, documented solutions |
| Complex (P0/P1, architectural) | Opus | Deep analysis, trade-off decisions |
| Regression test analysis | Sonnet | Standard test interpretation |
| Root cause investigation | Opus | Multi-factor analysis |
| Improvement proposals | Opus | Creative problem-solving |
| Labeling & formatting | Haiku | Mechanical operations |
Start with Sonnet, escalate to Opus when:
Stay with Sonnet when:
Drop to Haiku for:
| Phase | Recommended Model |
|---|---|
| Initial complexity assessment | Sonnet |
| Simple issue: direct fix | Sonnet |
| Complex issue: systematic-debugging skill | Opus |
| Complex issue: brainstorming skill | Opus |
| Complex issue: writing-plans skill | Opus |
| Complex issue: executing-plans skill | Sonnet |
| Verification before completion | Sonnet |
| Regression test execution | Sonnet |
| Regression test analysis | Sonnet ā Opus if patterns unclear |
| Improvement proposals | Opus |
| Issue creation from failures | Haiku |
// Initial assessment - start with Sonnet
Task("analyst", "Assess complexity of issue #${ISSUE_NUM}...", model="sonnet")
// Complex root cause - use Opus
Task("debugger", "Investigate why 15 tests fail with timeout...", model="opus")
// Standard fix - use Sonnet
Task("coder", "Update package.json to fix dependency conflict...", model="sonnet")
// Label management - use Haiku
Task("labeler", "Add P2 label to issue #${ISSUE_NUM}...", model="haiku")
Start working on GitHub issues now:
# Load project-specific configuration from CLAUDE.md
if [ -f "CLAUDE.md" ]; then
echo "š Reading project configuration from CLAUDE.md"
# Check if autofix configuration exists
if ! grep -q "## Automated Testing & Issue Management" CLAUDE.md; then
echo "ā ļø No autofix configuration found in CLAUDE.md"
echo "š Adding autofix configuration section to CLAUDE.md..."
# Append autofix configuration to CLAUDE.md
cat >> CLAUDE.md << 'AUTOFIX_CONFIG'
## Automated Testing & Issue Management
This section configures the `/fix-github` command for autonomous issue resolution.
### Regression Test Suite
```bash
npm test
npm run build
Unit Tests:
E2E Tests:
Test Reports:
docs/test/regression-reports/AUTOFIX_CONFIG
echo "ā
Added autofix configuration to CLAUDE.md - please update with project-specific details"
fi
if grep -q "### Regression Test Suite" CLAUDE.md; then TEST_COMMAND=$(sed -n "/### Regression Test Suite/,/^###/{/^```bash$/n;p;}" CLAUDE.md | grep -v "^#" | grep -v "^```" | grep -v "^$" | head -1) echo "ā Regression test command: $TEST_COMMAND" else TEST_COMMAND="npm test" echo "ā ļø No regression test command found, using default: $TEST_COMMAND" fi
if grep -q "### Build Verification" CLAUDE.md; then BUILD_COMMAND=$(sed -n "/### Build Verification/,/^###/{/^```bash$/n;p;}" CLAUDE.md | grep -v "^#" | grep -v "^```" | grep -v "^$" | head -1) echo "ā Build command: $BUILD_COMMAND" else BUILD_COMMAND="npm run build" echo "ā ļø No build command found, using default: $BUILD_COMMAND" fi else echo "ā ļø No CLAUDE.md found in project, using defaults" TEST_COMMAND="npm test" BUILD_COMMAND="npm run build" fi
if [ ! -f ".github/.priority-labels-configured" ]; then echo "š·ļø Checking priority labels (one-time setup)..." EXISTING_LABELS=$(gh label list --json name --jq '.[].name' 2>/dev/null || echo "")
for label in "P0:Critical priority issue:d73a4a" "P1:High priority issue:ff9800" "P2:Medium priority issue:ffeb3b" "P3:Low priority issue:4caf50" "proposal:AI-generated proposal awaiting human approval:c5def5"; do IFS=':' read -r name desc color <<< "$label" if ! echo "$EXISTING_LABELS" | grep -qFx "$name"; then echo "Creating label: $name" gh label create "$name" --description "$desc" --color "$color" 2>/dev/null || true fi done
mkdir -p .github echo "# Priority labels configured on $(date -I)" > .github/.priority-labels-configured echo "ā Priority labels configured" fi
echo "š Checking for unprioritized issues..." gh issue list --state open --json number,title,body,labels --limit 100 > /tmp/all-open-issues.json
UNPRIORITIZED=$(cat /tmp/all-open-issues.json | python3 -c " import json, sys issues = json.load(sys.stdin) unprioritized = [i for i in issues if not any(l['name'] in ['P0','P1','P2','P3'] for l in i.get('labels',[]))] for issue in unprioritized: print(f"{issue['number']}|{issue['title']}|{issue.get('body', '')[:500]}") ")
if [ -n "$UNPRIORITIZED" ]; then UNPRIORITIZED_COUNT=$(echo "$UNPRIORITIZED" | grep -c "^" || echo "0") echo "ā ļø Found $UNPRIORITIZED_COUNT unprioritized issue(s). Reviewing and assigning priorities..." echo "" echo "UNPRIORITIZED_ISSUES_FOUND=true" echo "UNPRIORITIZED_DATA<<EOF" echo "$UNPRIORITIZED" echo "EOF" else echo "ā All open issues have priority labels assigned" fi
SPECIFIED_ISSUE="${1:-}"
if [ -n "$SPECIFIED_ISSUE" ]; then
echo "šÆ Targeting specific issue #$SPECIFIED_ISSUE" gh issue view "$SPECIFIED_ISSUE" --json number,title,body,labels > /tmp/top-issue.json 2>/dev/null
if [ $? -ne 0 ] || [ ! -s /tmp/top-issue.json ]; then echo "ā Error: Issue #$SPECIFIED_ISSUE not found or not accessible" exit 1 fi
ISSUE_PRIORITY=$(cat /tmp/top-issue.json | jq -r ' if (.labels | map(.name) | any(. == "P0")) then 0 elif (.labels | map(.name) | any(. == "P1")) then 1 elif (.labels | map(.name) | any(. == "P2")) then 2 elif (.labels | map(.name) | any(. == "P3")) then 3 else 2 end ')
ISSUE_NUM=$(cat /tmp/top-issue.json | jq -r '.number') ISSUE_TITLE=$(cat /tmp/top-issue.json | jq -r '.title') ISSUE_BODY=$(cat /tmp/top-issue.json | jq -r '.body // ""')
echo "ā Found issue #$ISSUE_NUM: $ISSUE_TITLE" else
gh issue list --state open --json number,title,body,labels --limit 100 > /tmp/all-issues.json
cat /tmp/all-issues.json | jq -r ' .[] | select( (.labels | map(.name) | any(. == "P0" or . == "P1" or . == "P2" or . == "P3")) ) | { number: .number, title: .title, body: (.body // ""), priority: ( if (.labels | map(.name) | any(. == "P0")) then 0 elif (.labels | map(.name) | any(. == "P1")) then 1 elif (.labels | map(.name) | any(. == "P2")) then 2 elif (.labels | map(.name) | any(. == "P3")) then 3 else 4 end ) } ' | jq -s 'sort_by(.priority) | .[0]' > /tmp/top-issue.json
ISSUE_NUM=$(cat /tmp/top-issue.json | jq -r '.number') ISSUE_TITLE=$(cat /tmp/top-issue.json | jq -r '.title') ISSUE_BODY=$(cat /tmp/top-issue.json | jq -r '.body') ISSUE_PRIORITY=$(cat /tmp/top-issue.json | jq -r '.priority') fi
echo "" echo "šÆ Highest Priority Issue to Fix" echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā" echo "Issue: #$ISSUE_NUM" echo "Priority: P$ISSUE_PRIORITY" echo "Title: $ISSUE_TITLE" echo "" echo "Description:" echo "$ISSUE_BODY" | head -20 echo "" echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā" echo "" echo "š Starting work on issue #$ISSUE_NUM..." echo ""
git checkout -b "fix/issue-${ISSUE_NUM}-auto" 2>/dev/null || git checkout "fix/issue-${ISSUE_NUM}-auto"
gh issue comment "$ISSUE_NUM" --body "š¤ Automated Fix Started
Starting automated fix for this issue.
Branch: `fix/issue-${ISSUE_NUM}-auto` Started: $(date)
Fix in progress..." 2>/dev/null || true
echo "ā Created branch: fix/issue-${ISSUE_NUM}-auto" echo "ā Posted GitHub comment" echo ""
## Fixing Strategy
### Step 1: Assess Complexity
Analyze the issue and determine if it's simple or complex:
**Simple Issue Indicators**:
- Description < 500 chars
- Single component/file mentioned
- Clear, specific fix described
- No test failures OR < 5 test failures
- Keywords: "hide", "timeout", "remove", "add field", "typo"
**Complex Issue Indicators**:
- Description > 1000 chars
- Multiple failing tests (>10)
- Multiple components involved
- Requires design/architecture
- Keywords: "implement", "system", "management", "integration", "~30 failures"
### Step 2A: Simple Issue - Direct Fix
For simple issues, proceed directly:
1. Read relevant code files to understand the root cause
2. Implement a complete fix (not partial)
3. Run targeted tests to verify the fix works
4. Create a git commit with the changes
5. Mark as complete
```bash
# After fixing simple issue:
git add -A
git commit -m "Fix #${ISSUE_NUM}: Brief description
Detailed explanation of what was fixed and how.
š¤ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
# Merge to main
git checkout main
git merge "fix/issue-${ISSUE_NUM}-auto" --no-edit
git branch -d "fix/issue-${ISSUE_NUM}-auto"
# Close issue
gh issue close "$ISSUE_NUM" --comment "ā
**Issue Resolved**
[Detailed explanation of fix]
**Branch**: \`fix/issue-${ISSUE_NUM}-auto\` (merged and deleted)
š¤ Auto-resolved by autonomous fix workflow"
For complex issues requiring design and planning:
1. Systematic Debugging (if bugs)
If the issue involves bugs or test failures, use the systematic-debugging skill:
Use Skill tool: superpowers:systematic-debugging
This will:
2. Brainstorming (if new features)
If the issue requires new feature design:
Use Skill tool: superpowers:brainstorming
This will:
3. Writing Plans (for implementation)
After design is complete, create implementation plan:
Use Skill tool: superpowers:writing-plans
This will:
4. Executing Plans
Execute the plan in controlled batches:
Use Skill tool: superpowers:executing-plans
This will:
5. Verification
Before claiming complete, verify the fix:
Use Skill tool: superpowers:verification-before-completion
This will:
After verification passes:
# Commit changes
git add -A
git commit -m "Fix #${ISSUE_NUM}: Brief description
Detailed multi-line explanation of:
- Root cause analysis
- Solution approach
- Changes made
- Verification results
š¤ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
# Merge to main
git checkout main
git merge "fix/issue-${ISSUE_NUM}-auto" --no-edit
git branch -d "fix/issue-${ISSUE_NUM}-auto"
# Close issue with detailed explanation
gh issue close "$ISSUE_NUM" --comment "ā
**Issue Resolved**
## Root Cause
[Detailed analysis]
## Solution
[Approach taken]
## Changes Made
[List of changes]
## Verification
[Test results and evidence]
**Branch**: \`fix/issue-${ISSUE_NUM}-auto\` (merged and deleted)
**Commit**: [commit hash]
š¤ Auto-resolved by autonomous fix workflow with superpowers"
Issue #240: TypeScript compilation errors in disabled-features
ā Direct fix: Delete broken test files
ā Verify: $BUILD_COMMAND (from CLAUDE-AUTOFIX-CONFIG.md)
ā Commit and close
Issue #222: Review Management system broken (~30 test failures)
ā Complexity detected: >30 failures, multiple components
ā Use superpowers:systematic-debugging
- Investigate root cause
- Analyze test failure patterns
- Identify common issues
ā Use superpowers:brainstorming
- Design fix approach
- Validate assumptions
ā Use superpowers:writing-plans
- Create implementation plan
- Break into tasks
ā Use superpowers:executing-plans
- Execute in batches
- Review between batches
ā Use superpowers:verification-before-completion
- Run all tests
- Confirm passing
ā Commit and close with evidence
Skip to next issue if:
Post a comment explaining why skipped:
gh issue comment "$ISSUE_NUM" --body "āļø **Skipped for Manual Review**
This issue requires [reason] and cannot be automatically resolved.
**Recommendation**: [Suggested approach]
Moving to next priority issue.
š¤ Autonomous fix workflow"
If no issues with P0-P3 labels exist, run full regression testing:
Use the /full-regression-test command to run the complete test suite:
/full-regression-test
This command will:
After /full-regression-test completes:
Check newly created issues:
# View issues created by regression test
gh issue list --label "test-failure" --state open --json number,title,labels --limit 20
After regression testing:
If regression tests pass completely (no new bug issues created), shift focus to enhancements.
IMPORTANT: Only implement enhancements that have been approved by a human (i.e., do NOT have the proposal label). AI-generated proposals require human review before implementation.
# Check for open enhancement issues that are NOT proposals (approved for implementation)
gh issue list --state open --label "enhancement" --json number,title,body,labels --limit 50 > /tmp/all-enhancements.json
# Filter out proposals - only get approved enhancements
APPROVED_ENHANCEMENTS=$(cat /tmp/all-enhancements.json | python3 -c "
import json, sys
issues = json.load(sys.stdin)
approved = [i for i in issues if not any(l['name'] == 'proposal' for l in i.get('labels', []))]
print(json.dumps(approved))
")
ENHANCEMENT_COUNT=$(echo "$APPROVED_ENHANCEMENTS" | python3 -c "import json,sys; print(len(json.load(sys.stdin)))")
if [ "$ENHANCEMENT_COUNT" -gt 0 ]; then
echo "š Found $ENHANCEMENT_COUNT approved enhancement(s) to implement"
# Get first approved enhancement
ENHANCE_NUM=$(echo "$APPROVED_ENHANCEMENTS" | python3 -c "import json,sys; print(json.load(sys.stdin)[0]['number'])")
ENHANCE_TITLE=$(echo "$APPROVED_ENHANCEMENTS" | python3 -c "import json,sys; print(json.load(sys.stdin)[0]['title'])")
ENHANCE_BODY=$(echo "$APPROVED_ENHANCEMENTS" | python3 -c "import json,sys; print(json.load(sys.stdin)[0].get('body',''))")
echo "š Working on approved enhancement #$ENHANCE_NUM: $ENHANCE_TITLE"
else
# Check if there are pending proposals
PROPOSAL_COUNT=$(cat /tmp/all-enhancements.json | python3 -c "
import json, sys
issues = json.load(sys.stdin)
proposals = [i for i in issues if any(l['name'] == 'proposal' for l in i.get('labels', []))]
print(len(proposals))
")
if [ "$PROPOSAL_COUNT" -gt 0 ]; then
echo "š Found $PROPOSAL_COUNT proposal(s) awaiting human approval"
echo "š” Use '/list-proposals' to review pending proposals"
echo "⨠No approved enhancements to implement. Creating new proposals..."
else
echo "⨠No enhancements or proposals. Creating new proposals..."
fi
# Continue to Step 5B
fi
If no enhancement issues exist, analyze the codebase and propose improvements:
First, check test coverage using the dedicated command:
/improve-test-coverage --analyze
This will identify coverage gaps and prioritize them. If coverage is below 80%, focus on improving it before other enhancements.
Then use superpowers:brainstorming to identify other valuable enhancements:
Use Skill tool: superpowers:brainstorming
Focus areas for enhancement proposals:
/improve-test-coverage to identify and fix gapsCreate Enhancement Proposal (tagged with proposal label for human review):
gh issue create \
--label "enhancement,proposal,P3" \
--title "Proposal: [Brief description]" \
--body "$(cat <<'ENHANCEMENT_BODY'
## Proposed Enhancement
[Detailed description of what this enhancement accomplishes]
## Rationale
[Why this improvement is valuable - metrics, user impact, maintainability]
## Implementation Plan
### Phase 1: [First phase]
- [ ] Task 1.1
- [ ] Task 1.2
### Phase 2: [Second phase]
- [ ] Task 2.1
- [ ] Task 2.2
### Phase 3: Verification
- [ ] Run full test suite
- [ ] Manual verification of feature
- [ ] Update documentation
## Success Criteria
- [ ] All existing tests pass
- [ ] New tests added for enhancement
- [ ] Documentation updated
- [ ] No performance regression
## Estimated Complexity
[Simple | Medium | Complex]
---
## š Proposal Status
**Status**: ā³ Awaiting Human Approval
### How to Approve This Proposal
To approve and allow automated implementation:
```bash
gh issue edit <issue_number> --remove-label "proposal"
Comment on this issue with your feedback. The AI will incorporate your suggestions when you run /refine-proposal <issue_number>.
gh issue close <issue_number> --comment "Rejected: [reason]"
š¤ Proposed by autonomous improvement workflow ENHANCEMENT_BODY )"
echo "ā Created proposal issue. Awaiting human approval before implementation." echo "š” Use '/list-proposals' to view all pending proposals"
**IMPORTANT**: After creating a proposal, do NOT automatically implement it. The workflow should continue looking for other work (bugs, approved enhancements) or create additional proposals. Proposals require explicit human approval (removal of the `proposal` label) before implementation.
#### 5C: Implement Approved Enhancement Using Superpowers
**IMPORTANT**: Only implement enhancements that do NOT have the `proposal` label. If an enhancement has the `proposal` label, it is awaiting human approval and must NOT be implemented.
For each **approved** enhancement issue (no `proposal` label), follow this workflow:
**Step 1: Create Feature Branch**
```bash
git checkout -b "enhancement/issue-${ENHANCE_NUM}-auto" 2>/dev/null || git checkout "enhancement/issue-${ENHANCE_NUM}-auto"
gh issue comment "$ENHANCE_NUM" --body "š **Enhancement Implementation Started**
Starting automated implementation of this enhancement.
**Branch**: \`enhancement/issue-${ENHANCE_NUM}-auto\`
**Started**: $(date)
Implementation in progress..."
Step 2: Design Solution with Brainstorming
Use Skill tool: superpowers:brainstorming
This will:
Step 3: Create Detailed Implementation Plan
Use Skill tool: superpowers:writing-plans
This will:
Update the GitHub issue with the implementation plan:
gh issue comment "$ENHANCE_NUM" --body "š **Implementation Plan Created**
## Detailed Implementation Plan
[Paste the implementation plan created by superpowers:writing-plans]
Beginning execution..."
Step 4: Execute the Plan
Use Skill tool: superpowers:executing-plans
This will:
Step 5: Run Tests and Verify
# Run full test suite
$TEST_COMMAND
# Capture test results
TEST_EXIT_CODE=$?
TEST_OUTPUT=$(cat /tmp/test-output.txt 2>/dev/null || echo "Test output not captured")
If Tests Pass:
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo "ā
All tests pass!"
# Use verification skill before claiming complete
# Use Skill tool: superpowers:verification-before-completion
# Commit changes
git add -A
git commit -m "Implement enhancement #${ENHANCE_NUM}: ${ENHANCE_TITLE}
Detailed explanation of:
- What was implemented
- Design decisions made
- Tests added/modified
š¤ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
# Merge to main
git checkout main
git merge "enhancement/issue-${ENHANCE_NUM}-auto" --no-edit
git branch -d "enhancement/issue-${ENHANCE_NUM}-auto"
# Close enhancement with details
gh issue close "$ENHANCE_NUM" --comment "ā
**Enhancement Implemented**
## Summary
[What was implemented]
## Changes Made
[List of changes]
## Tests
- All existing tests pass
- New tests added: [list new tests]
## Verification
[Evidence that enhancement works correctly]
**Branch**: \`enhancement/issue-${ENHANCE_NUM}-auto\` (merged and deleted)
š¤ Auto-implemented by autonomous enhancement workflow"
fi
If Tests Fail - Create Bug Issues:
if [ $TEST_EXIT_CODE -ne 0 ]; then
echo "ā Tests failed during enhancement implementation"
# Parse test failures and create issues for each
# Extract failing test names and create individual issues
gh issue create \
--label "bug,test-failure,P1" \
--title "Test failure during enhancement #${ENHANCE_NUM}: [Test name]" \
--body "$(cat <<FAILURE_BODY
## Test Failure
**Related Enhancement**: #${ENHANCE_NUM}
**Branch**: \`enhancement/issue-${ENHANCE_NUM}-auto\`
## Failing Test
\`\`\`
[Test name and location]
\`\`\`
## Error Output
\`\`\`
${TEST_OUTPUT}
\`\`\`
## Context
This test failure occurred while implementing enhancement #${ENHANCE_NUM}.
## Suggested Investigation
1. Check if enhancement changes broke existing functionality
2. Verify test expectations are still valid
3. Check for missing dependencies or setup
š¤ Created by autonomous enhancement workflow
FAILURE_BODY
)"
# Comment on enhancement issue about the failure
gh issue comment "$ENHANCE_NUM" --body "ā ļø **Implementation Blocked by Test Failures**
Test failures occurred during implementation. Bug issues have been created:
- [List created bug issue numbers]
Enhancement implementation paused. Will resume after bugs are fixed.
š¤ Autonomous enhancement workflow"
# Do NOT merge - leave branch for investigation
echo "ā ļø Enhancement branch preserved for investigation: enhancement/issue-${ENHANCE_NUM}-auto"
# Switch back to main
git checkout main
fi
Skip an enhancement and move to the next if:
gh issue comment "$ENHANCE_NUM" --body "āļø **Enhancement Skipped**
This enhancement cannot be automatically implemented because:
[Reason]
**Recommendation**: [What manual steps are needed]
Moving to next enhancement or proposing new improvements.
š¤ Autonomous enhancement workflow"
# Add 'needs-review' label
gh issue edit "$ENHANCE_NUM" --add-label "needs-review"
THIS WORKFLOW RUNS FOREVER UNTIL MANUALLY STOPPED.
After completing ANY of these actions, you MUST immediately continue:
IDLE_NO_WORK_AVAILABLE to trigger sleep cycleThe workflow follows this strict priority order:
proposal label)ā ļø NEVER automatically implement proposals. Proposals (issues with proposal label) require human approval before implementation.
After every issue is resolved, skipped, or when checking for work:
# Fetch all open issues
gh issue list --state open --json number,title,body,labels --limit 100 > /tmp/all-issues.json
# Count priority bug issues (P0-P3, excluding proposals)
PRIORITY_ISSUES=$(cat /tmp/all-issues.json | python3 -c "
import json, sys
issues = json.load(sys.stdin)
priority = [i for i in issues
if any(l['name'] in ['P0','P1','P2','P3'] for l in i.get('labels',[]))
and not any(l['name'] == 'proposal' for l in i.get('labels',[]))]
print(len(priority))
")
# Count APPROVED enhancement issues (enhancement label but NOT proposal label)
APPROVED_ENHANCEMENTS=$(cat /tmp/all-issues.json | python3 -c "
import json, sys
issues = json.load(sys.stdin)
approved = [i for i in issues
if any(l['name'] == 'enhancement' for l in i.get('labels',[]))
and not any(l['name'] == 'proposal' for l in i.get('labels',[]))]
print(len(approved))
")
# Count pending proposals
PENDING_PROPOSALS=$(cat /tmp/all-issues.json | python3 -c "
import json, sys
issues = json.load(sys.stdin)
proposals = [i for i in issues if any(l['name'] == 'proposal' for l in i.get('labels',[]))]
print(len(proposals))
")
if [ "$PRIORITY_ISSUES" -gt 0 ]; then
echo "š Found $PRIORITY_ISSUES priority bug(s). Fixing bugs first..."
# Process next bug issue (repeat from "Get highest priority issue" section)
elif [ "$APPROVED_ENHANCEMENTS" -gt 0 ]; then
echo "š No bugs! Found $APPROVED_ENHANCEMENTS approved enhancement(s). Implementing..."
# Process next approved enhancement (Step 5C)
else
echo "⨠No bugs or approved enhancements. Checking for useful proposals to create..."
# Run /full-regression-test first if not recently run
# Then brainstorm proposals using superpowers:brainstorming
# Create proposals for genuinely useful improvements
# If nothing useful to propose ā Output IDLE signal for sleep cycle
fi
proposal label (they require human approval)/full-regression-test when bug queue is empty/full-regression-testWhen truly idle (no bugs, no approved enhancements, no useful proposals to create, tests passing), output:
IDLE_NO_WORK_AVAILABLE
This signals the stop hook to sleep (default 60 minutes) before checking again for:
The only way this workflow stops is if the user manually interrupts it.
A proposal is an AI-generated enhancement suggestion that requires human review before implementation. Proposals are tagged with the proposal label and will NOT be automatically implemented.
Use the /list-proposals command to see all pending proposals:
/list-proposals
To approve a proposal for automated implementation, remove the proposal label:
gh issue edit <issue_number> --remove-label "proposal"
Once the proposal label is removed, the /fix-github workflow will automatically implement the enhancement on its next iteration.
/refine-proposal <issue_number> to have the AI incorporate your feedbackgh issue close <issue_number> --comment "Rejected: [reason for rejection]"
| Label | Meaning |
|---|---|
proposal | AI-generated, awaiting human approval |
enhancement | Describes a feature improvement |
P0-P3 | Priority level (assigned during triage) |
Note: An issue can have both proposal and enhancement labels. The proposal label is what prevents automatic implementation.
š¤ Ready to fix issue #$ISSUE_NUM! Start working on it now, then IMMEDIATELY continue to the next issue.