An AI-powered GitHub bot that automatically analyzes and fixes issues in your repositories. Download, configure, and let it run autonomously to maintain your projects.
Mr. Code Fixer is an autonomous bot that:
- 🔍 Monitors your GitHub repositories for open issues
- 🧠 Uses AI to understand what needs to be fixed
- 💡 Asks clarifying questions when uncertain
- ✏️ Creates fixes and opens pull requests
- 🧪 Runs tests before creating PRs
- 📊 Tracks API costs and session metrics
- ✅ Closes issues when confident about the solution
Think of it as a tireless contributor that works 24/7 to help maintain your codebase.
- Smart Issue Processing: Filters out vague issues, duplicates, and PRs automatically
- Multi-AI Support: Choose between ChatGPT (OpenAI), Grok (xAI), or Ollama (local)
- Confidence-Based Decisions: High confidence fixes auto-close issues; uncertain ones ask questions
- Test Execution: Automatically detects and runs tests (Go, Node.js, Python, Rust, Java, PHP)
- Cost Tracking: Shows estimated costs before processing multiple issues
- Session Analytics: Tracks API calls, costs, PRs created, and questions asked
- Beautiful UI: Colored output with emojis and progress indicators
Get the latest release for your platform from the releases page:
mr-code-fixer_Windows_x86_64.zip- Windowsmr-code-fixer_Linux_x86_64.tar.gz- Linux (Intel/AMD)mr-code-fixer_Linux_arm64.tar.gz- Linux (ARM)mr-code-fixer_Darwin_x86_64.tar.gz- macOS (Intel)mr-code-fixer_Darwin_arm64.tar.gz- macOS (Apple Silicon)
Run the bot for the first time:
./mr-code-fixerIt will guide you through interactive setup:
- GitHub Repository: Which repo should the bot help fix?
- GitHub Token: Your personal access token (see below)
- AI Service: Choose ChatGPT, Grok, or local Ollama
- Working Directory: Where to clone repos (defaults to
~/.mr-code-fixer/workspace)
Configuration is saved in ~/.mr-code-fixer.json for future runs.
The bot will:
- Show all open issues
- Let you select which one to fix
- Analyze the issue with AI
- Either ask questions (if uncertain) or create a PR (if confident)
Run manually whenever you want help with issues:
./mr-code-fixerSet up the bot to run periodically:
Windows (Task Scheduler):
# Run every 6 hours
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Hours 6)
$action = New-ScheduledTaskAction -Execute "C:\path\to\mr-code-fixer.exe"
Register-ScheduledTask -TaskName "Mr Code Fixer" -Trigger $trigger -Action $actionLinux/macOS (cron):
# Add to crontab (runs every 6 hours)
0 */6 * * * cd /path/to && ./mr-code-fixerDocker:
FROM golang:1.21-alpine
WORKDIR /app
COPY . .
RUN go build -o mr-code-fixer
CMD ["./mr-code-fixer"]For a true "bot experience":
- Create a new GitHub account (e.g.,
my-code-fixer-bot) - Set up a nice bot profile (avatar, bio: "🤖 Automated code fixer")
- Generate a PAT from the bot account
- Invite the bot as a collaborator to your repos
- Run Mr. Code Fixer with the bot's token
Now all PRs and comments will appear from the bot account!
Create a token at https://github.com/settings/tokens with these permissions:
Fine-grained token (recommended):
- Repository access: Select repositories you want the bot to help with
- Permissions:
- Contents: Read and write
- Issues: Read and write
- Pull requests: Read and write
- Metadata: Read-only
Classic token:
repo(full control)
Choose one of three AI providers:
- Get API Key: https://platform.openai.com/api-keys
- Models: gpt-4o, gpt-4-turbo, gpt-3.5-turbo
- Cost: Pay-per-use (check OpenAI pricing)
- Get API Key: https://x.ai
- Models: grok-3, grok-4-fast-reasoning, grok-code-fast-1
- Cost: Pay-per-use (check xAI pricing)
- Install: https://ollama.ai
- Models: llama2, codellama, deepseek-coder (free, runs on your machine)
- Cost: Free, but uses your compute resources
- Setup:
ollama pull codellamathen select in the bot
The bot assesses its confidence before acting:
High Confidence ✅
- Creates PR with the fix
- Adds comment to issue
- Automatically closes the issue
Medium/Low Confidence
- Creates PR with warnings
- Leaves issue open for human review
Needs More Info ❓
- Posts questions as issue comments
- Waits for human clarification
- Does NOT create a PR
The bot creates descriptive branches:
fix/1-app-crashes-on-startupfix/23-typo-in-documentationfix/5-where-is-documentation
Issue #5: "App crashes on startup"
↓
Bot analyzes code + issue description
↓
AI analyzes and creates fix
↓
Bot detects test command (e.g., "go test")
↓
Runs tests after applying changes
├─ Tests pass → Creates PR, closes issue
└─ Tests fail → Rolls back, reports error
After processing issues, the bot shows a summary:
╔══════════════════════════════════════════════════════════════╗
║ 📊 Session Summary ║
╚══════════════════════════════════════════════════════════════╝
⏱ Duration: 2m 34s
🤖 AI Calls: 5
💰 Estimated Cost: $0.005
📝 Issues Handled: 3
🔀 PRs Created: 2
❓ Questions Asked: 1
When fixing multiple issues, you'll see cost estimates first:
💰 Estimated cost for 10 issues: ~$0.015 (15 AI calls @ $0.001 each)
⚠️ Note: Processing multiple issues will incur API costs
Fix all 10 issues? (yes/no) [no]:
The bot saves settings in ~/.mr-code-fixer.json. You can edit this directly:
{
"github_token": "ghp_xxxxx",
"repo_owner": "yourusername",
"repo_name": "yourrepo",
"ai_service": "grok",
"ai_api_key": "xai-xxxxx",
"ai_model": "grok-code-fast-1",
"work_dir": "/home/user/.mr-code-fixer/workspace"
}To use the bot with multiple repos, either:
- Run it interactively and change the repo each time
- Create separate config files and use:
./mr-code-fixer --config /path/to/config.json - Set up separate bot instances with different working directories
Mr. Code Fixer automatically detects and runs tests for:
| Language/Framework | Detection | Command |
|---|---|---|
| Node.js | package.json | npm test |
| Go | go.mod | go test ./... |
| Python | requirements.txt, setup.py | python -m pytest |
| Rust | Cargo.toml | cargo test |
| Java (Maven) | pom.xml | mvn test |
| Java (Gradle) | build.gradle | gradle test |
| PHP | composer.json | php vendor/bin/phpunit |
If no tests are found, the bot proceeds without test validation and notes this in the PR.
- Go 1.21 or higher
- Git
git clone https://github.com/pefman/Mr-Code-Fixer.git
cd Mr-Code-Fixer
go build -o mr-code-fixergit tag -a v0.2.0 -m "Release v0.2.0"
git push origin v0.2.0
goreleaser release --clean- Quality depends on AI: The bot is only as good as the AI model you choose
- Complex issues: May require human intervention or clarification
- No testing: The bot cannot run tests (yet) - always review PRs before merging
- API limits: Respects GitHub API rate limits (5000 requests/hour for authenticated)
- Cost awareness: ChatGPT and Grok are paid services - monitor your usage
- File limit: Analyzes up to 30 most relevant files per issue to keep AI context manageable
The bot works best with well-written issues. Here are examples:
Title: Login button not working in src/components/Auth/LoginForm.tsx
Description:
The login button on the login page doesn't submit the form when clicked.
File: src/components/Auth/LoginForm.tsx
Line: Around line 45
Expected: Clicking "Login" should call handleSubmit() and send credentials to API
Actual: Nothing happens when clicking the button
Error in console:
TypeError: Cannot read property 'submit' of undefinedWhy this works:
- ✅ Mentions exact file path:
src/components/Auth/LoginForm.tsx - ✅ Describes expected vs actual behavior
- ✅ Includes error message
- ✅ Specifies approximate location (line 45)
Title: Database connection failing in api/db.go
The app crashes on startup with "connection refused" error.
I think the issue is in api/db.go where we initialize the database pool.Why this works:
- ✅ Mentions file:
api/db.go - ✅ Clear error description
- ✅ Hints at the problem area
Title: Typo in documentation
README.md has wrong command - it says `npm start` but should be `npm run dev`Why this works:
- ✅ Mentions file:
README.md - ✅ Clear what needs to change
⚠️ Simple fix, bot will handle confidently
Title: App doesn't work
Something is broken. Please fix it.Why this fails:
- ❌ No file mentioned
- ❌ No error description
- ❌ No context about what "doesn't work" means
- Bot response: Will ask clarifying questions in the issue
- Mention files explicitly: Use backticks for file paths:
src/utils/helper.js - Include error messages: Copy-paste actual errors from console/logs
- Describe expected behavior: What should happen vs what actually happens
- Add context: Environment, steps to reproduce, related files
- Use keywords: Words like "login", "database", "api" help the bot find relevant files
The bot uses smart file selection:
- Explicit mentions: Files mentioned in the issue get highest priority
- Keyword matching: Finds files with issue keywords in their path
- Relevance scoring: Ranks files by how likely they are related
- Limit: Analyzes top 30 most relevant files (not entire codebase)
Example: Issue mentions "login problem" → Bot prioritizes:
- Files explicitly mentioned:
auth/login.js - Files with "login" in path:
components/LoginForm.tsx,services/loginService.js - Files with "auth" in path:
middleware/auth.js - Common entry points:
index.js,main.go,app.py
- Write clear issues: Mention file paths and include error messages
- Start with simple issues: Test the bot on documentation or simple bugs first
- Review PRs carefully: Always review before merging, especially for critical code
- Use labels: Consider only letting the bot handle issues labeled "auto-fix" or "good-first-issue"
- Monitor costs: If using paid AI services, track your API usage
- One issue per problem: Don't bundle multiple unrelated problems in one issue
Contributions welcome! Areas for improvement:
- Add automated testing before creating PRs
- Implement GitHub App for easier installation
- Add webhook listener for real-time responses
- Support for more AI providers
- Better code context understanding
- Issue priority/labeling system
MIT License - See LICENSE file for details.
Built with Go and AI. Zero external dependencies beyond the standard library.
Need help? Open an issue or check existing issues for common problems and solutions.